diff --git a/custom-plugins/excel_report_email_scheduler/CHANGELOG.md b/custom-plugins/excel_report_email_scheduler/CHANGELOG.md new file mode 100644 index 00000000..9d63e78d --- /dev/null +++ b/custom-plugins/excel_report_email_scheduler/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 (Unreleased) + +Initial release. diff --git a/custom-plugins/msupply-dashboard-app/backend/LICENSE b/custom-plugins/excel_report_email_scheduler/LICENSE similarity index 100% rename from custom-plugins/msupply-dashboard-app/backend/LICENSE rename to custom-plugins/excel_report_email_scheduler/LICENSE diff --git a/custom-plugins/excel_report_email_scheduler/MANIFEST.txt b/custom-plugins/excel_report_email_scheduler/MANIFEST.txt new file mode 100644 index 00000000..51ccd246 --- /dev/null +++ b/custom-plugins/excel_report_email_scheduler/MANIFEST.txt @@ -0,0 +1,57 @@ + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +{ + "manifestVersion": "2.0.0", + "signatureType": "private", + "signedByOrg": "msupplyfoundation", + "signedByOrgName": "msupplyfoundation", + "rootUrls": [ + "https://demo-board.msupply.org:3000/", + "https://png.msupply.org:3000/", + "https://ci.msupply.org:3000/", + "https://liberia.msupply.org:3000/", + "https://tonga-vax.msupply.org:3000/", + "https://timor.msupply.org:3000/", + "http://localhost:3000/", + "https://vanuatu-vax.msupply.org:3000/", + "https://tokelau.msupply.org:3000/", + "https://tonga.msupply.org:3000/", + "https://who-demo.msupply.org:3000/", + "https://msupply.health.gov.ws:3000/", + "https://fijimoh.msupply.org:3000/" + ], + "plugin": "msupplyfoundation-datasource", + "version": "2.1.1", + "time": 1663332823487, + "keyId": "7e4d0c6a708866e7", + "files": { + "gpx_excel_report_email_scheduler_darwin_amd64": "922de6a3205ac938241d11dcf9d199e29444c9348d10bab573cc7f12d17f259c", + "gpx_excel_report_email_scheduler_linux_arm": "beb3c0c30189ef899480780902400940533644bf63052b9ea5fdd6deb69de33f", + "gpx_excel_report_email_scheduler_linux_amd64": "eea39e3d0433dcfa7818c87efbdc1cb8d4a6ea467a826703fee2e781abcc5e22", + "locales/en.json": "026c96637f6d20d8c8890833355e61bfa63aac987d7efd17b8b8671019805f78", + "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", + "CHANGELOG.md": "aaa78be4710ef41d56ddab1edbd180ef9f9adfea2f293109aae925dc33a1b9b3", + "module.js.LICENSE.txt": "d4a7e197c25f0eb9176e26557c5f18e8cfc11a3fbd9a01106e79bae11fb7d0b8", + "module.js.map": "fa55d2021effcafe4b12cb1dca16be0beb3fe3a8c4bf41df1959e8817a064a21", + "plugin.json": "7927607f26ce48dd4dfa7831d2cab7b36c333f886a7541c794c43580a9926854", + "README.md": "9cd4dd25cee303062ec4ff6d90eec32ed3893351ae1646d5dc77c27801bc6d8b", + "img/msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2", + "gpx_excel_report_email_scheduler_linux_arm64": "baf4071df0aff28f09b9f5438fec4c19e2755f97d0a3445e9d340a6478758161", + "module.js": "f38ac6a569bded89bcd05d5da6835313daae77b65cb27660c61f39b5a632c9a3", + "gpx_excel_report_email_scheduler_darwin_arm64": "64f83e17fa0b7453662c813f15b516a1f1d5b5ead5b92a5b7d95d3494d5deff8", + "gpx_excel_report_email_scheduler_windows_amd64.exe": "ea2fc954fd4c6e703010fb8ad4f118434d6ee6513f76840a106e9355d17d8e03" + } +} +-----BEGIN PGP SIGNATURE----- +Version: OpenPGP.js v4.10.10 +Comment: https://openpgpjs.org + +wrcEARMKAAYFAmMkcdcAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq +cIhm5161AgY9P5LTZvpXcamVkUym8ZOhquqaF0ay8K/57YrhypOWxcZ2Fo3K +unk0snfuWJEnwOso9iQgA3E416ubI09LnB6qkAII27gX0rE5TOOog2ufJQPA +gW8D0kLvA18JLGf0pOm1Sdy5crTcOTWUSaJ7G2E1qxCLJ7mI9upK5IknwJCz +YSiRSr4= +=RTQR +-----END PGP SIGNATURE----- diff --git a/custom-plugins/excel_report_email_scheduler/README.md b/custom-plugins/excel_report_email_scheduler/README.md new file mode 100644 index 00000000..e6737cb6 --- /dev/null +++ b/custom-plugins/excel_report_email_scheduler/README.md @@ -0,0 +1,66 @@ +# mSupply Dashboard: Excel report e-mail scheduler + +The Open mSupply Dashboard Excel report e-mail scheduler plugin which takes data from panels of mSupply dashboard to generate excel reports. + +The reports are then emailed to a custom user report group, this report group is curated from the list of mSupply users, pulled from mSupply Dashboard's datasource. + +The timing of the scheduler can be set in the plugin. + +The app plugin is built with Golang as backend and react as frontend. + +## How it works + +The plugin has three main pages + +- [Configuration](./docs/configuration.md) +- [Report Groups](./docs/report-groups.md) +- [Schedules](./docs/schedule.md) + +Once a schedule is created it will run automatically on the date and time specified in the schedule options on the interval specified. + +## Requirements + +- Golang version 1.16 or above + - [Mage build tool](https://magefile.org/) +- Node.JS version 16 or above +- Grafana version 8 (Not required if you are using Docker, it will install this for you in a container) +- Yarn +- If you are using Docker for development the files are moved automatically, just have to rename the `msupply_example.db` file. + - You must have `msupply.db` database in the designated grafana `plugins/data` folder. We have included an empty `msupply_example.db` file in the `plugins/data` folder in this repo. Rename it to `msupply.db` and add it to your Grafana installation's `plugins/data` folder. Please do not skip this as the plugin would not work without this database file. + - You must have `template.xlsx` file in the designated grafana `plugins/data` folder. We have included a `template.xlsx` file in the `plugins/data` folder in this repo, add it to your Grafana installation's `plugins/data` folder. Please do not skip this as the plugin would not work without this template file. + +## Installation instructions + +### Development + +If you want to develop and change this plugin's file, you can install the plugin in your system through one if the two routes explained below. + +The Docker route need docker installed in your system along with Node.js, Golang and yarn but it gives you fresh grafana install. It will also auto-setup grafana for you (to some extent) so it is the recommended path. + +- [Docker development installation (recommended)](./docs/developers-docker-recommended-build.md) +- [Normal development installation](./docs/normal-installation.md) + +## Build for Production + +- Do everything instructed in the Development section above. +- Now it's time to build for Production + - Do `mage clean` to delete the dist folder. A fresh start. + - Do `mage -v` to build for all platforms + - Do `mage build:windows` if you want to build for Windows only + - Do `mage build:linuxARM64` if you want to build for Linux only + - Do `yarn build:frontend` to build the Javascript parts + - Do `yarn sign` to sign the plugin. + - Note: You would need a GRAFANA_API_KEY to sing the plugin. + - Also you would need to add the url of the site you are deploying to, in the sites in `sign` script, in package.json before building. + - Once you have signed the plugin you cannot change the content of the plugin folder (dist). Any add, edit or deletion of files in the folder would render the plugin invalid and it would not work in Grafana. + - If you want to use the signed plugin in development mode but you have not been abled to, there is manifest file that gets generated when the plugin is singed. That file must be deleted if you want to use the plugin unsigned for development. +- Alternatively, if you do `yarn build`, it will run all of the above commands for you. (I just wanted to explain what this will do to you.) + +## Migrating from v1 + +- The plugin expect Grafana v8 to be installed in your system. +- Please make sure you have created the mSupply dashboard datasource, without it this plugin would not work. +- Please make sure the mSupply.db SQLite database and Template.xlsx files is in the expected path `plugins/data` +- The Settings have changed slightly so you might have to re-enter them for the plugin to work. If you see errors, make sure you have reentered the plugin settings. +- If you are using legacy `mSupply.db`, please update the data type of `ReportContent.lookback` field to `TEXT`. Previously it was `INTEGER`. If you are using older content, you might have to re-select Lookups from Panel variables form fields, in Scheduler edit page. +- The remain data stays unchanged so you can use the legacy database with newer version of the plugin. diff --git a/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_amd64 b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_amd64 new file mode 100755 index 00000000..80a67174 Binary files /dev/null and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_amd64 differ diff --git a/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_arm64 b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_arm64 new file mode 100755 index 00000000..a1d3d17d Binary files /dev/null and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_darwin_arm64 differ diff --git a/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_amd64 b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_amd64 new file mode 100755 index 00000000..2af18d11 Binary files /dev/null and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_amd64 differ diff --git a/release/data/plugins/msupply-dashboard-app/backend/gpx_msupply-datasource_windows_amd64.exe b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm old mode 100644 new mode 100755 similarity index 57% rename from release/data/plugins/msupply-dashboard-app/backend/gpx_msupply-datasource_windows_amd64.exe rename to custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm index bf2cc629..0201648e Binary files a/release/data/plugins/msupply-dashboard-app/backend/gpx_msupply-datasource_windows_amd64.exe and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm differ diff --git a/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm64 b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm64 new file mode 100755 index 00000000..77fe9c84 Binary files /dev/null and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_linux_arm64 differ diff --git a/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_windows_amd64.exe b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_windows_amd64.exe new file mode 100755 index 00000000..3608627e Binary files /dev/null and b/custom-plugins/excel_report_email_scheduler/gpx_excel_report_email_scheduler_windows_amd64.exe differ diff --git a/custom-plugins/msupply-dashboard-app/backend/msupply_light_icon.svg b/custom-plugins/excel_report_email_scheduler/img/msupply_light_icon.svg similarity index 100% rename from custom-plugins/msupply-dashboard-app/backend/msupply_light_icon.svg rename to custom-plugins/excel_report_email_scheduler/img/msupply_light_icon.svg diff --git a/custom-plugins/msupply-dashboard-app/frontend/common/translations/en.json b/custom-plugins/excel_report_email_scheduler/locales/en.json similarity index 96% rename from custom-plugins/msupply-dashboard-app/frontend/common/translations/en.json rename to custom-plugins/excel_report_email_scheduler/locales/en.json index 87399df0..713be25d 100644 --- a/custom-plugins/msupply-dashboard-app/frontend/common/translations/en.json +++ b/custom-plugins/excel_report_email_scheduler/locales/en.json @@ -45,6 +45,13 @@ "monthly": "Monthly", "quarterly": "Quarterly", "yearly": "Yearly", + "monday": "Monday", + "tuesday": "Tuesday", + "wednesday": "Wednesday", + "thursday": "Thursday", + "friday": "Friday", + "saturday": "Saturday", + "sunday": "Sunday", "report_group": "Report group", "report_interval": "Report interval", "report_interval_description": "The interval frequency for emails to be sent", diff --git a/custom-plugins/excel_report_email_scheduler/module.js b/custom-plugins/excel_report_email_scheduler/module.js new file mode 100644 index 00000000..7833a91c --- /dev/null +++ b/custom-plugins/excel_report_email_scheduler/module.js @@ -0,0 +1,3 @@ +/*! For license information please see module.js.LICENSE.txt */ +define(["@grafana/data","react","react-dom","@grafana/runtime","react-router-dom","@grafana/ui","@emotion/css","moment"],((e,t,r,n,a,i,o,s)=>(()=>{var u=[e=>{"use strict";e.exports=t},e=>{"use strict";e.exports=i},e=>{"use strict";e.exports=o},(e,t,r)=>{"use strict";r.d(t,{QueryClient:()=>n.QueryClient,QueryClientProvider:()=>a.QueryClientProvider,useMutation:()=>a.useMutation,useQuery:()=>a.useQuery});var n=r(18);r.o(n,"QueryClientProvider")&&r.d(t,{QueryClientProvider:function(){return n.QueryClientProvider}}),r.o(n,"useMutation")&&r.d(t,{useMutation:function(){return n.useMutation}}),r.o(n,"useQuery")&&r.d(t,{useQuery:function(){return n.useQuery}});var a=r(16)},(e,t,r)=>{"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}n(r(9));var a=n(r(0)),i=n(r(23)),o=n(r(11)),s=n(r(24)),u=n(r(25)),l=n(r(14));r(15);for(var c=n(r(5)),d=["AFN","EUR","ALL","DZD","USD","AOA","XCD","ARS","AMD","AWG","AUD","AZN","BSD","BHD","BDT","BBD","BYN","BZD","XOF","BMD","INR","BTN","BOB","BOV","BAM","BWP","NOK","BRL","BND","BGN","BIF","CVE","KHR","XAF","CAD","KYD","CLP","CLF","CNY","COP","COU","KMF","CDF","NZD","CRC","HRK","CUP","CUC","ANG","CZK","DKK","DJF","DOP","EGP","SVC","ERN","ETB","FKP","FJD","XPF","GMD","GEL","GHS","GIP","GTQ","GBP","GNF","GYD","HTG","HNL","HKD","HUF","ISK","IDR","XDR","IRR","IQD","ILS","JMD","JPY","JOD","KZT","KES","KPW","KRW","KWD","KGS","LAK","LBP","LSL","ZAR","LRD","LYD","CHF","MOP","MKD","MGA","MWK","MYR","MVR","MRO","MUR","XUA","MXN","MXV","MDL","MNT","MAD","MZN","MMK","NAD","NPR","NIO","NGN","OMR","PKR","PAB","PGK","PYG","PEN","PHP","PLN","QAR","RON","RUB","RWF","SHP","WST","STD","SAR","RSD","SCR","SLL","SGD","XSU","SBD","SOS","SSP","LKR","SDG","SRD","SZL","SEK","CHE","CHW","SYP","TWD","TJS","TZS","THB","TOP","TTD","TND","TRY","TMT","UGX","UAH","AED","USN","UYU","UYI","UZS","VUV","VEF","VND","YER","ZMW","ZWL","XBA","XBB","XBC","XBD","XTS","XXX","XAU","XPD","XPT","XAG"],f={},p=0;p=0&&d.indexOf(">")>=0&&(d=o(d)),t[c]=d}try{return new i(u,a,s).format(t)}catch(t){return this.options.warningHandler("react-intl-universal format message failed for key='"+e+"'.",t.message),u}}},{key:"getHTML",value:function(e,t){if(this.options.intlGetHook)try{this.options.intlGetHook(e,this.options.currentLocale)}catch(e){console.log("intl get hook error: ",e)}var r=this.get(e,t);if(r){var n=a.createElement("span",{dangerouslySetInnerHTML:{__html:r}}),i=function(){return n};return Object.assign({defaultMessage:i,d:i},n)}return""}},{key:"formatMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.get(r,t).defaultMessage(n)}},{key:"formatHTMLMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.getHTML(r,t).defaultMessage(n)}},{key:"determineLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getLocaleFromURL(e)||this.getLocaleFromCookie(e)||this.getLocaleFromLocalStorage(e)||this.getLocaleFromBrowser()}},{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(e.currentLocale,"options.currentLocale is required"),l(e.locales,"options.locales is required"),Object.assign(this.options,e),this.options.formats=Object.assign({},this.options.formats,h),new Promise((function(e,t){e()}))}},{key:"getInitOptions",value:function(){return this.options}},{key:"load",value:function(e){c(this.options.locales,e)}},{key:"getLocaleFromCookie",value:function(e){var t=e.cookieLocaleKey;if(t){var r=s.parse(document.cookie);return r&&r[t]}}},{key:"getLocaleFromLocalStorage",value:function(e){var t=e.localStorageLocaleKey;if(t&&window.localStorage)return localStorage.getItem(t)}},{key:"getLocaleFromURL",value:function(e){var t=e.urlLocaleKey;if(t){var r=location.search.split("?");if(r.length>=2){var n=u.parse(r[1]);return n&&n[t]}}}},{key:"getDescendantProp",value:function(e,t){return e[t]?e[t]:t.split(".").reduce((function(e,t){return null!=e?e[t]:e}),e)}},{key:"getLocaleFromBrowser",value:function(){return navigator.language||navigator.userLanguage}}]),e}();e.exports=new v,e.exports.ReactIntlUniversal=v},(e,t,r)=>{e=r.nmd(e);var n="__lodash_hash_undefined__",a=9007199254740991,i="[object Arguments]",o="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,c={};c["[object Float32Array]"]=c["[object Float64Array]"]=c["[object Int8Array]"]=c["[object Int16Array]"]=c["[object Int32Array]"]=c["[object Uint8Array]"]=c["[object Uint8ClampedArray]"]=c["[object Uint16Array]"]=c["[object Uint32Array]"]=!0,c[i]=c["[object Array]"]=c["[object ArrayBuffer]"]=c["[object Boolean]"]=c["[object DataView]"]=c["[object Date]"]=c["[object Error]"]=c[o]=c["[object Map]"]=c["[object Number]"]=c[s]=c["[object RegExp]"]=c["[object Set]"]=c["[object String]"]=c["[object WeakMap]"]=!1;var d="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,f="object"==typeof self&&self&&self.Object===Object&&self,p=d||f||Function("return this")(),h=t&&!t.nodeType&&t,m=h&&e&&!e.nodeType&&e,v=m&&m.exports===h,g=v&&d.process,y=function(){try{return m&&m.require&&m.require("util").types||g&&g.binding&&g.binding("util")}catch(e){}}(),b=y&&y.isTypedArray;function w(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)}var E,S,O,D=Array.prototype,x=Function.prototype,P=Object.prototype,k=p["__core-js_shared__"],A=x.toString,C=P.hasOwnProperty,j=(E=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",T=P.toString,_=A.call(Object),R=RegExp("^"+A.call(C).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F=v?p.Buffer:void 0,I=p.Symbol,L=p.Uint8Array,M=(F&&F.allocUnsafe,S=Object.getPrototypeOf,O=Object,function(e){return S(O(e))}),N=Object.create,z=P.propertyIsEnumerable,U=D.splice,q=I?I.toStringTag:void 0,B=function(){try{var e=ue(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Q=F?F.isBuffer:void 0,V=Math.max,G=Date.now,H=ue(p,"Map"),Z=ue(Object,"create"),K=function(){function e(){}return function(t){if(!we(t))return{};if(N)return N(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function W(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1},$.prototype.set=function(e,t){var r=this.__data__,n=te(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new W,map:new(H||$),string:new W}},Y.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},Y.prototype.get=function(e){return se(this,e).get(e)},Y.prototype.has=function(e){return se(this,e).has(e)},Y.prototype.set=function(e,t){var r=se(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},X.prototype.clear=function(){this.__data__=new $,this.size=0},X.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},X.prototype.get=function(e){return this.__data__.get(e)},X.prototype.has=function(e){return this.__data__.has(e)},X.prototype.set=function(e,t){var r=this.__data__;if(r instanceof $){var n=r.__data__;if(!H||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Y(n)}return r.set(e,t),this.size=r.size,this};function ne(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?function(e){var t=C.call(e,q),r=e[q];try{e[q]=void 0;var n=!0}catch(e){}var a=T.call(e);return n&&(t?e[q]=r:delete e[q]),a}(e):function(e){return T.call(e)}(e)}function ae(e){return Ee(e)&&ne(e)==i}function ie(e,t,r,n,a){e!==t&&function(e,t,r){for(var n=-1,a=Object(e),i=r(e),o=i.length;o--;){var s=i[++n];if(!1===t(a[s],s,a))break}}(t,(function(i,o){if(a||(a=new X),we(i))!function(e,t,r,n,a,i,o){var u=de(e,r),l=de(t,r),c=o.get(l);if(c)J(e,r,c);else{var d,f,p,h,m,v=i?i(u,l,r+"",e,t,o):void 0,g=void 0===v;if(g){var y=me(l),b=!y&&ge(l),w=!y&&!b&&Se(l);v=l,y||b||w?me(u)?v=u:Ee(m=u)&&ve(m)?v=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(oe);function pe(e,t){return e===t||e!=e&&t!=t}var he=ae(function(){return arguments}())?ae:function(e){return Ee(e)&&C.call(e,"callee")&&!z.call(e,"callee")},me=Array.isArray;function ve(e){return null!=e&&be(e.length)&&!ye(e)}var ge=Q||function(){return!1};function ye(e){if(!we(e))return!1;var t=ne(e);return t==o||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function we(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ee(e){return null!=e&&"object"==typeof e}var Se=b?function(e){return function(t){return e(t)}}(b):function(e){return Ee(e)&&be(e.length)&&!!c[ne(e)]};function Oe(e){return ve(e)?function(e,t){var r=me(e),n=!r&&he(e),a=!r&&!n&&ge(e),i=!r&&!n&&!a&&Se(e),o=r||n||a||i,s=o?function(e,t){for(var r=-1,n=Array(e);++r1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(a=De.length>3&&"function"==typeof a?(n--,a):void 0,i&&function(e,t,r){if(!we(r))return!1;var n=typeof t;return!!("number"==n?ve(r)&&le(t,r.length):"string"==n&&t in r)&&pe(r[t],e)}(t[0],t[1],i)&&(a=n<3?void 0:a,n=1),e=Object(e);++r{"use strict";e.exports=n},e=>{"use strict";e.exports=a},t=>{"use strict";t.exports=e},(e,t,r)=>{r.g.IntlPolyfill=r(10),r(22),r.g.Intl||(r.g.Intl=r.g.IntlPolyfill,r.g.IntlPolyfill.__applyLocaleSensitivePrototypes()),e.exports=r.g.IntlPolyfill},(e,t,r)=>{"use strict";var n,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=(n="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,function(e,t,r,a){var i=e&&e.defaultProps,o=arguments.length-3;if(t||0===o||(t={}),t&&i)for(var s in i)void 0===t[s]&&(t[s]=i[s]);else t||(t=i||{});if(1===o)t.children=a;else if(o>1){for(var u=Array(o),l=0;l=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},possibleConstructorReturn:function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},selfGlobal:l,set:function e(t,r,n,a){var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);null!==o&&e(o,r,n,a)}else if("value"in i&&i.writable)i.value=n;else{var s=i.set;void 0!==s&&s.call(a,n)}return n},slicedToArray:function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},slicedToArrayLoose:function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e)){for(var r,n=[],a=e[Symbol.iterator]();!(r=a.next()).done&&(n.push(r.value),!t||n.length!==t););return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},taggedTemplateLiteral:function(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},taggedTemplateLiteralLoose:function(e,t){return e.raw=t,e},temporalRef:function(e,t,r){if(e===r)throw new ReferenceError(t+" is not defined - temporal dead zone");return e},temporalUndefined:{},toArray:function(e){return Array.isArray(e)?e:Array.from(e)},toConsumableArray:function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t="a"&&r<="z"&&(e=e.slice(0,t)+r.toUpperCase()+e.slice(t+1))}return e}function N(e){return!!T.test(e)&&!_.test(e)&&!R.test(e)}function z(e){for(var t=void 0,r=void 0,n=1,a=(r=(e=e.toLowerCase()).split("-")).length;n1&&(t.sort(),e=e.replace(RegExp("(?:"+F.source+")+","i"),w.call(t,""))),p.call(L.tags,e)&&(e=L.tags[e]);for(var i=1,o=(r=e.split("-")).length;i-1)return r;var n=r.lastIndexOf("-");if(n<0)return;n>=2&&"-"===r.charAt(n-2)&&(n-=2),r=r.substring(0,n)}}function V(e,t){for(var r=0,n=t.length,a=void 0,i=void 0,o=void 0;r2){var S=s[E+1];-1!==w.call(g,S)&&(b="-"+v+"-"+(y=S))}else-1!==w(g,"true")&&(y="true")}if(p.call(r,"[["+v+"]]")){var O=r["[["+v+"]]"];-1!==w.call(g,O)&&O!==y&&(y=O,b="")}c["[["+v+"]]"]=y,d+=b,f++}if(d.length>2){var D=o.indexOf("-x-");if(-1===D)o+=d;else{var P=o.substring(0,D),k=o.substring(D);o=P+d+k}o=z(o)}return c["[[locale]]"]=o,c}function H(e,t){for(var r=t.length,n=new P,a=0;an)throw new RangeError("Value is not a number or outside accepted range");return Math.floor(i)}return a}var $={};Object.defineProperty($,"getCanonicalLocales",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=B(e),r=[],n=t.length,a=0;ai;i++){var o=r[i],s={};s.type=o["[[type]]"],s.value=o["[[value]]"],n[a]=s,a+=1}return n}function re(e,t){var r=j(e),n=r["[[dataLocale]]"],a=r["[[numberingSystem]]"],i=O.NumberFormat["[[localeData]]"][n],o=i.symbols[a]||i.symbols.latn,s=void 0;!isNaN(t)&&t<0?(t=-t,s=r["[[negativePattern]]"]):s=r["[[positivePattern]]"];for(var u=new P,l=s.indexOf("{",0),c=0,d=0,f=s.length;l>-1&&ld){var h=s.substring(d,l);b.call(u,{"[[type]]":"literal","[[value]]":h})}var m=s.substring(l+1,c);if("number"===m)if(isNaN(t)){var v=o.nan;b.call(u,{"[[type]]":"nan","[[value]]":v})}else if(isFinite(t)){"percent"===r["[[style]]"]&&isFinite(t)&&(t*=100);var g=void 0;g=p.call(r,"[[minimumSignificantDigits]]")&&p.call(r,"[[maximumSignificantDigits]]")?ae(t,r["[[minimumSignificantDigits]]"],r["[[maximumSignificantDigits]]"]):ie(t,r["[[minimumIntegerDigits]]"],r["[[minimumFractionDigits]]"],r["[[maximumFractionDigits]]"]),oe[a]?function(){var e=oe[a];g=String(g).replace(/\d/g,(function(t){return e[t]}))}():g=String(g);var y=void 0,w=void 0,S=g.indexOf(".",0);if(S>0?(y=g.substring(0,S),w=g.substring(S+1,S.length)):(y=g,w=void 0),!0===r["[[useGrouping]]"]){var D=o.group,x=[],k=i.patterns.primaryGroupSize||3,A=i.patterns.secondaryGroupSize||k;if(y.length>k){var C=y.length-k,T=C%A,_=y.slice(0,T);for(_.length&&b.call(x,_);Ta;a++)n+=r[a]["[[value]]"];return n}function ae(e,t,r){var n=r,a=void 0,i=void 0;if(0===e)a=w.call(Array(n+1),"0"),i=0;else{i=function(e){if("function"==typeof Math.log10)return Math.floor(Math.log10(e));var t=Math.round(Math.log(e)*Math.LOG10E);return t-(Number("1e"+t)>e)}(Math.abs(e));var o=Math.round(Math.exp(Math.abs(i-n+1)*Math.LN10));a=String(Math.round(i-n+1<0?e*o:e/o))}if(i>=n)return a+w.call(Array(i-n+1+1),"0");if(i===n-1)return a;if(i>=0?a=a.slice(0,i+1)+"."+a.slice(i+1):i<0&&(a="0."+w.call(Array(1-(i+1)),"0")+a),a.indexOf(".")>=0&&r>t){for(var s=r-t;s>0&&"0"===a.charAt(a.length-1);)a=a.slice(0,-1),s--;"."===a.charAt(a.length-1)&&(a=a.slice(0,-1))}return a}function ie(e,t,r,n){var a,i=n,o=Math.pow(10,i)*e,s=0===o?"0":o.toFixed(0),u=(a=s.indexOf("e"))>-1?s.slice(a+1):0;u&&(s=s.slice(0,a).replace(".",""),s+=w.call(Array(u-(s.length-1)+1),"0"));var l=void 0;if(0!==i){var c=s.length;c<=i&&(s=w.call(Array(i+1-c+1),"0")+s,c=i+1);var d=s.substring(0,c-i),f=s.substring(c-i,s.length);s=d+"."+f,l=d.length}else l=s.length;for(var p=n-r;p>0&&"0"===s.slice(-1);)s=s.slice(0,-1),p--;return"."===s.slice(-1)&&(s=s.slice(0,-1)),lr&&(r=s,n=o),a++}return n}(o,S);else{var A=K(r,"hour12","boolean");o.hour12=void 0===A?E.hour12:A,w=function(e,t){var r=[];for(var n in Oe)p.call(Oe,n)&&void 0!==e["[["+n+"]]"]&&r.push(n);if(1===r.length){var a=function(e,t){var r;if(ye[e]&&ye[e][t])return r={originalPattern:ye[e][t],_:s({},e,t),extendedPattern:"{"+e+"}"},s(r,e,t),s(r,"pattern12","{"+e+"}"),s(r,"pattern","{"+e+"}"),r}(r[0],e["[["+r[0]+"]]"]);if(a)return a}for(var i=-1/0,o=void 0,u=0,l=t.length;u=2||b>=2&&y<=1?w>0?d-=6:w<0&&(d-=8):w>1?d-=3:w<-1&&(d-=6)}}c._.hour12!==e.hour12&&(d-=1),d>i&&(i=d,o=c),u++}return o}(o,S)}for(var C in Oe)if(p.call(Oe,C)&&p.call(w,C)){var T=w[C];T=w._&&p.call(w._,C)?w._[C]:T,n["[["+C+"]]"]=T}var _=void 0,R=K(r,"hour12","boolean");if(n["[[hour]]"])if(R=void 0===R?E.hour12:R,n["[[hour12]]"]=R,!0===R){var F=E.hourNo0;n["[[hourNo0]]"]=F,_=w.pattern12}else _=w.pattern;else _=w.pattern;return n["[[pattern]]"]=_,n["[[boundFormat]]"]=void 0,n["[[initializedDateTimeFormat]]"]=!0,f&&(e.format=xe.call(e)),a(),e}h($,"DateTimeFormat",{configurable:!0,writable:!0,value:Ee}),h(Ee,"prototype",{writable:!1});var Oe={weekday:["narrow","short","long"],era:["narrow","short","long"],year:["2-digit","numeric"],month:["2-digit","numeric","narrow","short","long"],day:["2-digit","numeric"],hour:["2-digit","numeric"],minute:["2-digit","numeric"],second:["2-digit","numeric"],timeZoneName:["short","long"]};function De(e,t,r){if(void 0===e)e=null;else{var n=A(e);for(var a in e=new x,n)e[a]=n[a]}e=v(e);var i=!0;return"date"!==t&&"any"!==t||void 0===e.weekday&&void 0===e.year&&void 0===e.month&&void 0===e.day||(i=!1),"time"!==t&&"any"!==t||void 0===e.hour&&void 0===e.minute&&void 0===e.second||(i=!1),!i||"date"!==r&&"all"!==r||(e.year=e.month=e.day="numeric"),!i||"time"!==r&&"all"!==r||(e.hour=e.minute=e.second="numeric"),e}function xe(){var e=null!==this&&"object"===c.typeof(this)&&j(this);if(!e||!e["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for format() is not an initialized Intl.DateTimeFormat object.");if(void 0===e["[[boundFormat]]"]){var t=S.call((function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=void 0===e?Date.now():C(e);return ke(this,t)}),this);e["[[boundFormat]]"]=t}return e["[[boundFormat]]"]}function Pe(e,t){if(!isFinite(t))throw new RangeError("Invalid valid date passed to format");var r=e.__getInternalProperties(D);k();for(var n,a,i,o,s=r["[[locale]]"],u=new $.NumberFormat([s],{useGrouping:!1}),l=new $.NumberFormat([s],{minimumIntegerDigits:2,useGrouping:!1}),c=(n=t,r["[[calendar]]"],a=r["[[timeZone]]"],new x({"[[weekday]]":(i=new Date(n))[(o="get"+(a||""))+"Day"](),"[[era]]":+(i[o+"FullYear"]()>=0),"[[year]]":i[o+"FullYear"](),"[[month]]":i[o+"Month"](),"[[day]]":i[o+"Date"](),"[[hour]]":i[o+"Hours"](),"[[minute]]":i[o+"Minutes"](),"[[second]]":i[o+"Seconds"](),"[[inDST]]":!1})),d=r["[[pattern]]"],f=new P,p=0,h=d.indexOf("{"),m=0,v=r["[[dataLocale]]"],g=O.DateTimeFormat["[[localeData]]"][v].calendars,y=r["[[calendar]]"];-1!==h;){var w=void 0;if(-1===(m=d.indexOf("}",h)))throw new Error("Unclosed pattern");h>p&&b.call(f,{type:"literal",value:d.substring(p,h)});var E=d.substring(h+1,m);if(Oe.hasOwnProperty(E)){var S=r["[["+E+"]]"],A=c["[["+E+"]]"];if("year"===E&&A<=0?A=1-A:"month"===E?A++:"hour"===E&&!0===r["[[hour12]]"]&&0==(A%=12)&&!0===r["[[hourNo0]]"]&&(A=12),"numeric"===S)w=ne(u,A);else if("2-digit"===S)(w=ne(l,A)).length>2&&(w=w.slice(-2));else if(S in be)switch(E){case"month":w=we(g,y,"months",S,c["[["+E+"]]"]);break;case"weekday":try{w=we(g,y,"days",S,c["[["+E+"]]"])}catch(e){throw new Error("Could not find weekday data for locale "+s)}break;case"timeZoneName":w="";break;case"era":try{w=we(g,y,"eras",S,c["[["+E+"]]"])}catch(e){throw new Error("Could not find era data for locale "+s)}break;default:w=c["[["+E+"]]"]}b.call(f,{type:E,value:w})}else"ampm"===E?(w=we(g,y,"dayPeriods",c["[[hour]]"]>11?"pm":"am",null),b.call(f,{type:"dayPeriod",value:w})):b.call(f,{type:"literal",value:d.substring(h,m+1)});p=m+1,h=d.indexOf("{",p)}return ma;a++)n+=r[a].value;return n}function Ae(e,t){for(var r=Pe(e,t),n=[],a=0;r.length>a;a++){var i=r[a];n.push({type:i.type,value:i.value})}return n}O.DateTimeFormat={"[[availableLocales]]":[],"[[relevantExtensionKeys]]":["ca","nu"],"[[localeData]]":{}},h($.DateTimeFormat,"supportedLocalesOf",{configurable:!0,writable:!0,value:S.call((function(e){if(!p.call(this,"[[availableLocales]]"))throw new TypeError("supportedLocalesOf() is not a constructor");var t=k(),r=arguments[1],n=this["[[availableLocales]]"],a=B(e);return t(),Z(n,a,r)}),O.NumberFormat)}),h($.DateTimeFormat.prototype,"format",{configurable:!0,get:xe}),Object.defineProperty($.DateTimeFormat.prototype,"formatToParts",{enumerable:!1,writable:!0,configurable:!0,value:function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=null!==this&&"object"===c.typeof(this)&&j(this);if(!t||!t["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.");var r=void 0===e?Date.now():C(e);return Ae(this,r)}}),h($.DateTimeFormat.prototype,"resolvedOptions",{writable:!0,configurable:!0,value:function(){var e=void 0,t=new x,r=["locale","calendar","numberingSystem","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"],n=null!==this&&"object"===c.typeof(this)&&j(this);if(!n||!n["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.");for(var a=0,i=r.length;a2&&4===a[1].length&&b.call(n,a[0]+"-"+a[2]);r=E.call(n);)b.call(O.NumberFormat["[[availableLocales]]"],r),O.NumberFormat["[[localeData]]"][r]=e.number,e.date&&(e.date.nu=e.number.nu,b.call(O.DateTimeFormat["[[availableLocales]]"],r),O.DateTimeFormat["[[localeData]]"][r]=e.date);void 0===I&&function(e){I=e}(t)}(e,e.locale)}}),h($,"__disableRegExpRestore",{value:function(){O.disableRegExpRestore=!0}}),e.exports=$},e=>{"use strict";var t=/["'&<>]/;e.exports=function(e){var r,n=""+e,a=t.exec(n);if(!a)return n;var i="",o=0,s=0;for(o=a.index;o{"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,r,n,a){r=r||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(r);var s=1e3;a&&"number"==typeof a.maxKeys&&(s=a.maxKeys);var u=e.length;s>0&&u>s&&(u=s);for(var l=0;l=0?(c=h.substr(0,m),d=h.substr(m+1)):(c=h,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),t(i,f)?Array.isArray(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i}},e=>{"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,r,n,a){return r=r||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(a){var i=encodeURIComponent(t(a))+n;return Array.isArray(e[a])?e[a].map((function(e){return i+encodeURIComponent(t(e))})).join(r):i+encodeURIComponent(t(e[a]))})).filter(Boolean).join(r):a?encodeURIComponent(t(a))+n+encodeURIComponent(t(e)):""}},e=>{"use strict";e.exports=function(e,t,r,n,a,i,o,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,a,i,o,s],c=0;(u=new Error(t.replace(/%s/g,(function(){return l[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(){!function(e){"use strict";e.console||(e.console={});for(var t,r,n=e.console,a=function(){},i=["memory"],o="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=i.pop();)n[t]||(n[t]={});for(;r=o.pop();)n[r]||(n[r]=a)}("undefined"==typeof window?this:window)},(e,t,r)=>{"use strict";r.d(t,{QueryClientProvider:()=>h,useMutation:()=>S,useQuery:()=>T});var n=r(38),a=r(21),i=r.n(a)().unstable_batchedUpdates;n.V.setBatchNotifyFunction(i);var o=r(37),s=console;(0,o.E)(s);var u=r(0),l=r.n(u),c=l().createContext(void 0),d=l().createContext(!1);function f(e){return e&&"undefined"!=typeof window?(window.ReactQueryClientContext||(window.ReactQueryClientContext=c),window.ReactQueryClientContext):c}var p=function(){var e=l().useContext(f(l().useContext(d)));if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},h=function(e){var t=e.client,r=e.contextSharing,n=void 0!==r&&r,a=e.children;l().useEffect((function(){return t.mount(),function(){t.unmount()}}),[t]);var i=f(n);return l().createElement(d.Provider,{value:n},l().createElement(i.Provider,{value:t},a))},m=r(32),v=r(31),g=r(30),y=r(39),b=r(35),w=function(e){function t(t,r){var n;return(n=e.call(this)||this).client=t,n.setOptions(r),n.bindMethods(),n.updateResult(),n}(0,g.Z)(t,e);var r=t.prototype;return r.bindMethods=function(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)},r.setOptions=function(e){this.options=this.client.defaultMutationOptions(e)},r.onUnsubscribe=function(){var e;this.listeners.length||null==(e=this.currentMutation)||e.removeObserver(this)},r.onMutationUpdate=function(e){this.updateResult();var t={listeners:!0};"success"===e.type?t.onSuccess=!0:"error"===e.type&&(t.onError=!0),this.notify(t)},r.getCurrentResult=function(){return this.currentResult},r.reset=function(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})},r.mutate=function(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,(0,m.Z)({},this.options,{variables:void 0!==e?e:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()},r.updateResult=function(){var e=this.currentMutation?this.currentMutation.state:(0,y.R)(),t=(0,m.Z)({},e,{isLoading:"loading"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset});this.currentResult=t},r.notify=function(e){var t=this;n.V.batch((function(){t.mutateOptions&&(e.onSuccess?(null==t.mutateOptions.onSuccess||t.mutateOptions.onSuccess(t.currentResult.data,t.currentResult.variables,t.currentResult.context),null==t.mutateOptions.onSettled||t.mutateOptions.onSettled(t.currentResult.data,null,t.currentResult.variables,t.currentResult.context)):e.onError&&(null==t.mutateOptions.onError||t.mutateOptions.onError(t.currentResult.error,t.currentResult.variables,t.currentResult.context),null==t.mutateOptions.onSettled||t.mutateOptions.onSettled(void 0,t.currentResult.error,t.currentResult.variables,t.currentResult.context))),e.listeners&&t.listeners.forEach((function(e){e(t.currentResult)}))}))},t}(b.l);function E(e,t,r){return"function"==typeof t?t.apply(void 0,r):"boolean"==typeof t?t:!!e}function S(e,t,r){var a=l().useRef(!1),i=l().useState(0)[1],o=(0,v.lV)(e,t,r),s=p(),u=l().useRef();u.current?u.current.setOptions(o):u.current=new w(s,o);var c=u.current.getCurrentResult();l().useEffect((function(){a.current=!0;var e=u.current.subscribe(n.V.batchCalls((function(){a.current&&i((function(e){return e+1}))})));return function(){a.current=!1,e()}}),[]);var d=l().useCallback((function(e,t){u.current.mutate(e,t).catch(v.ZT)}),[]);if(c.error&&E(void 0,u.current.options.useErrorBoundary,[c.error]))throw c.error;return(0,m.Z)({},c,{mutate:d,mutateAsync:c.mutate})}var O=r(34),D=r(33),x=function(e){function t(t,r){var n;return(n=e.call(this)||this).client=t,n.options=r,n.trackedProps=[],n.previousSelectError=null,n.bindMethods(),n.setOptions(r),n}(0,g.Z)(t,e);var r=t.prototype;return r.bindMethods=function(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)},r.onSubscribe=function(){1===this.listeners.length&&(this.currentQuery.addObserver(this),P(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())},r.onUnsubscribe=function(){this.listeners.length||this.destroy()},r.shouldFetchOnReconnect=function(){return e=this.currentQuery,!1!==(t=this.options).enabled&&("always"===t.refetchOnReconnect||!1!==t.refetchOnReconnect&&A(e,t));var e,t},r.shouldFetchOnWindowFocus=function(){return e=this.currentQuery,!1!==(t=this.options).enabled&&("always"===t.refetchOnWindowFocus||!1!==t.refetchOnWindowFocus&&A(e,t));var e,t},r.destroy=function(){this.listeners=[],this.clearTimers(),this.currentQuery.removeObserver(this)},r.setOptions=function(e,t){var r=this.options,n=this.currentQuery;if(this.options=this.client.defaultQueryObserverOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),this.updateQuery();var a=this.hasListeners();a&&k(this.currentQuery,n,this.options,r)&&this.executeFetch(),this.updateResult(t),!a||this.currentQuery===n&&this.options.enabled===r.enabled&&this.options.staleTime===r.staleTime||this.updateStaleTimeout();var i=this.computeRefetchInterval();!a||this.currentQuery===n&&this.options.enabled===r.enabled&&i===this.currentRefetchInterval||this.updateRefetchInterval(i)},r.getOptimisticResult=function(e){var t=this.client.defaultQueryObserverOptions(e),r=this.client.getQueryCache().build(this.client,t);return this.createResult(r,t)},r.getCurrentResult=function(){return this.currentResult},r.trackResult=function(e,t){var r=this,n={},a=function(e){r.trackedProps.includes(e)||r.trackedProps.push(e)};return Object.keys(e).forEach((function(t){Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:function(){return a(t),e[t]}})})),(t.useErrorBoundary||t.suspense)&&a("error"),n},r.getNextResult=function(e){var t=this;return new Promise((function(r,n){var a=t.subscribe((function(t){t.isFetching||(a(),t.isError&&(null==e?void 0:e.throwOnError)?n(t.error):r(t))}))}))},r.getCurrentQuery=function(){return this.currentQuery},r.remove=function(){this.client.getQueryCache().remove(this.currentQuery)},r.refetch=function(e){return this.fetch((0,m.Z)({},e,{meta:{refetchPage:null==e?void 0:e.refetchPage}}))},r.fetchOptimistic=function(e){var t=this,r=this.client.defaultQueryObserverOptions(e),n=this.client.getQueryCache().build(this.client,r);return n.fetch().then((function(){return t.createResult(n,r)}))},r.fetch=function(e){var t=this;return this.executeFetch(e).then((function(){return t.updateResult(),t.currentResult}))},r.executeFetch=function(e){this.updateQuery();var t=this.currentQuery.fetch(this.options,e);return(null==e?void 0:e.throwOnError)||(t=t.catch(v.ZT)),t},r.updateStaleTimeout=function(){var e=this;if(this.clearStaleTimeout(),!v.sk&&!this.currentResult.isStale&&(0,v.PN)(this.options.staleTime)){var t=(0,v.Kp)(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout((function(){e.currentResult.isStale||e.updateResult()}),t)}},r.computeRefetchInterval=function(){var e;return"function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.currentResult.data,this.currentQuery):null!=(e=this.options.refetchInterval)&&e},r.updateRefetchInterval=function(e){var t=this;this.clearRefetchInterval(),this.currentRefetchInterval=e,!v.sk&&!1!==this.options.enabled&&(0,v.PN)(this.currentRefetchInterval)&&0!==this.currentRefetchInterval&&(this.refetchIntervalId=setInterval((function(){(t.options.refetchIntervalInBackground||O.j.isFocused())&&t.executeFetch()}),this.currentRefetchInterval))},r.updateTimers=function(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())},r.clearTimers=function(){this.clearStaleTimeout(),this.clearRefetchInterval()},r.clearStaleTimeout=function(){clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0},r.clearRefetchInterval=function(){clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0},r.createResult=function(e,t){var r,n=this.currentQuery,a=this.options,i=this.currentResult,s=this.currentResultState,u=this.currentResultOptions,l=e!==n,c=l?e.state:this.currentQueryInitialState,d=l?this.currentResult:this.previousQueryResult,f=e.state,p=f.dataUpdatedAt,h=f.error,m=f.errorUpdatedAt,g=f.isFetching,y=f.status,b=!1,w=!1;if(t.optimisticResults){var E=this.hasListeners(),S=!E&&P(e,t),O=E&&k(e,n,t,a);(S||O)&&(g=!0,p||(y="loading"))}if(t.keepPreviousData&&!f.dataUpdateCount&&(null==d?void 0:d.isSuccess)&&"error"!==y)r=d.data,p=d.dataUpdatedAt,y=d.status,b=!0;else if(t.select&&void 0!==f.data){var D;if(i&&f.data===(null==s?void 0:s.data)&&t.select===(null==(D=this.previousSelect)?void 0:D.fn)&&!this.previousSelectError)r=this.previousSelect.result;else try{r=t.select(f.data),!1!==t.structuralSharing&&(r=(0,v.Q$)(null==i?void 0:i.data,r)),this.previousSelect={fn:t.select,result:r},this.previousSelectError=null}catch(e){(0,o.j)().error(e),h=e,this.previousSelectError=e,m=Date.now(),y="error"}}else r=f.data;if(void 0!==t.placeholderData&&void 0===r&&("loading"===y||"idle"===y)){var x;if((null==i?void 0:i.isPlaceholderData)&&t.placeholderData===(null==u?void 0:u.placeholderData))x=i.data;else if(x="function"==typeof t.placeholderData?t.placeholderData():t.placeholderData,t.select&&void 0!==x)try{x=t.select(x),!1!==t.structuralSharing&&(x=(0,v.Q$)(null==i?void 0:i.data,x)),this.previousSelectError=null}catch(e){(0,o.j)().error(e),h=e,this.previousSelectError=e,m=Date.now(),y="error"}void 0!==x&&(y="success",r=x,w=!0)}return{status:y,isLoading:"loading"===y,isSuccess:"success"===y,isError:"error"===y,isIdle:"idle"===y,data:r,dataUpdatedAt:p,error:h,errorUpdatedAt:m,failureCount:f.fetchFailureCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&"loading"!==y,isLoadingError:"error"===y&&0===f.dataUpdatedAt,isPlaceholderData:w,isPreviousData:b,isRefetchError:"error"===y&&0!==f.dataUpdatedAt,isStale:A(e,t),refetch:this.refetch,remove:this.remove}},r.shouldNotifyListeners=function(e,t){if(!t)return!0;var r=this.options,n=r.notifyOnChangeProps,a=r.notifyOnChangePropsExclusions;if(!n&&!a)return!0;if("tracked"===n&&!this.trackedProps.length)return!0;var i="tracked"===n?this.trackedProps:n;return Object.keys(e).some((function(r){var n=r,o=e[n]!==t[n],s=null==i?void 0:i.some((function(e){return e===r})),u=null==a?void 0:a.some((function(e){return e===r}));return o&&!u&&(!i||s)}))},r.updateResult=function(e){var t=this.currentResult;if(this.currentResult=this.createResult(this.currentQuery,this.options),this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,!(0,v.VS)(this.currentResult,t)){var r={cache:!0};!1!==(null==e?void 0:e.listeners)&&this.shouldNotifyListeners(this.currentResult,t)&&(r.listeners=!0),this.notify((0,m.Z)({},r,e))}},r.updateQuery=function(){var e=this.client.getQueryCache().build(this.client,this.options);if(e!==this.currentQuery){var t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(null==t||t.removeObserver(this),e.addObserver(this))}},r.onQueryUpdate=function(e){var t={};"success"===e.type?t.onSuccess=!0:"error"!==e.type||(0,D.DV)(e.error)||(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()},r.notify=function(e){var t=this;n.V.batch((function(){e.onSuccess?(null==t.options.onSuccess||t.options.onSuccess(t.currentResult.data),null==t.options.onSettled||t.options.onSettled(t.currentResult.data,null)):e.onError&&(null==t.options.onError||t.options.onError(t.currentResult.error),null==t.options.onSettled||t.options.onSettled(void 0,t.currentResult.error)),e.listeners&&t.listeners.forEach((function(e){e(t.currentResult)})),e.cache&&t.client.getQueryCache().notify({query:t.currentQuery,type:"observerResultsUpdated"})}))},t}(b.l);function P(e,t){return function(e,t){return!(!1===t.enabled||e.state.dataUpdatedAt||"error"===e.state.status&&!1===t.retryOnMount)}(e,t)||function(e,t){return!1!==t.enabled&&e.state.dataUpdatedAt>0&&("always"===t.refetchOnMount||!1!==t.refetchOnMount&&A(e,t))}(e,t)}function k(e,t,r,n){return!1!==r.enabled&&(e!==t||!1===n.enabled)&&(!r.suspense||"error"!==e.state.status)&&A(e,r)}function A(e,t){return e.isStaleByTime(t.staleTime)}var C,j=l().createContext((C=!1,{clearReset:function(){C=!1},reset:function(){C=!0},isReset:function(){return C}}));function T(e,t,r){return function(e,t){var r=l().useRef(!1),a=l().useState(0)[1],i=p(),o=l().useContext(j),s=i.defaultQueryObserverOptions(e);s.optimisticResults=!0,s.onError&&(s.onError=n.V.batchCalls(s.onError)),s.onSuccess&&(s.onSuccess=n.V.batchCalls(s.onSuccess)),s.onSettled&&(s.onSettled=n.V.batchCalls(s.onSettled)),s.suspense&&("number"!=typeof s.staleTime&&(s.staleTime=1e3),0===s.cacheTime&&(s.cacheTime=1)),(s.suspense||s.useErrorBoundary)&&(o.isReset()||(s.retryOnMount=!1));var u=l().useState((function(){return new t(i,s)}))[0],c=u.getOptimisticResult(s);if(l().useEffect((function(){r.current=!0,o.clearReset();var e=u.subscribe(n.V.batchCalls((function(){r.current&&a((function(e){return e+1}))})));return u.updateResult(),function(){r.current=!1,e()}}),[o,u]),l().useEffect((function(){u.setOptions(s,{listeners:!1})}),[s,u]),s.suspense&&c.isLoading)throw u.fetchOptimistic(s).then((function(e){var t=e.data;null==s.onSuccess||s.onSuccess(t),null==s.onSettled||s.onSettled(t,null)})).catch((function(e){o.clearReset(),null==s.onError||s.onError(e),null==s.onSettled||s.onSettled(void 0,e)}));if(c.isError&&!o.isReset()&&!c.isFetching&&E(s.suspense,s.useErrorBoundary,[c.error,u.getCurrentQuery()]))throw c.error;return"tracked"===s.notifyOnChangeProps&&(c=u.trackResult(c,s)),c}((0,v._v)(e,t,r),x)}},,(e,t,r)=>{"use strict";r.d(t,{QueryClient:()=>n.S});var n=r(19),a=r(20);r.o(a,"QueryClientProvider")&&r.d(t,{QueryClientProvider:function(){return a.QueryClientProvider}}),r.o(a,"useMutation")&&r.d(t,{useMutation:function(){return a.useMutation}}),r.o(a,"useQuery")&&r.d(t,{useQuery:function(){return a.useQuery}})},(e,t,r)=>{"use strict";r.d(t,{S:()=>g});var n=r(32),a=r(31),i=r(30),o=r(38),s=r(37),u=r(33),l=function(){function e(e){this.abortSignalConsumed=!1,this.hadObservers=!1,this.defaultOptions=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.cache=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.initialState=e.state||this.getDefaultState(this.options),this.state=this.initialState,this.meta=e.meta,this.scheduleGc()}var t=e.prototype;return t.setOptions=function(e){var t;this.options=(0,n.Z)({},this.defaultOptions,e),this.meta=null==e?void 0:e.meta,this.cacheTime=Math.max(this.cacheTime||0,null!=(t=this.options.cacheTime)?t:3e5)},t.setDefaultOptions=function(e){this.defaultOptions=e},t.scheduleGc=function(){var e=this;this.clearGcTimeout(),(0,a.PN)(this.cacheTime)&&(this.gcTimeout=setTimeout((function(){e.optionalRemove()}),this.cacheTime))},t.clearGcTimeout=function(){clearTimeout(this.gcTimeout),this.gcTimeout=void 0},t.optionalRemove=function(){this.observers.length||(this.state.isFetching?this.hadObservers&&this.scheduleGc():this.cache.remove(this))},t.setData=function(e,t){var r,n,i=this.state.data,o=(0,a.SE)(e,i);return(null==(r=(n=this.options).isDataEqual)?void 0:r.call(n,i,o))?o=i:!1!==this.options.structuralSharing&&(o=(0,a.Q$)(i,o)),this.dispatch({data:o,type:"success",dataUpdatedAt:null==t?void 0:t.updatedAt}),o},t.setState=function(e,t){this.dispatch({type:"setState",state:e,setStateOptions:t})},t.cancel=function(e){var t,r=this.promise;return null==(t=this.retryer)||t.cancel(e),r?r.then(a.ZT).catch(a.ZT):Promise.resolve()},t.destroy=function(){this.clearGcTimeout(),this.cancel({silent:!0})},t.reset=function(){this.destroy(),this.setState(this.initialState)},t.isActive=function(){return this.observers.some((function(e){return!1!==e.options.enabled}))},t.isFetching=function(){return this.state.isFetching},t.isStale=function(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some((function(e){return e.getCurrentResult().isStale}))},t.isStaleByTime=function(e){return void 0===e&&(e=0),this.state.isInvalidated||!this.state.dataUpdatedAt||!(0,a.Kp)(this.state.dataUpdatedAt,e)},t.onFocus=function(){var e,t=this.observers.find((function(e){return e.shouldFetchOnWindowFocus()}));t&&t.refetch(),null==(e=this.retryer)||e.continue()},t.onOnline=function(){var e,t=this.observers.find((function(e){return e.shouldFetchOnReconnect()}));t&&t.refetch(),null==(e=this.retryer)||e.continue()},t.addObserver=function(e){-1===this.observers.indexOf(e)&&(this.observers.push(e),this.hadObservers=!0,this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:e}))},t.removeObserver=function(e){-1!==this.observers.indexOf(e)&&(this.observers=this.observers.filter((function(t){return t!==e})),this.observers.length||(this.retryer&&(this.retryer.isTransportCancelable||this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.cacheTime?this.scheduleGc():this.cache.remove(this)),this.cache.notify({type:"observerRemoved",query:this,observer:e}))},t.getObserversCount=function(){return this.observers.length},t.invalidate=function(){this.state.isInvalidated||this.dispatch({type:"invalidate"})},t.fetch=function(e,t){var r,n,i,o=this;if(this.state.isFetching)if(this.state.dataUpdatedAt&&(null==t?void 0:t.cancelRefetch))this.cancel({silent:!0});else if(this.promise){var l;return null==(l=this.retryer)||l.continueRetry(),this.promise}if(e&&this.setOptions(e),!this.options.queryFn){var c=this.observers.find((function(e){return e.options.queryFn}));c&&this.setOptions(c.options)}var d=(0,a.mc)(this.queryKey),f=(0,a.G9)(),p={queryKey:d,pageParam:void 0,meta:this.meta};Object.defineProperty(p,"signal",{enumerable:!0,get:function(){if(f)return o.abortSignalConsumed=!0,f.signal}});var h,m,v={fetchOptions:t,options:this.options,queryKey:d,state:this.state,fetchFn:function(){return o.options.queryFn?(o.abortSignalConsumed=!1,o.options.queryFn(p)):Promise.reject("Missing queryFn")},meta:this.meta};return(null==(r=this.options.behavior)?void 0:r.onFetch)&&(null==(h=this.options.behavior)||h.onFetch(v)),this.revertState=this.state,this.state.isFetching&&this.state.fetchMeta===(null==(n=v.fetchOptions)?void 0:n.meta)||this.dispatch({type:"fetch",meta:null==(m=v.fetchOptions)?void 0:m.meta}),this.retryer=new u.m4({fn:v.fetchFn,abort:null==f||null==(i=f.abort)?void 0:i.bind(f),onSuccess:function(e){o.setData(e),null==o.cache.config.onSuccess||o.cache.config.onSuccess(e,o),0===o.cacheTime&&o.optionalRemove()},onError:function(e){(0,u.DV)(e)&&e.silent||o.dispatch({type:"error",error:e}),(0,u.DV)(e)||(null==o.cache.config.onError||o.cache.config.onError(e,o),(0,s.j)().error(e)),0===o.cacheTime&&o.optionalRemove()},onFail:function(){o.dispatch({type:"failed"})},onPause:function(){o.dispatch({type:"pause"})},onContinue:function(){o.dispatch({type:"continue"})},retry:v.options.retry,retryDelay:v.options.retryDelay}),this.promise=this.retryer.promise,this.promise},t.dispatch=function(e){var t=this;this.state=this.reducer(this.state,e),o.V.batch((function(){t.observers.forEach((function(t){t.onQueryUpdate(e)})),t.cache.notify({query:t,type:"queryUpdated",action:e})}))},t.getDefaultState=function(e){var t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==e.initialData?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0,n=void 0!==t;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?null!=r?r:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchMeta:null,isFetching:!1,isInvalidated:!1,isPaused:!1,status:n?"success":"idle"}},t.reducer=function(e,t){var r,a;switch(t.type){case"failed":return(0,n.Z)({},e,{fetchFailureCount:e.fetchFailureCount+1});case"pause":return(0,n.Z)({},e,{isPaused:!0});case"continue":return(0,n.Z)({},e,{isPaused:!1});case"fetch":return(0,n.Z)({},e,{fetchFailureCount:0,fetchMeta:null!=(r=t.meta)?r:null,isFetching:!0,isPaused:!1},!e.dataUpdatedAt&&{error:null,status:"loading"});case"success":return(0,n.Z)({},e,{data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:null!=(a=t.dataUpdatedAt)?a:Date.now(),error:null,fetchFailureCount:0,isFetching:!1,isInvalidated:!1,isPaused:!1,status:"success"});case"error":var i=t.error;return(0,u.DV)(i)&&i.revert&&this.revertState?(0,n.Z)({},this.revertState):(0,n.Z)({},e,{error:i,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,isFetching:!1,isPaused:!1,status:"error"});case"invalidate":return(0,n.Z)({},e,{isInvalidated:!0});case"setState":return(0,n.Z)({},e,t.state);default:return e}},e}(),c=r(35),d=function(e){function t(t){var r;return(r=e.call(this)||this).config=t||{},r.queries=[],r.queriesMap={},r}(0,i.Z)(t,e);var r=t.prototype;return r.build=function(e,t,r){var n,i=t.queryKey,o=null!=(n=t.queryHash)?n:(0,a.Rm)(i,t),s=this.get(o);return s||(s=new l({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i),meta:t.meta}),this.add(s)),s},r.add=function(e){this.queriesMap[e.queryHash]||(this.queriesMap[e.queryHash]=e,this.queries.push(e),this.notify({type:"queryAdded",query:e}))},r.remove=function(e){var t=this.queriesMap[e.queryHash];t&&(e.destroy(),this.queries=this.queries.filter((function(t){return t!==e})),t===e&&delete this.queriesMap[e.queryHash],this.notify({type:"queryRemoved",query:e}))},r.clear=function(){var e=this;o.V.batch((function(){e.queries.forEach((function(t){e.remove(t)}))}))},r.get=function(e){return this.queriesMap[e]},r.getAll=function(){return this.queries},r.find=function(e,t){var r=(0,a.I6)(e,t)[0];return void 0===r.exact&&(r.exact=!0),this.queries.find((function(e){return(0,a._x)(r,e)}))},r.findAll=function(e,t){var r=(0,a.I6)(e,t)[0];return Object.keys(r).length>0?this.queries.filter((function(e){return(0,a._x)(r,e)})):this.queries},r.notify=function(e){var t=this;o.V.batch((function(){t.listeners.forEach((function(t){t(e)}))}))},r.onFocus=function(){var e=this;o.V.batch((function(){e.queries.forEach((function(e){e.onFocus()}))}))},r.onOnline=function(){var e=this;o.V.batch((function(){e.queries.forEach((function(e){e.onOnline()}))}))},t}(c.l),f=r(39),p=function(e){function t(t){var r;return(r=e.call(this)||this).config=t||{},r.mutations=[],r.mutationId=0,r}(0,i.Z)(t,e);var r=t.prototype;return r.build=function(e,t,r){var n=new f.m({mutationCache:this,mutationId:++this.mutationId,options:e.defaultMutationOptions(t),state:r,defaultOptions:t.mutationKey?e.getMutationDefaults(t.mutationKey):void 0,meta:t.meta});return this.add(n),n},r.add=function(e){this.mutations.push(e),this.notify(e)},r.remove=function(e){this.mutations=this.mutations.filter((function(t){return t!==e})),e.cancel(),this.notify(e)},r.clear=function(){var e=this;o.V.batch((function(){e.mutations.forEach((function(t){e.remove(t)}))}))},r.getAll=function(){return this.mutations},r.find=function(e){return void 0===e.exact&&(e.exact=!0),this.mutations.find((function(t){return(0,a.X7)(e,t)}))},r.findAll=function(e){return this.mutations.filter((function(t){return(0,a.X7)(e,t)}))},r.notify=function(e){var t=this;o.V.batch((function(){t.listeners.forEach((function(t){t(e)}))}))},r.onFocus=function(){this.resumePausedMutations()},r.onOnline=function(){this.resumePausedMutations()},r.resumePausedMutations=function(){var e=this.mutations.filter((function(e){return e.state.isPaused}));return o.V.batch((function(){return e.reduce((function(e,t){return e.then((function(){return t.continue().catch(a.ZT)}))}),Promise.resolve())}))},t}(c.l),h=r(34),m=r(36);function v(e,t){return null==e.getNextPageParam?void 0:e.getNextPageParam(t[t.length-1],t)}var g=function(){function e(e){void 0===e&&(e={}),this.queryCache=e.queryCache||new d,this.mutationCache=e.mutationCache||new p,this.defaultOptions=e.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[]}var t=e.prototype;return t.mount=function(){var e=this;this.unsubscribeFocus=h.j.subscribe((function(){h.j.isFocused()&&m.N.isOnline()&&(e.mutationCache.onFocus(),e.queryCache.onFocus())})),this.unsubscribeOnline=m.N.subscribe((function(){h.j.isFocused()&&m.N.isOnline()&&(e.mutationCache.onOnline(),e.queryCache.onOnline())}))},t.unmount=function(){var e,t;null==(e=this.unsubscribeFocus)||e.call(this),null==(t=this.unsubscribeOnline)||t.call(this)},t.isFetching=function(e,t){var r=(0,a.I6)(e,t)[0];return r.fetching=!0,this.queryCache.findAll(r).length},t.isMutating=function(e){return this.mutationCache.findAll((0,n.Z)({},e,{fetching:!0})).length},t.getQueryData=function(e,t){var r;return null==(r=this.queryCache.find(e,t))?void 0:r.state.data},t.getQueriesData=function(e){return this.getQueryCache().findAll(e).map((function(e){return[e.queryKey,e.state.data]}))},t.setQueryData=function(e,t,r){var n=(0,a._v)(e),i=this.defaultQueryOptions(n);return this.queryCache.build(this,i).setData(t,r)},t.setQueriesData=function(e,t,r){var n=this;return o.V.batch((function(){return n.getQueryCache().findAll(e).map((function(e){var a=e.queryKey;return[a,n.setQueryData(a,t,r)]}))}))},t.getQueryState=function(e,t){var r;return null==(r=this.queryCache.find(e,t))?void 0:r.state},t.removeQueries=function(e,t){var r=(0,a.I6)(e,t)[0],n=this.queryCache;o.V.batch((function(){n.findAll(r).forEach((function(e){n.remove(e)}))}))},t.resetQueries=function(e,t,r){var i=this,s=(0,a.I6)(e,t,r),u=s[0],l=s[1],c=this.queryCache,d=(0,n.Z)({},u,{active:!0});return o.V.batch((function(){return c.findAll(u).forEach((function(e){e.reset()})),i.refetchQueries(d,l)}))},t.cancelQueries=function(e,t,r){var n=this,i=(0,a.I6)(e,t,r),s=i[0],u=i[1],l=void 0===u?{}:u;void 0===l.revert&&(l.revert=!0);var c=o.V.batch((function(){return n.queryCache.findAll(s).map((function(e){return e.cancel(l)}))}));return Promise.all(c).then(a.ZT).catch(a.ZT)},t.invalidateQueries=function(e,t,r){var i,s,u,l=this,c=(0,a.I6)(e,t,r),d=c[0],f=c[1],p=(0,n.Z)({},d,{active:null==(i=null!=(s=d.refetchActive)?s:d.active)||i,inactive:null!=(u=d.refetchInactive)&&u});return o.V.batch((function(){return l.queryCache.findAll(d).forEach((function(e){e.invalidate()})),l.refetchQueries(p,f)}))},t.refetchQueries=function(e,t,r){var i=this,s=(0,a.I6)(e,t,r),u=s[0],l=s[1],c=o.V.batch((function(){return i.queryCache.findAll(u).map((function(e){return e.fetch(void 0,(0,n.Z)({},l,{meta:{refetchPage:null==u?void 0:u.refetchPage}}))}))})),d=Promise.all(c).then(a.ZT);return(null==l?void 0:l.throwOnError)||(d=d.catch(a.ZT)),d},t.fetchQuery=function(e,t,r){var n=(0,a._v)(e,t,r),i=this.defaultQueryOptions(n);void 0===i.retry&&(i.retry=!1);var o=this.queryCache.build(this,i);return o.isStaleByTime(i.staleTime)?o.fetch(i):Promise.resolve(o.state.data)},t.prefetchQuery=function(e,t,r){return this.fetchQuery(e,t,r).then(a.ZT).catch(a.ZT)},t.fetchInfiniteQuery=function(e,t,r){var n=(0,a._v)(e,t,r);return n.behavior={onFetch:function(e){e.fetchFn=function(){var t,r,n,i,o,s,l,c,d,f=null==(t=e.fetchOptions)||null==(r=t.meta)?void 0:r.refetchPage,p=null==(n=e.fetchOptions)||null==(i=n.meta)?void 0:i.fetchMore,h=null==p?void 0:p.pageParam,m="forward"===(null==p?void 0:p.direction),g="backward"===(null==p?void 0:p.direction),y=(null==(o=e.state.data)?void 0:o.pages)||[],b=(null==(s=e.state.data)?void 0:s.pageParams)||[],w=(0,a.G9)(),E=null==w?void 0:w.signal,S=b,O=!1,D=e.options.queryFn||function(){return Promise.reject("Missing queryFn")},x=function(e,t,r,n){return S=n?[t].concat(S):[].concat(S,[t]),n?[r].concat(e):[].concat(e,[r])},P=function(t,r,n,a){if(O)return Promise.reject("Cancelled");if(void 0===n&&!r&&t.length)return Promise.resolve(t);var i={queryKey:e.queryKey,signal:E,pageParam:n,meta:e.meta},o=D(i),s=Promise.resolve(o).then((function(e){return x(t,n,e,a)}));return(0,u.LE)(o)&&(s.cancel=o.cancel),s};if(y.length)if(m){var k=void 0!==h,A=k?h:v(e.options,y);l=P(y,k,A)}else if(g){var C=void 0!==h,j=C?h:(c=e.options,d=y,null==c.getPreviousPageParam?void 0:c.getPreviousPageParam(d[0],d));l=P(y,C,j,!0)}else!function(){S=[];var t=void 0===e.options.getNextPageParam,r=!f||!y[0]||f(y[0],0,y);l=r?P([],t,b[0]):Promise.resolve(x([],b[0],y[0]));for(var n=function(r){l=l.then((function(n){if(!f||!y[r]||f(y[r],r,y)){var a=t?b[r]:v(e.options,n);return P(n,t,a)}return Promise.resolve(x(n,b[r],y[r]))}))},a=1;a{},e=>{"use strict";e.exports=r},()=>{},(e,t,r)=>{"use strict";var n;function a(e){return e.type===n.literal}function i(e){return e.type===n.argument}function o(e){return e.type===n.number}function s(e){return e.type===n.date}function u(e){return e.type===n.time}function l(e){return e.type===n.select}function c(e){return e.type===n.plural}function d(e){return e.type===n.pound}function f(e){return!(!e||"object"!=typeof e||0!==e.type)}function p(e){return!(!e||"object"!=typeof e||1!==e.type)}r.r(t),r.d(t,{IntlMessageFormat:()=>W,createDefaultFormatters:()=>K,default:()=>$,formatHTMLMessage:()=>H,formatToParts:()=>M,formatToString:()=>N}),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound"}(n||(n={}));var h,m=(h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},h(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),v=function(){return v=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0){for(t=1,r=1;tEe&&(Ee=ye,Se=[]),Se.push(e))}function Re(){return Fe()}function Fe(){var e,t;for(e=[],t=Ie();t!==a;)e.push(t),t=Ie();return e}function Ie(){var t;return(t=function(){var e,t,r;return e=ye,(t=Le())!==a&&(be=e,r=t,t=v({type:n.literal,value:r},it())),t}())===a&&(t=function(){var t,r,i,o,s;return Oe++,t=ye,123===e.charCodeAt(ye)?(r=l,ye++):(r=a,0===Oe&&_e(c)),r!==a&&He()!==a&&(i=Ye())!==a&&He()!==a?(125===e.charCodeAt(ye)?(o=d,ye++):(o=a,0===Oe&&_e(f)),o!==a?(be=t,s=i,t=r=v({type:n.argument,value:s},it())):(ye=t,t=a)):(ye=t,t=a),Oe--,t===a&&(r=a,0===Oe&&_e(u)),t}())===a&&(t=function(){var t;return(t=function(){var t,r,n,i,o,s,u,p,h;return t=ye,123===e.charCodeAt(ye)?(r=l,ye++):(r=a,0===Oe&&_e(c)),r!==a&&He()!==a&&(n=Ye())!==a&&He()!==a?(44===e.charCodeAt(ye)?(i=x,ye++):(i=a,0===Oe&&_e(P)),i!==a&&He()!==a?(e.substr(ye,6)===k?(o=k,ye+=6):(o=a,0===Oe&&_e(A)),o!==a&&He()!==a?(s=ye,44===e.charCodeAt(ye)?(u=x,ye++):(u=a,0===Oe&&_e(P)),u!==a&&(p=He())!==a?(h=function(){var t,r,n;return t=ye,e.substr(ye,2)===S?(r=S,ye+=2):(r=a,0===Oe&&_e(O)),r!==a?(n=function(){var e,t,r;if(e=ye,t=[],(r=ze())!==a)for(;r!==a;)t.push(r),r=ze();else t=a;return t!==a&&(be=e,t=v({type:0,tokens:t},it())),t}(),n!==a?(be=t,t=r=n):(ye=t,t=a)):(ye=t,t=a),t===a&&(t=ye,be=ye,nt.push("numberArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Le())!==a?(be=t,t=r=D(n)):(ye=t,t=a)),t}(),h!==a?s=u=[u,p,h]:(ye=s,s=a)):(ye=s,s=a),s===a&&(s=null),s!==a&&(u=He())!==a?(125===e.charCodeAt(ye)?(p=d,ye++):(p=a,0===Oe&&_e(f)),p!==a?(be=t,t=r=C(n,o,s)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a),t}())===a&&(t=function(){var t,r,n,i,o,s,u,p,h;return t=ye,123===e.charCodeAt(ye)?(r=l,ye++):(r=a,0===Oe&&_e(c)),r!==a&&He()!==a&&(n=Ye())!==a&&He()!==a?(44===e.charCodeAt(ye)?(i=x,ye++):(i=a,0===Oe&&_e(P)),i!==a&&He()!==a?(e.substr(ye,4)===N?(o=N,ye+=4):(o=a,0===Oe&&_e(z)),o===a&&(e.substr(ye,4)===U?(o=U,ye+=4):(o=a,0===Oe&&_e(q))),o!==a&&He()!==a?(s=ye,44===e.charCodeAt(ye)?(u=x,ye++):(u=a,0===Oe&&_e(P)),u!==a&&(p=He())!==a?(h=function(){var t,r,n;return t=ye,e.substr(ye,2)===S?(r=S,ye+=2):(r=a,0===Oe&&_e(O)),r!==a?(n=function(){var t,r,n,i;if(t=ye,r=ye,n=[],(i=Ue())===a&&(i=qe()),i!==a)for(;i!==a;)n.push(i),(i=Ue())===a&&(i=qe());else n=a;return(r=n!==a?e.substring(r,ye):n)!==a&&(be=t,r=v({type:1,pattern:r},it())),r}(),n!==a?(be=t,t=r=n):(ye=t,t=a)):(ye=t,t=a),t===a&&(t=ye,be=ye,nt.push("dateOrTimeArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Le())!==a?(be=t,t=r=D(n)):(ye=t,t=a)),t}(),h!==a?s=u=[u,p,h]:(ye=s,s=a)):(ye=s,s=a),s===a&&(s=null),s!==a&&(u=He())!==a?(125===e.charCodeAt(ye)?(p=d,ye++):(p=a,0===Oe&&_e(f)),p!==a?(be=t,t=r=C(n,o,s)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a),t}()),t}())===a&&(t=function(){var t,r,i,o,s,u,p,h,m,g,y;if(t=ye,123===e.charCodeAt(ye)?(r=l,ye++):(r=a,0===Oe&&_e(c)),r!==a)if(He()!==a)if((i=Ye())!==a)if(He()!==a)if(44===e.charCodeAt(ye)?(o=x,ye++):(o=a,0===Oe&&_e(P)),o!==a)if(He()!==a)if(e.substr(ye,6)===B?(s=B,ye+=6):(s=a,0===Oe&&_e(Q)),s===a&&(e.substr(ye,13)===V?(s=V,ye+=13):(s=a,0===Oe&&_e(G))),s!==a)if(He()!==a)if(44===e.charCodeAt(ye)?(u=x,ye++):(u=a,0===Oe&&_e(P)),u!==a)if(He()!==a)if(p=ye,e.substr(ye,7)===H?(h=H,ye+=7):(h=a,0===Oe&&_e(Z)),h!==a&&(m=He())!==a&&(g=Ze())!==a?p=h=[h,m,g]:(ye=p,p=a),p===a&&(p=null),p!==a)if((h=He())!==a){if(m=[],(g=Qe())!==a)for(;g!==a;)m.push(g),g=Qe();else m=a;m!==a&&(g=He())!==a?(125===e.charCodeAt(ye)?(y=d,ye++):(y=a,0===Oe&&_e(f)),y!==a?(be=t,r=function(e,t,r,a){return v({type:n.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:a.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&Pe('Duplicate option "'+r+'" in plural element: "'+De()+'"',xe()),e[r]={value:n,location:a},e}),{})},it())}(i,s,p,m),t=r):(ye=t,t=a)):(ye=t,t=a)}else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;return t}(),t===a&&(t=function(){var t,r,i,o,s,u,p,h,m;if(t=ye,123===e.charCodeAt(ye)?(r=l,ye++):(r=a,0===Oe&&_e(c)),r!==a)if(He()!==a)if((i=Ye())!==a)if(He()!==a)if(44===e.charCodeAt(ye)?(o=x,ye++):(o=a,0===Oe&&_e(P)),o!==a)if(He()!==a)if(e.substr(ye,6)===K?(s=K,ye+=6):(s=a,0===Oe&&_e(W)),s!==a)if(He()!==a)if(44===e.charCodeAt(ye)?(u=x,ye++):(u=a,0===Oe&&_e(P)),u!==a)if(He()!==a){if(p=[],(h=Be())!==a)for(;h!==a;)p.push(h),h=Be();else p=a;p!==a&&(h=He())!==a?(125===e.charCodeAt(ye)?(m=d,ye++):(m=a,0===Oe&&_e(f)),m!==a?(be=t,r=function(e,t){return v({type:n.select,value:e,options:t.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&Pe('Duplicate option "'+r+'" in select element: "'+De()+'"',xe()),e[r]={value:n,location:a},e}),{})},it())}(i,p),t=r):(ye=t,t=a)):(ye=t,t=a)}else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;else ye=t,t=a;return t}(),t===a&&(t=function(){var t,r;return t=ye,35===e.charCodeAt(ye)?(r="#",ye++):(r=a,0===Oe&&_e(s)),r!==a&&(be=t,r=v({type:n.pound},it())),r}()))),t}function Le(){var e,t,r;if(e=ye,t=[],(r=Ke())===a&&(r=We())===a&&(r=$e()),r!==a)for(;r!==a;)t.push(r),(r=Ke())===a&&(r=We())===a&&(r=$e());else t=a;return t!==a&&(be=e,t=t.join("")),t}function Me(){var t,r,n,i,o;if(Oe++,t=ye,r=[],n=ye,i=ye,Oe++,(o=Ve())===a&&(h.test(e.charAt(ye))?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(m))),Oe--,o===a?i=void 0:(ye=i,i=a),i!==a?(e.length>ye?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(y)),o!==a?n=i=[i,o]:(ye=n,n=a)):(ye=n,n=a),n!==a)for(;n!==a;)r.push(n),n=ye,i=ye,Oe++,(o=Ve())===a&&(h.test(e.charAt(ye))?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(m))),Oe--,o===a?i=void 0:(ye=i,i=a),i!==a?(e.length>ye?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(y)),o!==a?n=i=[i,o]:(ye=n,n=a)):(ye=n,n=a);else r=a;return t=r!==a?e.substring(t,ye):r,Oe--,t===a&&(r=a,0===Oe&&_e(p)),t}function Ne(){var t,r,n;return Oe++,t=ye,47===e.charCodeAt(ye)?(r="/",ye++):(r=a,0===Oe&&_e(w)),r!==a&&(n=Me())!==a?(be=t,t=r=n):(ye=t,t=a),Oe--,t===a&&(r=a,0===Oe&&_e(b)),t}function ze(){var e,t,r,n,i;if(Oe++,e=ye,(t=He())!==a)if((r=Me())!==a){for(n=[],i=Ne();i!==a;)n.push(i),i=Ne();n!==a?(be=e,t=function(e,t){return{stem:e,options:t}}(r,n),e=t):(ye=e,e=a)}else ye=e,e=a;else ye=e,e=a;return Oe--,e===a&&(t=a,0===Oe&&_e(E)),e}function Ue(){var t,r,n,i;if(t=ye,39===e.charCodeAt(ye)?(r=j,ye++):(r=a,0===Oe&&_e(T)),r!==a){if(n=[],(i=Ke())===a&&(_.test(e.charAt(ye))?(i=e.charAt(ye),ye++):(i=a,0===Oe&&_e(R))),i!==a)for(;i!==a;)n.push(i),(i=Ke())===a&&(_.test(e.charAt(ye))?(i=e.charAt(ye),ye++):(i=a,0===Oe&&_e(R)));else n=a;n!==a?(39===e.charCodeAt(ye)?(i=j,ye++):(i=a,0===Oe&&_e(T)),i!==a?t=r=[r,n,i]:(ye=t,t=a)):(ye=t,t=a)}else ye=t,t=a;if(t===a)if(t=[],(r=Ke())===a&&(F.test(e.charAt(ye))?(r=e.charAt(ye),ye++):(r=a,0===Oe&&_e(I))),r!==a)for(;r!==a;)t.push(r),(r=Ke())===a&&(F.test(e.charAt(ye))?(r=e.charAt(ye),ye++):(r=a,0===Oe&&_e(I)));else t=a;return t}function qe(){var t,r;if(t=[],L.test(e.charAt(ye))?(r=e.charAt(ye),ye++):(r=a,0===Oe&&_e(M)),r!==a)for(;r!==a;)t.push(r),L.test(e.charAt(ye))?(r=e.charAt(ye),ye++):(r=a,0===Oe&&_e(M));else t=a;return t}function Be(){var t,r,n,i,o,s,u;return t=ye,He()!==a&&(r=Je())!==a&&He()!==a?(123===e.charCodeAt(ye)?(n=l,ye++):(n=a,0===Oe&&_e(c)),n!==a?(be=ye,nt.push("select"),void 0!==a&&(i=Fe())!==a?(125===e.charCodeAt(ye)?(o=d,ye++):(o=a,0===Oe&&_e(f)),o!==a?(be=t,s=r,u=i,nt.pop(),t=v({id:s,value:u},it())):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a),t}function Qe(){var t,r,n,i,o,s,u;return t=ye,He()!==a?(r=function(){var t,r,n,i;return t=ye,r=ye,61===e.charCodeAt(ye)?(n="=",ye++):(n=a,0===Oe&&_e($)),n!==a&&(i=Ze())!==a?r=n=[n,i]:(ye=r,r=a),(t=r!==a?e.substring(t,ye):r)===a&&(t=Je()),t}(),r!==a&&He()!==a?(123===e.charCodeAt(ye)?(n=l,ye++):(n=a,0===Oe&&_e(c)),n!==a?(be=ye,nt.push("plural"),void 0!==a&&(i=Fe())!==a?(125===e.charCodeAt(ye)?(o=d,ye++):(o=a,0===Oe&&_e(f)),o!==a?(be=t,s=r,u=i,nt.pop(),t=v({id:s,value:u},it())):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a)):(ye=t,t=a),t}function Ve(){var t;return Oe++,X.test(e.charAt(ye))?(t=e.charAt(ye),ye++):(t=a,0===Oe&&_e(J)),Oe--,t===a&&0===Oe&&_e(Y),t}function Ge(){var t;return Oe++,te.test(e.charAt(ye))?(t=e.charAt(ye),ye++):(t=a,0===Oe&&_e(re)),Oe--,t===a&&0===Oe&&_e(ee),t}function He(){var t,r,n;for(Oe++,t=ye,r=[],n=Ve();n!==a;)r.push(n),n=Ve();return t=r!==a?e.substring(t,ye):r,Oe--,t===a&&(r=a,0===Oe&&_e(ne)),t}function Ze(){var t,r,n,i;return Oe++,t=ye,45===e.charCodeAt(ye)?(r="-",ye++):(r=a,0===Oe&&_e(ie)),r===a&&(r=null),r!==a&&(n=Xe())!==a?(be=t,t=r=(i=n)?r?-i:i:0):(ye=t,t=a),Oe--,t===a&&(r=a,0===Oe&&_e(ae)),t}function Ke(){var t,r;return Oe++,t=ye,e.substr(ye,2)===se?(r=se,ye+=2):(r=a,0===Oe&&_e(ue)),r!==a&&(be=t,r="'"),Oe--,(t=r)===a&&(r=a,0===Oe&&_e(oe)),t}function We(){var t,r,n,i,o,s;if(t=ye,39===e.charCodeAt(ye)?(r=j,ye++):(r=a,0===Oe&&_e(T)),r!==a)if(n=function(){var t,r,n,i,o;return t=ye,r=ye,e.length>ye?(n=e.charAt(ye),ye++):(n=a,0===Oe&&_e(y)),n!==a?(be=ye,(i=(i="{"===(o=n)||"}"===o||at()&&"#"===o)?void 0:a)!==a?r=n=[n,i]:(ye=r,r=a)):(ye=r,r=a),t=r!==a?e.substring(t,ye):r}(),n!==a){for(i=ye,o=[],e.substr(ye,2)===se?(s=se,ye+=2):(s=a,0===Oe&&_e(ue)),s===a&&(_.test(e.charAt(ye))?(s=e.charAt(ye),ye++):(s=a,0===Oe&&_e(R)));s!==a;)o.push(s),e.substr(ye,2)===se?(s=se,ye+=2):(s=a,0===Oe&&_e(ue)),s===a&&(_.test(e.charAt(ye))?(s=e.charAt(ye),ye++):(s=a,0===Oe&&_e(R)));(i=o!==a?e.substring(i,ye):o)!==a?(39===e.charCodeAt(ye)?(o=j,ye++):(o=a,0===Oe&&_e(T)),o===a&&(o=null),o!==a?(be=t,t=r=n+i.replace("''","'")):(ye=t,t=a)):(ye=t,t=a)}else ye=t,t=a;else ye=t,t=a;return t}function $e(){var t,r,n,i,o;return t=ye,r=ye,e.length>ye?(n=e.charAt(ye),ye++):(n=a,0===Oe&&_e(y)),n!==a?(be=ye,(i=(i=!("{"===(o=n)||at()&&"#"===o||nt.length>1&&"}"===o))?void 0:a)!==a?r=n=[n,i]:(ye=r,r=a)):(ye=r,r=a),r===a&&(10===e.charCodeAt(ye)?(r="\n",ye++):(r=a,0===Oe&&_e(le))),r!==a?e.substring(t,ye):r}function Ye(){var t,r;return Oe++,t=ye,(r=Xe())===a&&(r=Je()),t=r!==a?e.substring(t,ye):r,Oe--,t===a&&(r=a,0===Oe&&_e(ce)),t}function Xe(){var t,r,n,i,o;if(Oe++,t=ye,48===e.charCodeAt(ye)?(r="0",ye++):(r=a,0===Oe&&_e(fe)),r!==a&&(be=t,r=0),(t=r)===a){if(t=ye,r=ye,pe.test(e.charAt(ye))?(n=e.charAt(ye),ye++):(n=a,0===Oe&&_e(he)),n!==a){for(i=[],me.test(e.charAt(ye))?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(ve));o!==a;)i.push(o),me.test(e.charAt(ye))?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(ve));i!==a?r=n=[n,i]:(ye=r,r=a)}else ye=r,r=a;r!==a&&(be=t,r=parseInt(r.join(""),10)),t=r}return Oe--,t===a&&(r=a,0===Oe&&_e(de)),t}function Je(){var t,r,n,i,o;if(Oe++,t=ye,r=[],n=ye,i=ye,Oe++,(o=Ve())===a&&(o=Ge()),Oe--,o===a?i=void 0:(ye=i,i=a),i!==a?(e.length>ye?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(y)),o!==a?n=i=[i,o]:(ye=n,n=a)):(ye=n,n=a),n!==a)for(;n!==a;)r.push(n),n=ye,i=ye,Oe++,(o=Ve())===a&&(o=Ge()),Oe--,o===a?i=void 0:(ye=i,i=a),i!==a?(e.length>ye?(o=e.charAt(ye),ye++):(o=a,0===Oe&&_e(y)),o!==a?n=i=[i,o]:(ye=n,n=a)):(ye=n,n=a);else r=a;return t=r!==a?e.substring(t,ye):r,Oe--,t===a&&(r=a,0===Oe&&_e(ge)),t}var et,tt,rt,nt=["root"];function at(){return"plural"===nt[nt.length-1]}function it(){return t&&t.captureLocation?{location:xe()}:{}}if((r=o())!==a&&ye===e.length)return r;throw r!==a&&ye1)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(A,(function(e,r,n){return"."===e?t.maximumFractionDigits=0:"+"===n?t.minimumFractionDigits=n.length:"#"===r[0]?t.maximumFractionDigits=r.length:(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length+("string"==typeof n?n.length:0)),""})),a.options.length&&(t=x(x({},t),j(a.options[0])))}else if(C.test(a.stem))t=x(x({},t),j(a.stem));else{var i=T(a.stem);i&&(t=x(x({},t),i))}}return t}var F,I=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),L=function(e){function t(t,r){var n=e.call(this,t)||this;return n.variableId=r,n}return I(t,e),t}(Error);function M(e,t,r,n,h,m,v){if(1===e.length&&a(e[0]))return[{type:0,value:e[0].value}];for(var g,y=[],b=0,w=e;b(.*?)<\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\/>)/,Q=Date.now()+"@@",V=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function G(e,t,r){var n=e.tagName,a=e.outerHTML,i=e.textContent,o=e.childNodes;if(!n)return q(i||"",t);n=n.toLowerCase();var s=~V.indexOf(n),u=r[n];if(u&&s)throw new L(n+" is a self-closing tag and can not be used, please use another tag name.");if(!o.length)return[a];var l=Array.prototype.slice.call(o).reduce((function(e,n){return e.concat(G(n,t,r))}),[]);return u?"function"==typeof u?[u.apply(void 0,l)]:[u]:function(){for(var e=0,t=0,r=arguments.length;t"],l,[""])}function H(e,t,r,n,a,i){var o=M(e,t,r,n,a,void 0,i),s={},u=o.reduce((function(e,t){if(0===t.type)return e+t.value;var r=Date.now()+"_"+ ++U;return s[r]=t.value,e+"@@"+r+"@@"}),"");if(!B.test(u))return q(u,s);if(!a)throw new L("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new L("Cannot format XML message without DOMParser");F||(F=new DOMParser);var l=F.parseFromString(''+u+"","text/html").getElementById(Q);if(!l)throw new L("Malformed HTML message "+u);var c=Object.keys(a).filter((function(e){return!!l.getElementsByTagName(e).length}));if(!c.length)return q(u,s);var d=c.filter((function(e){return e!==e.toLowerCase()}));if(d.length)throw new L("HTML tag must be lowercased but the following tags are not: "+d.join(", "));return Array.prototype.slice.call(l.childNodes).reduce((function(e,t){return e.concat(G(t,s,a))}),[])}var Z=function(){return Z=Object.assign||function(e){for(var t,r=1,n=arguments.length;r{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},i=t||{},s=e.split(a),u=i.decode||r,l=0;l{"use strict";t.decode=t.parse=r(12),t.encode=t.stringify=r(13)},(e,t,r)=>{"use strict";e.exports=r(27)},(e,t)=>{"use strict";var r={TimePicker:{openButton:"data-testid TimePicker Open Button",fromField:"Time Range from field",toField:"Time Range to field",applyTimeRange:"data-testid TimePicker submit button",calendar:{label:"Time Range calendar",openButton:"Open time range calendar",closeButton:"Close time range Calendar"},absoluteTimeRangeTitle:"data-testid-absolute-time-range-narrow"},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:"Test Data Query scenario select container",scenarioSelect:"Test Data Query scenario select",max:"TestData max",min:"TestData min",noise:"TestData noise",seriesCount:"TestData series count",spread:"TestData spread",startValue:"TestData start value",drop:"TestData drop values"}},DataSourceHttpSettings:{urlInput:"Datasource HTTP settings url"},Jaeger:{traceIDInput:"Trace ID"},Prometheus:{configPage:{exemplarsAddButton:"Add exemplar config button",internalLinkSwitch:"Internal link switch"},exemplarMarker:"Exemplar marker"}},Menu:{MenuComponent:function(e){return e+" menu"},MenuGroup:function(e){return e+" menu group"},MenuItem:function(e){return e+" menu item"},SubMenu:{container:"SubMenu container",icon:"SubMenu icon"}},Panels:{Panel:{title:function(e){return"data-testid Panel header "+e},headerItems:function(e){return"Panel header item "+e},containerByTitle:function(e){return e+" panel"},headerCornerInfo:function(e){return"Panel header "+e}},Visualization:{Graph:{VisualizationTab:{legendSection:"Legend section"},Legend:{legendItemAlias:function(e){return"gpl alias "+e},showLegendSwitch:"gpl show legend"},xAxis:{labels:function(){return"div.flot-x-axis > div.flot-tick-label"}}},BarGauge:{value:"Bar gauge value",valueV2:"data-testid Bar gauge value"},PieChart:{svgSlice:"Pie Chart Slice"},Text:{container:function(){return".markdown-html"}},Table:{header:"table header",footer:"table-footer"}}},VizLegend:{seriesName:function(e){return"VizLegend series "+e}},Drawer:{General:{title:function(e){return"Drawer title "+e},expand:"Drawer expand",contract:"Drawer contract",close:"Drawer close",rcContentWrapper:function(){return".drawer-content-wrapper"}}},PanelEditor:{General:{content:"Panel editor content"},OptionsPane:{content:"Panel editor option pane content",select:"Panel editor option pane select",fieldLabel:function(e){return e+" field property editor"}},DataPane:{content:"Panel editor data pane content"},applyButton:"panel editor apply",toggleVizPicker:"toggle-viz-picker",toggleVizOptions:"toggle-viz-options",toggleTableView:"toggle-table-view"},PanelInspector:{Data:{content:"Panel inspector Data content"},Stats:{content:"Panel inspector Stats content"},Json:{content:"Panel inspector Json content"},Query:{content:"Panel inspector Query content",refreshButton:"Panel inspector Query refresh button",jsonObjectKeys:function(){return".json-formatter-key"}}},Tab:{title:function(e){return"Tab "+e},active:function(){return'[class*="-activeTabStyle"]'}},RefreshPicker:{runButton:"RefreshPicker run button",intervalButton:"RefreshPicker interval button",runButtonV2:"data-testid RefreshPicker run button",intervalButtonV2:"data-testid RefreshPicker interval button"},QueryTab:{content:"Query editor tab content",queryInspectorButton:"Query inspector button",addQuery:"Query editor add query button"},QueryEditorRows:{rows:"Query editor row"},QueryEditorRow:{actionButton:function(e){return e+" query operation action"},title:function(e){return"Query editor row title "+e}},AlertTab:{content:"Alert editor tab content"},Alert:{alert:function(e){return"Alert "+e},alertV2:function(e){return"data-testid Alert "+e}},TransformTab:{content:"Transform editor tab content",newTransform:function(e){return"New transform "+e},transformationEditor:function(e){return"Transformation editor "+e},transformationEditorDebugger:function(e){return"Transformation editor debugger "+e}},Transforms:{card:function(e){return"New transform "+e},Reduce:{modeLabel:"Transform mode label",calculationsLabel:"Transform calculations label"},searchInput:"search transformations"},PageToolbar:{container:function(){return".page-toolbar"},item:function(e){return""+e}},QueryEditorToolbarItem:{button:function(e){return"QueryEditor toolbar item button "+e}},BackButton:{backArrow:"Go Back"},OptionsGroup:{group:function(e){return e?"Options group "+e:"Options group"},toggle:function(e){return e?"Options group "+e+" toggle":"Options group toggle"}},PluginVisualization:{item:function(e){return"Plugin visualization item "+e},current:function(){return'[class*="-currentVisualizationItem"]'}},Select:{option:"Select option",input:function(){return'input[id*="time-options-input"]'},singleValue:function(){return'div[class*="-singleValue"]'}},FieldConfigEditor:{content:"Field config editor content"},OverridesConfigEditor:{content:"Field overrides editor content"},FolderPicker:{container:"Folder picker select container",containerV2:"data-testid Folder picker select container",input:"Select a folder"},ReadonlyFolderPicker:{container:"data-testid Readonly folder picker select container"},DataSourcePicker:{container:"Data source picker select container",input:function(){return'input[id="data-source-picker"]'},inputV2:"Select a data source"},TimeZonePicker:{container:"Time zone picker select container",containerV2:"data-testid Time zone picker select container"},WeekStartPicker:{container:"Choose starting day of the week",containerV2:"data-testid Choose starting day of the week",placeholder:"Choose starting day of the week"},TraceViewer:{spanBar:function(){return'[data-test-id="SpanBar--wrapper"]'}},QueryField:{container:"Query field"},ValuePicker:{button:function(e){return"Value picker button "+e},select:function(e){return"Value picker select "+e}},Search:{section:"Search section",sectionV2:"data-testid Search section",items:"Search items",itemsV2:"data-testid Search items",cards:"data-testid Search cards",collapseFolder:function(e){return"data-testid Collapse folder "+e},expandFolder:function(e){return"data-testid Expand folder "+e},dashboardItem:function(e){return r.Search.dashboardItems+" "+e},dashboardCard:function(e){return"data-testid Search card "+e},dashboardItems:"data-testid Dashboard search item"},DashboardLinks:{container:"data-testid Dashboard link container",dropDown:"data-testid Dashboard link dropdown",link:"data-testid Dashboard link"},LoadingIndicator:{icon:"Loading indicator"},CallToActionCard:{button:function(e){return"Call to action button "+e},buttonV2:function(e){return"data-testid Call to action button "+e}},DataLinksContextMenu:{singleLink:"Data link"},CodeEditor:{container:"Code editor container"},DashboardImportPage:{textarea:"data-testid-import-dashboard-textarea",submit:"data-testid-load-dashboard"},ImportDashboardForm:{name:"data-testid-import-dashboard-title",submit:"data-testid-import-dashboard-submit"},PanelAlertTabContent:{content:"Unified alert editor tab content"},VisualizationPreview:{card:function(e){return"data-testid suggestion-"+e}},ColorSwatch:{name:"data-testid-colorswatch"},DashboardRow:{title:function(e){return"data-testid dashboard-row-title-"+e}},UserProfile:{profileSaveButton:"data-testid-user-profile-save",preferencesSaveButton:"data-testid-shared-prefs-save",orgsTable:"data-testid-user-orgs-table",sessionsTable:"data-testid-user-sessions-table"}},n={pages:{Login:{url:"/login",username:"Username input field",password:"Password input field",submit:"Login button",skip:"Skip change password button"},Home:{url:"/"},DataSource:{name:"Data source settings page name input field",delete:"Data source settings page Delete button",readOnly:"Data source settings page read only message",saveAndTest:"Data source settings page Save and Test button",alert:"Data source settings page Alert"},DataSources:{url:"/datasources",dataSources:function(e){return"Data source list item "+e}},AddDataSource:{url:"/datasources/new",dataSourcePlugins:function(e){return"Data source plugin item "+e},dataSourcePluginsV2:function(e){return"Add data source "+e}},ConfirmModal:{delete:"Confirm Modal Danger Button"},AddDashboard:{url:"/dashboard/new",addNewPanel:"Add new panel",addNewRow:"Add new row",addNewPanelLibrary:"Add new panel from panel library"},Dashboard:{url:function(e){return"/d/"+e},DashNav:{nav:"Dashboard navigation",navV2:"data-testid Dashboard navigation"},SubMenu:{submenu:"Dashboard submenu",submenuItem:"data-testid template variable",submenuItemLabels:function(e){return"data-testid Dashboard template variables submenu Label "+e},submenuItemValueDropDownValueLinkTexts:function(e){return"data-testid Dashboard template variables Variable Value DropDown value link text "+e},submenuItemValueDropDownDropDown:"Variable options",submenuItemValueDropDownOptionTexts:function(e){return"data-testid Dashboard template variables Variable Value DropDown option text "+e}},Settings:{General:{deleteDashBoard:"Dashboard settings page delete dashboard button",sectionItems:function(e){return"Dashboard settings section item "+e},saveDashBoard:"Dashboard settings aside actions Save button",saveAsDashBoard:"Dashboard settings aside actions Save As button",timezone:"Time zone picker select container",title:"Dashboard settings page title"},Annotations:{List:{addAnnotationCTA:r.CallToActionCard.button("Add annotation query"),addAnnotationCTAV2:r.CallToActionCard.buttonV2("Add annotation query")},Settings:{name:"Annotations settings name input"}},Variables:{List:{addVariableCTA:r.CallToActionCard.button("Add variable"),addVariableCTAV2:r.CallToActionCard.buttonV2("Add variable"),newButton:"Variable editor New variable button",table:"Variable editor Table",tableRowNameFields:function(e){return"Variable editor Table Name field "+e},tableRowDefinitionFields:function(e){return"Variable editor Table Definition field "+e},tableRowArrowUpButtons:function(e){return"Variable editor Table ArrowUp button "+e},tableRowArrowDownButtons:function(e){return"Variable editor Table ArrowDown button "+e},tableRowDuplicateButtons:function(e){return"Variable editor Table Duplicate button "+e},tableRowRemoveButtons:function(e){return"Variable editor Table Remove button "+e}},Edit:{General:{headerLink:"Variable editor Header link",modeLabelNew:"Variable editor Header mode New",modeLabelEdit:"Variable editor Header mode Edit",generalNameInput:"Variable editor Form Name field",generalTypeSelect:"Variable editor Form Type select",generalLabelInput:"Variable editor Form Label field",generalHideSelect:"Variable editor Form Hide select",selectionOptionsMultiSwitch:"Variable editor Form Multi switch",selectionOptionsIncludeAllSwitch:"Variable editor Form IncludeAll switch",selectionOptionsCustomAllInput:"Variable editor Form IncludeAll field",previewOfValuesOption:"Variable editor Preview of Values option",submitButton:"Variable editor Submit button"},QueryVariable:{queryOptionsDataSourceSelect:r.DataSourcePicker.container,queryOptionsRefreshSelect:"Variable editor Form Query Refresh select",queryOptionsRegExInput:"Variable editor Form Query RegEx field",queryOptionsSortSelect:"Variable editor Form Query Sort select",queryOptionsQueryInput:"Variable editor Form Default Variable Query Editor textarea",valueGroupsTagsEnabledSwitch:"Variable editor Form Query UseTags switch",valueGroupsTagsTagsQueryInput:"Variable editor Form Query TagsQuery field",valueGroupsTagsTagsValuesQueryInput:"Variable editor Form Query TagsValuesQuery field"},ConstantVariable:{constantOptionsQueryInput:"Variable editor Form Constant Query field"},TextBoxVariable:{textBoxOptionsQueryInput:"Variable editor Form TextBox Query field"}}}}},Dashboards:{url:"/dashboards",dashboards:function(e){return"Dashboard search item "+e}},SaveDashboardAsModal:{newName:"Save dashboard title field",save:"Save dashboard button"},SaveDashboardModal:{save:"Dashboard settings Save Dashboard Modal Save button",saveVariables:"Dashboard settings Save Dashboard Modal Save variables checkbox",saveTimerange:"Dashboard settings Save Dashboard Modal Save timerange checkbox"},SharePanelModal:{linkToRenderedImage:"Link to rendered image"},Explore:{url:"/explore",General:{container:"data-testid Explore",graph:"Explore Graph",table:"Explore Table",scrollBar:function(){return".scrollbar-view"}}},SoloPanel:{url:function(e){return"/d-solo/"+e}},PluginsList:{page:"Plugins list page",list:"Plugins list",listItem:"Plugins list item",signatureErrorNotice:"Unsigned plugins notice"},PluginPage:{page:"Plugin page",signatureInfo:"Plugin signature info",disabledInfo:"Plugin disabled info"},PlaylistForm:{name:"Playlist name",interval:"Playlist interval",itemRow:"Playlist item row",itemIdType:"Playlist item dashboard by ID type",itemTagType:"Playlist item dashboard by Tag type",itemMoveUp:"Move playlist item order up",itemMoveDown:"Move playlist item order down",itemDelete:"Delete playlist item"}},components:r};t.selectors=n},e=>{"use strict";e.exports=JSON.parse('{"enable":"Enable","disable":"Disable","grafana_details":"Grafana Details","email_details":"Email Details","datasource_details":"Datasource Details","grafana_username_tooltip":"The username and password of the Grafana user to be able to collect data for reports.","grafana_username":"Grafana username","grafana_password":"Grafana password","grafana_password_tooltip":"Grafana password","grafana_url":"Grafana URL","grafana_url_tooltip":"The URL of the Grafana instance","email_address":"Email address","email_tooltip":"The email account from which to send emails from.","email_password":"Email password","email_password_tooltip":"The password of the email account from which to send emails from.","email_port":"Email port","email_host":"Email host","email_port_tooltip":"The port of the email address from which to send emails from.","email_host_tooltip":"The host of the email address from which to send emails from.","save_details":"Save details","save_details_description":"Save and update the newly added information.","required":"Required!","submit":"Submit","report_groups":"Report Groups","report_schedules":"Report Schedules","add_report_group":"Add report group","msupply":"mSupply","delete_report_group":"Delete report group","delete_report_group_question":"Are you sure you want to delete this report group?","delete_report_schedule":"Delete report schedule","delete_report_schedule_question":"Are you sure you want to delete this report schedule?","delete":"DELETE","no_email":"No email for this user","edit_report_group":"Edit Report Group","name":"Name","group_name":"Group name","description":"Description","group_description":"Group description","add_schedule":"Add schedule","edit_report_schedule":"Edit Report Schedule","daily":"Daily","weekly":"Weekly","fortnightly":"Fortnightly","monthly":"Monthly","quarterly":"Quarterly","yearly":"Yearly","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday","sunday":"Sunday","report_group":"Report group","report_interval":"Report interval","report_interval_description":"The interval frequency for emails to be sent","report_group_description":"The report group assigned to this schedule","choose_stores":"Choose stores for which this report should be run for","lookback_period":"Lookback period","lookback_period_description":"The amount of time to lookback for reports","selected_stores":"Stores","selected_stores_description":"The stores for which this the report should be run for","1day":"1 Day","2days":"2 Days","3days":"3 Days","1week":"1 Week","2weeks":"2 Weeks","4weeks":"4 Weeks","3months":"3 Months","6months":"6 Months","1year":"1 Year","datasource":"Datasource","datasource_tooltip":"Select the datasource where your mSupply data is held.","new_report_group":"New report group","variables":"Variables","variables_tooltip":"These are the variables which are used within this panels query. They are created within the panels dashboard settings - view that for more information.","edit_details":"Edit details","edit_details_report_group_tooltip":"Edit the details of this report group here.","edit_details_schedule_tooltip":"Edit the details of this report schedule here.","available_panels":"Available Panels","available_panels_tooltip":"This is a list of all panels which are available to be added as a sheet within an emailed report. They are panels created within any dashboard of your Grafana instance with a few requirements. Panels must use a table format, and must only use variables which are either a query or custom type. For query type variables, the datasource must be the same datasource as defined in this mSupply app configuration.","users":"Users","users_tooltip":"Select a user who should be a part of this report group and receive emails from any report schedule assigned this group. Only users who have an email entered into your mSupply instance can be selected.","send_test_emails":"SEND TEST","report_time":"Report time","report_time_description":"The time at which to send emails","report_day":"Report day","report_day_description":"The number of the day in the month/quarter/year in which to send. Use a value greater than the possible number of days to force \'last day\' eg day 31 or greater when emailing monthly will always send on the last day of the month."}')},e=>{"use strict";e.exports=s},(e,t,r)=>{"use strict";function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}r.d(t,{Z:()=>a})},(e,t,r)=>{"use strict";r.d(t,{A4:()=>x,G9:()=>P,Gh:()=>D,I6:()=>f,Kp:()=>l,PN:()=>s,Q$:()=>b,Rm:()=>m,SE:()=>o,VS:()=>w,X7:()=>h,ZT:()=>i,_v:()=>c,_x:()=>p,lV:()=>d,mc:()=>u,sk:()=>a,to:()=>g,yF:()=>v});var n=r(32),a="undefined"==typeof window;function i(){}function o(e,t){return"function"==typeof e?e(t):e}function s(e){return"number"==typeof e&&e>=0&&e!==1/0}function u(e){return Array.isArray(e)?e:[e]}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function c(e,t,r){return O(e)?"function"==typeof t?(0,n.Z)({},r,{queryKey:e,queryFn:t}):(0,n.Z)({},t,{queryKey:e}):e}function d(e,t,r){return O(e)?"function"==typeof t?(0,n.Z)({},r,{mutationKey:e,mutationFn:t}):(0,n.Z)({},t,{mutationKey:e}):"function"==typeof e?(0,n.Z)({},t,{mutationFn:e}):(0,n.Z)({},e)}function f(e,t,r){return O(e)?[(0,n.Z)({},t,{queryKey:e}),r]:[e||{},t]}function p(e,t){var r=e.active,n=e.exact,a=e.fetching,i=e.inactive,o=e.predicate,s=e.queryKey,u=e.stale;if(O(s))if(n){if(t.queryHash!==m(s,t.options))return!1}else if(!g(t.queryKey,s))return!1;var l=function(e,t){return!0===e&&!0===t||null==e&&null==t?"all":!1===e&&!1===t?"none":(null!=e?e:!t)?"active":"inactive"}(r,i);if("none"===l)return!1;if("all"!==l){var c=t.isActive();if("active"===l&&!c)return!1;if("inactive"===l&&c)return!1}return!("boolean"==typeof u&&t.isStale()!==u||"boolean"==typeof a&&t.isFetching()!==a||o&&!o(t))}function h(e,t){var r=e.exact,n=e.fetching,a=e.predicate,i=e.mutationKey;if(O(i)){if(!t.options.mutationKey)return!1;if(r){if(v(t.options.mutationKey)!==v(i))return!1}else if(!g(t.options.mutationKey,i))return!1}return!("boolean"==typeof n&&"loading"===t.state.status!==n||a&&!a(t))}function m(e,t){return((null==t?void 0:t.queryKeyHashFn)||v)(e)}function v(e){var t;return t=u(e),JSON.stringify(t,(function(e,t){return E(t)?Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{}):t}))}function g(e,t){return y(u(e),u(t))}function y(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((function(r){return!y(e[r],t[r])}))}function b(e,t){if(e===t)return e;var r=Array.isArray(e)&&Array.isArray(t);if(r||E(e)&&E(t)){for(var n=r?e.length:Object.keys(e).length,a=r?t:Object.keys(t),i=a.length,o=r?[]:{},s=0,u=0;u{"use strict";function n(){return n=Object.assign||function(e){for(var t=1;tn})},(e,t,r)=>{"use strict";r.d(t,{DV:()=>l,LE:()=>s,m4:()=>c});var n=r(34),a=r(36),i=r(31);function o(e){return Math.min(1e3*Math.pow(2,e),3e4)}function s(e){return"function"==typeof(null==e?void 0:e.cancel)}var u=function(e){this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent};function l(e){return e instanceof u}var c=function(e){var t,r,l,c,d=this,f=!1;this.abort=e.abort,this.cancel=function(e){return null==t?void 0:t(e)},this.cancelRetry=function(){f=!0},this.continueRetry=function(){f=!1},this.continue=function(){return null==r?void 0:r()},this.failureCount=0,this.isPaused=!1,this.isResolved=!1,this.isTransportCancelable=!1,this.promise=new Promise((function(e,t){l=e,c=t}));var p=function(t){d.isResolved||(d.isResolved=!0,null==e.onSuccess||e.onSuccess(t),null==r||r(),l(t))},h=function(t){d.isResolved||(d.isResolved=!0,null==e.onError||e.onError(t),null==r||r(),c(t))};!function l(){if(!d.isResolved){var c;try{c=e.fn()}catch(e){c=Promise.reject(e)}t=function(e){if(!d.isResolved&&(h(new u(e)),null==d.abort||d.abort(),s(c)))try{c.cancel()}catch(e){}},d.isTransportCancelable=s(c),Promise.resolve(c).then(p).catch((function(t){var s,u;if(!d.isResolved){var c=null!=(s=e.retry)?s:3,p=null!=(u=e.retryDelay)?u:o,m="function"==typeof p?p(d.failureCount,t):p,v=!0===c||"number"==typeof c&&d.failureCount{"use strict";r.d(t,{j:()=>o});var n=r(30),a=r(35),i=r(31),o=new(function(e){function t(){var t;return(t=e.call(this)||this).setup=function(e){var t;if(!i.sk&&(null==(t=window)?void 0:t.addEventListener)){var r=function(){return e()};return window.addEventListener("visibilitychange",r,!1),window.addEventListener("focus",r,!1),function(){window.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r)}}},t}(0,n.Z)(t,e);var r=t.prototype;return r.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},r.onUnsubscribe=function(){var e;this.hasListeners()||(null==(e=this.cleanup)||e.call(this),this.cleanup=void 0)},r.setEventListener=function(e){var t,r=this;this.setup=e,null==(t=this.cleanup)||t.call(this),this.cleanup=e((function(e){"boolean"==typeof e?r.setFocused(e):r.onFocus()}))},r.setFocused=function(e){this.focused=e,e&&this.onFocus()},r.onFocus=function(){this.listeners.forEach((function(e){e()}))},r.isFocused=function(){return"boolean"==typeof this.focused?this.focused:"undefined"==typeof document||[void 0,"visible","prerender"].includes(document.visibilityState)},t}(a.l))},(e,t,r)=>{"use strict";r.d(t,{l:()=>n});var n=function(){function e(){this.listeners=[]}var t=e.prototype;return t.subscribe=function(e){var t=this,r=e||function(){};return this.listeners.push(r),this.onSubscribe(),function(){t.listeners=t.listeners.filter((function(e){return e!==r})),t.onUnsubscribe()}},t.hasListeners=function(){return this.listeners.length>0},t.onSubscribe=function(){},t.onUnsubscribe=function(){},e}()},(e,t,r)=>{"use strict";r.d(t,{N:()=>o});var n=r(30),a=r(35),i=r(31),o=new(function(e){function t(){var t;return(t=e.call(this)||this).setup=function(e){var t;if(!i.sk&&(null==(t=window)?void 0:t.addEventListener)){var r=function(){return e()};return window.addEventListener("online",r,!1),window.addEventListener("offline",r,!1),function(){window.removeEventListener("online",r),window.removeEventListener("offline",r)}}},t}(0,n.Z)(t,e);var r=t.prototype;return r.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},r.onUnsubscribe=function(){var e;this.hasListeners()||(null==(e=this.cleanup)||e.call(this),this.cleanup=void 0)},r.setEventListener=function(e){var t,r=this;this.setup=e,null==(t=this.cleanup)||t.call(this),this.cleanup=e((function(e){"boolean"==typeof e?r.setOnline(e):r.onOnline()}))},r.setOnline=function(e){this.online=e,e&&this.onOnline()},r.onOnline=function(){this.listeners.forEach((function(e){e()}))},r.isOnline=function(){return"boolean"==typeof this.online?this.online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine},t}(a.l))},(e,t,r)=>{"use strict";r.d(t,{E:()=>i,j:()=>a});var n=console;function a(){return n}function i(e){n=e}},(e,t,r)=>{"use strict";r.d(t,{V:()=>a});var n=r(31),a=new(function(){function e(){this.queue=[],this.transactions=0,this.notifyFn=function(e){e()},this.batchNotifyFn=function(e){e()}}var t=e.prototype;return t.batch=function(e){var t;this.transactions++;try{t=e()}finally{this.transactions--,this.transactions||this.flush()}return t},t.schedule=function(e){var t=this;this.transactions?this.queue.push(e):(0,n.A4)((function(){t.notifyFn(e)}))},t.batchCalls=function(e){var t=this;return function(){for(var r=arguments.length,n=new Array(r),a=0;a{"use strict";r.d(t,{R:()=>l,m:()=>u});var n=r(32),a=r(37),i=r(38),o=r(33),s=r(31),u=function(){function e(e){this.options=(0,n.Z)({},e.defaultOptions,e.options),this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.observers=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,isPaused:!1,status:"idle",variables:void 0},this.meta=e.meta}var t=e.prototype;return t.setState=function(e){this.dispatch({type:"setState",state:e})},t.addObserver=function(e){-1===this.observers.indexOf(e)&&this.observers.push(e)},t.removeObserver=function(e){this.observers=this.observers.filter((function(t){return t!==e}))},t.cancel=function(){return this.retryer?(this.retryer.cancel(),this.retryer.promise.then(s.ZT).catch(s.ZT)):Promise.resolve()},t.continue=function(){return this.retryer?(this.retryer.continue(),this.retryer.promise):this.execute()},t.execute=function(){var e,t=this,r="loading"===this.state.status,n=Promise.resolve();return r||(this.dispatch({type:"loading",variables:this.options.variables}),n=n.then((function(){null==t.mutationCache.config.onMutate||t.mutationCache.config.onMutate(t.state.variables,t)})).then((function(){return null==t.options.onMutate?void 0:t.options.onMutate(t.state.variables)})).then((function(e){e!==t.state.context&&t.dispatch({type:"loading",context:e,variables:t.state.variables})}))),n.then((function(){return t.executeMutation()})).then((function(r){e=r,null==t.mutationCache.config.onSuccess||t.mutationCache.config.onSuccess(e,t.state.variables,t.state.context,t)})).then((function(){return null==t.options.onSuccess?void 0:t.options.onSuccess(e,t.state.variables,t.state.context)})).then((function(){return null==t.options.onSettled?void 0:t.options.onSettled(e,null,t.state.variables,t.state.context)})).then((function(){return t.dispatch({type:"success",data:e}),e})).catch((function(e){return null==t.mutationCache.config.onError||t.mutationCache.config.onError(e,t.state.variables,t.state.context,t),(0,a.j)().error(e),Promise.resolve().then((function(){return null==t.options.onError?void 0:t.options.onError(e,t.state.variables,t.state.context)})).then((function(){return null==t.options.onSettled?void 0:t.options.onSettled(void 0,e,t.state.variables,t.state.context)})).then((function(){throw t.dispatch({type:"error",error:e}),e}))}))},t.executeMutation=function(){var e,t=this;return this.retryer=new o.m4({fn:function(){return t.options.mutationFn?t.options.mutationFn(t.state.variables):Promise.reject("No mutationFn found")},onFail:function(){t.dispatch({type:"failed"})},onPause:function(){t.dispatch({type:"pause"})},onContinue:function(){t.dispatch({type:"continue"})},retry:null!=(e=this.options.retry)?e:0,retryDelay:this.options.retryDelay}),this.retryer.promise},t.dispatch=function(e){var t=this;this.state=function(e,t){switch(t.type){case"failed":return(0,n.Z)({},e,{failureCount:e.failureCount+1});case"pause":return(0,n.Z)({},e,{isPaused:!0});case"continue":return(0,n.Z)({},e,{isPaused:!1});case"loading":return(0,n.Z)({},e,{context:t.context,data:void 0,error:null,isPaused:!1,status:"loading",variables:t.variables});case"success":return(0,n.Z)({},e,{data:t.data,error:null,status:"success",isPaused:!1});case"error":return(0,n.Z)({},e,{data:void 0,error:t.error,failureCount:e.failureCount+1,isPaused:!1,status:"error"});case"setState":return(0,n.Z)({},e,t.state);default:return e}}(this.state,e),i.V.batch((function(){t.observers.forEach((function(t){t.onMutationUpdate(e)})),t.mutationCache.notify(t)}))},e}();function l(){return{context:void 0,data:void 0,error:null,failureCount:0,isPaused:!1,status:"idle",variables:void 0}}}],l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={id:e,loaded:!1,exports:{}};return u[e].call(r.exports,r,r.exports,c),r.loaded=!0,r.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var d={};return(()=>{"use strict";c.r(d),c.d(d,{plugin:()=>Yt});var e=c(8),t=c(0),r=c.n(t),n=c(3),a=c(4),i=c.n(a),o=r().createContext(null),s=function(){return(0,t.useContext)(o)};function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);ae.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0})).map((function(e){var t=e.panels,r=e.templating,n=e.uid,a=t.filter((function(e){var t=e.type;return"table"===t||"table-old"===t||"msupplyfoundation-table"===t})).map((function(e){var t,n=w(e.targets,1)[0].rawSql,a="";return r.list.filter((function(e){var t=e.type,r=e.datasource;return"datasource"===t||"adhoc"===t||"query"===t&&void 0!==r&&("object"===b(r)&&null!==r?r.type.includes(o):r!==o)})).some((function(e){var t=e.name;return y(n,t)}))?a="This panel uses an unsupported variable.":(t=n,RegExp(/(?!.*\$__timeFrom\(\).*)(?!.*\$__timeTo\(\).*)(?!.*\$__timeFilter\(.+\).*)(\$__.*)/g).test(t)&&(a="This panel uses an unsupported macro.")),Object.assign(Object.assign({},e),{error:a})})).map((function(e){var t,a=e.targets,i=e.description,o=e.title,s=e.id,u=e.type,l=e.error,c=w(a,1)[0].rawSql,d=n,f=r.list,p=null!==(t=null==f?void 0:f.reduce((function(e,t){return y(c,t.name)?[].concat(function(e){if(Array.isArray(e))return S(e)}(r=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||E(r)||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.")}(),[t]):e;var r}),[]))&&void 0!==t?t:[];return{error:l,rawSql:c,description:i,title:o,id:s,variables:p,dashboardID:d,type:u}}));return a})).flat(),t.abrupt("return",s);case 18:case"end":return t.stop()}}),t)})))}(f)}),{enabled:!!f,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:0}),h=p.data;return(0,t.useEffect)((function(){if(h){var e=h.map((function(e){return{id:"",scheduleID:"",panelID:e.id,dashboardID:e.dashboardID,lookback:"",variables:""}}));s(e),d(!1)}}),[h]),r().createElement(X.Provider,{value:{panels:h||[],panelDetails:o,isPanelsLoading:c,setPanelDetails:s,onUpdateLookback:function(e){return function(t){s((function(r){var n=r.findIndex((function(t){return t.panelID===e.panelID&&t.dashboardID===e.dashboardID}));return[].concat(G(r.slice(0,n)),[Object.assign(Object.assign({},r[n]),{lookback:t.value})],G(r.slice(n+1)))}))}},onUpdateVariable:function(e,t){return function(r){return function(n){var a=n.map((function(e){return e.value.value})),i=V(e.variables,{});i[r]=a,s((function(e){var r=e.findIndex((function(e){return e.panelID===t.id&&e.dashboardID===t.dashboardID}));return[].concat(G(e.slice(0,r)),[Object.assign(Object.assign({},e[r]),{variables:JSON.stringify(i)})],G(e.slice(r+1)))}))}}}}},a)},ee=c(1),te=function(e){var r=e.isConfigured,n=e.onReset,a=u(e,["isConfigured","onReset"]);return r?t.createElement(ee.HorizontalGroup,null,t.createElement(ee.Input,Object.assign({},a,{type:"text",disabled:!0,value:"configured"})),t.createElement(ee.Button,{onClick:n,variant:"secondary"},"Reset")):t.createElement(ee.Input,Object.assign({},a,{type:"password"}))},re=c(2),ne=c(26);function ae(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ie,oe,se,ue=(0,re.css)(W||(W=ae(["\n text-align: center;\n"]))),le=(0,re.css)($||($=ae(["\n max-width: 700px;\n margin: 0 auto;\n"]))),ce=function(e){var t=e.title,n=e.buttonIcon,a=e.buttonLink,i=e.buttonTitle,o=e.buttonDisabled,s=e.onClick,u=e.proTip,l=e.proTipLink,c=e.proTipLinkTitle,d=e.proTipTarget,f=e.infoBox,p=e.infoBoxTitle,h=function(){return r().createElement(r().Fragment,null,u?r().createElement("span",{key:"proTipFooter"},r().createElement(ee.Icon,{name:"rocket"}),r().createElement(r().Fragment,null," ProTip: ",u," "),l&&r().createElement("a",{href:l,target:d,className:"text-link"},c)):"",f?r().createElement("div",{key:"infoBoxHtml",className:"grafana-info-box ".concat(le)},p&&r().createElement("h5",null,p),r().createElement("div",{dangerouslySetInnerHTML:f})):"")},m=h()?"":(0,re.css)(Y||(Y=ae(["\n margin-bottom: 20px;\n "]))),v=a?ee.LinkButton:ee.Button,g=r().createElement(v,{size:"lg",onClick:s,href:a,icon:n,className:m,"data-testid":ne.selectors.components.CallToActionCard.buttonV2(i),disabled:o},i);return r().createElement(ee.CallToActionCard,{className:ue,message:t,footer:h(),callToActionElement:g})};function de(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);rl,c=function(e,t){return r().createElement("li",{key:e,className:u.item},r().createElement(ee.Button,{type:"button",size:"sm",variant:t,onClick:function(){return i(e)}},e))};return t.reduce((function(e,t){var i=t+1,d=i===n?"primary":"secondary",f=l,p=a-l+1,h=p-f,m=h>-1&&n>=f&&n<=p,v=s?1:3,g=s?0:2;return o?1===i||i===a||n=0&&n>p&&i>p||h<0&&n>=f&&i>p||m&&i>=n-g&&i<=n+g?e.push(c(i,d)):(i===f&&np||m&&(i===n-v||i===n+v))&&e.push(r().createElement("li",{key:i,className:u.item},r().createElement(ee.Icon,{className:u.ellipsis,name:"ellipsis-v"}))):e.push(c(i,d)),e}),[])}),[n,a,i,l,s,u.ellipsis,u.item]);return o&&a<=1?null:r().createElement("div",{className:u.container},r().createElement("ol",null,r().createElement("li",{className:u.item},r().createElement(ee.Button,{type:"button","aria-label":"previous",size:"sm",variant:"secondary",onClick:function(){return i(n-1)},disabled:1===n},r().createElement(ee.Icon,{name:"angle-left"}))),c,r().createElement("li",{className:u.item},r().createElement(ee.Button,{type:"button","aria-label":"next",size:"sm",variant:"secondary",onClick:function(){return i(n+1)},disabled:n===a},r().createElement(ee.Icon,{name:"angle-right"})))))},ve=function(){return{container:(0,re.css)(ie||(ie=de(["\n float: right;\n "]))),item:(0,re.css)(oe||(oe=de(["\n display: inline-block;\n padding-left: 10px;\n margin-bottom: 5px;\n "]))),ellipsis:(0,re.css)(se||(se=de(["\n transform: rotate(90deg);\n "])))}},ge=function(e){var t,n,a,i=(0,ee.useStyles2)(ye);return r().createElement("div",{className:i.headerCanvas},r().createElement("div",{className:"page-container"},r().createElement("div",{className:"page-header"},(n=(t=e).title,a=t.subTitle,r().createElement("div",{className:"page-header__inner"},r().createElement("div",{className:"page-header__info-block"},r().createElement("h1",{className:"page-header__title"},n),a&&r().createElement("div",{className:"page-header__sub-title"},a))))),e.backButton&&r().createElement(ee.LinkButton,{icon:e.backButton.icon,href:e.backButton.href},"Back")))},ye=function(e){return{headerCanvas:(0,re.css)(pe||(t=["\n background: ",";\n "],r||(r=t.slice(0)),pe=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))),e.colors.background.canvas)};var t,r},be=function(e){var t=e.headerProps,n=e.children,a=e.className,i=u(e,["headerProps","children","className"]),o=(0,ee.useStyles2)(De);return r().createElement("div",Object.assign({},i,{className:(0,re.cx)(o.wrapper,a)}),r().createElement(ee.CustomScrollbar,{autoHeightMin:"100%"},r().createElement("div",{className:"page-scrollbar-content"},t&&r().createElement(ge,Object.assign({},t)),n)))};be.Contents=function(e){var t=e.children,n=e.className;return r().createElement("div",{className:(0,re.cx)("page-container","page-body",n),style:{marginTop:"20px"}},t)};var we,Ee,Se,Oe,De=function(e){return{wrapper:(0,re.css)(he||(t=["\n width: 100%;\n flex-grow: 1;\n min-height: 0;\n "],r||(r=t.slice(0)),he=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))))};var t,r},xe=function(e){var t=e.text,n=void 0===t?"loading...":t,a=u(e,["text"]),i=(0,ee.useStyles2)(Pe);return r().createElement("div",{className:i.loadingWrapper},r().createElement(ee.LoadingPlaceholder,Object.assign({text:n},a)))},Pe=function(){return{loadingWrapper:(0,re.css)(we||(e=["\n display: flex;\n height: 50vh;\n align-items: center;\n justify-content: center;\n "],t||(t=e.slice(0)),we=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))))};var e,t},ke={"en-US":c(28),"en-UK":{}};function Ae(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}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,i=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return je(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)?je(e,t):void 0}}(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 je(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1})),t=function(e){var t=20*(y.currentPage-1);return null==e?void 0:e.slice(t,t+20)}(e),r=Math.ceil(e.length/20);b((function(t){return Object.assign(Object.assign({},t),{currentPage:t.currentPage>r?1:t.currentPage,totalPages:e?r:1})})),c(t)}),[n,m,f,y.currentPage]),r().createElement(r().Fragment,null,r().createElement("div",{className:"page-action-bar"},r().createElement(ee.FieldSet,{label:"Selected Users"},o.length>0?r().createElement(ee.HorizontalGroup,{wrap:!0,style:{marginBottom:"25px"},align:"flex-start",justify:"flex-start"},o.map((function(e){var t=n.find((function(t){return t.id===e}));return r().createElement(ee.Tag,{key:e,icon:"user",name:"".concat(null==t?void 0:t.name," <").concat(null==t?void 0:t.e_mail,">")})}))):r().createElement(ee.EmptySearchResult,null,"You have not selected any member(s) yet"))),r().createElement("div",{className:"page-action-bar"},r().createElement("div",{className:"gf-form gf-form--grow"},r().createElement(ee.FieldSet,{label:"Select Group members"},r().createElement(ee.HorizontalGroup,{spacing:"md",width:"auto"},r().createElement(ee.InlineField,{grow:!0},r().createElement(ee.Input,{prefix:r().createElement(ee.Icon,{name:"search"}),suffix:r().createElement(ee.Icon,{name:"trash-alt",onClick:function(){return p("")}}),id:"search-query",name:"search-query",placeholder:"Search users",onChange:function(e){return p(e.target.value)}})),r().createElement(ee.InlineField,{grow:!0,label:"Hide users without email",transparent:!0},r().createElement(ee.InlineSwitch,{value:m,transparent:!0,onChange:w})))))),r().createElement("div",{className:"admin-list-table"},r().createElement(ee.VerticalGroup,{spacing:"md"},a&&r().createElement(ee.Alert,{title:"User list error",severity:"error"},"You must select at least one user"),r().createElement("table",{className:"filter-table filter-table--hover form-inline"},r().createElement("thead",null,r().createElement("tr",null,r().createElement("th",{style:{width:"1%"}}),r().createElement("th",null,"Name"),r().createElement("th",null,"Email"))),r().createElement("tbody",null,null==l?void 0:l.map((function(e){return function(e){var t;return r().createElement("tr",{key:e.id},r().createElement("td",{className:"width-2"},r().createElement("div",{className:s.checkboxWrapper},r().createElement(ee.Checkbox,{value:o.includes(e.id),disabled:""===e.e_mail,onChange:function(t){return i(t,e.id)},label:""}))),r().createElement("td",{className:"width-5"},r().createElement("div",{style:{padding:"0px 8px"}},e.name)),r().createElement("td",{className:"width-5"},r().createElement("div",{style:{padding:"0px 8px"},"aria-label":(null===(t=e.e_mail)||void 0===t?void 0:t.length)>0?void 0:"Empty email cell"},e.e_mail)))}(e)})))),r().createElement(ee.HorizontalGroup,{justify:"center"},r().createElement(me,{onNavigate:function(e){return b((function(t){return Object.assign(Object.assign({},t),{currentPage:e})}))},currentPage:y.currentPage,numberOfPages:y.totalPages,hideWhenSinglePage:!0})))))},qe=function(e){return{checkboxWrapper:(0,re.css)(Te||(t=["\n label {\n line-height: 1.2;\n }\n "],r||(r=t.slice(0)),Te=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))))};var t,r},Be=function(e){var n=e.panel,a=e.onPanelChecked,i=e.panelDetail,o=e.checkedPanels,s=(0,ee.useStyles2)(Qe),u=n.title,l=n.description,c=n.error,d=(0,t.useContext)(X),f=d.onUpdateLookback,p=d.onUpdateVariable;return r().createElement("li",{className:"card-item-wrapper",style:{cursor:c?"":"pointer"}},r().createElement("div",{className:"card-item"},r().createElement("div",{className:"card-item-body",onClick:function(e){if(e.preventDefault(),!c)return a(n)}},r().createElement("div",{className:s.marginForCheckbox},c?null:r().createElement(ee.Checkbox,{value:!!o&&!!o.some((function(e){return e.panelID===n.id&&e.dashboardID===n.dashboardID}))})),r().createElement("div",{className:"card-item-details"},r().createElement("div",{className:"card-item-name"},u),r().createElement("div",{className:"card-item-type"},l))),r().createElement(We,{panel:n,panelDetail:i,onUpdateVariable:p(i,n),onUpdateLookback:f(i)})))},Qe=function(e){return{marginForCheckbox:(0,re.css)(Ne||(t=["\n margin-right: 10px;\n "],r||(r=t.slice(0)),Ne=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))))};var t,r},Ve=function(e){e.panelListError;var n=e.onPanelChecked,a=e.checkedPanels,o=(0,ee.useStyles2)(Ge),s=(0,t.useContext)(X),u=s.panels,l=s.panelDetails;return u?r().createElement(r().Fragment,null,r().createElement("div",{className:"page-action-bar"},r().createElement(ee.Card,{disabled:!0},r().createElement(ee.Card.Heading,null,"Selected panel(s)"),r().createElement(ee.Card.Figure,null,r().createElement(ee.Icon,{size:"xxxl",name:"bell"})),r().createElement(ee.Card.Description,null,r().createElement(ee.FieldSet,null,a&&a.length>0?r().createElement(ee.HorizontalGroup,{wrap:!0,style:{marginBottom:"25px"},align:"flex-start",justify:"flex-start"},a.map((function(e){var t=u.find((function(t){return t.id===e.panelID&&t.dashboardID===e.dashboardID}));return!!t&&r().createElement(ee.Tag,{key:e.panelID+"a"+e.dashboardID,icon:"user",name:t.title})}))):r().createElement("div",null,"You have not selected any panels(s) yet. Please select one or more panels from the list below"))))),r().createElement("div",{style:{marginTop:"25px"}},r().createElement("div",{style:{display:"flex",flex:1,alignItems:"center"}},r().createElement(ee.Tooltip,{placement:"top",content:i().get("available_panels_tooltip"),theme:"info"},r().createElement(ee.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),r().createElement(ee.Legend,null,i().get("available_panels"))),r().createElement("ol",{className:o.list},u&&l&&(null==u?void 0:u.map((function(e,t){return r().createElement(Be,{panel:e,key:"panelItem".concat(t),onPanelChecked:n,checkedPanels:a,panelDetail:l.find((function(t){return t.panelID===e.id&&t.dashboardID===e.dashboardID}))})})))))):r().createElement(xe,null)},Ge=function(e){return{checkboxWrapper:(0,re.css)(ze||(t=["\n label {\n line-height: 1.2;\n }\n "],r||(r=t.slice(0)),ze=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}})))),list:(0,re.cx)("card-section","card-list-layout-grid","card-list-layout-list","card-list")};var t,r};function He(e){return function(e){if(Array.isArray(e))return Ze(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){if("string"==typeof e)return Ze(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)?Ze(e,t):void 0}}(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 Ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?d?[h].concat(He(o)):o:d?v?[h].concat(He(v)):[h]:v;return r().createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},r().createElement(ee.InlineFormLabel,null,a),i?r().createElement(ee.MultiSelect,{onChange:function(e){if(e.some((function(e){var t=e.value;return"$__all"===(null==t?void 0:t.value)})))return t(o);t(e)},value:null==g?void 0:g.filter((function(e){return!!(null==u?void 0:u.find((function(t){var r;return t===(null===(r=null==e?void 0:e.value)||void 0===r?void 0:r.value)})))})),filterOption:function(e,t){var r;return!!(null===(r=null==e?void 0:e.label)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))},closeMenuOnSelect:!1,options:g}):r().createElement(ee.Select,{value:null==g?void 0:g.filter((function(e){return!!(null==u?void 0:u.find((function(t){return t===e.value.value})))})),onChange:function(e){var r;if("$__all"===(null===(r=e.value)||void 0===r?void 0:r.value))return t(o);t([e])},options:g}))},We=function(e){var t,n,a,o,s=e.panel,u=e.onUpdateVariable,l=e.panelDetail,c=e.onUpdateLookback,d=[{label:i().get("1day"),value:"now-1d"},{label:i().get("2days"),value:"now-2d"},{label:i().get("3days"),value:"now-3d"},{label:i().get("1week"),value:"now-1w"},{label:i().get("2weeks"),value:"now-2w"},{label:i().get("4weeks"),value:"now-4w"},{label:i().get("3months"),value:"now-3M"},{label:i().get("6months"),value:"now-6M"},{label:i().get("1year"),value:"now-1y"}],f=V(null==l?void 0:l.variables,{}),p=(t=s.rawSql,n=RegExp(/\$__timeTo()/g),a=RegExp(/\$__timeFrom()/g),o=RegExp(/\$__timeFilter\([a-zA-Z-_.]+\)/g),n.test(t)||a.test(t)||o.test(t));return s.variables.length>0||p?r().createElement("div",{style:{border:"1px solid grey",padding:"20px"}},r().createElement("div",{className:"card-item-type"},i().get("variables")),r().createElement(ee.Tooltip,{placement:"top",content:i().get("variables_tooltip"),theme:"info"},r().createElement(ee.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})),p&&r().createElement("div",{style:{display:"flex",flexDirection:"row"}},r().createElement(ee.InlineFormLabel,{tooltip:i().get("lookback_period_description")},i().get("lookback_period")),r().createElement(ee.Select,{options:d,value:!!l&&l.lookback,onChange:function(e){return c(e)}})),s.variables.map((function(e){var t,n,a,i=e.name,o=e.options,s=e.multi,l=e.label,c=f[e.name],d=o.map((function(t){return{label:t.text,value:{name:e.name,value:t.value}}}));if("textbox"===e.type){var p=null!==(t=null==c?void 0:c[0])&&void 0!==t?t:null===(a=null===(n=d[0])||void 0===n?void 0:n.value)||void 0===a?void 0:a.value;return r().createElement($e,{onUpdate:u(i),name:null!=l?l:i,value:p})}return r().createElement(Ke,{onUpdate:u(i),key:i,multiSelectable:s,name:null!=l?l:i,variable:e,selectedOptions:c,selectableOptions:d})}))):null},$e=function(e){var t=e.onUpdate,n=e.name,a=e.value;return r().createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},r().createElement(ee.InlineFormLabel,null,n),r().createElement(ee.Input,{type:"text",defaultValue:a,placeholder:"",onChange:function(e){var r=e.target.value;t([{value:{name:n,value:r}}])}}))};function Ye(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,i=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xe(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)?Xe(e,t):void 0}}(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 Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);rnull==e;var rt=e=>!tt(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e instanceof Date),nt=e=>void 0===e,at=(e={},t,r)=>{const n=(a=t.split(/[,[\].]+?/),a.filter(Boolean)).reduce(((e,t)=>tt(e)?e:e[t]),e);var a;return nt(n)||n===e?nt(e[t])?r:e[t]:n};const it="all",ot="undefined";const st=t.createContext(null);st.displayName="RHFContext";const ut=()=>t.useContext(st);var lt=(e,t,r)=>{const n=((e,t)=>{const r=Object.assign({},e);return delete r[t],r})(e,"name");return rt(a=n)&&!Object.keys(a).length||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find((e=>t[e]===(!r||it)));var a};const ct=typeof window!==ot&&typeof window.HTMLElement!==ot&&typeof document!==ot?"Proxy"in window:typeof Proxy!==ot;function dt({name:e,rules:r,defaultValue:n,control:a,shouldUnregister:i}){const o=ut(),{defaultValuesRef:s,register:u,fieldsRef:l,unregister:c,fieldArrayNamesRef:d,controllerSubjectRef:f,shouldUnmountUnregister:p,inFieldArrayActionRef:h}=a||o.control,{onChange:m,onBlur:v,ref:g}=u(e,r),y=((e,t)=>[...e].some((e=>(e=>e.substring(0,e.search(/.\d/))||e)(t)===e)))(d.current,e),[b,w]=t.useState(nt(at(l.current,e)._f.value)||y?nt(n)?at(s.current,e):n:at(l.current,e)._f.value),E=function(e){const{control:r,name:n}=e||{},a=ut(),{formStateRef:i,formStateSubjectRef:o,readFormStateRef:s}=r||a.control,u=t.useRef(n);u.current=n;const[l,c]=t.useState(i.current),d=t.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1});return t.useEffect((()=>{const e=o.current.subscribe({next:e=>(!u.current||!e.name||(e=>Array.isArray(e)?e:[e])(u.current).includes(e.name))&<(e,d.current)&&c(Object.assign(Object.assign({},i.current),e))});return()=>e.unsubscribe()}),[]),((e,t,r,n,a=!0)=>e?new Proxy(t,{get:(e,t)=>{if(t in e)return r.current[t]!==it&&(r.current[t]=!a||it),n&&(n.current[t]=!0),e[t]}}):t)(ct,l,s,d,!1)}({control:a||o.control,name:e});return at(l.current,e)._f.value=b,t.useEffect((()=>{const t=f.current.subscribe({next:t=>(!t.name||e===t.name)&&w(at(t.values,e))});return()=>{t.unsubscribe();const r=p||i;(y?r&&!h.current:r)?c(e):at(l.current,e)&&(at(l.current,e)._f.mount=!1)}}),[e]),{field:{onChange:t=>{const r=(e=>rt(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e)(t);w(r),m({target:{value:r,name:e},type:"change"})},onBlur:()=>{v({target:{name:e},type:"blur"})},name:e,value:b,ref:e=>e&&g(e)},formState:E,fieldState:Object.defineProperties({},{invalid:{get:()=>!!at(E.errors,e)},isDirty:{get:()=>!!at(E.dirtyFields,e)},isTouched:{get:()=>!!at(E.touchedFields,e)},error:{get:()=>at(E.errors,e)}})}}const ft=e=>e.render(dt(e));function pt(e){return function(e){if(Array.isArray(e))return ht(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){if("string"==typeof e)return ht(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)?ht(e,t):void 0}}(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 ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r")})})))]),r().createElement(ee.Card.Actions,{className:e.actions},r().createElement(ee.LinkButton,{icon:"cog",key:"edit",variant:"secondary",href:"".concat(L,"/report-groups/edit/").concat(t.id)},"Edit"),r().createElement(ee.Button,{key:"delete",icon:"trash-alt",variant:"destructive",onClick:function(e){return r=t.id,s(),void c(r);var r}},i().get("delete")))))}))),r().createElement(ee.ConfirmModal,{isOpen:o,title:i().get("delete_report_group"),body:i().get("delete_report_group_question"),confirmText:i().get("delete"),icon:"exclamation-triangle",onConfirm:function(){d(l),s()},onDismiss:s})):r().createElement(St,null)},Dt=function(e){return{marginTop:(0,re.css)(mt||(mt=bt(["\n margin-top: ",";\n "])),e.spacing(2)),list:(0,re.css)({listStyle:"none",display:"grid"}),adjustButtonToRight:(0,re.css)(vt||(vt=bt(["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n "]))),heading:(0,re.css)({fontSize:e.v1.typography.heading.h5,fontWeight:"inherit"}),card:(0,re.css)({gridTemplateAreas:'\n "Figure Heading Actions"\n "Figure Description Actions"\n "Figure Meta Actions"\n "Figure - Actions"'}),description:(0,re.css)({margin:"0px",fontSize:e.typography.size.sm}),actions:(0,re.css)({position:"relative",alignSelf:"center",marginTop:"0px",opacity:0,".card-parent:hover &, .card-parent:focus-within &":{opacity:1}})}};function xt(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,i=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw a}}return i}}(e,t)||Pt(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 Pt(e,t){if(e){if("string"==typeof e)return kt(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)?kt(e,t):void 0}}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r= 0 && value.indexOf(\">\") >= 0) {\n value = escapeHtml(value);\n }\n variables[i] = value;\n }\n }\n\n try {\n var msgFormatter = new IntlMessageFormat(msg, currentLocale, formats);\n return msgFormatter.format(variables);\n } catch (err) {\n this.options.warningHandler(\"react-intl-universal format message failed for key='\" + key + \"'.\", err.message);\n return msg;\n }\n }\n\n /**\n * Get the formatted html message by key.\n * @param {string} key The string representing key in locale data file\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"getHTML\",\n value: function getHTML(key, variables) {\n if (this.options.intlGetHook) {\n try {\n this.options.intlGetHook(key, this.options.currentLocale);\n } catch (e) {\n console.log('intl get hook error: ', e);\n }\n }\n var msg = this.get(key, variables);\n if (msg) {\n var el = React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: msg\n }\n });\n // when key exists, it should still return element if there's defaultMessage() after getHTML()\n var defaultMessage = function defaultMessage() {\n return el;\n };\n return Object.assign({ defaultMessage: defaultMessage, d: defaultMessage }, el);\n }\n return \"\";\n }\n\n /**\n * As same as get(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {string} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {string} message\n */\n\n }, {\n key: \"formatMessage\",\n value: function formatMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.get(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * As same as getHTML(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {React.Element} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"formatHTMLMessage\",\n value: function formatHTMLMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.getHTML(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * Helper: determine user's locale via URL, cookie, localStorage, and browser's language.\n * You may not need this API, if you have other rules to determine user's locale.\n * @param {string} options.urlLocaleKey URL's query Key to determine locale. Example: if URL=http://localhost?lang=en-US, then set it 'lang'\n * @param {string} options.cookieLocaleKey Cookie's Key to determine locale. Example: if cookie=lang:en-US, then set it 'lang'\n * @param {string} options.localStorageLocaleKey LocalStorage's Key to determine locale such as 'lang'\n * @returns {string} determined locale such as 'en-US'\n */\n\n }, {\n key: \"determineLocale\",\n value: function determineLocale() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n return this.getLocaleFromURL(options) || this.getLocaleFromCookie(options) || this.getLocaleFromLocalStorage(options) || this.getLocaleFromBrowser();\n }\n\n /**\n * Initialize properties and load CLDR locale data according to currentLocale\n * @param {Object} options\n * @param {string} options.currentLocale Current locale such as 'en-US'\n * @param {string} options.locales App locale data like {\"en-US\":{\"key1\":\"value1\"},\"zh-CN\":{\"key1\":\"值1\"}}\n * @returns {Promise}\n */\n\n }, {\n key: \"init\",\n value: function init() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n invariant(options.currentLocale, \"options.currentLocale is required\");\n invariant(options.locales, \"options.locales is required\");\n\n Object.assign(this.options, options);\n\n this.options.formats = Object.assign({}, this.options.formats, defaultFormats);\n\n return new Promise(function (resolve, reject) {\n // init() will not load external common locale data anymore.\n // But, it still return a Promise for abckward compatibility.\n resolve();\n });\n }\n\n /**\n * Get the inital options\n */\n\n }, {\n key: \"getInitOptions\",\n value: function getInitOptions() {\n return this.options;\n }\n\n /**\n * Load more locales after init\n */\n\n }, {\n key: \"load\",\n value: function load(locales) {\n merge(this.options.locales, locales);\n }\n }, {\n key: \"getLocaleFromCookie\",\n value: function getLocaleFromCookie(options) {\n var cookieLocaleKey = options.cookieLocaleKey;\n\n if (cookieLocaleKey) {\n var params = cookie.parse(document.cookie);\n return params && params[cookieLocaleKey];\n }\n }\n }, {\n key: \"getLocaleFromLocalStorage\",\n value: function getLocaleFromLocalStorage(options) {\n var localStorageLocaleKey = options.localStorageLocaleKey;\n\n if (localStorageLocaleKey && window.localStorage) {\n return localStorage.getItem(localStorageLocaleKey);\n }\n }\n }, {\n key: \"getLocaleFromURL\",\n value: function getLocaleFromURL(options) {\n var urlLocaleKey = options.urlLocaleKey;\n\n if (urlLocaleKey) {\n var query = location.search.split(\"?\");\n if (query.length >= 2) {\n var params = queryParser.parse(query[1]);\n return params && params[urlLocaleKey];\n }\n }\n }\n }, {\n key: \"getDescendantProp\",\n value: function getDescendantProp(locale, key) {\n\n if (locale[key]) {\n return locale[key];\n }\n\n var msg = key.split(\".\").reduce(function (a, b) {\n return a != undefined ? a[b] : a;\n }, locale);\n\n return msg;\n }\n }, {\n key: \"getLocaleFromBrowser\",\n value: function getLocaleFromBrowser() {\n return navigator.language || navigator.userLanguage;\n }\n }]);\n return ReactIntlUniversal;\n}();\n\nmodule.exports = new ReactIntlUniversal();\nmodule.exports.ReactIntlUniversal = ReactIntlUniversal;\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = merge;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__6__;","module.exports = __WEBPACK_EXTERNAL_MODULE__7__;","module.exports = __WEBPACK_EXTERNAL_MODULE__8__;","// Expose `IntlPolyfill` as global to add locale data into runtime later on.\nglobal.IntlPolyfill = require('./lib/core.js');\n\n// Require all locale data for `Intl`. This module will be\n// ignored when bundling for the browser with Browserify/Webpack.\nrequire('./locale-data/complete.js');\n\n// hack to export the polyfill as global Intl if needed\nif (!global.Intl) {\n global.Intl = global.IntlPolyfill;\n global.IntlPolyfill.__applyLocaleSensitivePrototypes();\n}\n\n// providing an idiomatic api for the nodejs version of this module\nmodule.exports = global.IntlPolyfill;\n","'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n};\n\nvar jsx = function () {\n var REACT_ELEMENT_TYPE = typeof Symbol === \"function\" && Symbol.for && Symbol.for(\"react.element\") || 0xeac7;\n return function createRawReactElement(type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n props = {};\n }\n\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : '' + key,\n ref: null,\n props: props,\n _owner: null\n };\n };\n}();\n\nvar asyncToGenerator = function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n return step(\"next\", value);\n }, function (err) {\n return step(\"throw\", err);\n });\n }\n }\n\n return step(\"next\");\n });\n };\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar defineEnumerableProperties = function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n\n return obj;\n};\n\nvar defaults = function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n\n return obj;\n};\n\nvar defineProperty$1 = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n};\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar get = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar _instanceof = function (left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n};\n\nvar interopRequireDefault = function (obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n};\n\nvar interopRequireWildcard = function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n};\n\nvar newArrowCheck = function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n};\n\nvar objectDestructuringEmpty = function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n};\n\nvar objectWithoutProperties = function (obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar selfGlobal = typeof global === \"undefined\" ? self : global;\n\nvar set = function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if (\"value\" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n};\n\nvar slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\nvar slicedToArrayLoose = function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n\n if (i && _arr.length === i) break;\n }\n\n return _arr;\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n};\n\nvar taggedTemplateLiteral = function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n};\n\nvar taggedTemplateLiteralLoose = function (strings, raw) {\n strings.raw = raw;\n return strings;\n};\n\nvar temporalRef = function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + \" is not defined - temporal dead zone\");\n } else {\n return val;\n }\n};\n\nvar temporalUndefined = {};\n\nvar toArray = function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n};\n\nvar toConsumableArray = function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n};\n\n\n\nvar babelHelpers$1 = Object.freeze({\n jsx: jsx,\n asyncToGenerator: asyncToGenerator,\n classCallCheck: classCallCheck,\n createClass: createClass,\n defineEnumerableProperties: defineEnumerableProperties,\n defaults: defaults,\n defineProperty: defineProperty$1,\n get: get,\n inherits: inherits,\n interopRequireDefault: interopRequireDefault,\n interopRequireWildcard: interopRequireWildcard,\n newArrowCheck: newArrowCheck,\n objectDestructuringEmpty: objectDestructuringEmpty,\n objectWithoutProperties: objectWithoutProperties,\n possibleConstructorReturn: possibleConstructorReturn,\n selfGlobal: selfGlobal,\n set: set,\n slicedToArray: slicedToArray,\n slicedToArrayLoose: slicedToArrayLoose,\n taggedTemplateLiteral: taggedTemplateLiteral,\n taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,\n temporalRef: temporalRef,\n temporalUndefined: temporalUndefined,\n toArray: toArray,\n toConsumableArray: toConsumableArray,\n typeof: _typeof,\n extends: _extends,\n instanceof: _instanceof\n});\n\nvar realDefineProp = function () {\n var sentinel = function sentinel() {};\n try {\n Object.defineProperty(sentinel, 'a', {\n get: function get() {\n return 1;\n }\n });\n Object.defineProperty(sentinel, 'prototype', { writable: false });\n return sentinel.a === 1 && sentinel.prototype instanceof Object;\n } catch (e) {\n return false;\n }\n}();\n\n// Need a workaround for getters in ES3\nvar es3 = !realDefineProp && !Object.prototype.__defineGetter__;\n\n// We use this a lot (and need it for proto-less objects)\nvar hop = Object.prototype.hasOwnProperty;\n\n// Naive defineProperty for compatibility\nvar defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) {\n if ('get' in desc && obj.__defineGetter__) obj.__defineGetter__(name, desc.get);else if (!hop.call(obj, name) || 'value' in desc) obj[name] = desc.value;\n};\n\n// Array.prototype.indexOf, as good as we need it to be\nvar arrIndexOf = Array.prototype.indexOf || function (search) {\n /*jshint validthis:true */\n var t = this;\n if (!t.length) return -1;\n\n for (var i = arguments[1] || 0, max = t.length; i < max; i++) {\n if (t[i] === search) return i;\n }\n\n return -1;\n};\n\n// Create an object with the specified prototype (2nd arg required for Record)\nvar objCreate = Object.create || function (proto, props) {\n var obj = void 0;\n\n function F() {}\n F.prototype = proto;\n obj = new F();\n\n for (var k in props) {\n if (hop.call(props, k)) defineProperty(obj, k, props[k]);\n }\n\n return obj;\n};\n\n// Snapshot some (hopefully still) native built-ins\nvar arrSlice = Array.prototype.slice;\nvar arrConcat = Array.prototype.concat;\nvar arrPush = Array.prototype.push;\nvar arrJoin = Array.prototype.join;\nvar arrShift = Array.prototype.shift;\n\n// Naive Function.prototype.bind for compatibility\nvar fnBind = Function.prototype.bind || function (thisObj) {\n var fn = this,\n args = arrSlice.call(arguments, 1);\n\n // All our (presently) bound functions have either 1 or 0 arguments. By returning\n // different function signatures, we can pass some tests in ES3 environments\n if (fn.length === 1) {\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n }\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n};\n\n// Object housing internal properties for constructors\nvar internals = objCreate(null);\n\n// Keep internal properties internal\nvar secret = Math.random();\n\n// Helper functions\n// ================\n\n/**\n * A function to deal with the inaccuracy of calculating log10 in pre-ES6\n * JavaScript environments. Math.log(num) / Math.LN10 was responsible for\n * causing issue #62.\n */\nfunction log10Floor(n) {\n // ES6 provides the more accurate Math.log10\n if (typeof Math.log10 === 'function') return Math.floor(Math.log10(n));\n\n var x = Math.round(Math.log(n) * Math.LOG10E);\n return x - (Number('1e' + x) > n);\n}\n\n/**\n * A map that doesn't contain Object in its prototype chain\n */\nfunction Record(obj) {\n // Copy only own properties over unless this object is already a Record instance\n for (var k in obj) {\n if (obj instanceof Record || hop.call(obj, k)) defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });\n }\n}\nRecord.prototype = objCreate(null);\n\n/**\n * An ordered list\n */\nfunction List() {\n defineProperty(this, 'length', { writable: true, value: 0 });\n\n if (arguments.length) arrPush.apply(this, arrSlice.call(arguments));\n}\nList.prototype = objCreate(null);\n\n/**\n * Constructs a regular expression to restore tainted RegExp properties\n */\nfunction createRegExpRestore() {\n if (internals.disableRegExpRestore) {\n return function () {/* no-op */};\n }\n\n var regExpCache = {\n lastMatch: RegExp.lastMatch || '',\n leftContext: RegExp.leftContext,\n multiline: RegExp.multiline,\n input: RegExp.input\n },\n has = false;\n\n // Create a snapshot of all the 'captured' properties\n for (var i = 1; i <= 9; i++) {\n has = (regExpCache['$' + i] = RegExp['$' + i]) || has;\n }return function () {\n // Now we've snapshotted some properties, escape the lastMatch string\n var esc = /[.?*+^$[\\]\\\\(){}|-]/g,\n lm = regExpCache.lastMatch.replace(esc, '\\\\$&'),\n reg = new List();\n\n // If any of the captured strings were non-empty, iterate over them all\n if (has) {\n for (var _i = 1; _i <= 9; _i++) {\n var m = regExpCache['$' + _i];\n\n // If it's empty, add an empty capturing group\n if (!m) lm = '()' + lm;\n\n // Else find the string in lm and escape & wrap it to capture it\n else {\n m = m.replace(esc, '\\\\$&');\n lm = lm.replace(m, '(' + m + ')');\n }\n\n // Push it to the reg and chop lm to make sure further groups come after\n arrPush.call(reg, lm.slice(0, lm.indexOf('(') + 1));\n lm = lm.slice(lm.indexOf('(') + 1);\n }\n }\n\n var exprStr = arrJoin.call(reg, '') + lm;\n\n // Shorten the regex by replacing each part of the expression with a match\n // for a string of that exact length. This is safe for the type of\n // expressions generated above, because the expression matches the whole\n // match string, so we know each group and each segment between capturing\n // groups can be matched by its length alone.\n exprStr = exprStr.replace(/(\\\\\\(|\\\\\\)|[^()])+/g, function (match) {\n return '[\\\\s\\\\S]{' + match.replace('\\\\', '').length + '}';\n });\n\n // Create the regular expression that will reconstruct the RegExp properties\n var expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g');\n\n // Set the lastIndex of the generated expression to ensure that the match\n // is found in the correct index.\n expr.lastIndex = regExpCache.leftContext.length;\n\n expr.exec(regExpCache.input);\n };\n}\n\n/**\n * Mimics ES5's abstract ToObject() function\n */\nfunction toObject(arg) {\n if (arg === null) throw new TypeError('Cannot convert null or undefined to object');\n\n if ((typeof arg === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](arg)) === 'object') return arg;\n return Object(arg);\n}\n\nfunction toNumber(arg) {\n if (typeof arg === 'number') return arg;\n return Number(arg);\n}\n\nfunction toInteger(arg) {\n var number = toNumber(arg);\n if (isNaN(number)) return 0;\n if (number === +0 || number === -0 || number === +Infinity || number === -Infinity) return number;\n if (number < 0) return Math.floor(Math.abs(number)) * -1;\n return Math.floor(Math.abs(number));\n}\n\nfunction toLength(arg) {\n var len = toInteger(arg);\n if (len <= 0) return 0;\n if (len === Infinity) return Math.pow(2, 53) - 1;\n return Math.min(len, Math.pow(2, 53) - 1);\n}\n\n/**\n * Returns \"internal\" properties for an object\n */\nfunction getInternalProperties(obj) {\n if (hop.call(obj, '__getInternalProperties')) return obj.__getInternalProperties(secret);\n\n return objCreate(null);\n}\n\n/**\n* Defines regular expressions for various operations related to the BCP 47 syntax,\n* as defined at http://tools.ietf.org/html/bcp47#section-2.1\n*/\n\n// extlang = 3ALPHA ; selected ISO 639 codes\n// *2(\"-\" 3ALPHA) ; permanently reserved\nvar extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';\n\n// language = 2*3ALPHA ; shortest ISO 639 code\n// [\"-\" extlang] ; sometimes followed by\n// ; extended language subtags\n// / 4ALPHA ; or reserved for future use\n// / 5*8ALPHA ; or registered language subtag\nvar language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';\n\n// script = 4ALPHA ; ISO 15924 code\nvar script = '[a-z]{4}';\n\n// region = 2ALPHA ; ISO 3166-1 code\n// / 3DIGIT ; UN M.49 code\nvar region = '(?:[a-z]{2}|\\\\d{3})';\n\n// variant = 5*8alphanum ; registered variants\n// / (DIGIT 3alphanum)\nvar variant = '(?:[a-z0-9]{5,8}|\\\\d[a-z0-9]{3})';\n\n// ; Single alphanumerics\n// ; \"x\" reserved for private use\n// singleton = DIGIT ; 0 - 9\n// / %x41-57 ; A - W\n// / %x59-5A ; Y - Z\n// / %x61-77 ; a - w\n// / %x79-7A ; y - z\nvar singleton = '[0-9a-wy-z]';\n\n// extension = singleton 1*(\"-\" (2*8alphanum))\nvar extension = singleton + '(?:-[a-z0-9]{2,8})+';\n\n// privateuse = \"x\" 1*(\"-\" (1*8alphanum))\nvar privateuse = 'x(?:-[a-z0-9]{1,8})+';\n\n// irregular = \"en-GB-oed\" ; irregular tags do not match\n// / \"i-ami\" ; the 'langtag' production and\n// / \"i-bnn\" ; would not otherwise be\n// / \"i-default\" ; considered 'well-formed'\n// / \"i-enochian\" ; These tags are all valid,\n// / \"i-hak\" ; but most are deprecated\n// / \"i-klingon\" ; in favor of more modern\n// / \"i-lux\" ; subtags or subtag\n// / \"i-mingo\" ; combination\n// / \"i-navajo\"\n// / \"i-pwn\"\n// / \"i-tao\"\n// / \"i-tay\"\n// / \"i-tsu\"\n// / \"sgn-BE-FR\"\n// / \"sgn-BE-NL\"\n// / \"sgn-CH-DE\"\nvar irregular = '(?:en-GB-oed' + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)' + '|sgn-(?:BE-FR|BE-NL|CH-DE))';\n\n// regular = \"art-lojban\" ; these tags match the 'langtag'\n// / \"cel-gaulish\" ; production, but their subtags\n// / \"no-bok\" ; are not extended language\n// / \"no-nyn\" ; or variant subtags: their meaning\n// / \"zh-guoyu\" ; is defined by their registration\n// / \"zh-hakka\" ; and all of these are deprecated\n// / \"zh-min\" ; in favor of a more modern\n// / \"zh-min-nan\" ; subtag or sequence of subtags\n// / \"zh-xiang\"\nvar regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn' + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';\n\n// grandfathered = irregular ; non-redundant tags registered\n// / regular ; during the RFC 3066 era\nvar grandfathered = '(?:' + irregular + '|' + regular + ')';\n\n// langtag = language\n// [\"-\" script]\n// [\"-\" region]\n// *(\"-\" variant)\n// *(\"-\" extension)\n// [\"-\" privateuse]\nvar langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-' + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';\n\n// Language-Tag = langtag ; normal language tags\n// / privateuse ; private use tag\n// / grandfathered ; grandfathered tags\nvar expBCP47Syntax = RegExp('^(?:' + langtag + '|' + privateuse + '|' + grandfathered + ')$', 'i');\n\n// Match duplicate variants in a language tag\nvar expVariantDupes = RegExp('^(?!x).*?-(' + variant + ')-(?:\\\\w{4,8}-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match duplicate singletons in a language tag (except in private use)\nvar expSingletonDupes = RegExp('^(?!x).*?-(' + singleton + ')-(?:\\\\w+-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match all extension sequences\nvar expExtSequences = RegExp('-' + extension, 'ig');\n\n// Default locale is the first-added locale data for us\nvar defaultLocale = void 0;\nfunction setDefaultLocale(locale) {\n defaultLocale = locale;\n}\n\n// IANA Subtag Registry redundant tag and subtag maps\nvar redundantTags = {\n tags: {\n \"art-lojban\": \"jbo\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"no-bok\": \"nb\",\n \"no-nyn\": \"nn\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"zh-guoyu\": \"cmn\",\n \"zh-hakka\": \"hak\",\n \"zh-min-nan\": \"nan\",\n \"zh-xiang\": \"hsn\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsl\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"zh-cmn\": \"cmn\",\n \"zh-cmn-Hans\": \"cmn-Hans\",\n \"zh-cmn-Hant\": \"cmn-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-wuu\": \"wuu\",\n \"zh-yue\": \"yue\"\n },\n subtags: {\n BU: \"MM\",\n DD: \"DE\",\n FX: \"FR\",\n TP: \"TL\",\n YD: \"YE\",\n ZR: \"CD\",\n heploc: \"alalc97\",\n 'in': \"id\",\n iw: \"he\",\n ji: \"yi\",\n jw: \"jv\",\n mo: \"ro\",\n ayx: \"nun\",\n bjd: \"drl\",\n ccq: \"rki\",\n cjr: \"mom\",\n cka: \"cmr\",\n cmk: \"xch\",\n drh: \"khk\",\n drw: \"prs\",\n gav: \"dev\",\n hrr: \"jal\",\n ibi: \"opa\",\n kgh: \"kml\",\n lcq: \"ppr\",\n mst: \"mry\",\n myt: \"mry\",\n sca: \"hle\",\n tie: \"ras\",\n tkk: \"twm\",\n tlw: \"weo\",\n tnf: \"prs\",\n ybd: \"rki\",\n yma: \"lrr\"\n },\n extLang: {\n aao: [\"aao\", \"ar\"],\n abh: [\"abh\", \"ar\"],\n abv: [\"abv\", \"ar\"],\n acm: [\"acm\", \"ar\"],\n acq: [\"acq\", \"ar\"],\n acw: [\"acw\", \"ar\"],\n acx: [\"acx\", \"ar\"],\n acy: [\"acy\", \"ar\"],\n adf: [\"adf\", \"ar\"],\n ads: [\"ads\", \"sgn\"],\n aeb: [\"aeb\", \"ar\"],\n aec: [\"aec\", \"ar\"],\n aed: [\"aed\", \"sgn\"],\n aen: [\"aen\", \"sgn\"],\n afb: [\"afb\", \"ar\"],\n afg: [\"afg\", \"sgn\"],\n ajp: [\"ajp\", \"ar\"],\n apc: [\"apc\", \"ar\"],\n apd: [\"apd\", \"ar\"],\n arb: [\"arb\", \"ar\"],\n arq: [\"arq\", \"ar\"],\n ars: [\"ars\", \"ar\"],\n ary: [\"ary\", \"ar\"],\n arz: [\"arz\", \"ar\"],\n ase: [\"ase\", \"sgn\"],\n asf: [\"asf\", \"sgn\"],\n asp: [\"asp\", \"sgn\"],\n asq: [\"asq\", \"sgn\"],\n asw: [\"asw\", \"sgn\"],\n auz: [\"auz\", \"ar\"],\n avl: [\"avl\", \"ar\"],\n ayh: [\"ayh\", \"ar\"],\n ayl: [\"ayl\", \"ar\"],\n ayn: [\"ayn\", \"ar\"],\n ayp: [\"ayp\", \"ar\"],\n bbz: [\"bbz\", \"ar\"],\n bfi: [\"bfi\", \"sgn\"],\n bfk: [\"bfk\", \"sgn\"],\n bjn: [\"bjn\", \"ms\"],\n bog: [\"bog\", \"sgn\"],\n bqn: [\"bqn\", \"sgn\"],\n bqy: [\"bqy\", \"sgn\"],\n btj: [\"btj\", \"ms\"],\n bve: [\"bve\", \"ms\"],\n bvl: [\"bvl\", \"sgn\"],\n bvu: [\"bvu\", \"ms\"],\n bzs: [\"bzs\", \"sgn\"],\n cdo: [\"cdo\", \"zh\"],\n cds: [\"cds\", \"sgn\"],\n cjy: [\"cjy\", \"zh\"],\n cmn: [\"cmn\", \"zh\"],\n coa: [\"coa\", \"ms\"],\n cpx: [\"cpx\", \"zh\"],\n csc: [\"csc\", \"sgn\"],\n csd: [\"csd\", \"sgn\"],\n cse: [\"cse\", \"sgn\"],\n csf: [\"csf\", \"sgn\"],\n csg: [\"csg\", \"sgn\"],\n csl: [\"csl\", \"sgn\"],\n csn: [\"csn\", \"sgn\"],\n csq: [\"csq\", \"sgn\"],\n csr: [\"csr\", \"sgn\"],\n czh: [\"czh\", \"zh\"],\n czo: [\"czo\", \"zh\"],\n doq: [\"doq\", \"sgn\"],\n dse: [\"dse\", \"sgn\"],\n dsl: [\"dsl\", \"sgn\"],\n dup: [\"dup\", \"ms\"],\n ecs: [\"ecs\", \"sgn\"],\n esl: [\"esl\", \"sgn\"],\n esn: [\"esn\", \"sgn\"],\n eso: [\"eso\", \"sgn\"],\n eth: [\"eth\", \"sgn\"],\n fcs: [\"fcs\", \"sgn\"],\n fse: [\"fse\", \"sgn\"],\n fsl: [\"fsl\", \"sgn\"],\n fss: [\"fss\", \"sgn\"],\n gan: [\"gan\", \"zh\"],\n gds: [\"gds\", \"sgn\"],\n gom: [\"gom\", \"kok\"],\n gse: [\"gse\", \"sgn\"],\n gsg: [\"gsg\", \"sgn\"],\n gsm: [\"gsm\", \"sgn\"],\n gss: [\"gss\", \"sgn\"],\n gus: [\"gus\", \"sgn\"],\n hab: [\"hab\", \"sgn\"],\n haf: [\"haf\", \"sgn\"],\n hak: [\"hak\", \"zh\"],\n hds: [\"hds\", \"sgn\"],\n hji: [\"hji\", \"ms\"],\n hks: [\"hks\", \"sgn\"],\n hos: [\"hos\", \"sgn\"],\n hps: [\"hps\", \"sgn\"],\n hsh: [\"hsh\", \"sgn\"],\n hsl: [\"hsl\", \"sgn\"],\n hsn: [\"hsn\", \"zh\"],\n icl: [\"icl\", \"sgn\"],\n ils: [\"ils\", \"sgn\"],\n inl: [\"inl\", \"sgn\"],\n ins: [\"ins\", \"sgn\"],\n ise: [\"ise\", \"sgn\"],\n isg: [\"isg\", \"sgn\"],\n isr: [\"isr\", \"sgn\"],\n jak: [\"jak\", \"ms\"],\n jax: [\"jax\", \"ms\"],\n jcs: [\"jcs\", \"sgn\"],\n jhs: [\"jhs\", \"sgn\"],\n jls: [\"jls\", \"sgn\"],\n jos: [\"jos\", \"sgn\"],\n jsl: [\"jsl\", \"sgn\"],\n jus: [\"jus\", \"sgn\"],\n kgi: [\"kgi\", \"sgn\"],\n knn: [\"knn\", \"kok\"],\n kvb: [\"kvb\", \"ms\"],\n kvk: [\"kvk\", \"sgn\"],\n kvr: [\"kvr\", \"ms\"],\n kxd: [\"kxd\", \"ms\"],\n lbs: [\"lbs\", \"sgn\"],\n lce: [\"lce\", \"ms\"],\n lcf: [\"lcf\", \"ms\"],\n liw: [\"liw\", \"ms\"],\n lls: [\"lls\", \"sgn\"],\n lsg: [\"lsg\", \"sgn\"],\n lsl: [\"lsl\", \"sgn\"],\n lso: [\"lso\", \"sgn\"],\n lsp: [\"lsp\", \"sgn\"],\n lst: [\"lst\", \"sgn\"],\n lsy: [\"lsy\", \"sgn\"],\n ltg: [\"ltg\", \"lv\"],\n lvs: [\"lvs\", \"lv\"],\n lzh: [\"lzh\", \"zh\"],\n max: [\"max\", \"ms\"],\n mdl: [\"mdl\", \"sgn\"],\n meo: [\"meo\", \"ms\"],\n mfa: [\"mfa\", \"ms\"],\n mfb: [\"mfb\", \"ms\"],\n mfs: [\"mfs\", \"sgn\"],\n min: [\"min\", \"ms\"],\n mnp: [\"mnp\", \"zh\"],\n mqg: [\"mqg\", \"ms\"],\n mre: [\"mre\", \"sgn\"],\n msd: [\"msd\", \"sgn\"],\n msi: [\"msi\", \"ms\"],\n msr: [\"msr\", \"sgn\"],\n mui: [\"mui\", \"ms\"],\n mzc: [\"mzc\", \"sgn\"],\n mzg: [\"mzg\", \"sgn\"],\n mzy: [\"mzy\", \"sgn\"],\n nan: [\"nan\", \"zh\"],\n nbs: [\"nbs\", \"sgn\"],\n ncs: [\"ncs\", \"sgn\"],\n nsi: [\"nsi\", \"sgn\"],\n nsl: [\"nsl\", \"sgn\"],\n nsp: [\"nsp\", \"sgn\"],\n nsr: [\"nsr\", \"sgn\"],\n nzs: [\"nzs\", \"sgn\"],\n okl: [\"okl\", \"sgn\"],\n orn: [\"orn\", \"ms\"],\n ors: [\"ors\", \"ms\"],\n pel: [\"pel\", \"ms\"],\n pga: [\"pga\", \"ar\"],\n pks: [\"pks\", \"sgn\"],\n prl: [\"prl\", \"sgn\"],\n prz: [\"prz\", \"sgn\"],\n psc: [\"psc\", \"sgn\"],\n psd: [\"psd\", \"sgn\"],\n pse: [\"pse\", \"ms\"],\n psg: [\"psg\", \"sgn\"],\n psl: [\"psl\", \"sgn\"],\n pso: [\"pso\", \"sgn\"],\n psp: [\"psp\", \"sgn\"],\n psr: [\"psr\", \"sgn\"],\n pys: [\"pys\", \"sgn\"],\n rms: [\"rms\", \"sgn\"],\n rsi: [\"rsi\", \"sgn\"],\n rsl: [\"rsl\", \"sgn\"],\n sdl: [\"sdl\", \"sgn\"],\n sfb: [\"sfb\", \"sgn\"],\n sfs: [\"sfs\", \"sgn\"],\n sgg: [\"sgg\", \"sgn\"],\n sgx: [\"sgx\", \"sgn\"],\n shu: [\"shu\", \"ar\"],\n slf: [\"slf\", \"sgn\"],\n sls: [\"sls\", \"sgn\"],\n sqk: [\"sqk\", \"sgn\"],\n sqs: [\"sqs\", \"sgn\"],\n ssh: [\"ssh\", \"ar\"],\n ssp: [\"ssp\", \"sgn\"],\n ssr: [\"ssr\", \"sgn\"],\n svk: [\"svk\", \"sgn\"],\n swc: [\"swc\", \"sw\"],\n swh: [\"swh\", \"sw\"],\n swl: [\"swl\", \"sgn\"],\n syy: [\"syy\", \"sgn\"],\n tmw: [\"tmw\", \"ms\"],\n tse: [\"tse\", \"sgn\"],\n tsm: [\"tsm\", \"sgn\"],\n tsq: [\"tsq\", \"sgn\"],\n tss: [\"tss\", \"sgn\"],\n tsy: [\"tsy\", \"sgn\"],\n tza: [\"tza\", \"sgn\"],\n ugn: [\"ugn\", \"sgn\"],\n ugy: [\"ugy\", \"sgn\"],\n ukl: [\"ukl\", \"sgn\"],\n uks: [\"uks\", \"sgn\"],\n urk: [\"urk\", \"ms\"],\n uzn: [\"uzn\", \"uz\"],\n uzs: [\"uzs\", \"uz\"],\n vgt: [\"vgt\", \"sgn\"],\n vkk: [\"vkk\", \"ms\"],\n vkt: [\"vkt\", \"ms\"],\n vsi: [\"vsi\", \"sgn\"],\n vsl: [\"vsl\", \"sgn\"],\n vsv: [\"vsv\", \"sgn\"],\n wuu: [\"wuu\", \"zh\"],\n xki: [\"xki\", \"sgn\"],\n xml: [\"xml\", \"sgn\"],\n xmm: [\"xmm\", \"ms\"],\n xms: [\"xms\", \"sgn\"],\n yds: [\"yds\", \"sgn\"],\n ysl: [\"ysl\", \"sgn\"],\n yue: [\"yue\", \"zh\"],\n zib: [\"zib\", \"sgn\"],\n zlm: [\"zlm\", \"ms\"],\n zmi: [\"zmi\", \"ms\"],\n zsl: [\"zsl\", \"sgn\"],\n zsm: [\"zsm\", \"ms\"]\n }\n};\n\n/**\n * Convert only a-z to uppercase as per section 6.1 of the spec\n */\nfunction toLatinUpperCase(str) {\n var i = str.length;\n\n while (i--) {\n var ch = str.charAt(i);\n\n if (ch >= \"a\" && ch <= \"z\") str = str.slice(0, i) + ch.toUpperCase() + str.slice(i + 1);\n }\n\n return str;\n}\n\n/**\n * The IsStructurallyValidLanguageTag abstract operation verifies that the locale\n * argument (which must be a String value)\n *\n * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section\n * 2.1, or successor,\n * - does not include duplicate variant subtags, and\n * - does not include duplicate singleton subtags.\n *\n * The abstract operation returns true if locale can be generated from the ABNF\n * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not\n * contain duplicate variant or singleton subtags (other than as a private use\n * subtag). It returns false otherwise. Terminal value characters in the grammar are\n * interpreted as the Unicode equivalents of the ASCII octet values given.\n */\nfunction /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {\n // represents a well-formed BCP 47 language tag as specified in RFC 5646\n if (!expBCP47Syntax.test(locale)) return false;\n\n // does not include duplicate variant subtags, and\n if (expVariantDupes.test(locale)) return false;\n\n // does not include duplicate singleton subtags.\n if (expSingletonDupes.test(locale)) return false;\n\n return true;\n}\n\n/**\n * The CanonicalizeLanguageTag abstract operation returns the canonical and case-\n * regularized form of the locale argument (which must be a String value that is\n * a structurally valid BCP 47 language tag as verified by the\n * IsStructurallyValidLanguageTag abstract operation). It takes the steps\n * specified in RFC 5646 section 4.5, or successor, to bring the language tag\n * into canonical form, and to regularize the case of the subtags, but does not\n * take the steps to bring a language tag into “extlang form” and to reorder\n * variant subtags.\n\n * The specifications for extensions to BCP 47 language tags, such as RFC 6067,\n * may include canonicalization rules for the extension subtag sequences they\n * define that go beyond the canonicalization rules of RFC 5646 section 4.5.\n * Implementations are allowed, but not required, to apply these additional rules.\n */\nfunction /* 6.2.3 */CanonicalizeLanguageTag(locale) {\n var match = void 0,\n parts = void 0;\n\n // A language tag is in 'canonical form' when the tag is well-formed\n // according to the rules in Sections 2.1 and 2.2\n\n // Section 2.1 says all subtags use lowercase...\n locale = locale.toLowerCase();\n\n // ...with 2 exceptions: 'two-letter and four-letter subtags that neither\n // appear at the start of the tag nor occur after singletons. Such two-letter\n // subtags are all uppercase (as in the tags \"en-CA-x-ca\" or \"sgn-BE-FR\") and\n // four-letter subtags are titlecase (as in the tag \"az-Latn-x-latn\").\n parts = locale.split('-');\n for (var i = 1, max = parts.length; i < max; i++) {\n // Two-letter subtags are all uppercase\n if (parts[i].length === 2) parts[i] = parts[i].toUpperCase();\n\n // Four-letter subtags are titlecase\n else if (parts[i].length === 4) parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);\n\n // Is it a singleton?\n else if (parts[i].length === 1 && parts[i] !== 'x') break;\n }\n locale = arrJoin.call(parts, '-');\n\n // The steps laid out in RFC 5646 section 4.5 are as follows:\n\n // 1. Extension sequences are ordered into case-insensitive ASCII order\n // by singleton subtag.\n if ((match = locale.match(expExtSequences)) && match.length > 1) {\n // The built-in sort() sorts by ASCII order, so use that\n match.sort();\n\n // Replace all extensions with the joined, sorted array\n locale = locale.replace(RegExp('(?:' + expExtSequences.source + ')+', 'i'), arrJoin.call(match, ''));\n }\n\n // 2. Redundant or grandfathered tags are replaced by their 'Preferred-\n // Value', if there is one.\n if (hop.call(redundantTags.tags, locale)) locale = redundantTags.tags[locale];\n\n // 3. Subtags are replaced by their 'Preferred-Value', if there is one.\n // For extlangs, the original primary language subtag is also\n // replaced if there is a primary language subtag in the 'Preferred-\n // Value'.\n parts = locale.split('-');\n\n for (var _i = 1, _max = parts.length; _i < _max; _i++) {\n if (hop.call(redundantTags.subtags, parts[_i])) parts[_i] = redundantTags.subtags[parts[_i]];else if (hop.call(redundantTags.extLang, parts[_i])) {\n parts[_i] = redundantTags.extLang[parts[_i]][0];\n\n // For extlang tags, the prefix needs to be removed if it is redundant\n if (_i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {\n parts = arrSlice.call(parts, _i++);\n _max -= 1;\n }\n }\n }\n\n return arrJoin.call(parts, '-');\n}\n\n/**\n * The DefaultLocale abstract operation returns a String value representing the\n * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the\n * host environment’s current locale.\n */\nfunction /* 6.2.4 */DefaultLocale() {\n return defaultLocale;\n}\n\n// Sect 6.3 Currency Codes\n// =======================\n\nvar expCurrencyCode = /^[A-Z]{3}$/;\n\n/**\n * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument\n * (after conversion to a String value) represents a well-formed 3-letter ISO currency\n * code. The following steps are taken:\n */\nfunction /* 6.3.1 */IsWellFormedCurrencyCode(currency) {\n // 1. Let `c` be ToString(currency)\n var c = String(currency);\n\n // 2. Let `normalized` be the result of mapping c to upper case as described\n // in 6.1.\n var normalized = toLatinUpperCase(c);\n\n // 3. If the string length of normalized is not 3, return false.\n // 4. If normalized contains any character that is not in the range \"A\" to \"Z\"\n // (U+0041 to U+005A), return false.\n if (expCurrencyCode.test(normalized) === false) return false;\n\n // 5. Return true\n return true;\n}\n\nvar expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below\n\nfunction /* 9.2.1 */CanonicalizeLocaleList(locales) {\n // The abstract operation CanonicalizeLocaleList takes the following steps:\n\n // 1. If locales is undefined, then a. Return a new empty List\n if (locales === undefined) return new List();\n\n // 2. Let seen be a new empty List.\n var seen = new List();\n\n // 3. If locales is a String value, then\n // a. Let locales be a new array created as if by the expression new\n // Array(locales) where Array is the standard built-in constructor with\n // that name and locales is the value of locales.\n locales = typeof locales === 'string' ? [locales] : locales;\n\n // 4. Let O be ToObject(locales).\n var O = toObject(locales);\n\n // 5. Let lenValue be the result of calling the [[Get]] internal method of\n // O with the argument \"length\".\n // 6. Let len be ToUint32(lenValue).\n var len = toLength(O.length);\n\n // 7. Let k be 0.\n var k = 0;\n\n // 8. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ToString(k).\n var Pk = String(k);\n\n // b. Let kPresent be the result of calling the [[HasProperty]] internal\n // method of O with argument Pk.\n var kPresent = Pk in O;\n\n // c. If kPresent is true, then\n if (kPresent) {\n // i. Let kValue be the result of calling the [[Get]] internal\n // method of O with argument Pk.\n var kValue = O[Pk];\n\n // ii. If the type of kValue is not String or Object, then throw a\n // TypeError exception.\n if (kValue === null || typeof kValue !== 'string' && (typeof kValue === \"undefined\" ? \"undefined\" : babelHelpers$1[\"typeof\"](kValue)) !== 'object') throw new TypeError('String or Object type expected');\n\n // iii. Let tag be ToString(kValue).\n var tag = String(kValue);\n\n // iv. If the result of calling the abstract operation\n // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as\n // the argument, is false, then throw a RangeError exception.\n if (!IsStructurallyValidLanguageTag(tag)) throw new RangeError(\"'\" + tag + \"' is not a structurally valid language tag\");\n\n // v. Let tag be the result of calling the abstract operation\n // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the\n // argument.\n tag = CanonicalizeLanguageTag(tag);\n\n // vi. If tag is not an element of seen, then append tag as the last\n // element of seen.\n if (arrIndexOf.call(seen, tag) === -1) arrPush.call(seen, tag);\n }\n\n // d. Increase k by 1.\n k++;\n }\n\n // 9. Return seen.\n return seen;\n}\n\n/**\n * The BestAvailableLocale abstract operation compares the provided argument\n * locale, which must be a String value with a structurally valid and\n * canonicalized BCP 47 language tag, against the locales in availableLocales and\n * returns either the longest non-empty prefix of locale that is an element of\n * availableLocales, or undefined if there is no such element. It uses the\n * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:\n */\nfunction /* 9.2.2 */BestAvailableLocale(availableLocales, locale) {\n // 1. Let candidate be locale\n var candidate = locale;\n\n // 2. Repeat\n while (candidate) {\n // a. If availableLocales contains an element equal to candidate, then return\n // candidate.\n if (arrIndexOf.call(availableLocales, candidate) > -1) return candidate;\n\n // b. Let pos be the character index of the last occurrence of \"-\"\n // (U+002D) within candidate. If that character does not occur, return\n // undefined.\n var pos = candidate.lastIndexOf('-');\n\n if (pos < 0) return;\n\n // c. If pos ≥ 2 and the character \"-\" occurs at index pos-2 of candidate,\n // then decrease pos by 2.\n if (pos >= 2 && candidate.charAt(pos - 2) === '-') pos -= 2;\n\n // d. Let candidate be the substring of candidate from position 0, inclusive,\n // to position pos, exclusive.\n candidate = candidate.substring(0, pos);\n }\n}\n\n/**\n * The LookupMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The following steps are taken:\n */\nfunction /* 9.2.3 */LookupMatcher(availableLocales, requestedLocales) {\n // 1. Let i be 0.\n var i = 0;\n\n // 2. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n\n // 3. Let availableLocale be undefined.\n var availableLocale = void 0;\n\n var locale = void 0,\n noExtensionsLocale = void 0;\n\n // 4. Repeat while i < len and availableLocale is undefined:\n while (i < len && !availableLocale) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position i.\n locale = requestedLocales[i];\n\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. Increase i by 1.\n i++;\n }\n\n // 5. Let result be a new Record.\n var result = new Record();\n\n // 6. If availableLocale is not undefined, then\n if (availableLocale !== undefined) {\n // a. Set result.[[locale]] to availableLocale.\n result['[[locale]]'] = availableLocale;\n\n // b. If locale and noExtensionsLocale are not the same String value, then\n if (String(locale) !== String(noExtensionsLocale)) {\n // i. Let extension be the String value consisting of the first\n // substring of locale that is a Unicode locale extension sequence.\n var extension = locale.match(expUnicodeExSeq)[0];\n\n // ii. Let extensionIndex be the character position of the initial\n // \"-\" of the first Unicode locale extension sequence within locale.\n var extensionIndex = locale.indexOf('-u-');\n\n // iii. Set result.[[extension]] to extension.\n result['[[extension]]'] = extension;\n\n // iv. Set result.[[extensionIndex]] to extensionIndex.\n result['[[extensionIndex]]'] = extensionIndex;\n }\n }\n // 7. Else\n else\n // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract\n // operation (defined in 6.2.4).\n result['[[locale]]'] = DefaultLocale();\n\n // 8. Return result\n return result;\n}\n\n/**\n * The BestFitMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The algorithm is implementation dependent, but should produce results\n * that a typical user of the requested locales would perceive as at least as\n * good as those produced by the LookupMatcher abstract operation. Options\n * specified through Unicode locale extension sequences must be ignored by the\n * algorithm. Information about such subsequences is returned separately.\n * The abstract operation returns a record with a [[locale]] field, whose value\n * is the language tag of the selected locale, which must be an element of\n * availableLocales. If the language tag of the request locale that led to the\n * selected locale contained a Unicode locale extension sequence, then the\n * returned record also contains an [[extension]] field whose value is the first\n * Unicode locale extension sequence, and an [[extensionIndex]] field whose value\n * is the index of the first Unicode locale extension sequence within the request\n * locale language tag.\n */\nfunction /* 9.2.4 */BestFitMatcher(availableLocales, requestedLocales) {\n return LookupMatcher(availableLocales, requestedLocales);\n}\n\n/**\n * The ResolveLocale abstract operation compares a BCP 47 language priority list\n * requestedLocales against the locales in availableLocales and determines the\n * best available language to meet the request. availableLocales and\n * requestedLocales must be provided as List values, options as a Record.\n */\nfunction /* 9.2.5 */ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n if (availableLocales.length === 0) {\n throw new ReferenceError('No locale data has been provided for this object yet.');\n }\n\n // The following steps are taken:\n // 1. Let matcher be the value of options.[[localeMatcher]].\n var matcher = options['[[localeMatcher]]'];\n\n var r = void 0;\n\n // 2. If matcher is \"lookup\", then\n if (matcher === 'lookup')\n // a. Let r be the result of calling the LookupMatcher abstract operation\n // (defined in 9.2.3) with arguments availableLocales and\n // requestedLocales.\n r = LookupMatcher(availableLocales, requestedLocales);\n\n // 3. Else\n else\n // a. Let r be the result of calling the BestFitMatcher abstract\n // operation (defined in 9.2.4) with arguments availableLocales and\n // requestedLocales.\n r = BestFitMatcher(availableLocales, requestedLocales);\n\n // 4. Let foundLocale be the value of r.[[locale]].\n var foundLocale = r['[[locale]]'];\n\n var extensionSubtags = void 0,\n extensionSubtagsLength = void 0;\n\n // 5. If r has an [[extension]] field, then\n if (hop.call(r, '[[extension]]')) {\n // a. Let extension be the value of r.[[extension]].\n var extension = r['[[extension]]'];\n // b. Let split be the standard built-in function object defined in ES5,\n // 15.5.4.14.\n var split = String.prototype.split;\n // c. Let extensionSubtags be the result of calling the [[Call]] internal\n // method of split with extension as the this value and an argument\n // list containing the single item \"-\".\n extensionSubtags = split.call(extension, '-');\n // d. Let extensionSubtagsLength be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument \"length\".\n extensionSubtagsLength = extensionSubtags.length;\n }\n\n // 6. Let result be a new Record.\n var result = new Record();\n\n // 7. Set result.[[dataLocale]] to foundLocale.\n result['[[dataLocale]]'] = foundLocale;\n\n // 8. Let supportedExtension be \"-u\".\n var supportedExtension = '-u';\n // 9. Let i be 0.\n var i = 0;\n // 10. Let len be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument \"length\".\n var len = relevantExtensionKeys.length;\n\n // 11 Repeat while i < len:\n while (i < len) {\n // a. Let key be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument ToString(i).\n var key = relevantExtensionKeys[i];\n // b. Let foundLocaleData be the result of calling the [[Get]] internal\n // method of localeData with the argument foundLocale.\n var foundLocaleData = localeData[foundLocale];\n // c. Let keyLocaleData be the result of calling the [[Get]] internal\n // method of foundLocaleData with the argument key.\n var keyLocaleData = foundLocaleData[key];\n // d. Let value be the result of calling the [[Get]] internal method of\n // keyLocaleData with argument \"0\".\n var value = keyLocaleData['0'];\n // e. Let supportedExtensionAddition be \"\".\n var supportedExtensionAddition = '';\n // f. Let indexOf be the standard built-in function object defined in\n // ES5, 15.4.4.14.\n var indexOf = arrIndexOf;\n\n // g. If extensionSubtags is not undefined, then\n if (extensionSubtags !== undefined) {\n // i. Let keyPos be the result of calling the [[Call]] internal\n // method of indexOf with extensionSubtags as the this value and\n // an argument list containing the single item key.\n var keyPos = indexOf.call(extensionSubtags, key);\n\n // ii. If keyPos ≠ -1, then\n if (keyPos !== -1) {\n // 1. If keyPos + 1 < extensionSubtagsLength and the length of the\n // result of calling the [[Get]] internal method of\n // extensionSubtags with argument ToString(keyPos +1) is greater\n // than 2, then\n if (keyPos + 1 < extensionSubtagsLength && extensionSubtags[keyPos + 1].length > 2) {\n // a. Let requestedValue be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument\n // ToString(keyPos + 1).\n var requestedValue = extensionSubtags[keyPos + 1];\n // b. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the\n // this value and an argument list containing the single\n // item requestedValue.\n var valuePos = indexOf.call(keyLocaleData, requestedValue);\n\n // c. If valuePos ≠ -1, then\n if (valuePos !== -1) {\n // i. Let value be requestedValue.\n value = requestedValue,\n // ii. Let supportedExtensionAddition be the\n // concatenation of \"-\", key, \"-\", and value.\n supportedExtensionAddition = '-' + key + '-' + value;\n }\n }\n // 2. Else\n else {\n // a. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the this\n // value and an argument list containing the single item\n // \"true\".\n var _valuePos = indexOf(keyLocaleData, 'true');\n\n // b. If valuePos ≠ -1, then\n if (_valuePos !== -1)\n // i. Let value be \"true\".\n value = 'true';\n }\n }\n }\n // h. If options has a field [[]], then\n if (hop.call(options, '[[' + key + ']]')) {\n // i. Let optionsValue be the value of options.[[]].\n var optionsValue = options['[[' + key + ']]'];\n\n // ii. If the result of calling the [[Call]] internal method of indexOf\n // with keyLocaleData as the this value and an argument list\n // containing the single item optionsValue is not -1, then\n if (indexOf.call(keyLocaleData, optionsValue) !== -1) {\n // 1. If optionsValue is not equal to value, then\n if (optionsValue !== value) {\n // a. Let value be optionsValue.\n value = optionsValue;\n // b. Let supportedExtensionAddition be \"\".\n supportedExtensionAddition = '';\n }\n }\n }\n // i. Set result.[[]] to value.\n result['[[' + key + ']]'] = value;\n\n // j. Append supportedExtensionAddition to supportedExtension.\n supportedExtension += supportedExtensionAddition;\n\n // k. Increase i by 1.\n i++;\n }\n // 12. If the length of supportedExtension is greater than 2, then\n if (supportedExtension.length > 2) {\n // a.\n var privateIndex = foundLocale.indexOf(\"-x-\");\n // b.\n if (privateIndex === -1) {\n // i.\n foundLocale = foundLocale + supportedExtension;\n }\n // c.\n else {\n // i.\n var preExtension = foundLocale.substring(0, privateIndex);\n // ii.\n var postExtension = foundLocale.substring(privateIndex);\n // iii.\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n // d. asserting - skipping\n // e.\n foundLocale = CanonicalizeLanguageTag(foundLocale);\n }\n // 13. Set result.[[locale]] to foundLocale.\n result['[[locale]]'] = foundLocale;\n\n // 14. Return result.\n return result;\n}\n\n/**\n * The LookupSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.\n * Locales appear in the same order in the returned list as in requestedLocales.\n * The following steps are taken:\n */\nfunction /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) {\n // 1. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n // 2. Let subset be a new empty List.\n var subset = new List();\n // 3. Let k be 0.\n var k = 0;\n\n // 4. Repeat while k < len\n while (k < len) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position k.\n var locale = requestedLocales[k];\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n var noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. If availableLocale is not undefined, then append locale to the end of\n // subset.\n if (availableLocale !== undefined) arrPush.call(subset, locale);\n\n // e. Increment k by 1.\n k++;\n }\n\n // 5. Let subsetArray be a new Array object whose elements are the same\n // values in the same order as the elements of subset.\n var subsetArray = arrSlice.call(subset);\n\n // 6. Return subsetArray.\n return subsetArray;\n}\n\n/**\n * The BestFitSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the Best Fit Matcher\n * algorithm. Locales appear in the same order in the returned list as in\n * requestedLocales. The steps taken are implementation dependent.\n */\nfunction /*9.2.7 */BestFitSupportedLocales(availableLocales, requestedLocales) {\n // ###TODO: implement this function as described by the specification###\n return LookupSupportedLocales(availableLocales, requestedLocales);\n}\n\n/**\n * The SupportedLocales abstract operation returns the subset of the provided BCP\n * 47 language priority list requestedLocales for which availableLocales has a\n * matching locale. Two algorithms are available to match the locales: the Lookup\n * algorithm described in RFC 4647 section 3.4, and an implementation dependent\n * best-fit algorithm. Locales appear in the same order in the returned list as\n * in requestedLocales. The following steps are taken:\n */\nfunction /*9.2.8 */SupportedLocales(availableLocales, requestedLocales, options) {\n var matcher = void 0,\n subset = void 0;\n\n // 1. If options is not undefined, then\n if (options !== undefined) {\n // a. Let options be ToObject(options).\n options = new Record(toObject(options));\n // b. Let matcher be the result of calling the [[Get]] internal method of\n // options with argument \"localeMatcher\".\n matcher = options.localeMatcher;\n\n // c. If matcher is not undefined, then\n if (matcher !== undefined) {\n // i. Let matcher be ToString(matcher).\n matcher = String(matcher);\n\n // ii. If matcher is not \"lookup\" or \"best fit\", then throw a RangeError\n // exception.\n if (matcher !== 'lookup' && matcher !== 'best fit') throw new RangeError('matcher should be \"lookup\" or \"best fit\"');\n }\n }\n // 2. If matcher is undefined or \"best fit\", then\n if (matcher === undefined || matcher === 'best fit')\n // a. Let subset be the result of calling the BestFitSupportedLocales\n // abstract operation (defined in 9.2.7) with arguments\n // availableLocales and requestedLocales.\n subset = BestFitSupportedLocales(availableLocales, requestedLocales);\n // 3. Else\n else\n // a. Let subset be the result of calling the LookupSupportedLocales\n // abstract operation (defined in 9.2.6) with arguments\n // availableLocales and requestedLocales.\n subset = LookupSupportedLocales(availableLocales, requestedLocales);\n\n // 4. For each named own property name P of subset,\n for (var P in subset) {\n if (!hop.call(subset, P)) continue;\n\n // a. Let desc be the result of calling the [[GetOwnProperty]] internal\n // method of subset with P.\n // b. Set desc.[[Writable]] to false.\n // c. Set desc.[[Configurable]] to false.\n // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,\n // and true as arguments.\n defineProperty(subset, P, {\n writable: false, configurable: false, value: subset[P]\n });\n }\n // \"Freeze\" the array so no new elements can be added\n defineProperty(subset, 'length', { writable: false });\n\n // 5. Return subset\n return subset;\n}\n\n/**\n * The GetOption abstract operation extracts the value of the property named\n * property from the provided options object, converts it to the required type,\n * checks whether it is one of a List of allowed values, and fills in a fallback\n * value if necessary.\n */\nfunction /*9.2.9 */GetOption(options, property, type, values, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Assert: type is \"boolean\" or \"string\".\n // b. If type is \"boolean\", then let value be ToBoolean(value).\n // c. If type is \"string\", then let value be ToString(value).\n value = type === 'boolean' ? Boolean(value) : type === 'string' ? String(value) : value;\n\n // d. If values is not undefined, then\n if (values !== undefined) {\n // i. If values does not contain an element equal to value, then throw a\n // RangeError exception.\n if (arrIndexOf.call(values, value) === -1) throw new RangeError(\"'\" + value + \"' is not an allowed value for `\" + property + '`');\n }\n\n // e. Return value.\n return value;\n }\n // Else return fallback.\n return fallback;\n}\n\n/**\n * The GetNumberOption abstract operation extracts a property value from the\n * provided options object, converts it to a Number value, checks whether it is\n * in the allowed range, and fills in a fallback value if necessary.\n */\nfunction /* 9.2.10 */GetNumberOption(options, property, minimum, maximum, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Let value be ToNumber(value).\n value = Number(value);\n\n // b. If value is NaN or less than minimum or greater than maximum, throw a\n // RangeError exception.\n if (isNaN(value) || value < minimum || value > maximum) throw new RangeError('Value is not a number or outside accepted range');\n\n // c. Return floor(value).\n return Math.floor(value);\n }\n // 3. Else return fallback.\n return fallback;\n}\n\n// 8 The Intl Object\nvar Intl = {};\n\n// 8.2 Function Properties of the Intl Object\n\n// 8.2.1\n// @spec[tc39/ecma402/master/spec/intl.html]\n// @clause[sec-intl.getcanonicallocales]\nfunction getCanonicalLocales(locales) {\n // 1. Let ll be ? CanonicalizeLocaleList(locales).\n var ll = CanonicalizeLocaleList(locales);\n // 2. Return CreateArrayFromList(ll).\n {\n var result = [];\n\n var len = ll.length;\n var k = 0;\n\n while (k < len) {\n result[k] = ll[k];\n k++;\n }\n return result;\n }\n}\n\nObject.defineProperty(Intl, 'getCanonicalLocales', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: getCanonicalLocales\n});\n\n// Currency minor units output from get-4217 grunt task, formatted\nvar currencyMinorUnits = {\n BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,\n XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,\n OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0\n};\n\n// Define the NumberFormat constructor internally so it cannot be tainted\nfunction NumberFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.NumberFormat(locales, options);\n }\n\n return InitializeNumberFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'NumberFormat', {\n configurable: true,\n writable: true,\n value: NumberFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(Intl.NumberFormat, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeNumberFormat accepts the arguments\n * numberFormat (which must be an object), locales, and options. It initializes\n * numberFormat as a NumberFormat object.\n */\nfunction /*11.1.1.1 */InitializeNumberFormat(numberFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(numberFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If numberFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(numberFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. If options is undefined, then\n if (options === undefined)\n // a. Let options be the result of creating a new object as if by the\n // expression new Object() where Object is the standard built-in constructor\n // with that name.\n options = {};\n\n // 5. Else\n else\n // a. Let options be ToObject(options).\n options = toObject(options);\n\n // 6. Let opt be a new Record.\n var opt = new Record(),\n\n\n // 7. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with the arguments options, \"localeMatcher\", \"string\",\n // a List containing the two String values \"lookup\" and \"best fit\", and\n // \"best fit\".\n matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 8. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 9. Let NumberFormat be the standard built-in object that is the initial value\n // of Intl.NumberFormat.\n // 10. Let localeData be the value of the [[localeData]] internal property of\n // NumberFormat.\n var localeData = internals.NumberFormat['[[localeData]]'];\n\n // 11. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of NumberFormat, and localeData.\n var r = ResolveLocale(internals.NumberFormat['[[availableLocales]]'], requestedLocales, opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 12. Set the [[locale]] internal property of numberFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 13. Set the [[numberingSystem]] internal property of numberFormat to the value\n // of r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let s be the result of calling the GetOption abstract operation with the\n // arguments options, \"style\", \"string\", a List containing the three String\n // values \"decimal\", \"percent\", and \"currency\", and \"decimal\".\n var s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');\n\n // 16. Set the [[style]] internal property of numberFormat to s.\n internal['[[style]]'] = s;\n\n // 17. Let c be the result of calling the GetOption abstract operation with the\n // arguments options, \"currency\", \"string\", undefined, and undefined.\n var c = GetOption(options, 'currency', 'string');\n\n // 18. If c is not undefined and the result of calling the\n // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with\n // argument c is false, then throw a RangeError exception.\n if (c !== undefined && !IsWellFormedCurrencyCode(c)) throw new RangeError(\"'\" + c + \"' is not a valid currency code\");\n\n // 19. If s is \"currency\" and c is undefined, throw a TypeError exception.\n if (s === 'currency' && c === undefined) throw new TypeError('Currency code is required when style is currency');\n\n var cDigits = void 0;\n\n // 20. If s is \"currency\", then\n if (s === 'currency') {\n // a. Let c be the result of converting c to upper case as specified in 6.1.\n c = c.toUpperCase();\n\n // b. Set the [[currency]] internal property of numberFormat to c.\n internal['[[currency]]'] = c;\n\n // c. Let cDigits be the result of calling the CurrencyDigits abstract\n // operation (defined below) with argument c.\n cDigits = CurrencyDigits(c);\n }\n\n // 21. Let cd be the result of calling the GetOption abstract operation with the\n // arguments options, \"currencyDisplay\", \"string\", a List containing the\n // three String values \"code\", \"symbol\", and \"name\", and \"symbol\".\n var cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');\n\n // 22. If s is \"currency\", then set the [[currencyDisplay]] internal property of\n // numberFormat to cd.\n if (s === 'currency') internal['[[currencyDisplay]]'] = cd;\n\n // 23. Let mnid be the result of calling the GetNumberOption abstract operation\n // (defined in 9.2.10) with arguments options, \"minimumIntegerDigits\", 1, 21,\n // and 1.\n var mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);\n\n // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.\n internal['[[minimumIntegerDigits]]'] = mnid;\n\n // 25. If s is \"currency\", then let mnfdDefault be cDigits; else let mnfdDefault\n // be 0.\n var mnfdDefault = s === 'currency' ? cDigits : 0;\n\n // 26. Let mnfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"minimumFractionDigits\", 0, 20, and mnfdDefault.\n var mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);\n\n // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.\n internal['[[minimumFractionDigits]]'] = mnfd;\n\n // 28. If s is \"currency\", then let mxfdDefault be max(mnfd, cDigits); else if s\n // is \"percent\", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault\n // be max(mnfd, 3).\n var mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits) : s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3);\n\n // 29. Let mxfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"maximumFractionDigits\", mnfd, 20, and mxfdDefault.\n var mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);\n\n // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.\n internal['[[maximumFractionDigits]]'] = mxfd;\n\n // 31. Let mnsd be the result of calling the [[Get]] internal method of options\n // with argument \"minimumSignificantDigits\".\n var mnsd = options.minimumSignificantDigits;\n\n // 32. Let mxsd be the result of calling the [[Get]] internal method of options\n // with argument \"maximumSignificantDigits\".\n var mxsd = options.maximumSignificantDigits;\n\n // 33. If mnsd is not undefined or mxsd is not undefined, then:\n if (mnsd !== undefined || mxsd !== undefined) {\n // a. Let mnsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"minimumSignificantDigits\", 1, 21,\n // and 1.\n mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);\n\n // b. Let mxsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"maximumSignificantDigits\", mnsd,\n // 21, and 21.\n mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);\n\n // c. Set the [[minimumSignificantDigits]] internal property of numberFormat\n // to mnsd, and the [[maximumSignificantDigits]] internal property of\n // numberFormat to mxsd.\n internal['[[minimumSignificantDigits]]'] = mnsd;\n internal['[[maximumSignificantDigits]]'] = mxsd;\n }\n // 34. Let g be the result of calling the GetOption abstract operation with the\n // arguments options, \"useGrouping\", \"boolean\", undefined, and true.\n var g = GetOption(options, 'useGrouping', 'boolean', undefined, true);\n\n // 35. Set the [[useGrouping]] internal property of numberFormat to g.\n internal['[[useGrouping]]'] = g;\n\n // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 37. Let patterns be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"patterns\".\n var patterns = dataLocaleData.patterns;\n\n // 38. Assert: patterns is an object (see 11.2.3)\n\n // 39. Let stylePatterns be the result of calling the [[Get]] internal method of\n // patterns with argument s.\n var stylePatterns = patterns[s];\n\n // 40. Set the [[positivePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"positivePattern\".\n internal['[[positivePattern]]'] = stylePatterns.positivePattern;\n\n // 41. Set the [[negativePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"negativePattern\".\n internal['[[negativePattern]]'] = stylePatterns.negativePattern;\n\n // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to\n // true.\n internal['[[initializedNumberFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) numberFormat.format = GetFormatNumber.call(numberFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return numberFormat;\n}\n\nfunction CurrencyDigits(currency) {\n // When the CurrencyDigits abstract operation is called with an argument currency\n // (which must be an upper case String value), the following steps are taken:\n\n // 1. If the ISO 4217 currency and funds code list contains currency as an\n // alphabetic code, then return the minor unit value corresponding to the\n // currency from the list; else return 2.\n return currencyMinorUnits[currency] !== undefined ? currencyMinorUnits[currency] : 2;\n}\n\n/* 11.2.3 */internals.NumberFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.NumberFormat is called, the\n * following steps are taken:\n */\n/* 11.2.2 */\ndefineProperty(Intl.NumberFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * NumberFormat object.\n */\n/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatNumber\n});\n\nfunction GetFormatNumber() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this NumberFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 1, that takes the argument value and\n // performs the following steps:\n var F = function F(value) {\n // i. If value is not provided, then let value be undefined.\n // ii. Let x be ToNumber(value).\n // iii. Return the result of calling the FormatNumber abstract\n // operation (defined below) with arguments this and x.\n return FormatNumber(this, /* x = */Number(value));\n };\n\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts() {\n var value = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');\n\n var x = Number(value);\n return FormatNumberToParts(this, x);\n}\n\nObject.defineProperty(Intl.NumberFormat.prototype, 'formatToParts', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: formatToParts\n});\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumbertoparts]\n */\nfunction FormatNumberToParts(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be ArrayCreate(0).\n var result = [];\n // 3. Let n be 0.\n var n = 0;\n // 4. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Let O be ObjectCreate(%ObjectPrototype%).\n var O = {};\n // a. Perform ? CreateDataPropertyOrThrow(O, \"type\", part.[[type]]).\n O.type = part['[[type]]'];\n // a. Perform ? CreateDataPropertyOrThrow(O, \"value\", part.[[value]]).\n O.value = part['[[value]]'];\n // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).\n result[n] = O;\n // a. Increment n by 1.\n n += 1;\n }\n // 5. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-partitionnumberpattern]\n */\nfunction PartitionNumberPattern(numberFormat, x) {\n\n var internal = getInternalProperties(numberFormat),\n locale = internal['[[dataLocale]]'],\n nums = internal['[[numberingSystem]]'],\n data = internals.NumberFormat['[[localeData]]'][locale],\n ild = data.symbols[nums] || data.symbols.latn,\n pattern = void 0;\n\n // 1. If x is not NaN and x < 0, then:\n if (!isNaN(x) && x < 0) {\n // a. Let x be -x.\n x = -x;\n // a. Let pattern be the value of numberFormat.[[negativePattern]].\n pattern = internal['[[negativePattern]]'];\n }\n // 2. Else,\n else {\n // a. Let pattern be the value of numberFormat.[[positivePattern]].\n pattern = internal['[[positivePattern]]'];\n }\n // 3. Let result be a new empty List.\n var result = new List();\n // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, \"{\", 0).\n var beginIndex = pattern.indexOf('{', 0);\n // 5. Let endIndex be 0.\n var endIndex = 0;\n // 6. Let nextIndex be 0.\n var nextIndex = 0;\n // 7. Let length be the number of code units in pattern.\n var length = pattern.length;\n // 8. Repeat while beginIndex is an integer index into pattern:\n while (beginIndex > -1 && beginIndex < length) {\n // a. Set endIndex to Call(%StringProto_indexOf%, pattern, \"}\", beginIndex)\n endIndex = pattern.indexOf('}', beginIndex);\n // a. If endIndex = -1, throw new Error exception.\n if (endIndex === -1) throw new Error();\n // a. If beginIndex is greater than nextIndex, then:\n if (beginIndex > nextIndex) {\n // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.\n var literal = pattern.substring(nextIndex, beginIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // a. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // a. If p is equal \"number\", then:\n if (p === \"number\") {\n // i. If x is NaN,\n if (isNaN(x)) {\n // 1. Let n be an ILD String value indicating the NaN value.\n var n = ild.nan;\n // 2. Add new part record { [[type]]: \"nan\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });\n }\n // ii. Else if isFinite(x) is false,\n else if (!isFinite(x)) {\n // 1. Let n be an ILD String value indicating infinity.\n var _n = ild.infinity;\n // 2. Add new part record { [[type]]: \"infinity\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': _n });\n }\n // iii. Else,\n else {\n // 1. If the value of numberFormat.[[style]] is \"percent\" and isFinite(x), let x be 100 × x.\n if (internal['[[style]]'] === 'percent' && isFinite(x)) x *= 100;\n\n var _n2 = void 0;\n // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then\n if (hop.call(internal, '[[minimumSignificantDigits]]') && hop.call(internal, '[[maximumSignificantDigits]]')) {\n // a. Let n be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).\n _n2 = ToRawPrecision(x, internal['[[minimumSignificantDigits]]'], internal['[[maximumSignificantDigits]]']);\n }\n // 3. Else,\n else {\n // a. Let n be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).\n _n2 = ToRawFixed(x, internal['[[minimumIntegerDigits]]'], internal['[[minimumFractionDigits]]'], internal['[[maximumFractionDigits]]']);\n }\n // 4. If the value of the numberFormat.[[numberingSystem]] matches one of the values in the \"Numbering System\" column of Table 2 below, then\n if (numSys[nums]) {\n (function () {\n // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the \"Digits\" column of the matching row in Table 2.\n var digits = numSys[nums];\n // a. Replace each digit in n with the value of digits[digit].\n _n2 = String(_n2).replace(/\\d/g, function (digit) {\n return digits[digit];\n });\n })();\n }\n // 5. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.\n else _n2 = String(_n2); // ###TODO###\n\n var integer = void 0;\n var fraction = void 0;\n // 6. Let decimalSepIndex be Call(%StringProto_indexOf%, n, \".\", 0).\n var decimalSepIndex = _n2.indexOf('.', 0);\n // 7. If decimalSepIndex > 0, then:\n if (decimalSepIndex > 0) {\n // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.\n integer = _n2.substring(0, decimalSepIndex);\n // a. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.\n fraction = _n2.substring(decimalSepIndex + 1, decimalSepIndex.length);\n }\n // 8. Else:\n else {\n // a. Let integer be n.\n integer = _n2;\n // a. Let fraction be undefined.\n fraction = undefined;\n }\n // 9. If the value of the numberFormat.[[useGrouping]] is true,\n if (internal['[[useGrouping]]'] === true) {\n // a. Let groupSepSymbol be the ILND String representing the grouping separator.\n var groupSepSymbol = ild.group;\n // a. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.\n var groups = [];\n // ----> implementation:\n // Primary group represents the group closest to the decimal\n var pgSize = data.patterns.primaryGroupSize || 3;\n // Secondary group is every other group\n var sgSize = data.patterns.secondaryGroupSize || pgSize;\n // Group only if necessary\n if (integer.length > pgSize) {\n // Index of the primary grouping separator\n var end = integer.length - pgSize;\n // Starting index for our loop\n var idx = end % sgSize;\n var start = integer.slice(0, idx);\n if (start.length) arrPush.call(groups, start);\n // Loop to separate into secondary grouping digits\n while (idx < end) {\n arrPush.call(groups, integer.slice(idx, idx + sgSize));\n idx += sgSize;\n }\n // Add the primary grouping digits\n arrPush.call(groups, integer.slice(end));\n } else {\n arrPush.call(groups, integer);\n }\n // a. Assert: The number of elements in groups List is greater than 0.\n if (groups.length === 0) throw new Error();\n // a. Repeat, while groups List is not empty:\n while (groups.length) {\n // i. Remove the first element from groups and let integerGroup be the value of that element.\n var integerGroup = arrShift.call(groups);\n // ii. Add new part record { [[type]]: \"integer\", [[value]]: integerGroup } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });\n // iii. If groups List is not empty, then:\n if (groups.length) {\n // 1. Add new part record { [[type]]: \"group\", [[value]]: groupSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });\n }\n }\n }\n // 10. Else,\n else {\n // a. Add new part record { [[type]]: \"integer\", [[value]]: integer } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });\n }\n // 11. If fraction is not undefined, then:\n if (fraction !== undefined) {\n // a. Let decimalSepSymbol be the ILND String representing the decimal separator.\n var decimalSepSymbol = ild.decimal;\n // a. Add new part record { [[type]]: \"decimal\", [[value]]: decimalSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });\n // a. Add new part record { [[type]]: \"fraction\", [[value]]: fraction } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });\n }\n }\n }\n // a. Else if p is equal \"plusSign\", then:\n else if (p === \"plusSign\") {\n // i. Let plusSignSymbol be the ILND String representing the plus sign.\n var plusSignSymbol = ild.plusSign;\n // ii. Add new part record { [[type]]: \"plusSign\", [[value]]: plusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });\n }\n // a. Else if p is equal \"minusSign\", then:\n else if (p === \"minusSign\") {\n // i. Let minusSignSymbol be the ILND String representing the minus sign.\n var minusSignSymbol = ild.minusSign;\n // ii. Add new part record { [[type]]: \"minusSign\", [[value]]: minusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });\n }\n // a. Else if p is equal \"percentSign\" and numberFormat.[[style]] is \"percent\", then:\n else if (p === \"percentSign\" && internal['[[style]]'] === \"percent\") {\n // i. Let percentSignSymbol be the ILND String representing the percent sign.\n var percentSignSymbol = ild.percentSign;\n // ii. Add new part record { [[type]]: \"percentSign\", [[value]]: percentSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });\n }\n // a. Else if p is equal \"currency\" and numberFormat.[[style]] is \"currency\", then:\n else if (p === \"currency\" && internal['[[style]]'] === \"currency\") {\n // i. Let currency be the value of numberFormat.[[currency]].\n var currency = internal['[[currency]]'];\n\n var cd = void 0;\n\n // ii. If numberFormat.[[currencyDisplay]] is \"code\", then\n if (internal['[[currencyDisplay]]'] === \"code\") {\n // 1. Let cd be currency.\n cd = currency;\n }\n // iii. Else if numberFormat.[[currencyDisplay]] is \"symbol\", then\n else if (internal['[[currencyDisplay]]'] === \"symbol\") {\n // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.\n cd = data.currencies[currency] || currency;\n }\n // iv. Else if numberFormat.[[currencyDisplay]] is \"name\", then\n else if (internal['[[currencyDisplay]]'] === \"name\") {\n // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.\n cd = currency;\n }\n // v. Add new part record { [[type]]: \"currency\", [[value]]: cd } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });\n }\n // a. Else,\n else {\n // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.\n var _literal = pattern.substring(beginIndex, endIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal });\n }\n // a. Set nextIndex to endIndex + 1.\n nextIndex = endIndex + 1;\n // a. Set beginIndex to Call(%StringProto_indexOf%, pattern, \"{\", nextIndex)\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n // 9. If nextIndex is less than length, then:\n if (nextIndex < length) {\n // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.\n var _literal2 = pattern.substring(nextIndex, length);\n // a. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal2 });\n }\n // 10. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumber]\n */\nfunction FormatNumber(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be an empty String.\n var result = '';\n // 3. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Set result to a String value produced by concatenating result and part.[[value]].\n result += part['[[value]]'];\n }\n // 4. Return result.\n return result;\n}\n\n/**\n * When the ToRawPrecision abstract operation is called with arguments x (which\n * must be a finite non-negative number), minPrecision, and maxPrecision (both\n * must be integers between 1 and 21) the following steps are taken:\n */\nfunction ToRawPrecision(x, minPrecision, maxPrecision) {\n // 1. Let p be maxPrecision.\n var p = maxPrecision;\n\n var m = void 0,\n e = void 0;\n\n // 2. If x = 0, then\n if (x === 0) {\n // a. Let m be the String consisting of p occurrences of the character \"0\".\n m = arrJoin.call(Array(p + 1), '0');\n // b. Let e be 0.\n e = 0;\n }\n // 3. Else\n else {\n // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the\n // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as\n // possible. If there are two such sets of e and n, pick the e and n for\n // which n × 10ᵉ⁻ᵖ⁺¹ is larger.\n e = log10Floor(Math.abs(x));\n\n // Easier to get to m from here\n var f = Math.round(Math.exp(Math.abs(e - p + 1) * Math.LN10));\n\n // b. Let m be the String consisting of the digits of the decimal\n // representation of n (in order, with no leading zeroes)\n m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));\n }\n\n // 4. If e ≥ p, then\n if (e >= p)\n // a. Return the concatenation of m and e-p+1 occurrences of the character \"0\".\n return m + arrJoin.call(Array(e - p + 1 + 1), '0');\n\n // 5. If e = p-1, then\n else if (e === p - 1)\n // a. Return m.\n return m;\n\n // 6. If e ≥ 0, then\n else if (e >= 0)\n // a. Let m be the concatenation of the first e+1 characters of m, the character\n // \".\", and the remaining p–(e+1) characters of m.\n m = m.slice(0, e + 1) + '.' + m.slice(e + 1);\n\n // 7. If e < 0, then\n else if (e < 0)\n // a. Let m be the concatenation of the String \"0.\", –(e+1) occurrences of the\n // character \"0\", and the string m.\n m = '0.' + arrJoin.call(Array(-(e + 1) + 1), '0') + m;\n\n // 8. If m contains the character \".\", and maxPrecision > minPrecision, then\n if (m.indexOf(\".\") >= 0 && maxPrecision > minPrecision) {\n // a. Let cut be maxPrecision – minPrecision.\n var cut = maxPrecision - minPrecision;\n\n // b. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.charAt(m.length - 1) === '0') {\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n\n // ii. Decrease cut by 1.\n cut--;\n }\n\n // c. If the last character of m is \".\", then\n if (m.charAt(m.length - 1) === '.')\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. Return m.\n return m;\n}\n\n/**\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-torawfixed]\n * When the ToRawFixed abstract operation is called with arguments x (which must\n * be a finite non-negative number), minInteger (which must be an integer between\n * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and\n * 20) the following steps are taken:\n */\nfunction ToRawFixed(x, minInteger, minFraction, maxFraction) {\n // 1. Let f be maxFraction.\n var f = maxFraction;\n // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.\n var n = Math.pow(10, f) * x; // diverging...\n // 3. If n = 0, let m be the String \"0\". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).\n var m = n === 0 ? \"0\" : n.toFixed(0); // divering...\n\n {\n // this diversion is needed to take into consideration big numbers, e.g.:\n // 1.2344501e+37 -> 12344501000000000000000000000000000000\n var idx = void 0;\n var exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;\n if (exp) {\n m = m.slice(0, idx).replace('.', '');\n m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');\n }\n }\n\n var int = void 0;\n // 4. If f ≠ 0, then\n if (f !== 0) {\n // a. Let k be the number of characters in m.\n var k = m.length;\n // a. If k ≤ f, then\n if (k <= f) {\n // i. Let z be the String consisting of f+1–k occurrences of the character \"0\".\n var z = arrJoin.call(Array(f + 1 - k + 1), '0');\n // ii. Let m be the concatenation of Strings z and m.\n m = z + m;\n // iii. Let k be f+1.\n k = f + 1;\n }\n // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.\n var a = m.substring(0, k - f),\n b = m.substring(k - f, m.length);\n // a. Let m be the concatenation of the three Strings a, \".\", and b.\n m = a + \".\" + b;\n // a. Let int be the number of characters in a.\n int = a.length;\n }\n // 5. Else, let int be the number of characters in m.\n else int = m.length;\n // 6. Let cut be maxFraction – minFraction.\n var cut = maxFraction - minFraction;\n // 7. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.slice(-1) === \"0\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n // a. Decrease cut by 1.\n cut--;\n }\n // 8. If the last character of m is \".\", then\n if (m.slice(-1) === \".\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. If int < minInteger, then\n if (int < minInteger) {\n // a. Let z be the String consisting of minInteger–int occurrences of the character \"0\".\n var _z = arrJoin.call(Array(minInteger - int + 1), '0');\n // a. Let m be the concatenation of Strings z and m.\n m = _z + m;\n }\n // 10. Return m.\n return m;\n}\n\n// Sect 11.3.2 Table 2, Numbering systems\n// ======================================\nvar numSys = {\n arab: [\"٠\", \"١\", \"٢\", \"٣\", \"٤\", \"٥\", \"٦\", \"٧\", \"٨\", \"٩\"],\n arabext: [\"۰\", \"۱\", \"۲\", \"۳\", \"۴\", \"۵\", \"۶\", \"۷\", \"۸\", \"۹\"],\n bali: [\"᭐\", \"᭑\", \"᭒\", \"᭓\", \"᭔\", \"᭕\", \"᭖\", \"᭗\", \"᭘\", \"᭙\"],\n beng: [\"০\", \"১\", \"২\", \"৩\", \"৪\", \"৫\", \"৬\", \"৭\", \"৮\", \"৯\"],\n deva: [\"०\", \"१\", \"२\", \"३\", \"४\", \"५\", \"६\", \"७\", \"८\", \"९\"],\n fullwide: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n gujr: [\"૦\", \"૧\", \"૨\", \"૩\", \"૪\", \"૫\", \"૬\", \"૭\", \"૮\", \"૯\"],\n guru: [\"੦\", \"੧\", \"੨\", \"੩\", \"੪\", \"੫\", \"੬\", \"੭\", \"੮\", \"੯\"],\n hanidec: [\"〇\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\", \"七\", \"八\", \"九\"],\n khmr: [\"០\", \"១\", \"២\", \"៣\", \"៤\", \"៥\", \"៦\", \"៧\", \"៨\", \"៩\"],\n knda: [\"೦\", \"೧\", \"೨\", \"೩\", \"೪\", \"೫\", \"೬\", \"೭\", \"೮\", \"೯\"],\n laoo: [\"໐\", \"໑\", \"໒\", \"໓\", \"໔\", \"໕\", \"໖\", \"໗\", \"໘\", \"໙\"],\n latn: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n limb: [\"᥆\", \"᥇\", \"᥈\", \"᥉\", \"᥊\", \"᥋\", \"᥌\", \"᥍\", \"᥎\", \"᥏\"],\n mlym: [\"൦\", \"൧\", \"൨\", \"൩\", \"൪\", \"൫\", \"൬\", \"൭\", \"൮\", \"൯\"],\n mong: [\"᠐\", \"᠑\", \"᠒\", \"᠓\", \"᠔\", \"᠕\", \"᠖\", \"᠗\", \"᠘\", \"᠙\"],\n mymr: [\"၀\", \"၁\", \"၂\", \"၃\", \"၄\", \"၅\", \"၆\", \"၇\", \"၈\", \"၉\"],\n orya: [\"୦\", \"୧\", \"୨\", \"୩\", \"୪\", \"୫\", \"୬\", \"୭\", \"୮\", \"୯\"],\n tamldec: [\"௦\", \"௧\", \"௨\", \"௩\", \"௪\", \"௫\", \"௬\", \"௭\", \"௮\", \"௯\"],\n telu: [\"౦\", \"౧\", \"౨\", \"౩\", \"౪\", \"౫\", \"౬\", \"౭\", \"౮\", \"౯\"],\n thai: [\"๐\", \"๑\", \"๒\", \"๓\", \"๔\", \"๕\", \"๖\", \"๗\", \"๘\", \"๙\"],\n tibt: [\"༠\", \"༡\", \"༢\", \"༣\", \"༤\", \"༥\", \"༦\", \"༧\", \"༨\", \"༩\"]\n};\n\n/**\n * This function provides access to the locale and formatting options computed\n * during initialization of the object.\n *\n * The function returns a new object whose properties and attributes are set as\n * if constructed by an object literal assigning to each of the following\n * properties the value of the corresponding internal property of this\n * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,\n * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,\n * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and\n * useGrouping. Properties whose corresponding internal properties are not present\n * are not assigned.\n */\n/* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {\n configurable: true,\n writable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\n/* jslint esnext: true */\n\n// Match these datetime components in a CLDR pattern, except those in single quotes\nvar expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nvar expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n// Skip over patterns with these datetime components because we don't have data\n// to back them up:\n// timezone, weekday, amoung others\nvar unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string\n\nvar dtKeys = [\"era\", \"year\", \"month\", \"day\", \"weekday\", \"quarter\"];\nvar tmKeys = [\"hour\", \"minute\", \"second\", \"hour12\", \"timeZoneName\"];\n\nfunction isDateFormatOnly(obj) {\n for (var i = 0; i < tmKeys.length; i += 1) {\n if (obj.hasOwnProperty(tmKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isTimeFormatOnly(obj) {\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (obj.hasOwnProperty(dtKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {\n var o = { _: {} };\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (dateFormatObj[dtKeys[i]]) {\n o[dtKeys[i]] = dateFormatObj[dtKeys[i]];\n }\n if (dateFormatObj._[dtKeys[i]]) {\n o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];\n }\n }\n for (var j = 0; j < tmKeys.length; j += 1) {\n if (timeFormatObj[tmKeys[j]]) {\n o[tmKeys[j]] = timeFormatObj[tmKeys[j]];\n }\n if (timeFormatObj._[tmKeys[j]]) {\n o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];\n }\n }\n return o;\n}\n\nfunction computeFinalPatterns(formatObj) {\n // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:\n // 'In patterns, two single quotes represents a literal single quote, either\n // inside or outside single quotes. Text within single quotes is not\n // interpreted in any way (except for two adjacent single quotes).'\n formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, function ($0, literal) {\n return literal ? literal : \"'\";\n });\n\n // pattern 12 is always the default. we can produce the 24 by removing {ampm}\n formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');\n return formatObj;\n}\n\nfunction expDTComponentsMeta($0, formatObj) {\n switch ($0.charAt(0)) {\n // --- Era\n case 'G':\n formatObj.era = ['short', 'short', 'short', 'long', 'narrow'][$0.length - 1];\n return '{era}';\n\n // --- Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';\n return '{year}';\n\n // --- Quarter (not supported in this polyfill)\n case 'Q':\n case 'q':\n formatObj.quarter = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{quarter}';\n\n // --- Month\n case 'M':\n case 'L':\n formatObj.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{month}';\n\n // --- Week (not supported in this polyfill)\n case 'w':\n // week of the year\n formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';\n return '{weekday}';\n case 'W':\n // week of the month\n formatObj.week = 'numeric';\n return '{weekday}';\n\n // --- Day\n case 'd':\n // day of the month\n formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';\n return '{day}';\n case 'D': // day of the year\n case 'F': // day of the week\n case 'g':\n // 1..n: Modified Julian day\n formatObj.day = 'numeric';\n return '{day}';\n\n // --- Week Day\n case 'E':\n // day of the week\n formatObj.weekday = ['short', 'short', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'e':\n // local day of the week\n formatObj.weekday = ['numeric', '2-digit', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'c':\n // stand alone local day of the week\n formatObj.weekday = ['numeric', undefined, 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n\n // --- Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B':\n // flexible day periods\n formatObj.hour12 = true;\n return '{ampm}';\n\n // --- Hour\n case 'h':\n case 'H':\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n case 'k':\n case 'K':\n formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n\n // --- Minute\n case 'm':\n formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';\n return '{minute}';\n\n // --- Second\n case 's':\n formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';\n return '{second}';\n case 'S':\n case 'A':\n formatObj.second = 'numeric';\n return '{second}';\n\n // --- Timezone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x':\n // 1, 2, 3, 4: The ISO8601 varios formats\n // this polyfill only supports much, for now, we are just doing something dummy\n formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n}\n\n/**\n * Converts the CLDR availableFormats into the objects and patterns required by\n * the ECMAScript Internationalization API specification.\n */\nfunction createDateTimeFormat(skeleton, pattern) {\n // we ignore certain patterns that are unsupported to avoid this expensive op.\n if (unwantedDTCs.test(pattern)) return undefined;\n\n var formatObj = {\n originalPattern: pattern,\n _: {}\n };\n\n // Replace the pattern string with the one required by the specification, whilst\n // at the same time evaluating it for the subsets and formats\n formatObj.extendedPattern = pattern.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj._);\n });\n\n // Match the skeleton string with the one required by the specification\n // this implementation is based on the Date Field Symbol Table:\n // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n // Note: we are adding extra data to the formatObject even though this polyfill\n // might not support it.\n skeleton.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj);\n });\n\n return computeFinalPatterns(formatObj);\n}\n\n/**\n * Processes DateTime formats from CLDR to an easier-to-parse format.\n * the result of this operation should be cached the first time a particular\n * calendar is analyzed.\n *\n * The specification requires we support at least the following subsets of\n * date/time components:\n *\n * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'\n * - 'weekday', 'year', 'month', 'day'\n * - 'year', 'month', 'day'\n * - 'year', 'month'\n * - 'month', 'day'\n * - 'hour', 'minute', 'second'\n * - 'hour', 'minute'\n *\n * We need to cherry pick at least these subsets from the CLDR data and convert\n * them into the pattern objects used in the ECMA-402 API.\n */\nfunction createDateTimeFormats(formats) {\n var availableFormats = formats.availableFormats;\n var timeFormats = formats.timeFormats;\n var dateFormats = formats.dateFormats;\n var result = [];\n var skeleton = void 0,\n pattern = void 0,\n computed = void 0,\n i = void 0,\n j = void 0;\n var timeRelatedFormats = [];\n var dateRelatedFormats = [];\n\n // Map available (custom) formats into a pattern for createDateTimeFormats\n for (skeleton in availableFormats) {\n if (availableFormats.hasOwnProperty(skeleton)) {\n pattern = availableFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n // in some cases, the format is only displaying date specific props\n // or time specific props, in which case we need to also produce the\n // combined formats.\n if (isDateFormatOnly(computed)) {\n dateRelatedFormats.push(computed);\n } else if (isTimeFormatOnly(computed)) {\n timeRelatedFormats.push(computed);\n }\n }\n }\n }\n\n // Map time formats into a pattern for createDateTimeFormats\n for (skeleton in timeFormats) {\n if (timeFormats.hasOwnProperty(skeleton)) {\n pattern = timeFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n timeRelatedFormats.push(computed);\n }\n }\n }\n\n // Map date formats into a pattern for createDateTimeFormats\n for (skeleton in dateFormats) {\n if (dateFormats.hasOwnProperty(skeleton)) {\n pattern = dateFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n dateRelatedFormats.push(computed);\n }\n }\n }\n\n // combine custom time and custom date formats when they are orthogonals to complete the\n // formats supported by CLDR.\n // This Algo is based on section \"Missing Skeleton Fields\" from:\n // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems\n for (i = 0; i < timeRelatedFormats.length; i += 1) {\n for (j = 0; j < dateRelatedFormats.length; j += 1) {\n if (dateRelatedFormats[j].month === 'long') {\n pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;\n } else if (dateRelatedFormats[j].month === 'short') {\n pattern = formats.medium;\n } else {\n pattern = formats.short;\n }\n computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);\n computed.originalPattern = pattern;\n computed.extendedPattern = pattern.replace('{0}', timeRelatedFormats[i].extendedPattern).replace('{1}', dateRelatedFormats[j].extendedPattern).replace(/^[,\\s]+|[,\\s]+$/gi, '');\n result.push(computeFinalPatterns(computed));\n }\n }\n\n return result;\n}\n\n// this represents the exceptions of the rule that are not covered by CLDR availableFormats\n// for single property configurations, they play no role when using multiple properties, and\n// those that are not in this table, are not exceptions or are not covered by the data we\n// provide.\nvar validSyntheticProps = {\n second: {\n numeric: 's',\n '2-digit': 'ss'\n },\n minute: {\n numeric: 'm',\n '2-digit': 'mm'\n },\n year: {\n numeric: 'y',\n '2-digit': 'yy'\n },\n day: {\n numeric: 'd',\n '2-digit': 'dd'\n },\n month: {\n numeric: 'L',\n '2-digit': 'LL',\n narrow: 'LLLLL',\n short: 'LLL',\n long: 'LLLL'\n },\n weekday: {\n narrow: 'ccccc',\n short: 'ccc',\n long: 'cccc'\n }\n};\n\nfunction generateSyntheticFormat(propName, propValue) {\n if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) {\n var _ref2;\n\n return _ref2 = {\n originalPattern: validSyntheticProps[propName][propValue],\n _: defineProperty$1({}, propName, propValue),\n extendedPattern: \"{\" + propName + \"}\"\n }, defineProperty$1(_ref2, propName, propValue), defineProperty$1(_ref2, \"pattern12\", \"{\" + propName + \"}\"), defineProperty$1(_ref2, \"pattern\", \"{\" + propName + \"}\"), _ref2;\n }\n}\n\n// An object map of date component keys, saves using a regex later\nvar dateWidths = objCreate(null, { narrow: {}, short: {}, long: {} });\n\n/**\n * Returns a string for a date component, resolved using multiple inheritance as specified\n * as specified in the Unicode Technical Standard 35.\n */\nfunction resolveDateString(data, ca, component, width, key) {\n // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:\n // 'In clearly specified instances, resources may inherit from within the same locale.\n // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'\n var obj = data[ca] && data[ca][component] ? data[ca][component] : data.gregory[component],\n\n\n // \"sideways\" inheritance resolves strings when a key doesn't exist\n alts = {\n narrow: ['short', 'long'],\n short: ['long', 'narrow'],\n long: ['short', 'narrow']\n },\n\n\n //\n resolved = hop.call(obj, width) ? obj[width] : hop.call(obj, alts[width][0]) ? obj[alts[width][0]] : obj[alts[width][1]];\n\n // `key` wouldn't be specified for components 'dayPeriods'\n return key !== null ? resolved[key] : resolved;\n}\n\n// Define the DateTimeFormat constructor internally so it cannot be tainted\nfunction DateTimeFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.DateTimeFormat(locales, options);\n }\n return InitializeDateTimeFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'DateTimeFormat', {\n configurable: true,\n writable: true,\n value: DateTimeFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(DateTimeFormatConstructor, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat\n * (which must be an object), locales, and options. It initializes dateTimeFormat as a\n * DateTimeFormat object.\n */\nfunction /* 12.1.1.1 */InitializeDateTimeFormat(dateTimeFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(dateTimeFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(dateTimeFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined below) with arguments options, \"any\", and \"date\".\n options = ToDateTimeOptions(options, 'any', 'date');\n\n // 5. Let opt be a new Record.\n var opt = new Record();\n\n // 6. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with arguments options, \"localeMatcher\", \"string\", a List\n // containing the two String values \"lookup\" and \"best fit\", and \"best fit\".\n var matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 7. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 8. Let DateTimeFormat be the standard built-in object that is the initial\n // value of Intl.DateTimeFormat.\n var DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need\n\n // 9. Let localeData be the value of the [[localeData]] internal property of\n // DateTimeFormat.\n var localeData = DateTimeFormat['[[localeData]]'];\n\n // 10. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of DateTimeFormat, and localeData.\n var r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales, opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 11. Set the [[locale]] internal property of dateTimeFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of\n // r.[[ca]].\n internal['[[calendar]]'] = r['[[ca]]'];\n\n // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of\n // r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let tz be the result of calling the [[Get]] internal method of options with\n // argument \"timeZone\".\n var tz = options.timeZone;\n\n // 16. If tz is not undefined, then\n if (tz !== undefined) {\n // a. Let tz be ToString(tz).\n // b. Convert tz to upper case as described in 6.1.\n // NOTE: If an implementation accepts additional time zone values, as permitted\n // under certain conditions by the Conformance clause, different casing\n // rules apply.\n tz = toLatinUpperCase(tz);\n\n // c. If tz is not \"UTC\", then throw a RangeError exception.\n // ###TODO: accept more time zones###\n if (tz !== 'UTC') throw new RangeError('timeZone is not supported.');\n }\n\n // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.\n internal['[[timeZone]]'] = tz;\n\n // 18. Let opt be a new Record.\n opt = new Record();\n\n // 19. For each row of Table 3, except the header row, do:\n for (var prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop)) continue;\n\n // 20. Let prop be the name given in the Property column of the row.\n // 21. Let value be the result of calling the GetOption abstract operation,\n // passing as argument options, the name given in the Property column of the\n // row, \"string\", a List containing the strings given in the Values column of\n // the row, and undefined.\n var value = GetOption(options, prop, 'string', dateTimeComponents[prop]);\n\n // 22. Set opt.[[]] to value.\n opt['[[' + prop + ']]'] = value;\n }\n\n // Assigned a value below\n var bestFormat = void 0;\n\n // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 24. Let formats be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"formats\".\n // Note: we process the CLDR formats into the spec'd structure\n var formats = ToDateTimeFormats(dataLocaleData.formats);\n\n // 25. Let matcher be the result of calling the GetOption abstract operation with\n // arguments options, \"formatMatcher\", \"string\", a List containing the two String\n // values \"basic\" and \"best fit\", and \"best fit\".\n matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');\n\n // Optimization: caching the processed formats as a one time operation by\n // replacing the initial structure from localeData\n dataLocaleData.formats = formats;\n\n // 26. If matcher is \"basic\", then\n if (matcher === 'basic') {\n // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract\n // operation (defined below) with opt and formats.\n bestFormat = BasicFormatMatcher(opt, formats);\n\n // 28. Else\n } else {\n {\n // diverging\n var _hr = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n opt.hour12 = _hr === undefined ? dataLocaleData.hour12 : _hr;\n }\n // 29. Let bestFormat be the result of calling the BestFitFormatMatcher\n // abstract operation (defined below) with opt and formats.\n bestFormat = BestFitFormatMatcher(opt, formats);\n }\n\n // 30. For each row in Table 3, except the header row, do\n for (var _prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _prop)) continue;\n\n // a. Let prop be the name given in the Property column of the row.\n // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of\n // bestFormat with argument prop.\n // c. If pDesc is not undefined, then\n if (hop.call(bestFormat, _prop)) {\n // i. Let p be the result of calling the [[Get]] internal method of bestFormat\n // with argument prop.\n var p = bestFormat[_prop];\n {\n // diverging\n p = bestFormat._ && hop.call(bestFormat._, _prop) ? bestFormat._[_prop] : p;\n }\n\n // ii. Set the [[]] internal property of dateTimeFormat to p.\n internal['[[' + _prop + ']]'] = p;\n }\n }\n\n var pattern = void 0; // Assigned a value below\n\n // 31. Let hr12 be the result of calling the GetOption abstract operation with\n // arguments options, \"hour12\", \"boolean\", undefined, and undefined.\n var hr12 = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n\n // 32. If dateTimeFormat has an internal property [[hour]], then\n if (internal['[[hour]]']) {\n // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]\n // internal method of dataLocaleData with argument \"hour12\".\n hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n\n // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.\n internal['[[hour12]]'] = hr12;\n\n // c. If hr12 is true, then\n if (hr12 === true) {\n // i. Let hourNo0 be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"hourNo0\".\n var hourNo0 = dataLocaleData.hourNo0;\n\n // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.\n internal['[[hourNo0]]'] = hourNo0;\n\n // iii. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern12\".\n pattern = bestFormat.pattern12;\n }\n\n // d. Else\n else\n // i. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n }\n\n // 33. Else\n else\n // a. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n\n // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.\n internal['[[pattern]]'] = pattern;\n\n // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to\n // true.\n internal['[[initializedDateTimeFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return dateTimeFormat;\n}\n\n/**\n * Several DateTimeFormat algorithms use values from the following table, which provides\n * property names and allowable values for the components of date and time formats:\n */\nvar dateTimeComponents = {\n weekday: [\"narrow\", \"short\", \"long\"],\n era: [\"narrow\", \"short\", \"long\"],\n year: [\"2-digit\", \"numeric\"],\n month: [\"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\"],\n day: [\"2-digit\", \"numeric\"],\n hour: [\"2-digit\", \"numeric\"],\n minute: [\"2-digit\", \"numeric\"],\n second: [\"2-digit\", \"numeric\"],\n timeZoneName: [\"short\", \"long\"]\n};\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeFormats(formats) {\n if (Object.prototype.toString.call(formats) === '[object Array]') {\n return formats;\n }\n return createDateTimeFormats(formats);\n}\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeOptions(options, required, defaults) {\n // 1. If options is undefined, then let options be null, else let options be\n // ToObject(options).\n if (options === undefined) options = null;else {\n // (#12) options needs to be a Record, but it also needs to inherit properties\n var opt2 = toObject(options);\n options = new Record();\n\n for (var k in opt2) {\n options[k] = opt2[k];\n }\n }\n\n // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.\n var create = objCreate;\n\n // 3. Let options be the result of calling the [[Call]] internal method of create with\n // undefined as the this value and an argument list containing the single item\n // options.\n options = create(options);\n\n // 4. Let needDefaults be true.\n var needDefaults = true;\n\n // 5. If required is \"date\" or \"any\", then\n if (required === 'date' || required === 'any') {\n // a. For each of the property names \"weekday\", \"year\", \"month\", \"day\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined) needDefaults = false;\n }\n\n // 6. If required is \"time\" or \"any\", then\n if (required === 'time' || required === 'any') {\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined) needDefaults = false;\n }\n\n // 7. If needDefaults is true and defaults is either \"date\" or \"all\", then\n if (needDefaults && (defaults === 'date' || defaults === 'all'))\n // a. For each of the property names \"year\", \"month\", \"day\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.year = options.month = options.day = 'numeric';\n\n // 8. If needDefaults is true and defaults is either \"time\" or \"all\", then\n if (needDefaults && (defaults === 'time' || defaults === 'all'))\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.hour = options.minute = options.second = 'numeric';\n\n // 9. Return options.\n return options;\n}\n\n/**\n * When the BasicFormatMatcher abstract operation is called with two arguments options and\n * formats, the following steps are taken:\n */\nfunction BasicFormatMatcher(options, formats) {\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta === 2) score -= longMorePenalty;\n\n // 6. Else if delta = 1, decrease score by shortMorePenalty.\n else if (delta === 1) score -= shortMorePenalty;\n\n // 7. Else if delta = -1, decrease score by shortLessPenalty.\n else if (delta === -1) score -= shortLessPenalty;\n\n // 8. Else if delta = -2, decrease score by longLessPenalty.\n else if (delta === -2) score -= longLessPenalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/**\n * When the BestFitFormatMatcher abstract operation is called with two arguments options\n * and formats, it performs implementation dependent steps, which should return a set of\n * component representations that a typical user of the selected locale would perceive as\n * at least as good as the one returned by BasicFormatMatcher.\n *\n * This polyfill defines the algorithm to be the same as BasicFormatMatcher,\n * with the addition of bonus points awarded where the requested format is of\n * the same data type as the potentially matching format.\n *\n * This algo relies on the concept of closest distance matching described here:\n * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n * Typically a “best match” is found using a closest distance match, such as:\n *\n * Symbols requesting a best choice for the locale are replaced.\n * j → one of {H, k, h, K}; C → one of {a, b, B}\n * -> Covered by cldr.js matching process\n *\n * For fields with symbols representing the same type (year, month, day, etc):\n * Most symbols have a small distance from each other.\n * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...\n * -> Covered by cldr.js matching process\n *\n * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.\n * MMM ≅ MMMM\n * MM ≅ M\n * Numeric and text fields are given a larger distance from each other.\n * MMM ≈ MM\n * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.\n * d ≋ D; ...\n * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).\n *\n *\n * For example,\n *\n * { month: 'numeric', day: 'numeric' }\n *\n * should match\n *\n * { month: '2-digit', day: '2-digit' }\n *\n * rather than\n *\n * { month: 'short', day: 'numeric' }\n *\n * This makes sense because a user requesting a formatted date with numeric parts would\n * not expect to see the returned format containing narrow, short or long part names\n */\nfunction BestFitFormatMatcher(options, formats) {\n /** Diverging: this block implements the hack for single property configuration, eg.:\n *\n * `new Intl.DateTimeFormat('en', {day: 'numeric'})`\n *\n * should produce a single digit with the day of the month. This is needed because\n * CLDR `availableFormats` data structure doesn't cover these cases.\n */\n {\n var optionsPropNames = [];\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n if (options['[[' + property + ']]'] !== undefined) {\n optionsPropNames.push(property);\n }\n }\n if (optionsPropNames.length === 1) {\n var _bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[[' + optionsPropNames[0] + ']]']);\n if (_bestFormat) {\n return _bestFormat;\n }\n }\n }\n\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n var patternPenalty = 2;\n\n var hour12Penalty = 1;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var _property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + _property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, _property) ? format[_property] : undefined;\n\n // Diverging: using the default properties produced by the pattern/skeleton\n // to match it with user options, and apply a penalty\n var patternProp = hop.call(format._, _property) ? format._[_property] : undefined;\n if (optionsProp !== patternProp) {\n score -= patternPenalty;\n }\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n {\n // diverging from spec\n // When the bestFit argument is true, subtract additional penalty where data types are not the same\n if (formatPropIndex <= 1 && optionsPropIndex >= 2 || formatPropIndex >= 2 && optionsPropIndex <= 1) {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 0) score -= longMorePenalty;else if (delta < 0) score -= longLessPenalty;\n } else {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 1) score -= shortMorePenalty;else if (delta < -1) score -= shortLessPenalty;\n }\n }\n }\n }\n\n {\n // diverging to also take into consideration differences between 12 or 24 hours\n // which is special for the best fit only.\n if (format._.hour12 !== options.hour12) {\n score -= hour12Penalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/* 12.2.3 */internals.DateTimeFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['ca', 'nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the\n * following steps are taken:\n */\n/* 12.2.2 */\ndefineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * DateTimeFormat object.\n */\n/* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatDateTime\n});\n\nfunction GetFormatDateTime() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this DateTimeFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 0, that takes the argument date and\n // performs the following steps:\n var F = function F() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n // i. If date is not provided or is undefined, then let x be the\n // result as if by the expression Date.now() where Date.now is\n // the standard built-in function defined in ES5, 15.9.4.4.\n // ii. Else let x be ToNumber(date).\n // iii. Return the result of calling the FormatDateTime abstract\n // operation (defined below) with arguments this and x.\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatDateTime(this, x);\n };\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts$1() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');\n\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatToPartsDateTime(this, x);\n}\n\nObject.defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: formatToParts$1\n});\n\nfunction CreateDateTimeParts(dateTimeFormat, x) {\n // 1. If x is not a finite Number, then throw a RangeError exception.\n if (!isFinite(x)) throw new RangeError('Invalid valid date passed to format');\n\n var internal = dateTimeFormat.__getInternalProperties(secret);\n\n // Creating restore point for properties on the RegExp object... please wait\n /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this\n\n // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.\n var locale = internal['[[locale]]'];\n\n // 3. Let nf be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {useGrouping: false}) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n var nf = new Intl.NumberFormat([locale], { useGrouping: false });\n\n // 4. Let nf2 be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:\n // false}) where Intl.NumberFormat is the standard built-in constructor defined in\n // 11.1.3.\n var nf2 = new Intl.NumberFormat([locale], { minimumIntegerDigits: 2, useGrouping: false });\n\n // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined\n // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,\n // and the value of the [[timeZone]] internal property of dateTimeFormat.\n var tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);\n\n // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.\n var pattern = internal['[[pattern]]'];\n\n // 7.\n var result = new List();\n\n // 8.\n var index = 0;\n\n // 9.\n var beginIndex = pattern.indexOf('{');\n\n // 10.\n var endIndex = 0;\n\n // Need the locale minus any extensions\n var dataLocale = internal['[[dataLocale]]'];\n\n // Need the calendar data from CLDR\n var localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;\n var ca = internal['[[calendar]]'];\n\n // 11.\n while (beginIndex !== -1) {\n var fv = void 0;\n // a.\n endIndex = pattern.indexOf('}', beginIndex);\n // b.\n if (endIndex === -1) {\n throw new Error('Unclosed pattern');\n }\n // c.\n if (beginIndex > index) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(index, beginIndex)\n });\n }\n // d.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // e.\n if (dateTimeComponents.hasOwnProperty(p)) {\n // i. Let f be the value of the [[

]] internal property of dateTimeFormat.\n var f = internal['[[' + p + ']]'];\n // ii. Let v be the value of tm.[[

]].\n var v = tm['[[' + p + ']]'];\n // iii. If p is \"year\" and v ≤ 0, then let v be 1 - v.\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n // iv. If p is \"month\", then increase v by 1.\n else if (p === 'month') {\n v++;\n }\n // v. If p is \"hour\" and the value of the [[hour12]] internal property of\n // dateTimeFormat is true, then\n else if (p === 'hour' && internal['[[hour12]]'] === true) {\n // 1. Let v be v modulo 12.\n v = v % 12;\n // 2. If v is 0 and the value of the [[hourNo0]] internal property of\n // dateTimeFormat is true, then let v be 12.\n if (v === 0 && internal['[[hourNo0]]'] === true) {\n v = 12;\n }\n }\n\n // vi. If f is \"numeric\", then\n if (f === 'numeric') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments nf and v.\n fv = FormatNumber(nf, v);\n }\n // vii. Else if f is \"2-digit\", then\n else if (f === '2-digit') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // with arguments nf2 and v.\n fv = FormatNumber(nf2, v);\n // 2. If the length of fv is greater than 2, let fv be the substring of fv\n // containing the last two characters.\n if (fv.length > 2) {\n fv = fv.slice(-2);\n }\n }\n // viii. Else if f is \"narrow\", \"short\", or \"long\", then let fv be a String\n // value representing f in the desired form; the String value depends upon\n // the implementation and the effective locale and calendar of\n // dateTimeFormat. If p is \"month\", then the String value may also depend\n // on whether dateTimeFormat has a [[day]] internal property. If p is\n // \"timeZoneName\", then the String value may also depend on the value of\n // the [[inDST]] field of tm.\n else if (f in dateWidths) {\n switch (p) {\n case 'month':\n fv = resolveDateString(localeData, ca, 'months', f, tm['[[' + p + ']]']);\n break;\n\n case 'weekday':\n try {\n fv = resolveDateString(localeData, ca, 'days', f, tm['[[' + p + ']]']);\n // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];\n } catch (e) {\n throw new Error('Could not find weekday data for locale ' + locale);\n }\n break;\n\n case 'timeZoneName':\n fv = ''; // ###TODO\n break;\n\n case 'era':\n try {\n fv = resolveDateString(localeData, ca, 'eras', f, tm['[[' + p + ']]']);\n } catch (e) {\n throw new Error('Could not find era data for locale ' + locale);\n }\n break;\n\n default:\n fv = tm['[[' + p + ']]'];\n }\n }\n // ix\n arrPush.call(result, {\n type: p,\n value: fv\n });\n // f.\n } else if (p === 'ampm') {\n // i.\n var _v = tm['[[hour]]'];\n // ii./iii.\n fv = resolveDateString(localeData, ca, 'dayPeriods', _v > 11 ? 'pm' : 'am', null);\n // iv.\n arrPush.call(result, {\n type: 'dayPeriod',\n value: fv\n });\n // g.\n } else {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(beginIndex, endIndex + 1)\n });\n }\n // h.\n index = endIndex + 1;\n // i.\n beginIndex = pattern.indexOf('{', index);\n }\n // 12.\n if (endIndex < pattern.length - 1) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substr(endIndex + 1)\n });\n }\n // 13.\n return result;\n}\n\n/**\n * When the FormatDateTime abstract operation is called with arguments dateTimeFormat\n * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number\n * value), it returns a String value representing x (interpreted as a time value as\n * specified in ES5, 15.9.1.1) according to the effective locale and the formatting\n * options of dateTimeFormat.\n */\nfunction FormatDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = '';\n\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result += part.value;\n }\n return result;\n}\n\nfunction FormatToPartsDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = [];\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result.push({\n type: part.type,\n value: part.value\n });\n }\n return result;\n}\n\n/**\n * When the ToLocalTime abstract operation is called with arguments date, calendar, and\n * timeZone, the following steps are taken:\n */\nfunction ToLocalTime(date, calendar, timeZone) {\n // 1. Apply calendrical calculations on date for the given calendar and time zone to\n // produce weekday, era, year, month, day, hour, minute, second, and inDST values.\n // The calculations should use best available information about the specified\n // calendar and time zone. If the calendar is \"gregory\", then the calculations must\n // match the algorithms specified in ES5, 15.9.1, except that calculations are not\n // bound by the restrictions on the use of best available information on time zones\n // for local time zone adjustment and daylight saving time adjustment imposed by\n // ES5, 15.9.1.7 and 15.9.1.8.\n // ###TODO###\n var d = new Date(date),\n m = 'get' + (timeZone || '');\n\n // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],\n // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding\n // calculated value.\n return new Record({\n '[[weekday]]': d[m + 'Day'](),\n '[[era]]': +(d[m + 'FullYear']() >= 0),\n '[[year]]': d[m + 'FullYear'](),\n '[[month]]': d[m + 'Month'](),\n '[[day]]': d[m + 'Date'](),\n '[[hour]]': d[m + 'Hours'](),\n '[[minute]]': d[m + 'Minutes'](),\n '[[second]]': d[m + 'Seconds'](),\n '[[inDST]]': false // ###TODO###\n });\n}\n\n/**\n * The function returns a new object whose properties and attributes are set as if\n * constructed by an object literal assigning to each of the following properties the\n * value of the corresponding internal property of this DateTimeFormat object (see 12.4):\n * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,\n * hour, minute, second, and timeZoneName. Properties whose corresponding internal\n * properties are not present are not assigned.\n */\n/* 12.3.3 */defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {\n writable: true,\n configurable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\nvar ls = Intl.__localeSensitiveProtos = {\n Number: {},\n Date: {}\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.2.1 */ls.Number.toLocaleString = function () {\n // Satisfy test 13.2.1_1\n if (Object.prototype.toString.call(this) !== '[object Number]') throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');\n\n // 1. Let x be this Number value (as defined in ES5, 15.7.4).\n // 2. If locales is not provided, then let locales be undefined.\n // 3. If options is not provided, then let options be undefined.\n // 4. Let numberFormat be the result of creating a new object as if by the\n // expression new Intl.NumberFormat(locales, options) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n // 5. Return the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments numberFormat and x.\n return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.3.1 */ls.Date.toLocaleString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"any\", and \"all\".\n options = ToDateTimeOptions(options, 'any', 'all');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleDateString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.2 */ls.Date.toLocaleDateString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0],\n\n\n // 4. If options is not provided, then let options be undefined.\n options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"date\", and \"date\".\n options = ToDateTimeOptions(options, 'date', 'date');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleTimeString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.3 */ls.Date.toLocaleTimeString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"time\", and \"time\".\n options = ToDateTimeOptions(options, 'time', 'time');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\ndefineProperty(Intl, '__applyLocaleSensitivePrototypes', {\n writable: true,\n configurable: true,\n value: function value() {\n defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });\n // Need this here for IE 8, to avoid the _DontEnum_ bug\n defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });\n\n for (var k in ls.Date) {\n if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });\n }\n }\n});\n\n/**\n * Can't really ship a single script with data for hundreds of locales, so we provide\n * this __addLocaleData method as a means for the developer to add the data on an\n * as-needed basis\n */\ndefineProperty(Intl, '__addLocaleData', {\n value: function value(data) {\n if (!IsStructurallyValidLanguageTag(data.locale)) throw new Error(\"Object passed doesn't identify itself with a valid language tag\");\n\n addLocaleData(data, data.locale);\n }\n});\n\nfunction addLocaleData(data, tag) {\n // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present\n if (!data.number) throw new Error(\"Object passed doesn't contain locale data for Intl.NumberFormat\");\n\n var locale = void 0,\n locales = [tag],\n parts = tag.split('-');\n\n // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc\n if (parts.length > 2 && parts[1].length === 4) arrPush.call(locales, parts[0] + '-' + parts[2]);\n\n while (locale = arrShift.call(locales)) {\n // Add to NumberFormat internal properties as per 11.2.3\n arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);\n internals.NumberFormat['[[localeData]]'][locale] = data.number;\n\n // ...and DateTimeFormat internal properties as per 12.2.3\n if (data.date) {\n data.date.nu = data.number.nu;\n arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);\n internals.DateTimeFormat['[[localeData]]'][locale] = data.date;\n }\n }\n\n // If this is the first set of locale data added, make it the default\n if (defaultLocale === undefined) setDefaultLocale(tag);\n}\n\ndefineProperty(Intl, '__disableRegExpRestore', {\n value: function value() {\n internals.disableRegExpRestore = true;\n }\n});\n\nmodule.exports = Intl;","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).filter(Boolean).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","// Console-polyfill. MIT license.\n// https://github.com/paulmillr/console-polyfill\n// Make it safe to do console.log() always.\n(function(global) {\n 'use strict';\n if (!global.console) {\n global.console = {};\n }\n var con = global.console;\n var prop, method;\n var dummy = function() {};\n var properties = ['memory'];\n var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = {};\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n // Using `this` for web workers & supports Browserify / Webpack.\n})(typeof window === 'undefined' ? this : window);\n","import ReactDOM from 'react-dom';\nexport var unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates;","import { notifyManager } from '../core';\nimport { unstable_batchedUpdates } from './reactBatchedUpdates';\nnotifyManager.setBatchNotifyFunction(unstable_batchedUpdates);","export var logger = console;","import { setLogger } from '../core';\nimport { logger } from './logger';\nsetLogger(logger);","import React from 'react';\nvar defaultContext = /*#__PURE__*/React.createContext(undefined);\nvar QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\n\nfunction getQueryClientContext(contextSharing) {\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext;\n }\n\n return window.ReactQueryClientContext;\n }\n\n return defaultContext;\n}\n\nexport var useQueryClient = function useQueryClient() {\n var queryClient = React.useContext(getQueryClientContext(React.useContext(QueryClientSharingContext)));\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one');\n }\n\n return queryClient;\n};\nexport var QueryClientProvider = function QueryClientProvider(_ref) {\n var client = _ref.client,\n _ref$contextSharing = _ref.contextSharing,\n contextSharing = _ref$contextSharing === void 0 ? false : _ref$contextSharing,\n children = _ref.children;\n React.useEffect(function () {\n client.mount();\n return function () {\n client.unmount();\n };\n }, [client]);\n var Context = getQueryClientContext(contextSharing);\n return /*#__PURE__*/React.createElement(QueryClientSharingContext.Provider, {\n value: contextSharing\n }, /*#__PURE__*/React.createElement(Context.Provider, {\n value: client\n }, children));\n};","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { getDefaultState } from './mutation';\nimport { notifyManager } from './notifyManager';\nimport { Subscribable } from './subscribable';\n// CLASS\nexport var MutationObserver = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(MutationObserver, _Subscribable);\n\n function MutationObserver(client, options) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.client = client;\n\n _this.setOptions(options);\n\n _this.bindMethods();\n\n _this.updateResult();\n\n return _this;\n }\n\n var _proto = MutationObserver.prototype;\n\n _proto.bindMethods = function bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n };\n\n _proto.setOptions = function setOptions(options) {\n this.options = this.client.defaultMutationOptions(options);\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.listeners.length) {\n var _this$currentMutation;\n\n (_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.removeObserver(this);\n }\n };\n\n _proto.onMutationUpdate = function onMutationUpdate(action) {\n this.updateResult(); // Determine which callbacks to trigger\n\n var notifyOptions = {\n listeners: true\n };\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error') {\n notifyOptions.onError = true;\n }\n\n this.notify(notifyOptions);\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n };\n\n _proto.reset = function reset() {\n this.currentMutation = undefined;\n this.updateResult();\n this.notify({\n listeners: true\n });\n };\n\n _proto.mutate = function mutate(variables, options) {\n this.mutateOptions = options;\n\n if (this.currentMutation) {\n this.currentMutation.removeObserver(this);\n }\n\n this.currentMutation = this.client.getMutationCache().build(this.client, _extends({}, this.options, {\n variables: typeof variables !== 'undefined' ? variables : this.options.variables\n }));\n this.currentMutation.addObserver(this);\n return this.currentMutation.execute();\n };\n\n _proto.updateResult = function updateResult() {\n var state = this.currentMutation ? this.currentMutation.state : getDefaultState();\n\n var result = _extends({}, state, {\n isLoading: state.status === 'loading',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset\n });\n\n this.currentResult = result;\n };\n\n _proto.notify = function notify(options) {\n var _this2 = this;\n\n notifyManager.batch(function () {\n // First trigger the mutate callbacks\n if (_this2.mutateOptions) {\n if (options.onSuccess) {\n _this2.mutateOptions.onSuccess == null ? void 0 : _this2.mutateOptions.onSuccess(_this2.currentResult.data, _this2.currentResult.variables, _this2.currentResult.context);\n _this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(_this2.currentResult.data, null, _this2.currentResult.variables, _this2.currentResult.context);\n } else if (options.onError) {\n _this2.mutateOptions.onError == null ? void 0 : _this2.mutateOptions.onError(_this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);\n _this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(undefined, _this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);\n }\n } // Then trigger the listeners\n\n\n if (options.listeners) {\n _this2.listeners.forEach(function (listener) {\n listener(_this2.currentResult);\n });\n }\n });\n };\n\n return MutationObserver;\n}(Subscribable);","export function shouldThrowError(suspense, _useErrorBoundary, params) {\n // Allow useErrorBoundary function to override throwing behavior on a per-error basis\n if (typeof _useErrorBoundary === 'function') {\n return _useErrorBoundary.apply(void 0, params);\n } // Allow useErrorBoundary to override suspense's throwing behavior\n\n\n if (typeof _useErrorBoundary === 'boolean') return _useErrorBoundary; // If suspense is enabled default to throwing errors\n\n return !!suspense;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { noop, parseMutationArgs } from '../core/utils';\nimport { MutationObserver } from '../core/mutationObserver';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils'; // HOOK\n\nexport function useMutation(arg1, arg2, arg3) {\n var mountedRef = React.useRef(false);\n\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n\n var options = parseMutationArgs(arg1, arg2, arg3);\n var queryClient = useQueryClient();\n var obsRef = React.useRef();\n\n if (!obsRef.current) {\n obsRef.current = new MutationObserver(queryClient, options);\n } else {\n obsRef.current.setOptions(options);\n }\n\n var currentResult = obsRef.current.getCurrentResult();\n React.useEffect(function () {\n mountedRef.current = true;\n var unsubscribe = obsRef.current.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n }));\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, []);\n var mutate = React.useCallback(function (variables, mutateOptions) {\n obsRef.current.mutate(variables, mutateOptions).catch(noop);\n }, []);\n\n if (currentResult.error && shouldThrowError(undefined, obsRef.current.options.useErrorBoundary, [currentResult.error])) {\n throw currentResult.error;\n }\n\n return _extends({}, currentResult, {\n mutate: mutate,\n mutateAsync: currentResult.mutate\n });\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { isServer, isValidTimeout, noop, replaceEqualDeep, shallowEqualObjects, timeUntilStale } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { focusManager } from './focusManager';\nimport { Subscribable } from './subscribable';\nimport { getLogger } from './logger';\nimport { isCancelledError } from './retryer';\nexport var QueryObserver = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(QueryObserver, _Subscribable);\n\n function QueryObserver(client, options) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.client = client;\n _this.options = options;\n _this.trackedProps = [];\n _this.previousSelectError = null;\n\n _this.bindMethods();\n\n _this.setOptions(options);\n\n return _this;\n }\n\n var _proto = QueryObserver.prototype;\n\n _proto.bindMethods = function bindMethods() {\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n };\n\n _proto.onSubscribe = function onSubscribe() {\n if (this.listeners.length === 1) {\n this.currentQuery.addObserver(this);\n\n if (shouldFetchOnMount(this.currentQuery, this.options)) {\n this.executeFetch();\n }\n\n this.updateTimers();\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.listeners.length) {\n this.destroy();\n }\n };\n\n _proto.shouldFetchOnReconnect = function shouldFetchOnReconnect() {\n return _shouldFetchOnReconnect(this.currentQuery, this.options);\n };\n\n _proto.shouldFetchOnWindowFocus = function shouldFetchOnWindowFocus() {\n return _shouldFetchOnWindowFocus(this.currentQuery, this.options);\n };\n\n _proto.destroy = function destroy() {\n this.listeners = [];\n this.clearTimers();\n this.currentQuery.removeObserver(this);\n };\n\n _proto.setOptions = function setOptions(options, notifyOptions) {\n var prevOptions = this.options;\n var prevQuery = this.currentQuery;\n this.options = this.client.defaultQueryObserverOptions(options);\n\n if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {\n throw new Error('Expected enabled to be a boolean');\n } // Keep previous query key if the user does not supply one\n\n\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey;\n }\n\n this.updateQuery();\n var mounted = this.hasListeners(); // Fetch if there are subscribers\n\n if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {\n this.executeFetch();\n } // Update result\n\n\n this.updateResult(notifyOptions); // Update stale interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {\n this.updateStaleTimeout();\n }\n\n var nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {\n this.updateRefetchInterval(nextRefetchInterval);\n }\n };\n\n _proto.getOptimisticResult = function getOptimisticResult(options) {\n var defaultedOptions = this.client.defaultQueryObserverOptions(options);\n var query = this.client.getQueryCache().build(this.client, defaultedOptions);\n return this.createResult(query, defaultedOptions);\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n };\n\n _proto.trackResult = function trackResult(result, defaultedOptions) {\n var _this2 = this;\n\n var trackedResult = {};\n\n var trackProp = function trackProp(key) {\n if (!_this2.trackedProps.includes(key)) {\n _this2.trackedProps.push(key);\n }\n };\n\n Object.keys(result).forEach(function (key) {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: function get() {\n trackProp(key);\n return result[key];\n }\n });\n });\n\n if (defaultedOptions.useErrorBoundary || defaultedOptions.suspense) {\n trackProp('error');\n }\n\n return trackedResult;\n };\n\n _proto.getNextResult = function getNextResult(options) {\n var _this3 = this;\n\n return new Promise(function (resolve, reject) {\n var unsubscribe = _this3.subscribe(function (result) {\n if (!result.isFetching) {\n unsubscribe();\n\n if (result.isError && (options == null ? void 0 : options.throwOnError)) {\n reject(result.error);\n } else {\n resolve(result);\n }\n }\n });\n });\n };\n\n _proto.getCurrentQuery = function getCurrentQuery() {\n return this.currentQuery;\n };\n\n _proto.remove = function remove() {\n this.client.getQueryCache().remove(this.currentQuery);\n };\n\n _proto.refetch = function refetch(options) {\n return this.fetch(_extends({}, options, {\n meta: {\n refetchPage: options == null ? void 0 : options.refetchPage\n }\n }));\n };\n\n _proto.fetchOptimistic = function fetchOptimistic(options) {\n var _this4 = this;\n\n var defaultedOptions = this.client.defaultQueryObserverOptions(options);\n var query = this.client.getQueryCache().build(this.client, defaultedOptions);\n return query.fetch().then(function () {\n return _this4.createResult(query, defaultedOptions);\n });\n };\n\n _proto.fetch = function fetch(fetchOptions) {\n var _this5 = this;\n\n return this.executeFetch(fetchOptions).then(function () {\n _this5.updateResult();\n\n return _this5.currentResult;\n });\n };\n\n _proto.executeFetch = function executeFetch(fetchOptions) {\n // Make sure we reference the latest query as the current one might have been removed\n this.updateQuery(); // Fetch\n\n var promise = this.currentQuery.fetch(this.options, fetchOptions);\n\n if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n };\n\n _proto.updateStaleTimeout = function updateStaleTimeout() {\n var _this6 = this;\n\n this.clearStaleTimeout();\n\n if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {\n return;\n }\n\n var time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n\n var timeout = time + 1;\n this.staleTimeoutId = setTimeout(function () {\n if (!_this6.currentResult.isStale) {\n _this6.updateResult();\n }\n }, timeout);\n };\n\n _proto.computeRefetchInterval = function computeRefetchInterval() {\n var _this$options$refetch;\n\n return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;\n };\n\n _proto.updateRefetchInterval = function updateRefetchInterval(nextInterval) {\n var _this7 = this;\n\n this.clearRefetchInterval();\n this.currentRefetchInterval = nextInterval;\n\n if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {\n return;\n }\n\n this.refetchIntervalId = setInterval(function () {\n if (_this7.options.refetchIntervalInBackground || focusManager.isFocused()) {\n _this7.executeFetch();\n }\n }, this.currentRefetchInterval);\n };\n\n _proto.updateTimers = function updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval(this.computeRefetchInterval());\n };\n\n _proto.clearTimers = function clearTimers() {\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n };\n\n _proto.clearStaleTimeout = function clearStaleTimeout() {\n clearTimeout(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n };\n\n _proto.clearRefetchInterval = function clearRefetchInterval() {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n };\n\n _proto.createResult = function createResult(query, options) {\n var prevQuery = this.currentQuery;\n var prevOptions = this.options;\n var prevResult = this.currentResult;\n var prevResultState = this.currentResultState;\n var prevResultOptions = this.currentResultOptions;\n var queryChange = query !== prevQuery;\n var queryInitialState = queryChange ? query.state : this.currentQueryInitialState;\n var prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;\n var state = query.state;\n var dataUpdatedAt = state.dataUpdatedAt,\n error = state.error,\n errorUpdatedAt = state.errorUpdatedAt,\n isFetching = state.isFetching,\n status = state.status;\n var isPreviousData = false;\n var isPlaceholderData = false;\n var data; // Optimistically set result in fetching state if needed\n\n if (options.optimisticResults) {\n var mounted = this.hasListeners();\n var fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n var fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\n if (fetchOnMount || fetchOptionally) {\n isFetching = true;\n\n if (!dataUpdatedAt) {\n status = 'loading';\n }\n }\n } // Keep previous data if needed\n\n\n if (options.keepPreviousData && !state.dataUpdateCount && (prevQueryResult == null ? void 0 : prevQueryResult.isSuccess) && status !== 'error') {\n data = prevQueryResult.data;\n dataUpdatedAt = prevQueryResult.dataUpdatedAt;\n status = prevQueryResult.status;\n isPreviousData = true;\n } // Select data if needed\n else if (options.select && typeof state.data !== 'undefined') {\n var _this$previousSelect;\n\n // Memoize select result\n if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === ((_this$previousSelect = this.previousSelect) == null ? void 0 : _this$previousSelect.fn) && !this.previousSelectError) {\n data = this.previousSelect.result;\n } else {\n try {\n data = options.select(state.data);\n\n if (options.structuralSharing !== false) {\n data = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, data);\n }\n\n this.previousSelect = {\n fn: options.select,\n result: data\n };\n this.previousSelectError = null;\n } catch (selectError) {\n getLogger().error(selectError);\n error = selectError;\n this.previousSelectError = selectError;\n errorUpdatedAt = Date.now();\n status = 'error';\n }\n }\n } // Use query data\n else {\n data = state.data;\n } // Show placeholder data if needed\n\n\n if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && (status === 'loading' || status === 'idle')) {\n var placeholderData; // Memoize placeholder data\n\n if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {\n placeholderData = prevResult.data;\n } else {\n placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;\n\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData);\n\n if (options.structuralSharing !== false) {\n placeholderData = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, placeholderData);\n }\n\n this.previousSelectError = null;\n } catch (selectError) {\n getLogger().error(selectError);\n error = selectError;\n this.previousSelectError = selectError;\n errorUpdatedAt = Date.now();\n status = 'error';\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success';\n data = placeholderData;\n isPlaceholderData = true;\n }\n }\n\n var result = {\n status: status,\n isLoading: status === 'loading',\n isSuccess: status === 'success',\n isError: status === 'error',\n isIdle: status === 'idle',\n data: data,\n dataUpdatedAt: dataUpdatedAt,\n error: error,\n errorUpdatedAt: errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching: isFetching,\n isRefetching: isFetching && status !== 'loading',\n isLoadingError: status === 'error' && state.dataUpdatedAt === 0,\n isPlaceholderData: isPlaceholderData,\n isPreviousData: isPreviousData,\n isRefetchError: status === 'error' && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n remove: this.remove\n };\n return result;\n };\n\n _proto.shouldNotifyListeners = function shouldNotifyListeners(result, prevResult) {\n if (!prevResult) {\n return true;\n }\n\n var _this$options = this.options,\n notifyOnChangeProps = _this$options.notifyOnChangeProps,\n notifyOnChangePropsExclusions = _this$options.notifyOnChangePropsExclusions;\n\n if (!notifyOnChangeProps && !notifyOnChangePropsExclusions) {\n return true;\n }\n\n if (notifyOnChangeProps === 'tracked' && !this.trackedProps.length) {\n return true;\n }\n\n var includedProps = notifyOnChangeProps === 'tracked' ? this.trackedProps : notifyOnChangeProps;\n return Object.keys(result).some(function (key) {\n var typedKey = key;\n var changed = result[typedKey] !== prevResult[typedKey];\n var isIncluded = includedProps == null ? void 0 : includedProps.some(function (x) {\n return x === key;\n });\n var isExcluded = notifyOnChangePropsExclusions == null ? void 0 : notifyOnChangePropsExclusions.some(function (x) {\n return x === key;\n });\n return changed && !isExcluded && (!includedProps || isIncluded);\n });\n };\n\n _proto.updateResult = function updateResult(notifyOptions) {\n var prevResult = this.currentResult;\n this.currentResult = this.createResult(this.currentQuery, this.options);\n this.currentResultState = this.currentQuery.state;\n this.currentResultOptions = this.options; // Only notify if something has changed\n\n if (shallowEqualObjects(this.currentResult, prevResult)) {\n return;\n } // Determine which callbacks to trigger\n\n\n var defaultNotifyOptions = {\n cache: true\n };\n\n if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && this.shouldNotifyListeners(this.currentResult, prevResult)) {\n defaultNotifyOptions.listeners = true;\n }\n\n this.notify(_extends({}, defaultNotifyOptions, notifyOptions));\n };\n\n _proto.updateQuery = function updateQuery() {\n var query = this.client.getQueryCache().build(this.client, this.options);\n\n if (query === this.currentQuery) {\n return;\n }\n\n var prevQuery = this.currentQuery;\n this.currentQuery = query;\n this.currentQueryInitialState = query.state;\n this.previousQueryResult = this.currentResult;\n\n if (this.hasListeners()) {\n prevQuery == null ? void 0 : prevQuery.removeObserver(this);\n query.addObserver(this);\n }\n };\n\n _proto.onQueryUpdate = function onQueryUpdate(action) {\n var notifyOptions = {};\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error' && !isCancelledError(action.error)) {\n notifyOptions.onError = true;\n }\n\n this.updateResult(notifyOptions);\n\n if (this.hasListeners()) {\n this.updateTimers();\n }\n };\n\n _proto.notify = function notify(notifyOptions) {\n var _this8 = this;\n\n notifyManager.batch(function () {\n // First trigger the configuration callbacks\n if (notifyOptions.onSuccess) {\n _this8.options.onSuccess == null ? void 0 : _this8.options.onSuccess(_this8.currentResult.data);\n _this8.options.onSettled == null ? void 0 : _this8.options.onSettled(_this8.currentResult.data, null);\n } else if (notifyOptions.onError) {\n _this8.options.onError == null ? void 0 : _this8.options.onError(_this8.currentResult.error);\n _this8.options.onSettled == null ? void 0 : _this8.options.onSettled(undefined, _this8.currentResult.error);\n } // Then trigger the listeners\n\n\n if (notifyOptions.listeners) {\n _this8.listeners.forEach(function (listener) {\n listener(_this8.currentResult);\n });\n } // Then the cache listeners\n\n\n if (notifyOptions.cache) {\n _this8.client.getQueryCache().notify({\n query: _this8.currentQuery,\n type: 'observerResultsUpdated'\n });\n }\n });\n };\n\n return QueryObserver;\n}(Subscribable);\n\nfunction shouldLoadOnMount(query, options) {\n return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);\n}\n\nfunction shouldRefetchOnMount(query, options) {\n return options.enabled !== false && query.state.dataUpdatedAt > 0 && (options.refetchOnMount === 'always' || options.refetchOnMount !== false && isStale(query, options));\n}\n\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || shouldRefetchOnMount(query, options);\n}\n\nfunction _shouldFetchOnReconnect(query, options) {\n return options.enabled !== false && (options.refetchOnReconnect === 'always' || options.refetchOnReconnect !== false && isStale(query, options));\n}\n\nfunction _shouldFetchOnWindowFocus(query, options) {\n return options.enabled !== false && (options.refetchOnWindowFocus === 'always' || options.refetchOnWindowFocus !== false && isStale(query, options));\n}\n\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);\n}\n\nfunction isStale(query, options) {\n return query.isStaleByTime(options.staleTime);\n}","import React from 'react'; // CONTEXT\n\nfunction createValue() {\n var _isReset = false;\n return {\n clearReset: function clearReset() {\n _isReset = false;\n },\n reset: function reset() {\n _isReset = true;\n },\n isReset: function isReset() {\n return _isReset;\n }\n };\n}\n\nvar QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue()); // HOOK\n\nexport var useQueryErrorResetBoundary = function useQueryErrorResetBoundary() {\n return React.useContext(QueryErrorResetBoundaryContext);\n}; // COMPONENT\n\nexport var QueryErrorResetBoundary = function QueryErrorResetBoundary(_ref) {\n var children = _ref.children;\n var value = React.useMemo(function () {\n return createValue();\n }, []);\n return /*#__PURE__*/React.createElement(QueryErrorResetBoundaryContext.Provider, {\n value: value\n }, typeof children === 'function' ? children(value) : children);\n};","import { QueryObserver } from '../core';\nimport { parseQueryArgs } from '../core/utils';\nimport { useBaseQuery } from './useBaseQuery'; // HOOK\n\nexport function useQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n return useBaseQuery(parsedOptions, QueryObserver);\n}","import React from 'react';\nimport { notifyManager } from '../core/notifyManager';\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary';\nimport { useQueryClient } from './QueryClientProvider';\nimport { shouldThrowError } from './utils';\nexport function useBaseQuery(options, Observer) {\n var mountedRef = React.useRef(false);\n\n var _React$useState = React.useState(0),\n forceUpdate = _React$useState[1];\n\n var queryClient = useQueryClient();\n var errorResetBoundary = useQueryErrorResetBoundary();\n var defaultedOptions = queryClient.defaultQueryObserverOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options\n\n defaultedOptions.optimisticResults = true; // Include callbacks in batch renders\n\n if (defaultedOptions.onError) {\n defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);\n }\n\n if (defaultedOptions.onSuccess) {\n defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);\n }\n\n if (defaultedOptions.onSettled) {\n defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);\n }\n\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000;\n } // Set cache time to 1 if the option has been set to 0\n // when using suspense to prevent infinite loop of fetches\n\n\n if (defaultedOptions.cacheTime === 0) {\n defaultedOptions.cacheTime = 1;\n }\n }\n\n if (defaultedOptions.suspense || defaultedOptions.useErrorBoundary) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n defaultedOptions.retryOnMount = false;\n }\n }\n\n var _React$useState2 = React.useState(function () {\n return new Observer(queryClient, defaultedOptions);\n }),\n observer = _React$useState2[0];\n\n var result = observer.getOptimisticResult(defaultedOptions);\n React.useEffect(function () {\n mountedRef.current = true;\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe(notifyManager.batchCalls(function () {\n if (mountedRef.current) {\n forceUpdate(function (x) {\n return x + 1;\n });\n }\n })); // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n\n observer.updateResult();\n return function () {\n mountedRef.current = false;\n unsubscribe();\n };\n }, [errorResetBoundary, observer]);\n React.useEffect(function () {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, {\n listeners: false\n });\n }, [defaultedOptions, observer]); // Handle suspense\n\n if (defaultedOptions.suspense && result.isLoading) {\n throw observer.fetchOptimistic(defaultedOptions).then(function (_ref) {\n var data = _ref.data;\n defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);\n }).catch(function (error) {\n errorResetBoundary.clearReset();\n defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);\n });\n } // Handle error boundary\n\n\n if (result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(defaultedOptions.suspense, defaultedOptions.useErrorBoundary, [result.error, observer.getCurrentQuery()])) {\n throw result.error;\n } // Handle result property usage tracking\n\n\n if (defaultedOptions.notifyOnChangeProps === 'tracked') {\n result = observer.trackResult(result, defaultedOptions);\n }\n\n return result;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getAbortController, functionalUpdate, isValidTimeout, noop, replaceEqualDeep, timeUntilStale, ensureQueryKeyArray } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { getLogger } from './logger';\nimport { Retryer, isCancelledError } from './retryer'; // TYPES\n\n// CLASS\nexport var Query = /*#__PURE__*/function () {\n function Query(config) {\n this.abortSignalConsumed = false;\n this.hadObservers = false;\n this.defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.cache = config.cache;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.initialState = config.state || this.getDefaultState(this.options);\n this.state = this.initialState;\n this.meta = config.meta;\n this.scheduleGc();\n }\n\n var _proto = Query.prototype;\n\n _proto.setOptions = function setOptions(options) {\n var _this$options$cacheTi;\n\n this.options = _extends({}, this.defaultOptions, options);\n this.meta = options == null ? void 0 : options.meta; // Default to 5 minutes if not cache time is set\n\n this.cacheTime = Math.max(this.cacheTime || 0, (_this$options$cacheTi = this.options.cacheTime) != null ? _this$options$cacheTi : 5 * 60 * 1000);\n };\n\n _proto.setDefaultOptions = function setDefaultOptions(options) {\n this.defaultOptions = options;\n };\n\n _proto.scheduleGc = function scheduleGc() {\n var _this = this;\n\n this.clearGcTimeout();\n\n if (isValidTimeout(this.cacheTime)) {\n this.gcTimeout = setTimeout(function () {\n _this.optionalRemove();\n }, this.cacheTime);\n }\n };\n\n _proto.clearGcTimeout = function clearGcTimeout() {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n };\n\n _proto.optionalRemove = function optionalRemove() {\n if (!this.observers.length) {\n if (this.state.isFetching) {\n if (this.hadObservers) {\n this.scheduleGc();\n }\n } else {\n this.cache.remove(this);\n }\n }\n };\n\n _proto.setData = function setData(updater, options) {\n var _this$options$isDataE, _this$options;\n\n var prevData = this.state.data; // Get the new data\n\n var data = functionalUpdate(updater, prevData); // Use prev data if an isDataEqual function is defined and returns `true`\n\n if ((_this$options$isDataE = (_this$options = this.options).isDataEqual) == null ? void 0 : _this$options$isDataE.call(_this$options, prevData, data)) {\n data = prevData;\n } else if (this.options.structuralSharing !== false) {\n // Structurally share data between prev and new data if needed\n data = replaceEqualDeep(prevData, data);\n } // Set data and mark it as cached\n\n\n this.dispatch({\n data: data,\n type: 'success',\n dataUpdatedAt: options == null ? void 0 : options.updatedAt\n });\n return data;\n };\n\n _proto.setState = function setState(state, setStateOptions) {\n this.dispatch({\n type: 'setState',\n state: state,\n setStateOptions: setStateOptions\n });\n };\n\n _proto.cancel = function cancel(options) {\n var _this$retryer;\n\n var promise = this.promise;\n (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n };\n\n _proto.destroy = function destroy() {\n this.clearGcTimeout();\n this.cancel({\n silent: true\n });\n };\n\n _proto.reset = function reset() {\n this.destroy();\n this.setState(this.initialState);\n };\n\n _proto.isActive = function isActive() {\n return this.observers.some(function (observer) {\n return observer.options.enabled !== false;\n });\n };\n\n _proto.isFetching = function isFetching() {\n return this.state.isFetching;\n };\n\n _proto.isStale = function isStale() {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(function (observer) {\n return observer.getCurrentResult().isStale;\n });\n };\n\n _proto.isStaleByTime = function isStaleByTime(staleTime) {\n if (staleTime === void 0) {\n staleTime = 0;\n }\n\n return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n };\n\n _proto.onFocus = function onFocus() {\n var _this$retryer2;\n\n var observer = this.observers.find(function (x) {\n return x.shouldFetchOnWindowFocus();\n });\n\n if (observer) {\n observer.refetch();\n } // Continue fetch if currently paused\n\n\n (_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();\n };\n\n _proto.onOnline = function onOnline() {\n var _this$retryer3;\n\n var observer = this.observers.find(function (x) {\n return x.shouldFetchOnReconnect();\n });\n\n if (observer) {\n observer.refetch();\n } // Continue fetch if currently paused\n\n\n (_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();\n };\n\n _proto.addObserver = function addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer);\n this.hadObservers = true; // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n this.cache.notify({\n type: 'observerAdded',\n query: this,\n observer: observer\n });\n }\n };\n\n _proto.removeObserver = function removeObserver(observer) {\n if (this.observers.indexOf(observer) !== -1) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.retryer) {\n if (this.retryer.isTransportCancelable || this.abortSignalConsumed) {\n this.retryer.cancel({\n revert: true\n });\n } else {\n this.retryer.cancelRetry();\n }\n }\n\n if (this.cacheTime) {\n this.scheduleGc();\n } else {\n this.cache.remove(this);\n }\n }\n\n this.cache.notify({\n type: 'observerRemoved',\n query: this,\n observer: observer\n });\n }\n };\n\n _proto.getObserversCount = function getObserversCount() {\n return this.observers.length;\n };\n\n _proto.invalidate = function invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: 'invalidate'\n });\n }\n };\n\n _proto.fetch = function fetch(options, fetchOptions) {\n var _this2 = this,\n _this$options$behavio,\n _context$fetchOptions,\n _abortController$abor;\n\n if (this.state.isFetching) {\n if (this.state.dataUpdatedAt && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {\n // Silently cancel current fetch if the user wants to cancel refetches\n this.cancel({\n silent: true\n });\n } else if (this.promise) {\n var _this$retryer4;\n\n // make sure that retries that were potentially cancelled due to unmounts can continue\n (_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching\n\n return this.promise;\n }\n } // Update config if passed, otherwise the config from the last execution is used\n\n\n if (options) {\n this.setOptions(options);\n } // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n\n\n if (!this.options.queryFn) {\n var observer = this.observers.find(function (x) {\n return x.options.queryFn;\n });\n\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n\n var queryKey = ensureQueryKeyArray(this.queryKey);\n var abortController = getAbortController(); // Create query function context\n\n var queryFnContext = {\n queryKey: queryKey,\n pageParam: undefined,\n meta: this.meta\n };\n Object.defineProperty(queryFnContext, 'signal', {\n enumerable: true,\n get: function get() {\n if (abortController) {\n _this2.abortSignalConsumed = true;\n return abortController.signal;\n }\n\n return undefined;\n }\n }); // Create fetch function\n\n var fetchFn = function fetchFn() {\n if (!_this2.options.queryFn) {\n return Promise.reject('Missing queryFn');\n }\n\n _this2.abortSignalConsumed = false;\n return _this2.options.queryFn(queryFnContext);\n }; // Trigger behavior hook\n\n\n var context = {\n fetchOptions: fetchOptions,\n options: this.options,\n queryKey: queryKey,\n state: this.state,\n fetchFn: fetchFn,\n meta: this.meta\n };\n\n if ((_this$options$behavio = this.options.behavior) == null ? void 0 : _this$options$behavio.onFetch) {\n var _this$options$behavio2;\n\n (_this$options$behavio2 = this.options.behavior) == null ? void 0 : _this$options$behavio2.onFetch(context);\n } // Store state in case the current fetch needs to be reverted\n\n\n this.revertState = this.state; // Set to fetching state if not already in it\n\n if (!this.state.isFetching || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {\n var _context$fetchOptions2;\n\n this.dispatch({\n type: 'fetch',\n meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta\n });\n } // Try to fetch the data\n\n\n this.retryer = new Retryer({\n fn: context.fetchFn,\n abort: abortController == null ? void 0 : (_abortController$abor = abortController.abort) == null ? void 0 : _abortController$abor.bind(abortController),\n onSuccess: function onSuccess(data) {\n _this2.setData(data); // Notify cache callback\n\n\n _this2.cache.config.onSuccess == null ? void 0 : _this2.cache.config.onSuccess(data, _this2); // Remove query after fetching if cache time is 0\n\n if (_this2.cacheTime === 0) {\n _this2.optionalRemove();\n }\n },\n onError: function onError(error) {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n _this2.dispatch({\n type: 'error',\n error: error\n });\n }\n\n if (!isCancelledError(error)) {\n // Notify cache callback\n _this2.cache.config.onError == null ? void 0 : _this2.cache.config.onError(error, _this2); // Log error\n\n getLogger().error(error);\n } // Remove query after fetching if cache time is 0\n\n\n if (_this2.cacheTime === 0) {\n _this2.optionalRemove();\n }\n },\n onFail: function onFail() {\n _this2.dispatch({\n type: 'failed'\n });\n },\n onPause: function onPause() {\n _this2.dispatch({\n type: 'pause'\n });\n },\n onContinue: function onContinue() {\n _this2.dispatch({\n type: 'continue'\n });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay\n });\n this.promise = this.retryer.promise;\n return this.promise;\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this3 = this;\n\n this.state = this.reducer(this.state, action);\n notifyManager.batch(function () {\n _this3.observers.forEach(function (observer) {\n observer.onQueryUpdate(action);\n });\n\n _this3.cache.notify({\n query: _this3,\n type: 'queryUpdated',\n action: action\n });\n });\n };\n\n _proto.getDefaultState = function getDefaultState(options) {\n var data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;\n var hasInitialData = typeof options.initialData !== 'undefined';\n var initialDataUpdatedAt = hasInitialData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n var hasData = typeof data !== 'undefined';\n return {\n data: data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchMeta: null,\n isFetching: false,\n isInvalidated: false,\n isPaused: false,\n status: hasData ? 'success' : 'idle'\n };\n };\n\n _proto.reducer = function reducer(state, action) {\n var _action$meta, _action$dataUpdatedAt;\n\n switch (action.type) {\n case 'failed':\n return _extends({}, state, {\n fetchFailureCount: state.fetchFailureCount + 1\n });\n\n case 'pause':\n return _extends({}, state, {\n isPaused: true\n });\n\n case 'continue':\n return _extends({}, state, {\n isPaused: false\n });\n\n case 'fetch':\n return _extends({}, state, {\n fetchFailureCount: 0,\n fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,\n isFetching: true,\n isPaused: false\n }, !state.dataUpdatedAt && {\n error: null,\n status: 'loading'\n });\n\n case 'success':\n return _extends({}, state, {\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),\n error: null,\n fetchFailureCount: 0,\n isFetching: false,\n isInvalidated: false,\n isPaused: false,\n status: 'success'\n });\n\n case 'error':\n var error = action.error;\n\n if (isCancelledError(error) && error.revert && this.revertState) {\n return _extends({}, this.revertState);\n }\n\n return _extends({}, state, {\n error: error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n isFetching: false,\n isPaused: false,\n status: 'error'\n });\n\n case 'invalidate':\n return _extends({}, state, {\n isInvalidated: true\n });\n\n case 'setState':\n return _extends({}, state, action.state);\n\n default:\n return state;\n }\n };\n\n return Query;\n}();","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { hashQueryKeyByOptions, matchQuery, parseFilterArgs } from './utils';\nimport { Query } from './query';\nimport { notifyManager } from './notifyManager';\nimport { Subscribable } from './subscribable';\n// CLASS\nexport var QueryCache = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(QueryCache, _Subscribable);\n\n function QueryCache(config) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.config = config || {};\n _this.queries = [];\n _this.queriesMap = {};\n return _this;\n }\n\n var _proto = QueryCache.prototype;\n\n _proto.build = function build(client, options, state) {\n var _options$queryHash;\n\n var queryKey = options.queryKey;\n var queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);\n var query = this.get(queryHash);\n\n if (!query) {\n query = new Query({\n cache: this,\n queryKey: queryKey,\n queryHash: queryHash,\n options: client.defaultQueryOptions(options),\n state: state,\n defaultOptions: client.getQueryDefaults(queryKey),\n meta: options.meta\n });\n this.add(query);\n }\n\n return query;\n };\n\n _proto.add = function add(query) {\n if (!this.queriesMap[query.queryHash]) {\n this.queriesMap[query.queryHash] = query;\n this.queries.push(query);\n this.notify({\n type: 'queryAdded',\n query: query\n });\n }\n };\n\n _proto.remove = function remove(query) {\n var queryInMap = this.queriesMap[query.queryHash];\n\n if (queryInMap) {\n query.destroy();\n this.queries = this.queries.filter(function (x) {\n return x !== query;\n });\n\n if (queryInMap === query) {\n delete this.queriesMap[query.queryHash];\n }\n\n this.notify({\n type: 'queryRemoved',\n query: query\n });\n }\n };\n\n _proto.clear = function clear() {\n var _this2 = this;\n\n notifyManager.batch(function () {\n _this2.queries.forEach(function (query) {\n _this2.remove(query);\n });\n });\n };\n\n _proto.get = function get(queryHash) {\n return this.queriesMap[queryHash];\n };\n\n _proto.getAll = function getAll() {\n return this.queries;\n };\n\n _proto.find = function find(arg1, arg2) {\n var _parseFilterArgs = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs[0];\n\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.queries.find(function (query) {\n return matchQuery(filters, query);\n });\n };\n\n _proto.findAll = function findAll(arg1, arg2) {\n var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs2[0];\n\n return Object.keys(filters).length > 0 ? this.queries.filter(function (query) {\n return matchQuery(filters, query);\n }) : this.queries;\n };\n\n _proto.notify = function notify(event) {\n var _this3 = this;\n\n notifyManager.batch(function () {\n _this3.listeners.forEach(function (listener) {\n listener(event);\n });\n });\n };\n\n _proto.onFocus = function onFocus() {\n var _this4 = this;\n\n notifyManager.batch(function () {\n _this4.queries.forEach(function (query) {\n query.onFocus();\n });\n });\n };\n\n _proto.onOnline = function onOnline() {\n var _this5 = this;\n\n notifyManager.batch(function () {\n _this5.queries.forEach(function (query) {\n query.onOnline();\n });\n });\n };\n\n return QueryCache;\n}(Subscribable);","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { notifyManager } from './notifyManager';\nimport { Mutation } from './mutation';\nimport { matchMutation, noop } from './utils';\nimport { Subscribable } from './subscribable'; // TYPES\n\n// CLASS\nexport var MutationCache = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(MutationCache, _Subscribable);\n\n function MutationCache(config) {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n _this.config = config || {};\n _this.mutations = [];\n _this.mutationId = 0;\n return _this;\n }\n\n var _proto = MutationCache.prototype;\n\n _proto.build = function build(client, options, state) {\n var mutation = new Mutation({\n mutationCache: this,\n mutationId: ++this.mutationId,\n options: client.defaultMutationOptions(options),\n state: state,\n defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined,\n meta: options.meta\n });\n this.add(mutation);\n return mutation;\n };\n\n _proto.add = function add(mutation) {\n this.mutations.push(mutation);\n this.notify(mutation);\n };\n\n _proto.remove = function remove(mutation) {\n this.mutations = this.mutations.filter(function (x) {\n return x !== mutation;\n });\n mutation.cancel();\n this.notify(mutation);\n };\n\n _proto.clear = function clear() {\n var _this2 = this;\n\n notifyManager.batch(function () {\n _this2.mutations.forEach(function (mutation) {\n _this2.remove(mutation);\n });\n });\n };\n\n _proto.getAll = function getAll() {\n return this.mutations;\n };\n\n _proto.find = function find(filters) {\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.mutations.find(function (mutation) {\n return matchMutation(filters, mutation);\n });\n };\n\n _proto.findAll = function findAll(filters) {\n return this.mutations.filter(function (mutation) {\n return matchMutation(filters, mutation);\n });\n };\n\n _proto.notify = function notify(mutation) {\n var _this3 = this;\n\n notifyManager.batch(function () {\n _this3.listeners.forEach(function (listener) {\n listener(mutation);\n });\n });\n };\n\n _proto.onFocus = function onFocus() {\n this.resumePausedMutations();\n };\n\n _proto.onOnline = function onOnline() {\n this.resumePausedMutations();\n };\n\n _proto.resumePausedMutations = function resumePausedMutations() {\n var pausedMutations = this.mutations.filter(function (x) {\n return x.state.isPaused;\n });\n return notifyManager.batch(function () {\n return pausedMutations.reduce(function (promise, mutation) {\n return promise.then(function () {\n return mutation.continue().catch(noop);\n });\n }, Promise.resolve());\n });\n };\n\n return MutationCache;\n}(Subscribable);","import { isCancelable } from './retryer';\nimport { getAbortController } from './utils';\nexport function infiniteQueryBehavior() {\n return {\n onFetch: function onFetch(context) {\n context.fetchFn = function () {\n var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;\n\n var refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;\n var fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;\n var pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;\n var isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';\n var isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';\n var oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];\n var oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];\n var abortController = getAbortController();\n var abortSignal = abortController == null ? void 0 : abortController.signal;\n var newPageParams = oldPageParams;\n var cancelled = false; // Get query function\n\n var queryFn = context.options.queryFn || function () {\n return Promise.reject('Missing queryFn');\n };\n\n var buildNewPages = function buildNewPages(pages, param, page, previous) {\n newPageParams = previous ? [param].concat(newPageParams) : [].concat(newPageParams, [param]);\n return previous ? [page].concat(pages) : [].concat(pages, [page]);\n }; // Create function to fetch a page\n\n\n var fetchPage = function fetchPage(pages, manual, param, previous) {\n if (cancelled) {\n return Promise.reject('Cancelled');\n }\n\n if (typeof param === 'undefined' && !manual && pages.length) {\n return Promise.resolve(pages);\n }\n\n var queryFnContext = {\n queryKey: context.queryKey,\n signal: abortSignal,\n pageParam: param,\n meta: context.meta\n };\n var queryFnResult = queryFn(queryFnContext);\n var promise = Promise.resolve(queryFnResult).then(function (page) {\n return buildNewPages(pages, param, page, previous);\n });\n\n if (isCancelable(queryFnResult)) {\n var promiseAsAny = promise;\n promiseAsAny.cancel = queryFnResult.cancel;\n }\n\n return promise;\n };\n\n var promise; // Fetch first page?\n\n if (!oldPages.length) {\n promise = fetchPage([]);\n } // Fetch next page?\n else if (isFetchingNextPage) {\n var manual = typeof pageParam !== 'undefined';\n var param = manual ? pageParam : getNextPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param);\n } // Fetch previous page?\n else if (isFetchingPreviousPage) {\n var _manual = typeof pageParam !== 'undefined';\n\n var _param = _manual ? pageParam : getPreviousPageParam(context.options, oldPages);\n\n promise = fetchPage(oldPages, _manual, _param, true);\n } // Refetch pages\n else {\n (function () {\n newPageParams = [];\n var manual = typeof context.options.getNextPageParam === 'undefined';\n var shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page\n\n promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages\n\n var _loop = function _loop(i) {\n promise = promise.then(function (pages) {\n var shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;\n\n if (shouldFetchNextPage) {\n var _param2 = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);\n\n return fetchPage(pages, manual, _param2);\n }\n\n return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));\n });\n };\n\n for (var i = 1; i < oldPages.length; i++) {\n _loop(i);\n }\n })();\n }\n\n var finalPromise = promise.then(function (pages) {\n return {\n pages: pages,\n pageParams: newPageParams\n };\n });\n var finalPromiseAsAny = finalPromise;\n\n finalPromiseAsAny.cancel = function () {\n cancelled = true;\n abortController == null ? void 0 : abortController.abort();\n\n if (isCancelable(promise)) {\n promise.cancel();\n }\n };\n\n return finalPromise;\n };\n }\n };\n}\nexport function getNextPageParam(options, pages) {\n return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);\n}\nexport function getPreviousPageParam(options, pages) {\n return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);\n}\n/**\n * Checks if there is a next page.\n * Returns `undefined` if it cannot be determined.\n */\n\nexport function hasNextPage(options, pages) {\n if (options.getNextPageParam && Array.isArray(pages)) {\n var nextPageParam = getNextPageParam(options, pages);\n return typeof nextPageParam !== 'undefined' && nextPageParam !== null && nextPageParam !== false;\n }\n}\n/**\n * Checks if there is a previous page.\n * Returns `undefined` if it cannot be determined.\n */\n\nexport function hasPreviousPage(options, pages) {\n if (options.getPreviousPageParam && Array.isArray(pages)) {\n var previousPageParam = getPreviousPageParam(options, pages);\n return typeof previousPageParam !== 'undefined' && previousPageParam !== null && previousPageParam !== false;\n }\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { hashQueryKey, noop, parseFilterArgs, parseQueryArgs, partialMatchKey, hashQueryKeyByOptions } from './utils';\nimport { QueryCache } from './queryCache';\nimport { MutationCache } from './mutationCache';\nimport { focusManager } from './focusManager';\nimport { onlineManager } from './onlineManager';\nimport { notifyManager } from './notifyManager';\nimport { infiniteQueryBehavior } from './infiniteQueryBehavior';\n// CLASS\nexport var QueryClient = /*#__PURE__*/function () {\n function QueryClient(config) {\n if (config === void 0) {\n config = {};\n }\n\n this.queryCache = config.queryCache || new QueryCache();\n this.mutationCache = config.mutationCache || new MutationCache();\n this.defaultOptions = config.defaultOptions || {};\n this.queryDefaults = [];\n this.mutationDefaults = [];\n }\n\n var _proto = QueryClient.prototype;\n\n _proto.mount = function mount() {\n var _this = this;\n\n this.unsubscribeFocus = focusManager.subscribe(function () {\n if (focusManager.isFocused() && onlineManager.isOnline()) {\n _this.mutationCache.onFocus();\n\n _this.queryCache.onFocus();\n }\n });\n this.unsubscribeOnline = onlineManager.subscribe(function () {\n if (focusManager.isFocused() && onlineManager.isOnline()) {\n _this.mutationCache.onOnline();\n\n _this.queryCache.onOnline();\n }\n });\n };\n\n _proto.unmount = function unmount() {\n var _this$unsubscribeFocu, _this$unsubscribeOnli;\n\n (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);\n (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);\n };\n\n _proto.isFetching = function isFetching(arg1, arg2) {\n var _parseFilterArgs = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs[0];\n\n filters.fetching = true;\n return this.queryCache.findAll(filters).length;\n };\n\n _proto.isMutating = function isMutating(filters) {\n return this.mutationCache.findAll(_extends({}, filters, {\n fetching: true\n })).length;\n };\n\n _proto.getQueryData = function getQueryData(queryKey, filters) {\n var _this$queryCache$find;\n\n return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;\n };\n\n _proto.getQueriesData = function getQueriesData(queryKeyOrFilters) {\n return this.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref) {\n var queryKey = _ref.queryKey,\n state = _ref.state;\n var data = state.data;\n return [queryKey, data];\n });\n };\n\n _proto.setQueryData = function setQueryData(queryKey, updater, options) {\n var parsedOptions = parseQueryArgs(queryKey);\n var defaultedOptions = this.defaultQueryOptions(parsedOptions);\n return this.queryCache.build(this, defaultedOptions).setData(updater, options);\n };\n\n _proto.setQueriesData = function setQueriesData(queryKeyOrFilters, updater, options) {\n var _this2 = this;\n\n return notifyManager.batch(function () {\n return _this2.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref2) {\n var queryKey = _ref2.queryKey;\n return [queryKey, _this2.setQueryData(queryKey, updater, options)];\n });\n });\n };\n\n _proto.getQueryState = function getQueryState(queryKey, filters) {\n var _this$queryCache$find2;\n\n return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;\n };\n\n _proto.removeQueries = function removeQueries(arg1, arg2) {\n var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),\n filters = _parseFilterArgs2[0];\n\n var queryCache = this.queryCache;\n notifyManager.batch(function () {\n queryCache.findAll(filters).forEach(function (query) {\n queryCache.remove(query);\n });\n });\n };\n\n _proto.resetQueries = function resetQueries(arg1, arg2, arg3) {\n var _this3 = this;\n\n var _parseFilterArgs3 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs3[0],\n options = _parseFilterArgs3[1];\n\n var queryCache = this.queryCache;\n\n var refetchFilters = _extends({}, filters, {\n active: true\n });\n\n return notifyManager.batch(function () {\n queryCache.findAll(filters).forEach(function (query) {\n query.reset();\n });\n return _this3.refetchQueries(refetchFilters, options);\n });\n };\n\n _proto.cancelQueries = function cancelQueries(arg1, arg2, arg3) {\n var _this4 = this;\n\n var _parseFilterArgs4 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs4[0],\n _parseFilterArgs4$ = _parseFilterArgs4[1],\n cancelOptions = _parseFilterArgs4$ === void 0 ? {} : _parseFilterArgs4$;\n\n if (typeof cancelOptions.revert === 'undefined') {\n cancelOptions.revert = true;\n }\n\n var promises = notifyManager.batch(function () {\n return _this4.queryCache.findAll(filters).map(function (query) {\n return query.cancel(cancelOptions);\n });\n });\n return Promise.all(promises).then(noop).catch(noop);\n };\n\n _proto.invalidateQueries = function invalidateQueries(arg1, arg2, arg3) {\n var _ref3,\n _filters$refetchActiv,\n _filters$refetchInact,\n _this5 = this;\n\n var _parseFilterArgs5 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs5[0],\n options = _parseFilterArgs5[1];\n\n var refetchFilters = _extends({}, filters, {\n // if filters.refetchActive is not provided and filters.active is explicitly false,\n // e.g. invalidateQueries({ active: false }), we don't want to refetch active queries\n active: (_ref3 = (_filters$refetchActiv = filters.refetchActive) != null ? _filters$refetchActiv : filters.active) != null ? _ref3 : true,\n inactive: (_filters$refetchInact = filters.refetchInactive) != null ? _filters$refetchInact : false\n });\n\n return notifyManager.batch(function () {\n _this5.queryCache.findAll(filters).forEach(function (query) {\n query.invalidate();\n });\n\n return _this5.refetchQueries(refetchFilters, options);\n });\n };\n\n _proto.refetchQueries = function refetchQueries(arg1, arg2, arg3) {\n var _this6 = this;\n\n var _parseFilterArgs6 = parseFilterArgs(arg1, arg2, arg3),\n filters = _parseFilterArgs6[0],\n options = _parseFilterArgs6[1];\n\n var promises = notifyManager.batch(function () {\n return _this6.queryCache.findAll(filters).map(function (query) {\n return query.fetch(undefined, _extends({}, options, {\n meta: {\n refetchPage: filters == null ? void 0 : filters.refetchPage\n }\n }));\n });\n });\n var promise = Promise.all(promises).then(noop);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n };\n\n _proto.fetchQuery = function fetchQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n var defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652\n\n if (typeof defaultedOptions.retry === 'undefined') {\n defaultedOptions.retry = false;\n }\n\n var query = this.queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n };\n\n _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3) {\n return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);\n };\n\n _proto.fetchInfiniteQuery = function fetchInfiniteQuery(arg1, arg2, arg3) {\n var parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n parsedOptions.behavior = infiniteQueryBehavior();\n return this.fetchQuery(parsedOptions);\n };\n\n _proto.prefetchInfiniteQuery = function prefetchInfiniteQuery(arg1, arg2, arg3) {\n return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);\n };\n\n _proto.cancelMutations = function cancelMutations() {\n var _this7 = this;\n\n var promises = notifyManager.batch(function () {\n return _this7.mutationCache.getAll().map(function (mutation) {\n return mutation.cancel();\n });\n });\n return Promise.all(promises).then(noop).catch(noop);\n };\n\n _proto.resumePausedMutations = function resumePausedMutations() {\n return this.getMutationCache().resumePausedMutations();\n };\n\n _proto.executeMutation = function executeMutation(options) {\n return this.mutationCache.build(this, options).execute();\n };\n\n _proto.getQueryCache = function getQueryCache() {\n return this.queryCache;\n };\n\n _proto.getMutationCache = function getMutationCache() {\n return this.mutationCache;\n };\n\n _proto.getDefaultOptions = function getDefaultOptions() {\n return this.defaultOptions;\n };\n\n _proto.setDefaultOptions = function setDefaultOptions(options) {\n this.defaultOptions = options;\n };\n\n _proto.setQueryDefaults = function setQueryDefaults(queryKey, options) {\n var result = this.queryDefaults.find(function (x) {\n return hashQueryKey(queryKey) === hashQueryKey(x.queryKey);\n });\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.queryDefaults.push({\n queryKey: queryKey,\n defaultOptions: options\n });\n }\n };\n\n _proto.getQueryDefaults = function getQueryDefaults(queryKey) {\n var _this$queryDefaults$f;\n\n return queryKey ? (_this$queryDefaults$f = this.queryDefaults.find(function (x) {\n return partialMatchKey(queryKey, x.queryKey);\n })) == null ? void 0 : _this$queryDefaults$f.defaultOptions : undefined;\n };\n\n _proto.setMutationDefaults = function setMutationDefaults(mutationKey, options) {\n var result = this.mutationDefaults.find(function (x) {\n return hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey);\n });\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.mutationDefaults.push({\n mutationKey: mutationKey,\n defaultOptions: options\n });\n }\n };\n\n _proto.getMutationDefaults = function getMutationDefaults(mutationKey) {\n var _this$mutationDefault;\n\n return mutationKey ? (_this$mutationDefault = this.mutationDefaults.find(function (x) {\n return partialMatchKey(mutationKey, x.mutationKey);\n })) == null ? void 0 : _this$mutationDefault.defaultOptions : undefined;\n };\n\n _proto.defaultQueryOptions = function defaultQueryOptions(options) {\n if (options == null ? void 0 : options._defaulted) {\n return options;\n }\n\n var defaultedOptions = _extends({}, this.defaultOptions.queries, this.getQueryDefaults(options == null ? void 0 : options.queryKey), options, {\n _defaulted: true\n });\n\n if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n }\n\n return defaultedOptions;\n };\n\n _proto.defaultQueryObserverOptions = function defaultQueryObserverOptions(options) {\n return this.defaultQueryOptions(options);\n };\n\n _proto.defaultMutationOptions = function defaultMutationOptions(options) {\n if (options == null ? void 0 : options._defaulted) {\n return options;\n }\n\n return _extends({}, this.defaultOptions.mutations, this.getMutationDefaults(options == null ? void 0 : options.mutationKey), options, {\n _defaulted: true\n });\n };\n\n _proto.clear = function clear() {\n this.queryCache.clear();\n this.mutationCache.clear();\n };\n\n return QueryClient;\n}();","module.exports = __WEBPACK_EXTERNAL_MODULE__21__;","export var TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n})(TYPE || (TYPE = {}));\n/**\n * Type Guards\n */\nexport function isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nexport function isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nexport function isNumberElement(el) {\n return el.type === TYPE.number;\n}\nexport function isDateElement(el) {\n return el.type === TYPE.date;\n}\nexport function isTimeElement(el) {\n return el.type === TYPE.time;\n}\nexport function isSelectElement(el) {\n return el.type === TYPE.select;\n}\nexport function isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nexport function isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nexport function isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === 0 /* number */);\n}\nexport function isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === 1 /* dateTime */);\n}\nexport function createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nexport function createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\n","// tslint:disable:only-arrow-functions\n// tslint:disable:object-literal-shorthand\n// tslint:disable:trailing-comma\n// tslint:disable:object-literal-sort-keys\n// tslint:disable:one-variable-per-declaration\n// tslint:disable:max-line-length\n// tslint:disable:no-consecutive-blank-lines\n// tslint:disable:align\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n// Generated by PEG.js v. 0.10.0 (ts-pegjs plugin v. 0.2.6 )\n//\n// https://pegjs.org/ https://github.com/metadevpro/ts-pegjs\nimport { TYPE, } from './types';\nvar SyntaxError = /** @class */ (function (_super) {\n __extends(SyntaxError, _super);\n function SyntaxError(message, expected, found, location) {\n var _this = _super.call(this) || this;\n _this.message = message;\n _this.expected = expected;\n _this.found = found;\n _this.location = location;\n _this.name = \"SyntaxError\";\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(_this, SyntaxError);\n }\n return _this;\n }\n SyntaxError.buildMessage = function (expected, found) {\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, \"\\\\\\\"\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function (ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return \"\\\\x\" + hex(ch); });\n }\n function classEscape(s) {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\]/g, \"\\\\]\")\n .replace(/\\^/g, \"\\\\^\")\n .replace(/-/g, \"\\\\-\")\n .replace(/\\0/g, \"\\\\0\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/[\\x00-\\x0F]/g, function (ch) { return \"\\\\x0\" + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return \"\\\\x\" + hex(ch); });\n }\n function describeExpectation(expectation) {\n switch (expectation.type) {\n case \"literal\":\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n case \"class\":\n var escapedParts = expectation.parts.map(function (part) {\n return Array.isArray(part)\n ? classEscape(part[0]) + \"-\" + classEscape(part[1])\n : classEscape(part);\n });\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n case \"any\":\n return \"any character\";\n case \"end\":\n return \"end of input\";\n case \"other\":\n return expectation.description;\n }\n }\n function describeExpected(expected1) {\n var descriptions = expected1.map(describeExpectation);\n var i;\n var j;\n descriptions.sort();\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n function describeFound(found1) {\n return found1 ? \"\\\"\" + literalEscape(found1) + \"\\\"\" : \"end of input\";\n }\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n return SyntaxError;\n}(Error));\nexport { SyntaxError };\nfunction peg$parse(input, options) {\n options = options !== undefined ? options : {};\n var peg$FAILED = {};\n var peg$startRuleFunctions = { start: peg$parsestart };\n var peg$startRuleFunction = peg$parsestart;\n var peg$c0 = function (parts) {\n return parts.join('');\n };\n var peg$c1 = function (messageText) {\n return __assign({ type: TYPE.literal, value: messageText }, insertLocation());\n };\n var peg$c2 = \"#\";\n var peg$c3 = peg$literalExpectation(\"#\", false);\n var peg$c4 = function () {\n return __assign({ type: TYPE.pound }, insertLocation());\n };\n var peg$c5 = peg$otherExpectation(\"argumentElement\");\n var peg$c6 = \"{\";\n var peg$c7 = peg$literalExpectation(\"{\", false);\n var peg$c8 = \"}\";\n var peg$c9 = peg$literalExpectation(\"}\", false);\n var peg$c10 = function (value) {\n return __assign({ type: TYPE.argument, value: value }, insertLocation());\n };\n var peg$c11 = peg$otherExpectation(\"numberSkeletonId\");\n var peg$c12 = /^['\\/{}]/;\n var peg$c13 = peg$classExpectation([\"'\", \"/\", \"{\", \"}\"], false, false);\n var peg$c14 = peg$anyExpectation();\n var peg$c15 = peg$otherExpectation(\"numberSkeletonTokenOption\");\n var peg$c16 = \"/\";\n var peg$c17 = peg$literalExpectation(\"/\", false);\n var peg$c18 = function (option) { return option; };\n var peg$c19 = peg$otherExpectation(\"numberSkeletonToken\");\n var peg$c20 = function (stem, options) {\n return { stem: stem, options: options };\n };\n var peg$c21 = function (tokens) {\n return __assign({ type: 0 /* number */, tokens: tokens }, insertLocation());\n };\n var peg$c22 = \"::\";\n var peg$c23 = peg$literalExpectation(\"::\", false);\n var peg$c24 = function (skeleton) { return skeleton; };\n var peg$c25 = function () { messageCtx.push('numberArgStyle'); return true; };\n var peg$c26 = function (style) {\n messageCtx.pop();\n return style.replace(/\\s*$/, '');\n };\n var peg$c27 = \",\";\n var peg$c28 = peg$literalExpectation(\",\", false);\n var peg$c29 = \"number\";\n var peg$c30 = peg$literalExpectation(\"number\", false);\n var peg$c31 = function (value, type, style) {\n return __assign({ type: type === 'number' ? TYPE.number : type === 'date' ? TYPE.date : TYPE.time, style: style && style[2], value: value }, insertLocation());\n };\n var peg$c32 = \"'\";\n var peg$c33 = peg$literalExpectation(\"'\", false);\n var peg$c34 = /^[^']/;\n var peg$c35 = peg$classExpectation([\"'\"], true, false);\n var peg$c36 = /^[^a-zA-Z'{}]/;\n var peg$c37 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], \"'\", \"{\", \"}\"], true, false);\n var peg$c38 = /^[a-zA-Z]/;\n var peg$c39 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false);\n var peg$c40 = function (pattern) {\n return __assign({ type: 1 /* dateTime */, pattern: pattern }, insertLocation());\n };\n var peg$c41 = function () { messageCtx.push('dateOrTimeArgStyle'); return true; };\n var peg$c42 = \"date\";\n var peg$c43 = peg$literalExpectation(\"date\", false);\n var peg$c44 = \"time\";\n var peg$c45 = peg$literalExpectation(\"time\", false);\n var peg$c46 = \"plural\";\n var peg$c47 = peg$literalExpectation(\"plural\", false);\n var peg$c48 = \"selectordinal\";\n var peg$c49 = peg$literalExpectation(\"selectordinal\", false);\n var peg$c50 = \"offset:\";\n var peg$c51 = peg$literalExpectation(\"offset:\", false);\n var peg$c52 = function (value, pluralType, offset, options) {\n return __assign({ type: TYPE.plural, pluralType: pluralType === 'plural' ? 'cardinal' : 'ordinal', value: value, offset: offset ? offset[2] : 0, options: options.reduce(function (all, _a) {\n var id = _a.id, value = _a.value, optionLocation = _a.location;\n if (id in all) {\n error(\"Duplicate option \\\"\" + id + \"\\\" in plural element: \\\"\" + text() + \"\\\"\", location());\n }\n all[id] = {\n value: value,\n location: optionLocation\n };\n return all;\n }, {}) }, insertLocation());\n };\n var peg$c53 = \"select\";\n var peg$c54 = peg$literalExpectation(\"select\", false);\n var peg$c55 = function (value, options) {\n return __assign({ type: TYPE.select, value: value, options: options.reduce(function (all, _a) {\n var id = _a.id, value = _a.value, optionLocation = _a.location;\n if (id in all) {\n error(\"Duplicate option \\\"\" + id + \"\\\" in select element: \\\"\" + text() + \"\\\"\", location());\n }\n all[id] = {\n value: value,\n location: optionLocation\n };\n return all;\n }, {}) }, insertLocation());\n };\n var peg$c56 = \"=\";\n var peg$c57 = peg$literalExpectation(\"=\", false);\n var peg$c58 = function (id) { messageCtx.push('select'); return true; };\n var peg$c59 = function (id, value) {\n messageCtx.pop();\n return __assign({ id: id,\n value: value }, insertLocation());\n };\n var peg$c60 = function (id) { messageCtx.push('plural'); return true; };\n var peg$c61 = function (id, value) {\n messageCtx.pop();\n return __assign({ id: id,\n value: value }, insertLocation());\n };\n var peg$c62 = peg$otherExpectation(\"whitespace\");\n var peg$c63 = /^[\\t-\\r \\x85\\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/;\n var peg$c64 = peg$classExpectation([[\"\\t\", \"\\r\"], \" \", \"\\x85\", \"\\xA0\", \"\\u1680\", [\"\\u2000\", \"\\u200A\"], \"\\u2028\", \"\\u2029\", \"\\u202F\", \"\\u205F\", \"\\u3000\"], false, false);\n var peg$c65 = peg$otherExpectation(\"syntax pattern\");\n var peg$c66 = /^[!-\\/:-@[-\\^`{-~\\xA1-\\xA7\\xA9\\xAB\\xAC\\xAE\\xB0\\xB1\\xB6\\xBB\\xBF\\xD7\\xF7\\u2010-\\u2027\\u2030-\\u203E\\u2041-\\u2053\\u2055-\\u205E\\u2190-\\u245F\\u2500-\\u2775\\u2794-\\u2BFF\\u2E00-\\u2E7F\\u3001-\\u3003\\u3008-\\u3020\\u3030\\uFD3E\\uFD3F\\uFE45\\uFE46]/;\n var peg$c67 = peg$classExpectation([[\"!\", \"/\"], [\":\", \"@\"], [\"[\", \"^\"], \"`\", [\"{\", \"~\"], [\"\\xA1\", \"\\xA7\"], \"\\xA9\", \"\\xAB\", \"\\xAC\", \"\\xAE\", \"\\xB0\", \"\\xB1\", \"\\xB6\", \"\\xBB\", \"\\xBF\", \"\\xD7\", \"\\xF7\", [\"\\u2010\", \"\\u2027\"], [\"\\u2030\", \"\\u203E\"], [\"\\u2041\", \"\\u2053\"], [\"\\u2055\", \"\\u205E\"], [\"\\u2190\", \"\\u245F\"], [\"\\u2500\", \"\\u2775\"], [\"\\u2794\", \"\\u2BFF\"], [\"\\u2E00\", \"\\u2E7F\"], [\"\\u3001\", \"\\u3003\"], [\"\\u3008\", \"\\u3020\"], \"\\u3030\", \"\\uFD3E\", \"\\uFD3F\", \"\\uFE45\", \"\\uFE46\"], false, false);\n var peg$c68 = peg$otherExpectation(\"optional whitespace\");\n var peg$c69 = peg$otherExpectation(\"number\");\n var peg$c70 = \"-\";\n var peg$c71 = peg$literalExpectation(\"-\", false);\n var peg$c72 = function (negative, num) {\n return num\n ? negative\n ? -num\n : num\n : 0;\n };\n var peg$c73 = peg$otherExpectation(\"apostrophe\");\n var peg$c74 = peg$otherExpectation(\"double apostrophes\");\n var peg$c75 = \"''\";\n var peg$c76 = peg$literalExpectation(\"''\", false);\n var peg$c77 = function () { return \"'\"; };\n var peg$c78 = function (escapedChar, quotedChars) {\n return escapedChar + quotedChars.replace(\"''\", \"'\");\n };\n var peg$c79 = function (x) {\n return (x !== '{' &&\n !(isInPluralOption() && x === '#') &&\n !(isNestedMessageText() && x === '}'));\n };\n var peg$c80 = \"\\n\";\n var peg$c81 = peg$literalExpectation(\"\\n\", false);\n var peg$c82 = function (x) {\n return x === '{' || x === '}' || (isInPluralOption() && x === '#');\n };\n var peg$c83 = peg$otherExpectation(\"argNameOrNumber\");\n var peg$c84 = peg$otherExpectation(\"argNumber\");\n var peg$c85 = \"0\";\n var peg$c86 = peg$literalExpectation(\"0\", false);\n var peg$c87 = function () { return 0; };\n var peg$c88 = /^[1-9]/;\n var peg$c89 = peg$classExpectation([[\"1\", \"9\"]], false, false);\n var peg$c90 = /^[0-9]/;\n var peg$c91 = peg$classExpectation([[\"0\", \"9\"]], false, false);\n var peg$c92 = function (digits) {\n return parseInt(digits.join(''), 10);\n };\n var peg$c93 = peg$otherExpectation(\"argName\");\n var peg$currPos = 0;\n var peg$savedPos = 0;\n var peg$posDetailsCache = [{ line: 1, column: 1 }];\n var peg$maxFailPos = 0;\n var peg$maxFailExpected = [];\n var peg$silentFails = 0;\n var peg$result;\n if (options.startRule !== undefined) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n function expected(description, location1) {\n location1 = location1 !== undefined\n ? location1\n : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location1);\n }\n function error(message, location1) {\n location1 = location1 !== undefined\n ? location1\n : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildSimpleError(message, location1);\n }\n function peg$literalExpectation(text1, ignoreCase) {\n return { type: \"literal\", text: text1, ignoreCase: ignoreCase };\n }\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos];\n var p;\n if (details) {\n return details;\n }\n else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n }\n else {\n details.column++;\n }\n p++;\n }\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos);\n var endPosDetails = peg$computePosDetails(endPos);\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n function peg$fail(expected1) {\n if (peg$currPos < peg$maxFailPos) {\n return;\n }\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n peg$maxFailExpected.push(expected1);\n }\n function peg$buildSimpleError(message, location1) {\n return new SyntaxError(message, [], \"\", location1);\n }\n function peg$buildStructuredError(expected1, found, location1) {\n return new SyntaxError(SyntaxError.buildMessage(expected1, found), expected1, found, location1);\n }\n function peg$parsestart() {\n var s0;\n s0 = peg$parsemessage();\n return s0;\n }\n function peg$parsemessage() {\n var s0, s1;\n s0 = [];\n s1 = peg$parsemessageElement();\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n s1 = peg$parsemessageElement();\n }\n return s0;\n }\n function peg$parsemessageElement() {\n var s0;\n s0 = peg$parseliteralElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parseargumentElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesimpleFormatElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parsepluralElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parseselectElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parsepoundElement();\n }\n }\n }\n }\n }\n return s0;\n }\n function peg$parsemessageText() {\n var s0, s1, s2;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsedoubleApostrophes();\n if (s2 === peg$FAILED) {\n s2 = peg$parsequotedString();\n if (s2 === peg$FAILED) {\n s2 = peg$parseunquotedString();\n }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsedoubleApostrophes();\n if (s2 === peg$FAILED) {\n s2 = peg$parsequotedString();\n if (s2 === peg$FAILED) {\n s2 = peg$parseunquotedString();\n }\n }\n }\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parseliteralElement() {\n var s0, s1;\n s0 = peg$currPos;\n s1 = peg$parsemessageText();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsepoundElement() {\n var s0, s1;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c2;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c3);\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c4();\n }\n s0 = s1;\n return s0;\n }\n function peg$parseargumentElement() {\n var s0, s1, s2, s3, s4, s5;\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c6;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargNameOrNumber();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s5 = peg$c8;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c5);\n }\n }\n return s0;\n }\n function peg$parsenumberSkeletonId() {\n var s0, s1, s2, s3, s4;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$currPos;\n s3 = peg$currPos;\n peg$silentFails++;\n s4 = peg$parsewhiteSpace();\n if (s4 === peg$FAILED) {\n if (peg$c12.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c13);\n }\n }\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$currPos;\n s3 = peg$currPos;\n peg$silentFails++;\n s4 = peg$parsewhiteSpace();\n if (s4 === peg$FAILED) {\n if (peg$c12.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c13);\n }\n }\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c11);\n }\n }\n return s0;\n }\n function peg$parsenumberSkeletonTokenOption() {\n var s0, s1, s2;\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 47) {\n s1 = peg$c16;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c17);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsenumberSkeletonId();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c18(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c15);\n }\n }\n return s0;\n }\n function peg$parsenumberSkeletonToken() {\n var s0, s1, s2, s3, s4;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsenumberSkeletonId();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsenumberSkeletonTokenOption();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsenumberSkeletonTokenOption();\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s2, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c19);\n }\n }\n return s0;\n }\n function peg$parsenumberSkeleton() {\n var s0, s1, s2;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsenumberSkeletonToken();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsenumberSkeletonToken();\n }\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c21(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsenumberArgStyle() {\n var s0, s1, s2;\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c22) {\n s1 = peg$c22;\n peg$currPos += 2;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsenumberSkeleton();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c24(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n peg$savedPos = peg$currPos;\n s1 = peg$c25();\n if (s1) {\n s1 = undefined;\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsemessageText();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n return s0;\n }\n function peg$parsenumberFormatElement() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c6;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargNameOrNumber();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c27;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c29) {\n s7 = peg$c29;\n peg$currPos += 6;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c30);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s10 = peg$c27;\n peg$currPos++;\n }\n else {\n s10 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s10 !== peg$FAILED) {\n s11 = peg$parse_();\n if (s11 !== peg$FAILED) {\n s12 = peg$parsenumberArgStyle();\n if (s12 !== peg$FAILED) {\n s10 = [s10, s11, s12];\n s9 = s10;\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n if (s9 === peg$FAILED) {\n s9 = null;\n }\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s11 = peg$c8;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s11 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c31(s3, s7, s9);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsedateTimeSkeletonLiteral() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c32;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsedoubleApostrophes();\n if (s3 === peg$FAILED) {\n if (peg$c34.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c35);\n }\n }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsedoubleApostrophes();\n if (s3 === peg$FAILED) {\n if (peg$c34.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c35);\n }\n }\n }\n }\n }\n else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c32;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s3 !== peg$FAILED) {\n s1 = [s1, s2, s3];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = [];\n s1 = peg$parsedoubleApostrophes();\n if (s1 === peg$FAILED) {\n if (peg$c36.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c37);\n }\n }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n s1 = peg$parsedoubleApostrophes();\n if (s1 === peg$FAILED) {\n if (peg$c36.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c37);\n }\n }\n }\n }\n }\n else {\n s0 = peg$FAILED;\n }\n }\n return s0;\n }\n function peg$parsedateTimeSkeletonPattern() {\n var s0, s1;\n s0 = [];\n if (peg$c38.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c39);\n }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c38.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c39);\n }\n }\n }\n }\n else {\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsedateTimeSkeleton() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = [];\n s3 = peg$parsedateTimeSkeletonLiteral();\n if (s3 === peg$FAILED) {\n s3 = peg$parsedateTimeSkeletonPattern();\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsedateTimeSkeletonLiteral();\n if (s3 === peg$FAILED) {\n s3 = peg$parsedateTimeSkeletonPattern();\n }\n }\n }\n else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n }\n else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c40(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsedateOrTimeArgStyle() {\n var s0, s1, s2;\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c22) {\n s1 = peg$c22;\n peg$currPos += 2;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c23);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedateTimeSkeleton();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c24(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n peg$savedPos = peg$currPos;\n s1 = peg$c41();\n if (s1) {\n s1 = undefined;\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsemessageText();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n return s0;\n }\n function peg$parsedateOrTimeFormatElement() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c6;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargNameOrNumber();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c27;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c42) {\n s7 = peg$c42;\n peg$currPos += 4;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c43);\n }\n }\n if (s7 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c44) {\n s7 = peg$c44;\n peg$currPos += 4;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c45);\n }\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s10 = peg$c27;\n peg$currPos++;\n }\n else {\n s10 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s10 !== peg$FAILED) {\n s11 = peg$parse_();\n if (s11 !== peg$FAILED) {\n s12 = peg$parsedateOrTimeArgStyle();\n if (s12 !== peg$FAILED) {\n s10 = [s10, s11, s12];\n s9 = s10;\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s9;\n s9 = peg$FAILED;\n }\n if (s9 === peg$FAILED) {\n s9 = null;\n }\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s11 = peg$c8;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s11 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c31(s3, s7, s9);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsesimpleFormatElement() {\n var s0;\n s0 = peg$parsenumberFormatElement();\n if (s0 === peg$FAILED) {\n s0 = peg$parsedateOrTimeFormatElement();\n }\n return s0;\n }\n function peg$parsepluralElement() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c6;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargNameOrNumber();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c27;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c46) {\n s7 = peg$c46;\n peg$currPos += 6;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c47);\n }\n }\n if (s7 === peg$FAILED) {\n if (input.substr(peg$currPos, 13) === peg$c48) {\n s7 = peg$c48;\n peg$currPos += 13;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c49);\n }\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s9 = peg$c27;\n peg$currPos++;\n }\n else {\n s9 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n s11 = peg$currPos;\n if (input.substr(peg$currPos, 7) === peg$c50) {\n s12 = peg$c50;\n peg$currPos += 7;\n }\n else {\n s12 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c51);\n }\n }\n if (s12 !== peg$FAILED) {\n s13 = peg$parse_();\n if (s13 !== peg$FAILED) {\n s14 = peg$parsenumber();\n if (s14 !== peg$FAILED) {\n s12 = [s12, s13, s14];\n s11 = s12;\n }\n else {\n peg$currPos = s11;\n s11 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s11;\n s11 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s11;\n s11 = peg$FAILED;\n }\n if (s11 === peg$FAILED) {\n s11 = null;\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n s13 = [];\n s14 = peg$parsepluralOption();\n if (s14 !== peg$FAILED) {\n while (s14 !== peg$FAILED) {\n s13.push(s14);\n s14 = peg$parsepluralOption();\n }\n }\n else {\n s13 = peg$FAILED;\n }\n if (s13 !== peg$FAILED) {\n s14 = peg$parse_();\n if (s14 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s15 = peg$c8;\n peg$currPos++;\n }\n else {\n s15 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s15 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c52(s3, s7, s11, s13);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parseselectElement() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c6;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseargNameOrNumber();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c27;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c53) {\n s7 = peg$c53;\n peg$currPos += 6;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c54);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s9 = peg$c27;\n peg$currPos++;\n }\n else {\n s9 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c28);\n }\n }\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n s11 = [];\n s12 = peg$parseselectOption();\n if (s12 !== peg$FAILED) {\n while (s12 !== peg$FAILED) {\n s11.push(s12);\n s12 = peg$parseselectOption();\n }\n }\n else {\n s11 = peg$FAILED;\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s13 = peg$c8;\n peg$currPos++;\n }\n else {\n s13 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c55(s3, s11);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsepluralRuleSelectValue() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 61) {\n s2 = peg$c56;\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c57);\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseargName();\n }\n return s0;\n }\n function peg$parseselectOption() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseargName();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s4 = peg$c6;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = peg$currPos;\n s5 = peg$c58(s2);\n if (s5) {\n s5 = undefined;\n }\n else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parsemessage();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s7 = peg$c8;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c59(s2, s6);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsepluralOption() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepluralRuleSelectValue();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s4 = peg$c6;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c7);\n }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = peg$currPos;\n s5 = peg$c60(s2);\n if (s5) {\n s5 = undefined;\n }\n else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parsemessage();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s7 = peg$c8;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c9);\n }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c61(s2, s6);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsewhiteSpace() {\n var s0, s1;\n peg$silentFails++;\n if (peg$c63.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c64);\n }\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c62);\n }\n }\n return s0;\n }\n function peg$parsepatternSyntax() {\n var s0, s1;\n peg$silentFails++;\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c67);\n }\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c65);\n }\n }\n return s0;\n }\n function peg$parse_() {\n var s0, s1, s2;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsewhiteSpace();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsewhiteSpace();\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c68);\n }\n }\n return s0;\n }\n function peg$parsenumber() {\n var s0, s1, s2;\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s1 = peg$c70;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c71);\n }\n }\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseargNumber();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c72(s1, s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c69);\n }\n }\n return s0;\n }\n function peg$parseapostrophe() {\n var s0, s1;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 39) {\n s0 = peg$c32;\n peg$currPos++;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c73);\n }\n }\n return s0;\n }\n function peg$parsedoubleApostrophes() {\n var s0, s1;\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c75) {\n s1 = peg$c75;\n peg$currPos += 2;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c76);\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c77();\n }\n s0 = s1;\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c74);\n }\n }\n return s0;\n }\n function peg$parsequotedString() {\n var s0, s1, s2, s3, s4, s5;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c32;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseescapedChar();\n if (s2 !== peg$FAILED) {\n s3 = peg$currPos;\n s4 = [];\n if (input.substr(peg$currPos, 2) === peg$c75) {\n s5 = peg$c75;\n peg$currPos += 2;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c76);\n }\n }\n if (s5 === peg$FAILED) {\n if (peg$c34.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c35);\n }\n }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (input.substr(peg$currPos, 2) === peg$c75) {\n s5 = peg$c75;\n peg$currPos += 2;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c76);\n }\n }\n if (s5 === peg$FAILED) {\n if (peg$c34.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c35);\n }\n }\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = input.substring(s3, peg$currPos);\n }\n else {\n s3 = s4;\n }\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s4 = peg$c32;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c78(s2, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parseunquotedString() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = peg$currPos;\n s3 = peg$c79(s2);\n if (s3) {\n s3 = undefined;\n }\n else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 10) {\n s1 = peg$c80;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c81);\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n return s0;\n }\n function peg$parseescapedChar() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = peg$currPos;\n s3 = peg$c82(s2);\n if (s3) {\n s3 = undefined;\n }\n else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n return s0;\n }\n function peg$parseargNameOrNumber() {\n var s0, s1;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parseargNumber();\n if (s1 === peg$FAILED) {\n s1 = peg$parseargName();\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c83);\n }\n }\n return s0;\n }\n function peg$parseargNumber() {\n var s0, s1, s2, s3, s4;\n peg$silentFails++;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 48) {\n s1 = peg$c85;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c86);\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c88.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c89);\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c90.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c91);\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c90.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c91);\n }\n }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c92(s1);\n }\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c84);\n }\n }\n return s0;\n }\n function peg$parseargName() {\n var s0, s1, s2, s3, s4;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$currPos;\n s3 = peg$currPos;\n peg$silentFails++;\n s4 = peg$parsewhiteSpace();\n if (s4 === peg$FAILED) {\n s4 = peg$parsepatternSyntax();\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$currPos;\n s3 = peg$currPos;\n peg$silentFails++;\n s4 = peg$parsewhiteSpace();\n if (s4 === peg$FAILED) {\n s4 = peg$parsepatternSyntax();\n }\n peg$silentFails--;\n if (s4 === peg$FAILED) {\n s3 = undefined;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n }\n }\n else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n }\n else {\n s0 = s1;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c93);\n }\n }\n return s0;\n }\n var messageCtx = ['root'];\n function isNestedMessageText() {\n return messageCtx.length > 1;\n }\n function isInPluralOption() {\n return messageCtx[messageCtx.length - 1] === 'plural';\n }\n function insertLocation() {\n return options && options.captureLocation ? {\n location: location()\n } : {};\n }\n peg$result = peg$startRuleFunction();\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n }\n else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));\n }\n}\nexport var pegParse = peg$parse;\n","var __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nimport { isPluralElement, isLiteralElement, isSelectElement, } from './types';\nimport { pegParse } from './parser';\nvar PLURAL_HASHTAG_REGEX = /(^|[^\\\\])#/g;\n/**\n * Whether to convert `#` in plural rule options\n * to `{var, number}`\n * @param el AST Element\n * @param pluralStack current plural stack\n */\nexport function normalizeHashtagInPlural(els) {\n els.forEach(function (el) {\n // If we're encountering a plural el\n if (!isPluralElement(el) && !isSelectElement(el)) {\n return;\n }\n // Go down the options and search for # in any literal element\n Object.keys(el.options).forEach(function (id) {\n var _a;\n var opt = el.options[id];\n // If we got a match, we have to split this\n // and inject a NumberElement in the middle\n var matchingLiteralElIndex = -1;\n var literalEl = undefined;\n for (var i = 0; i < opt.value.length; i++) {\n var el_1 = opt.value[i];\n if (isLiteralElement(el_1) && PLURAL_HASHTAG_REGEX.test(el_1.value)) {\n matchingLiteralElIndex = i;\n literalEl = el_1;\n break;\n }\n }\n if (literalEl) {\n var newValue = literalEl.value.replace(PLURAL_HASHTAG_REGEX, \"$1{\" + el.value + \", number}\");\n var newEls = pegParse(newValue);\n (_a = opt.value).splice.apply(_a, __spreadArrays([matchingLiteralElIndex, 1], newEls));\n }\n normalizeHashtagInPlural(opt.value);\n });\n });\n}\n","import { pegParse } from './parser';\nimport { normalizeHashtagInPlural } from './normalize';\nexport * from './types';\nexport * from './parser';\nexport * from './skeleton';\nexport function parse(input, opts) {\n var els = pegParse(input, opts);\n if (!opts || opts.normalizeHashtagInPlural !== false) {\n normalizeHashtagInPlural(els);\n }\n return els;\n}\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\n// -- Utilities ----------------------------------------------------------------\nfunction getCacheId(inputs) {\n return JSON.stringify(inputs.map(function (input) {\n return input && typeof input === 'object' ? orderedProps(input) : input;\n }));\n}\nfunction orderedProps(obj) {\n return Object.keys(obj)\n .sort()\n .map(function (k) {\n var _a;\n return (_a = {}, _a[k] = obj[k], _a);\n });\n}\nvar memoizeFormatConstructor = function (FormatConstructor, cache) {\n if (cache === void 0) { cache = {}; }\n return function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var cacheId = getCacheId(args);\n var format = cacheId && cache[cacheId];\n if (!format) {\n format = new ((_a = FormatConstructor).bind.apply(_a, __spreadArrays([void 0], args)))();\n if (cacheId) {\n cache[cacheId] = format;\n }\n }\n return format;\n };\n};\nexport default memoizeFormatConstructor;\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nexport function parseDateTimeSkeleton(skeleton) {\n var result = {};\n skeleton.replace(DATE_TIME_REGEX, function (match) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n // Year\n case 'y':\n result.year = len === 2 ? '2-digit' : 'numeric';\n break;\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`q/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n break;\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n break;\n case 'D':\n case 'F':\n case 'g':\n throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'short' : len === 5 ? 'narrow' : 'short';\n break;\n case 'e':\n if (len < 4) {\n throw new RangeError('`e..eee` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n case 'c':\n if (len < 4) {\n throw new RangeError('`c..ccc` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n // Period\n case 'a': // AM, PM\n result.hour12 = true;\n break;\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');\n // Hour\n case 'h':\n result.hourCycle = 'h12';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'H':\n result.hourCycle = 'h23';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'K':\n result.hourCycle = 'h11';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'k':\n result.hourCycle = 'h24';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n break;\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n break;\n case 'S':\n case 'A':\n throw new RangeError('`S/A` (second) pattenrs are not supported, use `s` instead');\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n result.timeZoneName = len < 4 ? 'short' : 'long';\n break;\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n throw new RangeError('`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead');\n }\n return '';\n });\n return result;\n}\nfunction icuUnitToEcma(unit) {\n return unit.replace(/^(.*?)-/, '');\n}\nvar FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\+|#+)?)?$/g;\nvar SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?$/g;\nfunction parseSignificantPrecision(str) {\n var result = {};\n str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {\n // @@@ case\n if (typeof g2 !== 'string') {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits = g1.length;\n }\n // @@@+ case\n else if (g2 === '+') {\n result.minimumSignificantDigits = g1.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumSignificantDigits = g1.length;\n }\n // .@@## or .@@@ case\n else {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n return result;\n}\nfunction parseSign(str) {\n switch (str) {\n case 'sign-auto':\n return {\n signDisplay: 'auto',\n };\n case 'sign-accounting':\n return {\n currencySign: 'accounting',\n };\n case 'sign-always':\n return {\n signDisplay: 'always',\n };\n case 'sign-accounting-always':\n return {\n signDisplay: 'always',\n currencySign: 'accounting',\n };\n case 'sign-except-zero':\n return {\n signDisplay: 'exceptZero',\n };\n case 'sign-accounting-except-zero':\n return {\n signDisplay: 'exceptZero',\n currencySign: 'accounting',\n };\n case 'sign-never':\n return {\n signDisplay: 'never',\n };\n }\n}\nfunction parseNotationOptions(opt) {\n var result = {};\n var signOpts = parseSign(opt);\n if (signOpts) {\n return signOpts;\n }\n return result;\n}\n/**\n * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n */\nexport function convertNumberSkeletonToNumberFormatOptions(tokens) {\n var result = {};\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n switch (token.stem) {\n case 'percent':\n result.style = 'percent';\n continue;\n case 'currency':\n result.style = 'currency';\n result.currency = token.options[0];\n continue;\n case 'group-off':\n result.useGrouping = false;\n continue;\n case 'precision-integer':\n result.maximumFractionDigits = 0;\n continue;\n case 'measure-unit':\n result.style = 'unit';\n result.unit = icuUnitToEcma(token.options[0]);\n continue;\n case 'compact-short':\n result.notation = 'compact';\n result.compactDisplay = 'short';\n continue;\n case 'compact-long':\n result.notation = 'compact';\n result.compactDisplay = 'long';\n continue;\n case 'scientific':\n result = __assign(__assign(__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'engineering':\n result = __assign(__assign(__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'notation-simple':\n result.notation = 'standard';\n continue;\n // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h\n case 'unit-width-narrow':\n result.currencyDisplay = 'narrowSymbol';\n result.unitDisplay = 'narrow';\n continue;\n case 'unit-width-short':\n result.currencyDisplay = 'code';\n result.unitDisplay = 'short';\n continue;\n case 'unit-width-full-name':\n result.currencyDisplay = 'name';\n result.unitDisplay = 'long';\n continue;\n case 'unit-width-iso-code':\n result.currencyDisplay = 'symbol';\n continue;\n }\n // Precision\n // https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#fraction-precision\n if (FRACTION_PRECISION_REGEX.test(token.stem)) {\n if (token.options.length > 1) {\n throw new RangeError('Fraction-precision stems only accept a single optional option');\n }\n token.stem.replace(FRACTION_PRECISION_REGEX, function (match, g1, g2) {\n // precision-integer case\n if (match === '.') {\n result.maximumFractionDigits = 0;\n }\n // .000+ case\n else if (g2 === '+') {\n result.minimumFractionDigits = g2.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumFractionDigits = g1.length;\n }\n // .00## or .000 case\n else {\n result.minimumFractionDigits = g1.length;\n result.maximumFractionDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n if (token.options.length) {\n result = __assign(__assign({}, result), parseSignificantPrecision(token.options[0]));\n }\n continue;\n }\n if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));\n continue;\n }\n var signOpts = parseSign(token.stem);\n if (signOpts) {\n result = __assign(__assign({}, result), signOpts);\n }\n }\n return result;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nimport { convertNumberSkeletonToNumberFormatOptions, isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTimeElement, parseDateTimeSkeleton, } from 'intl-messageformat-parser';\nvar FormatError = /** @class */ (function (_super) {\n __extends(FormatError, _super);\n function FormatError(msg, variableId) {\n var _this = _super.call(this, msg) || this;\n _this.variableId = variableId;\n return _this;\n }\n return FormatError;\n}(Error));\nfunction mergeLiteral(parts) {\n if (parts.length < 2) {\n return parts;\n }\n return parts.reduce(function (all, part) {\n var lastPart = all[all.length - 1];\n if (!lastPart ||\n lastPart.type !== 0 /* literal */ ||\n part.type !== 0 /* literal */) {\n all.push(part);\n }\n else {\n lastPart.value += part.value;\n }\n return all;\n }, []);\n}\n// TODO(skeleton): add skeleton support\nexport function formatToParts(els, locales, formatters, formats, values, currentPluralValue, \n// For debugging\noriginalMessage) {\n // Hot path for straight simple msg translations\n if (els.length === 1 && isLiteralElement(els[0])) {\n return [\n {\n type: 0 /* literal */,\n value: els[0].value,\n },\n ];\n }\n var result = [];\n for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {\n var el = els_1[_i];\n // Exit early for string parts.\n if (isLiteralElement(el)) {\n result.push({\n type: 0 /* literal */,\n value: el.value,\n });\n continue;\n }\n // TODO: should this part be literal type?\n // Replace `#` in plural rules with the actual numeric value.\n if (isPoundElement(el)) {\n if (typeof currentPluralValue === 'number') {\n result.push({\n type: 0 /* literal */,\n value: formatters.getNumberFormat(locales).format(currentPluralValue),\n });\n }\n continue;\n }\n var varName = el.value;\n // Enforce that all required values are provided by the caller.\n if (!(values && varName in values)) {\n throw new FormatError(\"The intl string context variable \\\"\" + varName + \"\\\" was not provided to the string \\\"\" + originalMessage + \"\\\"\");\n }\n var value = values[varName];\n if (isArgumentElement(el)) {\n if (!value || typeof value === 'string' || typeof value === 'number') {\n value =\n typeof value === 'string' || typeof value === 'number'\n ? String(value)\n : '';\n }\n result.push({\n type: 1 /* argument */,\n value: value,\n });\n continue;\n }\n // Recursively format plural and select parts' option — which can be a\n // nested pattern structure. The choosing of the option to use is\n // abstracted-by and delegated-to the part helper object.\n if (isDateElement(el)) {\n var style = typeof el.style === 'string' ? formats.date[el.style] : undefined;\n result.push({\n type: 0 /* literal */,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isTimeElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.time[el.style]\n : isDateTimeSkeleton(el.style)\n ? parseDateTimeSkeleton(el.style.pattern)\n : undefined;\n result.push({\n type: 0 /* literal */,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isNumberElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.number[el.style]\n : isNumberSkeleton(el.style)\n ? convertNumberSkeletonToNumberFormatOptions(el.style.tokens)\n : undefined;\n result.push({\n type: 0 /* literal */,\n value: formatters\n .getNumberFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isSelectElement(el)) {\n var opt = el.options[value] || el.options.other;\n if (!opt) {\n throw new RangeError(\"Invalid values for \\\"\" + el.value + \"\\\": \\\"\" + value + \"\\\". Options are \\\"\" + Object.keys(el.options).join('\", \"') + \"\\\"\");\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));\n continue;\n }\n if (isPluralElement(el)) {\n var opt = el.options[\"=\" + value];\n if (!opt) {\n if (!Intl.PluralRules) {\n throw new FormatError(\"Intl.PluralRules is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-pluralrules\\\"\\n\");\n }\n var rule = formatters\n .getPluralRules(locales, { type: el.pluralType })\n .select(value - (el.offset || 0));\n opt = el.options[rule] || el.options.other;\n }\n if (!opt) {\n throw new RangeError(\"Invalid values for \\\"\" + el.value + \"\\\": \\\"\" + value + \"\\\". Options are \\\"\" + Object.keys(el.options).join('\", \"') + \"\\\"\");\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));\n continue;\n }\n }\n return mergeLiteral(result);\n}\nexport function formatToString(els, locales, formatters, formats, values, \n// For debugging\noriginalMessage) {\n var parts = formatToParts(els, locales, formatters, formats, values, undefined, originalMessage);\n // Hot path for straight simple msg translations\n if (parts.length === 1) {\n return parts[0].value;\n }\n return parts.reduce(function (all, part) { return (all += part.value); }, '');\n}\n// Singleton\nvar domParser;\nvar TOKEN_DELIMITER = '@@';\nvar TOKEN_REGEX = /@@(\\d+_\\d+)@@/g;\nvar counter = 0;\nfunction generateId() {\n return Date.now() + \"_\" + ++counter;\n}\nfunction restoreRichPlaceholderMessage(text, objectParts) {\n return text\n .split(TOKEN_REGEX)\n .filter(Boolean)\n .map(function (c) { return (objectParts[c] != null ? objectParts[c] : c); })\n .reduce(function (all, c) {\n if (!all.length) {\n all.push(c);\n }\n else if (typeof c === 'string' &&\n typeof all[all.length - 1] === 'string') {\n all[all.length - 1] += c;\n }\n else {\n all.push(c);\n }\n return all;\n }, []);\n}\n/**\n * Not exhaustive, just for sanity check\n */\nvar SIMPLE_XML_REGEX = /(<([0-9a-zA-Z-_]*?)>(.*?)<\\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\\/>)/;\nvar TEMPLATE_ID = Date.now() + '@@';\nvar VOID_ELEMENTS = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\nfunction formatHTMLElement(el, objectParts, values) {\n var tagName = el.tagName;\n var outerHTML = el.outerHTML, textContent = el.textContent, childNodes = el.childNodes;\n // Regular text\n if (!tagName) {\n return restoreRichPlaceholderMessage(textContent || '', objectParts);\n }\n tagName = tagName.toLowerCase();\n var isVoidElement = ~VOID_ELEMENTS.indexOf(tagName);\n var formatFnOrValue = values[tagName];\n if (formatFnOrValue && isVoidElement) {\n throw new FormatError(tagName + \" is a self-closing tag and can not be used, please use another tag name.\");\n }\n if (!childNodes.length) {\n return [outerHTML];\n }\n var chunks = Array.prototype.slice.call(childNodes).reduce(function (all, child) {\n return all.concat(formatHTMLElement(child, objectParts, values));\n }, []);\n // Legacy HTML\n if (!formatFnOrValue) {\n return __spreadArrays([\"<\" + tagName + \">\"], chunks, [\"\"]);\n }\n // HTML Tag replacement\n if (typeof formatFnOrValue === 'function') {\n return [formatFnOrValue.apply(void 0, chunks)];\n }\n return [formatFnOrValue];\n}\nexport function formatHTMLMessage(els, locales, formatters, formats, values, \n// For debugging\noriginalMessage) {\n var parts = formatToParts(els, locales, formatters, formats, values, undefined, originalMessage);\n var objectParts = {};\n var formattedMessage = parts.reduce(function (all, part) {\n if (part.type === 0 /* literal */) {\n return (all += part.value);\n }\n var id = generateId();\n objectParts[id] = part.value;\n return (all += \"\" + TOKEN_DELIMITER + id + TOKEN_DELIMITER);\n }, '');\n // Not designed to filter out aggressively\n if (!SIMPLE_XML_REGEX.test(formattedMessage)) {\n return restoreRichPlaceholderMessage(formattedMessage, objectParts);\n }\n if (!values) {\n throw new FormatError('Message has placeholders but no values was given');\n }\n if (typeof DOMParser === 'undefined') {\n throw new FormatError('Cannot format XML message without DOMParser');\n }\n if (!domParser) {\n domParser = new DOMParser();\n }\n var content = domParser\n .parseFromString(\"\" + formattedMessage + \"\", 'text/html')\n .getElementById(TEMPLATE_ID);\n if (!content) {\n throw new FormatError(\"Malformed HTML message \" + formattedMessage);\n }\n var tagsToFormat = Object.keys(values).filter(function (varName) { return !!content.getElementsByTagName(varName).length; });\n // No tags to format\n if (!tagsToFormat.length) {\n return restoreRichPlaceholderMessage(formattedMessage, objectParts);\n }\n var caseSensitiveTags = tagsToFormat.filter(function (tagName) { return tagName !== tagName.toLowerCase(); });\n if (caseSensitiveTags.length) {\n throw new FormatError(\"HTML tag must be lowercased but the following tags are not: \" + caseSensitiveTags.join(', '));\n }\n // We're doing this since top node is `` which does not have a formatter\n return Array.prototype.slice\n .call(content.childNodes)\n .reduce(function (all, child) { return all.concat(formatHTMLElement(child, objectParts, values)); }, []);\n}\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { parse } from 'intl-messageformat-parser';\nimport memoizeIntlConstructor from 'intl-format-cache';\nimport { formatToString, formatToParts, formatHTMLMessage, } from './formatters';\n// -- MessageFormat --------------------------------------------------------\nfunction mergeConfig(c1, c2) {\n if (!c2) {\n return c1;\n }\n return __assign(__assign(__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {\n all[k] = __assign(__assign({}, c1[k]), (c2[k] || {}));\n return all;\n }, {}));\n}\nfunction mergeConfigs(defaultConfig, configs) {\n if (!configs) {\n return defaultConfig;\n }\n return Object.keys(defaultConfig).reduce(function (all, k) {\n all[k] = mergeConfig(defaultConfig[k], configs[k]);\n return all;\n }, __assign({}, defaultConfig));\n}\nexport function createDefaultFormatters(cache) {\n if (cache === void 0) { cache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n }; }\n return {\n getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat, cache.number),\n getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat, cache.dateTime),\n getPluralRules: memoizeIntlConstructor(Intl.PluralRules, cache.pluralRules),\n };\n}\nvar IntlMessageFormat = /** @class */ (function () {\n function IntlMessageFormat(message, locales, overrideFormats, opts) {\n var _this = this;\n if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }\n this.formatterCache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n };\n this.format = function (values) {\n return formatToString(_this.ast, _this.locales, _this.formatters, _this.formats, values, _this.message);\n };\n this.formatToParts = function (values) {\n return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);\n };\n this.formatHTMLMessage = function (values) {\n return formatHTMLMessage(_this.ast, _this.locales, _this.formatters, _this.formats, values, _this.message);\n };\n this.resolvedOptions = function () { return ({\n locale: Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],\n }); };\n this.getAst = function () { return _this.ast; };\n if (typeof message === 'string') {\n this.message = message;\n if (!IntlMessageFormat.__parse) {\n throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');\n }\n // Parse string messages into an AST.\n this.ast = IntlMessageFormat.__parse(message, {\n normalizeHashtagInPlural: false,\n });\n }\n else {\n this.ast = message;\n }\n if (!Array.isArray(this.ast)) {\n throw new TypeError('A message must be provided as a String or AST.');\n }\n // Creates a new object with the specified `formats` merged with the default\n // formats.\n this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);\n // Defined first because it's used to build the format pattern.\n this.locales = locales;\n this.formatters =\n (opts && opts.formatters) || createDefaultFormatters(this.formatterCache);\n }\n IntlMessageFormat.defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;\n IntlMessageFormat.__parse = parse;\n // Default format options used as the prototype of the `formats` provided to the\n // constructor. These are used when constructing the internal Intl.NumberFormat\n // and Intl.DateTimeFormat instances.\n IntlMessageFormat.formats = {\n number: {\n currency: {\n style: 'currency',\n },\n percent: {\n style: 'percent',\n },\n },\n date: {\n short: {\n month: 'numeric',\n day: 'numeric',\n year: '2-digit',\n },\n medium: {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n },\n long: {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n full: {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n },\n time: {\n short: {\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n full: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n },\n };\n return IntlMessageFormat;\n}());\nexport { IntlMessageFormat };\nexport default IntlMessageFormat;\n","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nimport IntlMessageFormat from './core';\nexport * from './formatters';\nexport * from './core';\nexport default IntlMessageFormat;\n","/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar decode = decodeURIComponent;\nvar encode = encodeURIComponent;\nvar pairSplitRegExp = /; */;\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var pairs = str.split(pairSplitRegExp);\n var dec = opt.decode || decode;\n\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n continue;\n }\n\n var key = pair.substr(0, eq_idx).trim()\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n if (isNaN(maxAge)) throw new Error('maxAge should be a Number');\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (typeof opt.expires.toUTCString !== 'function') {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./index.production.js');\n} else {\n module.exports = require('./index.development.js');\n}\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});var e={TimePicker:{openButton:\"data-testid TimePicker Open Button\",fromField:\"Time Range from field\",toField:\"Time Range to field\",applyTimeRange:\"data-testid TimePicker submit button\",calendar:{label:\"Time Range calendar\",openButton:\"Open time range calendar\",closeButton:\"Close time range Calendar\"},absoluteTimeRangeTitle:\"data-testid-absolute-time-range-narrow\"},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:\"Test Data Query scenario select container\",scenarioSelect:\"Test Data Query scenario select\",max:\"TestData max\",min:\"TestData min\",noise:\"TestData noise\",seriesCount:\"TestData series count\",spread:\"TestData spread\",startValue:\"TestData start value\",drop:\"TestData drop values\"}},DataSourceHttpSettings:{urlInput:\"Datasource HTTP settings url\"},Jaeger:{traceIDInput:\"Trace ID\"},Prometheus:{configPage:{exemplarsAddButton:\"Add exemplar config button\",internalLinkSwitch:\"Internal link switch\"},exemplarMarker:\"Exemplar marker\"}},Menu:{MenuComponent:function(e){return e+\" menu\"},MenuGroup:function(e){return e+\" menu group\"},MenuItem:function(e){return e+\" menu item\"},SubMenu:{container:\"SubMenu container\",icon:\"SubMenu icon\"}},Panels:{Panel:{title:function(e){return\"data-testid Panel header \"+e},headerItems:function(e){return\"Panel header item \"+e},containerByTitle:function(e){return e+\" panel\"},headerCornerInfo:function(e){return\"Panel header \"+e}},Visualization:{Graph:{VisualizationTab:{legendSection:\"Legend section\"},Legend:{legendItemAlias:function(e){return\"gpl alias \"+e},showLegendSwitch:\"gpl show legend\"},xAxis:{labels:function(){return\"div.flot-x-axis > div.flot-tick-label\"}}},BarGauge:{value:\"Bar gauge value\",valueV2:\"data-testid Bar gauge value\"},PieChart:{svgSlice:\"Pie Chart Slice\"},Text:{container:function(){return\".markdown-html\"}},Table:{header:\"table header\",footer:\"table-footer\"}}},VizLegend:{seriesName:function(e){return\"VizLegend series \"+e}},Drawer:{General:{title:function(e){return\"Drawer title \"+e},expand:\"Drawer expand\",contract:\"Drawer contract\",close:\"Drawer close\",rcContentWrapper:function(){return\".drawer-content-wrapper\"}}},PanelEditor:{General:{content:\"Panel editor content\"},OptionsPane:{content:\"Panel editor option pane content\",select:\"Panel editor option pane select\",fieldLabel:function(e){return e+\" field property editor\"}},DataPane:{content:\"Panel editor data pane content\"},applyButton:\"panel editor apply\",toggleVizPicker:\"toggle-viz-picker\",toggleVizOptions:\"toggle-viz-options\",toggleTableView:\"toggle-table-view\"},PanelInspector:{Data:{content:\"Panel inspector Data content\"},Stats:{content:\"Panel inspector Stats content\"},Json:{content:\"Panel inspector Json content\"},Query:{content:\"Panel inspector Query content\",refreshButton:\"Panel inspector Query refresh button\",jsonObjectKeys:function(){return\".json-formatter-key\"}}},Tab:{title:function(e){return\"Tab \"+e},active:function(){return'[class*=\"-activeTabStyle\"]'}},RefreshPicker:{runButton:\"RefreshPicker run button\",intervalButton:\"RefreshPicker interval button\",runButtonV2:\"data-testid RefreshPicker run button\",intervalButtonV2:\"data-testid RefreshPicker interval button\"},QueryTab:{content:\"Query editor tab content\",queryInspectorButton:\"Query inspector button\",addQuery:\"Query editor add query button\"},QueryEditorRows:{rows:\"Query editor row\"},QueryEditorRow:{actionButton:function(e){return e+\" query operation action\"},title:function(e){return\"Query editor row title \"+e}},AlertTab:{content:\"Alert editor tab content\"},Alert:{alert:function(e){return\"Alert \"+e},alertV2:function(e){return\"data-testid Alert \"+e}},TransformTab:{content:\"Transform editor tab content\",newTransform:function(e){return\"New transform \"+e},transformationEditor:function(e){return\"Transformation editor \"+e},transformationEditorDebugger:function(e){return\"Transformation editor debugger \"+e}},Transforms:{card:function(e){return\"New transform \"+e},Reduce:{modeLabel:\"Transform mode label\",calculationsLabel:\"Transform calculations label\"},searchInput:\"search transformations\"},PageToolbar:{container:function(){return\".page-toolbar\"},item:function(e){return\"\"+e}},QueryEditorToolbarItem:{button:function(e){return\"QueryEditor toolbar item button \"+e}},BackButton:{backArrow:\"Go Back\"},OptionsGroup:{group:function(e){return e?\"Options group \"+e:\"Options group\"},toggle:function(e){return e?\"Options group \"+e+\" toggle\":\"Options group toggle\"}},PluginVisualization:{item:function(e){return\"Plugin visualization item \"+e},current:function(){return'[class*=\"-currentVisualizationItem\"]'}},Select:{option:\"Select option\",input:function(){return'input[id*=\"time-options-input\"]'},singleValue:function(){return'div[class*=\"-singleValue\"]'}},FieldConfigEditor:{content:\"Field config editor content\"},OverridesConfigEditor:{content:\"Field overrides editor content\"},FolderPicker:{container:\"Folder picker select container\",containerV2:\"data-testid Folder picker select container\",input:\"Select a folder\"},ReadonlyFolderPicker:{container:\"data-testid Readonly folder picker select container\"},DataSourcePicker:{container:\"Data source picker select container\",input:function(){return'input[id=\"data-source-picker\"]'},inputV2:\"Select a data source\"},TimeZonePicker:{container:\"Time zone picker select container\",containerV2:\"data-testid Time zone picker select container\"},WeekStartPicker:{container:\"Choose starting day of the week\",containerV2:\"data-testid Choose starting day of the week\",placeholder:\"Choose starting day of the week\"},TraceViewer:{spanBar:function(){return'[data-test-id=\"SpanBar--wrapper\"]'}},QueryField:{container:\"Query field\"},ValuePicker:{button:function(e){return\"Value picker button \"+e},select:function(e){return\"Value picker select \"+e}},Search:{section:\"Search section\",sectionV2:\"data-testid Search section\",items:\"Search items\",itemsV2:\"data-testid Search items\",cards:\"data-testid Search cards\",collapseFolder:function(e){return\"data-testid Collapse folder \"+e},expandFolder:function(e){return\"data-testid Expand folder \"+e},dashboardItem:function(t){return e.Search.dashboardItems+\" \"+t},dashboardCard:function(e){return\"data-testid Search card \"+e},dashboardItems:\"data-testid Dashboard search item\"},DashboardLinks:{container:\"data-testid Dashboard link container\",dropDown:\"data-testid Dashboard link dropdown\",link:\"data-testid Dashboard link\"},LoadingIndicator:{icon:\"Loading indicator\"},CallToActionCard:{button:function(e){return\"Call to action button \"+e},buttonV2:function(e){return\"data-testid Call to action button \"+e}},DataLinksContextMenu:{singleLink:\"Data link\"},CodeEditor:{container:\"Code editor container\"},DashboardImportPage:{textarea:\"data-testid-import-dashboard-textarea\",submit:\"data-testid-load-dashboard\"},ImportDashboardForm:{name:\"data-testid-import-dashboard-title\",submit:\"data-testid-import-dashboard-submit\"},PanelAlertTabContent:{content:\"Unified alert editor tab content\"},VisualizationPreview:{card:function(e){return\"data-testid suggestion-\"+e}},ColorSwatch:{name:\"data-testid-colorswatch\"},DashboardRow:{title:function(e){return\"data-testid dashboard-row-title-\"+e}},UserProfile:{profileSaveButton:\"data-testid-user-profile-save\",preferencesSaveButton:\"data-testid-shared-prefs-save\",orgsTable:\"data-testid-user-orgs-table\",sessionsTable:\"data-testid-user-sessions-table\"}},t={Login:{url:\"/login\",username:\"Username input field\",password:\"Password input field\",submit:\"Login button\",skip:\"Skip change password button\"},Home:{url:\"/\"},DataSource:{name:\"Data source settings page name input field\",delete:\"Data source settings page Delete button\",readOnly:\"Data source settings page read only message\",saveAndTest:\"Data source settings page Save and Test button\",alert:\"Data source settings page Alert\"},DataSources:{url:\"/datasources\",dataSources:function(e){return\"Data source list item \"+e}},AddDataSource:{url:\"/datasources/new\",dataSourcePlugins:function(e){return\"Data source plugin item \"+e},dataSourcePluginsV2:function(e){return\"Add data source \"+e}},ConfirmModal:{delete:\"Confirm Modal Danger Button\"},AddDashboard:{url:\"/dashboard/new\",addNewPanel:\"Add new panel\",addNewRow:\"Add new row\",addNewPanelLibrary:\"Add new panel from panel library\"},Dashboard:{url:function(e){return\"/d/\"+e},DashNav:{nav:\"Dashboard navigation\",navV2:\"data-testid Dashboard navigation\"},SubMenu:{submenu:\"Dashboard submenu\",submenuItem:\"data-testid template variable\",submenuItemLabels:function(e){return\"data-testid Dashboard template variables submenu Label \"+e},submenuItemValueDropDownValueLinkTexts:function(e){return\"data-testid Dashboard template variables Variable Value DropDown value link text \"+e},submenuItemValueDropDownDropDown:\"Variable options\",submenuItemValueDropDownOptionTexts:function(e){return\"data-testid Dashboard template variables Variable Value DropDown option text \"+e}},Settings:{General:{deleteDashBoard:\"Dashboard settings page delete dashboard button\",sectionItems:function(e){return\"Dashboard settings section item \"+e},saveDashBoard:\"Dashboard settings aside actions Save button\",saveAsDashBoard:\"Dashboard settings aside actions Save As button\",timezone:\"Time zone picker select container\",title:\"Dashboard settings page title\"},Annotations:{List:{addAnnotationCTA:e.CallToActionCard.button(\"Add annotation query\"),addAnnotationCTAV2:e.CallToActionCard.buttonV2(\"Add annotation query\")},Settings:{name:\"Annotations settings name input\"}},Variables:{List:{addVariableCTA:e.CallToActionCard.button(\"Add variable\"),addVariableCTAV2:e.CallToActionCard.buttonV2(\"Add variable\"),newButton:\"Variable editor New variable button\",table:\"Variable editor Table\",tableRowNameFields:function(e){return\"Variable editor Table Name field \"+e},tableRowDefinitionFields:function(e){return\"Variable editor Table Definition field \"+e},tableRowArrowUpButtons:function(e){return\"Variable editor Table ArrowUp button \"+e},tableRowArrowDownButtons:function(e){return\"Variable editor Table ArrowDown button \"+e},tableRowDuplicateButtons:function(e){return\"Variable editor Table Duplicate button \"+e},tableRowRemoveButtons:function(e){return\"Variable editor Table Remove button \"+e}},Edit:{General:{headerLink:\"Variable editor Header link\",modeLabelNew:\"Variable editor Header mode New\",modeLabelEdit:\"Variable editor Header mode Edit\",generalNameInput:\"Variable editor Form Name field\",generalTypeSelect:\"Variable editor Form Type select\",generalLabelInput:\"Variable editor Form Label field\",generalHideSelect:\"Variable editor Form Hide select\",selectionOptionsMultiSwitch:\"Variable editor Form Multi switch\",selectionOptionsIncludeAllSwitch:\"Variable editor Form IncludeAll switch\",selectionOptionsCustomAllInput:\"Variable editor Form IncludeAll field\",previewOfValuesOption:\"Variable editor Preview of Values option\",submitButton:\"Variable editor Submit button\"},QueryVariable:{queryOptionsDataSourceSelect:e.DataSourcePicker.container,queryOptionsRefreshSelect:\"Variable editor Form Query Refresh select\",queryOptionsRegExInput:\"Variable editor Form Query RegEx field\",queryOptionsSortSelect:\"Variable editor Form Query Sort select\",queryOptionsQueryInput:\"Variable editor Form Default Variable Query Editor textarea\",valueGroupsTagsEnabledSwitch:\"Variable editor Form Query UseTags switch\",valueGroupsTagsTagsQueryInput:\"Variable editor Form Query TagsQuery field\",valueGroupsTagsTagsValuesQueryInput:\"Variable editor Form Query TagsValuesQuery field\"},ConstantVariable:{constantOptionsQueryInput:\"Variable editor Form Constant Query field\"},TextBoxVariable:{textBoxOptionsQueryInput:\"Variable editor Form TextBox Query field\"}}}}},Dashboards:{url:\"/dashboards\",dashboards:function(e){return\"Dashboard search item \"+e}},SaveDashboardAsModal:{newName:\"Save dashboard title field\",save:\"Save dashboard button\"},SaveDashboardModal:{save:\"Dashboard settings Save Dashboard Modal Save button\",saveVariables:\"Dashboard settings Save Dashboard Modal Save variables checkbox\",saveTimerange:\"Dashboard settings Save Dashboard Modal Save timerange checkbox\"},SharePanelModal:{linkToRenderedImage:\"Link to rendered image\"},Explore:{url:\"/explore\",General:{container:\"data-testid Explore\",graph:\"Explore Graph\",table:\"Explore Table\",scrollBar:function(){return\".scrollbar-view\"}}},SoloPanel:{url:function(e){return\"/d-solo/\"+e}},PluginsList:{page:\"Plugins list page\",list:\"Plugins list\",listItem:\"Plugins list item\",signatureErrorNotice:\"Unsigned plugins notice\"},PluginPage:{page:\"Plugin page\",signatureInfo:\"Plugin signature info\",disabledInfo:\"Plugin disabled info\"},PlaylistForm:{name:\"Playlist name\",interval:\"Playlist interval\",itemRow:\"Playlist item row\",itemIdType:\"Playlist item dashboard by ID type\",itemTagType:\"Playlist item dashboard by Tag type\",itemMoveUp:\"Move playlist item order up\",itemMoveDown:\"Move playlist item order down\",itemDelete:\"Delete playlist item\"}},a={pages:t,components:e};exports.Components=e,exports.Pages=t,exports.selectors=a;\n//# sourceMappingURL=index.production.js.map\n","module.exports = __WEBPACK_EXTERNAL_MODULE__29__;","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\n// TYPES\n// UTILS\nexport var isServer = typeof window === 'undefined';\nexport function noop() {\n return undefined;\n}\nexport function functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nexport function isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nexport function ensureQueryKeyArray(value) {\n return Array.isArray(value) ? value : [value];\n}\nexport function difference(array1, array2) {\n return array1.filter(function (x) {\n return array2.indexOf(x) === -1;\n });\n}\nexport function replaceAt(array, index, value) {\n var copy = array.slice(0);\n copy[index] = value;\n return copy;\n}\nexport function timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nexport function parseQueryArgs(arg1, arg2, arg3) {\n if (!isQueryKey(arg1)) {\n return arg1;\n }\n\n if (typeof arg2 === 'function') {\n return _extends({}, arg3, {\n queryKey: arg1,\n queryFn: arg2\n });\n }\n\n return _extends({}, arg2, {\n queryKey: arg1\n });\n}\nexport function parseMutationArgs(arg1, arg2, arg3) {\n if (isQueryKey(arg1)) {\n if (typeof arg2 === 'function') {\n return _extends({}, arg3, {\n mutationKey: arg1,\n mutationFn: arg2\n });\n }\n\n return _extends({}, arg2, {\n mutationKey: arg1\n });\n }\n\n if (typeof arg1 === 'function') {\n return _extends({}, arg2, {\n mutationFn: arg1\n });\n }\n\n return _extends({}, arg1);\n}\nexport function parseFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [_extends({}, arg2, {\n queryKey: arg1\n }), arg3] : [arg1 || {}, arg2];\n}\nexport function parseMutationFilterArgs(arg1, arg2) {\n return isQueryKey(arg1) ? _extends({}, arg2, {\n mutationKey: arg1\n }) : arg1;\n}\nexport function mapQueryStatusFilter(active, inactive) {\n if (active === true && inactive === true || active == null && inactive == null) {\n return 'all';\n } else if (active === false && inactive === false) {\n return 'none';\n } else {\n // At this point, active|inactive can only be true|false or false|true\n // so, when only one value is provided, the missing one has to be the negated value\n var isActive = active != null ? active : !inactive;\n return isActive ? 'active' : 'inactive';\n }\n}\nexport function matchQuery(filters, query) {\n var active = filters.active,\n exact = filters.exact,\n fetching = filters.fetching,\n inactive = filters.inactive,\n predicate = filters.predicate,\n queryKey = filters.queryKey,\n stale = filters.stale;\n\n if (isQueryKey(queryKey)) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n\n var queryStatusFilter = mapQueryStatusFilter(active, inactive);\n\n if (queryStatusFilter === 'none') {\n return false;\n } else if (queryStatusFilter !== 'all') {\n var isActive = query.isActive();\n\n if (queryStatusFilter === 'active' && !isActive) {\n return false;\n }\n\n if (queryStatusFilter === 'inactive' && isActive) {\n return false;\n }\n }\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n if (typeof fetching === 'boolean' && query.isFetching() !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(query)) {\n return false;\n }\n\n return true;\n}\nexport function matchMutation(filters, mutation) {\n var exact = filters.exact,\n fetching = filters.fetching,\n predicate = filters.predicate,\n mutationKey = filters.mutationKey;\n\n if (isQueryKey(mutationKey)) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n\n if (exact) {\n if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n\n if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(mutation)) {\n return false;\n }\n\n return true;\n}\nexport function hashQueryKeyByOptions(queryKey, options) {\n var hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;\n return hashFn(queryKey);\n}\n/**\n * Default query keys hash function.\n */\n\nexport function hashQueryKey(queryKey) {\n var asArray = ensureQueryKeyArray(queryKey);\n return stableValueHash(asArray);\n}\n/**\n * Hashes the value into a stable hash.\n */\n\nexport function stableValueHash(value) {\n return JSON.stringify(value, function (_, val) {\n return isPlainObject(val) ? Object.keys(val).sort().reduce(function (result, key) {\n result[key] = val[key];\n return result;\n }, {}) : val;\n });\n}\n/**\n * Checks if key `b` partially matches with key `a`.\n */\n\nexport function partialMatchKey(a, b) {\n return partialDeepEqual(ensureQueryKeyArray(a), ensureQueryKeyArray(b));\n}\n/**\n * Checks if `b` partially matches with `a`.\n */\n\nexport function partialDeepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n return !Object.keys(b).some(function (key) {\n return !partialDeepEqual(a[key], b[key]);\n });\n }\n\n return false;\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nexport function replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n var array = Array.isArray(a) && Array.isArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n var aSize = array ? a.length : Object.keys(a).length;\n var bItems = array ? b : Object.keys(b);\n var bSize = bItems.length;\n var copy = array ? [] : {};\n var equalItems = 0;\n\n for (var i = 0; i < bSize; i++) {\n var key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n}\n/**\n * Shallow compare objects. Only works with objects that always have the same properties.\n */\n\nexport function shallowEqualObjects(a, b) {\n if (a && !b || b && !a) {\n return false;\n }\n\n for (var key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n\n return true;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nexport function isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n var ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n var prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isQueryKey(value) {\n return typeof value === 'string' || Array.isArray(value);\n}\nexport function isError(value) {\n return value instanceof Error;\n}\nexport function sleep(timeout) {\n return new Promise(function (resolve) {\n setTimeout(resolve, timeout);\n });\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nexport function scheduleMicrotask(callback) {\n Promise.resolve().then(callback).catch(function (error) {\n return setTimeout(function () {\n throw error;\n });\n });\n}\nexport function getAbortController() {\n if (typeof AbortController === 'function') {\n return new AbortController();\n }\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import { focusManager } from './focusManager';\nimport { onlineManager } from './onlineManager';\nimport { sleep } from './utils';\n\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1000 * Math.pow(2, failureCount), 30000);\n}\n\nexport function isCancelable(value) {\n return typeof (value == null ? void 0 : value.cancel) === 'function';\n}\nexport var CancelledError = function CancelledError(options) {\n this.revert = options == null ? void 0 : options.revert;\n this.silent = options == null ? void 0 : options.silent;\n};\nexport function isCancelledError(value) {\n return value instanceof CancelledError;\n} // CLASS\n\nexport var Retryer = function Retryer(config) {\n var _this = this;\n\n var cancelRetry = false;\n var cancelFn;\n var continueFn;\n var promiseResolve;\n var promiseReject;\n this.abort = config.abort;\n\n this.cancel = function (cancelOptions) {\n return cancelFn == null ? void 0 : cancelFn(cancelOptions);\n };\n\n this.cancelRetry = function () {\n cancelRetry = true;\n };\n\n this.continueRetry = function () {\n cancelRetry = false;\n };\n\n this.continue = function () {\n return continueFn == null ? void 0 : continueFn();\n };\n\n this.failureCount = 0;\n this.isPaused = false;\n this.isResolved = false;\n this.isTransportCancelable = false;\n this.promise = new Promise(function (outerResolve, outerReject) {\n promiseResolve = outerResolve;\n promiseReject = outerReject;\n });\n\n var resolve = function resolve(value) {\n if (!_this.isResolved) {\n _this.isResolved = true;\n config.onSuccess == null ? void 0 : config.onSuccess(value);\n continueFn == null ? void 0 : continueFn();\n promiseResolve(value);\n }\n };\n\n var reject = function reject(value) {\n if (!_this.isResolved) {\n _this.isResolved = true;\n config.onError == null ? void 0 : config.onError(value);\n continueFn == null ? void 0 : continueFn();\n promiseReject(value);\n }\n };\n\n var pause = function pause() {\n return new Promise(function (continueResolve) {\n continueFn = continueResolve;\n _this.isPaused = true;\n config.onPause == null ? void 0 : config.onPause();\n }).then(function () {\n continueFn = undefined;\n _this.isPaused = false;\n config.onContinue == null ? void 0 : config.onContinue();\n });\n }; // Create loop function\n\n\n var run = function run() {\n // Do nothing if already resolved\n if (_this.isResolved) {\n return;\n }\n\n var promiseOrValue; // Execute query\n\n try {\n promiseOrValue = config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n } // Create callback to cancel this fetch\n\n\n cancelFn = function cancelFn(cancelOptions) {\n if (!_this.isResolved) {\n reject(new CancelledError(cancelOptions));\n _this.abort == null ? void 0 : _this.abort(); // Cancel transport if supported\n\n if (isCancelable(promiseOrValue)) {\n try {\n promiseOrValue.cancel();\n } catch (_unused) {}\n }\n }\n }; // Check if the transport layer support cancellation\n\n\n _this.isTransportCancelable = isCancelable(promiseOrValue);\n Promise.resolve(promiseOrValue).then(resolve).catch(function (error) {\n var _config$retry, _config$retryDelay;\n\n // Stop if the fetch is already resolved\n if (_this.isResolved) {\n return;\n } // Do we need to retry the request?\n\n\n var retry = (_config$retry = config.retry) != null ? _config$retry : 3;\n var retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;\n var delay = typeof retryDelay === 'function' ? retryDelay(_this.failureCount, error) : retryDelay;\n var shouldRetry = retry === true || typeof retry === 'number' && _this.failureCount < retry || typeof retry === 'function' && retry(_this.failureCount, error);\n\n if (cancelRetry || !shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n }\n\n _this.failureCount++; // Notify on fail\n\n config.onFail == null ? void 0 : config.onFail(_this.failureCount, error); // Delay\n\n sleep(delay) // Pause if the document is not visible or when the device is offline\n .then(function () {\n if (!focusManager.isFocused() || !onlineManager.isOnline()) {\n return pause();\n }\n }).then(function () {\n if (cancelRetry) {\n reject(error);\n } else {\n run();\n }\n });\n });\n }; // Start loop\n\n\n run();\n};","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { Subscribable } from './subscribable';\nimport { isServer } from './utils';\nexport var FocusManager = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(FocusManager, _Subscribable);\n\n function FocusManager() {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n\n _this.setup = function (onFocus) {\n var _window;\n\n if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {\n var listener = function listener() {\n return onFocus();\n }; // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', listener, false);\n window.addEventListener('focus', listener, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener);\n window.removeEventListener('focus', listener);\n };\n }\n };\n\n return _this;\n }\n\n var _proto = FocusManager.prototype;\n\n _proto.onSubscribe = function onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n };\n\n _proto.setEventListener = function setEventListener(setup) {\n var _this$cleanup2,\n _this2 = this;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(function (focused) {\n if (typeof focused === 'boolean') {\n _this2.setFocused(focused);\n } else {\n _this2.onFocus();\n }\n });\n };\n\n _proto.setFocused = function setFocused(focused) {\n this.focused = focused;\n\n if (focused) {\n this.onFocus();\n }\n };\n\n _proto.onFocus = function onFocus() {\n this.listeners.forEach(function (listener) {\n listener();\n });\n };\n\n _proto.isFocused = function isFocused() {\n if (typeof this.focused === 'boolean') {\n return this.focused;\n } // document global can be unavailable in react native\n\n\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n };\n\n return FocusManager;\n}(Subscribable);\nexport var focusManager = new FocusManager();","export var Subscribable = /*#__PURE__*/function () {\n function Subscribable() {\n this.listeners = [];\n }\n\n var _proto = Subscribable.prototype;\n\n _proto.subscribe = function subscribe(listener) {\n var _this = this;\n\n var callback = listener || function () {\n return undefined;\n };\n\n this.listeners.push(callback);\n this.onSubscribe();\n return function () {\n _this.listeners = _this.listeners.filter(function (x) {\n return x !== callback;\n });\n\n _this.onUnsubscribe();\n };\n };\n\n _proto.hasListeners = function hasListeners() {\n return this.listeners.length > 0;\n };\n\n _proto.onSubscribe = function onSubscribe() {// Do nothing\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {// Do nothing\n };\n\n return Subscribable;\n}();","import _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport { Subscribable } from './subscribable';\nimport { isServer } from './utils';\nexport var OnlineManager = /*#__PURE__*/function (_Subscribable) {\n _inheritsLoose(OnlineManager, _Subscribable);\n\n function OnlineManager() {\n var _this;\n\n _this = _Subscribable.call(this) || this;\n\n _this.setup = function (onOnline) {\n var _window;\n\n if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {\n var listener = function listener() {\n return onOnline();\n }; // Listen to online\n\n\n window.addEventListener('online', listener, false);\n window.addEventListener('offline', listener, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', listener);\n window.removeEventListener('offline', listener);\n };\n }\n };\n\n return _this;\n }\n\n var _proto = OnlineManager.prototype;\n\n _proto.onSubscribe = function onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n };\n\n _proto.onUnsubscribe = function onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n };\n\n _proto.setEventListener = function setEventListener(setup) {\n var _this$cleanup2,\n _this2 = this;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(function (online) {\n if (typeof online === 'boolean') {\n _this2.setOnline(online);\n } else {\n _this2.onOnline();\n }\n });\n };\n\n _proto.setOnline = function setOnline(online) {\n this.online = online;\n\n if (online) {\n this.onOnline();\n }\n };\n\n _proto.onOnline = function onOnline() {\n this.listeners.forEach(function (listener) {\n listener();\n });\n };\n\n _proto.isOnline = function isOnline() {\n if (typeof this.online === 'boolean') {\n return this.online;\n }\n\n if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {\n return true;\n }\n\n return navigator.onLine;\n };\n\n return OnlineManager;\n}(Subscribable);\nexport var onlineManager = new OnlineManager();","// TYPES\n// FUNCTIONS\nvar logger = console;\nexport function getLogger() {\n return logger;\n}\nexport function setLogger(newLogger) {\n logger = newLogger;\n}","import { scheduleMicrotask } from './utils'; // TYPES\n\n// CLASS\nexport var NotifyManager = /*#__PURE__*/function () {\n function NotifyManager() {\n this.queue = [];\n this.transactions = 0;\n\n this.notifyFn = function (callback) {\n callback();\n };\n\n this.batchNotifyFn = function (callback) {\n callback();\n };\n }\n\n var _proto = NotifyManager.prototype;\n\n _proto.batch = function batch(callback) {\n var result;\n this.transactions++;\n\n try {\n result = callback();\n } finally {\n this.transactions--;\n\n if (!this.transactions) {\n this.flush();\n }\n }\n\n return result;\n };\n\n _proto.schedule = function schedule(callback) {\n var _this = this;\n\n if (this.transactions) {\n this.queue.push(callback);\n } else {\n scheduleMicrotask(function () {\n _this.notifyFn(callback);\n });\n }\n }\n /**\n * All calls to the wrapped function will be batched.\n */\n ;\n\n _proto.batchCalls = function batchCalls(callback) {\n var _this2 = this;\n\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this2.schedule(function () {\n callback.apply(void 0, args);\n });\n };\n };\n\n _proto.flush = function flush() {\n var _this3 = this;\n\n var queue = this.queue;\n this.queue = [];\n\n if (queue.length) {\n scheduleMicrotask(function () {\n _this3.batchNotifyFn(function () {\n queue.forEach(function (callback) {\n _this3.notifyFn(callback);\n });\n });\n });\n }\n }\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n ;\n\n _proto.setNotifyFunction = function setNotifyFunction(fn) {\n this.notifyFn = fn;\n }\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n ;\n\n _proto.setBatchNotifyFunction = function setBatchNotifyFunction(fn) {\n this.batchNotifyFn = fn;\n };\n\n return NotifyManager;\n}(); // SINGLETON\n\nexport var notifyManager = new NotifyManager();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getLogger } from './logger';\nimport { notifyManager } from './notifyManager';\nimport { Retryer } from './retryer';\nimport { noop } from './utils'; // TYPES\n\n// CLASS\nexport var Mutation = /*#__PURE__*/function () {\n function Mutation(config) {\n this.options = _extends({}, config.defaultOptions, config.options);\n this.mutationId = config.mutationId;\n this.mutationCache = config.mutationCache;\n this.observers = [];\n this.state = config.state || getDefaultState();\n this.meta = config.meta;\n }\n\n var _proto = Mutation.prototype;\n\n _proto.setState = function setState(state) {\n this.dispatch({\n type: 'setState',\n state: state\n });\n };\n\n _proto.addObserver = function addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer);\n }\n };\n\n _proto.removeObserver = function removeObserver(observer) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n };\n\n _proto.cancel = function cancel() {\n if (this.retryer) {\n this.retryer.cancel();\n return this.retryer.promise.then(noop).catch(noop);\n }\n\n return Promise.resolve();\n };\n\n _proto.continue = function _continue() {\n if (this.retryer) {\n this.retryer.continue();\n return this.retryer.promise;\n }\n\n return this.execute();\n };\n\n _proto.execute = function execute() {\n var _this = this;\n\n var data;\n var restored = this.state.status === 'loading';\n var promise = Promise.resolve();\n\n if (!restored) {\n this.dispatch({\n type: 'loading',\n variables: this.options.variables\n });\n promise = promise.then(function () {\n // Notify cache callback\n _this.mutationCache.config.onMutate == null ? void 0 : _this.mutationCache.config.onMutate(_this.state.variables, _this);\n }).then(function () {\n return _this.options.onMutate == null ? void 0 : _this.options.onMutate(_this.state.variables);\n }).then(function (context) {\n if (context !== _this.state.context) {\n _this.dispatch({\n type: 'loading',\n context: context,\n variables: _this.state.variables\n });\n }\n });\n }\n\n return promise.then(function () {\n return _this.executeMutation();\n }).then(function (result) {\n data = result; // Notify cache callback\n\n _this.mutationCache.config.onSuccess == null ? void 0 : _this.mutationCache.config.onSuccess(data, _this.state.variables, _this.state.context, _this);\n }).then(function () {\n return _this.options.onSuccess == null ? void 0 : _this.options.onSuccess(data, _this.state.variables, _this.state.context);\n }).then(function () {\n return _this.options.onSettled == null ? void 0 : _this.options.onSettled(data, null, _this.state.variables, _this.state.context);\n }).then(function () {\n _this.dispatch({\n type: 'success',\n data: data\n });\n\n return data;\n }).catch(function (error) {\n // Notify cache callback\n _this.mutationCache.config.onError == null ? void 0 : _this.mutationCache.config.onError(error, _this.state.variables, _this.state.context, _this); // Log error\n\n getLogger().error(error);\n return Promise.resolve().then(function () {\n return _this.options.onError == null ? void 0 : _this.options.onError(error, _this.state.variables, _this.state.context);\n }).then(function () {\n return _this.options.onSettled == null ? void 0 : _this.options.onSettled(undefined, error, _this.state.variables, _this.state.context);\n }).then(function () {\n _this.dispatch({\n type: 'error',\n error: error\n });\n\n throw error;\n });\n });\n };\n\n _proto.executeMutation = function executeMutation() {\n var _this2 = this,\n _this$options$retry;\n\n this.retryer = new Retryer({\n fn: function fn() {\n if (!_this2.options.mutationFn) {\n return Promise.reject('No mutationFn found');\n }\n\n return _this2.options.mutationFn(_this2.state.variables);\n },\n onFail: function onFail() {\n _this2.dispatch({\n type: 'failed'\n });\n },\n onPause: function onPause() {\n _this2.dispatch({\n type: 'pause'\n });\n },\n onContinue: function onContinue() {\n _this2.dispatch({\n type: 'continue'\n });\n },\n retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,\n retryDelay: this.options.retryDelay\n });\n return this.retryer.promise;\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this3 = this;\n\n this.state = reducer(this.state, action);\n notifyManager.batch(function () {\n _this3.observers.forEach(function (observer) {\n observer.onMutationUpdate(action);\n });\n\n _this3.mutationCache.notify(_this3);\n });\n };\n\n return Mutation;\n}();\nexport function getDefaultState() {\n return {\n context: undefined,\n data: undefined,\n error: null,\n failureCount: 0,\n isPaused: false,\n status: 'idle',\n variables: undefined\n };\n}\n\nfunction reducer(state, action) {\n switch (action.type) {\n case 'failed':\n return _extends({}, state, {\n failureCount: state.failureCount + 1\n });\n\n case 'pause':\n return _extends({}, state, {\n isPaused: true\n });\n\n case 'continue':\n return _extends({}, state, {\n isPaused: false\n });\n\n case 'loading':\n return _extends({}, state, {\n context: action.context,\n data: undefined,\n error: null,\n isPaused: false,\n status: 'loading',\n variables: action.variables\n });\n\n case 'success':\n return _extends({}, state, {\n data: action.data,\n error: null,\n status: 'success',\n isPaused: false\n });\n\n case 'error':\n return _extends({}, state, {\n data: undefined,\n error: action.error,\n failureCount: state.failureCount + 1,\n isPaused: false,\n status: 'error'\n });\n\n case 'setState':\n return _extends({}, state, action.state);\n\n default:\n return state;\n }\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","import React, { useContext } from 'react';\nimport { AppRootProps } from '@grafana/data';\n\n// This is used to be able to retrieve the root plugin props anywhere inside the app.\nconst PluginPropsContext = React.createContext(null);\n\nconst usePluginProps = () => {\n const pluginProps = useContext(PluginPropsContext);\n return pluginProps;\n};\n\nconst usePluginMeta = () => {\n const pluginProps = usePluginProps();\n return pluginProps?.meta;\n};\n\nexport { PluginPropsContext, usePluginProps, usePluginMeta };\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import { getBackendSrv } from '@grafana/runtime';\nimport { User } from 'types';\n\nexport const getUsers = (datasourceID: number): Promise => {\n return getBackendSrv()\n .post('/api/ds/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: 'SELECT id, name, first_name, last_name, e_mail FROM \"user\"',\n format: 'table',\n },\n ],\n })\n .then((result) => {\n const frames = result.results.A.frames[0];\n\n const {\n schema: { fields },\n data: { values },\n } = frames;\n\n const columnsToExtract = ['id', 'name', 'first_name', 'last_name', 'e_mail'];\n\n const indexes = fields.reduce((acc: number[], { name }: any, i: number) => {\n if (columnsToExtract.includes(name)) {\n return [...acc, i];\n }\n return acc;\n }, []);\n\n let results: any = [];\n\n for (let i = 0; i < values[0].length; i++) {\n const myObj: any = {};\n for (let j = 0; j < indexes.length; j++) {\n myObj[fields[indexes[j]].name] = values[j][i];\n }\n results.push(myObj);\n }\n\n return results;\n });\n};\n","import { getBackendSrv } from '@grafana/runtime';\nimport { ReportGroupType } from 'types';\n\nconst getReportGroups = () => getBackendSrv().get('api/plugins/msupplyfoundation-datasource/resources/report-group');\n\nconst createReportGroup = (reportGroup: ReportGroupType) => {\n return getBackendSrv().post(`/api/plugins/msupplyfoundation-datasource/resources/report-group`, reportGroup);\n};\n\nconst getReportGroupByID = (reportGroupID: string) => {\n return getBackendSrv().get(`/api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroupID}`);\n};\n\nconst getReportGroupMembersByGroupID = (reportGroupID: string) => {\n return getBackendSrv().get(\n `/api/plugins/msupplyfoundation-datasource/resources/report-group-membership?&group-id=${reportGroupID}`\n );\n};\n\nconst deleteReportGroup = async (reportGroupID: string) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroupID}`);\n};\n\nexport { createReportGroup, getReportGroups, getReportGroupByID, getReportGroupMembersByGroupID, deleteReportGroup };\n","import { getBackendSrv } from '@grafana/runtime';\n\nexport const getDatasources = async () => {\n return getBackendSrv().get(`./api/datasources`);\n};\n\nexport const getDatasource = async (id: number) => {\n return getBackendSrv().get(`./api/datasources/${id}`);\n};\n","export const panelUsesVariable = (sql: string, variableName: string): boolean => {\n return sql.includes(`\\${${variableName}`) || sql.includes(`\\[[${variableName}]]`);\n};\n\nexport const panelUsesMacro = (sql: string): boolean => {\n const timeToRegEx = RegExp(/\\$__timeTo()/g);\n const timeFromRegEx = RegExp(/\\$__timeFrom()/g);\n const timeFilterRegEx = RegExp(/\\$__timeFilter\\([a-zA-Z-_.]+\\)/g);\n\n return timeToRegEx.test(sql) || timeFromRegEx.test(sql) || timeFilterRegEx.test(sql);\n};\n\nexport const panelUsesUnsupportedMacro = (sql: string) => {\n // Match all macros starting with $__ except supported ones: timeFrom, timeTo, timeFilter\n const regexp = RegExp(/(?!.*\\$__timeFrom\\(\\).*)(?!.*\\$__timeTo\\(\\).*)(?!.*\\$__timeFilter\\(.+\\).*)(\\$__.*)/g);\n return regexp.test(sql);\n};\n","import { SelectableValue } from '@grafana/data';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { DashboardMeta, DashboardResponse, Panel, SelectableVariable, Variable } from 'types';\nimport { panelUsesUnsupportedMacro, panelUsesVariable } from 'utils/checkers.utils';\nimport { getDatasource } from './getDatasource.api';\n\nexport const getPanels = async (datasourceID: number): Promise => {\n const dashboards = (await getDashboards()) ?? [];\n\n const datasource = await getDatasource(datasourceID);\n const { name: datasourceName = '' } = datasource ?? {};\n\n const panels: Panel[] = dashboards\n .filter(({ panels }) => panels?.length > 0)\n .map(({ panels, templating, uid }) => {\n const mappedPanels = panels\n .filter(({ type }) => type === 'table' || type === 'table-old' || type === 'msupplyfoundation-table')\n .map((rawPanel) => {\n const { targets } = rawPanel;\n const [target] = targets;\n const { rawSql } = target;\n\n const { list } = templating;\n\n // Want to filter out any panel which uses variables which aren't supported\n // Supported variables are custom and query types where the query type must\n // use the datasource specified in mSupply App Configuration.\n const unusableVariables = list.filter((variable: Variable) => {\n const { type, datasource: varDatasource } = variable;\n\n if (type === 'datasource' || type === 'adhoc') {\n return true;\n } else if (type === 'query') {\n // Note: Having a strange issue where templating.list.datasource never populates\n if (varDatasource === undefined) {\n return false;\n }\n\n if (typeof varDatasource === 'object' && varDatasource !== null) {\n return varDatasource.type.includes(datasourceName);\n }\n\n return varDatasource !== datasourceName;\n } else {\n return false;\n }\n });\n\n const usesUnusableVariables = unusableVariables.some((variable) => {\n const { name: variableName } = variable;\n return panelUsesVariable(rawSql, variableName);\n });\n\n let error = '';\n if (usesUnusableVariables) {\n error = 'This panel uses an unsupported variable.';\n } else if (panelUsesUnsupportedMacro(rawSql)) {\n error = 'This panel uses an unsupported macro.';\n }\n\n return { ...rawPanel, error };\n })\n .map(({ targets, description, title, id, type, error }) => {\n const [target] = targets;\n const { rawSql } = target;\n\n const dashboardID = uid;\n\n const { list } = templating;\n\n const variables =\n list?.reduce((acc: any, variable: Variable) => {\n if (panelUsesVariable(rawSql, variable.name)) {\n return [...acc, variable];\n } else {\n return acc;\n }\n }, []) ?? [];\n\n const mappedPanel = { error, rawSql, description, title, id, variables, dashboardID, type };\n\n return mappedPanel;\n });\n return mappedPanels;\n })\n .flat();\n\n return panels;\n};\n\nexport const getDashboards = async () => {\n const dashboardMeta = await searchForDashboards();\n const newDashboardMeta = dashboardMeta.filter(({ folderTitle, type }) =>\n type !== 'dash-folder' && !!folderTitle ? folderTitle.toLowerCase() !== 'develop' : true\n );\n const dashboardResponses = await Promise.all(newDashboardMeta.map(({ uid }) => getDashboard(uid)));\n return dashboardResponses.map(({ dashboard }) => dashboard);\n};\n\nexport const getDashboard = async (uuid: string): Promise => {\n return await getBackendSrv().get(`./api/dashboards/uid/${uuid}`);\n};\n\nexport const searchForDashboards = async (): Promise => {\n return await getBackendSrv().get('./api/search');\n};\n\nexport const refreshPanelOptions = async (\n variable: Variable,\n datasourceID: number\n): Promise>> => {\n const { definition, name } = variable;\n\n const optionsResponse = await getBackendSrv().post('/api/ds/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: definition,\n format: 'table',\n },\n ],\n });\n\n const frames = optionsResponse.results.A.frames[0];\n\n const {\n data: { values },\n } = frames;\n\n const rows = values?.flat().map((datum: string) => {\n const selectableVariable = { name, value: datum } as SelectableVariable;\n const selectableValue = { label: datum, value: selectableVariable } as SelectableValue;\n\n return selectableValue;\n });\n\n return rows;\n};\n","import { getBackendSrv } from '@grafana/runtime';\nimport { ScheduleType } from 'types';\n\nconst getSchedules = () => getBackendSrv().get('api/plugins/msupplyfoundation-datasource/resources/schedule');\n\nconst createSchedule = (schedule: ScheduleType) => {\n return getBackendSrv().post(`/api/plugins/msupplyfoundation-datasource/resources/schedule`, schedule);\n};\n\nconst deleteSchedule = async (scheduleID: string) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/schedule/${scheduleID}`);\n};\n\nconst getScheduleByID = (scheduleID: string) => {\n return getBackendSrv().get(`/api/plugins/msupplyfoundation-datasource/resources/schedule/${scheduleID}`);\n};\n\nexport { createSchedule, getSchedules, deleteSchedule, getScheduleByID };\n","import { getBackendSrv } from '@grafana/runtime';\n\nconst sendTestEmail = (scheduleID: string) =>\n getBackendSrv().get(`api/plugins/msupplyfoundation-datasource/resources/test-email?schedule-id=${scheduleID}`);\n\nexport { sendTestEmail };\n","import { getSettings } from '../api/getSettings.api';\nimport { useQuery } from 'react-query';\nimport { usePluginMeta } from 'context';\n\nexport const useDatasourceID = (): number => {\n const pluginMeta = usePluginMeta();\n\n const { data: settings } = useQuery('settings', () => getSettings(pluginMeta?.id), {\n refetchOnWindowFocus: false,\n });\n\n const { jsonData } = settings ?? {};\n const { datasourceID } = jsonData ?? {};\n\n return datasourceID;\n};\n","import { getBackendSrv } from '@grafana/runtime';\n\nconst getSettings = async (id: any) => {\n return getBackendSrv().get(`/api/plugins/${id}/settings`);\n};\n\nexport { getSettings };\n","import { useCallback, useState } from 'react';\n\nconst useToggle: (initial: boolean) => [boolean, () => void] = (initial: boolean) => {\n const [toggle, setToggle] = useState(initial);\n\n const onToggle = useCallback(() => {\n setToggle((state) => !state);\n }, [setToggle]);\n\n return [toggle, onToggle];\n};\n\nexport { useToggle };\n","import pluginJson from './plugin.json';\nimport { NavItem } from './types';\nimport intl from 'react-intl-universal';\nimport { SelectableValue } from '@grafana/data';\n\nexport const PLUGIN_ID = `${pluginJson.id}`;\nexport const PLUGIN_BASE_URL = `/a/${PLUGIN_ID}`;\n\nexport enum ROUTES {\n REPORT_GROUP = 'report-groups',\n SCHEDULES = 'schedules',\n}\n\nexport const NAVIGATION_TITLE = 'Excel report e-mail scheduler';\nexport const NAVIGATION_SUBTITLE = `Generate Excel reports from mSupply dashboard. Send the reports to custom created user-groups on pre-defined schedule.`;\n\n// Add a navigation item for each route you would like to display in the navigation bar\nexport const NAVIGATION: Record = {\n [ROUTES.REPORT_GROUP]: {\n id: ROUTES.REPORT_GROUP,\n text: 'Report Groups',\n sub: 'Contain users to whom email reports would sent',\n icon: 'users-alt',\n url: `${PLUGIN_BASE_URL}/report-groups`,\n },\n [ROUTES.SCHEDULES]: {\n id: ROUTES.SCHEDULES,\n text: 'Schedules',\n sub: \"Schedules to send emails with selected panels's data to the selected user groups\",\n icon: 'schedule',\n url: `${PLUGIN_BASE_URL}/schedules`,\n },\n};\n\nexport const getIntervals = () => [\n { label: intl.get('daily'), value: 0 },\n { label: intl.get('weekly'), value: 1 },\n { label: intl.get('fortnightly'), value: 2 },\n { label: intl.get('monthly'), value: 3 },\n { label: intl.get('quarterly'), value: 4 },\n { label: intl.get('yearly'), value: 5 },\n];\n\nexport const getWeekDays = () => [\n { label: intl.get('sunday'), value: 0 },\n { label: intl.get('monday'), value: 1 },\n { label: intl.get('tuesday'), value: 2 },\n { label: intl.get('wednesday'), value: 3 },\n { label: intl.get('thursday'), value: 4 },\n { label: intl.get('friday'), value: 5 },\n { label: intl.get('saturday'), value: 6 },\n];\n\nexport const getLookbacks = (): Array> => [\n { label: intl.get('1day'), value: 'now-1d' },\n { label: intl.get('2days'), value: 'now-2d' },\n { label: intl.get('3days'), value: 'now-3d' },\n { label: intl.get('1week'), value: 'now-1w' },\n { label: intl.get('2weeks'), value: 'now-2w' },\n { label: intl.get('4weeks'), value: 'now-4w' },\n { label: intl.get('3months'), value: 'now-3M' },\n { label: intl.get('6months'), value: 'now-6M' },\n { label: intl.get('1year'), value: 'now-1y' },\n];\n","// Prefixes the route with the base URL of the plugin\nimport { PLUGIN_BASE_URL } from '../../constants';\n\nfunction prefixRoute(route: string): string {\n return `${PLUGIN_BASE_URL}/${route}`;\n}\n\nexport { prefixRoute };\n","import { dateTime, DateTime } from '@grafana/data';\n\nexport * from './navigation';\nexport * from './checkers.utils';\n\nexport const formatTimeToDate = (time?: string) => {\n const now: DateTime = dateTime(Date.now());\n const d: DateTime = dateTime(now.format('YYYY-MM-DD') + ' ' + time, 'YYYY-MM-DD HH:mm');\n return d.isValid() ? d : undefined;\n};\n\nexport const parseOrDefault = (value: string | null, defaultValue: T) => {\n try {\n if (!!value) {\n return JSON.parse(value) as T;\n }\n } catch {\n return defaultValue;\n }\n return defaultValue;\n};\n","import { SelectableValue } from '@grafana/data';\nimport { getPanels } from 'api';\nimport { useDatasourceID } from 'hooks';\nimport React, { useState, useEffect } from 'react';\nimport { useQuery } from 'react-query';\nimport { ContentVariables, Panel, PanelDetails, SelectableVariable } from 'types';\nimport { parseOrDefault } from 'utils';\n\ntype PanelContextProps = {\n panels: Panel[];\n isPanelsLoading: boolean;\n panelDetails: PanelDetails[];\n setPanelDetails: any;\n onUpdateLookback: (content: PanelDetails) => (selectableValue: SelectableValue) => void;\n onUpdateVariable: (\n content: PanelDetails,\n panel: Panel\n ) => (variableName: string) => (selectedValue: SelectableValue) => void;\n};\n\nconst panelContextDefault = {\n isPanelsLoading: true,\n panels: [],\n panelDetails: [],\n setPanelDetails: (panelDetails: PanelDetails[]) => {},\n onUpdateVariable:\n (content: PanelDetails, panel: Panel) => (variableName: string) => (selectedValue: SelectableValue) => {},\n onUpdateLookback: (content: PanelDetails) => (selectableValue: SelectableValue) => {},\n};\n\nconst PanelContext = React.createContext(panelContextDefault);\n\nconst PanelProvider: React.FC = ({ children }) => {\n const [panelDetails, setPanelDetails] = useState([]);\n const [isPanelsLoading, setIsPanelsLoading] = useState(true);\n\n const datasourceID = useDatasourceID();\n\n const { data: panels } = useQuery('all-panels', () => getPanels(datasourceID), {\n enabled: !!datasourceID,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n useEffect(() => {\n if (!!panels) {\n const newPanelDetails = panels.map((panel) => ({\n id: '',\n scheduleID: '',\n panelID: panel.id,\n dashboardID: panel.dashboardID,\n lookback: '',\n variables: '',\n }));\n\n setPanelDetails(newPanelDetails);\n setIsPanelsLoading(false);\n }\n }, [panels]);\n\n const onUpdateLookback = (content: PanelDetails) => (selectableValue: SelectableValue) => {\n setPanelDetails((prevPanels: any) => {\n const myIndex = prevPanels.findIndex(\n (el: any) => el.panelID === content.panelID && el.dashboardID === content.dashboardID\n );\n\n return [\n ...prevPanels.slice(0, myIndex),\n { ...prevPanels[myIndex], lookback: selectableValue.value },\n ...prevPanels.slice(myIndex + 1),\n ];\n });\n };\n\n const onUpdateVariable =\n (content: PanelDetails, panel: Panel) =>\n (variableName: string) =>\n (selectableValue: SelectableValue) => {\n const newVariable = selectableValue.map(({ value }: SelectableValue) => value.value);\n const newVariables = parseOrDefault(content.variables, {});\n\n newVariables[variableName] = newVariable;\n\n setPanelDetails((prevPanels: any) => {\n const myIndex = prevPanels.findIndex(\n (el: any) => el.panelID === panel.id && el.dashboardID === panel.dashboardID\n );\n\n return [\n ...prevPanels.slice(0, myIndex),\n { ...prevPanels[myIndex], variables: JSON.stringify(newVariables) },\n ...prevPanels.slice(myIndex + 1),\n ];\n });\n };\n\n return (\n \n {children}\n \n );\n};\n\nexport { PanelContext, PanelProvider, PanelContextProps };\n","import * as React from 'react';\nimport { Input, HorizontalGroup, Button } from '@grafana/ui';\n\ntype Props = React.ComponentProps & {\n /** Defines if the password is already set or not. (It is needed as in some cases the backend doesn't send back the actual password) */\n isConfigured: boolean;\n /** Called when the user clicks on the \"Reset\" button */\n onReset: () => void;\n};\n\n// This replaces the \"LegacyForms.SecretFormField\" component from @grafana/ui, so we can start using the newer form components.\nexport const SecretInput = ({ isConfigured, onReset, ...props }: Props) => {\n if (isConfigured) {\n return (\n \n \n \n \n );\n }\n\n return ;\n};\n","import { css } from '@emotion/css';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, CallToActionCard, Icon, IconName, LinkButton } from '@grafana/ui';\nimport React, { MouseEvent } from 'react';\n\ninterface Props {\n title: string;\n buttonIcon: IconName;\n buttonLink?: string;\n buttonTitle: string;\n buttonDisabled?: boolean;\n onClick?: (event: MouseEvent) => void;\n proTip?: string;\n proTipLink?: string;\n proTipLinkTitle?: string;\n proTipTarget?: string;\n infoBox?: { __html: string };\n infoBoxTitle?: string;\n}\n\nconst ctaStyle = css`\n text-align: center;\n`;\n\nconst infoBoxStyles = css`\n max-width: 700px;\n margin: 0 auto;\n`;\n\nconst EmptyListCTA = ({\n title,\n buttonIcon,\n buttonLink,\n buttonTitle,\n buttonDisabled,\n onClick,\n proTip,\n proTipLink,\n proTipLinkTitle,\n proTipTarget,\n infoBox,\n infoBoxTitle,\n}: Props) => {\n const footer = () => {\n return (\n <>\n {proTip ? (\n \n \n <> ProTip: {proTip} \n {proTipLink && (\n \n {proTipLinkTitle}\n \n )}\n \n ) : (\n ''\n )}\n {infoBox ? (\n

\n {infoBoxTitle &&
{infoBoxTitle}
}\n
\n
\n ) : (\n ''\n )}\n \n );\n };\n\n const ctaElementClassName = !footer()\n ? css`\n margin-bottom: 20px;\n `\n : '';\n\n const ButtonEl = buttonLink ? LinkButton : Button;\n\n const CallToActionElement = (\n \n {buttonTitle}\n \n );\n\n return (\n \n );\n};\n\nexport { EmptyListCTA };\n","import React, { useMemo } from 'react';\nimport { css } from '@emotion/css';\nimport { useStyles2, Button, ButtonVariant, Icon } from '@grafana/ui';\n\nexport interface Props {\n /** The current page index being shown. */\n currentPage: number;\n /** Number of total pages. */\n numberOfPages: number;\n /** Callback function for fetching the selected page. */\n onNavigate: (toPage: number) => void;\n /** When set to true and the pagination result is only one page it will not render the pagination at all. */\n hideWhenSinglePage?: boolean;\n /** Small version only shows the current page and the navigation buttons. */\n showSmallVersion?: boolean;\n}\n\nexport const Pagination: React.FC = ({\n currentPage,\n numberOfPages,\n onNavigate,\n hideWhenSinglePage,\n showSmallVersion,\n}) => {\n const styles = useStyles2(getStyles);\n const pageLengthToCondense = showSmallVersion ? 1 : 8;\n\n const pageButtons = useMemo(() => {\n const pages = [...new Array(numberOfPages).keys()];\n\n const condensePages = numberOfPages > pageLengthToCondense;\n const getListItem = (page: number, variant: 'primary' | 'secondary') => (\n
  • \n \n
  • \n );\n\n return pages.reduce((pagesToRender, pageIndex) => {\n const page = pageIndex + 1;\n const variant: ButtonVariant = page === currentPage ? 'primary' : 'secondary';\n\n // The indexes at which to start and stop condensing pages\n const lowerBoundIndex = pageLengthToCondense;\n const upperBoundIndex = numberOfPages - pageLengthToCondense + 1;\n // When the indexes overlap one another this number is negative\n const differenceOfBounds = upperBoundIndex - lowerBoundIndex;\n\n const isFirstOrLastPage = page === 1 || page === numberOfPages;\n // This handles when the lowerBoundIndex < currentPage < upperBoundIndex\n const currentPageIsBetweenBounds =\n differenceOfBounds > -1 && currentPage >= lowerBoundIndex && currentPage <= upperBoundIndex;\n\n // Show ellipsis after that many pages\n const ellipsisOffset = showSmallVersion ? 1 : 3;\n\n // The offset to show more pages when currentPageIsBetweenBounds\n const pageOffset = showSmallVersion ? 0 : 2;\n\n if (condensePages) {\n if (\n isFirstOrLastPage ||\n (currentPage < lowerBoundIndex && page < lowerBoundIndex) ||\n (differenceOfBounds >= 0 && currentPage > upperBoundIndex && page > upperBoundIndex) ||\n (differenceOfBounds < 0 && currentPage >= lowerBoundIndex && page > upperBoundIndex) ||\n (currentPageIsBetweenBounds && page >= currentPage - pageOffset && page <= currentPage + pageOffset)\n ) {\n // Renders a button for the page\n pagesToRender.push(getListItem(page, variant));\n } else if (\n (page === lowerBoundIndex && currentPage < lowerBoundIndex) ||\n (page === upperBoundIndex && currentPage > upperBoundIndex) ||\n (currentPageIsBetweenBounds &&\n (page === currentPage - ellipsisOffset || page === currentPage + ellipsisOffset))\n ) {\n // Renders and ellipsis to represent condensed pages\n pagesToRender.push(\n
  • \n \n
  • \n );\n }\n } else {\n pagesToRender.push(getListItem(page, variant));\n }\n return pagesToRender;\n }, []);\n }, [currentPage, numberOfPages, onNavigate, pageLengthToCondense, showSmallVersion, styles.ellipsis, styles.item]);\n\n if (hideWhenSinglePage && numberOfPages <= 1) {\n return null;\n }\n\n return (\n
    \n
      \n
    1. \n onNavigate(currentPage - 1)}\n disabled={currentPage === 1}\n >\n \n \n
    2. \n {pageButtons}\n
    3. \n onNavigate(currentPage + 1)}\n disabled={currentPage === numberOfPages}\n >\n \n \n
    4. \n
    \n
    \n );\n};\n\nconst getStyles = () => {\n return {\n container: css`\n float: right;\n `,\n item: css`\n display: inline-block;\n padding-left: 10px;\n margin-bottom: 5px;\n `,\n ellipsis: css`\n transform: rotate(90deg);\n `,\n };\n};\n","import React, { FC } from 'react';\nimport { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { IconName, LinkButton, useStyles2 } from '@grafana/ui';\nimport { HeaderPropsType } from './Page';\n\nconst PageHeader: FC = (props) => {\n const styles = useStyles2(getStyles);\n\n return (\n
    \n
    \n
    {renderHeaderTitle(props)}
    \n {props.backButton && (\n \n Back\n \n )}\n
    \n
    \n );\n};\n\nfunction renderHeaderTitle({ title, subTitle }: HeaderPropsType) {\n return (\n
    \n
    \n

    {title}

    \n {subTitle &&
    {subTitle}
    }\n
    \n
    \n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n headerCanvas: css`\n background: ${theme.colors.background.canvas};\n `,\n});\n\nexport { PageHeader };\n","// Libraries\nimport React, { FC, HTMLAttributes } from 'react';\n\nimport { CustomScrollbar, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { PageHeader } from './PageHeader';\nimport { PageContents } from './PageContents';\n\ninterface Props extends HTMLAttributes {\n children: React.ReactNode;\n headerProps?: HeaderPropsType;\n}\n\nexport interface HeaderPropsType {\n title: string;\n subTitle: string;\n backButton?: {\n icon: string;\n href: string;\n };\n}\n\nexport interface PageType extends FC {\n Contents: typeof PageContents;\n}\n\nexport const Page: PageType = ({ headerProps, children, className, ...otherProps }) => {\n const styles = useStyles2(getStyles);\n\n return (\n
    \n \n
    \n {headerProps && }\n {children}\n
    \n
    \n
    \n );\n};\n\nPage.Contents = PageContents;\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n width: 100%;\n flex-grow: 1;\n min-height: 0;\n `,\n});\n","// Libraries\nimport React, { FC } from 'react';\nimport { cx } from '@emotion/css';\n\ninterface Props {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const PageContents: FC = ({ children, className }) => {\n return (\n
    \n {children}\n
    \n );\n};\n","import React, { HTMLAttributes } from 'react';\nimport { css } from '@emotion/css';\nimport { LoadingPlaceholder, useStyles2 } from '@grafana/ui';\n\ninterface LoadingPlaceholderProps extends HTMLAttributes {\n text?: React.ReactNode;\n}\n\nconst Loading: React.FC = ({ text = 'loading...', ...rest }: LoadingPlaceholderProps) => {\n const style = useStyles2(getStyles);\n\n return (\n
    \n \n
    \n );\n};\n\nconst getStyles = () => ({\n loadingWrapper: css`\n display: flex;\n height: 50vh;\n align-items: center;\n justify-content: center;\n `,\n});\n\nexport { Loading, LoadingPlaceholderProps };\n","const en = require('./en.json');\n\n// TODO: Type this somehow\nexport const locales: any = {\n 'en-US': en,\n 'en-UK': {},\n};\n","import React, { useState, ChangeEvent, useEffect } from 'react';\nimport { Field, Input, FieldSet, Button, useStyles2, Select } from '@grafana/ui';\nimport { PluginConfigPageProps, AppPluginMeta, GrafanaTheme2, PluginMeta, SelectableValue } from '@grafana/data';\nimport { getBackendSrv, locationService } from '@grafana/runtime';\nimport intl from 'react-intl-universal';\nimport { useQuery } from 'react-query';\nimport { Loading, SecretInput } from './common';\nimport { css } from '@emotion/css';\nimport { locales } from '../locales';\nimport { AppConfigProps, AppConfigStateType } from 'types';\nimport { getDatasources } from 'api/getDatasource.api';\n\ninterface Props extends PluginConfigPageProps> {}\n\nconst AppConfigForm = ({ plugin }: Props) => {\n const style = useStyles2(getStyles);\n\n const [loading, setLoading] = useState(true);\n const { data: datasources, isLoading: isDatasourceListLoading } = useQuery('datasources', getDatasources);\n\n const { enabled, pinned, jsonData } = plugin.meta;\n\n const [state, setState] = useState({\n grafanaUsername: jsonData?.grafanaUsername || '',\n grafanaPassword: '',\n grafanaURL: jsonData?.grafanaURL || '',\n isGrafanaPasswordSet: Boolean(jsonData?.isGrafanaPasswordSet),\n senderEmailAddress: jsonData?.senderEmailAddress || '',\n senderEmailPassword: '',\n isSenderEmailPasswordSet: Boolean(jsonData?.isSenderEmailPasswordSet),\n senderEmailHost: jsonData?.senderEmailHost || '',\n senderEmailPort: jsonData?.senderEmailPort || 0,\n datasourceID: jsonData?.datasourceID || 0,\n });\n\n useEffect(() => {\n intl\n .init({\n currentLocale: 'en-US',\n locales,\n })\n .then(() => {\n // After loading locale data, start to render\n setLoading(false);\n });\n }, []);\n\n const onResetGrafanaPassword = () =>\n setState({\n ...state,\n grafanaPassword: '',\n isGrafanaPasswordSet: false,\n });\n\n const onResetSenderEmailPassword = () =>\n setState({\n ...state,\n senderEmailPassword: '',\n isSenderEmailPasswordSet: false,\n });\n\n const onChangeGrafanaPassword = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaPassword: event.target.value.trim(),\n });\n };\n\n const onChangeSenderEmailPassword = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailPassword: event.target.value.trim(),\n });\n };\n\n const onChangeGrafanaUsername = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaUsername: event.target.value.trim(),\n });\n };\n\n const onChangeGrafanaURL = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaURL: event.target.value.trim(),\n });\n };\n\n const onEmailAddressChange = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailAddress: event.target.value.trim(),\n });\n };\n\n const onSenderEmailHost = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailHost: event.target.value.trim(),\n });\n };\n\n const onSenderEmailPort = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailPort: Number(event.target.value.trim()),\n });\n };\n\n if (loading || isDatasourceListLoading) {\n return ;\n }\n\n return (\n !loading && (\n
    \n {/* Grafana Username */}\n
    \n \n \n \n\n \n \n \n\n \n \n \n
    \n\n
    \n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n
    \n\n
    \n \n ({ label: datasource.name, value: datasource.id })) ?? []}\n onChange={(selectedDatasource: SelectableValue) => {\n setState({\n ...state,\n datasourceID: Number(selectedDatasource.value),\n });\n }}\n >\n \n
    \n\n
    \n \n updatePluginAndReload(plugin.meta.id, {\n enabled,\n pinned,\n jsonData: {\n grafanaUsername: state.grafanaUsername,\n grafanaURL: state.grafanaURL,\n isGrafanaPasswordSet: true,\n senderEmailAddress: state.senderEmailAddress,\n isSenderEmailPasswordSet: true,\n senderEmailHost: state.senderEmailHost,\n senderEmailPort: state.senderEmailPort,\n datasourceID: state.datasourceID,\n },\n secureJsonData:\n state.isGrafanaPasswordSet && state.isSenderEmailPasswordSet\n ? undefined\n : Object.fromEntries(\n Object.entries({\n grafanaPassword: state.grafanaPassword,\n senderEmailPassword: state.senderEmailPassword,\n }).filter(([_, v]) => v !== '')\n ),\n })\n }\n disabled={Boolean(\n !state.grafanaUsername ||\n (!state.isGrafanaPasswordSet && !state.grafanaPassword) ||\n (!state.isSenderEmailPasswordSet && !state.senderEmailPassword) ||\n !state.senderEmailAddress ||\n !state.senderEmailHost ||\n !state.senderEmailPort ||\n !state.grafanaURL ||\n !state.datasourceID\n )}\n >\n Save settings\n \n
    \n
    \n )\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n colorWeak: css`\n color: ${theme.colors.text.secondary};\n `,\n marginTop: css`\n margin-top: ${theme.spacing(3)};\n `,\n marginTopXl: css`\n margin-top: ${theme.spacing(6)};\n `,\n});\n\nconst updatePluginAndReload = async (pluginId: string, data: Partial>) => {\n try {\n await updatePlugin(pluginId, data);\n\n // Reloading the page as the changes made here wouldn't be propagated to the actual plugin otherwise.\n // This is not ideal, however unfortunately currently there is no supported way for updating the plugin state.\n locationService.reload();\n } catch (e) {\n console.error('Error while updating the plugin', e);\n }\n};\n\nexport const updatePlugin = async (pluginId: string, data: Partial) => {\n await getBackendSrv().post(`/api/plugins/${pluginId}/resources/settings`, {\n ...data.jsonData,\n ...data.secureJsonData,\n });\n const response = await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data);\n return response?.data;\n};\n\nexport { AppConfigForm };\n","import React, { useState, useCallback, useEffect } from 'react';\nimport {\n InlineField,\n Input,\n Icon,\n InlineSwitch,\n VerticalGroup,\n HorizontalGroup,\n Checkbox,\n Tag,\n FieldSet,\n EmptySearchResult,\n useStyles2,\n Alert,\n} from '@grafana/ui';\nimport { User } from '../types';\n\nimport { Pagination } from './common/Pagination';\n\nimport { css } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\n\nconst pageLimit = 20;\n\ntype UserListProps = {\n users: User[];\n userListError: any;\n onUserChecked: (event: React.FormEvent, userID: string) => void;\n checkedUsers: string[];\n};\n\nconst UserList: React.FC = ({ users, userListError, onUserChecked, checkedUsers }) => {\n const styles = useStyles2(getStyles);\n const [data, setData] = useState(users);\n const [searchQuery, setSearchQuery] = useState('');\n const [isNoEmailUsersHidden, setIsNoEmailUsersHidden] = useState(true);\n\n const [paginationStates, setPaginationStates] = useState({\n totalPages: 1,\n currentPage: 1,\n });\n\n const renderUser = (user: User) => {\n return (\n \n \n
    \n onUserChecked(event, user.id)}\n label=\"\"\n />\n
    \n \n \n
    {user.name}
    \n \n \n
    0 ? undefined : 'Empty email cell'}>\n {user.e_mail}\n
    \n \n \n );\n };\n\n const onIsNoEmailUsersHiddenChange = useCallback(\n (e) => {\n setIsNoEmailUsersHidden(e.currentTarget.checked);\n },\n [setIsNoEmailUsersHidden]\n );\n\n useEffect(() => {\n const getPaginatedUsers = (users: User[] | undefined) => {\n const offset = (paginationStates.currentPage - 1) * pageLimit;\n return users?.slice(offset, offset + pageLimit);\n };\n\n const filteredUser = users\n ?.filter((user) => {\n if (isNoEmailUsersHidden) {\n return user.e_mail !== '';\n }\n return true;\n })\n .filter((user) => {\n const match = user.name.toString().toLowerCase().indexOf(searchQuery.toLowerCase()) > -1;\n return match;\n });\n\n const data = getPaginatedUsers(filteredUser);\n const totalPages = Math.ceil(filteredUser.length / pageLimit);\n\n setPaginationStates((paginationStates) => ({\n ...paginationStates,\n currentPage: paginationStates.currentPage > totalPages ? 1 : paginationStates.currentPage,\n totalPages: filteredUser ? totalPages : 1,\n }));\n\n setData(data);\n }, [users, isNoEmailUsersHidden, searchQuery, paginationStates.currentPage]);\n\n return (\n <>\n
    \n
    \n {checkedUsers.length > 0 ? (\n \n {checkedUsers.map((userID) => {\n const user = users.find((user) => user.id === userID);\n return `} />;\n })}\n \n ) : (\n You have not selected any member(s) yet\n )}\n
    \n
    \n\n
    \n
    \n
    \n \n \n }\n suffix={ setSearchQuery('')} />}\n id=\"search-query\"\n name=\"search-query\"\n placeholder=\"Search users\"\n onChange={(e: any) => setSearchQuery(e.target.value)}\n />\n \n \n \n \n \n
    \n
    \n
    \n\n
    \n \n {userListError && (\n \n You must select at least one user\n \n )}\n \n \n \n \n \n \n \n {data?.map((user) => renderUser(user))}\n
    \n NameEmail
    \n \n \n setPaginationStates((paginationStates) => ({\n ...paginationStates,\n currentPage: page,\n }))\n }\n currentPage={paginationStates.currentPage}\n numberOfPages={paginationStates.totalPages}\n hideWhenSinglePage={true}\n />\n \n
    \n
    \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n checkboxWrapper: css`\n label {\n line-height: 1.2;\n }\n `,\n});\n\nexport { UserList };\n","import React, { useContext } from 'react';\nimport { Panel, PanelDetails, PanelListSelectedType } from 'types';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Checkbox, useStyles2 } from '@grafana/ui';\nimport { css } from '@emotion/css';\nimport { PanelContext } from 'context';\nimport { PanelVariables } from 'components';\n\ntype Props = {\n panel: Panel;\n onPanelChecked: (panel: Panel) => void;\n checkedPanels: PanelListSelectedType[];\n panelDetail: PanelDetails;\n};\n\nexport const PanelItem: React.FC = ({ panel, onPanelChecked, panelDetail, checkedPanels }) => {\n const styles = useStyles2(getStyles);\n const { title, description, error } = panel;\n\n const { onUpdateLookback, onUpdateVariable } = useContext(PanelContext);\n\n return (\n
  • \n
    \n {\n event.preventDefault();\n if (error) {\n return;\n }\n return onPanelChecked(panel);\n }}\n >\n
    \n {!error ? (\n {\n return checkedPanel.panelID === panel.id && checkedPanel.dashboardID === panel.dashboardID;\n })\n }\n />\n ) : null}\n
    \n
    \n
    {title}
    \n
    {description}
    \n
    \n
    \n\n \n
  • \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginForCheckbox: css`\n margin-right: 10px;\n `,\n});\n","import React, { useContext } from 'react';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Card, FieldSet, HorizontalGroup, Icon, Legend, Tag, Tooltip, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { Panel, PanelDetails, PanelListSelectedType } from 'types';\nimport intl from 'react-intl-universal';\nimport { Loading, PanelItem } from 'components';\nimport { PanelContext } from 'context';\n\n//const pageLimit = 20;\n\ntype PanelListProps = {\n panelListError: any;\n onPanelChecked: (panel: Panel) => void;\n checkedPanels: PanelListSelectedType[];\n};\n\nconst PanelList: React.FC = ({ panelListError, onPanelChecked, checkedPanels }) => {\n const styles = useStyles2(getStyles);\n\n const { panels, panelDetails } = useContext(PanelContext);\n\n if (!panels) {\n return ;\n }\n\n return (\n <>\n
    \n \n Selected panel(s)\n \n \n \n \n
    \n {!!checkedPanels && checkedPanels.length > 0 ? (\n \n {checkedPanels.map((checkedPanel) => {\n const panel = panels.find(\n (panel: Panel) =>\n panel.id === checkedPanel.panelID && panel.dashboardID === checkedPanel.dashboardID\n );\n if (!panel) {\n return false;\n }\n\n return (\n \n );\n })}\n \n ) : (\n
    You have not selected any panels(s) yet. Please select one or more panels from the list below
    \n )}\n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n {intl.get('available_panels')}\n
    \n
      \n {panels &&\n panelDetails &&\n panels?.map((panel: Panel, key: any) => (\n detail.panelID === panel.id && detail.dashboardID === panel.dashboardID\n )!\n }\n />\n ))}\n
    \n
    \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n checkboxWrapper: css`\n label {\n line-height: 1.2;\n }\n `,\n list: cx('card-section', 'card-list-layout-grid', 'card-list-layout-list', 'card-list'),\n});\n\nexport { PanelList };\n","import { SelectableValue } from '@grafana/data';\nimport { InlineFormLabel, MultiSelect, Select } from '@grafana/ui';\nimport { refreshPanelOptions } from 'api';\nimport { useDatasourceID } from 'hooks';\nimport React from 'react';\nimport { useQuery } from 'react-query';\nimport { SelectableVariable, Variable } from 'types';\n\ntype Props = {\n onUpdate: (selected: SelectableValue) => void;\n name: string;\n multiSelectable: boolean;\n selectedOptions: string[];\n selectableOptions: Array>;\n variable: Variable;\n};\n\nexport const PanelVariableOptions: React.FC = ({\n onUpdate,\n name,\n multiSelectable,\n selectableOptions,\n variable,\n selectedOptions,\n}) => {\n const { refresh, includeAll } = variable;\n const datasourceID = useDatasourceID();\n\n const selectAllOption: SelectableValue = {\n value: '$__all',\n label: 'All',\n };\n\n // When a query variable is set to refresh, it does not by default have `options` pre-populated.\n // So, when refresh is true, query for the data and map it to the matching array.\n const { data } = useQuery(name, () => refreshPanelOptions(variable, datasourceID), {\n enabled: !!refresh,\n });\n\n const options =\n selectableOptions?.length > 0\n ? includeAll\n ? [selectAllOption, ...selectableOptions]\n : selectableOptions\n : includeAll\n ? data\n ? [selectAllOption, ...data]\n : [selectAllOption]\n : data;\n\n return (\n
    \n {name}\n {!multiSelectable ? (\n !!selectedOptions?.find((s1: any) => s1 === f.value.value))}\n onChange={(selected: SelectableValue) => {\n if (selected.value?.value === '$__all') {\n return onUpdate(selectableOptions);\n }\n\n onUpdate([selected]);\n }}\n options={options}\n />\n ) : (\n ) => {\n const isAll = selected.some(({ value }: SelectableValue) => value?.value === '$__all');\n if (isAll) {\n return onUpdate(selectableOptions);\n }\n\n onUpdate(selected);\n }}\n value={options?.filter(\n (option: SelectableValue) =>\n !!selectedOptions?.find((selected: string) => selected === option?.value?.value)\n )}\n filterOption={(option: SelectableValue, searchQuery: string) =>\n !!option?.label?.toLowerCase().includes(searchQuery.toLowerCase())\n }\n closeMenuOnSelect={false}\n options={options}\n />\n )}\n
    \n );\n};\n","import React from 'react';\nimport { SelectableValue } from '@grafana/data';\nimport { Tooltip, Icon, InlineFormLabel, Select } from '@grafana/ui';\nimport { getLookbacks } from '../../../constants';\n\nimport intl from 'react-intl-universal';\nimport { ContentVariables, Panel, PanelDetails, SelectableVariable, Variable, VariableOption } from 'types';\nimport { PanelVariableOptions } from './PanelVariableOptions';\nimport { panelUsesMacro, parseOrDefault } from 'utils';\nimport { PanelVariableTextInput } from 'components';\n\ntype Props = {\n panel: Panel;\n panelDetail: PanelDetails;\n onUpdateLookback: (selectedValue: SelectableValue) => void;\n onUpdateVariable: (variableName: string) => (selectedValue: SelectableValue) => void;\n};\n\nexport const PanelVariables: React.FC = ({ panel, onUpdateVariable, panelDetail, onUpdateLookback }) => {\n const lookbacks = getLookbacks();\n\n const vars = parseOrDefault(panelDetail?.variables, {});\n\n const usesMacro = panelUsesMacro(panel.rawSql);\n const usesVariables = panel.variables.length > 0;\n\n if (!(usesVariables || usesMacro)) {\n return null;\n }\n\n return (\n
    \n
    {intl.get('variables')}
    \n \n \n \n\n {usesMacro && (\n
    \n \n {intl.get('lookback_period')}\n \n ) => onUpdateLookback(selected)}\n />\n
    \n )}\n\n {panel.variables.map((variable: Variable) => {\n const { name, options: variableOptions, multi, label } = variable;\n\n // For a panels variables, find the ones which are selected from the\n // ReportContent.variables field, which is a stringified object consisting\n // of { [variable.name]: [Array of chosen options as strings] }\n // For example, a variable ${VEN} could have the `ReportContent.variables`\n // field { VEN: ['V', 'E'] }.\n const selected = vars[variable.name];\n\n // As well as mapping the current available options into a SelectedValue to\n const options: Array> = variableOptions.map((option: VariableOption) => {\n return { label: option.text, value: { name: variable.name, value: option.value } };\n });\n\n if (variable.type === 'textbox') {\n // Pre-fill with either the report content value that has been saved in the msupply sqlite,\n // or what is currently being used in the dashboard, as a default.\n const value = selected?.[0] ?? options[0]?.value?.value;\n return ;\n }\n\n return (\n \n );\n })}\n
    \n );\n};\n","import { SelectableValue } from '@grafana/data';\nimport { InlineFormLabel, Input } from '@grafana/ui';\n\nimport React, { FC } from 'react';\n\ntype Props = {\n onUpdate: (selected: SelectableValue) => void;\n name: string;\n value: string;\n};\n\nexport const PanelVariableTextInput: FC = ({ onUpdate, name, value }) => {\n return (\n
    \n {name}\n {\n const { value } = e.target as HTMLInputElement;\n onUpdate([{ value: { name, value } }]);\n }}\n />\n
    \n );\n};\n","import { Form, FormAPI, PageToolbar, Spinner, ToolbarButton } from '@grafana/ui';\nimport { createSchedule, getReportGroups, getScheduleByID, sendTestEmail } from 'api';\nimport { CreateScheduleFormPartial, Loading } from 'components';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { PanelContext } from 'context';\nimport React, { useContext } from 'react';\nimport { useMutation, useQuery } from 'react-query';\nimport { ScheduleType, ReportGroupType, PanelDetails } from 'types';\nimport { useHistory, useParams } from 'react-router-dom';\nimport { prefixRoute } from 'utils';\nimport intl from 'react-intl-universal';\n\nconst defaultFormValues: ScheduleType = {\n id: '',\n name: '',\n description: '',\n interval: 0,\n time: '',\n reportGroupID: '',\n day: 1,\n panels: [],\n panelDetails: [],\n};\n\nconst CreateScheduleForm: React.FC = () => {\n const { panelDetails, setPanelDetails, isPanelsLoading } = useContext(PanelContext);\n\n const [defaultSchedule, setDefaultSchedule] = React.useState(defaultFormValues);\n\n const history = useHistory();\n\n const { id: scheduleIdToEdit } = useParams<{ id: string }>();\n const isEditMode = !!scheduleIdToEdit;\n const [ready, setReady] = React.useState(false);\n const [isDefaultScheduleFetched, setIsDefaultScheduleFetched] = React.useState(false);\n\n const {\n data: defaultScheduleFetched,\n isLoading: isScheduleByIDLoading,\n isRefetching,\n } = useQuery(`schedules-${scheduleIdToEdit}`, () => getScheduleByID(scheduleIdToEdit), {\n enabled: isEditMode,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n onError: () => {\n history.push(`${PLUGIN_BASE_URL}/schedules/`);\n return;\n },\n });\n\n React.useEffect(() => {\n if (!isPanelsLoading && !!defaultScheduleFetched) {\n const { nextReportTime, ...restDefaultScheduleFetched } = defaultScheduleFetched;\n setDefaultSchedule({\n ...restDefaultScheduleFetched,\n });\n\n setPanelDetails((prevDetails: PanelDetails[]) =>\n prevDetails.map(\n (prevDetail: PanelDetails) =>\n defaultScheduleFetched.panelDetails.find(\n (defaultDetail) =>\n defaultDetail.panelID === prevDetail.panelID && defaultDetail.dashboardID === prevDetail.dashboardID\n ) || prevDetail\n )\n );\n\n setIsDefaultScheduleFetched(true);\n }\n }, [defaultScheduleFetched, isPanelsLoading, setPanelDetails]);\n\n React.useEffect(() => {\n if (!isEditMode) {\n setReady(true);\n setIsDefaultScheduleFetched(true);\n }\n\n if (!isPanelsLoading && isEditMode && !isRefetching && !isScheduleByIDLoading && isDefaultScheduleFetched) {\n setReady(true);\n }\n }, [isEditMode, isRefetching, isScheduleByIDLoading, isDefaultScheduleFetched, isPanelsLoading]);\n\n const { data: reportGroups } = useQuery(`reportGroups`, getReportGroups, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const createScheduleMutation = useMutation((newSchedule: ScheduleType) => createSchedule(newSchedule), {\n onSuccess: () => {\n history.push(`${PLUGIN_BASE_URL}/schedules/`);\n return;\n },\n });\n\n const { mutate: testEmails, isLoading: isSendTestEmailLoading } = useMutation(sendTestEmail);\n\n const submitCreateSchedule = (data: ScheduleType) => {\n const selectedPanels = panelDetails.filter((detail: PanelDetails) =>\n data.panels.find((panel) => panel.panelID === detail.panelID && panel.dashboardID === detail.dashboardID)\n );\n data.panelDetails = selectedPanels;\n createScheduleMutation.mutate(data);\n };\n\n if (!ready) {\n return ;\n }\n\n return (\n <>\n history.push(prefixRoute(ROUTES.SCHEDULES))}\n >\n {isEditMode &&\n (isSendTestEmailLoading ? (\n \n ) : (\n testEmails(defaultSchedule.id)}>\n {intl.get('send_test_emails')}\n \n ))}\n \n \n {(props: FormAPI) => {\n return (\n \n );\n }}\n \n \n );\n};\n\nexport { CreateScheduleForm };\n","import * as React from 'react';\n\nvar isCheckBoxInput = (element) => element.type === 'checkbox';\n\nvar isNullOrUndefined = (value) => value == null;\n\nconst isObjectType = (value) => typeof value === 'object';\r\nvar isObject = (value) => !isNullOrUndefined(value) &&\r\n !Array.isArray(value) &&\r\n isObjectType(value) &&\r\n !(value instanceof Date);\n\nvar getControllerValue = (event) => isObject(event) && event.target\r\n ? isCheckBoxInput(event.target)\r\n ? event.target.checked\r\n : event.target.value\r\n : event;\n\nvar getNodeParentName = (name) => name.substring(0, name.search(/.\\d/)) || name;\n\nvar isNameInFieldArray = (names, name) => [...names].some((current) => getNodeParentName(name) === current);\n\nvar compact = (value) => value.filter(Boolean);\n\nvar isUndefined = (val) => val === undefined;\n\nvar get = (obj = {}, path, defaultValue) => {\r\n const result = compact(path.split(/[,[\\].]+?/)).reduce((result, key) => (isNullOrUndefined(result) ? result : result[key]), obj);\r\n return isUndefined(result) || result === obj\r\n ? isUndefined(obj[path])\r\n ? defaultValue\r\n : obj[path]\r\n : result;\r\n};\n\nconst EVENTS = {\r\n BLUR: 'blur',\r\n CHANGE: 'change',\r\n};\r\nconst VALIDATION_MODE = {\r\n onBlur: 'onBlur',\r\n onChange: 'onChange',\r\n onSubmit: 'onSubmit',\r\n onTouched: 'onTouched',\r\n all: 'all',\r\n};\r\nconst SELECT = 'select';\r\nconst UNDEFINED = 'undefined';\r\nconst INPUT_VALIDATION_RULES = {\r\n max: 'max',\r\n min: 'min',\r\n maxLength: 'maxLength',\r\n minLength: 'minLength',\r\n pattern: 'pattern',\r\n required: 'required',\r\n validate: 'validate',\r\n};\n\nvar omit = (source, key) => {\r\n const copy = Object.assign({}, source);\r\n delete copy[key];\r\n return copy;\r\n};\n\nconst FormContext = React.createContext(null);\r\nFormContext.displayName = 'RHFContext';\r\nconst useFormContext = () => React.useContext(FormContext);\r\nconst FormProvider = (props) => (React.createElement(FormContext.Provider, { value: omit(props, 'children') }, props.children));\n\nvar getProxyFormState = (isProxyEnabled, formState, readFormStateRef, localReadFormStateRef, isRoot = true) => isProxyEnabled\r\n ? new Proxy(formState, {\r\n get: (obj, prop) => {\r\n if (prop in obj) {\r\n if (readFormStateRef.current[prop] !== VALIDATION_MODE.all) {\r\n readFormStateRef.current[prop] = isRoot\r\n ? VALIDATION_MODE.all\r\n : true;\r\n }\r\n localReadFormStateRef &&\r\n (localReadFormStateRef.current[prop] = true);\r\n return obj[prop];\r\n }\r\n return undefined;\r\n },\r\n })\r\n : formState;\n\nvar isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;\n\nvar shouldRenderFormState = (formStateData, readFormStateRef, isRoot) => {\r\n const formState = omit(formStateData, 'name');\r\n return (isEmptyObject(formState) ||\r\n Object.keys(formState).length >= Object.keys(readFormStateRef).length ||\r\n Object.keys(formState).find((key) => readFormStateRef[key] ===\r\n (isRoot ? VALIDATION_MODE.all : true)));\r\n};\n\nvar convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];\n\nvar isWeb = typeof window !== UNDEFINED &&\r\n typeof window.HTMLElement !== UNDEFINED &&\r\n typeof document !== UNDEFINED;\n\nconst isProxyEnabled = isWeb ? 'Proxy' in window : typeof Proxy !== UNDEFINED;\n\nfunction useFormState(props) {\r\n const { control, name } = props || {};\r\n const methods = useFormContext();\r\n const { formStateRef, formStateSubjectRef, readFormStateRef } = control || methods.control;\r\n const nameRef = React.useRef(name);\r\n nameRef.current = name;\r\n const [formState, updateFormState] = React.useState(formStateRef.current);\r\n const readFormState = React.useRef({\r\n isDirty: false,\r\n dirtyFields: false,\r\n touchedFields: false,\r\n isValidating: false,\r\n isValid: false,\r\n errors: false,\r\n });\r\n React.useEffect(() => {\r\n const formStateSubscription = formStateSubjectRef.current.subscribe({\r\n next: (formState) => (!nameRef.current ||\r\n !formState.name ||\r\n convertToArrayPayload(nameRef.current).includes(formState.name)) &&\r\n shouldRenderFormState(formState, readFormState.current) &&\r\n updateFormState(Object.assign(Object.assign({}, formStateRef.current), formState)),\r\n });\r\n return () => formStateSubscription.unsubscribe();\r\n }, []);\r\n return getProxyFormState(isProxyEnabled, formState, readFormStateRef, readFormState, false);\r\n}\n\nfunction useController({ name, rules, defaultValue, control, shouldUnregister, }) {\r\n const methods = useFormContext();\r\n const { defaultValuesRef, register, fieldsRef, unregister, fieldArrayNamesRef, controllerSubjectRef, shouldUnmountUnregister, inFieldArrayActionRef, } = control || methods.control;\r\n const { onChange, onBlur, ref } = register(name, rules);\r\n const isFieldArray = isNameInFieldArray(fieldArrayNamesRef.current, name);\r\n const [value, setInputStateValue] = React.useState(isUndefined(get(fieldsRef.current, name)._f.value) || isFieldArray\r\n ? isUndefined(defaultValue)\r\n ? get(defaultValuesRef.current, name)\r\n : defaultValue\r\n : get(fieldsRef.current, name)._f.value);\r\n const formState = useFormState({\r\n control: control || methods.control,\r\n name,\r\n });\r\n get(fieldsRef.current, name)._f.value = value;\r\n React.useEffect(() => {\r\n const controllerSubscription = controllerSubjectRef.current.subscribe({\r\n next: (data) => (!data.name || name === data.name) &&\r\n setInputStateValue(get(data.values, name)),\r\n });\r\n return () => {\r\n controllerSubscription.unsubscribe();\r\n const shouldUnmount = shouldUnmountUnregister || shouldUnregister;\r\n if (isFieldArray\r\n ? shouldUnmount && !inFieldArrayActionRef.current\r\n : shouldUnmount) {\r\n unregister(name);\r\n }\r\n else if (get(fieldsRef.current, name)) {\r\n get(fieldsRef.current, name)._f.mount = false;\r\n }\r\n };\r\n }, [name]);\r\n return {\r\n field: {\r\n onChange: (event) => {\r\n const value = getControllerValue(event);\r\n setInputStateValue(value);\r\n onChange({\r\n target: {\r\n value,\r\n name: name,\r\n },\r\n type: EVENTS.CHANGE,\r\n });\r\n },\r\n onBlur: () => {\r\n onBlur({\r\n target: {\r\n name: name,\r\n },\r\n type: EVENTS.BLUR,\r\n });\r\n },\r\n name,\r\n value,\r\n ref: (elm) => elm && ref(elm),\r\n },\r\n formState,\r\n fieldState: Object.defineProperties({}, {\r\n invalid: {\r\n get() {\r\n return !!get(formState.errors, name);\r\n },\r\n },\r\n isDirty: {\r\n get() {\r\n return !!get(formState.dirtyFields, name);\r\n },\r\n },\r\n isTouched: {\r\n get() {\r\n return !!get(formState.touchedFields, name);\r\n },\r\n },\r\n error: {\r\n get() {\r\n return get(formState.errors, name);\r\n },\r\n },\r\n }),\r\n };\r\n}\n\nconst Controller = (props) => props.render(useController(props));\n\nvar appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria\r\n ? Object.assign(Object.assign({}, errors[name]), { types: Object.assign(Object.assign({}, (errors[name] && errors[name].types ? errors[name].types : {})), { [type]: message || true }) }) : {};\n\nvar isKey = (value) => /^\\w*$/.test(value);\n\nvar stringToPath = (input) => compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n\nfunction set(object, path, value) {\r\n let index = -1;\r\n const tempPath = isKey(path) ? [path] : stringToPath(path);\r\n const length = tempPath.length;\r\n const lastIndex = length - 1;\r\n while (++index < length) {\r\n const key = tempPath[index];\r\n let newValue = value;\r\n if (index !== lastIndex) {\r\n const objValue = object[key];\r\n newValue =\r\n isObject(objValue) || Array.isArray(objValue)\r\n ? objValue\r\n : !isNaN(+tempPath[index + 1])\r\n ? []\r\n : {};\r\n }\r\n object[key] = newValue;\r\n object = object[key];\r\n }\r\n return object;\r\n}\n\nconst focusFieldBy = (fields, callback, fieldsNames) => {\r\n for (const key of fieldsNames || Object.keys(fields)) {\r\n const field = get(fields, key);\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n if (_f && callback(_f.name)) {\r\n if (_f.ref.focus && isUndefined(_f.ref.focus())) {\r\n break;\r\n }\r\n else if (_f.refs) {\r\n _f.refs[0].focus();\r\n break;\r\n }\r\n }\r\n else if (isObject(current)) {\r\n focusFieldBy(current, callback);\r\n }\r\n }\r\n }\r\n};\n\nconst getFieldsValues = (fieldsRef, defaultValuesRef, output = {}) => {\r\n for (const name in fieldsRef.current) {\r\n const field = fieldsRef.current[name];\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n set(output, name, _f\r\n ? _f.ref.disabled || (_f.refs && _f.refs.every((ref) => ref.disabled))\r\n ? undefined\r\n : _f.value\r\n : Array.isArray(field)\r\n ? []\r\n : {});\r\n if (current) {\r\n getFieldsValues({\r\n current,\r\n }, defaultValuesRef, output[name]);\r\n }\r\n }\r\n }\r\n return Object.assign(Object.assign({}, defaultValuesRef), output);\r\n};\n\nvar generateId = () => {\r\n const d = typeof performance === UNDEFINED ? Date.now() : performance.now() * 1000;\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\r\n const r = (Math.random() * 16 + d) % 16 | 0;\r\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\r\n });\r\n};\n\nvar mapIds = (values = [], keyName) => values.map((value) => (Object.assign({ [keyName]: (value && value[keyName]) || generateId() }, value)));\n\nvar isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);\n\nfunction deepEqual(object1, object2, isErrorObject) {\r\n if (isPrimitive(object1) ||\r\n isPrimitive(object2) ||\r\n object1 instanceof Date ||\r\n object2 instanceof Date) {\r\n return object1 === object2;\r\n }\r\n if (!React.isValidElement(object1)) {\r\n const keys1 = Object.keys(object1);\r\n const keys2 = Object.keys(object2);\r\n if (keys1.length !== keys2.length) {\r\n return false;\r\n }\r\n for (const key of keys1) {\r\n const val1 = object1[key];\r\n if (!(isErrorObject && key === 'ref')) {\r\n const val2 = object2[key];\r\n if ((isObject(val1) || Array.isArray(val1)) &&\r\n (isObject(val2) || Array.isArray(val2))\r\n ? !deepEqual(val1, val2, isErrorObject)\r\n : val1 !== val2) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n}\n\nfunction deepMerge(target, source) {\r\n if (isPrimitive(target) || isPrimitive(source)) {\r\n return source;\r\n }\r\n for (const key in source) {\r\n const targetValue = target[key];\r\n const sourceValue = source[key];\r\n try {\r\n target[key] =\r\n (isObject(targetValue) && isObject(sourceValue)) ||\r\n (Array.isArray(targetValue) && Array.isArray(sourceValue))\r\n ? deepMerge(targetValue, sourceValue)\r\n : sourceValue;\r\n }\r\n catch (_a) { }\r\n }\r\n return target;\r\n}\n\nfunction setDirtyFields(values, defaultValues, dirtyFields, parentNode, parentName) {\r\n let index = -1;\r\n while (++index < values.length) {\r\n for (const key in values[index]) {\r\n if (Array.isArray(values[index][key])) {\r\n !dirtyFields[index] && (dirtyFields[index] = {});\r\n dirtyFields[index][key] = [];\r\n setDirtyFields(values[index][key], get(defaultValues[index] || {}, key, []), dirtyFields[index][key], dirtyFields[index], key);\r\n }\r\n else {\r\n deepEqual(get(defaultValues[index] || {}, key), values[index][key])\r\n ? set(dirtyFields[index] || {}, key)\r\n : (dirtyFields[index] = Object.assign(Object.assign({}, dirtyFields[index]), { [key]: true }));\r\n }\r\n }\r\n parentNode &&\r\n !dirtyFields.length &&\r\n delete parentNode[parentName];\r\n }\r\n return dirtyFields;\r\n}\r\nvar setFieldArrayDirtyFields = (values, defaultValues, dirtyFields) => deepMerge(setDirtyFields(values, defaultValues, dirtyFields.slice(0, values.length)), setDirtyFields(defaultValues, values, dirtyFields.slice(0, values.length)));\n\nfunction append(data, value) {\r\n return [...data, ...convertToArrayPayload(value)];\r\n}\n\nvar fillEmptyArray = (value) => Array.isArray(value) ? Array(value.length).fill(undefined) : undefined;\n\nfunction insert(data, index, value) {\r\n return [\r\n ...data.slice(0, index),\r\n ...convertToArrayPayload(value),\r\n ...data.slice(index),\r\n ];\r\n}\n\nvar moveArrayAt = (data, from, to) => {\r\n if (Array.isArray(data)) {\r\n if (isUndefined(data[to])) {\r\n data[to] = undefined;\r\n }\r\n data.splice(to, 0, data.splice(from, 1)[0]);\r\n return data;\r\n }\r\n return [];\r\n};\n\nfunction prepend(data, value) {\r\n return [...convertToArrayPayload(value), ...data];\r\n}\n\nfunction removeAtIndexes(data, indexes) {\r\n let i = 0;\r\n const temp = [...data];\r\n for (const index of indexes) {\r\n temp.splice(index - i, 1);\r\n i++;\r\n }\r\n return compact(temp).length ? temp : [];\r\n}\r\nvar removeArrayAt = (data, index) => isUndefined(index)\r\n ? []\r\n : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));\n\nvar swapArrayAt = (data, indexA, indexB) => {\r\n data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\r\n};\n\nvar isBoolean = (value) => typeof value === 'boolean';\n\nfunction baseGet(object, updatePath) {\r\n const length = updatePath.slice(0, -1).length;\r\n let index = 0;\r\n while (index < length) {\r\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\r\n }\r\n return object;\r\n}\r\nfunction unset(object, path) {\r\n const updatePath = isKey(path) ? [path] : stringToPath(path);\r\n const childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);\r\n const key = updatePath[updatePath.length - 1];\r\n let previousObjRef;\r\n if (childObject) {\r\n delete childObject[key];\r\n }\r\n for (let k = 0; k < updatePath.slice(0, -1).length; k++) {\r\n let index = -1;\r\n let objectRef;\r\n const currentPaths = updatePath.slice(0, -(k + 1));\r\n const currentPathsLength = currentPaths.length - 1;\r\n if (k > 0) {\r\n previousObjRef = object;\r\n }\r\n while (++index < currentPaths.length) {\r\n const item = currentPaths[index];\r\n objectRef = objectRef ? objectRef[item] : object[item];\r\n if (currentPathsLength === index &&\r\n ((isObject(objectRef) && isEmptyObject(objectRef)) ||\r\n (Array.isArray(objectRef) &&\r\n !objectRef.filter((data) => (isObject(data) && !isEmptyObject(data)) || isBoolean(data)).length))) {\r\n previousObjRef ? delete previousObjRef[item] : delete object[item];\r\n }\r\n previousObjRef = objectRef;\r\n }\r\n }\r\n return object;\r\n}\n\nconst useFieldArray = ({ control, name, keyName = 'id', shouldUnregister, }) => {\r\n const methods = useFormContext();\r\n const focusNameRef = React.useRef('');\r\n const { isWatchAllRef, watchFieldsRef, getIsDirty, watchSubjectRef, fieldArraySubjectRef, fieldArrayNamesRef, fieldsRef, defaultValuesRef, formStateRef, formStateSubjectRef, readFormStateRef, validFieldsRef, fieldsWithValidationRef, fieldArrayDefaultValuesRef, unregister, shouldUnmountUnregister, inFieldArrayActionRef, } = control || methods.control;\r\n const [fields, setFields] = React.useState(mapIds(get(fieldsRef.current, name)\r\n ? get(getFieldsValues(fieldsRef), name)\r\n : get(fieldArrayDefaultValuesRef.current, getNodeParentName(name))\r\n ? get(fieldArrayDefaultValuesRef.current, name, [])\r\n : get(defaultValuesRef.current, name, []), keyName));\r\n set(fieldArrayDefaultValuesRef.current, name, [...fields]);\r\n fieldArrayNamesRef.current.add(name);\r\n const omitKey = (fields) => fields.map((field) => omit((field || {}), keyName));\r\n const getCurrentFieldsValues = () => {\r\n const values = get(getFieldsValues(fieldsRef, defaultValuesRef.current), name, []);\r\n return mapIds(get(fieldArrayDefaultValuesRef.current, name, []).map((item, index) => (Object.assign(Object.assign({}, item), values[index]))), keyName);\r\n };\r\n const getFocusDetail = (index, options) => options\r\n ? !isUndefined(options.focusIndex)\r\n ? `${name}.${options.focusIndex}`\r\n : options.focusName\r\n ? options.focusName\r\n : !options.shouldFocus\r\n ? ''\r\n : `${name}.${index}`\r\n : `${name}.${index}`;\r\n const resetFields = (index) => convertToArrayPayload(index).forEach((currentIndex) => set(fieldsRef.current, `${name}${isUndefined(currentIndex) ? '' : `.${currentIndex}`}`, isUndefined(currentIndex) ? [] : undefined));\r\n const setFieldsAndNotify = (fieldsValues = []) => setFields(mapIds(fieldsValues, keyName));\r\n const cleanup = (ref) => !compact(get(ref, name, [])).length && unset(ref, name);\r\n const updateDirtyFieldsWithDefaultValues = (updatedFieldArrayValues) => updatedFieldArrayValues &&\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFieldArrayValues), get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n const batchStateUpdate = (method, args, updatedFieldArrayValues = [], shouldSet = true) => {\r\n inFieldArrayActionRef.current = true;\r\n if (get(fieldsRef.current, name)) {\r\n const output = method(get(fieldsRef.current, name), args.argA, args.argB);\r\n shouldSet && set(fieldsRef.current, name, output);\r\n }\r\n if (Array.isArray(get(formStateRef.current.errors, name))) {\r\n const output = method(get(formStateRef.current.errors, name), args.argA, args.argB);\r\n shouldSet && set(formStateRef.current.errors, name, output);\r\n cleanup(formStateRef.current.errors);\r\n }\r\n if (readFormStateRef.current.touchedFields &&\r\n get(formStateRef.current.touchedFields, name)) {\r\n const output = method(get(formStateRef.current.touchedFields, name), args.argA, args.argB);\r\n shouldSet && set(formStateRef.current.touchedFields, name, output);\r\n cleanup(formStateRef.current.touchedFields);\r\n }\r\n if (readFormStateRef.current.dirtyFields ||\r\n readFormStateRef.current.isDirty) {\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFieldArrayValues), get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n updateDirtyFieldsWithDefaultValues(updatedFieldArrayValues);\r\n cleanup(formStateRef.current.dirtyFields);\r\n }\r\n if (readFormStateRef.current.isValid) {\r\n set(validFieldsRef.current, name, method(get(validFieldsRef.current, name, []), args.argA));\r\n cleanup(validFieldsRef.current);\r\n set(fieldsWithValidationRef.current, name, method(get(fieldsWithValidationRef.current, name, []), args.argA));\r\n cleanup(fieldsWithValidationRef.current);\r\n }\r\n formStateSubjectRef.current.next({\r\n isDirty: getIsDirty(name, omitKey(updatedFieldArrayValues)),\r\n errors: formStateRef.current.errors,\r\n isValid: formStateRef.current.isValid,\r\n });\r\n };\r\n const registerFieldArray = (values, index = 0, parentName = '') => values.forEach((appendValueItem, valueIndex) => !isPrimitive(appendValueItem) &&\r\n Object.entries(appendValueItem).forEach(([key, value]) => {\r\n const inputName = `${parentName || name}.${parentName ? valueIndex : index + valueIndex}.${key}`;\r\n Array.isArray(value)\r\n ? registerFieldArray(value, valueIndex, inputName)\r\n : set(fieldsRef.current, inputName, {\r\n _f: {\r\n ref: {\r\n name: inputName,\r\n },\r\n name: inputName,\r\n value,\r\n },\r\n });\r\n }));\r\n const append$1 = (value, options) => {\r\n const appendValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = append(getCurrentFieldsValues(), appendValue);\r\n const currentIndex = updatedFieldArrayValues.length - appendValue.length;\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(append, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues, false);\r\n registerFieldArray(appendValue, currentIndex);\r\n focusNameRef.current = getFocusDetail(currentIndex, options);\r\n };\r\n const prepend$1 = (value, options) => {\r\n const prependValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = prepend(getCurrentFieldsValues(), prependValue);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(prepend, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n registerFieldArray(prependValue);\r\n focusNameRef.current = getFocusDetail(0, options);\r\n };\r\n const remove = (index) => {\r\n const updatedFieldArrayValues = removeArrayAt(getCurrentFieldsValues(), index);\r\n resetFields(index);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(removeArrayAt, {\r\n argA: index,\r\n }, updatedFieldArrayValues);\r\n };\r\n const insert$1 = (index, value, options) => {\r\n const insertValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = insert(getCurrentFieldsValues(), index, insertValue);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(insert, {\r\n argA: index,\r\n argB: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n registerFieldArray(insertValue, index);\r\n focusNameRef.current = getFocusDetail(index, options);\r\n };\r\n const swap = (indexA, indexB) => {\r\n const fieldValues = getCurrentFieldsValues();\r\n swapArrayAt(fieldValues, indexA, indexB);\r\n batchStateUpdate(swapArrayAt, {\r\n argA: indexA,\r\n argB: indexB,\r\n }, fieldValues, false);\r\n setFieldsAndNotify(fieldValues);\r\n };\r\n const move = (from, to) => {\r\n const fieldValues = getCurrentFieldsValues();\r\n moveArrayAt(fieldValues, from, to);\r\n setFieldsAndNotify(fieldValues);\r\n batchStateUpdate(moveArrayAt, {\r\n argA: from,\r\n argB: to,\r\n }, fieldValues, false);\r\n };\r\n React.useEffect(() => {\r\n inFieldArrayActionRef.current = false;\r\n if (isWatchAllRef.current) {\r\n formStateSubjectRef.current.next({});\r\n }\r\n else {\r\n for (const watchField of watchFieldsRef.current) {\r\n if (name.startsWith(watchField)) {\r\n formStateSubjectRef.current.next({});\r\n break;\r\n }\r\n }\r\n }\r\n watchSubjectRef.current.next({\r\n name,\r\n value: get(getFieldsValues(fieldsRef, defaultValuesRef.current), name, []),\r\n });\r\n focusNameRef.current &&\r\n focusFieldBy(fieldsRef.current, (key) => key.startsWith(focusNameRef.current));\r\n focusNameRef.current = '';\r\n fieldArraySubjectRef.current.next({\r\n name,\r\n fields: omitKey([...fields]),\r\n });\r\n }, [fields, name]);\r\n React.useEffect(() => {\r\n const fieldArraySubscription = fieldArraySubjectRef.current.subscribe({\r\n next({ name: inputFieldArrayName, fields, isReset }) {\r\n if (isReset) {\r\n unset(fieldsRef.current, inputFieldArrayName || name);\r\n inputFieldArrayName\r\n ? set(fieldArrayDefaultValuesRef.current, inputFieldArrayName, fields)\r\n : (fieldArrayDefaultValuesRef.current = fields);\r\n setFieldsAndNotify(get(fieldArrayDefaultValuesRef.current, name));\r\n }\r\n },\r\n });\r\n !get(fieldsRef.current, name) && set(fieldsRef.current, name, []);\r\n return () => {\r\n fieldArraySubscription.unsubscribe();\r\n (shouldUnmountUnregister || shouldUnregister) && unregister(name);\r\n };\r\n }, []);\r\n return {\r\n swap: React.useCallback(swap, [name]),\r\n move: React.useCallback(move, [name]),\r\n prepend: React.useCallback(prepend$1, [name]),\r\n append: React.useCallback(append$1, [name]),\r\n remove: React.useCallback(remove, [name]),\r\n insert: React.useCallback(insert$1, [name]),\r\n fields: fields,\r\n };\r\n};\n\nfunction getFields(fieldsNames, fieldsRefs) {\r\n const currentFields = {};\r\n for (const name of fieldsNames) {\r\n const field = get(fieldsRefs, name);\r\n if (field) {\r\n !isKey(name)\r\n ? set(currentFields, name, field._f)\r\n : (currentFields[name] = field._f);\r\n }\r\n }\r\n return currentFields;\r\n}\n\nvar isFileInput = (element) => element.type === 'file';\n\nvar isMultipleSelect = (element) => element.type === `${SELECT}-multiple`;\n\nvar isRadioInput = (element) => element.type === 'radio';\n\nconst defaultResult = {\r\n value: false,\r\n isValid: false,\r\n};\r\nconst validResult = { value: true, isValid: true };\r\nvar getCheckboxValue = (options) => {\r\n if (Array.isArray(options)) {\r\n if (options.length > 1) {\r\n const values = options\r\n .filter((option) => option && option.checked && !option.disabled)\r\n .map((option) => option.value);\r\n return { value: values, isValid: !!values.length };\r\n }\r\n return options[0].checked && !options[0].disabled\r\n ? // @ts-expect-error expected to work in the browser\r\n options[0].attributes && !isUndefined(options[0].attributes.value)\r\n ? isUndefined(options[0].value) || options[0].value === ''\r\n ? validResult\r\n : { value: options[0].value, isValid: true }\r\n : validResult\r\n : defaultResult;\r\n }\r\n return defaultResult;\r\n};\n\nvar getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => valueAsNumber\r\n ? value === ''\r\n ? NaN\r\n : +value\r\n : valueAsDate\r\n ? new Date(value)\r\n : setValueAs\r\n ? setValueAs(value)\r\n : value;\n\nvar getMultipleSelectValue = (options) => [...options]\r\n .filter(({ selected }) => selected)\r\n .map(({ value }) => value);\n\nconst defaultReturn = {\r\n isValid: false,\r\n value: null,\r\n};\r\nvar getRadioValue = (options) => Array.isArray(options)\r\n ? options.reduce((previous, option) => option && option.checked && !option.disabled\r\n ? {\r\n isValid: true,\r\n value: option.value,\r\n }\r\n : previous, defaultReturn)\r\n : defaultReturn;\n\nfunction getFieldValue(field) {\r\n if (field && field._f) {\r\n const ref = field._f.ref;\r\n if (ref.disabled) {\r\n return;\r\n }\r\n if (isFileInput(ref)) {\r\n return ref.files;\r\n }\r\n if (isRadioInput(ref)) {\r\n return getRadioValue(field._f.refs).value;\r\n }\r\n if (isMultipleSelect(ref)) {\r\n return getMultipleSelectValue(ref.options);\r\n }\r\n if (isCheckBoxInput(ref)) {\r\n return getCheckboxValue(field._f.refs).value;\r\n }\r\n return getFieldValueAs(isUndefined(ref.value) ? field._f.ref.value : ref.value, field._f);\r\n }\r\n}\n\nvar hasValidation = (options, mounted) => options &&\r\n mounted &&\r\n (options.required ||\r\n options.min ||\r\n options.max ||\r\n options.maxLength ||\r\n options.minLength ||\r\n options.pattern ||\r\n options.validate);\n\nvar skipValidation = ({ isOnBlur, isOnChange, isOnTouch, isTouched, isReValidateOnBlur, isReValidateOnChange, isBlurEvent, isSubmitted, isOnAll, }) => {\r\n if (isOnAll) {\r\n return false;\r\n }\r\n else if (!isSubmitted && isOnTouch) {\r\n return !(isTouched || isBlurEvent);\r\n }\r\n else if (isSubmitted ? isReValidateOnBlur : isOnBlur) {\r\n return !isBlurEvent;\r\n }\r\n else if (isSubmitted ? isReValidateOnChange : isOnChange) {\r\n return isBlurEvent;\r\n }\r\n return true;\r\n};\n\nvar isFunction = (value) => typeof value === 'function';\n\nvar isString = (value) => typeof value === 'string';\n\nvar isMessage = (value) => isString(value) || React.isValidElement(value);\n\nvar isRegex = (value) => value instanceof RegExp;\n\nfunction getValidateError(result, ref, type = 'validate') {\r\n if (isMessage(result) ||\r\n (Array.isArray(result) && result.every(isMessage)) ||\r\n (isBoolean(result) && !result)) {\r\n return {\r\n type,\r\n message: isMessage(result) ? result : '',\r\n ref,\r\n };\r\n }\r\n}\n\nvar getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData)\r\n ? validationData\r\n : {\r\n value: validationData,\r\n message: '',\r\n };\n\nvar validateField = async ({ _f: { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, value: inputValue, valueAsNumber, mount, }, }, validateAllFieldCriteria) => {\r\n if (!mount) {\r\n return {};\r\n }\r\n const error = {};\r\n const isRadio = isRadioInput(ref);\r\n const isCheckBox = isCheckBoxInput(ref);\r\n const isRadioOrCheckbox = isRadio || isCheckBox;\r\n const isEmpty = ((valueAsNumber || isFileInput(ref)) && !ref.value) ||\r\n inputValue === '' ||\r\n (Array.isArray(inputValue) && !inputValue.length);\r\n const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\r\n const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {\r\n const message = exceedMax ? maxLengthMessage : minLengthMessage;\r\n error[name] = Object.assign({ type: exceedMax ? maxType : minType, message,\r\n ref }, appendErrorsCurry(exceedMax ? maxType : minType, message));\r\n };\r\n if (required &&\r\n ((!isRadio && !isCheckBox && (isEmpty || isNullOrUndefined(inputValue))) ||\r\n (isBoolean(inputValue) && !inputValue) ||\r\n (isCheckBox && !getCheckboxValue(refs).isValid) ||\r\n (isRadio && !getRadioValue(refs).isValid))) {\r\n const { value, message } = isMessage(required)\r\n ? { value: !!required, message: required }\r\n : getValueAndMessage(required);\r\n if (value) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.required, message, ref: isRadioOrCheckbox ? (refs || [])[0] || {} : ref }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if ((!isNullOrUndefined(min) || !isNullOrUndefined(max)) &&\r\n inputValue !== '') {\r\n let exceedMax;\r\n let exceedMin;\r\n const maxOutput = getValueAndMessage(max);\r\n const minOutput = getValueAndMessage(min);\r\n if (!isNaN(inputValue)) {\r\n const valueNumber = ref.valueAsNumber || parseFloat(inputValue);\r\n if (!isNullOrUndefined(maxOutput.value)) {\r\n exceedMax = valueNumber > maxOutput.value;\r\n }\r\n if (!isNullOrUndefined(minOutput.value)) {\r\n exceedMin = valueNumber < minOutput.value;\r\n }\r\n }\r\n else {\r\n const valueDate = ref.valueAsDate || new Date(inputValue);\r\n if (isString(maxOutput.value)) {\r\n exceedMax = valueDate > new Date(maxOutput.value);\r\n }\r\n if (isString(minOutput.value)) {\r\n exceedMin = valueDate < new Date(minOutput.value);\r\n }\r\n }\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (isString(inputValue) && !isEmpty && (maxLength || minLength)) {\r\n const maxLengthOutput = getValueAndMessage(maxLength);\r\n const minLengthOutput = getValueAndMessage(minLength);\r\n const exceedMax = !isNullOrUndefined(maxLengthOutput.value) &&\r\n inputValue.length > maxLengthOutput.value;\r\n const exceedMin = !isNullOrUndefined(minLengthOutput.value) &&\r\n inputValue.length < minLengthOutput.value;\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (isString(inputValue) && pattern && !isEmpty) {\r\n const { value: patternValue, message } = getValueAndMessage(pattern);\r\n if (isRegex(patternValue) && !inputValue.match(patternValue)) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.pattern, message,\r\n ref }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (validate) {\r\n const validateRef = isRadioOrCheckbox && refs ? refs[0] : ref;\r\n if (isFunction(validate)) {\r\n const result = await validate(inputValue);\r\n const validateError = getValidateError(result, validateRef);\r\n if (validateError) {\r\n error[name] = Object.assign(Object.assign({}, validateError), appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n else if (isObject(validate)) {\r\n let validationResult = {};\r\n for (const [key, validateFunction] of Object.entries(validate)) {\r\n if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\r\n break;\r\n }\r\n const validateResult = await validateFunction(inputValue);\r\n const validateError = getValidateError(validateResult, validateRef, key);\r\n if (validateError) {\r\n validationResult = Object.assign(Object.assign({}, validateError), appendErrorsCurry(key, validateError.message));\r\n if (validateAllFieldCriteria) {\r\n error[name] = validationResult;\r\n }\r\n }\r\n }\r\n if (!isEmptyObject(validationResult)) {\r\n error[name] = Object.assign({ ref: validateRef }, validationResult);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n }\r\n return error;\r\n};\n\nvar getValidationModes = (mode) => ({\r\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\r\n isOnBlur: mode === VALIDATION_MODE.onBlur,\r\n isOnChange: mode === VALIDATION_MODE.onChange,\r\n isOnAll: mode === VALIDATION_MODE.all,\r\n isOnTouch: mode === VALIDATION_MODE.onTouched,\r\n});\n\nvar isHTMLElement = (value) => value instanceof HTMLElement;\n\nvar isRadioOrCheckboxFunction = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);\n\nclass Subscription {\r\n constructor() {\r\n this.tearDowns = [];\r\n }\r\n add(tearDown) {\r\n this.tearDowns.push(tearDown);\r\n }\r\n unsubscribe() {\r\n for (const teardown of this.tearDowns) {\r\n teardown();\r\n }\r\n this.tearDowns = [];\r\n }\r\n}\r\nclass Subscriber {\r\n constructor(observer, subscription) {\r\n this.observer = observer;\r\n this.closed = false;\r\n subscription.add(() => (this.closed = true));\r\n }\r\n next(value) {\r\n if (!this.closed) {\r\n this.observer.next(value);\r\n }\r\n }\r\n}\r\nclass Subject {\r\n constructor() {\r\n this.observers = [];\r\n }\r\n next(value) {\r\n for (const observer of this.observers) {\r\n observer.next(value);\r\n }\r\n }\r\n subscribe(observer) {\r\n const subscription = new Subscription();\r\n const subscriber = new Subscriber(observer, subscription);\r\n this.observers.push(subscriber);\r\n return subscription;\r\n }\r\n unsubscribe() {\r\n this.observers = [];\r\n }\r\n}\n\nconst isWindowUndefined = typeof window === UNDEFINED;\r\nfunction useForm({ mode = VALIDATION_MODE.onSubmit, reValidateMode = VALIDATION_MODE.onChange, resolver, context, defaultValues = {}, shouldFocusError = true, shouldUnregister, criteriaMode, } = {}) {\r\n const fieldsRef = React.useRef({});\r\n const fieldsNamesRef = React.useRef(new Set());\r\n const formStateSubjectRef = React.useRef(new Subject());\r\n const unregisterFieldsNamesRef = React.useRef(new Set());\r\n const watchSubjectRef = React.useRef(new Subject());\r\n const controllerSubjectRef = React.useRef(new Subject());\r\n const fieldArraySubjectRef = React.useRef(new Subject());\r\n const fieldArrayDefaultValuesRef = React.useRef({});\r\n const inFieldArrayActionRef = React.useRef(false);\r\n const watchFieldsRef = React.useRef(new Set());\r\n const isMountedRef = React.useRef(false);\r\n const fieldsWithValidationRef = React.useRef({});\r\n const validFieldsRef = React.useRef({});\r\n const defaultValuesRef = React.useRef(defaultValues);\r\n const isWatchAllRef = React.useRef(false);\r\n const contextRef = React.useRef(context);\r\n const resolverRef = React.useRef(resolver);\r\n const fieldArrayNamesRef = React.useRef(new Set());\r\n const validationMode = getValidationModes(mode);\r\n const isValidateAllFieldCriteria = criteriaMode === VALIDATION_MODE.all;\r\n const [formState, updateFormState] = React.useState({\r\n isDirty: false,\r\n isValidating: false,\r\n dirtyFields: {},\r\n isSubmitted: false,\r\n submitCount: 0,\r\n touchedFields: {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n isValid: !validationMode.isOnSubmit,\r\n errors: {},\r\n });\r\n const readFormStateRef = React.useRef({\r\n isDirty: !isProxyEnabled,\r\n dirtyFields: !isProxyEnabled,\r\n touchedFields: !isProxyEnabled,\r\n isValidating: !isProxyEnabled,\r\n isValid: !isProxyEnabled,\r\n errors: !isProxyEnabled,\r\n });\r\n const formStateRef = React.useRef(formState);\r\n contextRef.current = context;\r\n resolverRef.current = resolver;\r\n const getIsValid = () => (formStateRef.current.isValid =\r\n deepEqual(validFieldsRef.current, fieldsWithValidationRef.current) &&\r\n isEmptyObject(formStateRef.current.errors));\r\n const shouldRenderBaseOnError = React.useCallback((name, error, shouldRender = false, state = {}, isValid, isWatched) => {\r\n const previousError = get(formStateRef.current.errors, name);\r\n let shouldReRender = shouldRender ||\r\n !deepEqual(previousError, error, true) ||\r\n (readFormStateRef.current.isValid &&\r\n isUndefined(error) &&\r\n get(fieldsWithValidationRef.current, name) &&\r\n !get(validFieldsRef.current, name));\r\n if (error) {\r\n unset(validFieldsRef.current, name);\r\n shouldReRender =\r\n shouldReRender ||\r\n !previousError ||\r\n !deepEqual(previousError, error, true);\r\n set(formStateRef.current.errors, name, error);\r\n }\r\n else {\r\n if (get(fieldsWithValidationRef.current, name) || resolverRef.current) {\r\n set(validFieldsRef.current, name, true);\r\n shouldReRender = shouldReRender || previousError;\r\n }\r\n unset(formStateRef.current.errors, name);\r\n }\r\n if ((shouldReRender && !isNullOrUndefined(shouldRender)) ||\r\n !isEmptyObject(state) ||\r\n isWatched) {\r\n const updatedFormState = Object.assign(Object.assign({}, state), { isValid: resolverRef.current ? !!isValid : getIsValid(), errors: formStateRef.current.errors, name });\r\n formStateRef.current = Object.assign(Object.assign({}, formStateRef.current), updatedFormState);\r\n formStateSubjectRef.current.next(isWatched ? { name } : updatedFormState);\r\n }\r\n formStateSubjectRef.current.next({\r\n isValidating: false,\r\n });\r\n }, []);\r\n const setFieldValue = React.useCallback((name, rawValue, options = {}, shouldRender, shouldRegister) => {\r\n shouldRegister && register(name);\r\n const _f = get(fieldsRef.current, name, {})._f;\r\n if (_f) {\r\n const value = isWeb && isHTMLElement(_f.ref) && isNullOrUndefined(rawValue)\r\n ? ''\r\n : rawValue;\r\n _f.value = getFieldValueAs(rawValue, _f);\r\n if (isRadioInput(_f.ref)) {\r\n (_f.refs || []).forEach((radioRef) => (radioRef.checked = radioRef.value === value));\r\n }\r\n else if (isFileInput(_f.ref) && !isString(value)) {\r\n _f.ref.files = value;\r\n }\r\n else if (isMultipleSelect(_f.ref)) {\r\n [..._f.ref.options].forEach((selectRef) => (selectRef.selected = value.includes(selectRef.value)));\r\n }\r\n else if (isCheckBoxInput(_f.ref) && _f.refs) {\r\n _f.refs.length > 1\r\n ? _f.refs.forEach((checkboxRef) => (checkboxRef.checked = Array.isArray(value)\r\n ? !!value.find((data) => data === checkboxRef.value)\r\n : value === checkboxRef.value))\r\n : (_f.refs[0].checked = !!value);\r\n }\r\n else {\r\n _f.ref.value = value;\r\n }\r\n if (shouldRender) {\r\n const values = getFieldsValues(fieldsRef);\r\n set(values, name, rawValue);\r\n controllerSubjectRef.current.next({\r\n values: Object.assign(Object.assign({}, defaultValuesRef.current), values),\r\n name,\r\n });\r\n }\r\n options.shouldDirty && updateAndGetDirtyState(name, value);\r\n options.shouldValidate && trigger(name);\r\n }\r\n }, []);\r\n const getIsDirty = React.useCallback((name, data) => {\r\n const formValues = getFieldsValues(fieldsRef);\r\n name && data && set(formValues, name, data);\r\n return !deepEqual(formValues, defaultValuesRef.current);\r\n }, []);\r\n const updateAndGetDirtyState = React.useCallback((name, inputValue, shouldRender = true) => {\r\n if (readFormStateRef.current.isDirty ||\r\n readFormStateRef.current.dirtyFields) {\r\n const isFieldDirty = !deepEqual(get(defaultValuesRef.current, name), inputValue);\r\n const isDirtyFieldExist = get(formStateRef.current.dirtyFields, name);\r\n const previousIsDirty = formStateRef.current.isDirty;\r\n isFieldDirty\r\n ? set(formStateRef.current.dirtyFields, name, true)\r\n : unset(formStateRef.current.dirtyFields, name);\r\n formStateRef.current.isDirty = getIsDirty();\r\n const state = {\r\n isDirty: formStateRef.current.isDirty,\r\n dirtyFields: formStateRef.current.dirtyFields,\r\n name,\r\n };\r\n const isChanged = (readFormStateRef.current.isDirty &&\r\n previousIsDirty !== state.isDirty) ||\r\n (readFormStateRef.current.dirtyFields &&\r\n isDirtyFieldExist !== get(formStateRef.current.dirtyFields, name));\r\n isChanged && shouldRender && formStateSubjectRef.current.next(state);\r\n return isChanged ? state : {};\r\n }\r\n return {};\r\n }, []);\r\n const executeValidation = React.useCallback(async (name, skipReRender) => {\r\n const error = (await validateField(get(fieldsRef.current, name), isValidateAllFieldCriteria))[name];\r\n shouldRenderBaseOnError(name, error, skipReRender);\r\n return isUndefined(error);\r\n }, [isValidateAllFieldCriteria]);\r\n const executeSchemaOrResolverValidation = React.useCallback(async (names, currentNames = []) => {\r\n const { errors } = await resolverRef.current(getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current), contextRef.current, {\r\n criteriaMode,\r\n names: currentNames,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n for (const name of names) {\r\n const error = get(errors, name);\r\n error\r\n ? set(formStateRef.current.errors, name, error)\r\n : unset(formStateRef.current.errors, name);\r\n }\r\n return errors;\r\n }, [criteriaMode]);\r\n const validateForm = async (fieldsRef) => {\r\n let isValid = true;\r\n for (const name in fieldsRef) {\r\n const field = fieldsRef[name];\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n if (_f) {\r\n const fieldError = await validateField(field, isValidateAllFieldCriteria);\r\n if (fieldError[_f.name]) {\r\n isValid = false;\r\n set(formStateRef.current.errors, _f.name, fieldError[_f.name]);\r\n unset(validFieldsRef.current, _f.name);\r\n }\r\n else if (get(fieldsWithValidationRef.current, _f.name)) {\r\n set(validFieldsRef.current, _f.name, true);\r\n unset(formStateRef.current.errors, _f.name);\r\n }\r\n }\r\n current && (await validateForm(current));\r\n }\r\n }\r\n return isValid;\r\n };\r\n const trigger = React.useCallback(async (name) => {\r\n const fields = isUndefined(name)\r\n ? Object.keys(fieldsRef.current)\r\n : convertToArrayPayload(name);\r\n let isValid;\r\n let schemaResult = {};\r\n formStateSubjectRef.current.next({\r\n isValidating: true,\r\n });\r\n if (resolverRef.current) {\r\n schemaResult = await executeSchemaOrResolverValidation(fields, isUndefined(name) ? undefined : fields);\r\n isValid = fields.every((name) => !get(schemaResult, name));\r\n }\r\n else {\r\n isValid = isUndefined(name)\r\n ? await validateForm(fieldsRef.current)\r\n : (await Promise.all(fields\r\n .filter((fieldName) => get(fieldsRef.current, fieldName))\r\n .map(async (fieldName) => await executeValidation(fieldName, null)))).every(Boolean);\r\n }\r\n formStateSubjectRef.current.next(Object.assign(Object.assign({}, (isString(name) ? { name } : {})), { errors: formStateRef.current.errors, isValidating: false, isValid: resolverRef.current\r\n ? isEmptyObject(schemaResult)\r\n : getIsValid() }));\r\n return isValid;\r\n }, [executeSchemaOrResolverValidation, executeValidation]);\r\n const setInternalValues = React.useCallback((name, value, options) => Object.entries(value).forEach(([inputKey, inputValue]) => {\r\n const fieldName = `${name}.${inputKey}`;\r\n const field = get(fieldsRef.current, fieldName);\r\n const isFieldArray = fieldArrayNamesRef.current.has(name);\r\n isFieldArray || (field && !field._f)\r\n ? setInternalValues(fieldName, inputValue, options)\r\n : setFieldValue(fieldName, inputValue, options, true, !field);\r\n }), [trigger]);\r\n const isFieldWatched = (name) => isWatchAllRef.current ||\r\n watchFieldsRef.current.has(name) ||\r\n watchFieldsRef.current.has((name.match(/\\w+/) || [])[0]);\r\n const updateValidAndValue = (name, options, ref, isWithinRefCallback) => {\r\n const field = get(fieldsRef.current, name);\r\n const defaultValue = isUndefined(field._f.value)\r\n ? get(defaultValuesRef.current, name)\r\n : field._f.value;\r\n if (field && !isUndefined(defaultValue)) {\r\n if (ref && ref.defaultChecked) {\r\n field._f.value = getFieldValue(field);\r\n }\r\n else if (!isNameInFieldArray(fieldArrayNamesRef.current, name)) {\r\n setFieldValue(name, defaultValue);\r\n }\r\n else {\r\n field._f.value = defaultValue;\r\n }\r\n }\r\n if ((!isUndefined(defaultValue) || isWithinRefCallback) &&\r\n hasValidation(options, field._f.mount) &&\r\n !validationMode.isOnSubmit &&\r\n field &&\r\n readFormStateRef.current.isValid) {\r\n validateField(field, isValidateAllFieldCriteria).then((error) => {\r\n isEmptyObject(error)\r\n ? set(validFieldsRef.current, name, true)\r\n : unset(validFieldsRef.current, name);\r\n formStateRef.current.isValid !== getIsValid() &&\r\n updateFormState(Object.assign(Object.assign({}, formStateRef.current), { isValid: getIsValid() }));\r\n });\r\n }\r\n return defaultValue;\r\n };\r\n const setValue = (name, value, options = {}) => {\r\n const field = get(fieldsRef.current, name);\r\n const isFieldArray = fieldArrayNamesRef.current.has(name);\r\n if (isFieldArray) {\r\n fieldArraySubjectRef.current.next({\r\n fields: value,\r\n name,\r\n isReset: true,\r\n });\r\n if ((readFormStateRef.current.isDirty ||\r\n readFormStateRef.current.dirtyFields) &&\r\n options.shouldDirty) {\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(value, get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n formStateSubjectRef.current.next({\r\n name,\r\n dirtyFields: formStateRef.current.dirtyFields,\r\n isDirty: getIsDirty(name, value),\r\n });\r\n }\r\n !value.length &&\r\n set(fieldsRef.current, name, []) &&\r\n set(fieldArrayDefaultValuesRef.current, name, []);\r\n }\r\n (field && !field._f) || isFieldArray\r\n ? setInternalValues(name, value, isFieldArray ? {} : options)\r\n : setFieldValue(name, value, options, true, !field);\r\n isFieldWatched(name) && formStateSubjectRef.current.next({});\r\n watchSubjectRef.current.next({ name, value });\r\n };\r\n const handleChange = React.useCallback(async ({ type, target, target: { value, type: inputType } }) => {\r\n let name = target.name;\r\n let error;\r\n let isValid;\r\n const field = get(fieldsRef.current, name);\r\n if (field) {\r\n let inputValue = inputType ? getFieldValue(field) : undefined;\r\n inputValue = isUndefined(inputValue) ? value : inputValue;\r\n const isBlurEvent = type === EVENTS.BLUR;\r\n const { isOnBlur: isReValidateOnBlur, isOnChange: isReValidateOnChange, } = getValidationModes(reValidateMode);\r\n const shouldSkipValidation = (!hasValidation(field._f, field._f.mount) &&\r\n !resolverRef.current &&\r\n !get(formStateRef.current.errors, name)) ||\r\n skipValidation(Object.assign({ isBlurEvent, isTouched: !!get(formStateRef.current.touchedFields, name), isSubmitted: formStateRef.current.isSubmitted, isReValidateOnBlur,\r\n isReValidateOnChange }, validationMode));\r\n const isWatched = !isBlurEvent && isFieldWatched(name);\r\n if (!isUndefined(inputValue)) {\r\n field._f.value = inputValue;\r\n }\r\n const state = updateAndGetDirtyState(name, field._f.value, false);\r\n if (isBlurEvent && !get(formStateRef.current.touchedFields, name)) {\r\n set(formStateRef.current.touchedFields, name, true);\r\n readFormStateRef.current.touchedFields &&\r\n (state.touchedFields = formStateRef.current.touchedFields);\r\n }\r\n let shouldRender = !isEmptyObject(state) || isWatched;\r\n if (shouldSkipValidation) {\r\n !isBlurEvent &&\r\n watchSubjectRef.current.next({\r\n name,\r\n type,\r\n value: inputValue,\r\n });\r\n return (shouldRender &&\r\n formStateSubjectRef.current.next(isWatched ? { name } : Object.assign(Object.assign({}, state), { name })));\r\n }\r\n formStateSubjectRef.current.next({\r\n isValidating: true,\r\n });\r\n if (resolverRef.current) {\r\n const { errors } = await resolverRef.current(getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current), contextRef.current, {\r\n criteriaMode,\r\n fields: getFields([name], fieldsRef.current),\r\n names: [name],\r\n });\r\n const previousFormIsValid = formStateRef.current.isValid;\r\n error = get(errors, name);\r\n if (isCheckBoxInput(target) && !error) {\r\n const parentNodeName = getNodeParentName(name);\r\n const currentError = get(errors, parentNodeName, {});\r\n currentError.type && currentError.message && (error = currentError);\r\n if (currentError ||\r\n get(formStateRef.current.errors, parentNodeName)) {\r\n name = parentNodeName;\r\n }\r\n }\r\n isValid = isEmptyObject(errors);\r\n previousFormIsValid !== isValid && (shouldRender = true);\r\n }\r\n else {\r\n error = (await validateField(field, isValidateAllFieldCriteria))[name];\r\n }\r\n !isBlurEvent &&\r\n watchSubjectRef.current.next({\r\n name,\r\n type,\r\n value: inputValue,\r\n });\r\n shouldRenderBaseOnError(name, error, shouldRender, state, isValid, isWatched);\r\n }\r\n }, []);\r\n const getValues = (fieldNames) => {\r\n const values = isMountedRef.current\r\n ? getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current)\r\n : defaultValuesRef.current;\r\n return isUndefined(fieldNames)\r\n ? values\r\n : isString(fieldNames)\r\n ? get(values, fieldNames)\r\n : fieldNames.map((name) => get(values, name));\r\n };\r\n const updateIsValid = React.useCallback(async (values = {}) => {\r\n const previousIsValid = formStateRef.current.isValid;\r\n if (resolver) {\r\n const { errors } = await resolverRef.current(Object.assign(Object.assign({}, getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current)), values), contextRef.current, {\r\n criteriaMode,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n formStateRef.current.isValid = isEmptyObject(errors);\r\n }\r\n else {\r\n getIsValid();\r\n }\r\n previousIsValid !== formStateRef.current.isValid &&\r\n formStateSubjectRef.current.next({\r\n isValid: formStateRef.current.isValid,\r\n });\r\n }, [criteriaMode]);\r\n const clearErrors = (name) => {\r\n name\r\n ? convertToArrayPayload(name).forEach((inputName) => unset(formStateRef.current.errors, inputName))\r\n : (formStateRef.current.errors = {});\r\n formStateSubjectRef.current.next({\r\n errors: formStateRef.current.errors,\r\n });\r\n };\r\n const setError = (name, error, options) => {\r\n const ref = ((get(fieldsRef.current, name) || { _f: {} })._f || {}).ref;\r\n set(formStateRef.current.errors, name, Object.assign(Object.assign({}, error), { ref }));\r\n formStateSubjectRef.current.next({\r\n name,\r\n errors: formStateRef.current.errors,\r\n isValid: false,\r\n });\r\n options && options.shouldFocus && ref && ref.focus && ref.focus();\r\n };\r\n const watchInternal = React.useCallback((fieldNames, defaultValue, isGlobal) => {\r\n const isArrayNames = Array.isArray(fieldNames);\r\n const fieldValues = isMountedRef.current\r\n ? getFieldsValues(fieldsRef, defaultValuesRef.current)\r\n : isUndefined(defaultValue)\r\n ? defaultValuesRef.current\r\n : isArrayNames\r\n ? defaultValue || {}\r\n : { [fieldNames]: defaultValue };\r\n if (isUndefined(fieldNames)) {\r\n isGlobal && (isWatchAllRef.current = true);\r\n return fieldValues;\r\n }\r\n const result = [];\r\n for (const fieldName of isArrayNames ? fieldNames : [fieldNames]) {\r\n isGlobal && watchFieldsRef.current.add(fieldName);\r\n result.push(get(fieldValues, fieldName));\r\n }\r\n return isArrayNames ? result : result[0];\r\n }, []);\r\n const watch = (fieldName, defaultValue) => isFunction(fieldName)\r\n ? watchSubjectRef.current.subscribe({\r\n next: (info) => fieldName(watchInternal(undefined, defaultValue), info),\r\n })\r\n : watchInternal(fieldName, defaultValue, true);\r\n const unregister = (name, options = {}) => {\r\n for (const inputName of name\r\n ? convertToArrayPayload(name)\r\n : Object.keys(fieldsNamesRef.current)) {\r\n fieldsNamesRef.current.delete(inputName);\r\n fieldArrayNamesRef.current.delete(inputName);\r\n if (get(fieldsRef.current, inputName)) {\r\n if (!options.keepIsValid) {\r\n unset(fieldsWithValidationRef.current, inputName);\r\n unset(validFieldsRef.current, inputName);\r\n }\r\n !options.keepError && unset(formStateRef.current.errors, inputName);\r\n !options.keepValue && unset(fieldsRef.current, inputName);\r\n !options.keepDirty &&\r\n unset(formStateRef.current.dirtyFields, inputName);\r\n !options.keepTouched &&\r\n unset(formStateRef.current.touchedFields, inputName);\r\n !shouldUnregister &&\r\n !options.keepDefaultValue &&\r\n unset(defaultValuesRef.current, inputName);\r\n watchSubjectRef.current.next({\r\n name: inputName,\r\n });\r\n }\r\n }\r\n formStateSubjectRef.current.next(Object.assign(Object.assign(Object.assign({}, formStateRef.current), (!options.keepDirty ? {} : { isDirty: getIsDirty() })), (resolverRef.current ? {} : { isValid: getIsValid() })));\r\n !options.keepIsValid && updateIsValid();\r\n };\r\n const registerFieldRef = (name, ref, options) => {\r\n register(name, options);\r\n let field = get(fieldsRef.current, name);\r\n const isRadioOrCheckbox = isRadioOrCheckboxFunction(ref);\r\n if (ref === field._f.ref ||\r\n (isWeb && isHTMLElement(field._f.ref) && !isHTMLElement(ref)) ||\r\n (isRadioOrCheckbox &&\r\n Array.isArray(field._f.refs) &&\r\n compact(field._f.refs).find((option) => option === ref))) {\r\n return;\r\n }\r\n field = {\r\n _f: isRadioOrCheckbox\r\n ? Object.assign(Object.assign({}, field._f), { refs: [\r\n ...compact(field._f.refs || []).filter((ref) => isHTMLElement(ref) && document.contains(ref)),\r\n ref,\r\n ], ref: { type: ref.type, name } }) : Object.assign(Object.assign({}, field._f), { ref }),\r\n };\r\n set(fieldsRef.current, name, field);\r\n const defaultValue = updateValidAndValue(name, options, ref, true);\r\n if (isRadioOrCheckbox && Array.isArray(defaultValue)\r\n ? !deepEqual(get(fieldsRef.current, name)._f.value, defaultValue)\r\n : isUndefined(get(fieldsRef.current, name)._f.value)) {\r\n get(fieldsRef.current, name)._f.value = getFieldValue(get(fieldsRef.current, name));\r\n }\r\n };\r\n const register = React.useCallback((name, options) => {\r\n const isInitialRegister = !get(fieldsRef.current, name);\r\n set(fieldsRef.current, name, {\r\n _f: Object.assign(Object.assign(Object.assign({}, (isInitialRegister\r\n ? { ref: { name } }\r\n : Object.assign({ ref: (get(fieldsRef.current, name)._f || {}).ref }, get(fieldsRef.current, name)._f))), { name, mount: true }), options),\r\n });\r\n hasValidation(options, true) &&\r\n set(fieldsWithValidationRef.current, name, true);\r\n fieldsNamesRef.current.add(name);\r\n isInitialRegister && updateValidAndValue(name, options);\r\n return isWindowUndefined\r\n ? { name: name }\r\n : {\r\n name,\r\n onChange: handleChange,\r\n onBlur: handleChange,\r\n ref: (ref) => {\r\n if (ref) {\r\n registerFieldRef(name, ref, options);\r\n }\r\n else {\r\n const field = get(fieldsRef.current, name);\r\n const shouldUnmount = shouldUnregister || (options && options.shouldUnregister);\r\n field && (field._f.mount = false);\r\n if (isWeb &&\r\n (isNameInFieldArray(fieldArrayNamesRef.current, name)\r\n ? shouldUnmount && !inFieldArrayActionRef.current\r\n : shouldUnmount)) {\r\n unregisterFieldsNamesRef.current.add(name);\r\n }\r\n }\r\n },\r\n };\r\n }, [defaultValuesRef.current]);\r\n const handleSubmit = React.useCallback((onValid, onInvalid) => async (e) => {\r\n if (e) {\r\n e.preventDefault && e.preventDefault();\r\n e.persist && e.persist();\r\n }\r\n let hasNoPromiseError = true;\r\n let fieldValues = getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current);\r\n formStateSubjectRef.current.next({\r\n isSubmitting: true,\r\n });\r\n try {\r\n if (resolverRef.current) {\r\n const { errors, values } = await resolverRef.current(fieldValues, contextRef.current, {\r\n criteriaMode,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n formStateRef.current.errors = errors;\r\n fieldValues = values;\r\n }\r\n else {\r\n await validateForm(fieldsRef.current);\r\n }\r\n if (isEmptyObject(formStateRef.current.errors) &&\r\n Object.keys(formStateRef.current.errors).every((name) => get(fieldValues, name))) {\r\n formStateSubjectRef.current.next({\r\n errors: {},\r\n isSubmitting: true,\r\n });\r\n await onValid(fieldValues, e);\r\n }\r\n else {\r\n onInvalid && (await onInvalid(formStateRef.current.errors, e));\r\n shouldFocusError &&\r\n focusFieldBy(fieldsRef.current, (key) => get(formStateRef.current.errors, key), fieldsNamesRef.current);\r\n }\r\n }\r\n catch (_a) {\r\n hasNoPromiseError = false;\r\n }\r\n finally {\r\n formStateRef.current.isSubmitted = true;\r\n formStateSubjectRef.current.next({\r\n isSubmitted: true,\r\n isSubmitting: false,\r\n isSubmitSuccessful: isEmptyObject(formStateRef.current.errors) && hasNoPromiseError,\r\n submitCount: formStateRef.current.submitCount + 1,\r\n errors: formStateRef.current.errors,\r\n });\r\n }\r\n }, [shouldFocusError, isValidateAllFieldCriteria, criteriaMode]);\r\n const resetFromState = React.useCallback(({ keepErrors, keepDirty, keepIsSubmitted, keepTouched, keepDefaultValues, keepIsValid, keepSubmitCount, }, values) => {\r\n if (!keepIsValid) {\r\n validFieldsRef.current = {};\r\n fieldsWithValidationRef.current = {};\r\n }\r\n watchFieldsRef.current = new Set();\r\n isWatchAllRef.current = false;\r\n formStateSubjectRef.current.next({\r\n submitCount: keepSubmitCount ? formStateRef.current.submitCount : 0,\r\n isDirty: keepDirty\r\n ? formStateRef.current.isDirty\r\n : keepDefaultValues\r\n ? deepEqual(values, defaultValuesRef.current)\r\n : false,\r\n isSubmitted: keepIsSubmitted ? formStateRef.current.isSubmitted : false,\r\n isValid: keepIsValid\r\n ? formStateRef.current.isValid\r\n : !!updateIsValid(values),\r\n dirtyFields: keepDirty ? formStateRef.current.dirtyFields : {},\r\n touchedFields: keepTouched ? formStateRef.current.touchedFields : {},\r\n errors: keepErrors ? formStateRef.current.errors : {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n });\r\n }, []);\r\n const reset = (values, keepStateOptions = {}) => {\r\n const updatedValues = values || defaultValuesRef.current;\r\n if (isWeb && !keepStateOptions.keepValues) {\r\n for (const name of fieldsNamesRef.current) {\r\n const field = get(fieldsRef.current, name);\r\n if (field && field._f) {\r\n const inputRef = Array.isArray(field._f.refs)\r\n ? field._f.refs[0]\r\n : field._f.ref;\r\n if (isHTMLElement(inputRef)) {\r\n try {\r\n inputRef.closest('form').reset();\r\n break;\r\n }\r\n catch (_a) { }\r\n }\r\n }\r\n }\r\n }\r\n !keepStateOptions.keepDefaultValues &&\r\n (defaultValuesRef.current = Object.assign({}, updatedValues));\r\n if (!keepStateOptions.keepValues) {\r\n fieldsRef.current = {};\r\n controllerSubjectRef.current.next({\r\n values: Object.assign({}, updatedValues),\r\n });\r\n watchSubjectRef.current.next({\r\n value: Object.assign({}, updatedValues),\r\n });\r\n fieldArraySubjectRef.current.next({\r\n fields: Object.assign({}, updatedValues),\r\n isReset: true,\r\n });\r\n }\r\n resetFromState(keepStateOptions, values);\r\n isMountedRef.current = false;\r\n };\r\n const setFocus = (name) => get(fieldsRef.current, name)._f.ref.focus();\r\n React.useEffect(() => {\r\n const formStateSubscription = formStateSubjectRef.current.subscribe({\r\n next(formState) {\r\n if (shouldRenderFormState(formState, readFormStateRef.current, true)) {\r\n formStateRef.current = Object.assign(Object.assign({}, formStateRef.current), formState);\r\n updateFormState(formStateRef.current);\r\n }\r\n },\r\n });\r\n const useFieldArraySubscription = fieldArraySubjectRef.current.subscribe({\r\n next(state) {\r\n if (state.fields && state.name && readFormStateRef.current.isValid) {\r\n const values = getFieldsValues(fieldsRef);\r\n set(values, state.name, state.fields);\r\n updateIsValid(values);\r\n }\r\n },\r\n });\r\n resolverRef.current && readFormStateRef.current.isValid && updateIsValid();\r\n return () => {\r\n watchSubjectRef.current.unsubscribe();\r\n formStateSubscription.unsubscribe();\r\n useFieldArraySubscription.unsubscribe();\r\n };\r\n }, []);\r\n React.useEffect(() => {\r\n const isLiveInDom = (ref) => !isHTMLElement(ref) || !document.contains(ref);\r\n isMountedRef.current = true;\r\n unregisterFieldsNamesRef.current.forEach((name) => {\r\n const field = get(fieldsRef.current, name);\r\n field &&\r\n (field._f.refs\r\n ? field._f.refs.every(isLiveInDom)\r\n : isLiveInDom(field._f.ref)) &&\r\n unregister(name);\r\n });\r\n unregisterFieldsNamesRef.current = new Set();\r\n });\r\n return {\r\n control: React.useMemo(() => ({\r\n register,\r\n isWatchAllRef,\r\n inFieldArrayActionRef,\r\n watchFieldsRef,\r\n getIsDirty,\r\n formStateSubjectRef,\r\n fieldArraySubjectRef,\r\n controllerSubjectRef,\r\n watchSubjectRef,\r\n watchInternal,\r\n fieldsRef,\r\n validFieldsRef,\r\n fieldsWithValidationRef,\r\n fieldArrayNamesRef,\r\n readFormStateRef,\r\n formStateRef,\r\n defaultValuesRef,\r\n fieldArrayDefaultValuesRef,\r\n unregister,\r\n shouldUnmountUnregister: shouldUnregister,\r\n }), []),\r\n formState: getProxyFormState(isProxyEnabled, formState, readFormStateRef),\r\n trigger,\r\n register,\r\n handleSubmit,\r\n watch: React.useCallback(watch, []),\r\n setValue: React.useCallback(setValue, [setInternalValues]),\r\n getValues: React.useCallback(getValues, []),\r\n reset: React.useCallback(reset, []),\r\n clearErrors: React.useCallback(clearErrors, []),\r\n unregister: React.useCallback(unregister, []),\r\n setError: React.useCallback(setError, []),\r\n setFocus: React.useCallback(setFocus, []),\r\n };\r\n}\n\nfunction useWatch(props) {\r\n const { control, name, defaultValue } = props || {};\r\n const methods = useFormContext();\r\n const nameRef = React.useRef(name);\r\n nameRef.current = name;\r\n const { watchInternal, watchSubjectRef } = control || methods.control;\r\n const [value, updateValue] = React.useState(isUndefined(defaultValue)\r\n ? watchInternal(name)\r\n : defaultValue);\r\n React.useEffect(() => {\r\n watchInternal(name);\r\n const watchSubscription = watchSubjectRef.current.subscribe({\r\n next: ({ name: inputName, value }) => (!nameRef.current ||\r\n !inputName ||\r\n convertToArrayPayload(nameRef.current).some((fieldName) => inputName &&\r\n fieldName &&\r\n (fieldName.startsWith(inputName) ||\r\n inputName.startsWith(fieldName)))) &&\r\n updateValue(isString(inputName) &&\r\n nameRef.current === inputName &&\r\n !isUndefined(value)\r\n ? value\r\n : watchInternal(nameRef.current, defaultValue)),\r\n });\r\n return () => watchSubscription.unsubscribe();\r\n }, []);\r\n return value;\r\n}\n\nexport { Controller, FormProvider, appendErrors, get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };\n//# sourceMappingURL=index.esm.js.map\n","import React, { useEffect } from 'react';\nimport { SelectableValue, DateTime } from '@grafana/data';\nimport {\n Button,\n Field,\n FieldSet,\n FormAPI,\n Icon,\n InlineField,\n InlineFieldRow,\n Input,\n Select,\n TimeOfDayPicker,\n} from '@grafana/ui';\nimport { getIntervals, getWeekDays } from '../../constants';\nimport { Panel, PanelListSelectedType, ReportGroupType, ScheduleType } from 'types';\nimport { formatTimeToDate } from 'utils';\nimport { PanelList } from 'components';\nimport { Controller } from 'react-hook-form';\n\nexport const CreateScheduleFormPartial = ({\n register,\n errors,\n control,\n setValue,\n watch,\n reportGroups,\n isEditMode,\n defaultSchedule,\n}: FormAPI & {\n reportGroups: ReportGroupType[] | undefined;\n isEditMode: boolean;\n defaultSchedule: ScheduleType;\n}) => {\n useEffect(() => {\n register('reportGroupID', { required: 'Report group is required' });\n register('time', { required: 'time of day is required' });\n register('interval', { required: 'Interval is required' });\n }, [register]);\n\n const getReportGroupOptions = (reportGroups: ReportGroupType[] | undefined) =>\n reportGroups?.map((reportGroup: ReportGroupType) => ({\n label: reportGroup.name,\n description: reportGroup.description,\n value: reportGroup,\n }));\n\n const renderInterval = () => {\n switch (watch('interval')) {\n case 0:\n return false;\n case 1:\n return (\n \n inter.value === watch('day'))}\n options={getWeekDays()}\n prefix={}\n onChange={(option: any) => {\n setValue('day', option.value);\n }}\n />\n \n );\n case 2:\n return (\n \n ({ label: (key + 1).toString(), value: key + 1 }))}\n prefix={}\n onChange={(option: any) => {\n setValue('day', option.value);\n }}\n />\n \n );\n default:\n return (\n \n \n \n );\n }\n };\n\n return (\n <>\n
    \n \n \n \n \n \n \n
    \n\n \n reportGroup.id === watch('reportGroupID'))\n .map((reportGroup: ReportGroupType) => ({\n label: reportGroup.name,\n description: reportGroup.description,\n value: reportGroup,\n }))}\n options={getReportGroupOptions(reportGroups)}\n onChange={(selected: SelectableValue) => {\n setValue('reportGroupID', selected?.value?.id ?? '');\n }}\n prefix={}\n />\n \n\n \n \n interval.value === watch('interval'))}\n options={getIntervals()}\n prefix={}\n onChange={(option: any) => {\n setValue('interval', option.value);\n }}\n />\n \n \n {\n setValue('time', selected.format('HH:mm'));\n }}\n />\n \n {renderInterval()}\n \n\n {\n return (\n {\n const foundElement = selectedPanels.find(\n (selectedPanel: PanelListSelectedType) =>\n selectedPanel.panelID === panel.id && selectedPanel.dashboardID === panel.dashboardID\n );\n\n const updatedSelectedPanels = foundElement\n ? selectedPanels.filter(\n (selectedPanel: PanelListSelectedType) =>\n !(selectedPanel.panelID === panel.id && selectedPanel.dashboardID === panel.dashboardID)\n )\n : [...selectedPanels, { panelID: panel.id, dashboardID: panel.dashboardID }];\n\n onChange(updatedSelectedPanels);\n }}\n />\n );\n }}\n name=\"panels\"\n control={control}\n defaultValue={defaultSchedule.panelDetails.map((panelDetail) => ({\n panelID: panelDetail.panelID,\n dashboardID: panelDetail.dashboardID,\n }))}\n />\n\n
    \n \n
    \n \n );\n};\n","import { AppPluginMeta, PluginConfigPageProps } from '@grafana/data';\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { AppConfigForm } from '../components';\nimport { AppConfigProps } from '../types';\n\nconst queryClient = new QueryClient();\n\ninterface Props extends PluginConfigPageProps> {}\n\nconst AppConfig = ({ plugin, ...rest }: Props) => {\n return (\n \n \n \n );\n};\n\nexport { AppConfig };\n","import React, { useState } from 'react';\nimport { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Card, ConfirmModal, HorizontalGroup, LinkButton, Spinner, Tag, useStyles2 } from '@grafana/ui';\nimport intl from 'react-intl-universal';\nimport { useMutation, useQuery } from 'react-query';\n\nimport { EmptyListCTA } from 'components/common';\nimport { prefixRoute } from '../../utils';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { ReportGroupType } from 'types';\nimport { deleteReportGroup, getReportGroups } from 'api';\nimport { useToggle } from '../../hooks';\n\nconst EmptyList = () => {\n return (\n \n );\n};\n\nconst ReportGroup = () => {\n const styles = useStyles2(getStyles);\n\n const [deleteAlertIsOpen, setDeleteAlertIsOpen] = useToggle(false);\n const [deleteReportGroupID, setDeleteReportGroupID] = useState('');\n\n const { mutate: deleteGroup } = useMutation(deleteReportGroup, {\n onSuccess: () => {\n refetchReportGroups();\n return;\n },\n });\n\n const onConfirmDeleteGroup = () => {\n deleteGroup(deleteReportGroupID);\n setDeleteAlertIsOpen();\n };\n\n const {\n data: reportGroups,\n isLoading,\n refetch: refetchReportGroups,\n } = useQuery(`reportGroups`, getReportGroups, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const onReportGroupDelete = (reportGroupID: string) => {\n setDeleteAlertIsOpen();\n setDeleteReportGroupID(reportGroupID);\n };\n\n if (isLoading) {\n return ;\n }\n\n if (!!!reportGroups || !reportGroups.length) {\n return ;\n }\n\n return (\n
    \n
    \n \n {intl.get('add_report_group')}\n \n
    \n
      \n {reportGroups.map((reportGroup) => {\n return (\n
    • \n \n {reportGroup.name}\n {reportGroup.description}\n {reportGroup.members && (\n \n {[\n \n {reportGroup.members.map(({ id, name, email }: any) => {\n return `} />;\n })}\n ,\n ]}\n \n )}\n \n \n Edit\n \n onReportGroupDelete(reportGroup.id)}\n >\n {intl.get('delete')}\n \n \n \n
    • \n );\n })}\n
    \n \n
    \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginTop: css`\n margin-top: ${theme.spacing(2)};\n `,\n list: css({\n listStyle: 'none',\n display: 'grid',\n // gap: '8px', Add back when legacy support for old Card interface is dropped\n }),\n adjustButtonToRight: css`\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n `,\n heading: css({\n fontSize: theme.v1.typography.heading.h5,\n fontWeight: 'inherit',\n }),\n card: css({\n gridTemplateAreas: `\n \"Figure Heading Actions\"\n \"Figure Description Actions\"\n \"Figure Meta Actions\"\n \"Figure - Actions\"`,\n }),\n description: css({\n margin: '0px',\n fontSize: theme.typography.size.sm,\n }),\n actions: css({\n position: 'relative',\n alignSelf: 'center',\n marginTop: '0px',\n opacity: 0,\n\n '.card-parent:hover &, .card-parent:focus-within &': {\n opacity: 1,\n },\n }),\n});\n\nexport { ReportGroup, EmptyList };\n","import React from 'react';\nimport { Controller } from 'react-hook-form';\nimport { Alert, Button, Field, FieldSet, Form, Input, PageToolbar } from '@grafana/ui';\nimport { useMutation, useQuery } from 'react-query';\n\nimport { Loading, Page, UserList } from '../../components';\nimport { ROUTES, NAVIGATION_TITLE, NAVIGATION_SUBTITLE, PLUGIN_BASE_URL } from '../../constants';\nimport { prefixRoute } from '../../utils';\nimport { useDatasourceID } from '../../hooks';\nimport { getUsers, createReportGroup, getReportGroupByID } from '../../api';\nimport { ReportGroupType, ReportGroupTypeWithMembersDetail, User } from '../../types';\n\nconst defaultFormValues: ReportGroupType = {\n id: '',\n name: '',\n description: '',\n members: [],\n};\n\nconst CreateReportGroup = ({ history, match }: any) => {\n const datasourceID = useDatasourceID();\n const { id: reportGroupIdToEdit } = match.params;\n const isEditMode = !!reportGroupIdToEdit;\n const [ready, setReady] = React.useState(false);\n\n const { data: users, isLoading: isUsersLoading } = useQuery(\n `users-${datasourceID}`,\n () => getUsers(datasourceID),\n {\n enabled: !!datasourceID,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n }\n );\n\n const [defaultReportGroup, setDefaultReportGroup] = React.useState(defaultFormValues);\n\n const {\n data: defaultReportGroupFetched,\n isLoading: isReportGroupByIDLoading,\n isRefetching,\n } = useQuery(\n `report-group-${reportGroupIdToEdit}`,\n () => getReportGroupByID(reportGroupIdToEdit),\n {\n enabled: isEditMode,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n onError: () => {\n history.push(`${PLUGIN_BASE_URL}/report-groups/`);\n return;\n },\n }\n );\n\n React.useEffect(() => {\n if (!!defaultReportGroupFetched) {\n setDefaultReportGroup({\n ...defaultReportGroupFetched,\n members: defaultReportGroupFetched.members.map((member: User) => member.id),\n });\n }\n }, [defaultReportGroupFetched]);\n\n React.useEffect(() => {\n if (!isEditMode && !isUsersLoading) {\n setReady(true);\n }\n\n if (isEditMode && !isUsersLoading && !isRefetching && !isReportGroupByIDLoading) {\n setReady(true);\n }\n }, [isEditMode, isRefetching, isReportGroupByIDLoading, isUsersLoading]);\n\n const createReportGroupMutation = useMutation(\n (newReportGroup: ReportGroupType) => createReportGroup(newReportGroup),\n {\n onSuccess: () => {\n history.push(`${PLUGIN_BASE_URL}/report-groups/`);\n return;\n },\n }\n );\n\n const submitCreateReportGroup = (data: ReportGroupType): any => {\n createReportGroupMutation.mutate(data);\n };\n\n if (!ready) {\n return ;\n }\n\n return (\n \n \n history.push(prefixRoute(ROUTES.REPORT_GROUP))}\n />\n \n {({ register, errors, control }) => {\n return (\n <>\n
    \n \n \n \n\n \n \n \n
    \n\n {users ? (\n (\n {\n const updatedSelectedMembers = selectedMembers.includes(userID)\n ? selectedMembers.filter((el) => el !== userID)\n : [...selectedMembers, userID];\n\n onChange(updatedSelectedMembers);\n }}\n />\n )}\n name=\"members\"\n control={control}\n />\n ) : (\n \n Report group must have members to be assigned from mSupply user. Please make sure you have mSupply\n datasource selected in Plugin configuration.\n \n )}\n\n
    \n \n
    \n \n );\n }}\n \n
    \n \n );\n};\n\nexport { CreateReportGroup };\n","import React, { useState } from 'react';\nimport { css, cx } from '@emotion/css';\nimport intl from 'react-intl-universal';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { prefixRoute } from '../../utils/navigation';\nimport { EmptyListCTA, Loading } from 'components/common';\nimport { Panel, PanelDetails, ScheduleType } from 'types';\nimport { useQuery, useMutation } from 'react-query';\nimport { deleteSchedule, getSchedules } from 'api';\nimport { Button, Card, ConfirmModal, HorizontalGroup, LinkButton, Spinner, Tag, useStyles2 } from '@grafana/ui';\nimport { useToggle } from 'hooks';\nimport { PanelContext, PanelProvider } from 'context';\n// eslint-disable-next-line no-restricted-imports\nimport moment from 'moment';\n\nconst Schedule: React.FC = () => {\n const styles = useStyles2(getStyles);\n\n const [deleteAlertIsOpen, setDeleteAlertIsOpen] = useToggle(false);\n const [deleteScheduleID, setDeleteScheduleID] = useState('');\n\n const {\n data: schedules,\n isLoading,\n refetch: refetchSchedules,\n } = useQuery(`scheduled`, getSchedules, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const onScheduleDelete = (reportGroupID: string) => {\n setDeleteAlertIsOpen();\n setDeleteScheduleID(reportGroupID);\n };\n\n const { mutate: deleteScheduleMutate } = useMutation(deleteSchedule, {\n onSuccess: () => {\n refetchSchedules();\n return;\n },\n });\n\n const onConfirmDeleteGroup = () => {\n deleteScheduleMutate(deleteScheduleID);\n setDeleteAlertIsOpen();\n };\n\n if (isLoading) {\n return ;\n }\n\n if (!!!schedules || !schedules.length) {\n return ;\n }\n\n return (\n
    \n
    \n \n {intl.get('add_schedule')}\n \n
    \n
      \n {schedules.map((schedule) => (\n
    • \n \n {schedule.name}\n {schedule.description}\n \n {schedule.nextReportTime ? (\n
      Next schedule: {moment.unix(schedule.nextReportTime).format('LLLL')}
      \n ) : (\n ''\n )}\n {schedule.panelDetails && (\n \n
      \n \n \n {({ panels }) => {\n if (!panels || !panels.length) {\n return ;\n }\n\n return (\n !!panels &&\n schedule.panelDetails.map(({ id, panelID, dashboardID }: PanelDetails) => {\n const panel = panels.find(\n (panel: Panel) => panel.id === panelID && panel.dashboardID === dashboardID\n );\n\n if (!panel) {\n return false;\n }\n\n return ;\n })\n );\n }}\n \n \n
      \n \n )}\n
      \n \n \n Edit\n \n onScheduleDelete(schedule.id)}\n >\n {intl.get('delete')}\n \n \n
      \n
    • \n ))}\n
    \n \n
    \n );\n};\n\nconst EmptyList = () => {\n return (\n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginTop: css`\n margin-top: ${theme.spacing(2)};\n `,\n tag: css`\n margin-bottom: 6px;\n margin-right: 7px;\n padding: 5px;\n `,\n list: css({\n listStyle: 'none',\n display: 'grid',\n gap: '8px',\n }),\n adjustButtonToRight: css`\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n `,\n heading: css({\n fontSize: theme.v1.typography.heading.h5,\n fontWeight: 'inherit',\n }),\n card: css({\n gridTemplateAreas: `\n \"Figure Heading Actions\"\n \"Figure Description Actions\"\n \"Figure Meta Actions\"\n \"Figure - Actions\"`,\n }),\n description: css({\n margin: '0px',\n fontSize: theme.typography.size.sm,\n }),\n actions: css({\n position: 'relative',\n alignSelf: 'center',\n marginTop: '0px',\n opacity: 0,\n\n '.card-parent:hover &, .card-parent:focus-within &': {\n opacity: 1,\n },\n }),\n});\n\nexport { Schedule };\n","import React from 'react';\n\nimport { NAVIGATION_TITLE, NAVIGATION_SUBTITLE } from '../../constants';\nimport { Page } from '../../components';\nimport { PanelProvider } from 'context';\nimport { CreateScheduleForm } from 'components/schedule/CreateScheduleForm';\nimport { RouteComponentProps } from 'react-router-dom';\n\nconst CreateSchedule: React.FC = () => (\n \n \n \n \n \n \n \n);\n\nexport { CreateSchedule };\n","import { ROUTES } from '../constants';\nimport { Redirect, Route, Switch } from 'react-router-dom';\nimport { prefixRoute, useNavigation } from '../utils/navigation';\nimport { ReportGroup, Schedule, CreateReportGroup, CreateSchedule } from '../Pages';\nimport React from 'react';\n\nconst AppRoutes = () => {\n useNavigation();\n\n return (\n \n \n \n\n {/* Full-width page (this page will have no navigation bar) */}\n \n \n\n \n \n\n {/* Default page */}\n \n \n \n \n );\n};\n\nexport { AppRoutes };\n","import { NavModel } from '@grafana/data';\nimport { NAVIGATION } from '../../constants';\nimport { usePluginProps } from 'context';\nimport { useLocation } from 'react-router-dom';\nimport { getNavModel } from '.';\nimport { useEffect } from 'react';\n\n// Displays a top navigation tab-bar if needed\nfunction useNavigation() {\n const pluginProps = usePluginProps();\n const location = useLocation();\n\n useEffect(() => {\n const excludeURIs: string[] = ['create', 'edit'];\n\n if (!pluginProps) {\n console.error('Root plugin props are not available in the context.');\n return;\n }\n\n const activeId = excludeURIs.some((uri) => location.pathname.includes(uri))\n ? ''\n : Object.keys(NAVIGATION).find((routeId) => location.pathname.includes(routeId)) || '';\n const activeNavItem = NAVIGATION[activeId];\n\n const { onNavChanged, meta, basename } = pluginProps;\n\n // Disable tab navigation\n // (the route is not registered as a navigation item)\n if (!activeNavItem) {\n onNavChanged(undefined as unknown as NavModel);\n }\n\n // Show tabbed navigation with the active tab\n else {\n onNavChanged(\n getNavModel({\n activeId,\n basePath: basename,\n logoUrl: meta.info.logos.large,\n })\n );\n }\n }, [location.pathname, pluginProps]);\n}\n\nexport { useNavigation };\n","import { NAVIGATION_TITLE, NAVIGATION_SUBTITLE, NAVIGATION } from '../../constants';\n\nfunction getNavModel({ activeId, basePath, logoUrl }: { activeId: string; basePath: string; logoUrl: string }) {\n const main = {\n text: NAVIGATION_TITLE,\n subTitle: NAVIGATION_SUBTITLE,\n url: basePath,\n img: logoUrl,\n children: Object.values(NAVIGATION).map((navItem) => ({\n ...navItem,\n active: navItem.id === activeId,\n })),\n };\n\n return {\n main,\n node: main,\n };\n}\n\nexport { getNavModel };\n","import React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport intl from 'react-intl-universal';\n\nimport { AppRootProps } from '@grafana/data';\n\nimport { PluginPropsContext } from '../context';\nimport { AppRoutes } from './AppRoutes';\n\nimport { AppSettings } from 'types';\n\nimport { locales } from '../locales';\nimport { Loading } from 'components';\n\nconst queryClient = new QueryClient();\n\ntype AppRootState = { initDone: boolean };\nclass App extends React.PureComponent, AppRootState> {\n state: AppRootState = {\n // optional second annotation for better type inference\n initDone: false,\n };\n\n componentDidMount() {\n this.loadLocales();\n }\n\n loadLocales() {\n // init method will load CLDR locale data according to currentLocale\n // react-intl-universal is singleton, so you should init it only once in your app\n intl\n .init({\n currentLocale: 'en-UK', // TODO: determine locale here\n fallbackLocale: 'en-US',\n locales,\n })\n .then(() => {\n // After loading CLDR locale data, start to render\n this.setState({\n initDone: true,\n });\n });\n }\n\n render() {\n return this.state.initDone ? (\n \n \n \n \n \n ) : (\n
    \n \n
    \n );\n }\n}\n\nexport { App };\n","import { AppPlugin } from '@grafana/data';\nimport { App } from 'components/App';\nimport { AppSettings } from 'types';\nimport { AppConfig } from './Pages/AppConfig';\n\nexport const plugin = new AppPlugin().setRootPage(App).addConfigPage({\n title: 'Configuration',\n icon: 'fa fa-cog',\n // @ts-ignore - Would expect a Class component, however works absolutely fine with a functional one\n // Implementation: https://github.com/grafana/grafana/blob/fd44c01675e54973370969dfb9e78f173aff7910/public/app/features/plugins/PluginPage.tsx#L157\n body: AppConfig,\n id: 'configuration',\n});\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","_interopDefault","ex","React","IntlMessageFormat","escapeHtml","cookie","queryParser","invariant","merge","currency","numberFormat","i","length","style","defaultFormats","number","createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","Constructor","protoProps","staticProps","prototype","String","defaultMessage","d","msg","this","ReactIntlUniversal","instance","TypeError","classCallCheck","options","currentLocale","locales","warningHandler","_console","console","warn","apply","arguments","fallbackLocale","value","variables","intlGetHook","e","log","_options","formats","getDescendantProp","assign","indexOf","format","err","message","get","el","createElement","dangerouslySetInnerHTML","__html","messageDescriptor","id","getHTML","undefined","getLocaleFromURL","getLocaleFromCookie","getLocaleFromLocalStorage","getLocaleFromBrowser","Promise","resolve","reject","cookieLocaleKey","params","parse","document","localStorageLocaleKey","window","localStorage","getItem","urlLocaleKey","query","location","search","split","locale","reduce","a","b","navigator","language","userLanguage","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","g","freeSelf","self","root","Function","freeExports","nodeType","freeModule","moduleExports","freeProcess","process","nodeUtil","require","types","binding","nodeIsTypedArray","isTypedArray","func","thisArg","args","call","uid","transform","arrayProto","Array","funcProto","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","exec","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","Symbol","Uint8Array","getPrototype","allocUnsafe","getPrototypeOf","arg","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","max","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","index","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","has","pop","push","getMapData","pairs","LARGE_ARRAY_SIZE","baseGetTag","isOwn","tag","unmasked","getRawTag","objectToString","baseIsArguments","isObjectLike","baseMerge","source","srcIndex","customizer","stack","iteratee","keysFunc","iterable","baseFor","srcValue","mergeFunc","safeGet","stacked","typedArray","buffer","arrayBuffer","newValue","isCommon","isArr","isArray","isBuff","isTyped","isArrayLike","copyArray","isDeep","slice","cloneBuffer","constructor","byteLength","byteOffset","Ctor","isPlainObject","isArguments","isNew","copyObject","keysIn","toPlainObject","isFunction","isPrototype","initCloneObject","baseMergeDeep","baseSetToString","string","identity","map","type","getValue","isMasked","test","toSource","baseIsNative","isIndex","setToString","count","lastCalled","stamp","remaining","shortOut","other","isLength","baseUnary","inherited","isArg","isType","skipIndexes","n","baseTimes","arrayLikeKeys","nativeKeysIn","isProto","baseKeysIn","assigner","start","otherArgs","overRest","baseRest","sources","guard","isIterateeCall","__WEBPACK_EXTERNAL_MODULE__6__","__WEBPACK_EXTERNAL_MODULE__7__","__WEBPACK_EXTERNAL_MODULE__8__","IntlPolyfill","Intl","__applyLocaleSensitivePrototypes","REACT_ELEMENT_TYPE","_typeof","iterator","obj","jsx","for","children","defaultProps","childrenLength","propName","childArray","$$typeof","ref","_owner","defineProperty$1","_extends","selfGlobal","babelHelpers$1","freeze","asyncToGenerator","fn","gen","step","info","error","done","then","defineEnumerableProperties","descs","desc","defaults","getOwnPropertyNames","getOwnPropertyDescriptor","property","receiver","parent","getter","inherits","subClass","superClass","setPrototypeOf","__proto__","interopRequireDefault","__esModule","default","interopRequireWildcard","newObj","newArrowCheck","innerThis","boundThis","objectDestructuringEmpty","objectWithoutProperties","possibleConstructorReturn","ReferenceError","setter","slicedToArray","arr","_arr","_n","_d","_e","_s","_i","next","sliceIterator","slicedToArrayLoose","_step","_iterator","taggedTemplateLiteral","strings","raw","taggedTemplateLiteralLoose","temporalRef","val","name","undef","temporalUndefined","toArray","from","toConsumableArray","arr2","typeof","extends","instanceof","left","right","hasInstance","realDefineProp","sentinel","es3","__defineGetter__","hop","arrIndexOf","t","objCreate","F","k","arrSlice","arrConcat","concat","arrPush","arrJoin","join","arrShift","shift","fnBind","bind","thisObj","internals","secret","random","Record","List","createRegExpRestore","disableRegExpRestore","regExpCache","lastMatch","leftContext","multiline","input","esc","lm","reg","m","exprStr","match","expr","lastIndex","toObject","toNumber","Number","getInternalProperties","__getInternalProperties","expBCP47Syntax","expVariantDupes","expSingletonDupes","expExtSequences","defaultLocale","redundantTags","tags","subtags","BU","DD","FX","TP","YD","ZR","heploc","iw","ji","jw","mo","ayx","bjd","ccq","cjr","cka","cmk","drh","drw","gav","hrr","ibi","kgh","lcq","mst","myt","sca","tie","tkk","tlw","tnf","ybd","yma","extLang","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","aed","aen","afb","afg","ajp","apc","apd","arb","arq","ars","ary","arz","ase","asf","asp","asq","asw","auz","avl","ayh","ayl","ayn","ayp","bbz","bfi","bfk","bjn","bog","bqn","bqy","btj","bve","bvl","bvu","bzs","cdo","cds","cjy","cmn","coa","cpx","csc","csd","cse","csf","csg","csl","csn","csq","csr","czh","czo","doq","dse","dsl","dup","ecs","esl","esn","eso","eth","fcs","fse","fsl","fss","gan","gds","gom","gse","gsg","gsm","gss","gus","hab","haf","hak","hds","hji","hks","hos","hps","hsh","hsl","hsn","icl","ils","inl","ins","ise","isg","isr","jak","jax","jcs","jhs","jls","jos","jsl","jus","kgi","knn","kvb","kvk","kvr","kxd","lbs","lce","lcf","liw","lls","lsg","lsl","lso","lsp","lst","lsy","ltg","lvs","lzh","mdl","meo","mfa","mfb","mfs","min","mnp","mqg","mre","msd","msi","msr","mui","mzc","mzg","mzy","nan","nbs","ncs","nsi","nsl","nsp","nsr","nzs","okl","orn","ors","pel","pga","pks","prl","prz","psc","psd","pse","psg","psl","pso","psp","psr","pys","rms","rsi","rsl","sdl","sfb","sfs","sgg","sgx","shu","slf","sls","sqk","sqs","ssh","ssp","ssr","svk","swc","swh","swl","syy","tmw","tse","tsm","tsq","tss","tsy","tza","ugn","ugy","ukl","uks","urk","uzn","uzs","vgt","vkk","vkt","vsi","vsl","vsv","wuu","xki","xml","xmm","xms","yds","ysl","yue","zib","zlm","zmi","zsl","zsm","toLatinUpperCase","str","ch","charAt","toUpperCase","IsStructurallyValidLanguageTag","CanonicalizeLanguageTag","parts","toLowerCase","sort","_max","expCurrencyCode","expUnicodeExSeq","CanonicalizeLocaleList","seen","O","len","isNaN","floor","abs","toInteger","Infinity","pow","toLength","Pk","kValue","RangeError","BestAvailableLocale","availableLocales","candidate","pos","lastIndexOf","substring","LookupMatcher","requestedLocales","availableLocale","noExtensionsLocale","extension","extensionIndex","ResolveLocale","relevantExtensionKeys","localeData","r","BestFitMatcher","foundLocale","extensionSubtags","extensionSubtagsLength","supportedExtension","keyLocaleData","supportedExtensionAddition","keyPos","requestedValue","optionsValue","privateIndex","preExtension","postExtension","LookupSupportedLocales","subset","SupportedLocales","matcher","localeMatcher","P","BestFitSupportedLocales","GetOption","values","fallback","Boolean","GetNumberOption","minimum","maximum","ll","currencyMinorUnits","BHD","BYR","XOF","BIF","XAF","CLF","CLP","KMF","DJF","XPF","GNF","ISK","IQD","JPY","JOD","KRW","KWD","LYD","OMR","PYG","RWF","TND","UGX","UYI","VUV","VND","NumberFormatConstructor","InitializeNumberFormat","NumberFormat","internal","regexpRestore","opt","dataLocale","s","normalized","c","cDigits","cd","mnid","mnfd","mxfd","mnsd","minimumSignificantDigits","mxsd","maximumSignificantDigits","stylePatterns","patterns","positivePattern","negativePattern","GetFormatNumber","bf","FormatNumber","FormatNumberToParts","x","PartitionNumberPattern","part","nums","ild","symbols","latn","pattern","beginIndex","endIndex","nextIndex","Error","literal","p","isFinite","_n2","ToRawPrecision","ToRawFixed","numSys","digits","digit","integer","fraction","decimalSepIndex","groupSepSymbol","group","groups","pgSize","primaryGroupSize","sgSize","secondaryGroupSize","end","idx","integerGroup","decimalSepSymbol","decimal","infinity","plusSignSymbol","plusSign","minusSignSymbol","minusSign","percentSignSymbol","percentSign","currencies","_literal","_literal2","minPrecision","maxPrecision","log10","round","LOG10E","log10Floor","f","exp","LN10","cut","minInteger","minFraction","maxFraction","toFixed","int","arab","arabext","bali","beng","deva","fullwide","gujr","guru","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","prop","expDTComponents","expPatternTrimmer","unwantedDTCs","dtKeys","tmKeys","isDateFormatOnly","isTimeFormatOnly","joinDateAndTimeFormats","dateFormatObj","timeFormatObj","o","_","j","computeFinalPatterns","formatObj","pattern12","extendedPattern","$0","expDTComponentsMeta","era","year","quarter","month","week","day","weekday","hour12","hour","minute","second","timeZoneName","createDateTimeFormat","skeleton","originalPattern","validSyntheticProps","numeric","narrow","short","long","dateWidths","resolveDateString","ca","component","width","gregory","alts","resolved","DateTimeFormatConstructor","InitializeDateTimeFormat","DateTimeFormat","dateTimeFormat","ToDateTimeOptions","tz","timeZone","dateTimeComponents","bestFormat","dataLocaleData","availableFormats","timeFormats","dateFormats","computed","timeRelatedFormats","dateRelatedFormats","full","medium","createDateTimeFormats","ToDateTimeFormats","bestScore","score","optionsProp","formatProp","optionsPropIndex","formatPropIndex","delta","BasicFormatMatcher","_hr","optionsPropNames","_bestFormat","propValue","_ref2","generateSyntheticFormat","_property","BestFitFormatMatcher","_prop","hr12","hourNo0","GetFormatDateTime","required","opt2","needDefaults","date","FormatDateTime","CreateDateTimeParts","nf","useGrouping","nf2","minimumIntegerDigits","tm","calendars","fv","v","substr","FormatToPartsDateTime","ls","__localeSensitiveProtos","toLocaleString","toLocaleDateString","toLocaleTimeString","nu","setDefaultLocale","addLocaleData","matchHtmlRegExp","escape","html","charCodeAt","qs","sep","regexp","maxKeys","kstr","vstr","decodeURIComponent","stringifyPrimitive","ks","encodeURIComponent","filter","condition","argIndex","framesToPop","global","method","con","dummy","properties","methods","unstable_batchedUpdates","notifyManager","defaultContext","QueryClientSharingContext","getQueryClientContext","contextSharing","ReactQueryClientContext","useQueryClient","queryClient","QueryClientProvider","_ref","client","_ref$contextSharing","mount","unmount","Context","Provider","MutationObserver","_Subscribable","_this","setOptions","bindMethods","updateResult","_proto","mutate","reset","defaultMutationOptions","onUnsubscribe","_this$currentMutation","listeners","currentMutation","removeObserver","onMutationUpdate","action","notifyOptions","onSuccess","onError","notify","getCurrentResult","currentResult","mutateOptions","getMutationCache","build","addObserver","execute","state","isLoading","status","isSuccess","isError","isIdle","_this2","context","onSettled","forEach","listener","shouldThrowError","suspense","_useErrorBoundary","useMutation","arg1","arg2","arg3","mountedRef","forceUpdate","obsRef","current","unsubscribe","subscribe","catch","useErrorBoundary","mutateAsync","QueryObserver","trackedProps","previousSelectError","remove","refetch","onSubscribe","currentQuery","shouldFetchOnMount","executeFetch","updateTimers","destroy","shouldFetchOnReconnect","enabled","refetchOnReconnect","isStale","shouldFetchOnWindowFocus","refetchOnWindowFocus","clearTimers","prevOptions","prevQuery","defaultQueryObserverOptions","queryKey","updateQuery","mounted","hasListeners","shouldFetchOptionally","staleTime","updateStaleTimeout","nextRefetchInterval","computeRefetchInterval","currentRefetchInterval","updateRefetchInterval","getOptimisticResult","defaultedOptions","getQueryCache","createResult","trackResult","trackedResult","trackProp","includes","getNextResult","_this3","isFetching","throwOnError","getCurrentQuery","fetch","meta","refetchPage","fetchOptimistic","_this4","fetchOptions","_this5","promise","_this6","clearStaleTimeout","timeout","dataUpdatedAt","staleTimeoutId","setTimeout","_this$options$refetch","refetchInterval","nextInterval","_this7","clearRefetchInterval","refetchIntervalId","setInterval","refetchIntervalInBackground","focusManager","clearTimeout","clearInterval","prevResult","prevResultState","currentResultState","prevResultOptions","currentResultOptions","queryChange","queryInitialState","currentQueryInitialState","prevQueryResult","previousQueryResult","errorUpdatedAt","isPreviousData","isPlaceholderData","optimisticResults","fetchOnMount","fetchOptionally","keepPreviousData","dataUpdateCount","select","_this$previousSelect","previousSelect","structuralSharing","selectError","placeholderData","failureCount","fetchFailureCount","isFetched","errorUpdateCount","isFetchedAfterMount","isRefetching","isLoadingError","isRefetchError","shouldNotifyListeners","_this$options","notifyOnChangeProps","notifyOnChangePropsExclusions","includedProps","some","typedKey","changed","isIncluded","isExcluded","defaultNotifyOptions","cache","onQueryUpdate","_this8","retryOnMount","shouldLoadOnMount","refetchOnMount","shouldRefetchOnMount","isStaleByTime","_isReset","QueryErrorResetBoundaryContext","clearReset","isReset","useQuery","Observer","errorResetBoundary","cacheTime","observer","useBaseQuery","Query","config","abortSignalConsumed","hadObservers","defaultOptions","observers","queryHash","initialState","getDefaultState","scheduleGc","_this$options$cacheTi","setDefaultOptions","clearGcTimeout","gcTimeout","optionalRemove","setData","updater","_this$options$isDataE","prevData","isDataEqual","dispatch","updatedAt","setState","setStateOptions","cancel","_this$retryer","retryer","silent","isActive","isInvalidated","onFocus","_this$retryer2","find","continue","onOnline","_this$retryer3","isTransportCancelable","revert","cancelRetry","getObserversCount","invalidate","_this$options$behavio","_context$fetchOptions","_abortController$abor","cancelRefetch","_this$retryer4","continueRetry","queryFn","abortController","queryFnContext","pageParam","signal","_this$options$behavio2","_context$fetchOptions2","fetchFn","behavior","onFetch","revertState","fetchMeta","abort","onFail","onPause","onContinue","retry","retryDelay","reducer","initialData","initialDataUpdatedAt","hasData","isPaused","_action$meta","_action$dataUpdatedAt","QueryCache","queries","queriesMap","_options$queryHash","defaultQueryOptions","getQueryDefaults","add","queryInMap","getAll","filters","exact","findAll","event","MutationCache","mutations","mutationId","mutation","mutationCache","mutationKey","getMutationDefaults","resumePausedMutations","pausedMutations","getNextPageParam","pages","QueryClient","queryCache","queryDefaults","mutationDefaults","unsubscribeFocus","onlineManager","unsubscribeOnline","_this$unsubscribeFocu","_this$unsubscribeOnli","fetching","isMutating","getQueryData","_this$queryCache$find","getQueriesData","queryKeyOrFilters","setQueryData","parsedOptions","setQueriesData","getQueryState","_this$queryCache$find2","removeQueries","resetQueries","_parseFilterArgs3","refetchFilters","active","refetchQueries","cancelQueries","_parseFilterArgs4","_parseFilterArgs4$","cancelOptions","promises","all","invalidateQueries","_ref3","_filters$refetchActiv","_filters$refetchInact","_parseFilterArgs5","refetchActive","inactive","refetchInactive","_parseFilterArgs6","fetchQuery","prefetchQuery","fetchInfiniteQuery","_context$fetchOptions3","_context$fetchOptions4","_context$state$data","_context$state$data2","fetchMore","isFetchingNextPage","direction","isFetchingPreviousPage","oldPages","oldPageParams","pageParams","abortSignal","newPageParams","cancelled","buildNewPages","param","page","previous","fetchPage","manual","queryFnResult","_manual","_param","getPreviousPageParam","shouldFetchFirstPage","_loop","_param2","finalPromise","prefetchInfiniteQuery","cancelMutations","executeMutation","getDefaultOptions","setQueryDefaults","_this$queryDefaults$f","setMutationDefaults","_this$mutationDefault","_defaulted","__WEBPACK_EXTERNAL_MODULE__21__","TYPE","isLiteralElement","isArgumentElement","argument","isNumberElement","isDateElement","isTimeElement","time","isSelectElement","isPluralElement","plural","isPoundElement","pound","isNumberSkeleton","isDateTimeSkeleton","extendStatics","__extends","__","__assign","SyntaxError","_super","expected","found","captureStackTrace","buildMessage","hex","literalEscape","classEscape","describeExpectation","expectation","text","escapedParts","inverted","description","expected1","descriptions","describeExpected","found1","pegParse","peg$result","peg$FAILED","peg$startRuleFunctions","peg$parsestart","peg$startRuleFunction","peg$c3","peg$literalExpectation","peg$c5","peg$otherExpectation","peg$c6","peg$c7","peg$c8","peg$c9","peg$c11","peg$c12","peg$c13","peg$classExpectation","peg$c14","peg$c15","peg$c17","peg$c19","peg$c22","peg$c23","peg$c26","messageCtx","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","insertLocation","peg$c32","peg$c33","peg$c34","peg$c35","peg$c36","peg$c37","peg$c38","peg$c39","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","peg$c50","peg$c51","peg$c53","peg$c54","peg$c57","peg$c62","peg$c63","peg$c64","peg$c65","peg$c66","peg$c67","peg$c68","peg$c69","peg$c71","peg$c74","peg$c75","peg$c76","peg$c81","peg$c83","peg$c84","peg$c86","peg$c88","peg$c89","peg$c90","peg$c91","peg$c93","peg$currPos","peg$savedPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","peg$computeLocation","location1","peg$buildSimpleError","text1","ignoreCase","peg$computePosDetails","details","startPos","endPos","startPosDetails","endPosDetails","offset","peg$fail","peg$parsemessage","s0","s1","peg$parsemessageElement","messageText","peg$parsemessageText","peg$parseliteralElement","s3","s5","peg$parse_","peg$parseargNameOrNumber","peg$parseargumentElement","s7","s9","s10","s11","s12","s2","peg$parsenumberSkeletonToken","tokens","peg$parsenumberSkeleton","peg$parsenumberArgStyle","peg$parsenumberFormatElement","peg$parsedateTimeSkeletonLiteral","peg$parsedateTimeSkeletonPattern","peg$parsedateTimeSkeleton","peg$parsedateOrTimeArgStyle","peg$parsedateOrTimeFormatElement","peg$parsesimpleFormatElement","s13","s14","s15","peg$parsenumber","peg$parsepluralOption","pluralType","_a","optionLocation","peg$c52","peg$parsepluralElement","peg$parseselectOption","peg$c55","peg$parseselectElement","peg$parsepoundElement","peg$parsedoubleApostrophes","peg$parsequotedString","peg$parseunquotedString","peg$parsenumberSkeletonId","s4","peg$parsewhiteSpace","peg$parsenumberSkeletonTokenOption","stem","peg$c20","s6","peg$parseargName","peg$parsepluralRuleSelectValue","peg$parsepatternSyntax","num","peg$parseargNumber","isInPluralOption","peg$parseescapedChar","parseInt","captureLocation","PLURAL_HASHTAG_REGEX","normalizeHashtagInPlural","els","matchingLiteralElIndex","literalEl","el_1","newEls","il","jl","__spreadArrays","opts","getCacheId","inputs","JSON","stringify","FormatConstructor","cacheId","DATE_TIME_REGEX","parseDateTimeSkeleton","hourCycle","FRACTION_PRECISION_REGEX","SIGNIFICANT_PRECISION_REGEX","parseSignificantPrecision","g1","g2","parseSign","signDisplay","currencySign","parseNotationOptions","convertNumberSkeletonToNumberFormatOptions","tokens_1","token","maximumFractionDigits","unit","notation","compactDisplay","currencyDisplay","unitDisplay","minimumFractionDigits","signOpts","domParser","FormatError","variableId","formatToParts","formatters","currentPluralValue","originalMessage","els_1","getNumberFormat","varName","getDateTimeFormat","PluralRules","rule","getPluralRules","lastPart","formatToString","TOKEN_REGEX","counter","restoreRichPlaceholderMessage","objectParts","SIMPLE_XML_REGEX","TEMPLATE_ID","VOID_ELEMENTS","formatHTMLElement","tagName","outerHTML","textContent","childNodes","isVoidElement","formatFnOrValue","chunks","child","formatHTMLMessage","formattedMessage","DOMParser","content","parseFromString","getElementById","tagsToFormat","getElementsByTagName","caseSensitiveTags","createDefaultFormatters","dateTime","pluralRules","overrideFormats","defaultConfig","configs","formatterCache","ast","resolvedOptions","supportedLocalesOf","getAst","__parse","c1","c2","percent","pairSplitRegExp","dec","decode","pair","eq_idx","trim","tryDecode","serialize","enc","encode","fieldContentRegExp","maxAge","domain","path","expires","toUTCString","httpOnly","secure","sameSite","TimePicker","openButton","fromField","toField","applyTimeRange","calendar","label","closeButton","absoluteTimeRangeTitle","DataSource","TestData","QueryTab","scenarioSelectContainer","scenarioSelect","noise","seriesCount","spread","startValue","drop","DataSourceHttpSettings","urlInput","Jaeger","traceIDInput","Prometheus","configPage","exemplarsAddButton","internalLinkSwitch","exemplarMarker","Menu","MenuComponent","MenuGroup","MenuItem","SubMenu","container","icon","Panels","Panel","title","headerItems","containerByTitle","headerCornerInfo","Visualization","Graph","VisualizationTab","legendSection","Legend","legendItemAlias","showLegendSwitch","xAxis","labels","BarGauge","valueV2","PieChart","svgSlice","Text","Table","header","footer","VizLegend","seriesName","Drawer","General","expand","contract","close","rcContentWrapper","PanelEditor","OptionsPane","fieldLabel","DataPane","applyButton","toggleVizPicker","toggleVizOptions","toggleTableView","PanelInspector","Data","Stats","Json","refreshButton","jsonObjectKeys","Tab","RefreshPicker","runButton","intervalButton","runButtonV2","intervalButtonV2","queryInspectorButton","addQuery","QueryEditorRows","rows","QueryEditorRow","actionButton","AlertTab","Alert","alert","alertV2","TransformTab","newTransform","transformationEditor","transformationEditorDebugger","Transforms","card","Reduce","modeLabel","calculationsLabel","searchInput","PageToolbar","item","QueryEditorToolbarItem","button","BackButton","backArrow","OptionsGroup","toggle","PluginVisualization","Select","option","singleValue","FieldConfigEditor","OverridesConfigEditor","FolderPicker","containerV2","ReadonlyFolderPicker","DataSourcePicker","inputV2","TimeZonePicker","WeekStartPicker","placeholder","TraceViewer","spanBar","QueryField","ValuePicker","Search","section","sectionV2","items","itemsV2","cards","collapseFolder","expandFolder","dashboardItem","dashboardItems","dashboardCard","DashboardLinks","dropDown","link","LoadingIndicator","CallToActionCard","buttonV2","DataLinksContextMenu","singleLink","CodeEditor","DashboardImportPage","textarea","submit","ImportDashboardForm","PanelAlertTabContent","VisualizationPreview","ColorSwatch","DashboardRow","UserProfile","profileSaveButton","preferencesSaveButton","orgsTable","sessionsTable","Login","url","username","password","skip","Home","delete","readOnly","saveAndTest","DataSources","dataSources","AddDataSource","dataSourcePlugins","dataSourcePluginsV2","ConfirmModal","AddDashboard","addNewPanel","addNewRow","addNewPanelLibrary","Dashboard","DashNav","nav","navV2","submenu","submenuItem","submenuItemLabels","submenuItemValueDropDownValueLinkTexts","submenuItemValueDropDownDropDown","submenuItemValueDropDownOptionTexts","Settings","deleteDashBoard","sectionItems","saveDashBoard","saveAsDashBoard","timezone","Annotations","addAnnotationCTA","addAnnotationCTAV2","Variables","addVariableCTA","addVariableCTAV2","newButton","table","tableRowNameFields","tableRowDefinitionFields","tableRowArrowUpButtons","tableRowArrowDownButtons","tableRowDuplicateButtons","tableRowRemoveButtons","Edit","headerLink","modeLabelNew","modeLabelEdit","generalNameInput","generalTypeSelect","generalLabelInput","generalHideSelect","selectionOptionsMultiSwitch","selectionOptionsIncludeAllSwitch","selectionOptionsCustomAllInput","previewOfValuesOption","submitButton","QueryVariable","queryOptionsDataSourceSelect","queryOptionsRefreshSelect","queryOptionsRegExInput","queryOptionsSortSelect","queryOptionsQueryInput","valueGroupsTagsEnabledSwitch","valueGroupsTagsTagsQueryInput","valueGroupsTagsTagsValuesQueryInput","ConstantVariable","constantOptionsQueryInput","TextBoxVariable","textBoxOptionsQueryInput","Dashboards","dashboards","SaveDashboardAsModal","newName","save","SaveDashboardModal","saveVariables","saveTimerange","SharePanelModal","linkToRenderedImage","Explore","graph","scrollBar","SoloPanel","PluginsList","list","listItem","signatureErrorNotice","PluginPage","signatureInfo","disabledInfo","PlaylistForm","interval","itemRow","itemIdType","itemTagType","itemMoveUp","itemMoveDown","itemDelete","components","selectors","__WEBPACK_EXTERNAL_MODULE__29__","_setPrototypeOf","_inheritsLoose","isServer","noop","functionalUpdate","isValidTimeout","ensureQueryKeyArray","timeUntilStale","parseQueryArgs","isQueryKey","parseMutationArgs","mutationFn","parseFilterArgs","matchQuery","predicate","stale","hashQueryKeyByOptions","partialMatchKey","queryStatusFilter","mapQueryStatusFilter","matchMutation","hashQueryKey","queryKeyHashFn","partialDeepEqual","replaceEqualDeep","aSize","bItems","bSize","copy","equalItems","shallowEqualObjects","hasObjectPrototype","ctor","prot","sleep","scheduleMicrotask","callback","getAbortController","AbortController","defaultRetryDelay","isCancelable","CancelledError","isCancelledError","Retryer","cancelFn","continueFn","promiseResolve","promiseReject","isResolved","outerResolve","outerReject","run","promiseOrValue","_unused","_config$retry","_config$retryDelay","delay","shouldRetry","continueResolve","FocusManager","setup","_window","addEventListener","removeEventListener","cleanup","setEventListener","_this$cleanup","_this$cleanup2","focused","setFocused","isFocused","visibilityState","Subscribable","OnlineManager","online","setOnline","isOnline","onLine","logger","getLogger","setLogger","newLogger","NotifyManager","queue","transactions","notifyFn","batchNotifyFn","batch","flush","schedule","batchCalls","_len","_key","setNotifyFunction","setBatchNotifyFunction","Mutation","restored","onMutate","_this$options$retry","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","loaded","__webpack_modules__","definition","globalThis","nmd","paths","PluginPropsContext","usePluginProps","useContext","__rest","getOwnPropertySymbols","__awaiter","_arguments","generator","fulfilled","rejected","getReportGroups","getBackendSrv","deleteReportGroup","reportGroupID","getDatasources","getDatasource","panelUsesVariable","sql","variableName","getDashboard","uuid","searchForDashboards","getSchedules","deleteSchedule","scheduleID","sendTestEmail","useDatasourceID","pluginProps","pluginMeta","settings","jsonData","datasourceID","useToggle","initial","useState","setToggle","useCallback","ROUTES","PLUGIN_ID","PLUGIN_BASE_URL","NAVIGATION_TITLE","NAVIGATION_SUBTITLE","NAVIGATION","REPORT_GROUP","sub","SCHEDULES","getIntervals","getWeekDays","prefixRoute","route","parseOrDefault","defaultValue","PanelContext","isPanelsLoading","panels","panelDetails","setPanelDetails","onUpdateVariable","panel","selectedValue","onUpdateLookback","selectableValue","PanelProvider","setIsPanelsLoading","dashboardMeta","newDashboardMeta","folderTitle","dashboardResponses","dashboard","datasource","datasourceName","templating","mappedPanels","rawPanel","rawSql","targets","variable","varDatasource","dashboardID","acc","flat","getPanels","useEffect","newPanelDetails","panelID","lookback","prevPanels","myIndex","findIndex","newVariable","newVariables","SecretInput","isConfigured","onReset","HorizontalGroup","Input","disabled","Button","onClick","variant","ctaStyle","css","infoBoxStyles","EmptyListCTA","buttonIcon","buttonLink","buttonTitle","buttonDisabled","proTip","proTipLink","proTipLinkTitle","proTipTarget","infoBox","infoBoxTitle","Icon","href","className","ctaElementClassName","ButtonEl","LinkButton","CallToActionElement","callToActionElement","Pagination","currentPage","numberOfPages","onNavigate","hideWhenSinglePage","showSmallVersion","styles","useStyles2","getStyles","pageLengthToCondense","pageButtons","useMemo","condensePages","getListItem","pagesToRender","pageIndex","lowerBoundIndex","upperBoundIndex","differenceOfBounds","currentPageIsBetweenBounds","ellipsisOffset","pageOffset","ellipsis","PageHeader","subTitle","headerCanvas","backButton","theme","colors","background","canvas","Page","headerProps","otherProps","cx","wrapper","CustomScrollbar","autoHeightMin","Contents","marginTop","Loading","rest","loadingWrapper","LoadingPlaceholder","AppConfigForm","plugin","loading","setLoading","datasources","isDatasourceListLoading","pinned","grafanaUsername","grafanaPassword","grafanaURL","isGrafanaPasswordSet","senderEmailAddress","senderEmailPassword","isSenderEmailPasswordSet","senderEmailHost","senderEmailPort","FieldSet","Field","onChange","menuShouldPortal","selectedDatasource","updatePluginAndReload","secureJsonData","fromEntries","colorWeak","secondary","spacing","marginTopXl","pluginId","updatePlugin","locationService","post","response","UserList","users","userListError","onUserChecked","checkedUsers","searchQuery","setSearchQuery","isNoEmailUsersHidden","setIsNoEmailUsersHidden","totalPages","paginationStates","setPaginationStates","onIsNoEmailUsersHiddenChange","currentTarget","checked","filteredUser","user","e_mail","getPaginatedUsers","ceil","wrap","marginBottom","align","justify","userID","Tag","EmptySearchResult","InlineField","grow","prefix","suffix","transparent","InlineSwitch","VerticalGroup","severity","checkboxWrapper","Checkbox","padding","renderUser","PanelItem","onPanelChecked","panelDetail","checkedPanels","cursor","preventDefault","marginForCheckbox","checkedPanel","PanelVariables","PanelList","panelListError","Card","display","flex","alignItems","Tooltip","placement","marginLeft","marginRight","detail","PanelVariableOptions","onUpdate","multiSelectable","selectableOptions","selectedOptions","refresh","includeAll","selectAllOption","datasourceId","optionsResponse","frames","results","A","datum","refreshPanelOptions","flexDirection","InlineFormLabel","MultiSelect","selected","filterOption","closeMenuOnSelect","timeToRegEx","timeFromRegEx","timeFilterRegEx","lookbacks","vars","usesMacro","border","tooltip","variableOptions","multi","PanelVariableTextInput","defaultFormValues","CreateScheduleForm","defaultSchedule","setDefaultSchedule","history","useHistory","scheduleIdToEdit","useParams","isEditMode","ready","setReady","isDefaultScheduleFetched","setIsDefaultScheduleFetched","defaultScheduleFetched","isScheduleByIDLoading","nextReportTime","restDefaultScheduleFetched","prevDetails","prevDetail","defaultDetail","reportGroups","createScheduleMutation","newSchedule","testEmails","isSendTestEmailLoading","titleHref","parentHref","onGoBack","Spinner","ToolbarButton","Form","onSubmit","selectedPanels","validateOnMount","defaultValues","validateOn","CreateScheduleFormPartial","isNullOrUndefined","isObjectType","isUndefined","VALIDATION_MODE","UNDEFINED","FormContext","displayName","useFormContext","shouldRenderFormState","formStateData","readFormStateRef","isRoot","formState","omit","isProxyEnabled","HTMLElement","Proxy","useController","rules","control","shouldUnregister","defaultValuesRef","register","fieldsRef","unregister","fieldArrayNamesRef","controllerSubjectRef","shouldUnmountUnregister","inFieldArrayActionRef","onBlur","isFieldArray","names","getNodeParentName","isNameInFieldArray","setInputStateValue","_f","formStateRef","formStateSubjectRef","nameRef","updateFormState","readFormState","isDirty","dirtyFields","touchedFields","isValidating","isValid","errors","formStateSubscription","convertToArrayPayload","localReadFormStateRef","getProxyFormState","useFormState","controllerSubscription","shouldUnmount","field","getControllerValue","elm","fieldState","invalid","isTouched","Controller","render","setValue","watch","reportGroup","getReportGroupOptions","InlineFieldRow","TimeOfDayPicker","inter","valueAsNumber","renderInterval","updatedSelectedPanels","selectedPanel","EmptyList","ReportGroup","deleteAlertIsOpen","setDeleteAlertIsOpen","deleteReportGroupID","setDeleteReportGroupID","deleteGroup","refetchReportGroups","adjustButtonToRight","heading","members","email","actions","isOpen","body","confirmText","onConfirm","onDismiss","listStyle","fontSize","v1","typography","h5","fontWeight","gridTemplateAreas","margin","sm","position","alignSelf","opacity","CreateReportGroup","reportGroupIdToEdit","fields","schema","columnsToExtract","indexes","myObj","getUsers","isUsersLoading","defaultReportGroup","setDefaultReportGroup","defaultReportGroupFetched","isReportGroupByIDLoading","member","createReportGroupMutation","newReportGroup","selectedMembers","updatedSelectedMembers","Schedule","deleteScheduleID","setDeleteScheduleID","schedules","refetchSchedules","deleteScheduleMutate","flexWrap","lineHeight","Consumer","gap","CreateSchedule","AppRoutes","useLocation","activeId","uri","pathname","routeId","activeNavItem","onNavChanged","basename","main","basePath","img","logoUrl","navItem","node","getNavModel","logos","large","useNavigation","Switch","Route","Redirect","to","App","initDone","loadLocales","AppPlugin","setRootPage","addConfigPage"],"sourceRoot":""} \ No newline at end of file diff --git a/custom-plugins/excel_report_email_scheduler/plugin.json b/custom-plugins/excel_report_email_scheduler/plugin.json new file mode 100644 index 00000000..513ea7ab --- /dev/null +++ b/custom-plugins/excel_report_email_scheduler/plugin.json @@ -0,0 +1,69 @@ +{ + "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json", + "type": "app", + "name": "Excel report e-mail scheduler", + "id": "msupplyfoundation-datasource", + "backend": true, + "alerting": false, + "metrics": false, + "annotations": false, + "executable": "gpx_excel_report_email_scheduler", + "info": { + "description": "Grafana plugin for mSupply Dashboard application. The plugin takes data from panels of mSupply dashboard to generate excel reports. The reports are then emailed to a custom user group created with mSupply users pulled from mSupply Dashboard's datasource. The timing of the scheduler can be set in the plugin.", + "author": { + "name": "mSupply Foundation", + "url": "https://msupply.foundation/" + }, + "keywords": ["grafana-plugin", "mSupply-foundation", "mSupply-dashboard", "datasource", "panel"], + "logos": { + "small": "img/msupply_light_icon.svg", + "large": "img/msupply_light_icon.svg" + }, + "links": [ + { + "name": "Website", + "url": "https://github.com/openmsupply/msupply-dashboard-app" + }, + { + "name": "License", + "url": "https://github.com/openmsupply/msupply-dashboard-app/blob/master/LICENSE" + } + ], + "screenshots": [], + "version": "2.1.1", + "updated": "2022-09-16" + }, + "includes": [ + { + "type": "page", + "name": "Report Groups", + "icon": "fa fa-group", + "path": "/a/msupplyfoundation-datasource", + "role": "Admin", + "addToNav": true, + "defaultNav": true + }, + { + "type": "page", + "name": "Schedules", + "icon": "fa fa-calendar", + "path": "/a/msupplyfoundation-datasource/schedules", + "role": "Admin", + "addToNav": true + }, + + { + "type": "page", + "icon": "fa fa-cog", + "name": "Configuration", + "path": "/plugins/msupplyfoundation-datasource", + "role": "Admin", + "addToNav": true + } + ], + "dependencies": { + "grafanaDependency": ">=8.0.0", + "grafanaVersion": "8.0.0", + "plugins": [] + } +} diff --git a/custom-plugins/msupply-dashboard-app/backend/MANIFEST.txt b/custom-plugins/msupply-dashboard-app/backend/MANIFEST.txt deleted file mode 100644 index b1331be3..00000000 --- a/custom-plugins/msupply-dashboard-app/backend/MANIFEST.txt +++ /dev/null @@ -1,45 +0,0 @@ - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "manifestVersion": "2.0.0", - "signatureType": "private", - "signedByOrg": "msupplyfoundation", - "signedByOrgName": "msupplyfoundation", - "rootUrls": [ - "https://demo-board.msupply.org:3000/", - "https://ci.msupply.org:3000/", - "https://liberia.msupply.org:3000/", - "https://tonga-vax.msupply.org:3000/", - "https://timor.msupply.org:3000/", - "http://localhost:3000/", - "https://vanuatu-vax.msupply.org:3000/", - "https://tokelau.msupply.org:3000/", - "https://tonga.msupply.org:3000/", - "https://who-demo.msupply.org:3000/" - ], - "plugin": "msupplyfoundation-datasource", - "version": "1.0.0", - "time": 1630713468977, - "keyId": "7e4d0c6a708866e7", - "files": { - "gpx_msupply-datasource_windows_amd64.exe": "3bd870e32e4264057300ef58e1161b002b86415e6ba10ece05d5f701d440e770", - "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", - "module.js.map": "6bb926e74abe6020fdf6672647f99791507c7592781ef2f6676c5ada66da4a4f", - "plugin.json": "0afc849543822e164c8383afa05ff3e7b526d161712eec3a92670c5afe9f2555", - "README.md": "b9bc43fc2b2f7ce74864ccf40de24cb465ccc953902071467916390a8e8b4a45", - "module.js": "e157158bb5ae7b498345ae08029093d7517f689fc02f03429184e7a026f15928", - "msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2" - } -} ------BEGIN PGP SIGNATURE----- -Version: OpenPGP.js v4.10.1 -Comment: https://openpgpjs.org - -wqIEARMKAAYFAmEytn0ACgkQfk0ManCIZudAOgIJARVCW8ArfcRyVseEUlFC -BN7fgXhEIlSvdf72mkzXfDe1cy4ea1KWcdC+Wtpn5gryFLB0eK9TALe08z6N -bIvP69RIAgkBUJ2lRDDX1ynXYXN1Np/SiuZU1/+vGTvOm8sxjV1Wzr+KBHei -9EgDvnfz4OekHOt+wEaiGQ6IwTYlG3Qfg75Qinw= -=Djuk ------END PGP SIGNATURE----- diff --git a/custom-plugins/msupply-dashboard-app/backend/README.md b/custom-plugins/msupply-dashboard-app/backend/README.md deleted file mode 100644 index b7cdcdb4..00000000 --- a/custom-plugins/msupply-dashboard-app/backend/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# mSupply Data Source - -This data source is a backend datastore for the mSupply Dashboard App plugin. - -The backend plugin uses a simple SQLite database and runs a HTTP restFUL server over Grafana's internal gRPC network to serve specific query requests. - -Currently the mSupply Dashboard App Plugin supports automatic emailing of reports which this datasource holds configurations for. - -Currently querying this datasource is unsupported for regular grafana operations. diff --git a/custom-plugins/msupply-dashboard-app/backend/module.js b/custom-plugins/msupply-dashboard-app/backend/module.js deleted file mode 100644 index fa63cee5..00000000 --- a/custom-plugins/msupply-dashboard-app/backend/module.js +++ /dev/null @@ -1,2 +0,0 @@ -define(["react","@grafana/data","@grafana/runtime"],(function(t,n,e){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="/",e(e.s=3)}([function(n,e){n.exports=t},function(t,e){t.exports=n},function(t,n){t.exports=e},function(t,n,e){"use strict";e.r(n);var r=e(0),o=e.n(r),u=e(1),i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function c(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var f=function(t){function n(n){return t.call(this,n)||this}return c(n,t),n}(e(2).DataSourceWithBackend),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){return o.a.createElement("div",{className:"gf-form-group"})},n}(r.PureComponent),l=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){return o.a.createElement("div",{className:"gf-form"})},n}(r.PureComponent);e.d(n,"plugin",(function(){return p})),e.d(n,"Hello",(function(){return s}));var p=new u.DataSourcePlugin(f).setConfigEditor(a).setQueryEditor(l),s=function(){return o.a.createElement("div",null,"Hello")}}])})); -//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/custom-plugins/msupply-dashboard-app/backend/module.js.map b/custom-plugins/msupply-dashboard-app/backend/module.js.map deleted file mode 100644 index 1c1cdb27..00000000 --- a/custom-plugins/msupply-dashboard-app/backend/module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@grafana/data\"","webpack:///external \"@grafana/runtime\"","webpack:///../node_modules/tslib/tslib.es6.js","webpack:///./DataSource.ts","webpack:///./ConfigEditor.tsx","webpack:///./QueryEditor.tsx","webpack:///./module.tsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","extendStatics","b","setPrototypeOf","__proto__","Array","__extends","__","this","constructor","instanceSettings","DataSource","render","className","setConfigEditor","setQueryEditor"],"mappings":"wFACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,IAIjBlC,EAAoBA,EAAoBmC,EAAI,G,gBClFrDhC,EAAOD,QAAUkC,G,cCAjBjC,EAAOD,QAAUmC,G,cCAjBlC,EAAOD,QAAUoC,G,+DCgBbC,EAAgB,SAAS7B,EAAG8B,GAI5B,OAHAD,EAAgBzB,OAAO2B,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUjC,EAAG8B,GAAK9B,EAAEgC,UAAYF,IACvE,SAAU9B,EAAG8B,GAAK,IAAK,IAAIN,KAAKM,EAAOA,EAAEP,eAAeC,KAAIxB,EAAEwB,GAAKM,EAAEN,MACpDxB,EAAG8B,IAGrB,SAASI,EAAUlC,EAAG8B,GAEzB,SAASK,IAAOC,KAAKC,YAAcrC,EADnC6B,EAAc7B,EAAG8B,GAEjB9B,EAAEsB,UAAkB,OAANQ,EAAa1B,OAAOY,OAAOc,IAAMK,EAAGb,UAAYQ,EAAER,UAAW,IAAIa,G,ICtBnF,cACE,WAAYG,G,OACV,YAAMA,IAAiB,KAE3B,OAJgC,EAAAC,EAAA,GAIhC,EAJA,C,KAAgC,uBCKhC,2B,+CAIA,OAJkC,OAChC,YAAAC,OAAA,WACE,OAAO,yBAAKC,UAAU,mBAE1B,EAJA,CAAkC,iBCDlC,2B,+CAIA,OAJiC,OAC/B,YAAAD,OAAA,WACE,OAAO,yBAAKC,UAAU,aAE1B,EAJA,CAAiC,iBCRjC,6EAOO,IAAM,EAAS,IAAI,mBAA2D,GAClFC,gBAAgB,GAChBC,eAAe,GAEL,EAAQ,WAAM","file":"module.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DataSourceInstanceSettings } from '@grafana/data';\nimport { DataSourceWithBackend } from '@grafana/runtime';\nimport { MyDataSourceOptions, MyQuery } from './types';\n\nexport class DataSource extends DataSourceWithBackend {\n constructor(instanceSettings: DataSourceInstanceSettings) {\n super(instanceSettings);\n }\n}\n","import React, { PureComponent } from 'react';\n\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { MyDataSourceOptions } from './types';\n\ninterface Props extends DataSourcePluginOptionsEditorProps {}\n\ninterface State {}\n\nexport class ConfigEditor extends PureComponent {\n render() {\n return
    ;\n }\n}\n","import React, { PureComponent } from 'react';\n\nimport { QueryEditorProps } from '@grafana/data';\nimport { DataSource } from './DataSource';\nimport { MyDataSourceOptions, MyQuery } from './types';\n\ntype Props = QueryEditorProps;\n\nexport class QueryEditor extends PureComponent {\n render() {\n return
    ;\n }\n}\n","import React from 'react';\nimport { DataSourcePlugin } from '@grafana/data';\nimport { DataSource } from './DataSource';\nimport { ConfigEditor } from './ConfigEditor';\nimport { QueryEditor } from './QueryEditor';\nimport { MyQuery, MyDataSourceOptions } from './types';\n\nexport const plugin = new DataSourcePlugin(DataSource)\n .setConfigEditor(ConfigEditor)\n .setQueryEditor(QueryEditor);\n\nexport const Hello = () =>
    Hello
    ;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/custom-plugins/msupply-dashboard-app/backend/plugin.json b/custom-plugins/msupply-dashboard-app/backend/plugin.json deleted file mode 100644 index 9365703f..00000000 --- a/custom-plugins/msupply-dashboard-app/backend/plugin.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "datasource", - "name": "mSupply Datasource", - "id": "msupplyfoundation-datasource", - "metrics": true, - "backend": true, - "executable": "gpx_msupply-datasource", - "info": { - "description": "", - "author": { - "name": "mSupply Foundation", - "url": "https://msupply.foundation/" - }, - "keywords": [], - "logos": { - "small": "msupply_light_icon.svg", - "large": "msupply_light_icon.svg" - }, - "links": [ - { - "name": "Website", - "url": "https://github.com/openmsupply/msupply-dashboard-app/tree/master/backend" - }, - { - "name": "License", - "url": "https://github.com/openmsupply/msupply-dashboard-app/blob/master/backend/LICENSE" - } - ], - "screenshots": [], - "version": "1.0.0", - "updated": "2021-05-06" - }, - "dependencies": { - "grafanaVersion": "7.x.x", - "plugins": [] - } -} diff --git a/custom-plugins/msupply-dashboard-app/frontend/MANIFEST.txt b/custom-plugins/msupply-dashboard-app/frontend/MANIFEST.txt deleted file mode 100644 index 897b9a52..00000000 --- a/custom-plugins/msupply-dashboard-app/frontend/MANIFEST.txt +++ /dev/null @@ -1,42 +0,0 @@ - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "manifestVersion": "2.0.0", - "signatureType": "private", - "signedByOrg": "msupplyfoundation", - "signedByOrgName": "msupplyfoundation", - "rootUrls": [ - "https://demo-board.msupply.org:3000/", - "https://ci.msupply.org:3000/", - "https://liberia.msupply.org:3000/", - "https://tonga-vax.msupply.org:3000/", - "https://timor.msupply.org:3000/", - "http://localhost:3000/" - ], - "plugin": "msupplyfoundation-scheduler", - "version": "1.0.0", - "time": 1624340436182, - "keyId": "7e4d0c6a708866e7", - "files": { - "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", - "module.js.LICENSE.txt": "42c1e051dfd53a9bb999495ef45df40051c66ab871060317457d17cb3ac6ac24", - "module.js.map": "eee6889704d222242d97e405ee3d3b525c46c65c76979fbd8b89a1cf255e725c", - "plugin.json": "9749beb0e6c81f87f7e225f645981603baa685faf9ce4780a4d2f48af43e4a91", - "README.md": "5b90c1aa9295a02ae248fb6165d7f024743ab5ceca9598d4118e30254de40fe6", - "common/translations/en.json": "9dec59ea1953ea14d8ecd8a39b106f568fdc08b9e07653c9975b9dd4f0925ef3", - "module.js": "1a9acbe39bff37985b58d59640eb2e61ead016af08d18f4d573459a91e9944fa", - "msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2" - } -} ------BEGIN PGP SIGNATURE----- -Version: OpenPGP.js v4.10.1 -Comment: https://openpgpjs.org - -wqAEARMKAAYFAmDRd9QACgkQfk0ManCIZufJTgII4mZ3xFlFksHrqcAy1kxK -VzmW5Mz1mt7i8O31aCQz9KSHAFWGbE5dEDAwzdCme6IhDQP1una875IaifbN -slGIToQCCL8EBwYa2/eHTeGIqk4S3Odv7UthvsZHPTiBT84EfjBxlZwCNcJY -8OP3KoFbfcaWnxePLeAOlZ7y6kdAJrjiZPYq -=uJXY ------END PGP SIGNATURE----- diff --git a/custom-plugins/msupply-dashboard-app/frontend/README.md b/custom-plugins/msupply-dashboard-app/frontend/README.md deleted file mode 100644 index 43ccceaa..00000000 --- a/custom-plugins/msupply-dashboard-app/frontend/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# mSupply Dashboard App - -The mSupply dashboard app is a Grafana App plugin which handles configuration of automatic email reporting when combined with the msupplyfoundation-datasource datasource plugin. diff --git a/custom-plugins/msupply-dashboard-app/frontend/module.js b/custom-plugins/msupply-dashboard-app/frontend/module.js deleted file mode 100644 index 3703158f..00000000 --- a/custom-plugins/msupply-dashboard-app/frontend/module.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see module.js.LICENSE.txt */ -define(["react","@grafana/ui","@grafana/runtime","emotion","@grafana/data","react-dom"],(function(e,t,r,n,a,i){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=23)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}n(r(10));var a=n(r(0)),i=n(r(24)),o=n(r(13)),u=n(r(14)),s=n(r(15)),l=n(r(18));r(19);for(var c=n(r(20)),f=["AFN","EUR","ALL","DZD","USD","AOA","XCD","ARS","AMD","AWG","AUD","AZN","BSD","BHD","BDT","BBD","BYN","BZD","XOF","BMD","INR","BTN","BOB","BOV","BAM","BWP","NOK","BRL","BND","BGN","BIF","CVE","KHR","XAF","CAD","KYD","CLP","CLF","CNY","COP","COU","KMF","CDF","NZD","CRC","HRK","CUP","CUC","ANG","CZK","DKK","DJF","DOP","EGP","SVC","ERN","ETB","FKP","FJD","XPF","GMD","GEL","GHS","GIP","GTQ","GBP","GNF","GYD","HTG","HNL","HKD","HUF","ISK","IDR","XDR","IRR","IQD","ILS","JMD","JPY","JOD","KZT","KES","KPW","KRW","KWD","KGS","LAK","LBP","LSL","ZAR","LRD","LYD","CHF","MOP","MKD","MGA","MWK","MYR","MVR","MRO","MUR","XUA","MXN","MXV","MDL","MNT","MAD","MZN","MMK","NAD","NPR","NIO","NGN","OMR","PKR","PAB","PGK","PYG","PEN","PHP","PLN","QAR","RON","RUB","RWF","SHP","WST","STD","SAR","RSD","SCR","SLL","SGD","XSU","SBD","SOS","SSP","LKR","SDG","SRD","SZL","SEK","CHE","CHW","SYP","TWD","TJS","TZS","THB","TOP","TTD","TND","TRY","TMT","UGX","UAH","AED","USN","UYU","UYI","UZS","VUV","VEF","VND","YER","ZMW","ZWL","XBA","XBB","XBC","XBD","XTS","XXX","XAU","XPD","XPT","XAG"],d={},p=0;p=0&&f.indexOf(">")>=0&&(f=o(f)),t[c]=f}try{return new i(s,a,u).format(t)}catch(t){return this.options.warningHandler("react-intl-universal format message failed for key='"+e+"'.",t.message),s}}},{key:"getHTML",value:function(e,t){if(this.options.intlGetHook)try{this.options.intlGetHook(e,this.options.currentLocale)}catch(e){}var r=this.get(e,t);if(r){var n=a.createElement("span",{dangerouslySetInnerHTML:{__html:r}}),i=function(){return n};return Object.assign({defaultMessage:i,d:i},n)}return""}},{key:"formatMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.get(r,t).defaultMessage(n)}},{key:"formatHTMLMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.getHTML(r,t).defaultMessage(n)}},{key:"determineLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getLocaleFromURL(e)||this.getLocaleFromCookie(e)||this.getLocaleFromLocalStorage(e)||this.getLocaleFromBrowser()}},{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(e.currentLocale,"options.currentLocale is required"),l(e.locales,"options.locales is required"),Object.assign(this.options,e),this.options.formats=Object.assign({},this.options.formats,h),new Promise((function(e,t){e()}))}},{key:"getInitOptions",value:function(){return this.options}},{key:"load",value:function(e){c(this.options.locales,e)}},{key:"getLocaleFromCookie",value:function(e){var t=e.cookieLocaleKey;if(t){var r=u.parse(document.cookie);return r&&r[t]}}},{key:"getLocaleFromLocalStorage",value:function(e){var t=e.localStorageLocaleKey;if(t&&window.localStorage)return localStorage.getItem(t)}},{key:"getLocaleFromURL",value:function(e){var t=e.urlLocaleKey;if(t){var r=location.search.split("?");if(r.length>=2){var n=s.parse(r[1]);return n&&n[t]}}}},{key:"getDescendantProp",value:function(e,t){return e[t]?e[t]:t.split(".").reduce((function(e,t){return null!=e?e[t]:e}),e)}},{key:"getLocaleFromBrowser",value:function(){return navigator.language||navigator.userLanguage}}]),e}();e.exports=new m,e.exports.ReactIntlUniversal=m},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t1){for(var s=Array(o),l=0;l=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},possibleConstructorReturn:function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},selfGlobal:s,set:function e(t,r,n,a){var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);null!==o&&e(o,r,n,a)}else if("value"in i&&i.writable)i.value=n;else{var u=i.set;void 0!==u&&u.call(a,n)}return n},slicedToArray:l,slicedToArrayLoose:function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e)){for(var r,n=[],a=e[Symbol.iterator]();!(r=a.next()).done&&(n.push(r.value),!t||n.length!==t););return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},taggedTemplateLiteral:function(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},taggedTemplateLiteralLoose:function(e,t){return e.raw=t,e},temporalRef:function(e,t,r){if(e===r)throw new ReferenceError(t+" is not defined - temporal dead zone");return e},temporalUndefined:{},toArray:function(e){return Array.isArray(e)?e:Array.from(e)},toConsumableArray:function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t="a"&&r<="z"&&(e=e.slice(0,t)+r.toUpperCase()+e.slice(t+1))}return e}function B(e){return!!L.test(e)&&(!P.test(e)&&!R.test(e))}function G(e){for(var t=void 0,r=void 0,n=1,a=(r=(e=e.toLowerCase()).split("-")).length;n1&&(t.sort(),e=e.replace(RegExp("(?:"+N.source+")+","i"),w.call(t,""))),p.call(z.tags,e)&&(e=z.tags[e]);for(var i=1,o=(r=e.split("-")).length;i-1)return r;var n=r.lastIndexOf("-");if(n<0)return;n>=2&&"-"===r.charAt(n-2)&&(n-=2),r=r.substring(0,n)}}function V(e,t){for(var r=0,n=t.length,a=void 0,i=void 0,o=void 0;r2){var E=u[_+1];-1!==w.call(g,E)&&(b="-"+m+"-"+(y=E))}else{-1!==w(g,"true")&&(y="true")}}if(p.call(r,"[["+m+"]]")){var x=r["[["+m+"]]"];-1!==w.call(g,x)&&x!==y&&(y=x,b="")}c["[["+m+"]]"]=y,f+=b,d++}if(f.length>2){var S=o.indexOf("-x-");if(-1===S)o+=f;else{var D=o.substring(0,S),j=o.substring(S);o=D+f+j}o=G(o)}return c["[[locale]]"]=o,c}function Y(e,t){for(var r=t.length,n=new D,a=0;an)throw new RangeError("Value is not a number or outside accepted range");return Math.floor(i)}return a}var J={};Object.defineProperty(J,"getCanonicalLocales",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=H(e),r=[],n=t.length,a=0;ai;i++){var o=r[i],u={};u.type=o["[[type]]"],u.value=o["[[value]]"],n[a]=u,a+=1}return n}function ie(e,t){var r=C(e),n=r["[[dataLocale]]"],a=r["[[numberingSystem]]"],i=x.NumberFormat["[[localeData]]"][n],o=i.symbols[a]||i.symbols.latn,u=void 0;!isNaN(t)&&t<0?(t=-t,u=r["[[negativePattern]]"]):u=r["[[positivePattern]]"];for(var s=new D,l=u.indexOf("{",0),c=0,f=0,d=u.length;l>-1&&lf){var h=u.substring(f,l);b.call(s,{"[[type]]":"literal","[[value]]":h})}var v=u.substring(l+1,c);if("number"===v)if(isNaN(t)){var m=o.nan;b.call(s,{"[[type]]":"nan","[[value]]":m})}else if(isFinite(t)){"percent"===r["[[style]]"]&&isFinite(t)&&(t*=100);var g=void 0;g=p.call(r,"[[minimumSignificantDigits]]")&&p.call(r,"[[maximumSignificantDigits]]")?ue(t,r["[[minimumSignificantDigits]]"],r["[[maximumSignificantDigits]]"]):se(t,r["[[minimumIntegerDigits]]"],r["[[minimumFractionDigits]]"],r["[[maximumFractionDigits]]"]),le[a]?function(){var e=le[a];g=String(g).replace(/\d/g,(function(t){return e[t]}))}():g=String(g);var y=void 0,w=void 0,E=g.indexOf(".",0);if(E>0?(y=g.substring(0,E),w=g.substring(E+1,E.length)):(y=g,w=void 0),!0===r["[[useGrouping]]"]){var S=o.group,O=[],j=i.patterns.primaryGroupSize||3,k=i.patterns.secondaryGroupSize||j;if(y.length>j){var F=y.length-j,A=F%k,T=y.slice(0,A);for(T.length&&b.call(O,T);Aa;a++){n+=r[a]["[[value]]"]}return n}function ue(e,t,r){var n=r,a=void 0,i=void 0;if(0===e)a=w.call(Array(n+1),"0"),i=0;else{i=function(e){if("function"==typeof Math.log10)return Math.floor(Math.log10(e));var t=Math.round(Math.log(e)*Math.LOG10E);return t-(Number("1e"+t)>e)}(Math.abs(e));var o=Math.round(Math.exp(Math.abs(i-n+1)*Math.LN10));a=String(Math.round(i-n+1<0?e*o:e/o))}if(i>=n)return a+w.call(Array(i-n+1+1),"0");if(i===n-1)return a;if(i>=0?a=a.slice(0,i+1)+"."+a.slice(i+1):i<0&&(a="0."+w.call(Array(1-(i+1)),"0")+a),a.indexOf(".")>=0&&r>t){for(var u=r-t;u>0&&"0"===a.charAt(a.length-1);)a=a.slice(0,-1),u--;"."===a.charAt(a.length-1)&&(a=a.slice(0,-1))}return a}function se(e,t,r,n){var a,i=n,o=Math.pow(10,i)*e,u=0===o?"0":o.toFixed(0),s=(a=u.indexOf("e"))>-1?u.slice(a+1):0;s&&(u=u.slice(0,a).replace(".",""),u+=w.call(Array(s-(u.length-1)+1),"0"));var l=void 0;if(0!==i){var c=u.length;if(c<=i)u=w.call(Array(i+1-c+1),"0")+u,c=i+1;var f=u.substring(0,c-i),d=u.substring(c-i,u.length);u=f+"."+d,l=f.length}else l=u.length;for(var p=n-r;p>0&&"0"===u.slice(-1);)u=u.slice(0,-1),p--;("."===u.slice(-1)&&(u=u.slice(0,-1)),lr&&(r=u,n=o),a++}return n}(u,E);else{var k=X(r,"hour12","boolean");u.hour12=void 0===k?_.hour12:k,w=function(e,t){var r=[];for(var n in De)p.call(De,n)&&void 0!==e["[["+n+"]]"]&&r.push(n);if(1===r.length){var a=function(e,t){var r;if(_e[e]&&_e[e][t])return r={originalPattern:_e[e][t],_:o({},e,t),extendedPattern:"{"+e+"}"},o(r,e,t),o(r,"pattern12","{"+e+"}"),o(r,"pattern","{"+e+"}"),r}(r[0],e["[["+r[0]+"]]"]);if(a)return a}var i=-1/0,u=void 0,s=0,l=t.length;for(;s=2||w>=2&&b<=1?_>0?f-=6:_<0&&(f-=8):_>1?f-=3:_<-1&&(f-=6)}}c._.hour12!==e.hour12&&(f-=1),f>i&&(i=f,u=c),s++}return u}(u,E)}for(var F in De)if(p.call(De,F)&&p.call(w,F)){var A=w[F];A=w._&&p.call(w._,F)?w._[F]:A,n["[["+F+"]]"]=A}var T=void 0,I=X(r,"hour12","boolean");if(n["[[hour]]"])if(I=void 0===I?_.hour12:I,n["[[hour12]]"]=I,!0===I){var L=_.hourNo0;n["[[hourNo0]]"]=L,T=w.pattern12}else T=w.pattern;else T=w.pattern;return n["[[pattern]]"]=T,n["[[boundFormat]]"]=void 0,n["[[initializedDateTimeFormat]]"]=!0,d&&(e.format=ke.call(e)),a(),e}h(J,"DateTimeFormat",{configurable:!0,writable:!0,value:Se}),h(Se,"prototype",{writable:!1});var De={weekday:["narrow","short","long"],era:["narrow","short","long"],year:["2-digit","numeric"],month:["2-digit","numeric","narrow","short","long"],day:["2-digit","numeric"],hour:["2-digit","numeric"],minute:["2-digit","numeric"],second:["2-digit","numeric"],timeZoneName:["short","long"]};function je(e,t,r){if(void 0===e)e=null;else{var n=k(e);for(var a in e=new O,n)e[a]=n[a]}e=m(e);var i=!0;return"date"!==t&&"any"!==t||void 0===e.weekday&&void 0===e.year&&void 0===e.month&&void 0===e.day||(i=!1),"time"!==t&&"any"!==t||void 0===e.hour&&void 0===e.minute&&void 0===e.second||(i=!1),!i||"date"!==r&&"all"!==r||(e.year=e.month=e.day="numeric"),!i||"time"!==r&&"all"!==r||(e.hour=e.minute=e.second="numeric"),e}function ke(){var e=null!==this&&"object"===c.typeof(this)&&C(this);if(!e||!e["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for format() is not an initialized Intl.DateTimeFormat object.");if(void 0===e["[[boundFormat]]"]){var t=E.call((function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=void 0===e?Date.now():F(e);return Ae(this,t)}),this);e["[[boundFormat]]"]=t}return e["[[boundFormat]]"]}function Fe(e,t){if(!isFinite(t))throw new RangeError("Invalid valid date passed to format");var r=e.__getInternalProperties(S);j();for(var n,a,i,o,u=r["[[locale]]"],s=new J.NumberFormat([u],{useGrouping:!1}),l=new J.NumberFormat([u],{minimumIntegerDigits:2,useGrouping:!1}),c=(n=t,r["[[calendar]]"],a=r["[[timeZone]]"],new O({"[[weekday]]":(i=new Date(n))[(o="get"+(a||""))+"Day"](),"[[era]]":+(i[o+"FullYear"]()>=0),"[[year]]":i[o+"FullYear"](),"[[month]]":i[o+"Month"](),"[[day]]":i[o+"Date"](),"[[hour]]":i[o+"Hours"](),"[[minute]]":i[o+"Minutes"](),"[[second]]":i[o+"Seconds"](),"[[inDST]]":!1})),f=r["[[pattern]]"],d=new D,p=0,h=f.indexOf("{"),v=0,m=r["[[dataLocale]]"],g=x.DateTimeFormat["[[localeData]]"][m].calendars,y=r["[[calendar]]"];-1!==h;){var w=void 0;if(-1===(v=f.indexOf("}",h)))throw new Error("Unclosed pattern");h>p&&b.call(d,{type:"literal",value:f.substring(p,h)});var _=f.substring(h+1,v);if(De.hasOwnProperty(_)){var E=r["[["+_+"]]"],k=c["[["+_+"]]"];if("year"===_&&k<=0?k=1-k:"month"===_?k++:"hour"===_&&!0===r["[[hour12]]"]&&0===(k%=12)&&!0===r["[[hourNo0]]"]&&(k=12),"numeric"===E)w=oe(s,k);else if("2-digit"===E)(w=oe(l,k)).length>2&&(w=w.slice(-2));else if(E in Ee)switch(_){case"month":w=xe(g,y,"months",E,c["[["+_+"]]"]);break;case"weekday":try{w=xe(g,y,"days",E,c["[["+_+"]]"])}catch(e){throw new Error("Could not find weekday data for locale "+u)}break;case"timeZoneName":w="";break;case"era":try{w=xe(g,y,"eras",E,c["[["+_+"]]"])}catch(e){throw new Error("Could not find era data for locale "+u)}break;default:w=c["[["+_+"]]"]}b.call(d,{type:_,value:w})}else if("ampm"===_){w=xe(g,y,"dayPeriods",c["[[hour]]"]>11?"pm":"am",null),b.call(d,{type:"dayPeriod",value:w})}else b.call(d,{type:"literal",value:f.substring(h,v+1)});p=v+1,h=f.indexOf("{",p)}return va;a++){n+=r[a].value}return n}function Ce(e,t){for(var r=Fe(e,t),n=[],a=0;r.length>a;a++){var i=r[a];n.push({type:i.type,value:i.value})}return n}x.DateTimeFormat={"[[availableLocales]]":[],"[[relevantExtensionKeys]]":["ca","nu"],"[[localeData]]":{}},h(J.DateTimeFormat,"supportedLocalesOf",{configurable:!0,writable:!0,value:E.call((function(e){if(!p.call(this,"[[availableLocales]]"))throw new TypeError("supportedLocalesOf() is not a constructor");var t=j(),r=arguments[1],n=this["[[availableLocales]]"],a=H(e);return t(),$(n,a,r)}),x.NumberFormat)}),h(J.DateTimeFormat.prototype,"format",{configurable:!0,get:ke}),Object.defineProperty(J.DateTimeFormat.prototype,"formatToParts",{enumerable:!1,writable:!0,configurable:!0,value:function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=null!==this&&"object"===c.typeof(this)&&C(this);if(!t||!t["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.");var r=void 0===e?Date.now():F(e);return Ce(this,r)}}),h(J.DateTimeFormat.prototype,"resolvedOptions",{writable:!0,configurable:!0,value:function(){var e=void 0,t=new O,r=["locale","calendar","numberingSystem","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"],n=null!==this&&"object"===c.typeof(this)&&C(this);if(!n||!n["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.");for(var a=0,i=r.length;a2&&4===a[1].length&&b.call(n,a[0]+"-"+a[2]);for(;r=_.call(n);)b.call(x.NumberFormat["[[availableLocales]]"],r),x.NumberFormat["[[localeData]]"][r]=e.number,e.date&&(e.date.nu=e.number.nu,b.call(x.DateTimeFormat["[[availableLocales]]"],r),x.DateTimeFormat["[[localeData]]"][r]=e.date);void 0===M&&function(e){M=e}(t)}(e,e.locale)}}),h(J,"__disableRegExpRestore",{value:function(){x.disableRegExpRestore=!0}}),e.exports=J}).call(this,r(7))},function(e,t){},function(e,t,r){"use strict";var n=/["'&<>]/;e.exports=function(e){var t,r=""+e,a=n.exec(r);if(!a)return r;var i="",o=0,u=0;for(o=a.index;o0&&l>s&&(l=s);for(var c=0;c=0?(f=v.substr(0,m),d=v.substr(m+1)):(f=v,d=""),p=decodeURIComponent(f),h=decodeURIComponent(d),n(o,p)?a(o[p])?o[p].push(h):o[p]=[o[p],h]:o[p]=h}return o};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,u){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?i(o(e),(function(o){var u=encodeURIComponent(n(o))+r;return a(e[o])?i(e[o],(function(e){return u+encodeURIComponent(n(e))})).join(t):u+encodeURIComponent(n(e[o]))})).join(t):u?encodeURIComponent(n(u))+r+encodeURIComponent(n(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n-1},K.prototype.set=function(e,t){var r=this.__data__,n=W(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},V.prototype.clear=function(){this.size=0,this.__data__={hash:new H,map:new(G||K),string:new H}},V.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},V.prototype.get=function(e){return se(this,e).get(e)},V.prototype.has=function(e){return se(this,e).has(e)},V.prototype.set=function(e,t){var r=se(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new K,this.size=0},Z.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Z.prototype.get=function(e){return this.__data__.get(e)},Z.prototype.has=function(e){return this.__data__.has(e)},Z.prototype.set=function(e,t){var r=this.__data__;if(r instanceof K){var n=r.__data__;if(!G||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new V(n)}return r.set(e,t),this.size=r.size,this};var ee,te=function(e,t,r){for(var n=-1,a=Object(e),i=r(e),o=i.length;o--;){var u=i[ee?o:++n];if(!1===t(a[u],u,a))break}return e};function re(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":N&&N in Object(e)?function(e){var t=S.call(e,N),r=e[N];try{e[N]=void 0;var n=!0}catch(e){}var a=D.call(e);n&&(t?e[N]=r:delete e[N]);return a}(e):function(e){return D.call(e)}(e)}function ne(e){return Ee(e)&&"[object Arguments]"==re(e)}function ae(e){return!(!_e(e)||function(e){return!!O&&O in e}(e))&&(be(e)?k:n).test(function(e){if(null!=e){try{return x.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function ie(e){if(!_e(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=fe(e),r=[];for(var n in e)("constructor"!=n||!t&&S.call(e,n))&&r.push(n);return r}function oe(e,t,r,n,a){e!==t&&te(t,(function(i,o){if(a||(a=new Z),_e(i))!function(e,t,r,n,a,i,o){var u=de(e,r),s=de(t,r),l=o.get(s);if(l)return void $(e,r,l);var c=i?i(u,s,r+"",e,t,o):void 0,f=void 0===c;if(f){var d=me(s),p=!d&&ye(s),h=!d&&!p&&xe(s);c=s,d||p||h?me(u)?c=u:Ee(b=u)&&ge(b)?c=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(M?function(e,t){return M(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:je);function he(e,t){return e===t||e!=e&&t!=t}var ve=ne(function(){return arguments}())?ne:function(e){return Ee(e)&&S.call(e,"callee")&&!P.call(e,"callee")},me=Array.isArray;function ge(e){return null!=e&&we(e.length)&&!be(e)}var ye=z||function(){return!1};function be(e){if(!_e(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function we(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function _e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ee(e){return null!=e&&"object"==typeof e}var xe=h?function(e){return function(t){return e(t)}}(h):function(e){return Ee(e)&&we(e.length)&&!!i[re(e)]};function Se(e){return ge(e)?Y(e,!0):ie(e)}var Oe,De=(Oe=function(e,t,r){oe(e,t,r)},ue((function(e,t){var r=-1,n=t.length,a=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(a=Oe.length>3&&"function"==typeof a?(n--,a):void 0,i&&function(e,t,r){if(!_e(r))return!1;var n=typeof t;return!!("number"==n?ge(r)&&ce(t,r.length):"string"==n&&t in r)&&he(r[t],e)}(t[0],t[1],i)&&(a=n<3?void 0:a,n=1),e=Object(e);++r0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}function l(e,t){for(var r=0,n=t.length,a=e.length;r=0&&e!==1/0}function T(){return"undefined"==typeof document||[void 0,"visible","prerender"].includes(document.visibilityState)}function I(){return void 0===navigator.onLine||navigator.onLine}function L(e,t,r,n){var a,i,o,u;return P(e)?(a=e.queryKey,i=e.queryFn,o=e.config,u=t):P(t)?(a=e,o=t,u=r):(a=e,i=t,o=r,u=n),o=o||{},i&&(o=x({},o,{queryFn:i})),[a,o,u]}function P(e){if(!R(e))return!1;var t=e.constructor;if(void 0===t)return!0;var r=t.prototype;return!!R(r)&&!!r.hasOwnProperty("isPrototypeOf")}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function N(e){return e instanceof S}function M(e){return{status:e,isLoading:e===d.Loading,isSuccess:e===d.Success,isError:e===d.Error,isIdle:e===d.Idle}}function z(e){var t;return function(r){t&&t(),t=r(e)}}function q(e){Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}var B=function(e){e()};var G={queries:{cacheTime:3e5,enabled:!0,notifyOnStatusChange:!0,queryFn:function(){return Promise.reject()},queryKeySerializerFn:function(e){try{var t=Array.isArray(e)?e:[e],r=(n=t,JSON.stringify(n,A));return[r,t=JSON.parse(r)]}catch(e){throw new Error("A valid query key is required!")}var n},refetchOnMount:!0,refetchOnReconnect:!0,refetchOnWindowFocus:!0,retry:3,retryDelay:function(e){return Math.min(1e3*Math.pow(2,e),3e4)},staleTime:0,structuralSharing:!0}};function Q(e,t,r,n){var a=e.getDefaultConfig(),i=x({},G.queries,null==a?void 0:a.shared,null==a?void 0:a.queries,null==r?void 0:r.shared,null==r?void 0:r.queries,n),o=i.queryKeySerializerFn(t);return i.queryCache=e,i.queryHash=o[0],i.queryKey=o[1],i}var U=new(function(){function e(){this.queue=[],this.transactions=0}var t=e.prototype;return t.batch=function(e){this.transactions++;var t=e();return this.transactions--,this.transactions||this.flush(),t},t.schedule=function(e){this.transactions?this.queue.push(e):q((function(){e()}))},t.flush=function(){var e=this.queue;this.queue=[],e.length&&q((function(){B((function(){e.forEach((function(e){e()}))}))}))},e}()),H=function(){function e(e){this.config=e,this.isStale=!0,this.initialUpdateCount=0,this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this),this.fetchMore=this.fetchMore.bind(this),this.unsubscribe=this.unsubscribe.bind(this),this.updateQuery()}var t=e.prototype;return t.subscribe=function(e){return this.listener=e||j,this.currentQuery.subscribeObserver(this),this.config.enabled&&(this.config.forceFetchOnMount||"always"===this.config.refetchOnMount)?this.fetch():this.optionalFetch(),this.updateTimers(),this.unsubscribe},t.unsubscribe=function(){this.listener=void 0,this.clearTimers(),this.currentQuery.unsubscribeObserver(this)},t.updateConfig=function(e){var t=this.config,r=this.currentQuery;if(this.config=function(e){return Boolean(e.queryHash)}(e)?e:this.config.queryCache.getResolvedQueryConfig(this.config.queryKey,e),this.updateQuery(),this.listener){if(this.currentQuery!==r)return this.optionalFetch(),void this.updateTimers();e.enabled&&!t.enabled&&this.optionalFetch(),e.enabled===t.enabled&&e.staleTime===t.staleTime||this.updateStaleTimeout(),e.enabled===t.enabled&&e.refetchInterval===t.refetchInterval||this.updateRefetchInterval()}},t.getCurrentQuery=function(){return this.currentQuery},t.getCurrentResult=function(){return this.currentResult},t.clear=function(){this.remove()},t.remove=function(){this.currentQuery.remove()},t.refetch=function(e){return this.currentQuery.refetch(e,this.config)},t.fetchMore=function(e,t){return this.currentQuery.fetchMore(e,t,this.config).catch(j)},t.fetch=function(){var e;return this.config.queryFn===(null==(e=G.queries)?void 0:e.queryFn)?Promise.resolve(this.currentResult.data):this.currentQuery.fetch(void 0,this.config).catch(j)},t.optionalFetch=function(){!this.config.enabled||!this.isStale||this.config.suspense&&this.currentResult.isFetched||!this.config.refetchOnMount&&1!==this.currentQuery.observers.length||this.fetch()},t.updateStaleTimeout=function(){var e=this;if(!D&&(this.clearStaleTimeout(),!this.isStale&&C(this.config.staleTime))){var t=Date.now()-this.currentResult.updatedAt,r=this.config.staleTime-t+1,n=Math.max(r,0);this.staleTimeoutId=setTimeout((function(){e.isStale||(e.isStale=!0,e.updateResult(),e.notify({listener:!0,globalListeners:!0}))}),n)}},t.updateRefetchInterval=function(){var e=this;D||(this.clearRefetchInterval(),this.config.enabled&&C(this.config.refetchInterval)&&(this.refetchIntervalId=setInterval((function(){(e.config.refetchIntervalInBackground||T())&&e.fetch()}),this.config.refetchInterval)))},t.updateTimers=function(){this.updateStaleTimeout(),this.updateRefetchInterval()},t.clearTimers=function(){this.clearStaleTimeout(),this.clearRefetchInterval()},t.clearStaleTimeout=function(){this.staleTimeoutId&&(clearInterval(this.staleTimeoutId),this.staleTimeoutId=void 0)},t.clearRefetchInterval=function(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)},t.updateResult=function(){var e,t=this.currentQuery.state,r=t.data,n=t.status,a=t.updatedAt,i=!1,o=!1;if(this.config.keepPreviousData&&t.isInitialData&&(null==(e=this.previousQueryResult)?void 0:e.isSuccess)&&(r=this.previousQueryResult.data,a=this.previousQueryResult.updatedAt,n=this.previousQueryResult.status,i=!0),"loading"===n&&this.config.placeholderData){var u="function"==typeof this.config.placeholderData?this.config.placeholderData():this.config.placeholderData;void 0!==u&&(n=d.Success,r=u,o=!0)}this.currentResult=x({},M(n),{canFetchMore:t.canFetchMore,clear:this.remove,data:r,error:t.error,failureCount:t.failureCount,fetchMore:this.fetchMore,isFetched:t.updateCount>0,isFetchedAfterMount:t.updateCount>this.initialUpdateCount,isFetching:t.isFetching,isFetchingMore:t.isFetchingMore,isInitialData:t.isInitialData,isPreviousData:i,isPlaceholderData:o,isStale:this.isStale,refetch:this.refetch,remove:this.remove,updatedAt:a})},t.updateQuery=function(){var e=this.config,t=this.currentQuery,r=e.queryCache.getQueryByHash(e.queryHash);r||(r=e.queryCache.createQuery(e)),r!==t&&(this.previousQueryResult=this.currentResult,this.currentQuery=r,this.initialUpdateCount=r.state.updateCount,r.state.isInitialData?e.keepPreviousData&&t?this.isStale=!0:"function"==typeof e.initialStale?this.isStale=e.initialStale():"boolean"==typeof e.initialStale?this.isStale=e.initialStale:this.isStale=void 0===r.state.data:this.isStale=r.isStaleByTime(e.staleTime),this.updateResult(),this.listener&&(null==t||t.unsubscribeObserver(this),this.currentQuery.subscribeObserver(this)))},t.onQueryUpdate=function(e){var t=this.config,r=e.type;2!==r&&3!==r&&4!==r||(this.isStale=this.currentQuery.isStaleByTime(t.staleTime));var n=this.currentResult;this.updateResult();var a=this.currentResult;if(2!==r&&3!==r&&4!==r||this.updateTimers(),4!==r||a.isStale!==n.isStale){var i={};2===r?i.onSuccess=!0:3===r&&(i.onError=!0),(t.notifyOnStatusChange||a.data!==n.data||a.error!==n.error)&&(i.listener=!0),this.notify(i)}},t.notify=function(e){var t=this.config,r=this.currentResult,n=this.currentQuery,a=this.listener,i=t.onSuccess,o=t.onSettled,u=t.onError;U.batch((function(){e.onSuccess?(i&&U.schedule((function(){i(r.data)})),o&&U.schedule((function(){o(r.data,null)}))):e.onError&&(u&&U.schedule((function(){u(r.error)})),o&&U.schedule((function(){o(void 0,r.error)}))),e.listener&&a&&U.schedule((function(){a(r)})),e.globalListeners&&t.queryCache.notifyGlobalListeners(n)}))},e}();function K(){}var V=0,Z=1,Y=2,$=3,X=4;function W(e,t){if(!t)return e&&e.then?e.then(K):Promise.resolve()}function J(e,t){var r=e();return r&&r.then?r.then(t):t(r)}function ee(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function te(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function re(e){return function(){for(var t=[],r=0;r0||!C(this.cacheTime)||(this.gcTimeout=setTimeout((function(){e.remove()}),this.cacheTime)))},t.cancel=function(e){var t=this.promise;return t&&this.cancelFetch?(this.cancelFetch(e),t.then(j).catch(j)):Promise.resolve(void 0)},t.continue=function(){var e;null==(e=this.continueFetch)||e.call(this)},t.clearTimersObservers=function(){this.observers.forEach((function(e){e.clearTimers()}))},t.clearGcTimeout=function(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)},t.setData=function(e,t){var r,n,a=this.state.data,i=F(e,a);this.config.structuralSharing&&(i=function e(t,r){if(t===r)return t;var n=Array.isArray(t)&&Array.isArray(r);if(n||P(t)&&P(r)){for(var a=n?t.length:Object.keys(t).length,i=n?r:Object.keys(r),o=i.length,u=n?[]:{},s=0,l=0;l0})).map((function(e){var t=e.panels,r=e.templating,n=e.uid;return t.filter((function(e){var t=e.type;return"table"===t||"table-old"===t||"msupplyfoundation-table"===t})).map((function(e){var t,n=s(e.targets,1)[0].rawSql,o="";return r.list.filter((function(e){var t=e.datasource,r=e.type;return"datasource"===r||"adhoc"===r||"query"===r&&a!==t})).some((function(e){var t=e.name;return Le(n,t)}))?o="This panel uses an unsupported variable.":(t=n,RegExp(/(?!.*\$__timeFrom\(\).*)(?!.*\$__timeTo\(\).*)(?!.*\$__timeFilter\(.+\).*)(\$__.*)/g).test(t)&&(o="This panel uses an unsupported macro.")),i(i({},e),{error:o})})).map((function(e){var t,a=e.targets,i=e.description,o=e.title,u=e.id,c=e.type,f=e.error,d=s(a,1)[0].rawSql,p=n,h=r.list,v=null!==(t=null==h?void 0:h.reduce((function(e,t){return Le(d,t.name)?l(l([],s(e)),[t]):e}),[]))&&void 0!==t?t:[];return{error:f,rawSql:d,description:i,title:o,id:u,variables:v,dashboardID:p,type:c}}))})).flat()]}var d}))}))},$e=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().put("./api/plugins/msupplyfoundation-datasource/resources/schedule/"+(null==e?void 0:e.id),e)]}))}))},Xe=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().post("./api/plugins/msupplyfoundation-datasource/resources/report-content",e)]}))}))},We=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().delete("./api/plugins/msupplyfoundation-datasource/resources/report-content/"+(null==e?void 0:e.id))]}))}))},Je=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().put("./api/plugins/msupplyfoundation-datasource/resources/report-content/"+(null==e?void 0:e.id),e)]}))}))},et=function(){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,Object(E.getBackendSrv)().get("./api/datasources")]}))}))},tt=function(e){var t=e.tooltip,r=e.type,n=void 0===r?"text":r,a=e.label,i=e.register,o=e.defaultValue,u=e.placeholder,s=e.inputName,l=e.invalid,c=e.errorMessage;return h.a.createElement("div",{className:"gf-form"},h.a.createElement(b.InlineFormLabel,{className:"width-14",tooltip:t},a),h.a.createElement("div",{style:{display:"flex",flex:1,flexDirection:"column"}},h.a.createElement(b.Input,{type:n,defaultValue:o,placeholder:u,name:s,ref:i(),css:""}),l&&h.a.createElement("div",null,h.a.createElement(b.FieldValidationMessage,null,c))))},rt=function(e){var t=e.tooltip,r=e.value,n=e.options,a=e.onChange,i=e.label;return h.a.createElement("div",{className:"gf-form"},h.a.createElement(b.InlineFormLabel,{className:"width-14",tooltip:t},i),h.a.createElement("div",{style:{display:"flex",flex:1,flexDirection:"column"}},h.a.createElement(b.Select,{value:r,options:n,onChange:a})))},nt=function(e){var t=e.formValues,r=e.onSubmit,n=ke("datasources",et).data,a=s(Object(p.useState)(null),2),o=a[0],u=a[1];return Object(p.useEffect)((function(){var e=null==n?void 0:n.find((function(e){return e.id===t.datasourceID}));e&&u({label:e.name,value:e})}),[n,t.datasourceID]),h.a.createElement(b.Form,{defaultValues:t,onSubmit:function(e){var t;return r(i(i({},e),{datasourceID:null===(t=null==o?void 0:o.value)||void 0===t?void 0:t.id}))}},(function(e){var t,r,a,i,s,l,c,f,d,p,v,g,y,w,_,E=e.register,x=e.errors,S=e.getValues,O=e.formState,D=S(),j=D.grafanaUsername,k=void 0===j?"":j,F=D.email,A=void 0===F?"":F,C=D.grafanaPassword,T=void 0===C?"":C,I=D.grafanaURL,L=void 0===I?"":I,P=D.emailPassword,R=void 0===P?"":P,N=D.emailHost,M=D.emailPort;return h.a.createElement(h.a.Fragment,null,h.a.createElement(b.FieldSet,{label:m.a.get("grafana_details")},h.a.createElement(tt,{tooltip:m.a.get("grafana_username_tooltip"),label:m.a.get("grafana_username"),defaultValue:k,placeholder:m.a.get("grafana_username"),inputName:"grafanaUsername",invalid:!!x.grafanaUsername,errorMessage:null!==(r=null===(t=x.grafanaUsername)||void 0===t?void 0:t.message)&&void 0!==r?r:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{type:"password",tooltip:m.a.get("grafana_password_tooltip"),label:m.a.get("grafana_password"),defaultValue:T,placeholder:m.a.get("grafana_password"),inputName:"grafanaPassword",invalid:!!x.grafanaPassword,errorMessage:null!==(i=null===(a=x.grafanaPassword)||void 0===a?void 0:a.message)&&void 0!==i?i:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("grafana_url_tooltip"),label:m.a.get("grafana_url"),defaultValue:L,placeholder:m.a.get("grafana_url"),inputName:"grafanaURL",invalid:!!x.grafanaURL,errorMessage:null!==(l=null===(s=x.grafanaURL)||void 0===s?void 0:s.message)&&void 0!==l?l:"",register:function(){return E({required:m.a.get("required")})}})),h.a.createElement(b.FieldSet,{label:m.a.get("email_details")},h.a.createElement(tt,{tooltip:m.a.get("email_tooltip"),label:m.a.get("email_address"),defaultValue:A,placeholder:m.a.get("email_address"),inputName:"email",invalid:!!x.email,errorMessage:null!==(f=null===(c=x.email)||void 0===c?void 0:c.message)&&void 0!==f?f:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{type:"password",tooltip:m.a.get("email_password_tooltip"),label:m.a.get("email_password"),defaultValue:R,placeholder:m.a.get("email_password"),inputName:"emailPassword",invalid:!!x.emailPassword,errorMessage:null!==(p=null===(d=x.emailPassword)||void 0===d?void 0:d.message)&&void 0!==p?p:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("email_host_tooltip"),label:m.a.get("email_host"),defaultValue:N,placeholder:m.a.get("email_host"),inputName:"emailHost",invalid:!!x.emailHost,errorMessage:null!==(g=null===(v=x.emailHost)||void 0===v?void 0:v.message)&&void 0!==g?g:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("email_port_tooltip"),label:m.a.get("email_port"),defaultValue:M,placeholder:m.a.get("email_port"),inputName:"emailPort",invalid:!!x.emailPort,errorMessage:null!==(w=null===(y=x.emailPort)||void 0===y?void 0:y.message)&&void 0!==w?w:"",register:function(){return E({required:m.a.get("required")})}})),h.a.createElement(b.FieldSet,{label:m.a.get("datasource_details")},h.a.createElement(rt,{label:m.a.get("datasource"),tooltip:m.a.get("datasource_tooltip"),value:o,options:null!==(_=null==n?void 0:n.map((function(e){return{label:e.name,value:e}})))&&void 0!==_?_:[],onChange:function(e){u(e)}})),h.a.createElement(b.Field,{label:m.a.get("save_details"),description:m.a.get("save_details_description")},h.a.createElement(b.Input,{value:m.a.get("submit"),type:"submit",placeholder:m.a.get("submit"),name:"submit",css:"",disabled:O.dirty})))}))},at=r(9),it=function(){var e=Object(p.useContext)(y).pluginID,t=ke("settings",(function(){return t=e,o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,Object(E.getBackendSrv)().get("/api/plugins/"+t+"/settings")]}))}));var t})).data,r=(null!=t?t:{}).jsonData;return(null!=r?r:{}).datasourceID},ot=function(e){var t=s(Object(p.useState)(e),2),r=t[0],n=t[1];return[r,Object(p.useCallback)((function(){n((function(e){return!e}))}),[n])]},ut=function(e,t,r,n,a,o){void 0===o&&(o={});var u=s(De(t,i({onSuccess:function(){return ue.refetchQueries(e)},onMutate:function(t){var i=r(t);ue.cancelQueries(e);var o=ue.getQueryData(e);return ue.setQueryData(e,(function(e){return n(e,i)})),null!=o?o:a},onError:function(t,r,n){ue.setQueryData(e,n)}},o)),2);return[u[0],u[1]]},st=r(5),lt=r.n(st),ct=function(){var e=s(Object(p.useState)({width:void 0,height:void 0}),2),t=e[0],r=e[1];return Object(p.useEffect)((function(){var e=function(){r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}}),[]),t},ft=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),dt=Object(w.css)(Ae||(Ae=c(["\n margin-right: 10px;\n"],["\n margin-right: 10px;\n"]))),pt=function(e){var t=e.reportGroup,r=it(),n=(null!=t?t:{}).id,a=ct().height,o=s(Object(p.useState)(""),2),u=o[0],c=o[1],f=ke("users-"+r,(function(){return function(e){return Object(E.getBackendSrv)().post("/api/tsdb/query",{queries:[{datasourceId:e,rawSql:'SELECT id, name, first_name, last_name, e_mail FROM "user"',format:"table"}]}).then((function(e){var t=s(e.results.A.tables,1)[0],r=t.rows,n=t.columns,a=["id","name","first_name","last_name","e_mail"],o=n.reduce((function(e,t,r){var n=t.text;return a.includes(n)?l(l([],s(e)),[r]):e}),[]);return r.map((function(e){return o.reduce((function(t,r,a){var o;return i(i({},t),((o={})[n[r].text]=e[a],o))}),{})}))}))}(r)}),{enabled:!!r,refetchOnMount:!0,retry:0}),d=f.data,v=f.error,g=ke(["groupMembers",n],Re).data,y=s(ut(["groupMembers",n],Me,(function(e){return i(i({},e),{userID:e.user.id,id:""})}),(function(e,t){return e?l(l([],s(e)),[t]):e}),[]),1)[0],w=s(ut(["groupMembers",n],ze,(function(e){return e}),(function(e,t){return e?e.filter((function(e){return e.id!==t.id})):e}),[]),1)[0];return h.a.createElement("div",{style:{}},h.a.createElement("div",{style:{marginTop:"25px",display:"flex",alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("users_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,v?"There was a problem finding users. Is your Datasource setup correctly?":m.a.get("users"))),d?h.a.createElement(h.a.Fragment,null,h.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",flexDirection:"row"}},h.a.createElement(b.Icon,{style:{marginRight:"10px"},name:"search"}),h.a.createElement(b.Input,{css:"",placeholder:"Search for users",onChange:function(e){var t=e.target.value;return c(t)}}),h.a.createElement(b.Icon,{style:{marginRight:"10px"},size:"xl",name:"trash-alt",onClick:function(){return c("")}})),h.a.createElement("ol",{className:ft,style:{maxHeight:(null!=a?a:0)/2+"px",overflow:"scroll"}},null==d?void 0:d.filter((function(e){return e.name.toLowerCase().includes(u.toLowerCase())})).map((function(e){var t=e.name,r=e.e_mail,a=e.id,i=null==g?void 0:g.find((function(e){return e.userID===a}));return h.a.createElement("li",{className:"card-item-wrapper",style:r?{cursor:"pointer"}:{},key:t},h.a.createElement("div",{className:"card-item",onClick:function(){return r&&function(e){var t=e.id,r=null==g?void 0:g.find((function(e){return e.userID===t}));r?w(r):y({user:e,reportGroupID:null!=n?n:""})}(e)}},h.a.createElement("div",{className:"card-item-body"},h.a.createElement("div",{className:dt},h.a.createElement(b.Checkbox,{value:!!i,css:""})),h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},t),h.a.createElement("div",{className:"card-item-type"},r||m.a.get("no_email"))))))})))):!v&&h.a.createElement(b.Spinner,{style:{flex:1,display:"flex",justifyContent:"center"}}))};!function(e){e.NAME="name",e.DESCRIPTION="description",e.ID="id"}(Ce||(Ce={})),function(e){e.NAME="name",e.DESCRIPTION="description",e.ID="id",e.INTERVAL="interval",e.REPORT_GROUP_ID="reportGroupID",e.TIME_OF_DAY="time",e.DAY_OF_INTERVAL="day"}(Te||(Te={})),function(e){e.ID="id",e.LOOKBACK="lookback",e.PANEL_ID="panelID",e.VARIABLES="variables"}(Ie||(Ie={}));var ht,vt,mt,gt,yt,bt,wt,_t,Et,xt,St,Ot=Object(w.css)(ht||(ht=c(["\n display: flex;\n flex-direction: column;\n flex: 1;\n padding-right: 30px;\n"],["\n display: flex;\n flex-direction: column;\n flex: 1;\n padding-right: 30px;\n"]))),Dt=Object(w.css)(vt||(vt=c(["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n"],["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n"]))),jt=function(e){var t=e.onUpdate,r=e.reportGroup;return h.a.createElement("div",{className:Ot},h.a.createElement("div",{style:{marginTop:"25px",display:"flex",alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("edit_details_report_group_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("edit_details"))),h.a.createElement("div",{className:Dt},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_name")},m.a.get("name")),h.a.createElement(b.Input,{onChange:function(e){var r=e.currentTarget.value;return t(Ce.NAME,r)},name:m.a.get("name"),defaultValue:null==r?void 0:r.name,placeholder:m.a.get("name"),css:""})),h.a.createElement("div",{className:Dt},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("description")},m.a.get("group_description")),h.a.createElement(b.Input,{onChange:function(e){var r=e.currentTarget.value;return t(Ce.DESCRIPTION,r)},name:m.a.get("description"),defaultValue:null==r?void 0:r.description,placeholder:m.a.get("description"),css:""})))},kt=Object(w.css)(mt||(mt=c(["\n top: 0;\n bottom: 0;\n width: 80%;\n"],["\n top: 0;\n bottom: 0;\n width: 80%;\n"]))),Ft=function(e){var t=e.reportGroup,r=e.onClose,n=e.isOpen,a=s(ot(!1),2),o=a[0],u=a[1],f=s(ut(["reportGroup"],qe,(function(e){return e}),(function(e,t){if(e){var r=e.findIndex((function(e){return e.id===t.id}));if(r>=0)return e[r]=t,l([],s(e))}return e}),[]),1)[0],d=s(De(Be,{onSuccess:function(){return ue.refetchQueries(["reportGroup"])}}),1)[0];return h.a.createElement(b.Modal,{className:kt,title:m.a.get("edit_report_group"),isOpen:n,onDismiss:r},h.a.createElement("div",{className:Object(w.css)(gt||(gt=c(["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n "],["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n "])))},h.a.createElement(jt,{onUpdate:function(e,r){var n,a=i(i({},t),((n={})[e]=r,n));f(a)},reportGroup:t}),h.a.createElement(b.Button,{size:"md",variant:"destructive",onClick:u},m.a.get("delete"))),h.a.createElement(pt,{reportGroup:t}),h.a.createElement(b.ConfirmModal,{isOpen:o,title:m.a.get("delete_report_group"),body:m.a.get("delete_report_group_question"),confirmText:m.a.get("delete"),icon:"exclamation-triangle",onConfirm:function(){d(t),u(),r()},onDismiss:u}))},At=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),Ct=function(e){var t=e.onRowPress,r=ke("reportGroup",Ne),n=r.data;return r.isLoading?h.a.createElement(b.Spinner,null):h.a.createElement("ol",{className:At},null==n?void 0:n.map((function(e){var r=e.name,n=e.description;return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:"pointer"},key:r},h.a.createElement("div",{className:"card-item",onClick:function(){return t(null==e?void 0:e.id)}},h.a.createElement("div",{className:"card-item-name"},r),n&&h.a.createElement("div",{className:"card-item-type"},n)))})))},Tt=Object(w.css)(yt||(yt=c(["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"],["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"]))),It=function(){var e=s(Object(p.useState)(null),2),t=e[0],r=e[1],n=ue.getQueryData("reportGroup"),a=null==n?void 0:n.find((function(e){return e.id===t})),i=s(ut(["reportGroup"],Ge,(function(){return{id:"",name:m.a.get("new_report_group"),description:""}}),(function(e,t){return e?l(l([],s(e)),[t]):[t]}),[]),1)[0];return h.a.createElement("div",null,h.a.createElement("div",{className:Tt},h.a.createElement(b.Legend,null,"Report Groups"),h.a.createElement(b.Button,{onClick:i,variant:"primary"},m.a.get("add_report_group"))),h.a.createElement(Ct,{onRowPress:r}),a&&n&&h.a.createElement(Ft,{reportGroup:a,isOpen:!!t,onClose:function(){return r(null)}}))},Lt=function(e,t){try{return JSON.parse(e)}catch(e){return t}},Pt=function(e){var t=e.onUpdate,r=e.name,n=e.variable,a=e.multiSelectable,i=e.selectedOptions,s=e.selectableOptions,l=n.refresh,c=it(),f=ke(r,(function(){return function(e,t){return o(void 0,void 0,Promise,(function(){var r,n,a,i,o,s,l,c;return u(this,(function(u){switch(u.label){case 0:return r=e.definition,n=e.name,[4,Object(E.getBackendSrv)().post("/api/tsdb/query",{queries:[{datasourceId:t,rawSql:r,format:"table"}]})];case 1:return a=u.sent(),[2,null===(c=null===(l=null===(s=null===(o=null===(i=a.results)||void 0===i?void 0:i.A)||void 0===o?void 0:o.tables)||void 0===s?void 0:s[0])||void 0===l?void 0:l.rows)||void 0===c?void 0:c.flat().map((function(e){return{label:e,value:{name:n,value:e}}}))]}}))}))}(n,c)}),{enabled:!!l}).data,d=(null==s?void 0:s.length)>0?s:f;return h.a.createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},h.a.createElement(b.InlineFormLabel,null,r),a?h.a.createElement(b.MultiSelect,{onChange:function(e){if(e.some((function(e){var t=e.value;return"$__all"===(null==t?void 0:t.value)})))return t(s);t(e)},value:null==d?void 0:d.filter((function(e){return!!(null==i?void 0:i.find((function(t){var r;return t===(null===(r=null==e?void 0:e.value)||void 0===r?void 0:r.value)})))})),filterOption:function(e,t){var r;return!!(null===(r=null==e?void 0:e.label)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))},closeMenuOnSelect:!1,options:d}):h.a.createElement(b.Select,{value:null==d?void 0:d.filter((function(e){return!!(null==i?void 0:i.find((function(t){return t===e.value.value})))})),onChange:function(e){var r;if("$__all"===(null===(r=e.value)||void 0===r?void 0:r.value))return t(s);t([e])},options:d}))},Rt=function(e){var t=e.onUpdate,r=e.name,n=e.value;return h.a.createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},h.a.createElement(b.InlineFormLabel,null,r),h.a.createElement(b.Input,{type:"text",defaultValue:n,placeholder:"",onChange:function(e){var n=e.target.value;t([{value:{name:r,value:n}}])},css:""}))},Nt=function(e){var t,r,n,a,i=e.onUpdateVariable,o=e.panel,u=e.onUpdateContent,s=e.lookback,l=e.variables,c=[{label:m.a.get("1day"),value:864e5},{label:m.a.get("2days"),value:1728e5},{label:m.a.get("3days"),value:2592e5},{label:m.a.get("1week"),value:6048e5},{label:m.a.get("2weeks"),value:12096e5},{label:m.a.get("4weeks"),value:24192e5},{label:m.a.get("3months"),value:72576e5},{label:m.a.get("6months"),value:145152e5},{label:m.a.get("1year"),value:307584e5}],f=Lt(l,{}),d=(t=o.rawSql,r=RegExp(/\$__timeTo()/g),n=RegExp(/\$__timeFrom()/g),a=RegExp(/\$__timeFilter\([a-zA-Z]+\)/g),r.test(t)||n.test(t)||a.test(t));return o.variables.length>0||d?h.a.createElement("div",{style:{border:"1px solid grey",padding:"20px"}},h.a.createElement("div",{className:"card-item-type"},m.a.get("variables")),h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("variables_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})),d&&h.a.createElement("div",{style:{display:"flex",flexDirection:"row"}},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("lookback_period_description")},m.a.get("lookback_period")),h.a.createElement(b.Select,{options:c,onChange:function(e){return u(Ie.LOOKBACK,e)},value:c.filter((function(e){return e.value===s}))})),o.variables.map((function(e){var t,r,n,a=e.name,o=e.options,u=e.multi,s=e.label,l=f[e.name],c=o.map((function(t){return{label:t.text,value:{name:e.name,value:t.value}}}));if("textbox"===e.type){var d=null!==(t=null==l?void 0:l[0])&&void 0!==t?t:null===(n=null===(r=c[0])||void 0===r?void 0:r.value)||void 0===n?void 0:n.value;return h.a.createElement(Rt,{onUpdate:i(a),name:null!=s?s:a,value:d})}return h.a.createElement(Pt,{onUpdate:i(a),multiSelectable:u,name:null!=s?s:a,selectedOptions:l,selectableOptions:c,variable:e,key:a})}))):null},Mt=Object(w.css)(bt||(bt=c(["\n margin-right: 10px;\n"],["\n margin-right: 10px;\n"]))),zt=function(e){var t=e.panel,r=e.reportContent,n=e.onToggle,a=e.scheduleID,o=t.title,u=t.description,c=t.error;Object(p.useEffect)((function(){c&&r&&n(t)}),[c,r,t,n]);var f,d=s(ut(["reportContent",a],Je,(function(e){return e}),(function(e,t){var r=t.id;if(e){var n=e.findIndex((function(e){return e.id===r}));return e[n]=t,l([],s(e))}return e}),[]),1)[0];return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:c?"":"pointer"}},h.a.createElement("div",{className:"card-item"},h.a.createElement("div",{className:"card-item-body",onClick:function(){if(!c)return n(t)}},h.a.createElement("div",{className:Mt},c?null:h.a.createElement(b.Checkbox,{value:!!r,css:""})),h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},o),h.a.createElement("div",{className:"card-item-type"},u))),r&&!c&&h.a.createElement(Nt,{panel:t,lookback:r.lookback,variables:r.variables,onUpdateContent:(f=r,function(e,t){var r;d(i(i({},f),((r={})[e]=t.value,r)))}),onUpdateVariable:function(e){return function(t){return function(r){var n=r.map((function(e){return e.value.value})),a=Lt(e.variables,{});a[t]=n,d(i(i({},e),{variables:JSON.stringify(a)}))}}}(r)}),c))},qt=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),Bt=function(e){var t=e.schedule,r=ct().height,n=it(),a=t.id,c=ke(["panels"],(function(){return Ye(n)})).data,f=ke(["reportContent",a],Ke).data,d=Object(p.useCallback)((function(e){return f?function(e,t){var r;return null!==(r=null==e?void 0:e.find((function(e){var r=e.panelID,n=e.dashboardID,a=t.id,i=t.dashboardID;return a===r&&n===i})))&&void 0!==r?r:null}(f,e):null}),[f]),v=s(ut(["reportContent",a],Xe,(function(e){return i(i({},e),{lookback:0,id:""})}),(function(e,t){return e?l(l([],s(e)),[t]):[t]}),[]),1)[0],g=s(ut(["reportContent",a],We,(function(e){return e}),(function(e,t){return e?e.filter((function(e){return e.id!==t.id})):e}),[]),1)[0],y=function(e){return o(void 0,void 0,void 0,(function(){var t;return u(this,(function(r){switch(r.label){case 0:return(null==(t=d(e))?void 0:t.id)?[4,g(t)]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,v({scheduleID:null!=a?a:"",panelID:null==e?void 0:e.id,dashboardID:null==e?void 0:e.dashboardID,variables:""})];case 3:r.sent(),r.label=4;case 4:return[2]}}))}))};return h.a.createElement("div",{style:{marginTop:"25px"}},h.a.createElement("div",{style:{display:"flex",flex:1,alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("available_panels_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("available_panels"))),h.a.createElement("ol",{className:qt,style:{maxHeight:(null!=r?r:0)/2+"px",overflow:"scroll"}},null==c?void 0:c.map((function(e){var t=d(e);return h.a.createElement(zt,{reportContent:t,panel:e,scheduleID:a,onToggle:y,key:a})}))))},Gt=function(){return[{label:m.a.get("daily"),value:0},{label:m.a.get("weekly"),value:1},{label:m.a.get("fortnightly"),value:2},{label:m.a.get("monthly"),value:3},{label:m.a.get("quarterly"),value:4},{label:m.a.get("yearly"),value:5}]},Qt=Object(w.css)(wt||(wt=c(["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n flex: 1;\n padding-right: 30px;\n flex-direction: row;\n"],["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n flex: 1;\n padding-right: 30px;\n flex-direction: row;\n"]))),Ut=Object(w.css)(_t||(_t=c(["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n margin-left: 20px;\n"],["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n margin-left: 20px;\n"]))),Ht=function(e){var t,r,a,i=e.onUpdate,o=e.schedule,u=ke("reportGroup",Ne).data;return h.a.createElement("div",{style:{width:"100%"}},h.a.createElement("div",null,h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("edit_details_schedule_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("edit_details"))),h.a.createElement("div",{className:Qt},h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_name")},m.a.get("name")),h.a.createElement(b.Input,{onChange:function(e){var t=e.currentTarget.value;return i(Te.NAME,t)},name:m.a.get("name"),defaultValue:o.name,placeholder:m.a.get("name"),css:""})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_interval_description")},m.a.get("report_interval")),h.a.createElement(b.Select,{value:Gt().filter((function(e){return e.value===(null==o?void 0:o.interval)})),options:Gt(),onChange:function(e){i(Te.INTERVAL,e.value)}})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_description")},m.a.get("description")),h.a.createElement(b.Input,{onChange:function(e){var t=e.currentTarget.value;return i(Te.DESCRIPTION,t)},name:m.a.get("description"),defaultValue:o.description,placeholder:m.a.get("description"),css:""})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_time_description")},m.a.get("report_time")),h.a.createElement(b.TimeOfDayPicker,{onChange:function(e){i(Te.TIME_OF_DAY,e.format("HH:mm"))},value:(t=null==o?void 0:o.time,r=Object(n.dateTime)(Date.now()),a=Object(n.dateTime)(r.format("YYYY-MM-DD")+" "+t,"YYYY-MM-DD HH:mm"),a.isValid()?a:void 0)})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_group_description")},m.a.get("report_group")),h.a.createElement(b.Select,{value:null==u?void 0:u.filter((function(e){return e.id===o.reportGroupID})).map((function(e){return{label:e.name,description:e.description,value:e}})),options:null==u?void 0:u.map((function(e){return{label:e.name,description:e.description,value:e}})),onChange:function(e){var t,r;i(Te.REPORT_GROUP_ID,null!==(r=null===(t=null==e?void 0:e.value)||void 0===t?void 0:t.id)&&void 0!==r?r:"")}})),(o.interval||0)>2?h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_day_description")},m.a.get("report_day")),h.a.createElement(b.Input,{css:"",defaultValue:1,min:1,name:m.a.get("report_day"),onChange:function(e){var t=e.currentTarget.value;return i(Te.DAY_OF_INTERVAL,parseInt(t,10))},placeholder:m.a.get("report_day"),type:"number",value:(null==o?void 0:o.day)||1})):h.a.createElement("div",{className:Ut})))},Kt=Object(w.css)(Et||(Et=c(["\n top: 0;\n bottom: 0;\n width: 80%;\n"],["\n top: 0;\n bottom: 0;\n width: 80%;\n"]))),Vt=Object(w.css)(xt||(xt=c(["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n"],["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n"]))),Zt=function(e){var t=e.reportSchedule,r=e.onClose,n=e.isOpen,a=s(Object(p.useState)(t),2),o=a[0],u=a[1],l=s(ot(!1),2),c=l[0],f=l[1],d=s(De(Pe),2),v=d[0],g=d[1].isLoading,y=s(De($e,{onSuccess:function(){return ue.refetchQueries(["reportSchedules"])}}),1)[0],w=s(De(He,{onSuccess:function(){return ue.refetchQueries(["reportSchedules"])}}),1)[0];Object(p.useEffect)((function(){o||u(t)}),[o,t]);return h.a.createElement(b.Modal,{className:Kt,onClickBackdrop:function(){},title:m.a.get("edit_report_schedule"),isOpen:n,onDismiss:r},h.a.createElement("div",{className:Vt},h.a.createElement(Ht,{schedule:o,onUpdate:function(e,t){var r,n=i(i({},o),((r={})[e]=t,r));u(n),y(n)}}),h.a.createElement("div",{style:{display:"flex",flexDirection:"column"}},h.a.createElement(b.Button,{size:"md",variant:"destructive",onClick:f},m.a.get("delete")),g?h.a.createElement(b.Spinner,null):h.a.createElement(b.Button,{size:"md",variant:"primary",style:{marginTop:"10px"},onClick:function(){return v(o.id)}},m.a.get("send_test_emails")))),h.a.createElement(Bt,{schedule:t}),h.a.createElement(b.ConfirmModal,{isOpen:c,title:m.a.get("delete_report_schedule"),body:m.a.get("delete_report_schedule_question"),confirmText:m.a.get("delete"),icon:"exclamation-triangle",onConfirm:function(){w(o),f(),r()},onDismiss:f}))},Yt=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),$t=function(e){var t=e.onRowPress,r=ke("reportSchedules",Qe),n=r.data;return r.isLoading?h.a.createElement(b.Spinner,null):h.a.createElement("ol",{className:Yt},null==n?void 0:n.map((function(e){var r=e.name,n=e.description;return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:"pointer"},key:r},h.a.createElement("div",{className:"card-item",onClick:function(){return t(e)}},h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},r),h.a.createElement("div",{className:"card-item-type"},n))))})))},Xt=Object(w.css)(St||(St=c(["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"],["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"]))),Wt=function(){var e=s(Object(p.useState)(null),2),t=e[0],r=e[1],n=s(De(Ue,{onSuccess:function(){return ue.refetchQueries("reportSchedules")}}),1)[0];return h.a.createElement("div",null,h.a.createElement("div",{className:Xt},h.a.createElement(b.Legend,null,m.a.get("report_schedules")),h.a.createElement(b.Button,{onClick:function(){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n()]}))}))},variant:"primary"},m.a.get("add_schedule"))),h.a.createElement($t,{onRowPress:r}),t&&h.a.createElement(Zt,{reportSchedule:t,isOpen:!!t,onClose:function(){return r(null)}}))},Jt="report-group",er="report-schedule";r.d(t,"plugin",(function(){return rr}));var tr,rr=(new n.AppPlugin).setRootPage((function(e){var t=e.path,r=e.onNavChanged,n=e.query,a=e.meta,i=t.replace(/^\//,""),o={pluginID:null==a?void 0:a.id};Object(p.useEffect)((function(){m.a.init({currentLocale:"en",locales:g})}),[]),function(e,t,r,n){Object(p.useEffect)((function(){var e=[{text:" "+m.a.get("report_groups"),icon:"fa fa-fw fa-file-text-o",url:r+"?tab="+Jt,id:Jt},{text:" "+m.a.get("report_schedules"),icon:"fa fa-users",url:r+"?tab="+er,id:er}],a={text:m.a.get("msupply"),img:t,url:r,children:e};n({node:a,main:a})}),[e,r,t,n])}(n.tab,a.info.logos.large,i,r);return h.a.createElement("div",null,h.a.createElement(y.Provider,{value:o},function(){switch(n.tab){default:case Jt:return h.a.createElement(It,{meta:a,path:t,onNavChanged:r,query:n});case er:return h.a.createElement(Wt,{meta:a,path:t,onNavChanged:r,query:n})}}(),h.a.createElement(at.ReactQueryDevtools,null)))})).addConfigPage({title:"\tApp Configuration",icon:"fa fa-cogs",body:(tr=function(e){var t,r,n,a,o,u,s,l,f,d,p,v,g,y,x,S,O,D,j=function(t){void 0===t&&(t=!0),Object(E.getBackendSrv)().post("/api/plugins/"+e.plugin.meta.id+"/settings",i(i({},e.plugin.meta),{enabled:t,pinned:t})).then((function(){return window.location.href=window.location.href}))},k={grafanaPassword:null!==(r=null===(t=e.plugin.meta.jsonData)||void 0===t?void 0:t.grafanaPassword)&&void 0!==r?r:"",grafanaUsername:null!==(a=null===(n=e.plugin.meta.jsonData)||void 0===n?void 0:n.grafanaUsername)&&void 0!==a?a:"",grafanaURL:null!==(u=null===(o=e.plugin.meta.jsonData)||void 0===o?void 0:o.grafanaURL)&&void 0!==u?u:"",email:null!==(l=null===(s=e.plugin.meta.jsonData)||void 0===s?void 0:s.email)&&void 0!==l?l:"",emailPassword:null!==(d=null===(f=e.plugin.meta.jsonData)||void 0===f?void 0:f.emailPassword)&&void 0!==d?d:"",datasourceID:null!==(v=null===(p=e.plugin.meta.jsonData)||void 0===p?void 0:p.datasourceID)&&void 0!==v?v:1,datasourceName:null!==(y=null===(g=e.plugin.meta.jsonData)||void 0===g?void 0:g.datasourceName)&&void 0!==y?y:"",emailHost:null!==(S=null===(x=e.plugin.meta.jsonData)||void 0===x?void 0:x.emailHost)&&void 0!==S?S:"smtp.gmail.com",emailPort:null!==(D=null===(O=e.plugin.meta.jsonData)||void 0===O?void 0:O.emailPort)&&void 0!==D?D:587};return e.plugin.meta.enabled?h.a.createElement("div",{className:Object(w.css)(Fe||(Fe=c(["\n margin: auto;\n "],["\n margin: auto;\n "])))},h.a.createElement(nt,{formValues:k,onSubmit:function(t){var r=i(i({},t),{emailPort:Number(t.emailPort)});Object(E.getBackendSrv)().post("/api/plugins/msupplyfoundation-datasource/resources/settings",r),Object(E.getBackendSrv)().post("/api/plugins/"+e.plugin.meta.id+"/settings",i(i({},e.plugin.meta),{jsonData:r}))}}),h.a.createElement(b.Button,{variant:"destructive",onClick:function(){return j(!1)}},m.a.get("disable"))):h.a.createElement(_,{toggle:j})},function(e){function t(t){var r=e.call(this,t)||this;return r.displayName="ConfigPageFactory",r.state={shouldLoad:!1},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.componentDidMount=function(){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,m.a.init({currentLocale:"en",locales:g})];case 1:return e.sent(),this.setState({shouldLoad:!0}),[2]}}))}))},t.prototype.render=function(){return this.state.shouldLoad?h.a.createElement(tr,i({},this.props)):null},t}(p.Component)),id:"page1"})},function(e,t,r){"use strict";var n;function a(e){return e.type===n.literal}function i(e){return e.type===n.argument}function o(e){return e.type===n.number}function u(e){return e.type===n.date}function s(e){return e.type===n.time}function l(e){return e.type===n.select}function c(e){return e.type===n.plural}function f(e){return e.type===n.pound}function d(e){return!(!e||"object"!=typeof e||0!==e.type)}function p(e){return!(!e||"object"!=typeof e||1!==e.type)}r.r(t),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound"}(n||(n={}));var h,v=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),m=function(){return(m=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0){for(t=1,r=1;t1&&"}"===e)},X=ve("\n",!1),W=ge("argNameOrNumber"),J=ge("argNumber"),ee=ve("0",!1),te=/^[1-9]/,re=me([["1","9"]],!1,!1),ne=/^[0-9]/,ae=me([["0","9"]],!1,!1),ie=ge("argName"),oe=0,ue=0,se=[{line:1,column:1}],le=0,ce=[],fe=0;if(void 0!==t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=i[t.startRule]}function de(){return e.substring(ue,oe)}function pe(){return be(ue,oe)}function he(e,t){throw function(e,t){return new g(e,[],"",t)}(e,t=void 0!==t?t:be(ue,oe))}function ve(e,t){return{type:"literal",text:e,ignoreCase:t}}function me(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ge(e){return{type:"other",description:e}}function ye(t){var r,n=se[t];if(n)return n;for(r=t-1;!se[r];)r--;for(n={line:(n=se[r]).line,column:n.column};rle&&(le=oe,ce=[]),ce.push(e))}function _e(e,t,r){return new g(g.buildMessage(e,t),e,t,r)}function Ee(){return xe()}function xe(){var e,t;for(e=[],t=Se();t!==a;)e.push(t),t=Se();return e}function Se(){var t;return(t=function(){var e,t;e=oe,(t=Oe())!==a&&(ue=e,r=t,t=m({type:n.literal,value:r},He()));var r;return e=t}())===a&&(t=function(){var t,r,i,o;fe++,t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(i=qe())!==a&&Pe()!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=i,r=m({type:n.argument,value:u},He()),t=r):(oe=t,t=a)):(oe=t,t=a);var u;fe--,t===a&&(r=a,0===fe&&we(s));return t}())===a&&(t=function(){var t;(t=function(){var t,r,n,i,o,u,s,f,d;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(n=qe())!==a&&Pe()!==a?(44===e.charCodeAt(oe)?(i=",",oe++):(i=a,0===fe&&we(E)),i!==a&&Pe()!==a?("number"===e.substr(oe,6)?(o="number",oe+=6):(o=a,0===fe&&we(x)),o!==a&&Pe()!==a?(u=oe,44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a&&(f=Pe())!==a&&(d=function(){var t,r,n;t=oe,"::"===e.substr(oe,2)?(r="::",oe+=2):(r=a,0===fe&&we(w));r!==a&&(n=function(){var e,t,r;if(e=oe,t=[],(r=ke())!==a)for(;r!==a;)t.push(r),r=ke();else t=a;t!==a&&(ue=e,t=m({type:0,tokens:t},He()));return e=t}())!==a?(ue=t,t=r=n):(oe=t,t=a);t===a&&(t=oe,ue=oe,Qe.push("numberArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Oe())!==a?(ue=t,r=_(n),t=r):(oe=t,t=a));return t}())!==a?u=s=[s,f,d]:(oe=u,u=a),u===a&&(u=null),u!==a&&(s=Pe())!==a?(125===e.charCodeAt(oe)?(f="}",oe++):(f=a,0===fe&&we(c)),f!==a?(ue=t,r=S(n,o,u),t=r):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a);return t}())===a&&(t=function(){var t,r,n,i,o,u,s,f,d;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(n=qe())!==a&&Pe()!==a?(44===e.charCodeAt(oe)?(i=",",oe++):(i=a,0===fe&&we(E)),i!==a&&Pe()!==a?("date"===e.substr(oe,4)?(o="date",oe+=4):(o=a,0===fe&&we(T)),o===a&&("time"===e.substr(oe,4)?(o="time",oe+=4):(o=a,0===fe&&we(I))),o!==a&&Pe()!==a?(u=oe,44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a&&(f=Pe())!==a&&(d=function(){var t,r,n;t=oe,"::"===e.substr(oe,2)?(r="::",oe+=2):(r=a,0===fe&&we(w));r!==a&&(n=function(){var t,r,n,i;t=oe,r=oe,n=[],(i=Fe())===a&&(i=Ae());if(i!==a)for(;i!==a;)n.push(i),(i=Fe())===a&&(i=Ae());else n=a;r=n!==a?e.substring(r,oe):n;r!==a&&(ue=t,r=m({type:1,pattern:r},He()));return t=r}())!==a?(ue=t,t=r=n):(oe=t,t=a);t===a&&(t=oe,ue=oe,Qe.push("dateOrTimeArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Oe())!==a?(ue=t,r=_(n),t=r):(oe=t,t=a));return t}())!==a?u=s=[s,f,d]:(oe=u,u=a),u===a&&(u=null),u!==a&&(s=Pe())!==a?(125===e.charCodeAt(oe)?(f="}",oe++):(f=a,0===fe&&we(c)),f!==a?(ue=t,r=S(n,o,u),t=r):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a);return t}());return t}())===a&&(t=function(){var t,r,i,o,u,s,f,d,p,h,v;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));if(r!==a)if(Pe()!==a)if((i=qe())!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(o=",",oe++):(o=a,0===fe&&we(E)),o!==a)if(Pe()!==a)if("plural"===e.substr(oe,6)?(u="plural",oe+=6):(u=a,0===fe&&we(L)),u===a&&("selectordinal"===e.substr(oe,13)?(u="selectordinal",oe+=13):(u=a,0===fe&&we(P))),u!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a)if(Pe()!==a)if(f=oe,"offset:"===e.substr(oe,7)?(d="offset:",oe+=7):(d=a,0===fe&&we(R)),d!==a&&(p=Pe())!==a&&(h=Re())!==a?f=d=[d,p,h]:(oe=f,f=a),f===a&&(f=null),f!==a)if((d=Pe())!==a){if(p=[],(h=Te())!==a)for(;h!==a;)p.push(h),h=Te();else p=a;p!==a&&(h=Pe())!==a?(125===e.charCodeAt(oe)?(v="}",oe++):(v=a,0===fe&&we(c)),v!==a?(ue=t,r=function(e,t,r,a){return m({type:n.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:a.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&he('Duplicate option "'+r+'" in plural element: "'+de()+'"',pe()),e[r]={value:n,location:a},e}),{})},He())}(i,u,f,p),t=r):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;return t}())===a&&(t=function(){var t,r,i,o,u,s,f,d,p;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));if(r!==a)if(Pe()!==a)if((i=qe())!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(o=",",oe++):(o=a,0===fe&&we(E)),o!==a)if(Pe()!==a)if("select"===e.substr(oe,6)?(u="select",oe+=6):(u=a,0===fe&&we(N)),u!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a)if(Pe()!==a){if(f=[],(d=Ce())!==a)for(;d!==a;)f.push(d),d=Ce();else f=a;f!==a&&(d=Pe())!==a?(125===e.charCodeAt(oe)?(p="}",oe++):(p=a,0===fe&&we(c)),p!==a?(ue=t,r=function(e,t){return m({type:n.select,value:e,options:t.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&he('Duplicate option "'+r+'" in select element: "'+de()+'"',pe()),e[r]={value:n,location:a},e}),{})},He())}(i,f),t=r):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;return t}())===a&&(t=function(){var t,r;t=oe,35===e.charCodeAt(oe)?(r="#",oe++):(r=a,0===fe&&we(u));r!==a&&(ue=t,r=m({type:n.pound},He()));return t=r}()),t}function Oe(){var e,t,r;if(e=oe,t=[],(r=Ne())===a&&(r=Me())===a&&(r=ze()),r!==a)for(;r!==a;)t.push(r),(r=Ne())===a&&(r=Me())===a&&(r=ze());else t=a;return t!==a&&(ue=e,t=t.join("")),e=t}function De(){var t,r,n,i,o;if(fe++,t=oe,r=[],n=oe,i=oe,fe++,(o=Ie())===a&&(d.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(p))),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a),n!==a)for(;n!==a;)r.push(n),n=oe,i=oe,fe++,(o=Ie())===a&&(d.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(p))),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a);else r=a;return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(f)),t}function je(){var t,r,n;return fe++,t=oe,47===e.charCodeAt(oe)?(r="/",oe++):(r=a,0===fe&&we(y)),r!==a&&(n=De())!==a?(ue=t,t=r=n):(oe=t,t=a),fe--,t===a&&(r=a,0===fe&&we(v)),t}function ke(){var e,t,r,n;if(fe++,e=oe,Pe()!==a)if((t=De())!==a){for(r=[],n=je();n!==a;)r.push(n),n=je();r!==a?(ue=e,e=function(e,t){return{stem:e,options:t}}(t,r)):(oe=e,e=a)}else oe=e,e=a;else oe=e,e=a;return fe--,e===a&&(a,0===fe&&we(b)),e}function Fe(){var t,r,n,i;if(t=oe,39===e.charCodeAt(oe)?(r="'",oe++):(r=a,0===fe&&we(O)),r!==a){if(n=[],(i=Ne())===a&&(D.test(e.charAt(oe))?(i=e.charAt(oe),oe++):(i=a,0===fe&&we(j))),i!==a)for(;i!==a;)n.push(i),(i=Ne())===a&&(D.test(e.charAt(oe))?(i=e.charAt(oe),oe++):(i=a,0===fe&&we(j)));else n=a;n!==a?(39===e.charCodeAt(oe)?(i="'",oe++):(i=a,0===fe&&we(O)),i!==a?t=r=[r,n,i]:(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;if(t===a)if(t=[],(r=Ne())===a&&(k.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(F))),r!==a)for(;r!==a;)t.push(r),(r=Ne())===a&&(k.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(F)));else t=a;return t}function Ae(){var t,r;if(t=[],A.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(C)),r!==a)for(;r!==a;)t.push(r),A.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(C));else t=a;return t}function Ce(){var t,r,n,i,o,u,s;return t=oe,Pe()!==a&&(r=Ge())!==a&&Pe()!==a?(123===e.charCodeAt(oe)?(n="{",oe++):(n=a,0===fe&&we(l)),n!==a?(ue=oe,Qe.push("select"),(!0?void 0:a)!==a&&(i=xe())!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=r,s=i,Qe.pop(),t=m({id:u,value:s},He())):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a),t}function Te(){var t,r,n,i,o,u,s;return t=oe,Pe()!==a&&(r=function(){var t,r,n,i;return t=oe,r=oe,61===e.charCodeAt(oe)?(n="=",oe++):(n=a,0===fe&&we(M)),n!==a&&(i=Re())!==a?r=n=[n,i]:(oe=r,r=a),(t=r!==a?e.substring(t,oe):r)===a&&(t=Ge()),t}())!==a&&Pe()!==a?(123===e.charCodeAt(oe)?(n="{",oe++):(n=a,0===fe&&we(l)),n!==a?(ue=oe,Qe.push("plural"),(!0?void 0:a)!==a&&(i=xe())!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=r,s=i,Qe.pop(),t=m({id:u,value:s},He())):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a),t}function Ie(){var t;return fe++,q.test(e.charAt(oe))?(t=e.charAt(oe),oe++):(t=a,0===fe&&we(B)),fe--,t===a&&(a,0===fe&&we(z)),t}function Le(){var t;return fe++,Q.test(e.charAt(oe))?(t=e.charAt(oe),oe++):(t=a,0===fe&&we(U)),fe--,t===a&&(a,0===fe&&we(G)),t}function Pe(){var t,r,n;for(fe++,t=oe,r=[],n=Ie();n!==a;)r.push(n),n=Ie();return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(H)),t}function Re(){var t,r,n,i,o;return fe++,t=oe,45===e.charCodeAt(oe)?(r="-",oe++):(r=a,0===fe&&we(V)),r===a&&(r=null),r!==a&&(n=Be())!==a?(ue=t,i=r,t=r=(o=n)?i?-o:o:0):(oe=t,t=a),fe--,t===a&&(r=a,0===fe&&we(K)),t}function Ne(){var t,r;return fe++,t=oe,"''"===e.substr(oe,2)?(r="''",oe+=2):(r=a,0===fe&&we(Y)),r!==a&&(ue=t,r="'"),fe--,(t=r)===a&&(r=a,0===fe&&we(Z)),t}function Me(){var t,r,n,i,o,u;if(t=oe,39===e.charCodeAt(oe)?(r="'",oe++):(r=a,0===fe&&we(O)),r!==a)if((n=function(){var t,r,n,i;t=oe,r=oe,e.length>oe?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(h));n!==a?(ue=oe,(i=(i="{"===(o=n)||"}"===o||Ue()&&"#"===o)?void 0:a)!==a?r=n=[n,i]:(oe=r,r=a)):(oe=r,r=a);var o;t=r!==a?e.substring(t,oe):r;return t}())!==a){for(i=oe,o=[],"''"===e.substr(oe,2)?(u="''",oe+=2):(u=a,0===fe&&we(Y)),u===a&&(D.test(e.charAt(oe))?(u=e.charAt(oe),oe++):(u=a,0===fe&&we(j)));u!==a;)o.push(u),"''"===e.substr(oe,2)?(u="''",oe+=2):(u=a,0===fe&&we(Y)),u===a&&(D.test(e.charAt(oe))?(u=e.charAt(oe),oe++):(u=a,0===fe&&we(j)));(i=o!==a?e.substring(i,oe):o)!==a?(39===e.charCodeAt(oe)?(o="'",oe++):(o=a,0===fe&&we(O)),o===a&&(o=null),o!==a?(ue=t,t=r=n+i.replace("''","'")):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;return t}function ze(){var t,r,n,i;return t=oe,r=oe,e.length>oe?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(h)),n!==a?(ue=oe,(i=(i=$(n))?void 0:a)!==a?r=n=[n,i]:(oe=r,r=a)):(oe=r,r=a),r===a&&(10===e.charCodeAt(oe)?(r="\n",oe++):(r=a,0===fe&&we(X))),t=r!==a?e.substring(t,oe):r}function qe(){var t,r;return fe++,t=oe,(r=Be())===a&&(r=Ge()),t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(W)),t}function Be(){var t,r,n,i,o;if(fe++,t=oe,48===e.charCodeAt(oe)?(r="0",oe++):(r=a,0===fe&&we(ee)),r!==a&&(ue=t,r=0),(t=r)===a){if(t=oe,r=oe,te.test(e.charAt(oe))?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(re)),n!==a){for(i=[],ne.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(ae));o!==a;)i.push(o),ne.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(ae));i!==a?r=n=[n,i]:(oe=r,r=a)}else oe=r,r=a;r!==a&&(ue=t,r=parseInt(r.join(""),10)),t=r}return fe--,t===a&&(r=a,0===fe&&we(J)),t}function Ge(){var t,r,n,i,o;if(fe++,t=oe,r=[],n=oe,i=oe,fe++,(o=Ie())===a&&(o=Le()),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a),n!==a)for(;n!==a;)r.push(n),n=oe,i=oe,fe++,(o=Ie())===a&&(o=Le()),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a);else r=a;return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(ie)),t}var Qe=["root"];function Ue(){return"plural"===Qe[Qe.length-1]}function He(){return t&&t.captureLocation?{location:pe()}:{}}if((r=o())!==a&&oe===e.length)return r;throw r!==a&&oe1)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(k,(function(e,r,n){return"."===e?t.maximumFractionDigits=0:"+"===n?t.minimumFractionDigits=n.length:"#"===r[0]?t.maximumFractionDigits=r.length:(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length+("string"==typeof n?n.length:0)),""})),a.options.length&&(t=O(O({},t),A(a.options[0])))}else if(F.test(a.stem))t=O(O({},t),A(a.stem));else{var i=C(a.stem);i&&(t=O(O({},t),i))}}return t}var L,P=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),R=function(){for(var e=0,t=0,r=arguments.length;t(.*?)<\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\/>)/,U=Date.now()+"@@",H=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function K(e,t,r,n,a,i){var o=M(e,t,r,n,a,void 0,i),u={},s=o.reduce((function(e,t){if(0===t.type)return e+t.value;var r=Date.now()+"_"+ ++B;return u[r]=t.value,e+"@@"+r+"@@"}),"");if(!Q.test(s))return G(s,u);if(!a)throw new N("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new N("Cannot format XML message without DOMParser");L||(L=new DOMParser);var l=L.parseFromString(''+s+"","text/html").getElementById(U);if(!l)throw new N("Malformed HTML message "+s);var c=Object.keys(a).filter((function(e){return!!l.getElementsByTagName(e).length}));if(!c.length)return G(s,u);var f=c.filter((function(e){return e!==e.toLowerCase()}));if(f.length)throw new N("HTML tag must be lowercased but the following tags are not: "+f.join(", "));return Array.prototype.slice.call(l.childNodes).reduce((function(e,t){return e.concat(function e(t,r,n){var a=t.tagName,i=t.outerHTML,o=t.textContent,u=t.childNodes;if(!a)return G(o||"",r);a=a.toLowerCase();var s=~H.indexOf(a),l=n[a];if(l&&s)throw new N(a+" is a self-closing tag and can not be used, please use another tag name.");if(!u.length)return[i];var c=Array.prototype.slice.call(u).reduce((function(t,a){return t.concat(e(a,r,n))}),[]);return l?"function"==typeof l?[l.apply(void 0,c)]:[l]:R(["<"+a+">"],c,[""])}(t,u,a))}),[])}var V=function(){return(V=Object.assign||function(e){for(var t,r=1,n=arguments.length;r= 0 && value.indexOf(\">\") >= 0) {\n value = escapeHtml(value);\n }\n variables[i] = value;\n }\n }\n\n try {\n var msgFormatter = new IntlMessageFormat(msg, currentLocale, formats);\n return msgFormatter.format(variables);\n } catch (err) {\n this.options.warningHandler(\"react-intl-universal format message failed for key='\" + key + \"'.\", err.message);\n return msg;\n }\n }\n\n /**\n * Get the formatted html message by key.\n * @param {string} key The string representing key in locale data file\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"getHTML\",\n value: function getHTML(key, variables) {\n if (this.options.intlGetHook) {\n try {\n this.options.intlGetHook(key, this.options.currentLocale);\n } catch (e) {\n console.log('intl get hook error: ', e);\n }\n }\n var msg = this.get(key, variables);\n if (msg) {\n var el = React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: msg\n }\n });\n // when key exists, it should still return element if there's defaultMessage() after getHTML()\n var defaultMessage = function defaultMessage() {\n return el;\n };\n return Object.assign({ defaultMessage: defaultMessage, d: defaultMessage }, el);\n }\n return \"\";\n }\n\n /**\n * As same as get(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {string} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {string} message\n */\n\n }, {\n key: \"formatMessage\",\n value: function formatMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.get(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * As same as getHTML(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {React.Element} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"formatHTMLMessage\",\n value: function formatHTMLMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.getHTML(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * Helper: determine user's locale via URL, cookie, localStorage, and browser's language.\n * You may not this API, if you have other rules to determine user's locale.\n * @param {string} options.urlLocaleKey URL's query Key to determine locale. Example: if URL=http://localhost?lang=en-US, then set it 'lang'\n * @param {string} options.cookieLocaleKey Cookie's Key to determine locale. Example: if cookie=lang:en-US, then set it 'lang'\n * @param {string} options.localStorageLocaleKey LocalStorage's Key to determine locale such as 'lang'\n * @returns {string} determined locale such as 'en-US'\n */\n\n }, {\n key: \"determineLocale\",\n value: function determineLocale() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n return this.getLocaleFromURL(options) || this.getLocaleFromCookie(options) || this.getLocaleFromLocalStorage(options) || this.getLocaleFromBrowser();\n }\n\n /**\n * Initialize properties and load CLDR locale data according to currentLocale\n * @param {Object} options\n * @param {string} options.currentLocale Current locale such as 'en-US'\n * @param {string} options.locales App locale data like {\"en-US\":{\"key1\":\"value1\"},\"zh-CN\":{\"key1\":\"值1\"}}\n * @returns {Promise}\n */\n\n }, {\n key: \"init\",\n value: function init() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n invariant(options.currentLocale, \"options.currentLocale is required\");\n invariant(options.locales, \"options.locales is required\");\n\n Object.assign(this.options, options);\n\n this.options.formats = Object.assign({}, this.options.formats, defaultFormats);\n\n return new Promise(function (resolve, reject) {\n // init() will not load external common locale data anymore.\n // But, it still return a Promise for abckward compatibility.\n resolve();\n });\n }\n\n /**\n * Get the inital options\n */\n\n }, {\n key: \"getInitOptions\",\n value: function getInitOptions() {\n return this.options;\n }\n\n /**\n * Load more locales after init\n */\n\n }, {\n key: \"load\",\n value: function load(locales) {\n merge(this.options.locales, locales);\n }\n }, {\n key: \"getLocaleFromCookie\",\n value: function getLocaleFromCookie(options) {\n var cookieLocaleKey = options.cookieLocaleKey;\n\n if (cookieLocaleKey) {\n var params = cookie.parse(document.cookie);\n return params && params[cookieLocaleKey];\n }\n }\n }, {\n key: \"getLocaleFromLocalStorage\",\n value: function getLocaleFromLocalStorage(options) {\n var localStorageLocaleKey = options.localStorageLocaleKey;\n\n if (localStorageLocaleKey && window.localStorage) {\n return localStorage.getItem(localStorageLocaleKey);\n }\n }\n }, {\n key: \"getLocaleFromURL\",\n value: function getLocaleFromURL(options) {\n var urlLocaleKey = options.urlLocaleKey;\n\n if (urlLocaleKey) {\n var query = location.search.split(\"?\");\n if (query.length >= 2) {\n var params = queryParser.parse(query[1]);\n return params && params[urlLocaleKey];\n }\n }\n }\n }, {\n key: \"getDescendantProp\",\n value: function getDescendantProp(locale, key) {\n\n if (locale[key]) {\n return locale[key];\n }\n\n var msg = key.split(\".\").reduce(function (a, b) {\n return a != undefined ? a[b] : a;\n }, locale);\n\n return msg;\n }\n }, {\n key: \"getLocaleFromBrowser\",\n value: function getLocaleFromBrowser() {\n return navigator.language || navigator.userLanguage;\n }\n }]);\n return ReactIntlUniversal;\n}();\n\nmodule.exports = new ReactIntlUniversal();\nmodule.exports.ReactIntlUniversal = ReactIntlUniversal;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","module.exports = __WEBPACK_EXTERNAL_MODULE__3__;","module.exports = __WEBPACK_EXTERNAL_MODULE__4__;","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","module.exports = __WEBPACK_EXTERNAL_MODULE__6__;","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__8__;","if (process.env.NODE_ENV === 'production') {\n module.exports = {\n ReactQueryDevtools: function() {return null;},\n ReactQueryDevtoolsPanel: function() {return null;},\n }\n} else {\n module.exports = require('./dist/react-query-devtools.development.js')\n}\n","// Expose `IntlPolyfill` as global to add locale data into runtime later on.\nglobal.IntlPolyfill = require('./lib/core.js');\n\n// Require all locale data for `Intl`. This module will be\n// ignored when bundling for the browser with Browserify/Webpack.\nrequire('./locale-data/complete.js');\n\n// hack to export the polyfill as global Intl if needed\nif (!global.Intl) {\n global.Intl = global.IntlPolyfill;\n global.IntlPolyfill.__applyLocaleSensitivePrototypes();\n}\n\n// providing an idiomatic api for the nodejs version of this module\nmodule.exports = global.IntlPolyfill;\n","'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n};\n\nvar jsx = function () {\n var REACT_ELEMENT_TYPE = typeof Symbol === \"function\" && Symbol.for && Symbol.for(\"react.element\") || 0xeac7;\n return function createRawReactElement(type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n props = {};\n }\n\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : '' + key,\n ref: null,\n props: props,\n _owner: null\n };\n };\n}();\n\nvar asyncToGenerator = function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n return step(\"next\", value);\n }, function (err) {\n return step(\"throw\", err);\n });\n }\n }\n\n return step(\"next\");\n });\n };\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar defineEnumerableProperties = function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n\n return obj;\n};\n\nvar defaults = function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n\n return obj;\n};\n\nvar defineProperty$1 = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n};\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar get = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar _instanceof = function (left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n};\n\nvar interopRequireDefault = function (obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n};\n\nvar interopRequireWildcard = function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n};\n\nvar newArrowCheck = function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n};\n\nvar objectDestructuringEmpty = function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n};\n\nvar objectWithoutProperties = function (obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar selfGlobal = typeof global === \"undefined\" ? self : global;\n\nvar set = function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if (\"value\" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n};\n\nvar slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\nvar slicedToArrayLoose = function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n\n if (i && _arr.length === i) break;\n }\n\n return _arr;\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n};\n\nvar taggedTemplateLiteral = function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n};\n\nvar taggedTemplateLiteralLoose = function (strings, raw) {\n strings.raw = raw;\n return strings;\n};\n\nvar temporalRef = function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + \" is not defined - temporal dead zone\");\n } else {\n return val;\n }\n};\n\nvar temporalUndefined = {};\n\nvar toArray = function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n};\n\nvar toConsumableArray = function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n};\n\n\n\nvar babelHelpers$1 = Object.freeze({\n jsx: jsx,\n asyncToGenerator: asyncToGenerator,\n classCallCheck: classCallCheck,\n createClass: createClass,\n defineEnumerableProperties: defineEnumerableProperties,\n defaults: defaults,\n defineProperty: defineProperty$1,\n get: get,\n inherits: inherits,\n interopRequireDefault: interopRequireDefault,\n interopRequireWildcard: interopRequireWildcard,\n newArrowCheck: newArrowCheck,\n objectDestructuringEmpty: objectDestructuringEmpty,\n objectWithoutProperties: objectWithoutProperties,\n possibleConstructorReturn: possibleConstructorReturn,\n selfGlobal: selfGlobal,\n set: set,\n slicedToArray: slicedToArray,\n slicedToArrayLoose: slicedToArrayLoose,\n taggedTemplateLiteral: taggedTemplateLiteral,\n taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,\n temporalRef: temporalRef,\n temporalUndefined: temporalUndefined,\n toArray: toArray,\n toConsumableArray: toConsumableArray,\n typeof: _typeof,\n extends: _extends,\n instanceof: _instanceof\n});\n\nvar realDefineProp = function () {\n var sentinel = function sentinel() {};\n try {\n Object.defineProperty(sentinel, 'a', {\n get: function get() {\n return 1;\n }\n });\n Object.defineProperty(sentinel, 'prototype', { writable: false });\n return sentinel.a === 1 && sentinel.prototype instanceof Object;\n } catch (e) {\n return false;\n }\n}();\n\n// Need a workaround for getters in ES3\nvar es3 = !realDefineProp && !Object.prototype.__defineGetter__;\n\n// We use this a lot (and need it for proto-less objects)\nvar hop = Object.prototype.hasOwnProperty;\n\n// Naive defineProperty for compatibility\nvar defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) {\n if ('get' in desc && obj.__defineGetter__) obj.__defineGetter__(name, desc.get);else if (!hop.call(obj, name) || 'value' in desc) obj[name] = desc.value;\n};\n\n// Array.prototype.indexOf, as good as we need it to be\nvar arrIndexOf = Array.prototype.indexOf || function (search) {\n /*jshint validthis:true */\n var t = this;\n if (!t.length) return -1;\n\n for (var i = arguments[1] || 0, max = t.length; i < max; i++) {\n if (t[i] === search) return i;\n }\n\n return -1;\n};\n\n// Create an object with the specified prototype (2nd arg required for Record)\nvar objCreate = Object.create || function (proto, props) {\n var obj = void 0;\n\n function F() {}\n F.prototype = proto;\n obj = new F();\n\n for (var k in props) {\n if (hop.call(props, k)) defineProperty(obj, k, props[k]);\n }\n\n return obj;\n};\n\n// Snapshot some (hopefully still) native built-ins\nvar arrSlice = Array.prototype.slice;\nvar arrConcat = Array.prototype.concat;\nvar arrPush = Array.prototype.push;\nvar arrJoin = Array.prototype.join;\nvar arrShift = Array.prototype.shift;\n\n// Naive Function.prototype.bind for compatibility\nvar fnBind = Function.prototype.bind || function (thisObj) {\n var fn = this,\n args = arrSlice.call(arguments, 1);\n\n // All our (presently) bound functions have either 1 or 0 arguments. By returning\n // different function signatures, we can pass some tests in ES3 environments\n if (fn.length === 1) {\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n }\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n};\n\n// Object housing internal properties for constructors\nvar internals = objCreate(null);\n\n// Keep internal properties internal\nvar secret = Math.random();\n\n// Helper functions\n// ================\n\n/**\n * A function to deal with the inaccuracy of calculating log10 in pre-ES6\n * JavaScript environments. Math.log(num) / Math.LN10 was responsible for\n * causing issue #62.\n */\nfunction log10Floor(n) {\n // ES6 provides the more accurate Math.log10\n if (typeof Math.log10 === 'function') return Math.floor(Math.log10(n));\n\n var x = Math.round(Math.log(n) * Math.LOG10E);\n return x - (Number('1e' + x) > n);\n}\n\n/**\n * A map that doesn't contain Object in its prototype chain\n */\nfunction Record(obj) {\n // Copy only own properties over unless this object is already a Record instance\n for (var k in obj) {\n if (obj instanceof Record || hop.call(obj, k)) defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });\n }\n}\nRecord.prototype = objCreate(null);\n\n/**\n * An ordered list\n */\nfunction List() {\n defineProperty(this, 'length', { writable: true, value: 0 });\n\n if (arguments.length) arrPush.apply(this, arrSlice.call(arguments));\n}\nList.prototype = objCreate(null);\n\n/**\n * Constructs a regular expression to restore tainted RegExp properties\n */\nfunction createRegExpRestore() {\n if (internals.disableRegExpRestore) {\n return function () {/* no-op */};\n }\n\n var regExpCache = {\n lastMatch: RegExp.lastMatch || '',\n leftContext: RegExp.leftContext,\n multiline: RegExp.multiline,\n input: RegExp.input\n },\n has = false;\n\n // Create a snapshot of all the 'captured' properties\n for (var i = 1; i <= 9; i++) {\n has = (regExpCache['$' + i] = RegExp['$' + i]) || has;\n }return function () {\n // Now we've snapshotted some properties, escape the lastMatch string\n var esc = /[.?*+^$[\\]\\\\(){}|-]/g,\n lm = regExpCache.lastMatch.replace(esc, '\\\\$&'),\n reg = new List();\n\n // If any of the captured strings were non-empty, iterate over them all\n if (has) {\n for (var _i = 1; _i <= 9; _i++) {\n var m = regExpCache['$' + _i];\n\n // If it's empty, add an empty capturing group\n if (!m) lm = '()' + lm;\n\n // Else find the string in lm and escape & wrap it to capture it\n else {\n m = m.replace(esc, '\\\\$&');\n lm = lm.replace(m, '(' + m + ')');\n }\n\n // Push it to the reg and chop lm to make sure further groups come after\n arrPush.call(reg, lm.slice(0, lm.indexOf('(') + 1));\n lm = lm.slice(lm.indexOf('(') + 1);\n }\n }\n\n var exprStr = arrJoin.call(reg, '') + lm;\n\n // Shorten the regex by replacing each part of the expression with a match\n // for a string of that exact length. This is safe for the type of\n // expressions generated above, because the expression matches the whole\n // match string, so we know each group and each segment between capturing\n // groups can be matched by its length alone.\n exprStr = exprStr.replace(/(\\\\\\(|\\\\\\)|[^()])+/g, function (match) {\n return '[\\\\s\\\\S]{' + match.replace('\\\\', '').length + '}';\n });\n\n // Create the regular expression that will reconstruct the RegExp properties\n var expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g');\n\n // Set the lastIndex of the generated expression to ensure that the match\n // is found in the correct index.\n expr.lastIndex = regExpCache.leftContext.length;\n\n expr.exec(regExpCache.input);\n };\n}\n\n/**\n * Mimics ES5's abstract ToObject() function\n */\nfunction toObject(arg) {\n if (arg === null) throw new TypeError('Cannot convert null or undefined to object');\n\n if ((typeof arg === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](arg)) === 'object') return arg;\n return Object(arg);\n}\n\nfunction toNumber(arg) {\n if (typeof arg === 'number') return arg;\n return Number(arg);\n}\n\nfunction toInteger(arg) {\n var number = toNumber(arg);\n if (isNaN(number)) return 0;\n if (number === +0 || number === -0 || number === +Infinity || number === -Infinity) return number;\n if (number < 0) return Math.floor(Math.abs(number)) * -1;\n return Math.floor(Math.abs(number));\n}\n\nfunction toLength(arg) {\n var len = toInteger(arg);\n if (len <= 0) return 0;\n if (len === Infinity) return Math.pow(2, 53) - 1;\n return Math.min(len, Math.pow(2, 53) - 1);\n}\n\n/**\n * Returns \"internal\" properties for an object\n */\nfunction getInternalProperties(obj) {\n if (hop.call(obj, '__getInternalProperties')) return obj.__getInternalProperties(secret);\n\n return objCreate(null);\n}\n\n/**\n* Defines regular expressions for various operations related to the BCP 47 syntax,\n* as defined at http://tools.ietf.org/html/bcp47#section-2.1\n*/\n\n// extlang = 3ALPHA ; selected ISO 639 codes\n// *2(\"-\" 3ALPHA) ; permanently reserved\nvar extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';\n\n// language = 2*3ALPHA ; shortest ISO 639 code\n// [\"-\" extlang] ; sometimes followed by\n// ; extended language subtags\n// / 4ALPHA ; or reserved for future use\n// / 5*8ALPHA ; or registered language subtag\nvar language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';\n\n// script = 4ALPHA ; ISO 15924 code\nvar script = '[a-z]{4}';\n\n// region = 2ALPHA ; ISO 3166-1 code\n// / 3DIGIT ; UN M.49 code\nvar region = '(?:[a-z]{2}|\\\\d{3})';\n\n// variant = 5*8alphanum ; registered variants\n// / (DIGIT 3alphanum)\nvar variant = '(?:[a-z0-9]{5,8}|\\\\d[a-z0-9]{3})';\n\n// ; Single alphanumerics\n// ; \"x\" reserved for private use\n// singleton = DIGIT ; 0 - 9\n// / %x41-57 ; A - W\n// / %x59-5A ; Y - Z\n// / %x61-77 ; a - w\n// / %x79-7A ; y - z\nvar singleton = '[0-9a-wy-z]';\n\n// extension = singleton 1*(\"-\" (2*8alphanum))\nvar extension = singleton + '(?:-[a-z0-9]{2,8})+';\n\n// privateuse = \"x\" 1*(\"-\" (1*8alphanum))\nvar privateuse = 'x(?:-[a-z0-9]{1,8})+';\n\n// irregular = \"en-GB-oed\" ; irregular tags do not match\n// / \"i-ami\" ; the 'langtag' production and\n// / \"i-bnn\" ; would not otherwise be\n// / \"i-default\" ; considered 'well-formed'\n// / \"i-enochian\" ; These tags are all valid,\n// / \"i-hak\" ; but most are deprecated\n// / \"i-klingon\" ; in favor of more modern\n// / \"i-lux\" ; subtags or subtag\n// / \"i-mingo\" ; combination\n// / \"i-navajo\"\n// / \"i-pwn\"\n// / \"i-tao\"\n// / \"i-tay\"\n// / \"i-tsu\"\n// / \"sgn-BE-FR\"\n// / \"sgn-BE-NL\"\n// / \"sgn-CH-DE\"\nvar irregular = '(?:en-GB-oed' + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)' + '|sgn-(?:BE-FR|BE-NL|CH-DE))';\n\n// regular = \"art-lojban\" ; these tags match the 'langtag'\n// / \"cel-gaulish\" ; production, but their subtags\n// / \"no-bok\" ; are not extended language\n// / \"no-nyn\" ; or variant subtags: their meaning\n// / \"zh-guoyu\" ; is defined by their registration\n// / \"zh-hakka\" ; and all of these are deprecated\n// / \"zh-min\" ; in favor of a more modern\n// / \"zh-min-nan\" ; subtag or sequence of subtags\n// / \"zh-xiang\"\nvar regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn' + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';\n\n// grandfathered = irregular ; non-redundant tags registered\n// / regular ; during the RFC 3066 era\nvar grandfathered = '(?:' + irregular + '|' + regular + ')';\n\n// langtag = language\n// [\"-\" script]\n// [\"-\" region]\n// *(\"-\" variant)\n// *(\"-\" extension)\n// [\"-\" privateuse]\nvar langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-' + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';\n\n// Language-Tag = langtag ; normal language tags\n// / privateuse ; private use tag\n// / grandfathered ; grandfathered tags\nvar expBCP47Syntax = RegExp('^(?:' + langtag + '|' + privateuse + '|' + grandfathered + ')$', 'i');\n\n// Match duplicate variants in a language tag\nvar expVariantDupes = RegExp('^(?!x).*?-(' + variant + ')-(?:\\\\w{4,8}-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match duplicate singletons in a language tag (except in private use)\nvar expSingletonDupes = RegExp('^(?!x).*?-(' + singleton + ')-(?:\\\\w+-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match all extension sequences\nvar expExtSequences = RegExp('-' + extension, 'ig');\n\n// Default locale is the first-added locale data for us\nvar defaultLocale = void 0;\nfunction setDefaultLocale(locale) {\n defaultLocale = locale;\n}\n\n// IANA Subtag Registry redundant tag and subtag maps\nvar redundantTags = {\n tags: {\n \"art-lojban\": \"jbo\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"no-bok\": \"nb\",\n \"no-nyn\": \"nn\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"zh-guoyu\": \"cmn\",\n \"zh-hakka\": \"hak\",\n \"zh-min-nan\": \"nan\",\n \"zh-xiang\": \"hsn\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsl\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"zh-cmn\": \"cmn\",\n \"zh-cmn-Hans\": \"cmn-Hans\",\n \"zh-cmn-Hant\": \"cmn-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-wuu\": \"wuu\",\n \"zh-yue\": \"yue\"\n },\n subtags: {\n BU: \"MM\",\n DD: \"DE\",\n FX: \"FR\",\n TP: \"TL\",\n YD: \"YE\",\n ZR: \"CD\",\n heploc: \"alalc97\",\n 'in': \"id\",\n iw: \"he\",\n ji: \"yi\",\n jw: \"jv\",\n mo: \"ro\",\n ayx: \"nun\",\n bjd: \"drl\",\n ccq: \"rki\",\n cjr: \"mom\",\n cka: \"cmr\",\n cmk: \"xch\",\n drh: \"khk\",\n drw: \"prs\",\n gav: \"dev\",\n hrr: \"jal\",\n ibi: \"opa\",\n kgh: \"kml\",\n lcq: \"ppr\",\n mst: \"mry\",\n myt: \"mry\",\n sca: \"hle\",\n tie: \"ras\",\n tkk: \"twm\",\n tlw: \"weo\",\n tnf: \"prs\",\n ybd: \"rki\",\n yma: \"lrr\"\n },\n extLang: {\n aao: [\"aao\", \"ar\"],\n abh: [\"abh\", \"ar\"],\n abv: [\"abv\", \"ar\"],\n acm: [\"acm\", \"ar\"],\n acq: [\"acq\", \"ar\"],\n acw: [\"acw\", \"ar\"],\n acx: [\"acx\", \"ar\"],\n acy: [\"acy\", \"ar\"],\n adf: [\"adf\", \"ar\"],\n ads: [\"ads\", \"sgn\"],\n aeb: [\"aeb\", \"ar\"],\n aec: [\"aec\", \"ar\"],\n aed: [\"aed\", \"sgn\"],\n aen: [\"aen\", \"sgn\"],\n afb: [\"afb\", \"ar\"],\n afg: [\"afg\", \"sgn\"],\n ajp: [\"ajp\", \"ar\"],\n apc: [\"apc\", \"ar\"],\n apd: [\"apd\", \"ar\"],\n arb: [\"arb\", \"ar\"],\n arq: [\"arq\", \"ar\"],\n ars: [\"ars\", \"ar\"],\n ary: [\"ary\", \"ar\"],\n arz: [\"arz\", \"ar\"],\n ase: [\"ase\", \"sgn\"],\n asf: [\"asf\", \"sgn\"],\n asp: [\"asp\", \"sgn\"],\n asq: [\"asq\", \"sgn\"],\n asw: [\"asw\", \"sgn\"],\n auz: [\"auz\", \"ar\"],\n avl: [\"avl\", \"ar\"],\n ayh: [\"ayh\", \"ar\"],\n ayl: [\"ayl\", \"ar\"],\n ayn: [\"ayn\", \"ar\"],\n ayp: [\"ayp\", \"ar\"],\n bbz: [\"bbz\", \"ar\"],\n bfi: [\"bfi\", \"sgn\"],\n bfk: [\"bfk\", \"sgn\"],\n bjn: [\"bjn\", \"ms\"],\n bog: [\"bog\", \"sgn\"],\n bqn: [\"bqn\", \"sgn\"],\n bqy: [\"bqy\", \"sgn\"],\n btj: [\"btj\", \"ms\"],\n bve: [\"bve\", \"ms\"],\n bvl: [\"bvl\", \"sgn\"],\n bvu: [\"bvu\", \"ms\"],\n bzs: [\"bzs\", \"sgn\"],\n cdo: [\"cdo\", \"zh\"],\n cds: [\"cds\", \"sgn\"],\n cjy: [\"cjy\", \"zh\"],\n cmn: [\"cmn\", \"zh\"],\n coa: [\"coa\", \"ms\"],\n cpx: [\"cpx\", \"zh\"],\n csc: [\"csc\", \"sgn\"],\n csd: [\"csd\", \"sgn\"],\n cse: [\"cse\", \"sgn\"],\n csf: [\"csf\", \"sgn\"],\n csg: [\"csg\", \"sgn\"],\n csl: [\"csl\", \"sgn\"],\n csn: [\"csn\", \"sgn\"],\n csq: [\"csq\", \"sgn\"],\n csr: [\"csr\", \"sgn\"],\n czh: [\"czh\", \"zh\"],\n czo: [\"czo\", \"zh\"],\n doq: [\"doq\", \"sgn\"],\n dse: [\"dse\", \"sgn\"],\n dsl: [\"dsl\", \"sgn\"],\n dup: [\"dup\", \"ms\"],\n ecs: [\"ecs\", \"sgn\"],\n esl: [\"esl\", \"sgn\"],\n esn: [\"esn\", \"sgn\"],\n eso: [\"eso\", \"sgn\"],\n eth: [\"eth\", \"sgn\"],\n fcs: [\"fcs\", \"sgn\"],\n fse: [\"fse\", \"sgn\"],\n fsl: [\"fsl\", \"sgn\"],\n fss: [\"fss\", \"sgn\"],\n gan: [\"gan\", \"zh\"],\n gds: [\"gds\", \"sgn\"],\n gom: [\"gom\", \"kok\"],\n gse: [\"gse\", \"sgn\"],\n gsg: [\"gsg\", \"sgn\"],\n gsm: [\"gsm\", \"sgn\"],\n gss: [\"gss\", \"sgn\"],\n gus: [\"gus\", \"sgn\"],\n hab: [\"hab\", \"sgn\"],\n haf: [\"haf\", \"sgn\"],\n hak: [\"hak\", \"zh\"],\n hds: [\"hds\", \"sgn\"],\n hji: [\"hji\", \"ms\"],\n hks: [\"hks\", \"sgn\"],\n hos: [\"hos\", \"sgn\"],\n hps: [\"hps\", \"sgn\"],\n hsh: [\"hsh\", \"sgn\"],\n hsl: [\"hsl\", \"sgn\"],\n hsn: [\"hsn\", \"zh\"],\n icl: [\"icl\", \"sgn\"],\n ils: [\"ils\", \"sgn\"],\n inl: [\"inl\", \"sgn\"],\n ins: [\"ins\", \"sgn\"],\n ise: [\"ise\", \"sgn\"],\n isg: [\"isg\", \"sgn\"],\n isr: [\"isr\", \"sgn\"],\n jak: [\"jak\", \"ms\"],\n jax: [\"jax\", \"ms\"],\n jcs: [\"jcs\", \"sgn\"],\n jhs: [\"jhs\", \"sgn\"],\n jls: [\"jls\", \"sgn\"],\n jos: [\"jos\", \"sgn\"],\n jsl: [\"jsl\", \"sgn\"],\n jus: [\"jus\", \"sgn\"],\n kgi: [\"kgi\", \"sgn\"],\n knn: [\"knn\", \"kok\"],\n kvb: [\"kvb\", \"ms\"],\n kvk: [\"kvk\", \"sgn\"],\n kvr: [\"kvr\", \"ms\"],\n kxd: [\"kxd\", \"ms\"],\n lbs: [\"lbs\", \"sgn\"],\n lce: [\"lce\", \"ms\"],\n lcf: [\"lcf\", \"ms\"],\n liw: [\"liw\", \"ms\"],\n lls: [\"lls\", \"sgn\"],\n lsg: [\"lsg\", \"sgn\"],\n lsl: [\"lsl\", \"sgn\"],\n lso: [\"lso\", \"sgn\"],\n lsp: [\"lsp\", \"sgn\"],\n lst: [\"lst\", \"sgn\"],\n lsy: [\"lsy\", \"sgn\"],\n ltg: [\"ltg\", \"lv\"],\n lvs: [\"lvs\", \"lv\"],\n lzh: [\"lzh\", \"zh\"],\n max: [\"max\", \"ms\"],\n mdl: [\"mdl\", \"sgn\"],\n meo: [\"meo\", \"ms\"],\n mfa: [\"mfa\", \"ms\"],\n mfb: [\"mfb\", \"ms\"],\n mfs: [\"mfs\", \"sgn\"],\n min: [\"min\", \"ms\"],\n mnp: [\"mnp\", \"zh\"],\n mqg: [\"mqg\", \"ms\"],\n mre: [\"mre\", \"sgn\"],\n msd: [\"msd\", \"sgn\"],\n msi: [\"msi\", \"ms\"],\n msr: [\"msr\", \"sgn\"],\n mui: [\"mui\", \"ms\"],\n mzc: [\"mzc\", \"sgn\"],\n mzg: [\"mzg\", \"sgn\"],\n mzy: [\"mzy\", \"sgn\"],\n nan: [\"nan\", \"zh\"],\n nbs: [\"nbs\", \"sgn\"],\n ncs: [\"ncs\", \"sgn\"],\n nsi: [\"nsi\", \"sgn\"],\n nsl: [\"nsl\", \"sgn\"],\n nsp: [\"nsp\", \"sgn\"],\n nsr: [\"nsr\", \"sgn\"],\n nzs: [\"nzs\", \"sgn\"],\n okl: [\"okl\", \"sgn\"],\n orn: [\"orn\", \"ms\"],\n ors: [\"ors\", \"ms\"],\n pel: [\"pel\", \"ms\"],\n pga: [\"pga\", \"ar\"],\n pks: [\"pks\", \"sgn\"],\n prl: [\"prl\", \"sgn\"],\n prz: [\"prz\", \"sgn\"],\n psc: [\"psc\", \"sgn\"],\n psd: [\"psd\", \"sgn\"],\n pse: [\"pse\", \"ms\"],\n psg: [\"psg\", \"sgn\"],\n psl: [\"psl\", \"sgn\"],\n pso: [\"pso\", \"sgn\"],\n psp: [\"psp\", \"sgn\"],\n psr: [\"psr\", \"sgn\"],\n pys: [\"pys\", \"sgn\"],\n rms: [\"rms\", \"sgn\"],\n rsi: [\"rsi\", \"sgn\"],\n rsl: [\"rsl\", \"sgn\"],\n sdl: [\"sdl\", \"sgn\"],\n sfb: [\"sfb\", \"sgn\"],\n sfs: [\"sfs\", \"sgn\"],\n sgg: [\"sgg\", \"sgn\"],\n sgx: [\"sgx\", \"sgn\"],\n shu: [\"shu\", \"ar\"],\n slf: [\"slf\", \"sgn\"],\n sls: [\"sls\", \"sgn\"],\n sqk: [\"sqk\", \"sgn\"],\n sqs: [\"sqs\", \"sgn\"],\n ssh: [\"ssh\", \"ar\"],\n ssp: [\"ssp\", \"sgn\"],\n ssr: [\"ssr\", \"sgn\"],\n svk: [\"svk\", \"sgn\"],\n swc: [\"swc\", \"sw\"],\n swh: [\"swh\", \"sw\"],\n swl: [\"swl\", \"sgn\"],\n syy: [\"syy\", \"sgn\"],\n tmw: [\"tmw\", \"ms\"],\n tse: [\"tse\", \"sgn\"],\n tsm: [\"tsm\", \"sgn\"],\n tsq: [\"tsq\", \"sgn\"],\n tss: [\"tss\", \"sgn\"],\n tsy: [\"tsy\", \"sgn\"],\n tza: [\"tza\", \"sgn\"],\n ugn: [\"ugn\", \"sgn\"],\n ugy: [\"ugy\", \"sgn\"],\n ukl: [\"ukl\", \"sgn\"],\n uks: [\"uks\", \"sgn\"],\n urk: [\"urk\", \"ms\"],\n uzn: [\"uzn\", \"uz\"],\n uzs: [\"uzs\", \"uz\"],\n vgt: [\"vgt\", \"sgn\"],\n vkk: [\"vkk\", \"ms\"],\n vkt: [\"vkt\", \"ms\"],\n vsi: [\"vsi\", \"sgn\"],\n vsl: [\"vsl\", \"sgn\"],\n vsv: [\"vsv\", \"sgn\"],\n wuu: [\"wuu\", \"zh\"],\n xki: [\"xki\", \"sgn\"],\n xml: [\"xml\", \"sgn\"],\n xmm: [\"xmm\", \"ms\"],\n xms: [\"xms\", \"sgn\"],\n yds: [\"yds\", \"sgn\"],\n ysl: [\"ysl\", \"sgn\"],\n yue: [\"yue\", \"zh\"],\n zib: [\"zib\", \"sgn\"],\n zlm: [\"zlm\", \"ms\"],\n zmi: [\"zmi\", \"ms\"],\n zsl: [\"zsl\", \"sgn\"],\n zsm: [\"zsm\", \"ms\"]\n }\n};\n\n/**\n * Convert only a-z to uppercase as per section 6.1 of the spec\n */\nfunction toLatinUpperCase(str) {\n var i = str.length;\n\n while (i--) {\n var ch = str.charAt(i);\n\n if (ch >= \"a\" && ch <= \"z\") str = str.slice(0, i) + ch.toUpperCase() + str.slice(i + 1);\n }\n\n return str;\n}\n\n/**\n * The IsStructurallyValidLanguageTag abstract operation verifies that the locale\n * argument (which must be a String value)\n *\n * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section\n * 2.1, or successor,\n * - does not include duplicate variant subtags, and\n * - does not include duplicate singleton subtags.\n *\n * The abstract operation returns true if locale can be generated from the ABNF\n * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not\n * contain duplicate variant or singleton subtags (other than as a private use\n * subtag). It returns false otherwise. Terminal value characters in the grammar are\n * interpreted as the Unicode equivalents of the ASCII octet values given.\n */\nfunction /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {\n // represents a well-formed BCP 47 language tag as specified in RFC 5646\n if (!expBCP47Syntax.test(locale)) return false;\n\n // does not include duplicate variant subtags, and\n if (expVariantDupes.test(locale)) return false;\n\n // does not include duplicate singleton subtags.\n if (expSingletonDupes.test(locale)) return false;\n\n return true;\n}\n\n/**\n * The CanonicalizeLanguageTag abstract operation returns the canonical and case-\n * regularized form of the locale argument (which must be a String value that is\n * a structurally valid BCP 47 language tag as verified by the\n * IsStructurallyValidLanguageTag abstract operation). It takes the steps\n * specified in RFC 5646 section 4.5, or successor, to bring the language tag\n * into canonical form, and to regularize the case of the subtags, but does not\n * take the steps to bring a language tag into “extlang form” and to reorder\n * variant subtags.\n\n * The specifications for extensions to BCP 47 language tags, such as RFC 6067,\n * may include canonicalization rules for the extension subtag sequences they\n * define that go beyond the canonicalization rules of RFC 5646 section 4.5.\n * Implementations are allowed, but not required, to apply these additional rules.\n */\nfunction /* 6.2.3 */CanonicalizeLanguageTag(locale) {\n var match = void 0,\n parts = void 0;\n\n // A language tag is in 'canonical form' when the tag is well-formed\n // according to the rules in Sections 2.1 and 2.2\n\n // Section 2.1 says all subtags use lowercase...\n locale = locale.toLowerCase();\n\n // ...with 2 exceptions: 'two-letter and four-letter subtags that neither\n // appear at the start of the tag nor occur after singletons. Such two-letter\n // subtags are all uppercase (as in the tags \"en-CA-x-ca\" or \"sgn-BE-FR\") and\n // four-letter subtags are titlecase (as in the tag \"az-Latn-x-latn\").\n parts = locale.split('-');\n for (var i = 1, max = parts.length; i < max; i++) {\n // Two-letter subtags are all uppercase\n if (parts[i].length === 2) parts[i] = parts[i].toUpperCase();\n\n // Four-letter subtags are titlecase\n else if (parts[i].length === 4) parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);\n\n // Is it a singleton?\n else if (parts[i].length === 1 && parts[i] !== 'x') break;\n }\n locale = arrJoin.call(parts, '-');\n\n // The steps laid out in RFC 5646 section 4.5 are as follows:\n\n // 1. Extension sequences are ordered into case-insensitive ASCII order\n // by singleton subtag.\n if ((match = locale.match(expExtSequences)) && match.length > 1) {\n // The built-in sort() sorts by ASCII order, so use that\n match.sort();\n\n // Replace all extensions with the joined, sorted array\n locale = locale.replace(RegExp('(?:' + expExtSequences.source + ')+', 'i'), arrJoin.call(match, ''));\n }\n\n // 2. Redundant or grandfathered tags are replaced by their 'Preferred-\n // Value', if there is one.\n if (hop.call(redundantTags.tags, locale)) locale = redundantTags.tags[locale];\n\n // 3. Subtags are replaced by their 'Preferred-Value', if there is one.\n // For extlangs, the original primary language subtag is also\n // replaced if there is a primary language subtag in the 'Preferred-\n // Value'.\n parts = locale.split('-');\n\n for (var _i = 1, _max = parts.length; _i < _max; _i++) {\n if (hop.call(redundantTags.subtags, parts[_i])) parts[_i] = redundantTags.subtags[parts[_i]];else if (hop.call(redundantTags.extLang, parts[_i])) {\n parts[_i] = redundantTags.extLang[parts[_i]][0];\n\n // For extlang tags, the prefix needs to be removed if it is redundant\n if (_i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {\n parts = arrSlice.call(parts, _i++);\n _max -= 1;\n }\n }\n }\n\n return arrJoin.call(parts, '-');\n}\n\n/**\n * The DefaultLocale abstract operation returns a String value representing the\n * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the\n * host environment’s current locale.\n */\nfunction /* 6.2.4 */DefaultLocale() {\n return defaultLocale;\n}\n\n// Sect 6.3 Currency Codes\n// =======================\n\nvar expCurrencyCode = /^[A-Z]{3}$/;\n\n/**\n * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument\n * (after conversion to a String value) represents a well-formed 3-letter ISO currency\n * code. The following steps are taken:\n */\nfunction /* 6.3.1 */IsWellFormedCurrencyCode(currency) {\n // 1. Let `c` be ToString(currency)\n var c = String(currency);\n\n // 2. Let `normalized` be the result of mapping c to upper case as described\n // in 6.1.\n var normalized = toLatinUpperCase(c);\n\n // 3. If the string length of normalized is not 3, return false.\n // 4. If normalized contains any character that is not in the range \"A\" to \"Z\"\n // (U+0041 to U+005A), return false.\n if (expCurrencyCode.test(normalized) === false) return false;\n\n // 5. Return true\n return true;\n}\n\nvar expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below\n\nfunction /* 9.2.1 */CanonicalizeLocaleList(locales) {\n // The abstract operation CanonicalizeLocaleList takes the following steps:\n\n // 1. If locales is undefined, then a. Return a new empty List\n if (locales === undefined) return new List();\n\n // 2. Let seen be a new empty List.\n var seen = new List();\n\n // 3. If locales is a String value, then\n // a. Let locales be a new array created as if by the expression new\n // Array(locales) where Array is the standard built-in constructor with\n // that name and locales is the value of locales.\n locales = typeof locales === 'string' ? [locales] : locales;\n\n // 4. Let O be ToObject(locales).\n var O = toObject(locales);\n\n // 5. Let lenValue be the result of calling the [[Get]] internal method of\n // O with the argument \"length\".\n // 6. Let len be ToUint32(lenValue).\n var len = toLength(O.length);\n\n // 7. Let k be 0.\n var k = 0;\n\n // 8. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ToString(k).\n var Pk = String(k);\n\n // b. Let kPresent be the result of calling the [[HasProperty]] internal\n // method of O with argument Pk.\n var kPresent = Pk in O;\n\n // c. If kPresent is true, then\n if (kPresent) {\n // i. Let kValue be the result of calling the [[Get]] internal\n // method of O with argument Pk.\n var kValue = O[Pk];\n\n // ii. If the type of kValue is not String or Object, then throw a\n // TypeError exception.\n if (kValue === null || typeof kValue !== 'string' && (typeof kValue === \"undefined\" ? \"undefined\" : babelHelpers$1[\"typeof\"](kValue)) !== 'object') throw new TypeError('String or Object type expected');\n\n // iii. Let tag be ToString(kValue).\n var tag = String(kValue);\n\n // iv. If the result of calling the abstract operation\n // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as\n // the argument, is false, then throw a RangeError exception.\n if (!IsStructurallyValidLanguageTag(tag)) throw new RangeError(\"'\" + tag + \"' is not a structurally valid language tag\");\n\n // v. Let tag be the result of calling the abstract operation\n // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the\n // argument.\n tag = CanonicalizeLanguageTag(tag);\n\n // vi. If tag is not an element of seen, then append tag as the last\n // element of seen.\n if (arrIndexOf.call(seen, tag) === -1) arrPush.call(seen, tag);\n }\n\n // d. Increase k by 1.\n k++;\n }\n\n // 9. Return seen.\n return seen;\n}\n\n/**\n * The BestAvailableLocale abstract operation compares the provided argument\n * locale, which must be a String value with a structurally valid and\n * canonicalized BCP 47 language tag, against the locales in availableLocales and\n * returns either the longest non-empty prefix of locale that is an element of\n * availableLocales, or undefined if there is no such element. It uses the\n * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:\n */\nfunction /* 9.2.2 */BestAvailableLocale(availableLocales, locale) {\n // 1. Let candidate be locale\n var candidate = locale;\n\n // 2. Repeat\n while (candidate) {\n // a. If availableLocales contains an element equal to candidate, then return\n // candidate.\n if (arrIndexOf.call(availableLocales, candidate) > -1) return candidate;\n\n // b. Let pos be the character index of the last occurrence of \"-\"\n // (U+002D) within candidate. If that character does not occur, return\n // undefined.\n var pos = candidate.lastIndexOf('-');\n\n if (pos < 0) return;\n\n // c. If pos ≥ 2 and the character \"-\" occurs at index pos-2 of candidate,\n // then decrease pos by 2.\n if (pos >= 2 && candidate.charAt(pos - 2) === '-') pos -= 2;\n\n // d. Let candidate be the substring of candidate from position 0, inclusive,\n // to position pos, exclusive.\n candidate = candidate.substring(0, pos);\n }\n}\n\n/**\n * The LookupMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The following steps are taken:\n */\nfunction /* 9.2.3 */LookupMatcher(availableLocales, requestedLocales) {\n // 1. Let i be 0.\n var i = 0;\n\n // 2. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n\n // 3. Let availableLocale be undefined.\n var availableLocale = void 0;\n\n var locale = void 0,\n noExtensionsLocale = void 0;\n\n // 4. Repeat while i < len and availableLocale is undefined:\n while (i < len && !availableLocale) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position i.\n locale = requestedLocales[i];\n\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. Increase i by 1.\n i++;\n }\n\n // 5. Let result be a new Record.\n var result = new Record();\n\n // 6. If availableLocale is not undefined, then\n if (availableLocale !== undefined) {\n // a. Set result.[[locale]] to availableLocale.\n result['[[locale]]'] = availableLocale;\n\n // b. If locale and noExtensionsLocale are not the same String value, then\n if (String(locale) !== String(noExtensionsLocale)) {\n // i. Let extension be the String value consisting of the first\n // substring of locale that is a Unicode locale extension sequence.\n var extension = locale.match(expUnicodeExSeq)[0];\n\n // ii. Let extensionIndex be the character position of the initial\n // \"-\" of the first Unicode locale extension sequence within locale.\n var extensionIndex = locale.indexOf('-u-');\n\n // iii. Set result.[[extension]] to extension.\n result['[[extension]]'] = extension;\n\n // iv. Set result.[[extensionIndex]] to extensionIndex.\n result['[[extensionIndex]]'] = extensionIndex;\n }\n }\n // 7. Else\n else\n // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract\n // operation (defined in 6.2.4).\n result['[[locale]]'] = DefaultLocale();\n\n // 8. Return result\n return result;\n}\n\n/**\n * The BestFitMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The algorithm is implementation dependent, but should produce results\n * that a typical user of the requested locales would perceive as at least as\n * good as those produced by the LookupMatcher abstract operation. Options\n * specified through Unicode locale extension sequences must be ignored by the\n * algorithm. Information about such subsequences is returned separately.\n * The abstract operation returns a record with a [[locale]] field, whose value\n * is the language tag of the selected locale, which must be an element of\n * availableLocales. If the language tag of the request locale that led to the\n * selected locale contained a Unicode locale extension sequence, then the\n * returned record also contains an [[extension]] field whose value is the first\n * Unicode locale extension sequence, and an [[extensionIndex]] field whose value\n * is the index of the first Unicode locale extension sequence within the request\n * locale language tag.\n */\nfunction /* 9.2.4 */BestFitMatcher(availableLocales, requestedLocales) {\n return LookupMatcher(availableLocales, requestedLocales);\n}\n\n/**\n * The ResolveLocale abstract operation compares a BCP 47 language priority list\n * requestedLocales against the locales in availableLocales and determines the\n * best available language to meet the request. availableLocales and\n * requestedLocales must be provided as List values, options as a Record.\n */\nfunction /* 9.2.5 */ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n if (availableLocales.length === 0) {\n throw new ReferenceError('No locale data has been provided for this object yet.');\n }\n\n // The following steps are taken:\n // 1. Let matcher be the value of options.[[localeMatcher]].\n var matcher = options['[[localeMatcher]]'];\n\n var r = void 0;\n\n // 2. If matcher is \"lookup\", then\n if (matcher === 'lookup')\n // a. Let r be the result of calling the LookupMatcher abstract operation\n // (defined in 9.2.3) with arguments availableLocales and\n // requestedLocales.\n r = LookupMatcher(availableLocales, requestedLocales);\n\n // 3. Else\n else\n // a. Let r be the result of calling the BestFitMatcher abstract\n // operation (defined in 9.2.4) with arguments availableLocales and\n // requestedLocales.\n r = BestFitMatcher(availableLocales, requestedLocales);\n\n // 4. Let foundLocale be the value of r.[[locale]].\n var foundLocale = r['[[locale]]'];\n\n var extensionSubtags = void 0,\n extensionSubtagsLength = void 0;\n\n // 5. If r has an [[extension]] field, then\n if (hop.call(r, '[[extension]]')) {\n // a. Let extension be the value of r.[[extension]].\n var extension = r['[[extension]]'];\n // b. Let split be the standard built-in function object defined in ES5,\n // 15.5.4.14.\n var split = String.prototype.split;\n // c. Let extensionSubtags be the result of calling the [[Call]] internal\n // method of split with extension as the this value and an argument\n // list containing the single item \"-\".\n extensionSubtags = split.call(extension, '-');\n // d. Let extensionSubtagsLength be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument \"length\".\n extensionSubtagsLength = extensionSubtags.length;\n }\n\n // 6. Let result be a new Record.\n var result = new Record();\n\n // 7. Set result.[[dataLocale]] to foundLocale.\n result['[[dataLocale]]'] = foundLocale;\n\n // 8. Let supportedExtension be \"-u\".\n var supportedExtension = '-u';\n // 9. Let i be 0.\n var i = 0;\n // 10. Let len be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument \"length\".\n var len = relevantExtensionKeys.length;\n\n // 11 Repeat while i < len:\n while (i < len) {\n // a. Let key be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument ToString(i).\n var key = relevantExtensionKeys[i];\n // b. Let foundLocaleData be the result of calling the [[Get]] internal\n // method of localeData with the argument foundLocale.\n var foundLocaleData = localeData[foundLocale];\n // c. Let keyLocaleData be the result of calling the [[Get]] internal\n // method of foundLocaleData with the argument key.\n var keyLocaleData = foundLocaleData[key];\n // d. Let value be the result of calling the [[Get]] internal method of\n // keyLocaleData with argument \"0\".\n var value = keyLocaleData['0'];\n // e. Let supportedExtensionAddition be \"\".\n var supportedExtensionAddition = '';\n // f. Let indexOf be the standard built-in function object defined in\n // ES5, 15.4.4.14.\n var indexOf = arrIndexOf;\n\n // g. If extensionSubtags is not undefined, then\n if (extensionSubtags !== undefined) {\n // i. Let keyPos be the result of calling the [[Call]] internal\n // method of indexOf with extensionSubtags as the this value and\n // an argument list containing the single item key.\n var keyPos = indexOf.call(extensionSubtags, key);\n\n // ii. If keyPos ≠ -1, then\n if (keyPos !== -1) {\n // 1. If keyPos + 1 < extensionSubtagsLength and the length of the\n // result of calling the [[Get]] internal method of\n // extensionSubtags with argument ToString(keyPos +1) is greater\n // than 2, then\n if (keyPos + 1 < extensionSubtagsLength && extensionSubtags[keyPos + 1].length > 2) {\n // a. Let requestedValue be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument\n // ToString(keyPos + 1).\n var requestedValue = extensionSubtags[keyPos + 1];\n // b. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the\n // this value and an argument list containing the single\n // item requestedValue.\n var valuePos = indexOf.call(keyLocaleData, requestedValue);\n\n // c. If valuePos ≠ -1, then\n if (valuePos !== -1) {\n // i. Let value be requestedValue.\n value = requestedValue,\n // ii. Let supportedExtensionAddition be the\n // concatenation of \"-\", key, \"-\", and value.\n supportedExtensionAddition = '-' + key + '-' + value;\n }\n }\n // 2. Else\n else {\n // a. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the this\n // value and an argument list containing the single item\n // \"true\".\n var _valuePos = indexOf(keyLocaleData, 'true');\n\n // b. If valuePos ≠ -1, then\n if (_valuePos !== -1)\n // i. Let value be \"true\".\n value = 'true';\n }\n }\n }\n // h. If options has a field [[]], then\n if (hop.call(options, '[[' + key + ']]')) {\n // i. Let optionsValue be the value of options.[[]].\n var optionsValue = options['[[' + key + ']]'];\n\n // ii. If the result of calling the [[Call]] internal method of indexOf\n // with keyLocaleData as the this value and an argument list\n // containing the single item optionsValue is not -1, then\n if (indexOf.call(keyLocaleData, optionsValue) !== -1) {\n // 1. If optionsValue is not equal to value, then\n if (optionsValue !== value) {\n // a. Let value be optionsValue.\n value = optionsValue;\n // b. Let supportedExtensionAddition be \"\".\n supportedExtensionAddition = '';\n }\n }\n }\n // i. Set result.[[]] to value.\n result['[[' + key + ']]'] = value;\n\n // j. Append supportedExtensionAddition to supportedExtension.\n supportedExtension += supportedExtensionAddition;\n\n // k. Increase i by 1.\n i++;\n }\n // 12. If the length of supportedExtension is greater than 2, then\n if (supportedExtension.length > 2) {\n // a.\n var privateIndex = foundLocale.indexOf(\"-x-\");\n // b.\n if (privateIndex === -1) {\n // i.\n foundLocale = foundLocale + supportedExtension;\n }\n // c.\n else {\n // i.\n var preExtension = foundLocale.substring(0, privateIndex);\n // ii.\n var postExtension = foundLocale.substring(privateIndex);\n // iii.\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n // d. asserting - skipping\n // e.\n foundLocale = CanonicalizeLanguageTag(foundLocale);\n }\n // 13. Set result.[[locale]] to foundLocale.\n result['[[locale]]'] = foundLocale;\n\n // 14. Return result.\n return result;\n}\n\n/**\n * The LookupSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.\n * Locales appear in the same order in the returned list as in requestedLocales.\n * The following steps are taken:\n */\nfunction /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) {\n // 1. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n // 2. Let subset be a new empty List.\n var subset = new List();\n // 3. Let k be 0.\n var k = 0;\n\n // 4. Repeat while k < len\n while (k < len) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position k.\n var locale = requestedLocales[k];\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n var noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. If availableLocale is not undefined, then append locale to the end of\n // subset.\n if (availableLocale !== undefined) arrPush.call(subset, locale);\n\n // e. Increment k by 1.\n k++;\n }\n\n // 5. Let subsetArray be a new Array object whose elements are the same\n // values in the same order as the elements of subset.\n var subsetArray = arrSlice.call(subset);\n\n // 6. Return subsetArray.\n return subsetArray;\n}\n\n/**\n * The BestFitSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the Best Fit Matcher\n * algorithm. Locales appear in the same order in the returned list as in\n * requestedLocales. The steps taken are implementation dependent.\n */\nfunction /*9.2.7 */BestFitSupportedLocales(availableLocales, requestedLocales) {\n // ###TODO: implement this function as described by the specification###\n return LookupSupportedLocales(availableLocales, requestedLocales);\n}\n\n/**\n * The SupportedLocales abstract operation returns the subset of the provided BCP\n * 47 language priority list requestedLocales for which availableLocales has a\n * matching locale. Two algorithms are available to match the locales: the Lookup\n * algorithm described in RFC 4647 section 3.4, and an implementation dependent\n * best-fit algorithm. Locales appear in the same order in the returned list as\n * in requestedLocales. The following steps are taken:\n */\nfunction /*9.2.8 */SupportedLocales(availableLocales, requestedLocales, options) {\n var matcher = void 0,\n subset = void 0;\n\n // 1. If options is not undefined, then\n if (options !== undefined) {\n // a. Let options be ToObject(options).\n options = new Record(toObject(options));\n // b. Let matcher be the result of calling the [[Get]] internal method of\n // options with argument \"localeMatcher\".\n matcher = options.localeMatcher;\n\n // c. If matcher is not undefined, then\n if (matcher !== undefined) {\n // i. Let matcher be ToString(matcher).\n matcher = String(matcher);\n\n // ii. If matcher is not \"lookup\" or \"best fit\", then throw a RangeError\n // exception.\n if (matcher !== 'lookup' && matcher !== 'best fit') throw new RangeError('matcher should be \"lookup\" or \"best fit\"');\n }\n }\n // 2. If matcher is undefined or \"best fit\", then\n if (matcher === undefined || matcher === 'best fit')\n // a. Let subset be the result of calling the BestFitSupportedLocales\n // abstract operation (defined in 9.2.7) with arguments\n // availableLocales and requestedLocales.\n subset = BestFitSupportedLocales(availableLocales, requestedLocales);\n // 3. Else\n else\n // a. Let subset be the result of calling the LookupSupportedLocales\n // abstract operation (defined in 9.2.6) with arguments\n // availableLocales and requestedLocales.\n subset = LookupSupportedLocales(availableLocales, requestedLocales);\n\n // 4. For each named own property name P of subset,\n for (var P in subset) {\n if (!hop.call(subset, P)) continue;\n\n // a. Let desc be the result of calling the [[GetOwnProperty]] internal\n // method of subset with P.\n // b. Set desc.[[Writable]] to false.\n // c. Set desc.[[Configurable]] to false.\n // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,\n // and true as arguments.\n defineProperty(subset, P, {\n writable: false, configurable: false, value: subset[P]\n });\n }\n // \"Freeze\" the array so no new elements can be added\n defineProperty(subset, 'length', { writable: false });\n\n // 5. Return subset\n return subset;\n}\n\n/**\n * The GetOption abstract operation extracts the value of the property named\n * property from the provided options object, converts it to the required type,\n * checks whether it is one of a List of allowed values, and fills in a fallback\n * value if necessary.\n */\nfunction /*9.2.9 */GetOption(options, property, type, values, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Assert: type is \"boolean\" or \"string\".\n // b. If type is \"boolean\", then let value be ToBoolean(value).\n // c. If type is \"string\", then let value be ToString(value).\n value = type === 'boolean' ? Boolean(value) : type === 'string' ? String(value) : value;\n\n // d. If values is not undefined, then\n if (values !== undefined) {\n // i. If values does not contain an element equal to value, then throw a\n // RangeError exception.\n if (arrIndexOf.call(values, value) === -1) throw new RangeError(\"'\" + value + \"' is not an allowed value for `\" + property + '`');\n }\n\n // e. Return value.\n return value;\n }\n // Else return fallback.\n return fallback;\n}\n\n/**\n * The GetNumberOption abstract operation extracts a property value from the\n * provided options object, converts it to a Number value, checks whether it is\n * in the allowed range, and fills in a fallback value if necessary.\n */\nfunction /* 9.2.10 */GetNumberOption(options, property, minimum, maximum, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Let value be ToNumber(value).\n value = Number(value);\n\n // b. If value is NaN or less than minimum or greater than maximum, throw a\n // RangeError exception.\n if (isNaN(value) || value < minimum || value > maximum) throw new RangeError('Value is not a number or outside accepted range');\n\n // c. Return floor(value).\n return Math.floor(value);\n }\n // 3. Else return fallback.\n return fallback;\n}\n\n// 8 The Intl Object\nvar Intl = {};\n\n// 8.2 Function Properties of the Intl Object\n\n// 8.2.1\n// @spec[tc39/ecma402/master/spec/intl.html]\n// @clause[sec-intl.getcanonicallocales]\nfunction getCanonicalLocales(locales) {\n // 1. Let ll be ? CanonicalizeLocaleList(locales).\n var ll = CanonicalizeLocaleList(locales);\n // 2. Return CreateArrayFromList(ll).\n {\n var result = [];\n\n var len = ll.length;\n var k = 0;\n\n while (k < len) {\n result[k] = ll[k];\n k++;\n }\n return result;\n }\n}\n\nObject.defineProperty(Intl, 'getCanonicalLocales', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: getCanonicalLocales\n});\n\n// Currency minor units output from get-4217 grunt task, formatted\nvar currencyMinorUnits = {\n BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,\n XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,\n OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0\n};\n\n// Define the NumberFormat constructor internally so it cannot be tainted\nfunction NumberFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.NumberFormat(locales, options);\n }\n\n return InitializeNumberFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'NumberFormat', {\n configurable: true,\n writable: true,\n value: NumberFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(Intl.NumberFormat, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeNumberFormat accepts the arguments\n * numberFormat (which must be an object), locales, and options. It initializes\n * numberFormat as a NumberFormat object.\n */\nfunction /*11.1.1.1 */InitializeNumberFormat(numberFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(numberFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If numberFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(numberFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. If options is undefined, then\n if (options === undefined)\n // a. Let options be the result of creating a new object as if by the\n // expression new Object() where Object is the standard built-in constructor\n // with that name.\n options = {};\n\n // 5. Else\n else\n // a. Let options be ToObject(options).\n options = toObject(options);\n\n // 6. Let opt be a new Record.\n var opt = new Record(),\n\n\n // 7. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with the arguments options, \"localeMatcher\", \"string\",\n // a List containing the two String values \"lookup\" and \"best fit\", and\n // \"best fit\".\n matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 8. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 9. Let NumberFormat be the standard built-in object that is the initial value\n // of Intl.NumberFormat.\n // 10. Let localeData be the value of the [[localeData]] internal property of\n // NumberFormat.\n var localeData = internals.NumberFormat['[[localeData]]'];\n\n // 11. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of NumberFormat, and localeData.\n var r = ResolveLocale(internals.NumberFormat['[[availableLocales]]'], requestedLocales, opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 12. Set the [[locale]] internal property of numberFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 13. Set the [[numberingSystem]] internal property of numberFormat to the value\n // of r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let s be the result of calling the GetOption abstract operation with the\n // arguments options, \"style\", \"string\", a List containing the three String\n // values \"decimal\", \"percent\", and \"currency\", and \"decimal\".\n var s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');\n\n // 16. Set the [[style]] internal property of numberFormat to s.\n internal['[[style]]'] = s;\n\n // 17. Let c be the result of calling the GetOption abstract operation with the\n // arguments options, \"currency\", \"string\", undefined, and undefined.\n var c = GetOption(options, 'currency', 'string');\n\n // 18. If c is not undefined and the result of calling the\n // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with\n // argument c is false, then throw a RangeError exception.\n if (c !== undefined && !IsWellFormedCurrencyCode(c)) throw new RangeError(\"'\" + c + \"' is not a valid currency code\");\n\n // 19. If s is \"currency\" and c is undefined, throw a TypeError exception.\n if (s === 'currency' && c === undefined) throw new TypeError('Currency code is required when style is currency');\n\n var cDigits = void 0;\n\n // 20. If s is \"currency\", then\n if (s === 'currency') {\n // a. Let c be the result of converting c to upper case as specified in 6.1.\n c = c.toUpperCase();\n\n // b. Set the [[currency]] internal property of numberFormat to c.\n internal['[[currency]]'] = c;\n\n // c. Let cDigits be the result of calling the CurrencyDigits abstract\n // operation (defined below) with argument c.\n cDigits = CurrencyDigits(c);\n }\n\n // 21. Let cd be the result of calling the GetOption abstract operation with the\n // arguments options, \"currencyDisplay\", \"string\", a List containing the\n // three String values \"code\", \"symbol\", and \"name\", and \"symbol\".\n var cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');\n\n // 22. If s is \"currency\", then set the [[currencyDisplay]] internal property of\n // numberFormat to cd.\n if (s === 'currency') internal['[[currencyDisplay]]'] = cd;\n\n // 23. Let mnid be the result of calling the GetNumberOption abstract operation\n // (defined in 9.2.10) with arguments options, \"minimumIntegerDigits\", 1, 21,\n // and 1.\n var mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);\n\n // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.\n internal['[[minimumIntegerDigits]]'] = mnid;\n\n // 25. If s is \"currency\", then let mnfdDefault be cDigits; else let mnfdDefault\n // be 0.\n var mnfdDefault = s === 'currency' ? cDigits : 0;\n\n // 26. Let mnfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"minimumFractionDigits\", 0, 20, and mnfdDefault.\n var mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);\n\n // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.\n internal['[[minimumFractionDigits]]'] = mnfd;\n\n // 28. If s is \"currency\", then let mxfdDefault be max(mnfd, cDigits); else if s\n // is \"percent\", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault\n // be max(mnfd, 3).\n var mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits) : s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3);\n\n // 29. Let mxfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"maximumFractionDigits\", mnfd, 20, and mxfdDefault.\n var mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);\n\n // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.\n internal['[[maximumFractionDigits]]'] = mxfd;\n\n // 31. Let mnsd be the result of calling the [[Get]] internal method of options\n // with argument \"minimumSignificantDigits\".\n var mnsd = options.minimumSignificantDigits;\n\n // 32. Let mxsd be the result of calling the [[Get]] internal method of options\n // with argument \"maximumSignificantDigits\".\n var mxsd = options.maximumSignificantDigits;\n\n // 33. If mnsd is not undefined or mxsd is not undefined, then:\n if (mnsd !== undefined || mxsd !== undefined) {\n // a. Let mnsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"minimumSignificantDigits\", 1, 21,\n // and 1.\n mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);\n\n // b. Let mxsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"maximumSignificantDigits\", mnsd,\n // 21, and 21.\n mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);\n\n // c. Set the [[minimumSignificantDigits]] internal property of numberFormat\n // to mnsd, and the [[maximumSignificantDigits]] internal property of\n // numberFormat to mxsd.\n internal['[[minimumSignificantDigits]]'] = mnsd;\n internal['[[maximumSignificantDigits]]'] = mxsd;\n }\n // 34. Let g be the result of calling the GetOption abstract operation with the\n // arguments options, \"useGrouping\", \"boolean\", undefined, and true.\n var g = GetOption(options, 'useGrouping', 'boolean', undefined, true);\n\n // 35. Set the [[useGrouping]] internal property of numberFormat to g.\n internal['[[useGrouping]]'] = g;\n\n // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 37. Let patterns be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"patterns\".\n var patterns = dataLocaleData.patterns;\n\n // 38. Assert: patterns is an object (see 11.2.3)\n\n // 39. Let stylePatterns be the result of calling the [[Get]] internal method of\n // patterns with argument s.\n var stylePatterns = patterns[s];\n\n // 40. Set the [[positivePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"positivePattern\".\n internal['[[positivePattern]]'] = stylePatterns.positivePattern;\n\n // 41. Set the [[negativePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"negativePattern\".\n internal['[[negativePattern]]'] = stylePatterns.negativePattern;\n\n // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to\n // true.\n internal['[[initializedNumberFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) numberFormat.format = GetFormatNumber.call(numberFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return numberFormat;\n}\n\nfunction CurrencyDigits(currency) {\n // When the CurrencyDigits abstract operation is called with an argument currency\n // (which must be an upper case String value), the following steps are taken:\n\n // 1. If the ISO 4217 currency and funds code list contains currency as an\n // alphabetic code, then return the minor unit value corresponding to the\n // currency from the list; else return 2.\n return currencyMinorUnits[currency] !== undefined ? currencyMinorUnits[currency] : 2;\n}\n\n/* 11.2.3 */internals.NumberFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.NumberFormat is called, the\n * following steps are taken:\n */\n/* 11.2.2 */\ndefineProperty(Intl.NumberFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * NumberFormat object.\n */\n/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatNumber\n});\n\nfunction GetFormatNumber() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this NumberFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 1, that takes the argument value and\n // performs the following steps:\n var F = function F(value) {\n // i. If value is not provided, then let value be undefined.\n // ii. Let x be ToNumber(value).\n // iii. Return the result of calling the FormatNumber abstract\n // operation (defined below) with arguments this and x.\n return FormatNumber(this, /* x = */Number(value));\n };\n\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts() {\n var value = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');\n\n var x = Number(value);\n return FormatNumberToParts(this, x);\n}\n\nObject.defineProperty(Intl.NumberFormat.prototype, 'formatToParts', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: formatToParts\n});\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumbertoparts]\n */\nfunction FormatNumberToParts(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be ArrayCreate(0).\n var result = [];\n // 3. Let n be 0.\n var n = 0;\n // 4. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Let O be ObjectCreate(%ObjectPrototype%).\n var O = {};\n // a. Perform ? CreateDataPropertyOrThrow(O, \"type\", part.[[type]]).\n O.type = part['[[type]]'];\n // a. Perform ? CreateDataPropertyOrThrow(O, \"value\", part.[[value]]).\n O.value = part['[[value]]'];\n // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).\n result[n] = O;\n // a. Increment n by 1.\n n += 1;\n }\n // 5. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-partitionnumberpattern]\n */\nfunction PartitionNumberPattern(numberFormat, x) {\n\n var internal = getInternalProperties(numberFormat),\n locale = internal['[[dataLocale]]'],\n nums = internal['[[numberingSystem]]'],\n data = internals.NumberFormat['[[localeData]]'][locale],\n ild = data.symbols[nums] || data.symbols.latn,\n pattern = void 0;\n\n // 1. If x is not NaN and x < 0, then:\n if (!isNaN(x) && x < 0) {\n // a. Let x be -x.\n x = -x;\n // a. Let pattern be the value of numberFormat.[[negativePattern]].\n pattern = internal['[[negativePattern]]'];\n }\n // 2. Else,\n else {\n // a. Let pattern be the value of numberFormat.[[positivePattern]].\n pattern = internal['[[positivePattern]]'];\n }\n // 3. Let result be a new empty List.\n var result = new List();\n // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, \"{\", 0).\n var beginIndex = pattern.indexOf('{', 0);\n // 5. Let endIndex be 0.\n var endIndex = 0;\n // 6. Let nextIndex be 0.\n var nextIndex = 0;\n // 7. Let length be the number of code units in pattern.\n var length = pattern.length;\n // 8. Repeat while beginIndex is an integer index into pattern:\n while (beginIndex > -1 && beginIndex < length) {\n // a. Set endIndex to Call(%StringProto_indexOf%, pattern, \"}\", beginIndex)\n endIndex = pattern.indexOf('}', beginIndex);\n // a. If endIndex = -1, throw new Error exception.\n if (endIndex === -1) throw new Error();\n // a. If beginIndex is greater than nextIndex, then:\n if (beginIndex > nextIndex) {\n // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.\n var literal = pattern.substring(nextIndex, beginIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // a. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // a. If p is equal \"number\", then:\n if (p === \"number\") {\n // i. If x is NaN,\n if (isNaN(x)) {\n // 1. Let n be an ILD String value indicating the NaN value.\n var n = ild.nan;\n // 2. Add new part record { [[type]]: \"nan\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });\n }\n // ii. Else if isFinite(x) is false,\n else if (!isFinite(x)) {\n // 1. Let n be an ILD String value indicating infinity.\n var _n = ild.infinity;\n // 2. Add new part record { [[type]]: \"infinity\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': _n });\n }\n // iii. Else,\n else {\n // 1. If the value of numberFormat.[[style]] is \"percent\" and isFinite(x), let x be 100 × x.\n if (internal['[[style]]'] === 'percent' && isFinite(x)) x *= 100;\n\n var _n2 = void 0;\n // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then\n if (hop.call(internal, '[[minimumSignificantDigits]]') && hop.call(internal, '[[maximumSignificantDigits]]')) {\n // a. Let n be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).\n _n2 = ToRawPrecision(x, internal['[[minimumSignificantDigits]]'], internal['[[maximumSignificantDigits]]']);\n }\n // 3. Else,\n else {\n // a. Let n be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).\n _n2 = ToRawFixed(x, internal['[[minimumIntegerDigits]]'], internal['[[minimumFractionDigits]]'], internal['[[maximumFractionDigits]]']);\n }\n // 4. If the value of the numberFormat.[[numberingSystem]] matches one of the values in the \"Numbering System\" column of Table 2 below, then\n if (numSys[nums]) {\n (function () {\n // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the \"Digits\" column of the matching row in Table 2.\n var digits = numSys[nums];\n // a. Replace each digit in n with the value of digits[digit].\n _n2 = String(_n2).replace(/\\d/g, function (digit) {\n return digits[digit];\n });\n })();\n }\n // 5. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.\n else _n2 = String(_n2); // ###TODO###\n\n var integer = void 0;\n var fraction = void 0;\n // 6. Let decimalSepIndex be Call(%StringProto_indexOf%, n, \".\", 0).\n var decimalSepIndex = _n2.indexOf('.', 0);\n // 7. If decimalSepIndex > 0, then:\n if (decimalSepIndex > 0) {\n // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.\n integer = _n2.substring(0, decimalSepIndex);\n // a. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.\n fraction = _n2.substring(decimalSepIndex + 1, decimalSepIndex.length);\n }\n // 8. Else:\n else {\n // a. Let integer be n.\n integer = _n2;\n // a. Let fraction be undefined.\n fraction = undefined;\n }\n // 9. If the value of the numberFormat.[[useGrouping]] is true,\n if (internal['[[useGrouping]]'] === true) {\n // a. Let groupSepSymbol be the ILND String representing the grouping separator.\n var groupSepSymbol = ild.group;\n // a. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.\n var groups = [];\n // ----> implementation:\n // Primary group represents the group closest to the decimal\n var pgSize = data.patterns.primaryGroupSize || 3;\n // Secondary group is every other group\n var sgSize = data.patterns.secondaryGroupSize || pgSize;\n // Group only if necessary\n if (integer.length > pgSize) {\n // Index of the primary grouping separator\n var end = integer.length - pgSize;\n // Starting index for our loop\n var idx = end % sgSize;\n var start = integer.slice(0, idx);\n if (start.length) arrPush.call(groups, start);\n // Loop to separate into secondary grouping digits\n while (idx < end) {\n arrPush.call(groups, integer.slice(idx, idx + sgSize));\n idx += sgSize;\n }\n // Add the primary grouping digits\n arrPush.call(groups, integer.slice(end));\n } else {\n arrPush.call(groups, integer);\n }\n // a. Assert: The number of elements in groups List is greater than 0.\n if (groups.length === 0) throw new Error();\n // a. Repeat, while groups List is not empty:\n while (groups.length) {\n // i. Remove the first element from groups and let integerGroup be the value of that element.\n var integerGroup = arrShift.call(groups);\n // ii. Add new part record { [[type]]: \"integer\", [[value]]: integerGroup } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });\n // iii. If groups List is not empty, then:\n if (groups.length) {\n // 1. Add new part record { [[type]]: \"group\", [[value]]: groupSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });\n }\n }\n }\n // 10. Else,\n else {\n // a. Add new part record { [[type]]: \"integer\", [[value]]: integer } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });\n }\n // 11. If fraction is not undefined, then:\n if (fraction !== undefined) {\n // a. Let decimalSepSymbol be the ILND String representing the decimal separator.\n var decimalSepSymbol = ild.decimal;\n // a. Add new part record { [[type]]: \"decimal\", [[value]]: decimalSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });\n // a. Add new part record { [[type]]: \"fraction\", [[value]]: fraction } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });\n }\n }\n }\n // a. Else if p is equal \"plusSign\", then:\n else if (p === \"plusSign\") {\n // i. Let plusSignSymbol be the ILND String representing the plus sign.\n var plusSignSymbol = ild.plusSign;\n // ii. Add new part record { [[type]]: \"plusSign\", [[value]]: plusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });\n }\n // a. Else if p is equal \"minusSign\", then:\n else if (p === \"minusSign\") {\n // i. Let minusSignSymbol be the ILND String representing the minus sign.\n var minusSignSymbol = ild.minusSign;\n // ii. Add new part record { [[type]]: \"minusSign\", [[value]]: minusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });\n }\n // a. Else if p is equal \"percentSign\" and numberFormat.[[style]] is \"percent\", then:\n else if (p === \"percentSign\" && internal['[[style]]'] === \"percent\") {\n // i. Let percentSignSymbol be the ILND String representing the percent sign.\n var percentSignSymbol = ild.percentSign;\n // ii. Add new part record { [[type]]: \"percentSign\", [[value]]: percentSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });\n }\n // a. Else if p is equal \"currency\" and numberFormat.[[style]] is \"currency\", then:\n else if (p === \"currency\" && internal['[[style]]'] === \"currency\") {\n // i. Let currency be the value of numberFormat.[[currency]].\n var currency = internal['[[currency]]'];\n\n var cd = void 0;\n\n // ii. If numberFormat.[[currencyDisplay]] is \"code\", then\n if (internal['[[currencyDisplay]]'] === \"code\") {\n // 1. Let cd be currency.\n cd = currency;\n }\n // iii. Else if numberFormat.[[currencyDisplay]] is \"symbol\", then\n else if (internal['[[currencyDisplay]]'] === \"symbol\") {\n // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.\n cd = data.currencies[currency] || currency;\n }\n // iv. Else if numberFormat.[[currencyDisplay]] is \"name\", then\n else if (internal['[[currencyDisplay]]'] === \"name\") {\n // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.\n cd = currency;\n }\n // v. Add new part record { [[type]]: \"currency\", [[value]]: cd } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });\n }\n // a. Else,\n else {\n // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.\n var _literal = pattern.substring(beginIndex, endIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal });\n }\n // a. Set nextIndex to endIndex + 1.\n nextIndex = endIndex + 1;\n // a. Set beginIndex to Call(%StringProto_indexOf%, pattern, \"{\", nextIndex)\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n // 9. If nextIndex is less than length, then:\n if (nextIndex < length) {\n // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.\n var _literal2 = pattern.substring(nextIndex, length);\n // a. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal2 });\n }\n // 10. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumber]\n */\nfunction FormatNumber(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be an empty String.\n var result = '';\n // 3. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Set result to a String value produced by concatenating result and part.[[value]].\n result += part['[[value]]'];\n }\n // 4. Return result.\n return result;\n}\n\n/**\n * When the ToRawPrecision abstract operation is called with arguments x (which\n * must be a finite non-negative number), minPrecision, and maxPrecision (both\n * must be integers between 1 and 21) the following steps are taken:\n */\nfunction ToRawPrecision(x, minPrecision, maxPrecision) {\n // 1. Let p be maxPrecision.\n var p = maxPrecision;\n\n var m = void 0,\n e = void 0;\n\n // 2. If x = 0, then\n if (x === 0) {\n // a. Let m be the String consisting of p occurrences of the character \"0\".\n m = arrJoin.call(Array(p + 1), '0');\n // b. Let e be 0.\n e = 0;\n }\n // 3. Else\n else {\n // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the\n // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as\n // possible. If there are two such sets of e and n, pick the e and n for\n // which n × 10ᵉ⁻ᵖ⁺¹ is larger.\n e = log10Floor(Math.abs(x));\n\n // Easier to get to m from here\n var f = Math.round(Math.exp(Math.abs(e - p + 1) * Math.LN10));\n\n // b. Let m be the String consisting of the digits of the decimal\n // representation of n (in order, with no leading zeroes)\n m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));\n }\n\n // 4. If e ≥ p, then\n if (e >= p)\n // a. Return the concatenation of m and e-p+1 occurrences of the character \"0\".\n return m + arrJoin.call(Array(e - p + 1 + 1), '0');\n\n // 5. If e = p-1, then\n else if (e === p - 1)\n // a. Return m.\n return m;\n\n // 6. If e ≥ 0, then\n else if (e >= 0)\n // a. Let m be the concatenation of the first e+1 characters of m, the character\n // \".\", and the remaining p–(e+1) characters of m.\n m = m.slice(0, e + 1) + '.' + m.slice(e + 1);\n\n // 7. If e < 0, then\n else if (e < 0)\n // a. Let m be the concatenation of the String \"0.\", –(e+1) occurrences of the\n // character \"0\", and the string m.\n m = '0.' + arrJoin.call(Array(-(e + 1) + 1), '0') + m;\n\n // 8. If m contains the character \".\", and maxPrecision > minPrecision, then\n if (m.indexOf(\".\") >= 0 && maxPrecision > minPrecision) {\n // a. Let cut be maxPrecision – minPrecision.\n var cut = maxPrecision - minPrecision;\n\n // b. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.charAt(m.length - 1) === '0') {\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n\n // ii. Decrease cut by 1.\n cut--;\n }\n\n // c. If the last character of m is \".\", then\n if (m.charAt(m.length - 1) === '.')\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. Return m.\n return m;\n}\n\n/**\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-torawfixed]\n * When the ToRawFixed abstract operation is called with arguments x (which must\n * be a finite non-negative number), minInteger (which must be an integer between\n * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and\n * 20) the following steps are taken:\n */\nfunction ToRawFixed(x, minInteger, minFraction, maxFraction) {\n // 1. Let f be maxFraction.\n var f = maxFraction;\n // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.\n var n = Math.pow(10, f) * x; // diverging...\n // 3. If n = 0, let m be the String \"0\". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).\n var m = n === 0 ? \"0\" : n.toFixed(0); // divering...\n\n {\n // this diversion is needed to take into consideration big numbers, e.g.:\n // 1.2344501e+37 -> 12344501000000000000000000000000000000\n var idx = void 0;\n var exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;\n if (exp) {\n m = m.slice(0, idx).replace('.', '');\n m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');\n }\n }\n\n var int = void 0;\n // 4. If f ≠ 0, then\n if (f !== 0) {\n // a. Let k be the number of characters in m.\n var k = m.length;\n // a. If k ≤ f, then\n if (k <= f) {\n // i. Let z be the String consisting of f+1–k occurrences of the character \"0\".\n var z = arrJoin.call(Array(f + 1 - k + 1), '0');\n // ii. Let m be the concatenation of Strings z and m.\n m = z + m;\n // iii. Let k be f+1.\n k = f + 1;\n }\n // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.\n var a = m.substring(0, k - f),\n b = m.substring(k - f, m.length);\n // a. Let m be the concatenation of the three Strings a, \".\", and b.\n m = a + \".\" + b;\n // a. Let int be the number of characters in a.\n int = a.length;\n }\n // 5. Else, let int be the number of characters in m.\n else int = m.length;\n // 6. Let cut be maxFraction – minFraction.\n var cut = maxFraction - minFraction;\n // 7. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.slice(-1) === \"0\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n // a. Decrease cut by 1.\n cut--;\n }\n // 8. If the last character of m is \".\", then\n if (m.slice(-1) === \".\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. If int < minInteger, then\n if (int < minInteger) {\n // a. Let z be the String consisting of minInteger–int occurrences of the character \"0\".\n var _z = arrJoin.call(Array(minInteger - int + 1), '0');\n // a. Let m be the concatenation of Strings z and m.\n m = _z + m;\n }\n // 10. Return m.\n return m;\n}\n\n// Sect 11.3.2 Table 2, Numbering systems\n// ======================================\nvar numSys = {\n arab: [\"٠\", \"١\", \"٢\", \"٣\", \"٤\", \"٥\", \"٦\", \"٧\", \"٨\", \"٩\"],\n arabext: [\"۰\", \"۱\", \"۲\", \"۳\", \"۴\", \"۵\", \"۶\", \"۷\", \"۸\", \"۹\"],\n bali: [\"᭐\", \"᭑\", \"᭒\", \"᭓\", \"᭔\", \"᭕\", \"᭖\", \"᭗\", \"᭘\", \"᭙\"],\n beng: [\"০\", \"১\", \"২\", \"৩\", \"৪\", \"৫\", \"৬\", \"৭\", \"৮\", \"৯\"],\n deva: [\"०\", \"१\", \"२\", \"३\", \"४\", \"५\", \"६\", \"७\", \"८\", \"९\"],\n fullwide: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n gujr: [\"૦\", \"૧\", \"૨\", \"૩\", \"૪\", \"૫\", \"૬\", \"૭\", \"૮\", \"૯\"],\n guru: [\"੦\", \"੧\", \"੨\", \"੩\", \"੪\", \"੫\", \"੬\", \"੭\", \"੮\", \"੯\"],\n hanidec: [\"〇\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\", \"七\", \"八\", \"九\"],\n khmr: [\"០\", \"១\", \"២\", \"៣\", \"៤\", \"៥\", \"៦\", \"៧\", \"៨\", \"៩\"],\n knda: [\"೦\", \"೧\", \"೨\", \"೩\", \"೪\", \"೫\", \"೬\", \"೭\", \"೮\", \"೯\"],\n laoo: [\"໐\", \"໑\", \"໒\", \"໓\", \"໔\", \"໕\", \"໖\", \"໗\", \"໘\", \"໙\"],\n latn: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n limb: [\"᥆\", \"᥇\", \"᥈\", \"᥉\", \"᥊\", \"᥋\", \"᥌\", \"᥍\", \"᥎\", \"᥏\"],\n mlym: [\"൦\", \"൧\", \"൨\", \"൩\", \"൪\", \"൫\", \"൬\", \"൭\", \"൮\", \"൯\"],\n mong: [\"᠐\", \"᠑\", \"᠒\", \"᠓\", \"᠔\", \"᠕\", \"᠖\", \"᠗\", \"᠘\", \"᠙\"],\n mymr: [\"၀\", \"၁\", \"၂\", \"၃\", \"၄\", \"၅\", \"၆\", \"၇\", \"၈\", \"၉\"],\n orya: [\"୦\", \"୧\", \"୨\", \"୩\", \"୪\", \"୫\", \"୬\", \"୭\", \"୮\", \"୯\"],\n tamldec: [\"௦\", \"௧\", \"௨\", \"௩\", \"௪\", \"௫\", \"௬\", \"௭\", \"௮\", \"௯\"],\n telu: [\"౦\", \"౧\", \"౨\", \"౩\", \"౪\", \"౫\", \"౬\", \"౭\", \"౮\", \"౯\"],\n thai: [\"๐\", \"๑\", \"๒\", \"๓\", \"๔\", \"๕\", \"๖\", \"๗\", \"๘\", \"๙\"],\n tibt: [\"༠\", \"༡\", \"༢\", \"༣\", \"༤\", \"༥\", \"༦\", \"༧\", \"༨\", \"༩\"]\n};\n\n/**\n * This function provides access to the locale and formatting options computed\n * during initialization of the object.\n *\n * The function returns a new object whose properties and attributes are set as\n * if constructed by an object literal assigning to each of the following\n * properties the value of the corresponding internal property of this\n * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,\n * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,\n * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and\n * useGrouping. Properties whose corresponding internal properties are not present\n * are not assigned.\n */\n/* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {\n configurable: true,\n writable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\n/* jslint esnext: true */\n\n// Match these datetime components in a CLDR pattern, except those in single quotes\nvar expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nvar expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n// Skip over patterns with these datetime components because we don't have data\n// to back them up:\n// timezone, weekday, amoung others\nvar unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string\n\nvar dtKeys = [\"era\", \"year\", \"month\", \"day\", \"weekday\", \"quarter\"];\nvar tmKeys = [\"hour\", \"minute\", \"second\", \"hour12\", \"timeZoneName\"];\n\nfunction isDateFormatOnly(obj) {\n for (var i = 0; i < tmKeys.length; i += 1) {\n if (obj.hasOwnProperty(tmKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isTimeFormatOnly(obj) {\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (obj.hasOwnProperty(dtKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {\n var o = { _: {} };\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (dateFormatObj[dtKeys[i]]) {\n o[dtKeys[i]] = dateFormatObj[dtKeys[i]];\n }\n if (dateFormatObj._[dtKeys[i]]) {\n o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];\n }\n }\n for (var j = 0; j < tmKeys.length; j += 1) {\n if (timeFormatObj[tmKeys[j]]) {\n o[tmKeys[j]] = timeFormatObj[tmKeys[j]];\n }\n if (timeFormatObj._[tmKeys[j]]) {\n o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];\n }\n }\n return o;\n}\n\nfunction computeFinalPatterns(formatObj) {\n // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:\n // 'In patterns, two single quotes represents a literal single quote, either\n // inside or outside single quotes. Text within single quotes is not\n // interpreted in any way (except for two adjacent single quotes).'\n formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, function ($0, literal) {\n return literal ? literal : \"'\";\n });\n\n // pattern 12 is always the default. we can produce the 24 by removing {ampm}\n formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');\n return formatObj;\n}\n\nfunction expDTComponentsMeta($0, formatObj) {\n switch ($0.charAt(0)) {\n // --- Era\n case 'G':\n formatObj.era = ['short', 'short', 'short', 'long', 'narrow'][$0.length - 1];\n return '{era}';\n\n // --- Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';\n return '{year}';\n\n // --- Quarter (not supported in this polyfill)\n case 'Q':\n case 'q':\n formatObj.quarter = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{quarter}';\n\n // --- Month\n case 'M':\n case 'L':\n formatObj.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{month}';\n\n // --- Week (not supported in this polyfill)\n case 'w':\n // week of the year\n formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';\n return '{weekday}';\n case 'W':\n // week of the month\n formatObj.week = 'numeric';\n return '{weekday}';\n\n // --- Day\n case 'd':\n // day of the month\n formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';\n return '{day}';\n case 'D': // day of the year\n case 'F': // day of the week\n case 'g':\n // 1..n: Modified Julian day\n formatObj.day = 'numeric';\n return '{day}';\n\n // --- Week Day\n case 'E':\n // day of the week\n formatObj.weekday = ['short', 'short', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'e':\n // local day of the week\n formatObj.weekday = ['numeric', '2-digit', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'c':\n // stand alone local day of the week\n formatObj.weekday = ['numeric', undefined, 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n\n // --- Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B':\n // flexible day periods\n formatObj.hour12 = true;\n return '{ampm}';\n\n // --- Hour\n case 'h':\n case 'H':\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n case 'k':\n case 'K':\n formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n\n // --- Minute\n case 'm':\n formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';\n return '{minute}';\n\n // --- Second\n case 's':\n formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';\n return '{second}';\n case 'S':\n case 'A':\n formatObj.second = 'numeric';\n return '{second}';\n\n // --- Timezone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x':\n // 1, 2, 3, 4: The ISO8601 varios formats\n // this polyfill only supports much, for now, we are just doing something dummy\n formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n}\n\n/**\n * Converts the CLDR availableFormats into the objects and patterns required by\n * the ECMAScript Internationalization API specification.\n */\nfunction createDateTimeFormat(skeleton, pattern) {\n // we ignore certain patterns that are unsupported to avoid this expensive op.\n if (unwantedDTCs.test(pattern)) return undefined;\n\n var formatObj = {\n originalPattern: pattern,\n _: {}\n };\n\n // Replace the pattern string with the one required by the specification, whilst\n // at the same time evaluating it for the subsets and formats\n formatObj.extendedPattern = pattern.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj._);\n });\n\n // Match the skeleton string with the one required by the specification\n // this implementation is based on the Date Field Symbol Table:\n // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n // Note: we are adding extra data to the formatObject even though this polyfill\n // might not support it.\n skeleton.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj);\n });\n\n return computeFinalPatterns(formatObj);\n}\n\n/**\n * Processes DateTime formats from CLDR to an easier-to-parse format.\n * the result of this operation should be cached the first time a particular\n * calendar is analyzed.\n *\n * The specification requires we support at least the following subsets of\n * date/time components:\n *\n * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'\n * - 'weekday', 'year', 'month', 'day'\n * - 'year', 'month', 'day'\n * - 'year', 'month'\n * - 'month', 'day'\n * - 'hour', 'minute', 'second'\n * - 'hour', 'minute'\n *\n * We need to cherry pick at least these subsets from the CLDR data and convert\n * them into the pattern objects used in the ECMA-402 API.\n */\nfunction createDateTimeFormats(formats) {\n var availableFormats = formats.availableFormats;\n var timeFormats = formats.timeFormats;\n var dateFormats = formats.dateFormats;\n var result = [];\n var skeleton = void 0,\n pattern = void 0,\n computed = void 0,\n i = void 0,\n j = void 0;\n var timeRelatedFormats = [];\n var dateRelatedFormats = [];\n\n // Map available (custom) formats into a pattern for createDateTimeFormats\n for (skeleton in availableFormats) {\n if (availableFormats.hasOwnProperty(skeleton)) {\n pattern = availableFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n // in some cases, the format is only displaying date specific props\n // or time specific props, in which case we need to also produce the\n // combined formats.\n if (isDateFormatOnly(computed)) {\n dateRelatedFormats.push(computed);\n } else if (isTimeFormatOnly(computed)) {\n timeRelatedFormats.push(computed);\n }\n }\n }\n }\n\n // Map time formats into a pattern for createDateTimeFormats\n for (skeleton in timeFormats) {\n if (timeFormats.hasOwnProperty(skeleton)) {\n pattern = timeFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n timeRelatedFormats.push(computed);\n }\n }\n }\n\n // Map date formats into a pattern for createDateTimeFormats\n for (skeleton in dateFormats) {\n if (dateFormats.hasOwnProperty(skeleton)) {\n pattern = dateFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n dateRelatedFormats.push(computed);\n }\n }\n }\n\n // combine custom time and custom date formats when they are orthogonals to complete the\n // formats supported by CLDR.\n // This Algo is based on section \"Missing Skeleton Fields\" from:\n // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems\n for (i = 0; i < timeRelatedFormats.length; i += 1) {\n for (j = 0; j < dateRelatedFormats.length; j += 1) {\n if (dateRelatedFormats[j].month === 'long') {\n pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;\n } else if (dateRelatedFormats[j].month === 'short') {\n pattern = formats.medium;\n } else {\n pattern = formats.short;\n }\n computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);\n computed.originalPattern = pattern;\n computed.extendedPattern = pattern.replace('{0}', timeRelatedFormats[i].extendedPattern).replace('{1}', dateRelatedFormats[j].extendedPattern).replace(/^[,\\s]+|[,\\s]+$/gi, '');\n result.push(computeFinalPatterns(computed));\n }\n }\n\n return result;\n}\n\n// this represents the exceptions of the rule that are not covered by CLDR availableFormats\n// for single property configurations, they play no role when using multiple properties, and\n// those that are not in this table, are not exceptions or are not covered by the data we\n// provide.\nvar validSyntheticProps = {\n second: {\n numeric: 's',\n '2-digit': 'ss'\n },\n minute: {\n numeric: 'm',\n '2-digit': 'mm'\n },\n year: {\n numeric: 'y',\n '2-digit': 'yy'\n },\n day: {\n numeric: 'd',\n '2-digit': 'dd'\n },\n month: {\n numeric: 'L',\n '2-digit': 'LL',\n narrow: 'LLLLL',\n short: 'LLL',\n long: 'LLLL'\n },\n weekday: {\n narrow: 'ccccc',\n short: 'ccc',\n long: 'cccc'\n }\n};\n\nfunction generateSyntheticFormat(propName, propValue) {\n if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) {\n var _ref2;\n\n return _ref2 = {\n originalPattern: validSyntheticProps[propName][propValue],\n _: defineProperty$1({}, propName, propValue),\n extendedPattern: \"{\" + propName + \"}\"\n }, defineProperty$1(_ref2, propName, propValue), defineProperty$1(_ref2, \"pattern12\", \"{\" + propName + \"}\"), defineProperty$1(_ref2, \"pattern\", \"{\" + propName + \"}\"), _ref2;\n }\n}\n\n// An object map of date component keys, saves using a regex later\nvar dateWidths = objCreate(null, { narrow: {}, short: {}, long: {} });\n\n/**\n * Returns a string for a date component, resolved using multiple inheritance as specified\n * as specified in the Unicode Technical Standard 35.\n */\nfunction resolveDateString(data, ca, component, width, key) {\n // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:\n // 'In clearly specified instances, resources may inherit from within the same locale.\n // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'\n var obj = data[ca] && data[ca][component] ? data[ca][component] : data.gregory[component],\n\n\n // \"sideways\" inheritance resolves strings when a key doesn't exist\n alts = {\n narrow: ['short', 'long'],\n short: ['long', 'narrow'],\n long: ['short', 'narrow']\n },\n\n\n //\n resolved = hop.call(obj, width) ? obj[width] : hop.call(obj, alts[width][0]) ? obj[alts[width][0]] : obj[alts[width][1]];\n\n // `key` wouldn't be specified for components 'dayPeriods'\n return key !== null ? resolved[key] : resolved;\n}\n\n// Define the DateTimeFormat constructor internally so it cannot be tainted\nfunction DateTimeFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.DateTimeFormat(locales, options);\n }\n return InitializeDateTimeFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'DateTimeFormat', {\n configurable: true,\n writable: true,\n value: DateTimeFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(DateTimeFormatConstructor, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat\n * (which must be an object), locales, and options. It initializes dateTimeFormat as a\n * DateTimeFormat object.\n */\nfunction /* 12.1.1.1 */InitializeDateTimeFormat(dateTimeFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(dateTimeFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(dateTimeFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined below) with arguments options, \"any\", and \"date\".\n options = ToDateTimeOptions(options, 'any', 'date');\n\n // 5. Let opt be a new Record.\n var opt = new Record();\n\n // 6. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with arguments options, \"localeMatcher\", \"string\", a List\n // containing the two String values \"lookup\" and \"best fit\", and \"best fit\".\n var matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 7. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 8. Let DateTimeFormat be the standard built-in object that is the initial\n // value of Intl.DateTimeFormat.\n var DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need\n\n // 9. Let localeData be the value of the [[localeData]] internal property of\n // DateTimeFormat.\n var localeData = DateTimeFormat['[[localeData]]'];\n\n // 10. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of DateTimeFormat, and localeData.\n var r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales, opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 11. Set the [[locale]] internal property of dateTimeFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of\n // r.[[ca]].\n internal['[[calendar]]'] = r['[[ca]]'];\n\n // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of\n // r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let tz be the result of calling the [[Get]] internal method of options with\n // argument \"timeZone\".\n var tz = options.timeZone;\n\n // 16. If tz is not undefined, then\n if (tz !== undefined) {\n // a. Let tz be ToString(tz).\n // b. Convert tz to upper case as described in 6.1.\n // NOTE: If an implementation accepts additional time zone values, as permitted\n // under certain conditions by the Conformance clause, different casing\n // rules apply.\n tz = toLatinUpperCase(tz);\n\n // c. If tz is not \"UTC\", then throw a RangeError exception.\n // ###TODO: accept more time zones###\n if (tz !== 'UTC') throw new RangeError('timeZone is not supported.');\n }\n\n // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.\n internal['[[timeZone]]'] = tz;\n\n // 18. Let opt be a new Record.\n opt = new Record();\n\n // 19. For each row of Table 3, except the header row, do:\n for (var prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop)) continue;\n\n // 20. Let prop be the name given in the Property column of the row.\n // 21. Let value be the result of calling the GetOption abstract operation,\n // passing as argument options, the name given in the Property column of the\n // row, \"string\", a List containing the strings given in the Values column of\n // the row, and undefined.\n var value = GetOption(options, prop, 'string', dateTimeComponents[prop]);\n\n // 22. Set opt.[[]] to value.\n opt['[[' + prop + ']]'] = value;\n }\n\n // Assigned a value below\n var bestFormat = void 0;\n\n // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 24. Let formats be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"formats\".\n // Note: we process the CLDR formats into the spec'd structure\n var formats = ToDateTimeFormats(dataLocaleData.formats);\n\n // 25. Let matcher be the result of calling the GetOption abstract operation with\n // arguments options, \"formatMatcher\", \"string\", a List containing the two String\n // values \"basic\" and \"best fit\", and \"best fit\".\n matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');\n\n // Optimization: caching the processed formats as a one time operation by\n // replacing the initial structure from localeData\n dataLocaleData.formats = formats;\n\n // 26. If matcher is \"basic\", then\n if (matcher === 'basic') {\n // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract\n // operation (defined below) with opt and formats.\n bestFormat = BasicFormatMatcher(opt, formats);\n\n // 28. Else\n } else {\n {\n // diverging\n var _hr = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n opt.hour12 = _hr === undefined ? dataLocaleData.hour12 : _hr;\n }\n // 29. Let bestFormat be the result of calling the BestFitFormatMatcher\n // abstract operation (defined below) with opt and formats.\n bestFormat = BestFitFormatMatcher(opt, formats);\n }\n\n // 30. For each row in Table 3, except the header row, do\n for (var _prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _prop)) continue;\n\n // a. Let prop be the name given in the Property column of the row.\n // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of\n // bestFormat with argument prop.\n // c. If pDesc is not undefined, then\n if (hop.call(bestFormat, _prop)) {\n // i. Let p be the result of calling the [[Get]] internal method of bestFormat\n // with argument prop.\n var p = bestFormat[_prop];\n {\n // diverging\n p = bestFormat._ && hop.call(bestFormat._, _prop) ? bestFormat._[_prop] : p;\n }\n\n // ii. Set the [[]] internal property of dateTimeFormat to p.\n internal['[[' + _prop + ']]'] = p;\n }\n }\n\n var pattern = void 0; // Assigned a value below\n\n // 31. Let hr12 be the result of calling the GetOption abstract operation with\n // arguments options, \"hour12\", \"boolean\", undefined, and undefined.\n var hr12 = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n\n // 32. If dateTimeFormat has an internal property [[hour]], then\n if (internal['[[hour]]']) {\n // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]\n // internal method of dataLocaleData with argument \"hour12\".\n hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n\n // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.\n internal['[[hour12]]'] = hr12;\n\n // c. If hr12 is true, then\n if (hr12 === true) {\n // i. Let hourNo0 be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"hourNo0\".\n var hourNo0 = dataLocaleData.hourNo0;\n\n // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.\n internal['[[hourNo0]]'] = hourNo0;\n\n // iii. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern12\".\n pattern = bestFormat.pattern12;\n }\n\n // d. Else\n else\n // i. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n }\n\n // 33. Else\n else\n // a. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n\n // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.\n internal['[[pattern]]'] = pattern;\n\n // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to\n // true.\n internal['[[initializedDateTimeFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return dateTimeFormat;\n}\n\n/**\n * Several DateTimeFormat algorithms use values from the following table, which provides\n * property names and allowable values for the components of date and time formats:\n */\nvar dateTimeComponents = {\n weekday: [\"narrow\", \"short\", \"long\"],\n era: [\"narrow\", \"short\", \"long\"],\n year: [\"2-digit\", \"numeric\"],\n month: [\"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\"],\n day: [\"2-digit\", \"numeric\"],\n hour: [\"2-digit\", \"numeric\"],\n minute: [\"2-digit\", \"numeric\"],\n second: [\"2-digit\", \"numeric\"],\n timeZoneName: [\"short\", \"long\"]\n};\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeFormats(formats) {\n if (Object.prototype.toString.call(formats) === '[object Array]') {\n return formats;\n }\n return createDateTimeFormats(formats);\n}\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeOptions(options, required, defaults) {\n // 1. If options is undefined, then let options be null, else let options be\n // ToObject(options).\n if (options === undefined) options = null;else {\n // (#12) options needs to be a Record, but it also needs to inherit properties\n var opt2 = toObject(options);\n options = new Record();\n\n for (var k in opt2) {\n options[k] = opt2[k];\n }\n }\n\n // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.\n var create = objCreate;\n\n // 3. Let options be the result of calling the [[Call]] internal method of create with\n // undefined as the this value and an argument list containing the single item\n // options.\n options = create(options);\n\n // 4. Let needDefaults be true.\n var needDefaults = true;\n\n // 5. If required is \"date\" or \"any\", then\n if (required === 'date' || required === 'any') {\n // a. For each of the property names \"weekday\", \"year\", \"month\", \"day\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined) needDefaults = false;\n }\n\n // 6. If required is \"time\" or \"any\", then\n if (required === 'time' || required === 'any') {\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined) needDefaults = false;\n }\n\n // 7. If needDefaults is true and defaults is either \"date\" or \"all\", then\n if (needDefaults && (defaults === 'date' || defaults === 'all'))\n // a. For each of the property names \"year\", \"month\", \"day\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.year = options.month = options.day = 'numeric';\n\n // 8. If needDefaults is true and defaults is either \"time\" or \"all\", then\n if (needDefaults && (defaults === 'time' || defaults === 'all'))\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.hour = options.minute = options.second = 'numeric';\n\n // 9. Return options.\n return options;\n}\n\n/**\n * When the BasicFormatMatcher abstract operation is called with two arguments options and\n * formats, the following steps are taken:\n */\nfunction BasicFormatMatcher(options, formats) {\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta === 2) score -= longMorePenalty;\n\n // 6. Else if delta = 1, decrease score by shortMorePenalty.\n else if (delta === 1) score -= shortMorePenalty;\n\n // 7. Else if delta = -1, decrease score by shortLessPenalty.\n else if (delta === -1) score -= shortLessPenalty;\n\n // 8. Else if delta = -2, decrease score by longLessPenalty.\n else if (delta === -2) score -= longLessPenalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/**\n * When the BestFitFormatMatcher abstract operation is called with two arguments options\n * and formats, it performs implementation dependent steps, which should return a set of\n * component representations that a typical user of the selected locale would perceive as\n * at least as good as the one returned by BasicFormatMatcher.\n *\n * This polyfill defines the algorithm to be the same as BasicFormatMatcher,\n * with the addition of bonus points awarded where the requested format is of\n * the same data type as the potentially matching format.\n *\n * This algo relies on the concept of closest distance matching described here:\n * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n * Typically a “best match” is found using a closest distance match, such as:\n *\n * Symbols requesting a best choice for the locale are replaced.\n * j → one of {H, k, h, K}; C → one of {a, b, B}\n * -> Covered by cldr.js matching process\n *\n * For fields with symbols representing the same type (year, month, day, etc):\n * Most symbols have a small distance from each other.\n * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...\n * -> Covered by cldr.js matching process\n *\n * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.\n * MMM ≅ MMMM\n * MM ≅ M\n * Numeric and text fields are given a larger distance from each other.\n * MMM ≈ MM\n * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.\n * d ≋ D; ...\n * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).\n *\n *\n * For example,\n *\n * { month: 'numeric', day: 'numeric' }\n *\n * should match\n *\n * { month: '2-digit', day: '2-digit' }\n *\n * rather than\n *\n * { month: 'short', day: 'numeric' }\n *\n * This makes sense because a user requesting a formatted date with numeric parts would\n * not expect to see the returned format containing narrow, short or long part names\n */\nfunction BestFitFormatMatcher(options, formats) {\n /** Diverging: this block implements the hack for single property configuration, eg.:\n *\n * `new Intl.DateTimeFormat('en', {day: 'numeric'})`\n *\n * should produce a single digit with the day of the month. This is needed because\n * CLDR `availableFormats` data structure doesn't cover these cases.\n */\n {\n var optionsPropNames = [];\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n if (options['[[' + property + ']]'] !== undefined) {\n optionsPropNames.push(property);\n }\n }\n if (optionsPropNames.length === 1) {\n var _bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[[' + optionsPropNames[0] + ']]']);\n if (_bestFormat) {\n return _bestFormat;\n }\n }\n }\n\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n var patternPenalty = 2;\n\n var hour12Penalty = 1;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var _property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + _property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, _property) ? format[_property] : undefined;\n\n // Diverging: using the default properties produced by the pattern/skeleton\n // to match it with user options, and apply a penalty\n var patternProp = hop.call(format._, _property) ? format._[_property] : undefined;\n if (optionsProp !== patternProp) {\n score -= patternPenalty;\n }\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n {\n // diverging from spec\n // When the bestFit argument is true, subtract additional penalty where data types are not the same\n if (formatPropIndex <= 1 && optionsPropIndex >= 2 || formatPropIndex >= 2 && optionsPropIndex <= 1) {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 0) score -= longMorePenalty;else if (delta < 0) score -= longLessPenalty;\n } else {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 1) score -= shortMorePenalty;else if (delta < -1) score -= shortLessPenalty;\n }\n }\n }\n }\n\n {\n // diverging to also take into consideration differences between 12 or 24 hours\n // which is special for the best fit only.\n if (format._.hour12 !== options.hour12) {\n score -= hour12Penalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/* 12.2.3 */internals.DateTimeFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['ca', 'nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the\n * following steps are taken:\n */\n/* 12.2.2 */\ndefineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * DateTimeFormat object.\n */\n/* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatDateTime\n});\n\nfunction GetFormatDateTime() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this DateTimeFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 0, that takes the argument date and\n // performs the following steps:\n var F = function F() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n // i. If date is not provided or is undefined, then let x be the\n // result as if by the expression Date.now() where Date.now is\n // the standard built-in function defined in ES5, 15.9.4.4.\n // ii. Else let x be ToNumber(date).\n // iii. Return the result of calling the FormatDateTime abstract\n // operation (defined below) with arguments this and x.\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatDateTime(this, x);\n };\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts$1() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');\n\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatToPartsDateTime(this, x);\n}\n\nObject.defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: formatToParts$1\n});\n\nfunction CreateDateTimeParts(dateTimeFormat, x) {\n // 1. If x is not a finite Number, then throw a RangeError exception.\n if (!isFinite(x)) throw new RangeError('Invalid valid date passed to format');\n\n var internal = dateTimeFormat.__getInternalProperties(secret);\n\n // Creating restore point for properties on the RegExp object... please wait\n /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this\n\n // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.\n var locale = internal['[[locale]]'];\n\n // 3. Let nf be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {useGrouping: false}) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n var nf = new Intl.NumberFormat([locale], { useGrouping: false });\n\n // 4. Let nf2 be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:\n // false}) where Intl.NumberFormat is the standard built-in constructor defined in\n // 11.1.3.\n var nf2 = new Intl.NumberFormat([locale], { minimumIntegerDigits: 2, useGrouping: false });\n\n // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined\n // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,\n // and the value of the [[timeZone]] internal property of dateTimeFormat.\n var tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);\n\n // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.\n var pattern = internal['[[pattern]]'];\n\n // 7.\n var result = new List();\n\n // 8.\n var index = 0;\n\n // 9.\n var beginIndex = pattern.indexOf('{');\n\n // 10.\n var endIndex = 0;\n\n // Need the locale minus any extensions\n var dataLocale = internal['[[dataLocale]]'];\n\n // Need the calendar data from CLDR\n var localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;\n var ca = internal['[[calendar]]'];\n\n // 11.\n while (beginIndex !== -1) {\n var fv = void 0;\n // a.\n endIndex = pattern.indexOf('}', beginIndex);\n // b.\n if (endIndex === -1) {\n throw new Error('Unclosed pattern');\n }\n // c.\n if (beginIndex > index) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(index, beginIndex)\n });\n }\n // d.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // e.\n if (dateTimeComponents.hasOwnProperty(p)) {\n // i. Let f be the value of the [[

    ]] internal property of dateTimeFormat.\n var f = internal['[[' + p + ']]'];\n // ii. Let v be the value of tm.[[

    ]].\n var v = tm['[[' + p + ']]'];\n // iii. If p is \"year\" and v ≤ 0, then let v be 1 - v.\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n // iv. If p is \"month\", then increase v by 1.\n else if (p === 'month') {\n v++;\n }\n // v. If p is \"hour\" and the value of the [[hour12]] internal property of\n // dateTimeFormat is true, then\n else if (p === 'hour' && internal['[[hour12]]'] === true) {\n // 1. Let v be v modulo 12.\n v = v % 12;\n // 2. If v is 0 and the value of the [[hourNo0]] internal property of\n // dateTimeFormat is true, then let v be 12.\n if (v === 0 && internal['[[hourNo0]]'] === true) {\n v = 12;\n }\n }\n\n // vi. If f is \"numeric\", then\n if (f === 'numeric') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments nf and v.\n fv = FormatNumber(nf, v);\n }\n // vii. Else if f is \"2-digit\", then\n else if (f === '2-digit') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // with arguments nf2 and v.\n fv = FormatNumber(nf2, v);\n // 2. If the length of fv is greater than 2, let fv be the substring of fv\n // containing the last two characters.\n if (fv.length > 2) {\n fv = fv.slice(-2);\n }\n }\n // viii. Else if f is \"narrow\", \"short\", or \"long\", then let fv be a String\n // value representing f in the desired form; the String value depends upon\n // the implementation and the effective locale and calendar of\n // dateTimeFormat. If p is \"month\", then the String value may also depend\n // on whether dateTimeFormat has a [[day]] internal property. If p is\n // \"timeZoneName\", then the String value may also depend on the value of\n // the [[inDST]] field of tm.\n else if (f in dateWidths) {\n switch (p) {\n case 'month':\n fv = resolveDateString(localeData, ca, 'months', f, tm['[[' + p + ']]']);\n break;\n\n case 'weekday':\n try {\n fv = resolveDateString(localeData, ca, 'days', f, tm['[[' + p + ']]']);\n // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];\n } catch (e) {\n throw new Error('Could not find weekday data for locale ' + locale);\n }\n break;\n\n case 'timeZoneName':\n fv = ''; // ###TODO\n break;\n\n case 'era':\n try {\n fv = resolveDateString(localeData, ca, 'eras', f, tm['[[' + p + ']]']);\n } catch (e) {\n throw new Error('Could not find era data for locale ' + locale);\n }\n break;\n\n default:\n fv = tm['[[' + p + ']]'];\n }\n }\n // ix\n arrPush.call(result, {\n type: p,\n value: fv\n });\n // f.\n } else if (p === 'ampm') {\n // i.\n var _v = tm['[[hour]]'];\n // ii./iii.\n fv = resolveDateString(localeData, ca, 'dayPeriods', _v > 11 ? 'pm' : 'am', null);\n // iv.\n arrPush.call(result, {\n type: 'dayPeriod',\n value: fv\n });\n // g.\n } else {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(beginIndex, endIndex + 1)\n });\n }\n // h.\n index = endIndex + 1;\n // i.\n beginIndex = pattern.indexOf('{', index);\n }\n // 12.\n if (endIndex < pattern.length - 1) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substr(endIndex + 1)\n });\n }\n // 13.\n return result;\n}\n\n/**\n * When the FormatDateTime abstract operation is called with arguments dateTimeFormat\n * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number\n * value), it returns a String value representing x (interpreted as a time value as\n * specified in ES5, 15.9.1.1) according to the effective locale and the formatting\n * options of dateTimeFormat.\n */\nfunction FormatDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = '';\n\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result += part.value;\n }\n return result;\n}\n\nfunction FormatToPartsDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = [];\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result.push({\n type: part.type,\n value: part.value\n });\n }\n return result;\n}\n\n/**\n * When the ToLocalTime abstract operation is called with arguments date, calendar, and\n * timeZone, the following steps are taken:\n */\nfunction ToLocalTime(date, calendar, timeZone) {\n // 1. Apply calendrical calculations on date for the given calendar and time zone to\n // produce weekday, era, year, month, day, hour, minute, second, and inDST values.\n // The calculations should use best available information about the specified\n // calendar and time zone. If the calendar is \"gregory\", then the calculations must\n // match the algorithms specified in ES5, 15.9.1, except that calculations are not\n // bound by the restrictions on the use of best available information on time zones\n // for local time zone adjustment and daylight saving time adjustment imposed by\n // ES5, 15.9.1.7 and 15.9.1.8.\n // ###TODO###\n var d = new Date(date),\n m = 'get' + (timeZone || '');\n\n // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],\n // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding\n // calculated value.\n return new Record({\n '[[weekday]]': d[m + 'Day'](),\n '[[era]]': +(d[m + 'FullYear']() >= 0),\n '[[year]]': d[m + 'FullYear'](),\n '[[month]]': d[m + 'Month'](),\n '[[day]]': d[m + 'Date'](),\n '[[hour]]': d[m + 'Hours'](),\n '[[minute]]': d[m + 'Minutes'](),\n '[[second]]': d[m + 'Seconds'](),\n '[[inDST]]': false // ###TODO###\n });\n}\n\n/**\n * The function returns a new object whose properties and attributes are set as if\n * constructed by an object literal assigning to each of the following properties the\n * value of the corresponding internal property of this DateTimeFormat object (see 12.4):\n * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,\n * hour, minute, second, and timeZoneName. Properties whose corresponding internal\n * properties are not present are not assigned.\n */\n/* 12.3.3 */defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {\n writable: true,\n configurable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\nvar ls = Intl.__localeSensitiveProtos = {\n Number: {},\n Date: {}\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.2.1 */ls.Number.toLocaleString = function () {\n // Satisfy test 13.2.1_1\n if (Object.prototype.toString.call(this) !== '[object Number]') throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');\n\n // 1. Let x be this Number value (as defined in ES5, 15.7.4).\n // 2. If locales is not provided, then let locales be undefined.\n // 3. If options is not provided, then let options be undefined.\n // 4. Let numberFormat be the result of creating a new object as if by the\n // expression new Intl.NumberFormat(locales, options) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n // 5. Return the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments numberFormat and x.\n return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.3.1 */ls.Date.toLocaleString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"any\", and \"all\".\n options = ToDateTimeOptions(options, 'any', 'all');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleDateString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.2 */ls.Date.toLocaleDateString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0],\n\n\n // 4. If options is not provided, then let options be undefined.\n options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"date\", and \"date\".\n options = ToDateTimeOptions(options, 'date', 'date');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleTimeString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.3 */ls.Date.toLocaleTimeString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"time\", and \"time\".\n options = ToDateTimeOptions(options, 'time', 'time');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\ndefineProperty(Intl, '__applyLocaleSensitivePrototypes', {\n writable: true,\n configurable: true,\n value: function value() {\n defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });\n // Need this here for IE 8, to avoid the _DontEnum_ bug\n defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });\n\n for (var k in ls.Date) {\n if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });\n }\n }\n});\n\n/**\n * Can't really ship a single script with data for hundreds of locales, so we provide\n * this __addLocaleData method as a means for the developer to add the data on an\n * as-needed basis\n */\ndefineProperty(Intl, '__addLocaleData', {\n value: function value(data) {\n if (!IsStructurallyValidLanguageTag(data.locale)) throw new Error(\"Object passed doesn't identify itself with a valid language tag\");\n\n addLocaleData(data, data.locale);\n }\n});\n\nfunction addLocaleData(data, tag) {\n // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present\n if (!data.number) throw new Error(\"Object passed doesn't contain locale data for Intl.NumberFormat\");\n\n var locale = void 0,\n locales = [tag],\n parts = tag.split('-');\n\n // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc\n if (parts.length > 2 && parts[1].length === 4) arrPush.call(locales, parts[0] + '-' + parts[2]);\n\n while (locale = arrShift.call(locales)) {\n // Add to NumberFormat internal properties as per 11.2.3\n arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);\n internals.NumberFormat['[[localeData]]'][locale] = data.number;\n\n // ...and DateTimeFormat internal properties as per 12.2.3\n if (data.date) {\n data.date.nu = data.number.nu;\n arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);\n internals.DateTimeFormat['[[localeData]]'][locale] = data.date;\n }\n }\n\n // If this is the first set of locale data added, make it the default\n if (defaultLocale === undefined) setDefaultLocale(tag);\n}\n\ndefineProperty(Intl, '__disableRegExpRestore', {\n value: function value() {\n internals.disableRegExpRestore = true;\n }\n});\n\nmodule.exports = Intl;","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar decode = decodeURIComponent;\nvar encode = encodeURIComponent;\nvar pairSplitRegExp = /; */;\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var pairs = str.split(pairSplitRegExp);\n var dec = opt.decode || decode;\n\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n continue;\n }\n\n var key = pair.substr(0, eq_idx).trim()\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n if (isNaN(maxAge)) throw new Error('maxAge should be a Number');\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (typeof opt.expires.toUTCString !== 'function') {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","// Console-polyfill. MIT license.\n// https://github.com/paulmillr/console-polyfill\n// Make it safe to do console.log() always.\n(function(global) {\n 'use strict';\n if (!global.console) {\n global.console = {};\n }\n var con = global.console;\n var prop, method;\n var dummy = function() {};\n var properties = ['memory'];\n var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = {};\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n // Using `this` for web workers & supports Browserify / Webpack.\n})(typeof window === 'undefined' ? this : window);\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = merge;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","export var QueryStatus;\n\n(function (QueryStatus) {\n QueryStatus[\"Idle\"] = \"idle\";\n QueryStatus[\"Loading\"] = \"loading\";\n QueryStatus[\"Error\"] = \"error\";\n QueryStatus[\"Success\"] = \"success\";\n})(QueryStatus || (QueryStatus = {}));","const en = require('./en.json');\n\n// TODO: Type this somehow\nexport const locales: any = {\n en,\n};\n","import React from 'react';\nimport { AppData } from 'common/types';\n\nexport const AppDataContext = React.createContext({\n pluginID: undefined,\n});\n","import React, { FC } from 'react';\nimport intl from 'react-intl-universal';\nimport { Button } from '@grafana/ui';\nimport { css } from 'emotion';\n\ntype DisabledProps = {\n toggle: Function;\n};\n\nexport const DisabledState: FC = ({ toggle }) => {\n const centered = css`\n align-items: center;\n justify-content: center;\n flex: 1;\n display: flex;\n height: 100%;\n `;\n\n return (\n

    \n \n
    \n );\n};\n","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { QueryStatus } from './types'; // TYPES\n\nexport var CancelledError = function CancelledError(silent) {\n this.silent = silent;\n}; // UTILS\n\nvar _uid = 0;\nexport function uid() {\n return _uid++;\n}\nexport var isServer = typeof window === 'undefined';\nexport function noop() {\n return undefined;\n}\nexport var Console = console || {\n error: noop,\n warn: noop,\n log: noop\n};\nexport function setConsole(c) {\n Console = c;\n}\nexport function functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\n\nfunction stableStringifyReplacer(_key, value) {\n if (typeof value === 'function') {\n throw new Error();\n }\n\n if (isPlainObject(value)) {\n return Object.keys(value).sort().reduce(function (result, key) {\n result[key] = value[key];\n return result;\n }, {});\n }\n\n return value;\n}\n\nexport function stableStringify(value) {\n return JSON.stringify(value, stableStringifyReplacer);\n}\nexport function deepIncludes(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a === 'object') {\n return !Object.keys(b).some(function (key) {\n return !deepIncludes(a[key], b[key]);\n });\n }\n\n return false;\n}\nexport function isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nexport function isDocumentVisible() {\n // document global can be unavailable in react native\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n}\nexport function isOnline() {\n return navigator.onLine === undefined || navigator.onLine;\n}\nexport function getQueryArgs(arg1, arg2, arg3, arg4) {\n var queryKey;\n var queryFn;\n var config;\n var options;\n\n if (isPlainObject(arg1)) {\n queryKey = arg1.queryKey;\n queryFn = arg1.queryFn;\n config = arg1.config;\n options = arg2;\n } else if (isPlainObject(arg2)) {\n queryKey = arg1;\n config = arg2;\n options = arg3;\n } else {\n queryKey = arg1;\n queryFn = arg2;\n config = arg3;\n options = arg4;\n }\n\n config = config || {};\n\n if (queryFn) {\n config = _extends({}, config, {\n queryFn: queryFn\n });\n }\n\n return [queryKey, config, options];\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nexport function replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n var array = Array.isArray(a) && Array.isArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n var aSize = array ? a.length : Object.keys(a).length;\n var bItems = array ? b : Object.keys(b);\n var bSize = bItems.length;\n var copy = array ? [] : {};\n var equalItems = 0;\n\n for (var i = 0; i < bSize; i++) {\n var key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nexport function isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n var ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n var prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isCancelable(value) {\n return typeof (value == null ? void 0 : value.cancel) === 'function';\n}\nexport function isError(value) {\n return value instanceof Error;\n}\nexport function isCancelledError(value) {\n return value instanceof CancelledError;\n}\nexport function sleep(timeout) {\n return new Promise(function (resolve) {\n setTimeout(resolve, timeout);\n });\n}\nexport function getStatusProps(status) {\n return {\n status: status,\n isLoading: status === QueryStatus.Loading,\n isSuccess: status === QueryStatus.Success,\n isError: status === QueryStatus.Error,\n isIdle: status === QueryStatus.Idle\n };\n}\nexport function createSetHandler(fn) {\n var removePreviousHandler;\n return function (callback) {\n // Unsub the old handler\n if (removePreviousHandler) {\n removePreviousHandler();\n } // Sub the new handler\n\n\n removePreviousHandler = callback(fn);\n };\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nexport function scheduleMicrotask(callback) {\n Promise.resolve().then(callback).catch(function (error) {\n return setTimeout(function () {\n throw error;\n });\n });\n}\n\n// Default to a dummy \"batch\" implementation that just runs the callback\nvar batchedUpdates = function batchedUpdates(callback) {\n callback();\n}; // Allow injecting another batching function later\n\n\nexport function setBatchedUpdates(fn) {\n batchedUpdates = fn;\n} // Supply a getter just to skip dealing with ESM bindings\n\nexport function getBatchedUpdates() {\n return batchedUpdates;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { stableStringify } from './utils';\n// CONFIG\nexport var defaultQueryKeySerializerFn = function defaultQueryKeySerializerFn(queryKey) {\n try {\n var arrayQueryKey = Array.isArray(queryKey) ? queryKey : [queryKey];\n var queryHash = stableStringify(arrayQueryKey);\n arrayQueryKey = JSON.parse(queryHash);\n return [queryHash, arrayQueryKey];\n } catch (_unused) {\n throw new Error('A valid query key is required!');\n }\n};\n/**\n * Config merging strategy\n *\n * When using hooks the config will be merged in the following order:\n *\n * 1. These defaults.\n * 2. Defaults from the hook query cache.\n * 3. Combined defaults from any config providers in the tree.\n * 4. Query/mutation config provided to the hook.\n *\n * When using a query cache directly the config will be merged in the following order:\n *\n * 1. These defaults.\n * 2. Defaults from the query cache.\n * 3. Query/mutation config provided to the query cache method.\n */\n\nexport var DEFAULT_CONFIG = {\n queries: {\n cacheTime: 5 * 60 * 1000,\n enabled: true,\n notifyOnStatusChange: true,\n queryFn: function queryFn() {\n return Promise.reject();\n },\n queryKeySerializerFn: defaultQueryKeySerializerFn,\n refetchOnMount: true,\n refetchOnReconnect: true,\n refetchOnWindowFocus: true,\n retry: 3,\n retryDelay: function retryDelay(attemptIndex) {\n return Math.min(1000 * Math.pow(2, attemptIndex), 30000);\n },\n staleTime: 0,\n structuralSharing: true\n }\n};\nexport function getDefaultReactQueryConfig() {\n return {\n queries: _extends({}, DEFAULT_CONFIG.queries),\n mutations: _extends({}, DEFAULT_CONFIG.mutations)\n };\n}\nexport function mergeReactQueryConfigs(a, b) {\n return {\n shared: _extends({}, a.shared, b.shared),\n queries: _extends({}, a.queries, b.queries),\n mutations: _extends({}, a.mutations, b.mutations)\n };\n}\nexport function getResolvedQueryConfig(queryCache, queryKey, contextConfig, config) {\n var queryCacheConfig = queryCache.getDefaultConfig();\n\n var resolvedConfig = _extends({}, DEFAULT_CONFIG.queries, queryCacheConfig == null ? void 0 : queryCacheConfig.shared, queryCacheConfig == null ? void 0 : queryCacheConfig.queries, contextConfig == null ? void 0 : contextConfig.shared, contextConfig == null ? void 0 : contextConfig.queries, config);\n\n var result = resolvedConfig.queryKeySerializerFn(queryKey);\n resolvedConfig.queryCache = queryCache;\n resolvedConfig.queryHash = result[0];\n resolvedConfig.queryKey = result[1];\n return resolvedConfig;\n}\nexport function isResolvedQueryConfig(config) {\n return Boolean(config.queryHash);\n}\nexport function getResolvedMutationConfig(queryCache, contextConfig, config) {\n var queryCacheConfig = queryCache.getDefaultConfig();\n return _extends({}, DEFAULT_CONFIG.mutations, queryCacheConfig == null ? void 0 : queryCacheConfig.shared, queryCacheConfig == null ? void 0 : queryCacheConfig.mutations, contextConfig == null ? void 0 : contextConfig.shared, contextConfig == null ? void 0 : contextConfig.mutations, config);\n}","import { getBatchedUpdates, scheduleMicrotask } from './utils'; // TYPES\n\n// CLASS\nexport var NotifyManager = /*#__PURE__*/function () {\n function NotifyManager() {\n this.queue = [];\n this.transactions = 0;\n }\n\n var _proto = NotifyManager.prototype;\n\n _proto.batch = function batch(callback) {\n this.transactions++;\n var result = callback();\n this.transactions--;\n\n if (!this.transactions) {\n this.flush();\n }\n\n return result;\n };\n\n _proto.schedule = function schedule(notify) {\n if (this.transactions) {\n this.queue.push(notify);\n } else {\n scheduleMicrotask(function () {\n notify();\n });\n }\n };\n\n _proto.flush = function flush() {\n var queue = this.queue;\n this.queue = [];\n\n if (queue.length) {\n scheduleMicrotask(function () {\n var batchedUpdates = getBatchedUpdates();\n batchedUpdates(function () {\n queue.forEach(function (notify) {\n notify();\n });\n });\n });\n }\n };\n\n return NotifyManager;\n}(); // SINGLETON\n\nexport var notifyManager = new NotifyManager();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getStatusProps, isDocumentVisible, isServer, isValidTimeout, noop } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { QueryStatus } from './types';\nimport { DEFAULT_CONFIG, isResolvedQueryConfig } from './config';\nexport var QueryObserver = /*#__PURE__*/function () {\n function QueryObserver(config) {\n this.config = config;\n this.isStale = true;\n this.initialUpdateCount = 0; // Bind exposed methods\n\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n this.fetchMore = this.fetchMore.bind(this);\n this.unsubscribe = this.unsubscribe.bind(this); // Subscribe to the query\n\n this.updateQuery();\n }\n\n var _proto = QueryObserver.prototype;\n\n _proto.subscribe = function subscribe(listener) {\n this.listener = listener || noop;\n this.currentQuery.subscribeObserver(this);\n\n if (this.config.enabled && (this.config.forceFetchOnMount || this.config.refetchOnMount === 'always')) {\n this.fetch();\n } else {\n this.optionalFetch();\n }\n\n this.updateTimers();\n return this.unsubscribe;\n };\n\n _proto.unsubscribe = function unsubscribe() {\n this.listener = undefined;\n this.clearTimers();\n this.currentQuery.unsubscribeObserver(this);\n };\n\n _proto.updateConfig = function updateConfig(config) {\n var prevConfig = this.config;\n var prevQuery = this.currentQuery;\n this.config = isResolvedQueryConfig(config) ? config : this.config.queryCache.getResolvedQueryConfig(this.config.queryKey, config);\n this.updateQuery(); // Take no further actions if there is no subscriber\n\n if (!this.listener) {\n return;\n } // If we subscribed to a new query, optionally fetch and update refetch\n\n\n if (this.currentQuery !== prevQuery) {\n this.optionalFetch();\n this.updateTimers();\n return;\n } // Optionally fetch if the query became enabled\n\n\n if (config.enabled && !prevConfig.enabled) {\n this.optionalFetch();\n } // Update stale interval if needed\n\n\n if (config.enabled !== prevConfig.enabled || config.staleTime !== prevConfig.staleTime) {\n this.updateStaleTimeout();\n } // Update refetch interval if needed\n\n\n if (config.enabled !== prevConfig.enabled || config.refetchInterval !== prevConfig.refetchInterval) {\n this.updateRefetchInterval();\n }\n };\n\n _proto.getCurrentQuery = function getCurrentQuery() {\n return this.currentQuery;\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n }\n /**\n * @deprecated\n */\n ;\n\n _proto.clear = function clear() {\n this.remove();\n };\n\n _proto.remove = function remove() {\n this.currentQuery.remove();\n };\n\n _proto.refetch = function refetch(options) {\n return this.currentQuery.refetch(options, this.config);\n };\n\n _proto.fetchMore = function fetchMore(fetchMoreVariable, options) {\n return this.currentQuery.fetchMore(fetchMoreVariable, options, this.config).catch(noop);\n };\n\n _proto.fetch = function fetch() {\n var _DEFAULT_CONFIG$queri;\n\n // Never try to fetch if no query function has been set\n if (this.config.queryFn === ((_DEFAULT_CONFIG$queri = DEFAULT_CONFIG.queries) == null ? void 0 : _DEFAULT_CONFIG$queri.queryFn)) {\n return Promise.resolve(this.currentResult.data);\n }\n\n return this.currentQuery.fetch(undefined, this.config).catch(noop);\n };\n\n _proto.optionalFetch = function optionalFetch() {\n if (this.config.enabled && // Only fetch if enabled\n this.isStale && // Only fetch if stale\n !(this.config.suspense && this.currentResult.isFetched) && ( // Don't refetch if in suspense mode and the data is already fetched\n this.config.refetchOnMount || this.currentQuery.observers.length === 1)) {\n this.fetch();\n }\n };\n\n _proto.updateStaleTimeout = function updateStaleTimeout() {\n var _this = this;\n\n if (isServer) {\n return;\n }\n\n this.clearStaleTimeout();\n\n if (this.isStale || !isValidTimeout(this.config.staleTime)) {\n return;\n }\n\n var timeElapsed = Date.now() - this.currentResult.updatedAt;\n var timeUntilStale = this.config.staleTime - timeElapsed + 1;\n var timeout = Math.max(timeUntilStale, 0);\n this.staleTimeoutId = setTimeout(function () {\n if (!_this.isStale) {\n _this.isStale = true;\n\n _this.updateResult();\n\n _this.notify({\n listener: true,\n globalListeners: true\n });\n }\n }, timeout);\n };\n\n _proto.updateRefetchInterval = function updateRefetchInterval() {\n var _this2 = this;\n\n if (isServer) {\n return;\n }\n\n this.clearRefetchInterval();\n\n if (!this.config.enabled || !isValidTimeout(this.config.refetchInterval)) {\n return;\n }\n\n this.refetchIntervalId = setInterval(function () {\n if (_this2.config.refetchIntervalInBackground || isDocumentVisible()) {\n _this2.fetch();\n }\n }, this.config.refetchInterval);\n };\n\n _proto.updateTimers = function updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval();\n };\n\n _proto.clearTimers = function clearTimers() {\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n };\n\n _proto.clearStaleTimeout = function clearStaleTimeout() {\n if (this.staleTimeoutId) {\n clearInterval(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n }\n };\n\n _proto.clearRefetchInterval = function clearRefetchInterval() {\n if (this.refetchIntervalId) {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n }\n };\n\n _proto.updateResult = function updateResult() {\n var _this$previousQueryRe;\n\n var state = this.currentQuery.state;\n var data = state.data,\n status = state.status,\n updatedAt = state.updatedAt;\n var isPreviousData = false;\n var isPlaceholderData = false; // Keep previous data if needed\n\n if (this.config.keepPreviousData && state.isInitialData && ((_this$previousQueryRe = this.previousQueryResult) == null ? void 0 : _this$previousQueryRe.isSuccess)) {\n data = this.previousQueryResult.data;\n updatedAt = this.previousQueryResult.updatedAt;\n status = this.previousQueryResult.status;\n isPreviousData = true;\n }\n\n if (status === 'loading' && this.config.placeholderData) {\n var placeholderData = typeof this.config.placeholderData === 'function' ? this.config.placeholderData() : this.config.placeholderData;\n\n if (typeof placeholderData !== 'undefined') {\n status = QueryStatus.Success;\n data = placeholderData;\n isPlaceholderData = true;\n }\n }\n\n this.currentResult = _extends({}, getStatusProps(status), {\n canFetchMore: state.canFetchMore,\n clear: this.remove,\n data: data,\n error: state.error,\n failureCount: state.failureCount,\n fetchMore: this.fetchMore,\n isFetched: state.updateCount > 0,\n isFetchedAfterMount: state.updateCount > this.initialUpdateCount,\n isFetching: state.isFetching,\n isFetchingMore: state.isFetchingMore,\n isInitialData: state.isInitialData,\n isPreviousData: isPreviousData,\n isPlaceholderData: isPlaceholderData,\n isStale: this.isStale,\n refetch: this.refetch,\n remove: this.remove,\n updatedAt: updatedAt\n });\n };\n\n _proto.updateQuery = function updateQuery() {\n var config = this.config;\n var prevQuery = this.currentQuery;\n var query = config.queryCache.getQueryByHash(config.queryHash);\n\n if (!query) {\n query = config.queryCache.createQuery(config);\n }\n\n if (query === prevQuery) {\n return;\n }\n\n this.previousQueryResult = this.currentResult;\n this.currentQuery = query;\n this.initialUpdateCount = query.state.updateCount; // Update stale state on query switch\n\n if (query.state.isInitialData) {\n if (config.keepPreviousData && prevQuery) {\n this.isStale = true;\n } else if (typeof config.initialStale === 'function') {\n this.isStale = config.initialStale();\n } else if (typeof config.initialStale === 'boolean') {\n this.isStale = config.initialStale;\n } else {\n this.isStale = typeof query.state.data === 'undefined';\n }\n } else {\n this.isStale = query.isStaleByTime(config.staleTime);\n }\n\n this.updateResult();\n\n if (this.listener) {\n prevQuery == null ? void 0 : prevQuery.unsubscribeObserver(this);\n this.currentQuery.subscribeObserver(this);\n }\n };\n\n _proto.onQueryUpdate = function onQueryUpdate(action) {\n var config = this.config;\n var type = action.type; // Update stale state on success, error or invalidation\n\n if (type === 2 || type === 3 || type === 4) {\n this.isStale = this.currentQuery.isStaleByTime(config.staleTime);\n } // Store current result and get new result\n\n\n var prevResult = this.currentResult;\n this.updateResult();\n var currentResult = this.currentResult; // Update timers on success, error or invalidation\n\n if (type === 2 || type === 3 || type === 4) {\n this.updateTimers();\n } // Do not notify if the query was invalidated but the stale state did not changed\n\n\n if (type === 4 && currentResult.isStale === prevResult.isStale) {\n return;\n } // Determine which callbacks to trigger\n\n\n var notifyOptions = {};\n\n if (type === 2) {\n notifyOptions.onSuccess = true;\n } else if (type === 3) {\n notifyOptions.onError = true;\n }\n\n if ( // Always notify if notifyOnStatusChange is set\n config.notifyOnStatusChange || // Otherwise only notify on data or error change\n currentResult.data !== prevResult.data || currentResult.error !== prevResult.error) {\n notifyOptions.listener = true;\n }\n\n this.notify(notifyOptions);\n };\n\n _proto.notify = function notify(options) {\n var config = this.config,\n currentResult = this.currentResult,\n currentQuery = this.currentQuery,\n listener = this.listener;\n var onSuccess = config.onSuccess,\n onSettled = config.onSettled,\n onError = config.onError;\n notifyManager.batch(function () {\n // First trigger the configuration callbacks\n if (options.onSuccess) {\n if (onSuccess) {\n notifyManager.schedule(function () {\n onSuccess(currentResult.data);\n });\n }\n\n if (onSettled) {\n notifyManager.schedule(function () {\n onSettled(currentResult.data, null);\n });\n }\n } else if (options.onError) {\n if (onError) {\n notifyManager.schedule(function () {\n onError(currentResult.error);\n });\n }\n\n if (onSettled) {\n notifyManager.schedule(function () {\n onSettled(undefined, currentResult.error);\n });\n }\n } // Then trigger the listener\n\n\n if (options.listener && listener) {\n notifyManager.schedule(function () {\n listener(currentResult);\n });\n } // Then the global listeners\n\n\n if (options.globalListeners) {\n config.queryCache.notifyGlobalListeners(currentQuery);\n }\n });\n };\n\n return QueryObserver;\n}();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { CancelledError, Console, functionalUpdate, isCancelable, isCancelledError, isDocumentVisible, isOnline, isServer, isValidTimeout, noop, replaceEqualDeep, sleep } from './utils';\nimport { QueryStatus } from './types';\nimport { QueryObserver } from './queryObserver';\nimport { notifyManager } from './notifyManager'; // TYPES\n\nfunction _empty() {}\n\nvar ActionType = {\n Failed: 0,\n Fetch: 1,\n Success: 2,\n Error: 3,\n Invalidate: 4\n};\n\n// CLASS\nfunction _awaitIgnored(value, direct) {\n if (!direct) {\n return value && value.then ? value.then(_empty) : Promise.resolve();\n }\n}\n\nfunction _invoke(body, then) {\n var result = body();\n\n if (result && result.then) {\n return result.then(then);\n }\n\n return then(result);\n}\n\nfunction _await(value, then, direct) {\n if (direct) {\n return then ? then(value) : value;\n }\n\n if (!value || !value.then) {\n value = Promise.resolve(value);\n }\n\n return then ? value.then(then) : value;\n}\n\nfunction _catch(body, recover) {\n try {\n var result = body();\n } catch (e) {\n return recover(e);\n }\n\n if (result && result.then) {\n return result.then(void 0, recover);\n }\n\n return result;\n}\n\nfunction _async(f) {\n return function () {\n for (var args = [], i = 0; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n\n try {\n return Promise.resolve(f.apply(this, args));\n } catch (e) {\n return Promise.reject(e);\n }\n };\n}\n\nexport var Query = /*#__PURE__*/function () {\n function Query(config) {\n this.config = config;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.queryCache = config.queryCache;\n this.cacheTime = config.cacheTime;\n this.observers = [];\n this.state = getDefaultState(config);\n this.scheduleGc();\n }\n\n var _proto = Query.prototype;\n\n _proto.updateConfig = function updateConfig(config) {\n this.config = config;\n this.cacheTime = Math.max(this.cacheTime, config.cacheTime);\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this = this;\n\n this.state = queryReducer(this.state, action);\n notifyManager.batch(function () {\n _this.observers.forEach(function (observer) {\n observer.onQueryUpdate(action);\n });\n\n _this.queryCache.notifyGlobalListeners(_this);\n });\n };\n\n _proto.scheduleGc = function scheduleGc() {\n var _this2 = this;\n\n if (isServer) {\n return;\n }\n\n this.clearGcTimeout();\n\n if (this.observers.length > 0 || !isValidTimeout(this.cacheTime)) {\n return;\n }\n\n this.gcTimeout = setTimeout(function () {\n _this2.remove();\n }, this.cacheTime);\n };\n\n _proto.cancel = function cancel(silent) {\n var promise = this.promise;\n\n if (promise && this.cancelFetch) {\n this.cancelFetch(silent);\n return promise.then(noop).catch(noop);\n }\n\n return Promise.resolve(undefined);\n };\n\n _proto.continue = function _continue() {\n var _this$continueFetch;\n\n (_this$continueFetch = this.continueFetch) == null ? void 0 : _this$continueFetch.call(this);\n };\n\n _proto.clearTimersObservers = function clearTimersObservers() {\n this.observers.forEach(function (observer) {\n observer.clearTimers();\n });\n };\n\n _proto.clearGcTimeout = function clearGcTimeout() {\n if (this.gcTimeout) {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n }\n };\n\n _proto.setData = function setData(updater, options) {\n var _this$config$isDataEq, _this$config;\n\n var prevData = this.state.data; // Get the new data\n\n var data = functionalUpdate(updater, prevData); // Structurally share data between prev and new data if needed\n\n if (this.config.structuralSharing) {\n data = replaceEqualDeep(prevData, data);\n } // Use prev data if an isDataEqual function is defined and returns `true`\n\n\n if ((_this$config$isDataEq = (_this$config = this.config).isDataEqual) == null ? void 0 : _this$config$isDataEq.call(_this$config, prevData, data)) {\n data = prevData;\n } // Try to determine if more data can be fetched\n\n\n var canFetchMore = hasMorePages(this.config, data); // Set data and mark it as cached\n\n this.dispatch({\n type: ActionType.Success,\n data: data,\n canFetchMore: canFetchMore,\n updatedAt: options == null ? void 0 : options.updatedAt\n });\n }\n /**\n * @deprecated\n */\n ;\n\n _proto.clear = function clear() {\n Console.warn('react-query: clear() has been deprecated, please use remove() instead');\n this.remove();\n };\n\n _proto.remove = function remove() {\n this.queryCache.removeQuery(this);\n };\n\n _proto.destroy = function destroy() {\n this.clearGcTimeout();\n this.clearTimersObservers();\n this.cancel();\n };\n\n _proto.isActive = function isActive() {\n return this.observers.some(function (observer) {\n return observer.config.enabled;\n });\n };\n\n _proto.isStale = function isStale() {\n return this.state.isInvalidated || this.state.status !== QueryStatus.Success || this.observers.some(function (observer) {\n return observer.getCurrentResult().isStale;\n });\n };\n\n _proto.isStaleByTime = function isStaleByTime(staleTime) {\n if (staleTime === void 0) {\n staleTime = 0;\n }\n\n return this.state.isInvalidated || this.state.status !== QueryStatus.Success || this.state.updatedAt + staleTime <= Date.now();\n };\n\n _proto.onInteraction = function onInteraction(type) {\n // Execute the first observer which is enabled,\n // stale and wants to refetch on this interaction.\n var staleObserver = this.observers.find(function (observer) {\n var config = observer.config;\n\n var _observer$getCurrentR = observer.getCurrentResult(),\n isStale = _observer$getCurrentR.isStale;\n\n return config.enabled && (type === 'focus' && (config.refetchOnWindowFocus === 'always' || config.refetchOnWindowFocus && isStale) || type === 'online' && (config.refetchOnReconnect === 'always' || config.refetchOnReconnect && isStale));\n });\n\n if (staleObserver) {\n staleObserver.fetch();\n } // Continue any paused fetch\n\n\n this.continue();\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.subscribe = function subscribe(listener) {\n var observer = new QueryObserver(this.config);\n observer.subscribe(listener);\n return observer;\n };\n\n _proto.subscribeObserver = function subscribeObserver(observer) {\n this.observers.push(observer); // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n };\n\n _proto.unsubscribeObserver = function unsubscribeObserver(observer) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.isTransportCancelable) {\n this.cancel();\n }\n\n this.scheduleGc();\n }\n };\n\n _proto.invalidate = function invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: ActionType.Invalidate\n });\n }\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.refetch = function refetch(options, config) {\n var promise = this.fetch(undefined, config);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.fetchMore = function fetchMore(fetchMoreVariable, options, config) {\n return this.fetch({\n fetchMore: {\n fetchMoreVariable: fetchMoreVariable,\n previous: (options == null ? void 0 : options.previous) || false\n }\n }, config);\n };\n\n _proto.fetch = function fetch(options, config) {\n try {\n var _exit2 = false;\n\n var _this4 = this;\n\n return _invoke(function () {\n if (_this4.promise) {\n return function () {\n if ((options == null ? void 0 : options.fetchMore) && _this4.state.data) {\n // Silently cancel current fetch if the user wants to fetch more\n return _awaitIgnored(_this4.cancel(true));\n } else {\n // Return current promise if we are already fetching\n _exit2 = true;\n return _this4.promise;\n }\n }();\n }\n }, function (_result2) {\n if (_exit2) return _result2;\n\n // Update config if passed, otherwise the config from the last execution is used\n if (config) {\n _this4.updateConfig(config);\n }\n\n config = _this4.config; // Get the query function params\n\n var filter = config.queryFnParamsFilter;\n var params = filter ? filter(_this4.queryKey) : _this4.queryKey;\n _this4.promise = _async(function () {\n return _catch(function () {\n var data;\n return _invoke(function () {\n if (config.infinite) {\n return _await(_this4.startInfiniteFetch(config, params, options), function (_this4$startInfiniteF) {\n data = _this4$startInfiniteF;\n });\n } else {\n return _await(_this4.startFetch(config, params, options), function (_this4$startFetch) {\n data = _this4$startFetch;\n });\n }\n }, function () {\n // Set success state\n _this4.setData(data); // Cleanup\n\n\n delete _this4.promise; // Return data\n\n return data;\n });\n }, function (error) {\n // Set error state if needed\n if (!(isCancelledError(error) && error.silent)) {\n _this4.dispatch({\n type: ActionType.Error,\n error: error\n });\n } // Log error\n\n\n if (!isCancelledError(error)) {\n Console.error(error);\n } // Cleanup\n\n\n delete _this4.promise; // Propagate error\n\n throw error;\n });\n })();\n return _this4.promise;\n });\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n _proto.startFetch = function startFetch(config, params, _options) {\n // Create function to fetch the data\n var fetchData = function fetchData() {\n return config.queryFn.apply(config, params);\n }; // Set to fetching state if not already in it\n\n\n if (!this.state.isFetching) {\n this.dispatch({\n type: ActionType.Fetch\n });\n } // Try to fetch the data\n\n\n return this.tryFetchData(config, fetchData);\n };\n\n _proto.startInfiniteFetch = function startInfiniteFetch(config, params, options) {\n var fetchMore = options == null ? void 0 : options.fetchMore;\n\n var _ref = fetchMore || {},\n previous = _ref.previous,\n fetchMoreVariable = _ref.fetchMoreVariable;\n\n var isFetchingMore = fetchMore ? previous ? 'previous' : 'next' : false;\n var prevPages = this.state.data || []; // Create function to fetch a page\n\n var fetchPage = _async(function (pages, prepend, cursor) {\n var lastPage = getLastPage(pages, prepend);\n\n if (typeof cursor === 'undefined' && typeof lastPage !== 'undefined' && config.getFetchMore) {\n cursor = config.getFetchMore(lastPage, pages);\n }\n\n return !Boolean(cursor) && typeof lastPage !== 'undefined' ? pages : _await(config.queryFn.apply(config, params.concat([cursor])), function (page) {\n return prepend ? [page].concat(pages) : [].concat(pages, [page]);\n });\n }); // Create function to fetch the data\n\n\n var fetchData = function fetchData() {\n if (isFetchingMore) {\n return fetchPage(prevPages, previous, fetchMoreVariable);\n } else if (!prevPages.length) {\n return fetchPage([]);\n } else {\n var promise = fetchPage([]);\n\n for (var i = 1; i < prevPages.length; i++) {\n promise = promise.then(fetchPage);\n }\n\n return promise;\n }\n }; // Set to fetching state if not already in it\n\n\n if (!this.state.isFetching || this.state.isFetchingMore !== isFetchingMore) {\n this.dispatch({\n type: ActionType.Fetch,\n isFetchingMore: isFetchingMore\n });\n } // Try to get the data\n\n\n return this.tryFetchData(config, fetchData);\n };\n\n _proto.tryFetchData = function tryFetchData(config, fn) {\n var _this5 = this;\n\n return new Promise(function (outerResolve, outerReject) {\n var resolved = false;\n var continueLoop;\n var cancelTransport;\n\n var done = function done() {\n resolved = true;\n delete _this5.cancelFetch;\n delete _this5.continueFetch;\n delete _this5.isTransportCancelable; // End loop if currently paused\n\n continueLoop == null ? void 0 : continueLoop();\n };\n\n var resolve = function resolve(value) {\n done();\n outerResolve(value);\n };\n\n var reject = function reject(value) {\n done();\n outerReject(value);\n }; // Create callback to cancel this fetch\n\n\n _this5.cancelFetch = function (silent) {\n reject(new CancelledError(silent));\n cancelTransport == null ? void 0 : cancelTransport();\n }; // Create callback to continue this fetch\n\n\n _this5.continueFetch = function () {\n continueLoop == null ? void 0 : continueLoop();\n }; // Create loop function\n\n\n var run = _async(function () {\n return _catch(function () {\n // Execute query\n var promiseOrValue = fn(); // Check if the transport layer support cancellation\n\n if (isCancelable(promiseOrValue)) {\n cancelTransport = function cancelTransport() {\n try {\n promiseOrValue.cancel();\n } catch (_unused) {}\n };\n\n _this5.isTransportCancelable = true;\n } // Await data\n\n\n return _await(promiseOrValue, function (_promiseOrValue) {\n resolve(_promiseOrValue);\n });\n }, function (error) {\n // Stop if the fetch is already resolved\n if (resolved) {\n return;\n } // Do we need to retry the request?\n\n\n var failureCount = _this5.state.failureCount;\n var retry = config.retry,\n retryDelay = config.retryDelay;\n var shouldRetry = retry === true || failureCount < retry || typeof retry === 'function' && retry(failureCount, error);\n\n if (!shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n } // Increase the failureCount\n\n\n _this5.dispatch({\n type: ActionType.Failed\n }); // Delay\n\n\n return _await(sleep(functionalUpdate(retryDelay, failureCount) || 0), function () {\n // Pause retry if the document is not visible or when the device is offline\n return _invoke(function () {\n if (!isDocumentVisible() || !isOnline()) {\n return _awaitIgnored(new Promise(function (continueResolve) {\n continueLoop = continueResolve;\n }));\n }\n }, function () {\n if (!resolved) {\n run();\n }\n }); // Try again if not resolved yet\n });\n });\n }); // Start loop\n\n\n run();\n });\n };\n\n return Query;\n}();\n\nfunction getLastPage(pages, previous) {\n return previous ? pages[0] : pages[pages.length - 1];\n}\n\nfunction hasMorePages(config, pages, previous) {\n if (config.infinite && config.getFetchMore && Array.isArray(pages)) {\n return Boolean(config.getFetchMore(getLastPage(pages, previous), pages));\n }\n}\n\nfunction getDefaultState(config) {\n var data = typeof config.initialData === 'function' ? config.initialData() : config.initialData;\n var status = typeof data !== 'undefined' ? QueryStatus.Success : config.enabled ? QueryStatus.Loading : QueryStatus.Idle;\n return {\n canFetchMore: hasMorePages(config, data),\n data: data,\n error: null,\n failureCount: 0,\n isFetching: status === QueryStatus.Loading,\n isFetchingMore: false,\n isInitialData: true,\n isInvalidated: false,\n status: status,\n updateCount: 0,\n updatedAt: Date.now()\n };\n}\n\nexport function queryReducer(state, action) {\n var _action$updatedAt;\n\n switch (action.type) {\n case ActionType.Failed:\n return _extends({}, state, {\n failureCount: state.failureCount + 1\n });\n\n case ActionType.Fetch:\n return _extends({}, state, {\n failureCount: 0,\n isFetching: true,\n isFetchingMore: action.isFetchingMore || false,\n status: typeof state.data !== 'undefined' ? QueryStatus.Success : QueryStatus.Loading\n });\n\n case ActionType.Success:\n return _extends({}, state, {\n canFetchMore: action.canFetchMore,\n data: action.data,\n error: null,\n failureCount: 0,\n isFetching: false,\n isFetchingMore: false,\n isInitialData: false,\n isInvalidated: false,\n status: QueryStatus.Success,\n updateCount: state.updateCount + 1,\n updatedAt: (_action$updatedAt = action.updatedAt) != null ? _action$updatedAt : Date.now()\n });\n\n case ActionType.Error:\n return _extends({}, state, {\n error: action.error,\n failureCount: state.failureCount + 1,\n isFetching: false,\n isFetchingMore: false,\n status: QueryStatus.Error,\n throwInErrorBoundary: true,\n updateCount: state.updateCount + 1\n });\n\n case ActionType.Invalidate:\n return _extends({}, state, {\n isInvalidated: true\n });\n\n default:\n return state;\n }\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { deepIncludes, getQueryArgs, isDocumentVisible, isOnline, isPlainObject, isServer, noop } from './utils';\nimport { getResolvedQueryConfig as _getResolvedQueryConfig } from './config';\nimport { Query } from './query';\nimport { notifyManager } from './notifyManager';\nimport { QueryObserver } from './queryObserver'; // TYPES\n\n// CLASS\nexport var QueryCache = /*#__PURE__*/function () {\n function QueryCache(config) {\n this.config = config || {};\n this.globalListeners = [];\n this.queries = {};\n this.queriesArray = [];\n this.isFetching = 0;\n }\n\n var _proto = QueryCache.prototype;\n\n _proto.notifyGlobalListeners = function notifyGlobalListeners(query) {\n var _this = this;\n\n this.isFetching = this.getQueries().reduce(function (acc, q) {\n return q.state.isFetching ? acc + 1 : acc;\n }, 0);\n notifyManager.batch(function () {\n _this.globalListeners.forEach(function (listener) {\n notifyManager.schedule(function () {\n listener(_this, query);\n });\n });\n });\n };\n\n _proto.getDefaultConfig = function getDefaultConfig() {\n return this.config.defaultConfig;\n };\n\n _proto.getResolvedQueryConfig = function getResolvedQueryConfig(queryKey, config) {\n return _getResolvedQueryConfig(this, queryKey, undefined, config);\n };\n\n _proto.subscribe = function subscribe(listener) {\n var _this2 = this;\n\n this.globalListeners.push(listener);\n return function () {\n _this2.globalListeners = _this2.globalListeners.filter(function (x) {\n return x !== listener;\n });\n };\n };\n\n _proto.clear = function clear(options) {\n this.removeQueries();\n\n if (options == null ? void 0 : options.notify) {\n this.notifyGlobalListeners();\n }\n };\n\n _proto.getQueries = function getQueries(predicate, options) {\n var anyKey = predicate === true || typeof predicate === 'undefined';\n\n if (anyKey && !options) {\n return this.queriesArray;\n }\n\n var predicateFn;\n\n if (typeof predicate === 'function') {\n predicateFn = predicate;\n } else {\n var _ref = options || {},\n exact = _ref.exact,\n active = _ref.active,\n stale = _ref.stale;\n\n var resolvedConfig = this.getResolvedQueryConfig(predicate);\n\n predicateFn = function predicateFn(query) {\n // Check query key if needed\n if (!anyKey) {\n if (exact) {\n // Check if the query key matches exactly\n if (query.queryHash !== resolvedConfig.queryHash) {\n return false;\n }\n } else {\n // Check if the query key matches partially\n if (!deepIncludes(query.queryKey, resolvedConfig.queryKey)) {\n return false;\n }\n }\n } // Check active state if needed\n\n\n if (typeof active === 'boolean' && query.isActive() !== active) {\n return false;\n } // Check stale state if needed\n\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n return true;\n };\n }\n\n return this.queriesArray.filter(predicateFn);\n };\n\n _proto.getQuery = function getQuery(predicate) {\n return this.getQueries(predicate, {\n exact: true\n })[0];\n };\n\n _proto.getQueryByHash = function getQueryByHash(queryHash) {\n return this.queries[queryHash];\n };\n\n _proto.getQueryData = function getQueryData(predicate) {\n var _this$getQuery;\n\n return (_this$getQuery = this.getQuery(predicate)) == null ? void 0 : _this$getQuery.state.data;\n };\n\n _proto.removeQuery = function removeQuery(query) {\n if (this.queries[query.queryHash]) {\n query.destroy();\n delete this.queries[query.queryHash];\n this.queriesArray = this.queriesArray.filter(function (x) {\n return x !== query;\n });\n this.notifyGlobalListeners(query);\n }\n };\n\n _proto.removeQueries = function removeQueries(predicate, options) {\n var _this3 = this;\n\n this.getQueries(predicate, options).forEach(function (query) {\n _this3.removeQuery(query);\n });\n };\n\n _proto.cancelQueries = function cancelQueries(predicate, options) {\n this.getQueries(predicate, options).forEach(function (query) {\n query.cancel();\n });\n }\n /**\n * @return Promise resolving to an array with the invalidated queries.\n */\n ;\n\n _proto.invalidateQueries = function invalidateQueries(predicate, options) {\n var queries = this.getQueries(predicate, options);\n notifyManager.batch(function () {\n queries.forEach(function (query) {\n query.invalidate();\n });\n });\n\n var _ref2 = options || {},\n _ref2$refetchActive = _ref2.refetchActive,\n refetchActive = _ref2$refetchActive === void 0 ? true : _ref2$refetchActive,\n _ref2$refetchInactive = _ref2.refetchInactive,\n refetchInactive = _ref2$refetchInactive === void 0 ? false : _ref2$refetchInactive;\n\n if (!refetchInactive && !refetchActive) {\n return Promise.resolve(queries);\n }\n\n var refetchOptions = _extends({}, options);\n\n if (refetchActive && !refetchInactive) {\n refetchOptions.active = true;\n } else if (refetchInactive && !refetchActive) {\n refetchOptions.active = false;\n }\n\n var promise = this.refetchQueries(predicate, refetchOptions);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(function () {\n return queries;\n });\n }\n\n return promise.then(function () {\n return queries;\n });\n }\n /**\n * @return Promise resolving to an array with the refetched queries.\n */\n ;\n\n _proto.refetchQueries = function refetchQueries(predicate, options) {\n var _this4 = this;\n\n var promises = [];\n notifyManager.batch(function () {\n _this4.getQueries(predicate, options).forEach(function (query) {\n var promise = query.fetch().then(function () {\n return query;\n });\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(function () {\n return query;\n });\n }\n\n promises.push(promise);\n });\n });\n return Promise.all(promises);\n };\n\n _proto.resetErrorBoundaries = function resetErrorBoundaries() {\n this.getQueries().forEach(function (query) {\n query.state.throwInErrorBoundary = false;\n });\n };\n\n _proto.buildQuery = function buildQuery(queryKey, config) {\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, config);\n var query = this.getQueryByHash(resolvedConfig.queryHash);\n\n if (!query) {\n query = this.createQuery(resolvedConfig);\n }\n\n return query;\n };\n\n _proto.createQuery = function createQuery(config) {\n var query = new Query(config); // A frozen cache does not add new queries to the cache\n\n if (!this.config.frozen) {\n this.queries[query.queryHash] = query;\n this.queriesArray.push(query);\n this.notifyGlobalListeners(query);\n }\n\n return query;\n } // Parameter syntax\n ;\n\n // Implementation\n _proto.fetchQuery = function fetchQuery(arg1, arg2, arg3) {\n var _getQueryArgs = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs[0],\n config = _getQueryArgs[1];\n\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, _extends({\n // https://github.com/tannerlinsley/react-query/issues/652\n retry: false\n }, config));\n var query = this.getQueryByHash(resolvedConfig.queryHash);\n\n if (!query) {\n query = this.createQuery(resolvedConfig);\n }\n\n if (!query.isStaleByTime(config.staleTime)) {\n return Promise.resolve(query.state.data);\n }\n\n return query.fetch(undefined, resolvedConfig);\n } // Parameter syntax with optional prefetch options\n ;\n\n // Implementation\n _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3, arg4) {\n if (isPlainObject(arg2) && (arg2.hasOwnProperty('throwOnError') || arg2.hasOwnProperty('force'))) {\n arg4 = arg2;\n arg2 = undefined;\n arg3 = undefined;\n }\n\n var _getQueryArgs2 = getQueryArgs(arg1, arg2, arg3, arg4),\n queryKey = _getQueryArgs2[0],\n config = _getQueryArgs2[1],\n options = _getQueryArgs2[2];\n\n if (options == null ? void 0 : options.force) {\n config.staleTime = 0;\n }\n\n var promise = this.fetchQuery(queryKey, config);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n } // Parameter syntax\n ;\n\n // Implementation\n _proto.watchQuery = function watchQuery(arg1, arg2, arg3) {\n var _getQueryArgs3 = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs3[0],\n config = _getQueryArgs3[1];\n\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, config);\n return new QueryObserver(resolvedConfig);\n };\n\n _proto.setQueryData = function setQueryData(queryKey, updater, config) {\n this.buildQuery(queryKey, config).setData(updater);\n };\n\n return QueryCache;\n}();\nvar defaultQueryCache = new QueryCache({\n frozen: isServer\n});\nexport { defaultQueryCache as queryCache };\nexport var queryCaches = [defaultQueryCache];\n/**\n * @deprecated\n */\n\nexport function makeQueryCache(config) {\n return new QueryCache(config);\n}\nexport function onVisibilityOrOnlineChange(type) {\n if (isDocumentVisible() && isOnline()) {\n notifyManager.batch(function () {\n queryCaches.forEach(function (queryCache) {\n queryCache.getQueries().forEach(function (query) {\n query.onInteraction(type);\n });\n });\n });\n }\n}","import { createSetHandler, isServer } from './utils';\nimport { onVisibilityOrOnlineChange } from './queryCache';\nexport var setFocusHandler = createSetHandler(function () {\n return onVisibilityOrOnlineChange('focus');\n});\nsetFocusHandler(function (handleFocus) {\n var _window;\n\n if (isServer || !((_window = window) == null ? void 0 : _window.addEventListener)) {\n return;\n } // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', handleFocus, false);\n window.addEventListener('focus', handleFocus, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', handleFocus);\n window.removeEventListener('focus', handleFocus);\n };\n});","import { createSetHandler, isServer } from './utils';\nimport { onVisibilityOrOnlineChange } from './queryCache';\nexport var setOnlineHandler = createSetHandler(function () {\n return onVisibilityOrOnlineChange('online');\n});\nsetOnlineHandler(function (handleOnline) {\n var _window;\n\n if (isServer || !((_window = window) == null ? void 0 : _window.addEventListener)) {\n return;\n } // Listen to online\n\n\n window.addEventListener('online', handleOnline, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', handleOnline);\n };\n});","import ReactDOM from 'react-dom';\nexport var unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates;","import React from 'react';\nimport { QueryCache, queryCache as defaultQueryCache, queryCaches } from '../core';\nvar queryCacheContext = /*#__PURE__*/React.createContext(defaultQueryCache);\nexport var useQueryCache = function useQueryCache() {\n return React.useContext(queryCacheContext);\n};\nexport var ReactQueryCacheProvider = function ReactQueryCacheProvider(_ref) {\n var queryCache = _ref.queryCache,\n children = _ref.children;\n var resolvedQueryCache = React.useMemo(function () {\n return queryCache || new QueryCache();\n }, [queryCache]);\n React.useEffect(function () {\n queryCaches.push(resolvedQueryCache);\n return function () {\n // remove the cache from the active list\n var i = queryCaches.indexOf(resolvedQueryCache);\n\n if (i > -1) {\n queryCaches.splice(i, 1);\n } // if the resolvedQueryCache was created by us, we need to tear it down\n\n\n if (queryCache == null) {\n resolvedQueryCache.clear({\n notify: false\n });\n }\n };\n }, [resolvedQueryCache, queryCache]);\n return /*#__PURE__*/React.createElement(queryCacheContext.Provider, {\n value: resolvedQueryCache\n }, children);\n};","import React from 'react';\nimport { mergeReactQueryConfigs } from '../core/config';\nvar configContext = /*#__PURE__*/React.createContext(undefined);\nexport function useContextConfig() {\n return React.useContext(configContext);\n}\nexport var ReactQueryConfigProvider = function ReactQueryConfigProvider(_ref) {\n var config = _ref.config,\n children = _ref.children;\n var parentConfig = useContextConfig();\n var mergedConfig = React.useMemo(function () {\n return parentConfig ? mergeReactQueryConfigs(parentConfig, config) : config;\n }, [config, parentConfig]);\n return /*#__PURE__*/React.createElement(configContext.Provider, {\n value: mergedConfig\n }, children);\n};","import React from 'react'; // CONTEXT\n\nfunction createValue() {\n var _isReset = false;\n return {\n clearReset: function clearReset() {\n _isReset = false;\n },\n reset: function reset() {\n _isReset = true;\n },\n isReset: function isReset() {\n return _isReset;\n }\n };\n}\n\nvar context = /*#__PURE__*/React.createContext(createValue()); // HOOK\n\nexport var useErrorResetBoundary = function useErrorResetBoundary() {\n return React.useContext(context);\n}; // COMPONENT\n\nexport var ReactQueryErrorResetBoundary = function ReactQueryErrorResetBoundary(_ref) {\n var children = _ref.children;\n var value = React.useMemo(function () {\n return createValue();\n }, []);\n return /*#__PURE__*/React.createElement(context.Provider, {\n value: value\n }, typeof children === 'function' ? children(value) : children);\n};","import React from 'react';\nimport { isServer } from '../core/utils';\nexport function useIsMounted() {\n var mountedRef = React.useRef(false);\n var isMounted = React.useCallback(function () {\n return mountedRef.current;\n }, []);\n React[isServer ? 'useEffect' : 'useLayoutEffect'](function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return isMounted;\n}\nexport function useMountedCallback(callback) {\n var isMounted = useIsMounted();\n return React.useCallback(function () {\n if (isMounted()) {\n return callback.apply(void 0, arguments);\n }\n }, [callback, isMounted]);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport React from 'react';\nimport { useMountedCallback } from './utils';\nimport { getResolvedMutationConfig } from '../core/config';\nimport { Console, uid, getStatusProps } from '../core/utils';\nimport { QueryStatus } from '../core/types';\nimport { useQueryCache } from './ReactQueryCacheProvider';\nimport { useContextConfig } from './ReactQueryConfigProvider'; // TYPES\n\nfunction _await(value, then, direct) {\n if (direct) {\n return then ? then(value) : value;\n }\n\n if (!value || !value.then) {\n value = Promise.resolve(value);\n }\n\n return then ? value.then(then) : value;\n}\n\nvar ActionType = {\n Reset: 0,\n Loading: 1,\n Resolve: 2,\n Reject: 3\n};\n\n// HOOK\nfunction _catch(body, recover) {\n try {\n var result = body();\n } catch (e) {\n return recover(e);\n }\n\n if (result && result.then) {\n return result.then(void 0, recover);\n }\n\n return result;\n}\n\nfunction _async(f) {\n return function () {\n for (var args = [], i = 0; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n\n try {\n return Promise.resolve(f.apply(this, args));\n } catch (e) {\n return Promise.reject(e);\n }\n };\n}\n\nfunction getDefaultState() {\n return _extends({}, getStatusProps(QueryStatus.Idle), {\n data: undefined,\n error: null\n });\n}\n\nfunction mutationReducer(state, action) {\n switch (action.type) {\n case ActionType.Reset:\n return getDefaultState();\n\n case ActionType.Loading:\n return _extends({}, getStatusProps(QueryStatus.Loading), {\n data: undefined,\n error: null\n });\n\n case ActionType.Resolve:\n return _extends({}, getStatusProps(QueryStatus.Success), {\n data: action.data,\n error: null\n });\n\n case ActionType.Reject:\n return _extends({}, getStatusProps(QueryStatus.Error), {\n data: undefined,\n error: action.error\n });\n\n default:\n return state;\n }\n}\n\nexport function useMutation(mutationFn, config) {\n if (config === void 0) {\n config = {};\n }\n\n var cache = useQueryCache();\n var contextConfig = useContextConfig(); // Get resolved config\n\n var resolvedConfig = getResolvedMutationConfig(cache, contextConfig, config);\n\n var _React$useReducer = React.useReducer(mutationReducer, null, getDefaultState),\n state = _React$useReducer[0],\n unsafeDispatch = _React$useReducer[1];\n\n var dispatch = useMountedCallback(unsafeDispatch);\n var latestMutationRef = React.useRef();\n var latestMutationFnRef = React.useRef(mutationFn);\n latestMutationFnRef.current = mutationFn;\n var latestConfigRef = React.useRef(resolvedConfig);\n latestConfigRef.current = resolvedConfig;\n var mutate = React.useCallback(_async(function (variables, mutateConfig) {\n if (mutateConfig === void 0) {\n mutateConfig = {};\n }\n\n var latestConfig = latestConfigRef.current;\n var mutationId = uid();\n latestMutationRef.current = mutationId;\n\n var isLatest = function isLatest() {\n return latestMutationRef.current === mutationId;\n };\n\n var snapshotValue;\n return _catch(function () {\n dispatch({\n type: ActionType.Loading\n });\n return _await(latestConfig.onMutate == null ? void 0 : latestConfig.onMutate(variables), function (_latestConfig$onMutat) {\n snapshotValue = _latestConfig$onMutat;\n var latestMutationFn = latestMutationFnRef.current;\n return _await(latestMutationFn(variables), function (data) {\n if (isLatest()) {\n dispatch({\n type: ActionType.Resolve,\n data: data\n });\n }\n\n return _await(latestConfig.onSuccess == null ? void 0 : latestConfig.onSuccess(data, variables), function () {\n return _await(mutateConfig.onSuccess == null ? void 0 : mutateConfig.onSuccess(data, variables), function () {\n return _await(latestConfig.onSettled == null ? void 0 : latestConfig.onSettled(data, null, variables), function () {\n return _await(mutateConfig.onSettled == null ? void 0 : mutateConfig.onSettled(data, null, variables), function () {\n return data;\n });\n });\n });\n });\n });\n });\n }, function (error) {\n Console.error(error);\n return _await(latestConfig.onError == null ? void 0 : latestConfig.onError(error, variables, snapshotValue), function () {\n return _await(mutateConfig.onError == null ? void 0 : mutateConfig.onError(error, variables, snapshotValue), function () {\n return _await(latestConfig.onSettled == null ? void 0 : latestConfig.onSettled(undefined, error, variables, snapshotValue), function () {\n return _await(mutateConfig.onSettled == null ? void 0 : mutateConfig.onSettled(undefined, error, variables, snapshotValue), function () {\n if (isLatest()) {\n dispatch({\n type: ActionType.Reject,\n error: error\n });\n }\n\n if (mutateConfig.throwOnError || latestConfig.throwOnError) {\n throw error;\n }\n });\n });\n });\n });\n });\n }), [dispatch]);\n React.useEffect(function () {\n var latestConfig = latestConfigRef.current;\n var suspense = latestConfig.suspense,\n useErrorBoundary = latestConfig.useErrorBoundary;\n\n if ((useErrorBoundary || suspense) && state.error) {\n throw state.error;\n }\n }, [state.error]);\n var reset = React.useCallback(function () {\n dispatch({\n type: ActionType.Reset\n });\n }, [dispatch]);\n\n var result = _extends({}, state, {\n reset: reset\n });\n\n return [mutate, result];\n}","import React from 'react';\nimport { useIsMounted } from './utils';\nimport { getResolvedQueryConfig } from '../core/config';\nimport { QueryObserver } from '../core/queryObserver';\nimport { useErrorResetBoundary } from './ReactQueryErrorResetBoundary';\nimport { useQueryCache } from './ReactQueryCacheProvider';\nimport { useContextConfig } from './ReactQueryConfigProvider';\nexport function useBaseQuery(queryKey, config) {\n var _React$useReducer = React.useReducer(function (c) {\n return c + 1;\n }, 0),\n rerender = _React$useReducer[1];\n\n var isMounted = useIsMounted();\n var cache = useQueryCache();\n var contextConfig = useContextConfig();\n var errorResetBoundary = useErrorResetBoundary(); // Get resolved config\n\n var resolvedConfig = getResolvedQueryConfig(cache, queryKey, contextConfig, config); // Create query observer\n\n var observerRef = React.useRef();\n var firstRender = !observerRef.current;\n var observer = observerRef.current || new QueryObserver(resolvedConfig);\n observerRef.current = observer; // Subscribe to the observer\n\n React.useEffect(function () {\n errorResetBoundary.clearReset();\n return observer.subscribe(function () {\n if (isMounted()) {\n rerender();\n }\n });\n }, [isMounted, observer, rerender, errorResetBoundary]); // Update config\n\n if (!firstRender) {\n observer.updateConfig(resolvedConfig);\n }\n\n var result = observer.getCurrentResult(); // Handle suspense\n\n if (resolvedConfig.suspense || resolvedConfig.useErrorBoundary) {\n var query = observer.getCurrentQuery();\n\n if (result.isError && !errorResetBoundary.isReset() && query.state.throwInErrorBoundary) {\n throw result.error;\n }\n\n if (resolvedConfig.enabled && resolvedConfig.suspense && !result.isSuccess) {\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe();\n throw observer.fetch().finally(unsubscribe);\n }\n }\n\n return result;\n}","import { getQueryArgs } from '../core/utils';\nimport { useBaseQuery } from './useBaseQuery'; // TYPES\n\n// Implementation\nexport function useQuery(arg1, arg2, arg3) {\n var _getQueryArgs = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs[0],\n config = _getQueryArgs[1];\n\n return useBaseQuery(queryKey, config);\n}","import { setBatchedUpdates } from './core/index';\nimport { unstable_batchedUpdates } from './react/reactBatchedUpdates';\nsetBatchedUpdates(unstable_batchedUpdates);\nexport * from './core/index';\nexport * from './react/index';","export const panelUsesVariable = (sql: string, variableName: string): boolean => {\n return sql.includes(`\\${${variableName}`);\n};\n\nexport const panelUsesMacro = (sql: string): boolean => {\n const timeToRegEx = RegExp(/\\$__timeTo()/g);\n const timeFromRegEx = RegExp(/\\$__timeFrom()/g);\n const timeFilterRegEx = RegExp(/\\$__timeFilter\\([a-zA-Z]+\\)/g);\n\n return timeToRegEx.test(sql) || timeFromRegEx.test(sql) || timeFilterRegEx.test(sql);\n};\n\nexport const panelUsesUnsupportedMacro = (sql: string) => {\n // Match all macros starting with $__ except supported ones: timeFrom, timeTo, timeFilter\n const regexp = RegExp(/(?!.*\\$__timeFrom\\(\\).*)(?!.*\\$__timeTo\\(\\).*)(?!.*\\$__timeFilter\\(.+\\).*)(\\$__.*)/g);\n return regexp.test(sql);\n};\n","export enum ReportGroupKey {\n NAME = 'name',\n DESCRIPTION = 'description',\n ID = 'id',\n}\n\nexport enum ScheduleKey {\n NAME = 'name',\n DESCRIPTION = 'description',\n ID = 'id',\n INTERVAL = 'interval',\n REPORT_GROUP_ID = 'reportGroupID',\n TIME_OF_DAY = 'time',\n DAY_OF_INTERVAL = 'day',\n}\n\nexport enum ReportContentKey {\n ID = 'id',\n LOOKBACK = 'lookback',\n PANEL_ID = 'panelID',\n VARIABLES = 'variables',\n}\n","import { SelectableValue } from '@grafana/data';\nimport { panelUsesVariable, panelUsesUnsupportedMacro } from './common/utils/checkers';\nimport { DashboardResponse, DashboardMeta, CreateContentVars, ReportContent, SelectableVariable } from './common/types';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Variable, Panel, ReportGroupMember, Schedule, Store, ReportGroup, User } from 'common/types';\n\nexport const refreshPanelOptions = async (\n variable: Variable,\n datasourceID: number\n): Promise>> => {\n const { definition, name } = variable;\n const optionsResponse = await getBackendSrv().post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: definition,\n format: 'table',\n },\n ],\n });\n\n const rows = optionsResponse.results?.A?.tables?.[0]?.rows?.flat().map((datum: string) => {\n const selectableVariable = { name, value: datum } as SelectableVariable;\n const selectableValue = { label: datum, value: selectableVariable } as SelectableValue;\n\n return selectableValue;\n });\n\n return rows;\n};\n\nexport const sendTestEmail = (scheduleID: string) =>\n getBackendSrv().get(`api/plugins/msupplyfoundation-datasource/resources/test-email?schedule-id=${scheduleID}`);\n\nexport const getGroupMembers = (_: string, groupId: string): Promise =>\n getBackendSrv().get(\n `api/plugins/msupplyfoundation-datasource/resources/report-group-membership/?group-id=${groupId}`\n );\n\nexport const getReportGroups = (): Promise =>\n getBackendSrv().get('api/plugins/msupplyfoundation-datasource/resources/report-group');\n\nexport const getUsers = (datasourceID: number): Promise => {\n return getBackendSrv()\n .post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: 'SELECT id, name, first_name, last_name, e_mail FROM \"user\"',\n format: 'table',\n },\n ],\n })\n .then(result => {\n const {\n results: {\n A: {\n tables: [{ rows, columns }],\n },\n },\n } = result;\n\n const columnsToExtract = ['id', 'name', 'first_name', 'last_name', 'e_mail'];\n const indexes = columns.reduce((acc: number[], { text }: any, i: number) => {\n if (columnsToExtract.includes(text)) {\n return [...acc, i];\n }\n return acc;\n }, []);\n\n return rows.map((rowData: any) => {\n return indexes.reduce((acc: any, value: any, i: any) => {\n return { ...acc, [columns[value].text]: rowData[i] };\n }, {});\n });\n });\n};\n\nexport const getStores = (datasourceID: number): Promise => {\n return getBackendSrv()\n .post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: 'SELECT id, name, code FROM \"store\"',\n format: 'table',\n },\n ],\n })\n .then(result => {\n const {\n results: {\n A: {\n tables: [{ rows, columns }],\n },\n },\n } = result;\n\n const columnsToExtract = ['id', 'name', 'code'];\n const indexes = columns.reduce((acc: number[], { text }: any, i: number) => {\n if (columnsToExtract.includes(text)) {\n return [...acc, i];\n }\n return acc;\n }, []);\n\n return rows.map((rowData: any) => {\n return indexes.reduce((acc: any, value: any, i: any) => {\n return { ...acc, [columns[value].text]: rowData[i] };\n }, {});\n });\n });\n};\n\nexport const createReportGroupMembership = async (params: any) => {\n const { user, reportGroupID } = params;\n\n const membership = { userID: user.id, reportGroupID };\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/report-group-membership', [\n membership,\n ]);\n};\n\nexport const deleteReportGroupMembership = async (reportGroupMembership: ReportGroupMember) => {\n const { id } = reportGroupMembership;\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-group-membership/${id}`);\n};\n\nexport const updateReportGroup = async (reportGroup: any) => {\n return getBackendSrv().put(\n `./api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroup?.id}`,\n reportGroup\n );\n};\n\nexport const deleteReportGroup = async (reportGroup: ReportGroup) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroup?.id}`);\n};\n\nexport const createReportGroup = async () => {\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/report-group');\n};\n\nexport const getSchedules = async () => {\n return getBackendSrv().get('./api/plugins/msupplyfoundation-datasource/resources/schedule');\n};\n\nexport const createSchedule = async () => {\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/schedule');\n};\n\nexport const deleteSchedule = async (schedule: Schedule) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/schedule/${schedule?.id}`);\n};\n\nexport const getReportContent = async (_: string, scheduleID: string) => {\n const content: ReportContent[] = await getBackendSrv().get(\n `./api/plugins/msupplyfoundation-datasource/resources/report-content?schedule-id=${scheduleID}`\n );\n return content;\n};\n\nexport const getDashboards = async () => {\n const dashboardMeta = await searchForDashboards();\n const dashboardResponses = await Promise.all(dashboardMeta.map(({ uid }) => getDashboard(uid)));\n return dashboardResponses.map(({ dashboard }) => dashboard);\n};\n\nexport const getDashboard = async (uuid: string): Promise => {\n return getBackendSrv().get(`./api/dashboards/uid/${uuid}`);\n};\n\nexport const searchForDashboards = async (): Promise => {\n return getBackendSrv().get('./api/search');\n};\n\nexport const getDatasource = async (id: number) => {\n return getBackendSrv().get(`./api/datasources/${id}`);\n};\n\nexport const getPanels = async (datasourceID: number): Promise => {\n const dashboards = (await getDashboards()) ?? [];\n const datasource = await getDatasource(datasourceID);\n const { name: datasourceName = '' } = datasource ?? {};\n\n const panels: Panel[] = dashboards\n .filter(({ panels }) => panels?.length > 0)\n .map(({ panels, templating, uid }) => {\n const mappedPanels = panels\n .filter(({ type }) => type === 'table' || type === 'table-old' || type === 'msupplyfoundation-table')\n .map(rawPanel => {\n const { targets } = rawPanel;\n const [target] = targets;\n const { rawSql } = target;\n\n const { list } = templating;\n\n // Want to filter out any panel which uses variables which aren't supported\n // Supported variables are custom and query types where the query type must\n // use the datasource specified in mSupply App Configuration.\n const unusableVariables = list.filter((variable: Variable) => {\n const { datasource, type } = variable;\n if (type === 'datasource' || type === 'adhoc') {\n return true;\n } else if (type === 'query') {\n return datasourceName !== datasource;\n } else {\n return false;\n }\n });\n\n const usesUnusableVariables = unusableVariables.some(variable => {\n const { name: variableName } = variable;\n return panelUsesVariable(rawSql, variableName);\n });\n\n let error = '';\n if (usesUnusableVariables) {\n error = 'This panel uses an unsupported variable.';\n } else if (panelUsesUnsupportedMacro(rawSql)) {\n error = 'This panel uses an unsupported macro.';\n }\n\n return { ...rawPanel, error };\n })\n .map(({ targets, description, title, id, type, error }) => {\n const [target] = targets;\n const { rawSql } = target;\n\n const dashboardID = uid;\n\n const { list } = templating;\n\n const variables =\n list?.reduce((acc: any, variable: Variable) => {\n if (panelUsesVariable(rawSql, variable.name)) {\n return [...acc, variable];\n } else {\n return acc;\n }\n }, []) ?? [];\n\n const mappedPanel = { error, rawSql, description, title, id, variables, dashboardID, type };\n\n return mappedPanel;\n });\n return mappedPanels;\n })\n .flat();\n\n return panels;\n};\n\nexport const updateSchedule = async (schedule: Schedule) => {\n return getBackendSrv().put(`./api/plugins/msupplyfoundation-datasource/resources/schedule/${schedule?.id}`, schedule);\n};\n\nexport const createReportContent = async (contents: CreateContentVars) => {\n return getBackendSrv().post(`./api/plugins/msupplyfoundation-datasource/resources/report-content`, contents);\n};\n\nexport const deleteReportContent = async (contents: any) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-content/${contents?.id}`);\n};\n\nexport const updateReportContent = async (reportContent: any) => {\n return getBackendSrv().put(\n `./api/plugins/msupplyfoundation-datasource/resources/report-content/${reportContent?.id}`,\n reportContent\n );\n};\n\nexport const getDatasources = async () => {\n return getBackendSrv().get(`./api/datasources`);\n};\n\nexport const getSettings = async (id: any) => {\n return getBackendSrv().get(`/api/plugins/${id}/settings`);\n};\n","import React, { FC } from 'react';\n\nimport { FieldValidationMessage, InlineFormLabel, Input } from '@grafana/ui';\n\ntype Props = {\n label: string;\n defaultValue: string | number;\n placeholder?: string;\n inputName: string;\n invalid: boolean;\n errorMessage: string;\n tooltip: string;\n register: any;\n type?: string;\n};\n\nexport const FieldInput: FC = ({\n tooltip,\n type = 'text',\n label,\n register,\n defaultValue,\n placeholder,\n inputName,\n invalid,\n errorMessage,\n}) => {\n return (\n
    \n \n {label}\n \n
    \n \n\n {invalid && (\n
    \n {errorMessage}\n
    \n )}\n
    \n
    \n );\n};\n","import React, { FC } from 'react';\n\nimport { InlineFormLabel, Select } from '@grafana/ui';\nimport { SelectableValue } from '@grafana/data';\n\ntype Props = {\n tooltip: string;\n value: any;\n options: SelectableValue[];\n onChange: (selected: SelectableValue) => void;\n label: string;\n};\n\nexport const FieldSelect: FC = ({ tooltip, value, options, onChange, label }) => {\n return (\n
    \n \n {label}\n \n
    \n \n \n \n );\n }\n\n return ;\n};\n","import { css } from '@emotion/css';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, CallToActionCard, Icon, IconName, LinkButton } from '@grafana/ui';\nimport React, { MouseEvent } from 'react';\n\ninterface Props {\n title: string;\n buttonIcon: IconName;\n buttonLink?: string;\n buttonTitle: string;\n buttonDisabled?: boolean;\n onClick?: (event: MouseEvent) => void;\n proTip?: string;\n proTipLink?: string;\n proTipLinkTitle?: string;\n proTipTarget?: string;\n infoBox?: { __html: string };\n infoBoxTitle?: string;\n}\n\nconst ctaStyle = css`\n text-align: center;\n`;\n\nconst infoBoxStyles = css`\n max-width: 700px;\n margin: 0 auto;\n`;\n\nconst EmptyListCTA = ({\n title,\n buttonIcon,\n buttonLink,\n buttonTitle,\n buttonDisabled,\n onClick,\n proTip,\n proTipLink,\n proTipLinkTitle,\n proTipTarget,\n infoBox,\n infoBoxTitle,\n}: Props) => {\n const footer = () => {\n return (\n <>\n {proTip ? (\n \n \n <> ProTip: {proTip} \n {proTipLink && (\n \n {proTipLinkTitle}\n \n )}\n \n ) : (\n ''\n )}\n {infoBox ? (\n
    \n {infoBoxTitle &&
    {infoBoxTitle}
    }\n
    \n
    \n ) : (\n ''\n )}\n \n );\n };\n\n const ctaElementClassName = !footer()\n ? css`\n margin-bottom: 20px;\n `\n : '';\n\n const ButtonEl = buttonLink ? LinkButton : Button;\n\n const CallToActionElement = (\n \n {buttonTitle}\n \n );\n\n return (\n \n );\n};\n\nexport { EmptyListCTA };\n","import React, { useMemo } from 'react';\nimport { css } from '@emotion/css';\nimport { useStyles2, Button, ButtonVariant, Icon } from '@grafana/ui';\n\nexport interface Props {\n /** The current page index being shown. */\n currentPage: number;\n /** Number of total pages. */\n numberOfPages: number;\n /** Callback function for fetching the selected page. */\n onNavigate: (toPage: number) => void;\n /** When set to true and the pagination result is only one page it will not render the pagination at all. */\n hideWhenSinglePage?: boolean;\n /** Small version only shows the current page and the navigation buttons. */\n showSmallVersion?: boolean;\n}\n\nexport const Pagination: React.FC = ({\n currentPage,\n numberOfPages,\n onNavigate,\n hideWhenSinglePage,\n showSmallVersion,\n}) => {\n const styles = useStyles2(getStyles);\n const pageLengthToCondense = showSmallVersion ? 1 : 8;\n\n const pageButtons = useMemo(() => {\n const pages = [...new Array(numberOfPages).keys()];\n\n const condensePages = numberOfPages > pageLengthToCondense;\n const getListItem = (page: number, variant: 'primary' | 'secondary') => (\n
  • \n \n
  • \n );\n\n return pages.reduce((pagesToRender, pageIndex) => {\n const page = pageIndex + 1;\n const variant: ButtonVariant = page === currentPage ? 'primary' : 'secondary';\n\n // The indexes at which to start and stop condensing pages\n const lowerBoundIndex = pageLengthToCondense;\n const upperBoundIndex = numberOfPages - pageLengthToCondense + 1;\n // When the indexes overlap one another this number is negative\n const differenceOfBounds = upperBoundIndex - lowerBoundIndex;\n\n const isFirstOrLastPage = page === 1 || page === numberOfPages;\n // This handles when the lowerBoundIndex < currentPage < upperBoundIndex\n const currentPageIsBetweenBounds =\n differenceOfBounds > -1 && currentPage >= lowerBoundIndex && currentPage <= upperBoundIndex;\n\n // Show ellipsis after that many pages\n const ellipsisOffset = showSmallVersion ? 1 : 3;\n\n // The offset to show more pages when currentPageIsBetweenBounds\n const pageOffset = showSmallVersion ? 0 : 2;\n\n if (condensePages) {\n if (\n isFirstOrLastPage ||\n (currentPage < lowerBoundIndex && page < lowerBoundIndex) ||\n (differenceOfBounds >= 0 && currentPage > upperBoundIndex && page > upperBoundIndex) ||\n (differenceOfBounds < 0 && currentPage >= lowerBoundIndex && page > upperBoundIndex) ||\n (currentPageIsBetweenBounds && page >= currentPage - pageOffset && page <= currentPage + pageOffset)\n ) {\n // Renders a button for the page\n pagesToRender.push(getListItem(page, variant));\n } else if (\n (page === lowerBoundIndex && currentPage < lowerBoundIndex) ||\n (page === upperBoundIndex && currentPage > upperBoundIndex) ||\n (currentPageIsBetweenBounds &&\n (page === currentPage - ellipsisOffset || page === currentPage + ellipsisOffset))\n ) {\n // Renders and ellipsis to represent condensed pages\n pagesToRender.push(\n
  • \n \n
  • \n );\n }\n } else {\n pagesToRender.push(getListItem(page, variant));\n }\n return pagesToRender;\n }, []);\n }, [currentPage, numberOfPages, onNavigate, pageLengthToCondense, showSmallVersion, styles.ellipsis, styles.item]);\n\n if (hideWhenSinglePage && numberOfPages <= 1) {\n return null;\n }\n\n return (\n
    \n
      \n
    1. \n onNavigate(currentPage - 1)}\n disabled={currentPage === 1}\n >\n \n \n
    2. \n {pageButtons}\n
    3. \n onNavigate(currentPage + 1)}\n disabled={currentPage === numberOfPages}\n >\n \n \n
    4. \n
    \n
    \n );\n};\n\nconst getStyles = () => {\n return {\n container: css`\n float: right;\n `,\n item: css`\n display: inline-block;\n padding-left: 10px;\n margin-bottom: 5px;\n `,\n ellipsis: css`\n transform: rotate(90deg);\n `,\n };\n};\n","import React, { FC } from 'react';\nimport { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { IconName, LinkButton, useStyles2 } from '@grafana/ui';\nimport { HeaderPropsType } from './Page';\n\nconst PageHeader: FC = (props) => {\n const styles = useStyles2(getStyles);\n\n return (\n
    \n
    \n
    {renderHeaderTitle(props)}
    \n {props.backButton && (\n \n Back\n \n )}\n
    \n
    \n );\n};\n\nfunction renderHeaderTitle({ title, subTitle }: HeaderPropsType) {\n return (\n
    \n
    \n

    {title}

    \n {subTitle &&
    {subTitle}
    }\n
    \n
    \n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n headerCanvas: css`\n background: ${theme.colors.background.canvas};\n `,\n});\n\nexport { PageHeader };\n","// Libraries\nimport React, { FC, HTMLAttributes } from 'react';\n\nimport { CustomScrollbar, useStyles2 } from '@grafana/ui';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { PageHeader } from './PageHeader';\nimport { PageContents } from './PageContents';\n\ninterface Props extends HTMLAttributes {\n children: React.ReactNode;\n headerProps?: HeaderPropsType;\n}\n\nexport interface HeaderPropsType {\n title: string;\n subTitle: string;\n backButton?: {\n icon: string;\n href: string;\n };\n}\n\nexport interface PageType extends FC {\n Contents: typeof PageContents;\n}\n\nexport const Page: PageType = ({ headerProps, children, className, ...otherProps }) => {\n const styles = useStyles2(getStyles);\n\n return (\n
    \n \n
    \n {headerProps && }\n {children}\n
    \n
    \n
    \n );\n};\n\nPage.Contents = PageContents;\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n width: 100%;\n flex-grow: 1;\n min-height: 0;\n `,\n});\n","// Libraries\nimport React, { FC } from 'react';\nimport { cx } from '@emotion/css';\n\ninterface Props {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const PageContents: FC = ({ children, className }) => {\n return (\n
    \n {children}\n
    \n );\n};\n","import React, { HTMLAttributes } from 'react';\nimport { css } from '@emotion/css';\nimport { LoadingPlaceholder, useStyles2 } from '@grafana/ui';\n\ninterface LoadingPlaceholderProps extends HTMLAttributes {\n text?: React.ReactNode;\n}\n\nconst Loading: React.FC = ({ text = 'loading...', ...rest }: LoadingPlaceholderProps) => {\n const style = useStyles2(getStyles);\n\n return (\n
    \n \n
    \n );\n};\n\nconst getStyles = () => ({\n loadingWrapper: css`\n display: flex;\n height: 50vh;\n align-items: center;\n justify-content: center;\n `,\n});\n\nexport { Loading, LoadingPlaceholderProps };\n","const en = require('./en.json');\n\n// TODO: Type this somehow\nexport const locales: any = {\n 'en-US': en,\n 'en-UK': {},\n};\n","import React, { useState, ChangeEvent, useEffect } from 'react';\nimport { Field, Input, FieldSet, Button, useStyles2, Select } from '@grafana/ui';\nimport { PluginConfigPageProps, AppPluginMeta, GrafanaTheme2, PluginMeta, SelectableValue } from '@grafana/data';\nimport { getBackendSrv, locationService } from '@grafana/runtime';\nimport intl from 'react-intl-universal';\nimport { useQuery } from 'react-query';\nimport { Loading, SecretInput } from './common';\nimport { css } from '@emotion/css';\nimport { locales } from '../locales';\nimport { AppConfigProps, AppConfigStateType } from 'types';\nimport { getDatasources } from 'api/getDatasource.api';\n\ninterface Props extends PluginConfigPageProps> {}\n\nconst AppConfigForm = ({ plugin }: Props) => {\n const style = useStyles2(getStyles);\n\n const [loading, setLoading] = useState(true);\n const { data: datasources, isLoading: isDatasourceListLoading } = useQuery('datasources', getDatasources);\n\n const { enabled, pinned, jsonData } = plugin.meta;\n\n const [state, setState] = useState({\n grafanaUsername: jsonData?.grafanaUsername || '',\n grafanaPassword: '',\n grafanaURL: jsonData?.grafanaURL || '',\n isGrafanaPasswordSet: Boolean(jsonData?.isGrafanaPasswordSet),\n senderEmailAddress: jsonData?.senderEmailAddress || '',\n senderEmailPassword: '',\n isSenderEmailPasswordSet: Boolean(jsonData?.isSenderEmailPasswordSet),\n senderEmailHost: jsonData?.senderEmailHost || '',\n senderEmailPort: jsonData?.senderEmailPort || 0,\n datasourceID: jsonData?.datasourceID || 0,\n });\n\n useEffect(() => {\n intl\n .init({\n currentLocale: 'en-US',\n locales,\n })\n .then(() => {\n // After loading locale data, start to render\n setLoading(false);\n });\n }, []);\n\n const onResetGrafanaPassword = () =>\n setState({\n ...state,\n grafanaPassword: '',\n isGrafanaPasswordSet: false,\n });\n\n const onResetSenderEmailPassword = () =>\n setState({\n ...state,\n senderEmailPassword: '',\n isSenderEmailPasswordSet: false,\n });\n\n const onChangeGrafanaPassword = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaPassword: event.target.value.trim(),\n });\n };\n\n const onChangeSenderEmailPassword = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailPassword: event.target.value.trim(),\n });\n };\n\n const onChangeGrafanaUsername = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaUsername: event.target.value.trim(),\n });\n };\n\n const onChangeGrafanaURL = (event: ChangeEvent) => {\n setState({\n ...state,\n grafanaURL: event.target.value.trim(),\n });\n };\n\n const onEmailAddressChange = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailAddress: event.target.value.trim(),\n });\n };\n\n const onSenderEmailHost = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailHost: event.target.value.trim(),\n });\n };\n\n const onSenderEmailPort = (event: ChangeEvent) => {\n setState({\n ...state,\n senderEmailPort: Number(event.target.value.trim()),\n });\n };\n\n if (loading || isDatasourceListLoading) {\n return ;\n }\n\n return (\n !loading && (\n
    \n {/* Grafana Username */}\n
    \n \n \n \n\n \n \n \n\n \n \n \n
    \n\n
    \n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n
    \n\n
    \n \n ({ label: datasource.name, value: datasource.id })) ?? []}\n onChange={(selectedDatasource: SelectableValue) => {\n setState({\n ...state,\n datasourceID: Number(selectedDatasource.value),\n });\n }}\n >\n \n
    \n\n
    \n \n updatePluginAndReload(plugin.meta.id, {\n enabled,\n pinned,\n jsonData: {\n grafanaUsername: state.grafanaUsername,\n grafanaURL: state.grafanaURL,\n isGrafanaPasswordSet: true,\n senderEmailAddress: state.senderEmailAddress,\n isSenderEmailPasswordSet: true,\n senderEmailHost: state.senderEmailHost,\n senderEmailPort: state.senderEmailPort,\n datasourceID: state.datasourceID,\n },\n secureJsonData:\n state.isGrafanaPasswordSet && state.isSenderEmailPasswordSet\n ? undefined\n : Object.fromEntries(\n Object.entries({\n grafanaPassword: state.grafanaPassword,\n senderEmailPassword: state.senderEmailPassword,\n }).filter(([_, v]) => v !== '')\n ),\n })\n }\n disabled={Boolean(\n !state.grafanaUsername ||\n (!state.isGrafanaPasswordSet && !state.grafanaPassword) ||\n (!state.isSenderEmailPasswordSet && !state.senderEmailPassword) ||\n !state.senderEmailAddress ||\n !state.senderEmailHost ||\n !state.senderEmailPort ||\n !state.grafanaURL ||\n !state.datasourceID\n )}\n >\n Save settings\n \n
    \n
    \n )\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n colorWeak: css`\n color: ${theme.colors.text.secondary};\n `,\n marginTop: css`\n margin-top: ${theme.spacing(3)};\n `,\n marginTopXl: css`\n margin-top: ${theme.spacing(6)};\n `,\n});\n\nconst updatePluginAndReload = async (pluginId: string, data: Partial>) => {\n try {\n await updatePlugin(pluginId, data);\n\n // Reloading the page as the changes made here wouldn't be propagated to the actual plugin otherwise.\n // This is not ideal, however unfortunately currently there is no supported way for updating the plugin state.\n locationService.reload();\n } catch (e) {\n console.error('Error while updating the plugin', e);\n }\n};\n\nexport const updatePlugin = async (pluginId: string, data: Partial) => {\n await getBackendSrv().post(`/api/plugins/${pluginId}/resources/settings`, {\n ...data.jsonData,\n ...data.secureJsonData,\n });\n const response = await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data);\n return response?.data;\n};\n\nexport { AppConfigForm };\n","import React, { useState, useCallback, useEffect } from 'react';\nimport {\n InlineField,\n Input,\n Icon,\n InlineSwitch,\n VerticalGroup,\n HorizontalGroup,\n Checkbox,\n Tag,\n FieldSet,\n EmptySearchResult,\n useStyles2,\n Alert,\n} from '@grafana/ui';\nimport { User } from '../types';\n\nimport { Pagination } from './common/Pagination';\n\nimport { css } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\n\nconst pageLimit = 20;\n\ntype UserListProps = {\n users: User[];\n userListError: any;\n onUserChecked: (event: React.FormEvent, userID: string) => void;\n checkedUsers: string[];\n};\n\nconst UserList: React.FC = ({ users, userListError, onUserChecked, checkedUsers }) => {\n const styles = useStyles2(getStyles);\n const [data, setData] = useState(users);\n const [searchQuery, setSearchQuery] = useState('');\n const [isNoEmailUsersHidden, setIsNoEmailUsersHidden] = useState(true);\n\n const [paginationStates, setPaginationStates] = useState({\n totalPages: 1,\n currentPage: 1,\n });\n\n const renderUser = (user: User) => {\n return (\n \n \n
    \n onUserChecked(event, user.id)}\n label=\"\"\n />\n
    \n \n \n
    {user.name}
    \n \n \n
    0 ? undefined : 'Empty email cell'}>\n {user.e_mail}\n
    \n \n \n );\n };\n\n const onIsNoEmailUsersHiddenChange = useCallback(\n (e) => {\n setIsNoEmailUsersHidden(e.currentTarget.checked);\n },\n [setIsNoEmailUsersHidden]\n );\n\n useEffect(() => {\n const getPaginatedUsers = (users: User[] | undefined) => {\n const offset = (paginationStates.currentPage - 1) * pageLimit;\n return users?.slice(offset, offset + pageLimit);\n };\n\n const filteredUser = users\n ?.filter((user) => {\n if (isNoEmailUsersHidden) {\n return user.e_mail !== '';\n }\n return true;\n })\n .filter((user) => {\n const match = user.name.toString().toLowerCase().indexOf(searchQuery.toLowerCase()) > -1;\n return match;\n });\n\n const data = getPaginatedUsers(filteredUser);\n const totalPages = Math.ceil(filteredUser.length / pageLimit);\n\n setPaginationStates((paginationStates) => ({\n ...paginationStates,\n currentPage: paginationStates.currentPage > totalPages ? 1 : paginationStates.currentPage,\n totalPages: filteredUser ? totalPages : 1,\n }));\n\n setData(data);\n }, [users, isNoEmailUsersHidden, searchQuery, paginationStates.currentPage]);\n\n return (\n <>\n
    \n
    \n {checkedUsers.length > 0 ? (\n \n {checkedUsers.map((userID) => {\n const user = users.find((user) => user.id === userID);\n return `} />;\n })}\n \n ) : (\n You have not selected any member(s) yet\n )}\n
    \n
    \n\n
    \n
    \n
    \n \n \n }\n suffix={ setSearchQuery('')} />}\n id=\"search-query\"\n name=\"search-query\"\n placeholder=\"Search users\"\n onChange={(e: any) => setSearchQuery(e.target.value)}\n />\n \n \n \n \n \n
    \n
    \n
    \n\n
    \n \n {userListError && (\n \n You must select at least one user\n \n )}\n \n \n \n \n \n \n \n {data?.map((user) => renderUser(user))}\n
    \n NameEmail
    \n \n \n setPaginationStates((paginationStates) => ({\n ...paginationStates,\n currentPage: page,\n }))\n }\n currentPage={paginationStates.currentPage}\n numberOfPages={paginationStates.totalPages}\n hideWhenSinglePage={true}\n />\n \n
    \n
    \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n checkboxWrapper: css`\n label {\n line-height: 1.2;\n }\n `,\n});\n\nexport { UserList };\n","import React, { useContext } from 'react';\nimport { Panel, PanelDetails, PanelListSelectedType } from 'types';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Checkbox, useStyles2 } from '@grafana/ui';\nimport { css } from '@emotion/css';\nimport { PanelContext } from 'context';\nimport { PanelVariables } from 'components';\n\ntype Props = {\n panel: Panel;\n onPanelChecked: (panel: Panel) => void;\n checkedPanels: PanelListSelectedType[];\n panelDetail: PanelDetails;\n};\n\nexport const PanelItem: React.FC = ({ panel, onPanelChecked, panelDetail, checkedPanels }) => {\n const styles = useStyles2(getStyles);\n const { title, description, error } = panel;\n\n const { onUpdateLookback, onUpdateVariable } = useContext(PanelContext);\n\n return (\n
  • \n
    \n {\n event.preventDefault();\n if (error) {\n return;\n }\n return onPanelChecked(panel);\n }}\n >\n
    \n {!error ? (\n {\n return checkedPanel.panelID === panel.id && checkedPanel.dashboardID === panel.dashboardID;\n })\n }\n />\n ) : null}\n
    \n
    \n
    {title}
    \n
    {description}
    \n
    \n
    \n\n \n
  • \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginForCheckbox: css`\n margin-right: 10px;\n `,\n});\n","import React, { useContext } from 'react';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Card, FieldSet, HorizontalGroup, Icon, Legend, Tag, Tooltip, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { Panel, PanelDetails, PanelListSelectedType } from 'types';\nimport intl from 'react-intl-universal';\nimport { Loading, PanelItem } from 'components';\nimport { PanelContext } from 'context';\n\n//const pageLimit = 20;\n\ntype PanelListProps = {\n panelListError: any;\n onPanelChecked: (panel: Panel) => void;\n checkedPanels: PanelListSelectedType[];\n};\n\nconst PanelList: React.FC = ({ panelListError, onPanelChecked, checkedPanels }) => {\n const styles = useStyles2(getStyles);\n\n const { panels, panelDetails } = useContext(PanelContext);\n\n if (!panels) {\n return ;\n }\n\n return (\n <>\n
    \n \n Selected panel(s)\n \n \n \n \n
    \n {!!checkedPanels && checkedPanels.length > 0 ? (\n \n {checkedPanels.map((checkedPanel) => {\n const panel = panels.find(\n (panel: Panel) =>\n panel.id === checkedPanel.panelID && panel.dashboardID === checkedPanel.dashboardID\n );\n if (!panel) {\n return false;\n }\n\n return (\n \n );\n })}\n \n ) : (\n
    You have not selected any panels(s) yet. Please select one or more panels from the list below
    \n )}\n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n {intl.get('available_panels')}\n
    \n
      \n {panels &&\n panelDetails &&\n panels?.map((panel: Panel, key: any) => (\n detail.panelID === panel.id && detail.dashboardID === panel.dashboardID\n )!\n }\n />\n ))}\n
    \n
    \n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n checkboxWrapper: css`\n label {\n line-height: 1.2;\n }\n `,\n list: cx('card-section', 'card-list-layout-grid', 'card-list-layout-list', 'card-list'),\n});\n\nexport { PanelList };\n","import { SelectableValue } from '@grafana/data';\nimport { InlineFormLabel, MultiSelect, Select } from '@grafana/ui';\nimport { refreshPanelOptions } from 'api';\nimport { useDatasourceID } from 'hooks';\nimport React from 'react';\nimport { useQuery } from 'react-query';\nimport { SelectableVariable, Variable } from 'types';\n\ntype Props = {\n onUpdate: (selected: SelectableValue) => void;\n name: string;\n multiSelectable: boolean;\n selectedOptions: string[];\n selectableOptions: Array>;\n variable: Variable;\n};\n\nexport const PanelVariableOptions: React.FC = ({\n onUpdate,\n name,\n multiSelectable,\n selectableOptions,\n variable,\n selectedOptions,\n}) => {\n const { refresh, includeAll } = variable;\n const datasourceID = useDatasourceID();\n\n const selectAllOption: SelectableValue = {\n value: '$__all',\n label: 'All',\n };\n\n // When a query variable is set to refresh, it does not by default have `options` pre-populated.\n // So, when refresh is true, query for the data and map it to the matching array.\n const { data } = useQuery(name, () => refreshPanelOptions(variable, datasourceID), {\n enabled: !!refresh,\n });\n\n const options =\n selectableOptions?.length > 0\n ? includeAll\n ? [selectAllOption, ...selectableOptions]\n : selectableOptions\n : includeAll\n ? data\n ? [selectAllOption, ...data]\n : [selectAllOption]\n : data;\n\n return (\n
    \n {name}\n {!multiSelectable ? (\n !!selectedOptions?.find((s1: any) => s1 === f.value.value))}\n onChange={(selected: SelectableValue) => {\n if (selected.value?.value === '$__all') {\n return onUpdate(selectableOptions);\n }\n\n onUpdate([selected]);\n }}\n options={options}\n />\n ) : (\n ) => {\n const isAll = selected.some(({ value }: SelectableValue) => value?.value === '$__all');\n if (isAll) {\n return onUpdate(selectableOptions);\n }\n\n onUpdate(selected);\n }}\n value={options?.filter(\n (option: SelectableValue) =>\n !!selectedOptions?.find((selected: string) => selected === option?.value?.value)\n )}\n filterOption={(option: SelectableValue, searchQuery: string) =>\n !!option?.label?.toLowerCase().includes(searchQuery.toLowerCase())\n }\n closeMenuOnSelect={false}\n options={options}\n />\n )}\n
    \n );\n};\n","import React from 'react';\nimport { SelectableValue } from '@grafana/data';\nimport { Tooltip, Icon, InlineFormLabel, Select } from '@grafana/ui';\nimport { getLookbacks } from '../../../constants';\n\nimport intl from 'react-intl-universal';\nimport { ContentVariables, Panel, PanelDetails, SelectableVariable, Variable, VariableOption } from 'types';\nimport { PanelVariableOptions } from './PanelVariableOptions';\nimport { panelUsesMacro, parseOrDefault } from 'utils';\nimport { PanelVariableTextInput } from 'components';\n\ntype Props = {\n panel: Panel;\n panelDetail: PanelDetails;\n onUpdateLookback: (selectedValue: SelectableValue) => void;\n onUpdateVariable: (variableName: string) => (selectedValue: SelectableValue) => void;\n};\n\nexport const PanelVariables: React.FC = ({ panel, onUpdateVariable, panelDetail, onUpdateLookback }) => {\n const lookbacks = getLookbacks();\n\n const vars = parseOrDefault(panelDetail?.variables, {});\n\n const usesMacro = panelUsesMacro(panel.rawSql);\n const usesVariables = panel.variables.length > 0;\n\n if (!(usesVariables || usesMacro)) {\n return null;\n }\n\n return (\n
    \n
    {intl.get('variables')}
    \n \n \n \n\n {usesMacro && (\n
    \n \n {intl.get('lookback_period')}\n \n ) => onUpdateLookback(selected)}\n />\n
    \n )}\n\n {panel.variables.map((variable: Variable) => {\n const { name, options: variableOptions, multi, label } = variable;\n\n // For a panels variables, find the ones which are selected from the\n // ReportContent.variables field, which is a stringified object consisting\n // of { [variable.name]: [Array of chosen options as strings] }\n // For example, a variable ${VEN} could have the `ReportContent.variables`\n // field { VEN: ['V', 'E'] }.\n const selected = vars[variable.name];\n\n // As well as mapping the current available options into a SelectedValue to\n const options: Array> = variableOptions.map((option: VariableOption) => {\n return { label: option.text, value: { name: variable.name, value: option.value } };\n });\n\n if (variable.type === 'textbox') {\n // Pre-fill with either the report content value that has been saved in the msupply sqlite,\n // or what is currently being used in the dashboard, as a default.\n const value = selected?.[0] ?? options[0]?.value?.value;\n return ;\n }\n\n return (\n \n );\n })}\n
    \n );\n};\n","import { SelectableValue } from '@grafana/data';\nimport { InlineFormLabel, Input } from '@grafana/ui';\n\nimport React, { FC } from 'react';\n\ntype Props = {\n onUpdate: (selected: SelectableValue) => void;\n name: string;\n value: string;\n};\n\nexport const PanelVariableTextInput: FC = ({ onUpdate, name, value }) => {\n return (\n
    \n {name}\n {\n const { value } = e.target as HTMLInputElement;\n onUpdate([{ value: { name, value } }]);\n }}\n />\n
    \n );\n};\n","import { Form, FormAPI, PageToolbar, Spinner, ToolbarButton } from '@grafana/ui';\nimport { createSchedule, getReportGroups, getScheduleByID, sendTestEmail } from 'api';\nimport { CreateScheduleFormPartial, Loading } from 'components';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { PanelContext } from 'context';\nimport React, { useContext } from 'react';\nimport { useMutation, useQuery } from 'react-query';\nimport { ScheduleType, ReportGroupType, PanelDetails } from 'types';\nimport { useHistory, useParams } from 'react-router-dom';\nimport { prefixRoute } from 'utils';\nimport intl from 'react-intl-universal';\n\nconst defaultFormValues: ScheduleType = {\n id: '',\n name: '',\n description: '',\n interval: 0,\n time: '',\n reportGroupID: '',\n day: 1,\n panels: [],\n panelDetails: [],\n};\n\nconst CreateScheduleForm: React.FC = () => {\n const { panelDetails, setPanelDetails, isPanelsLoading } = useContext(PanelContext);\n\n const [defaultSchedule, setDefaultSchedule] = React.useState(defaultFormValues);\n\n const history = useHistory();\n\n const { id: scheduleIdToEdit } = useParams<{ id: string }>();\n const isEditMode = !!scheduleIdToEdit;\n const [ready, setReady] = React.useState(false);\n const [isDefaultScheduleFetched, setIsDefaultScheduleFetched] = React.useState(false);\n\n const {\n data: defaultScheduleFetched,\n isLoading: isScheduleByIDLoading,\n isRefetching,\n } = useQuery(`schedules-${scheduleIdToEdit}`, () => getScheduleByID(scheduleIdToEdit), {\n enabled: isEditMode,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n onError: () => {\n history.push(`${PLUGIN_BASE_URL}/schedules/`);\n return;\n },\n });\n\n React.useEffect(() => {\n if (!isPanelsLoading && !!defaultScheduleFetched) {\n const { nextReportTime, ...restDefaultScheduleFetched } = defaultScheduleFetched;\n setDefaultSchedule({\n ...restDefaultScheduleFetched,\n });\n\n setPanelDetails((prevDetails: PanelDetails[]) =>\n prevDetails.map(\n (prevDetail: PanelDetails) =>\n defaultScheduleFetched.panelDetails.find(\n (defaultDetail) =>\n defaultDetail.panelID === prevDetail.panelID && defaultDetail.dashboardID === prevDetail.dashboardID\n ) || prevDetail\n )\n );\n\n setIsDefaultScheduleFetched(true);\n }\n }, [defaultScheduleFetched, isPanelsLoading, setPanelDetails]);\n\n React.useEffect(() => {\n if (!isEditMode) {\n setReady(true);\n setIsDefaultScheduleFetched(true);\n }\n\n if (!isPanelsLoading && isEditMode && !isRefetching && !isScheduleByIDLoading && isDefaultScheduleFetched) {\n setReady(true);\n }\n }, [isEditMode, isRefetching, isScheduleByIDLoading, isDefaultScheduleFetched, isPanelsLoading]);\n\n const { data: reportGroups } = useQuery(`reportGroups`, getReportGroups, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const createScheduleMutation = useMutation((newSchedule: ScheduleType) => createSchedule(newSchedule), {\n onSuccess: () => {\n history.push(`${PLUGIN_BASE_URL}/schedules/`);\n return;\n },\n });\n\n const { mutate: testEmails, isLoading: isSendTestEmailLoading } = useMutation(sendTestEmail);\n\n const submitCreateSchedule = (data: ScheduleType) => {\n const selectedPanels = panelDetails.filter((detail: PanelDetails) =>\n data.panels.find((panel) => panel.panelID === detail.panelID && panel.dashboardID === detail.dashboardID)\n );\n data.panelDetails = selectedPanels;\n createScheduleMutation.mutate(data);\n };\n\n if (!ready) {\n return ;\n }\n\n return (\n <>\n history.push(prefixRoute(ROUTES.SCHEDULES))}\n >\n {isEditMode &&\n (isSendTestEmailLoading ? (\n \n ) : (\n testEmails(defaultSchedule.id)}>\n {intl.get('send_test_emails')}\n \n ))}\n \n \n {(props: FormAPI) => {\n return (\n \n );\n }}\n \n \n );\n};\n\nexport { CreateScheduleForm };\n","import * as React from 'react';\n\nvar isCheckBoxInput = (element) => element.type === 'checkbox';\n\nvar isNullOrUndefined = (value) => value == null;\n\nconst isObjectType = (value) => typeof value === 'object';\r\nvar isObject = (value) => !isNullOrUndefined(value) &&\r\n !Array.isArray(value) &&\r\n isObjectType(value) &&\r\n !(value instanceof Date);\n\nvar getControllerValue = (event) => isObject(event) && event.target\r\n ? isCheckBoxInput(event.target)\r\n ? event.target.checked\r\n : event.target.value\r\n : event;\n\nvar getNodeParentName = (name) => name.substring(0, name.search(/.\\d/)) || name;\n\nvar isNameInFieldArray = (names, name) => [...names].some((current) => getNodeParentName(name) === current);\n\nvar compact = (value) => value.filter(Boolean);\n\nvar isUndefined = (val) => val === undefined;\n\nvar get = (obj = {}, path, defaultValue) => {\r\n const result = compact(path.split(/[,[\\].]+?/)).reduce((result, key) => (isNullOrUndefined(result) ? result : result[key]), obj);\r\n return isUndefined(result) || result === obj\r\n ? isUndefined(obj[path])\r\n ? defaultValue\r\n : obj[path]\r\n : result;\r\n};\n\nconst EVENTS = {\r\n BLUR: 'blur',\r\n CHANGE: 'change',\r\n};\r\nconst VALIDATION_MODE = {\r\n onBlur: 'onBlur',\r\n onChange: 'onChange',\r\n onSubmit: 'onSubmit',\r\n onTouched: 'onTouched',\r\n all: 'all',\r\n};\r\nconst SELECT = 'select';\r\nconst UNDEFINED = 'undefined';\r\nconst INPUT_VALIDATION_RULES = {\r\n max: 'max',\r\n min: 'min',\r\n maxLength: 'maxLength',\r\n minLength: 'minLength',\r\n pattern: 'pattern',\r\n required: 'required',\r\n validate: 'validate',\r\n};\n\nvar omit = (source, key) => {\r\n const copy = Object.assign({}, source);\r\n delete copy[key];\r\n return copy;\r\n};\n\nconst FormContext = React.createContext(null);\r\nFormContext.displayName = 'RHFContext';\r\nconst useFormContext = () => React.useContext(FormContext);\r\nconst FormProvider = (props) => (React.createElement(FormContext.Provider, { value: omit(props, 'children') }, props.children));\n\nvar getProxyFormState = (isProxyEnabled, formState, readFormStateRef, localReadFormStateRef, isRoot = true) => isProxyEnabled\r\n ? new Proxy(formState, {\r\n get: (obj, prop) => {\r\n if (prop in obj) {\r\n if (readFormStateRef.current[prop] !== VALIDATION_MODE.all) {\r\n readFormStateRef.current[prop] = isRoot\r\n ? VALIDATION_MODE.all\r\n : true;\r\n }\r\n localReadFormStateRef &&\r\n (localReadFormStateRef.current[prop] = true);\r\n return obj[prop];\r\n }\r\n return undefined;\r\n },\r\n })\r\n : formState;\n\nvar isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;\n\nvar shouldRenderFormState = (formStateData, readFormStateRef, isRoot) => {\r\n const formState = omit(formStateData, 'name');\r\n return (isEmptyObject(formState) ||\r\n Object.keys(formState).length >= Object.keys(readFormStateRef).length ||\r\n Object.keys(formState).find((key) => readFormStateRef[key] ===\r\n (isRoot ? VALIDATION_MODE.all : true)));\r\n};\n\nvar convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];\n\nvar isWeb = typeof window !== UNDEFINED &&\r\n typeof window.HTMLElement !== UNDEFINED &&\r\n typeof document !== UNDEFINED;\n\nconst isProxyEnabled = isWeb ? 'Proxy' in window : typeof Proxy !== UNDEFINED;\n\nfunction useFormState(props) {\r\n const { control, name } = props || {};\r\n const methods = useFormContext();\r\n const { formStateRef, formStateSubjectRef, readFormStateRef } = control || methods.control;\r\n const nameRef = React.useRef(name);\r\n nameRef.current = name;\r\n const [formState, updateFormState] = React.useState(formStateRef.current);\r\n const readFormState = React.useRef({\r\n isDirty: false,\r\n dirtyFields: false,\r\n touchedFields: false,\r\n isValidating: false,\r\n isValid: false,\r\n errors: false,\r\n });\r\n React.useEffect(() => {\r\n const formStateSubscription = formStateSubjectRef.current.subscribe({\r\n next: (formState) => (!nameRef.current ||\r\n !formState.name ||\r\n convertToArrayPayload(nameRef.current).includes(formState.name)) &&\r\n shouldRenderFormState(formState, readFormState.current) &&\r\n updateFormState(Object.assign(Object.assign({}, formStateRef.current), formState)),\r\n });\r\n return () => formStateSubscription.unsubscribe();\r\n }, []);\r\n return getProxyFormState(isProxyEnabled, formState, readFormStateRef, readFormState, false);\r\n}\n\nfunction useController({ name, rules, defaultValue, control, shouldUnregister, }) {\r\n const methods = useFormContext();\r\n const { defaultValuesRef, register, fieldsRef, unregister, fieldArrayNamesRef, controllerSubjectRef, shouldUnmountUnregister, inFieldArrayActionRef, } = control || methods.control;\r\n const { onChange, onBlur, ref } = register(name, rules);\r\n const isFieldArray = isNameInFieldArray(fieldArrayNamesRef.current, name);\r\n const [value, setInputStateValue] = React.useState(isUndefined(get(fieldsRef.current, name)._f.value) || isFieldArray\r\n ? isUndefined(defaultValue)\r\n ? get(defaultValuesRef.current, name)\r\n : defaultValue\r\n : get(fieldsRef.current, name)._f.value);\r\n const formState = useFormState({\r\n control: control || methods.control,\r\n name,\r\n });\r\n get(fieldsRef.current, name)._f.value = value;\r\n React.useEffect(() => {\r\n const controllerSubscription = controllerSubjectRef.current.subscribe({\r\n next: (data) => (!data.name || name === data.name) &&\r\n setInputStateValue(get(data.values, name)),\r\n });\r\n return () => {\r\n controllerSubscription.unsubscribe();\r\n const shouldUnmount = shouldUnmountUnregister || shouldUnregister;\r\n if (isFieldArray\r\n ? shouldUnmount && !inFieldArrayActionRef.current\r\n : shouldUnmount) {\r\n unregister(name);\r\n }\r\n else if (get(fieldsRef.current, name)) {\r\n get(fieldsRef.current, name)._f.mount = false;\r\n }\r\n };\r\n }, [name]);\r\n return {\r\n field: {\r\n onChange: (event) => {\r\n const value = getControllerValue(event);\r\n setInputStateValue(value);\r\n onChange({\r\n target: {\r\n value,\r\n name: name,\r\n },\r\n type: EVENTS.CHANGE,\r\n });\r\n },\r\n onBlur: () => {\r\n onBlur({\r\n target: {\r\n name: name,\r\n },\r\n type: EVENTS.BLUR,\r\n });\r\n },\r\n name,\r\n value,\r\n ref: (elm) => elm && ref(elm),\r\n },\r\n formState,\r\n fieldState: Object.defineProperties({}, {\r\n invalid: {\r\n get() {\r\n return !!get(formState.errors, name);\r\n },\r\n },\r\n isDirty: {\r\n get() {\r\n return !!get(formState.dirtyFields, name);\r\n },\r\n },\r\n isTouched: {\r\n get() {\r\n return !!get(formState.touchedFields, name);\r\n },\r\n },\r\n error: {\r\n get() {\r\n return get(formState.errors, name);\r\n },\r\n },\r\n }),\r\n };\r\n}\n\nconst Controller = (props) => props.render(useController(props));\n\nvar appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria\r\n ? Object.assign(Object.assign({}, errors[name]), { types: Object.assign(Object.assign({}, (errors[name] && errors[name].types ? errors[name].types : {})), { [type]: message || true }) }) : {};\n\nvar isKey = (value) => /^\\w*$/.test(value);\n\nvar stringToPath = (input) => compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n\nfunction set(object, path, value) {\r\n let index = -1;\r\n const tempPath = isKey(path) ? [path] : stringToPath(path);\r\n const length = tempPath.length;\r\n const lastIndex = length - 1;\r\n while (++index < length) {\r\n const key = tempPath[index];\r\n let newValue = value;\r\n if (index !== lastIndex) {\r\n const objValue = object[key];\r\n newValue =\r\n isObject(objValue) || Array.isArray(objValue)\r\n ? objValue\r\n : !isNaN(+tempPath[index + 1])\r\n ? []\r\n : {};\r\n }\r\n object[key] = newValue;\r\n object = object[key];\r\n }\r\n return object;\r\n}\n\nconst focusFieldBy = (fields, callback, fieldsNames) => {\r\n for (const key of fieldsNames || Object.keys(fields)) {\r\n const field = get(fields, key);\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n if (_f && callback(_f.name)) {\r\n if (_f.ref.focus && isUndefined(_f.ref.focus())) {\r\n break;\r\n }\r\n else if (_f.refs) {\r\n _f.refs[0].focus();\r\n break;\r\n }\r\n }\r\n else if (isObject(current)) {\r\n focusFieldBy(current, callback);\r\n }\r\n }\r\n }\r\n};\n\nconst getFieldsValues = (fieldsRef, defaultValuesRef, output = {}) => {\r\n for (const name in fieldsRef.current) {\r\n const field = fieldsRef.current[name];\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n set(output, name, _f\r\n ? _f.ref.disabled || (_f.refs && _f.refs.every((ref) => ref.disabled))\r\n ? undefined\r\n : _f.value\r\n : Array.isArray(field)\r\n ? []\r\n : {});\r\n if (current) {\r\n getFieldsValues({\r\n current,\r\n }, defaultValuesRef, output[name]);\r\n }\r\n }\r\n }\r\n return Object.assign(Object.assign({}, defaultValuesRef), output);\r\n};\n\nvar generateId = () => {\r\n const d = typeof performance === UNDEFINED ? Date.now() : performance.now() * 1000;\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\r\n const r = (Math.random() * 16 + d) % 16 | 0;\r\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\r\n });\r\n};\n\nvar mapIds = (values = [], keyName) => values.map((value) => (Object.assign({ [keyName]: (value && value[keyName]) || generateId() }, value)));\n\nvar isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);\n\nfunction deepEqual(object1, object2, isErrorObject) {\r\n if (isPrimitive(object1) ||\r\n isPrimitive(object2) ||\r\n object1 instanceof Date ||\r\n object2 instanceof Date) {\r\n return object1 === object2;\r\n }\r\n if (!React.isValidElement(object1)) {\r\n const keys1 = Object.keys(object1);\r\n const keys2 = Object.keys(object2);\r\n if (keys1.length !== keys2.length) {\r\n return false;\r\n }\r\n for (const key of keys1) {\r\n const val1 = object1[key];\r\n if (!(isErrorObject && key === 'ref')) {\r\n const val2 = object2[key];\r\n if ((isObject(val1) || Array.isArray(val1)) &&\r\n (isObject(val2) || Array.isArray(val2))\r\n ? !deepEqual(val1, val2, isErrorObject)\r\n : val1 !== val2) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n}\n\nfunction deepMerge(target, source) {\r\n if (isPrimitive(target) || isPrimitive(source)) {\r\n return source;\r\n }\r\n for (const key in source) {\r\n const targetValue = target[key];\r\n const sourceValue = source[key];\r\n try {\r\n target[key] =\r\n (isObject(targetValue) && isObject(sourceValue)) ||\r\n (Array.isArray(targetValue) && Array.isArray(sourceValue))\r\n ? deepMerge(targetValue, sourceValue)\r\n : sourceValue;\r\n }\r\n catch (_a) { }\r\n }\r\n return target;\r\n}\n\nfunction setDirtyFields(values, defaultValues, dirtyFields, parentNode, parentName) {\r\n let index = -1;\r\n while (++index < values.length) {\r\n for (const key in values[index]) {\r\n if (Array.isArray(values[index][key])) {\r\n !dirtyFields[index] && (dirtyFields[index] = {});\r\n dirtyFields[index][key] = [];\r\n setDirtyFields(values[index][key], get(defaultValues[index] || {}, key, []), dirtyFields[index][key], dirtyFields[index], key);\r\n }\r\n else {\r\n deepEqual(get(defaultValues[index] || {}, key), values[index][key])\r\n ? set(dirtyFields[index] || {}, key)\r\n : (dirtyFields[index] = Object.assign(Object.assign({}, dirtyFields[index]), { [key]: true }));\r\n }\r\n }\r\n parentNode &&\r\n !dirtyFields.length &&\r\n delete parentNode[parentName];\r\n }\r\n return dirtyFields;\r\n}\r\nvar setFieldArrayDirtyFields = (values, defaultValues, dirtyFields) => deepMerge(setDirtyFields(values, defaultValues, dirtyFields.slice(0, values.length)), setDirtyFields(defaultValues, values, dirtyFields.slice(0, values.length)));\n\nfunction append(data, value) {\r\n return [...data, ...convertToArrayPayload(value)];\r\n}\n\nvar fillEmptyArray = (value) => Array.isArray(value) ? Array(value.length).fill(undefined) : undefined;\n\nfunction insert(data, index, value) {\r\n return [\r\n ...data.slice(0, index),\r\n ...convertToArrayPayload(value),\r\n ...data.slice(index),\r\n ];\r\n}\n\nvar moveArrayAt = (data, from, to) => {\r\n if (Array.isArray(data)) {\r\n if (isUndefined(data[to])) {\r\n data[to] = undefined;\r\n }\r\n data.splice(to, 0, data.splice(from, 1)[0]);\r\n return data;\r\n }\r\n return [];\r\n};\n\nfunction prepend(data, value) {\r\n return [...convertToArrayPayload(value), ...data];\r\n}\n\nfunction removeAtIndexes(data, indexes) {\r\n let i = 0;\r\n const temp = [...data];\r\n for (const index of indexes) {\r\n temp.splice(index - i, 1);\r\n i++;\r\n }\r\n return compact(temp).length ? temp : [];\r\n}\r\nvar removeArrayAt = (data, index) => isUndefined(index)\r\n ? []\r\n : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));\n\nvar swapArrayAt = (data, indexA, indexB) => {\r\n data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\r\n};\n\nvar isBoolean = (value) => typeof value === 'boolean';\n\nfunction baseGet(object, updatePath) {\r\n const length = updatePath.slice(0, -1).length;\r\n let index = 0;\r\n while (index < length) {\r\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\r\n }\r\n return object;\r\n}\r\nfunction unset(object, path) {\r\n const updatePath = isKey(path) ? [path] : stringToPath(path);\r\n const childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);\r\n const key = updatePath[updatePath.length - 1];\r\n let previousObjRef;\r\n if (childObject) {\r\n delete childObject[key];\r\n }\r\n for (let k = 0; k < updatePath.slice(0, -1).length; k++) {\r\n let index = -1;\r\n let objectRef;\r\n const currentPaths = updatePath.slice(0, -(k + 1));\r\n const currentPathsLength = currentPaths.length - 1;\r\n if (k > 0) {\r\n previousObjRef = object;\r\n }\r\n while (++index < currentPaths.length) {\r\n const item = currentPaths[index];\r\n objectRef = objectRef ? objectRef[item] : object[item];\r\n if (currentPathsLength === index &&\r\n ((isObject(objectRef) && isEmptyObject(objectRef)) ||\r\n (Array.isArray(objectRef) &&\r\n !objectRef.filter((data) => (isObject(data) && !isEmptyObject(data)) || isBoolean(data)).length))) {\r\n previousObjRef ? delete previousObjRef[item] : delete object[item];\r\n }\r\n previousObjRef = objectRef;\r\n }\r\n }\r\n return object;\r\n}\n\nconst useFieldArray = ({ control, name, keyName = 'id', shouldUnregister, }) => {\r\n const methods = useFormContext();\r\n const focusNameRef = React.useRef('');\r\n const { isWatchAllRef, watchFieldsRef, getIsDirty, watchSubjectRef, fieldArraySubjectRef, fieldArrayNamesRef, fieldsRef, defaultValuesRef, formStateRef, formStateSubjectRef, readFormStateRef, validFieldsRef, fieldsWithValidationRef, fieldArrayDefaultValuesRef, unregister, shouldUnmountUnregister, inFieldArrayActionRef, } = control || methods.control;\r\n const [fields, setFields] = React.useState(mapIds(get(fieldsRef.current, name)\r\n ? get(getFieldsValues(fieldsRef), name)\r\n : get(fieldArrayDefaultValuesRef.current, getNodeParentName(name))\r\n ? get(fieldArrayDefaultValuesRef.current, name, [])\r\n : get(defaultValuesRef.current, name, []), keyName));\r\n set(fieldArrayDefaultValuesRef.current, name, [...fields]);\r\n fieldArrayNamesRef.current.add(name);\r\n const omitKey = (fields) => fields.map((field) => omit((field || {}), keyName));\r\n const getCurrentFieldsValues = () => {\r\n const values = get(getFieldsValues(fieldsRef, defaultValuesRef.current), name, []);\r\n return mapIds(get(fieldArrayDefaultValuesRef.current, name, []).map((item, index) => (Object.assign(Object.assign({}, item), values[index]))), keyName);\r\n };\r\n const getFocusDetail = (index, options) => options\r\n ? !isUndefined(options.focusIndex)\r\n ? `${name}.${options.focusIndex}`\r\n : options.focusName\r\n ? options.focusName\r\n : !options.shouldFocus\r\n ? ''\r\n : `${name}.${index}`\r\n : `${name}.${index}`;\r\n const resetFields = (index) => convertToArrayPayload(index).forEach((currentIndex) => set(fieldsRef.current, `${name}${isUndefined(currentIndex) ? '' : `.${currentIndex}`}`, isUndefined(currentIndex) ? [] : undefined));\r\n const setFieldsAndNotify = (fieldsValues = []) => setFields(mapIds(fieldsValues, keyName));\r\n const cleanup = (ref) => !compact(get(ref, name, [])).length && unset(ref, name);\r\n const updateDirtyFieldsWithDefaultValues = (updatedFieldArrayValues) => updatedFieldArrayValues &&\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFieldArrayValues), get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n const batchStateUpdate = (method, args, updatedFieldArrayValues = [], shouldSet = true) => {\r\n inFieldArrayActionRef.current = true;\r\n if (get(fieldsRef.current, name)) {\r\n const output = method(get(fieldsRef.current, name), args.argA, args.argB);\r\n shouldSet && set(fieldsRef.current, name, output);\r\n }\r\n if (Array.isArray(get(formStateRef.current.errors, name))) {\r\n const output = method(get(formStateRef.current.errors, name), args.argA, args.argB);\r\n shouldSet && set(formStateRef.current.errors, name, output);\r\n cleanup(formStateRef.current.errors);\r\n }\r\n if (readFormStateRef.current.touchedFields &&\r\n get(formStateRef.current.touchedFields, name)) {\r\n const output = method(get(formStateRef.current.touchedFields, name), args.argA, args.argB);\r\n shouldSet && set(formStateRef.current.touchedFields, name, output);\r\n cleanup(formStateRef.current.touchedFields);\r\n }\r\n if (readFormStateRef.current.dirtyFields ||\r\n readFormStateRef.current.isDirty) {\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFieldArrayValues), get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n updateDirtyFieldsWithDefaultValues(updatedFieldArrayValues);\r\n cleanup(formStateRef.current.dirtyFields);\r\n }\r\n if (readFormStateRef.current.isValid) {\r\n set(validFieldsRef.current, name, method(get(validFieldsRef.current, name, []), args.argA));\r\n cleanup(validFieldsRef.current);\r\n set(fieldsWithValidationRef.current, name, method(get(fieldsWithValidationRef.current, name, []), args.argA));\r\n cleanup(fieldsWithValidationRef.current);\r\n }\r\n formStateSubjectRef.current.next({\r\n isDirty: getIsDirty(name, omitKey(updatedFieldArrayValues)),\r\n errors: formStateRef.current.errors,\r\n isValid: formStateRef.current.isValid,\r\n });\r\n };\r\n const registerFieldArray = (values, index = 0, parentName = '') => values.forEach((appendValueItem, valueIndex) => !isPrimitive(appendValueItem) &&\r\n Object.entries(appendValueItem).forEach(([key, value]) => {\r\n const inputName = `${parentName || name}.${parentName ? valueIndex : index + valueIndex}.${key}`;\r\n Array.isArray(value)\r\n ? registerFieldArray(value, valueIndex, inputName)\r\n : set(fieldsRef.current, inputName, {\r\n _f: {\r\n ref: {\r\n name: inputName,\r\n },\r\n name: inputName,\r\n value,\r\n },\r\n });\r\n }));\r\n const append$1 = (value, options) => {\r\n const appendValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = append(getCurrentFieldsValues(), appendValue);\r\n const currentIndex = updatedFieldArrayValues.length - appendValue.length;\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(append, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues, false);\r\n registerFieldArray(appendValue, currentIndex);\r\n focusNameRef.current = getFocusDetail(currentIndex, options);\r\n };\r\n const prepend$1 = (value, options) => {\r\n const prependValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = prepend(getCurrentFieldsValues(), prependValue);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(prepend, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n registerFieldArray(prependValue);\r\n focusNameRef.current = getFocusDetail(0, options);\r\n };\r\n const remove = (index) => {\r\n const updatedFieldArrayValues = removeArrayAt(getCurrentFieldsValues(), index);\r\n resetFields(index);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(removeArrayAt, {\r\n argA: index,\r\n }, updatedFieldArrayValues);\r\n };\r\n const insert$1 = (index, value, options) => {\r\n const insertValue = convertToArrayPayload(value);\r\n const updatedFieldArrayValues = insert(getCurrentFieldsValues(), index, insertValue);\r\n setFieldsAndNotify(updatedFieldArrayValues);\r\n batchStateUpdate(insert, {\r\n argA: index,\r\n argB: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n registerFieldArray(insertValue, index);\r\n focusNameRef.current = getFocusDetail(index, options);\r\n };\r\n const swap = (indexA, indexB) => {\r\n const fieldValues = getCurrentFieldsValues();\r\n swapArrayAt(fieldValues, indexA, indexB);\r\n batchStateUpdate(swapArrayAt, {\r\n argA: indexA,\r\n argB: indexB,\r\n }, fieldValues, false);\r\n setFieldsAndNotify(fieldValues);\r\n };\r\n const move = (from, to) => {\r\n const fieldValues = getCurrentFieldsValues();\r\n moveArrayAt(fieldValues, from, to);\r\n setFieldsAndNotify(fieldValues);\r\n batchStateUpdate(moveArrayAt, {\r\n argA: from,\r\n argB: to,\r\n }, fieldValues, false);\r\n };\r\n React.useEffect(() => {\r\n inFieldArrayActionRef.current = false;\r\n if (isWatchAllRef.current) {\r\n formStateSubjectRef.current.next({});\r\n }\r\n else {\r\n for (const watchField of watchFieldsRef.current) {\r\n if (name.startsWith(watchField)) {\r\n formStateSubjectRef.current.next({});\r\n break;\r\n }\r\n }\r\n }\r\n watchSubjectRef.current.next({\r\n name,\r\n value: get(getFieldsValues(fieldsRef, defaultValuesRef.current), name, []),\r\n });\r\n focusNameRef.current &&\r\n focusFieldBy(fieldsRef.current, (key) => key.startsWith(focusNameRef.current));\r\n focusNameRef.current = '';\r\n fieldArraySubjectRef.current.next({\r\n name,\r\n fields: omitKey([...fields]),\r\n });\r\n }, [fields, name]);\r\n React.useEffect(() => {\r\n const fieldArraySubscription = fieldArraySubjectRef.current.subscribe({\r\n next({ name: inputFieldArrayName, fields, isReset }) {\r\n if (isReset) {\r\n unset(fieldsRef.current, inputFieldArrayName || name);\r\n inputFieldArrayName\r\n ? set(fieldArrayDefaultValuesRef.current, inputFieldArrayName, fields)\r\n : (fieldArrayDefaultValuesRef.current = fields);\r\n setFieldsAndNotify(get(fieldArrayDefaultValuesRef.current, name));\r\n }\r\n },\r\n });\r\n !get(fieldsRef.current, name) && set(fieldsRef.current, name, []);\r\n return () => {\r\n fieldArraySubscription.unsubscribe();\r\n (shouldUnmountUnregister || shouldUnregister) && unregister(name);\r\n };\r\n }, []);\r\n return {\r\n swap: React.useCallback(swap, [name]),\r\n move: React.useCallback(move, [name]),\r\n prepend: React.useCallback(prepend$1, [name]),\r\n append: React.useCallback(append$1, [name]),\r\n remove: React.useCallback(remove, [name]),\r\n insert: React.useCallback(insert$1, [name]),\r\n fields: fields,\r\n };\r\n};\n\nfunction getFields(fieldsNames, fieldsRefs) {\r\n const currentFields = {};\r\n for (const name of fieldsNames) {\r\n const field = get(fieldsRefs, name);\r\n if (field) {\r\n !isKey(name)\r\n ? set(currentFields, name, field._f)\r\n : (currentFields[name] = field._f);\r\n }\r\n }\r\n return currentFields;\r\n}\n\nvar isFileInput = (element) => element.type === 'file';\n\nvar isMultipleSelect = (element) => element.type === `${SELECT}-multiple`;\n\nvar isRadioInput = (element) => element.type === 'radio';\n\nconst defaultResult = {\r\n value: false,\r\n isValid: false,\r\n};\r\nconst validResult = { value: true, isValid: true };\r\nvar getCheckboxValue = (options) => {\r\n if (Array.isArray(options)) {\r\n if (options.length > 1) {\r\n const values = options\r\n .filter((option) => option && option.checked && !option.disabled)\r\n .map((option) => option.value);\r\n return { value: values, isValid: !!values.length };\r\n }\r\n return options[0].checked && !options[0].disabled\r\n ? // @ts-expect-error expected to work in the browser\r\n options[0].attributes && !isUndefined(options[0].attributes.value)\r\n ? isUndefined(options[0].value) || options[0].value === ''\r\n ? validResult\r\n : { value: options[0].value, isValid: true }\r\n : validResult\r\n : defaultResult;\r\n }\r\n return defaultResult;\r\n};\n\nvar getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => valueAsNumber\r\n ? value === ''\r\n ? NaN\r\n : +value\r\n : valueAsDate\r\n ? new Date(value)\r\n : setValueAs\r\n ? setValueAs(value)\r\n : value;\n\nvar getMultipleSelectValue = (options) => [...options]\r\n .filter(({ selected }) => selected)\r\n .map(({ value }) => value);\n\nconst defaultReturn = {\r\n isValid: false,\r\n value: null,\r\n};\r\nvar getRadioValue = (options) => Array.isArray(options)\r\n ? options.reduce((previous, option) => option && option.checked && !option.disabled\r\n ? {\r\n isValid: true,\r\n value: option.value,\r\n }\r\n : previous, defaultReturn)\r\n : defaultReturn;\n\nfunction getFieldValue(field) {\r\n if (field && field._f) {\r\n const ref = field._f.ref;\r\n if (ref.disabled) {\r\n return;\r\n }\r\n if (isFileInput(ref)) {\r\n return ref.files;\r\n }\r\n if (isRadioInput(ref)) {\r\n return getRadioValue(field._f.refs).value;\r\n }\r\n if (isMultipleSelect(ref)) {\r\n return getMultipleSelectValue(ref.options);\r\n }\r\n if (isCheckBoxInput(ref)) {\r\n return getCheckboxValue(field._f.refs).value;\r\n }\r\n return getFieldValueAs(isUndefined(ref.value) ? field._f.ref.value : ref.value, field._f);\r\n }\r\n}\n\nvar hasValidation = (options, mounted) => options &&\r\n mounted &&\r\n (options.required ||\r\n options.min ||\r\n options.max ||\r\n options.maxLength ||\r\n options.minLength ||\r\n options.pattern ||\r\n options.validate);\n\nvar skipValidation = ({ isOnBlur, isOnChange, isOnTouch, isTouched, isReValidateOnBlur, isReValidateOnChange, isBlurEvent, isSubmitted, isOnAll, }) => {\r\n if (isOnAll) {\r\n return false;\r\n }\r\n else if (!isSubmitted && isOnTouch) {\r\n return !(isTouched || isBlurEvent);\r\n }\r\n else if (isSubmitted ? isReValidateOnBlur : isOnBlur) {\r\n return !isBlurEvent;\r\n }\r\n else if (isSubmitted ? isReValidateOnChange : isOnChange) {\r\n return isBlurEvent;\r\n }\r\n return true;\r\n};\n\nvar isFunction = (value) => typeof value === 'function';\n\nvar isString = (value) => typeof value === 'string';\n\nvar isMessage = (value) => isString(value) || React.isValidElement(value);\n\nvar isRegex = (value) => value instanceof RegExp;\n\nfunction getValidateError(result, ref, type = 'validate') {\r\n if (isMessage(result) ||\r\n (Array.isArray(result) && result.every(isMessage)) ||\r\n (isBoolean(result) && !result)) {\r\n return {\r\n type,\r\n message: isMessage(result) ? result : '',\r\n ref,\r\n };\r\n }\r\n}\n\nvar getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData)\r\n ? validationData\r\n : {\r\n value: validationData,\r\n message: '',\r\n };\n\nvar validateField = async ({ _f: { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, value: inputValue, valueAsNumber, mount, }, }, validateAllFieldCriteria) => {\r\n if (!mount) {\r\n return {};\r\n }\r\n const error = {};\r\n const isRadio = isRadioInput(ref);\r\n const isCheckBox = isCheckBoxInput(ref);\r\n const isRadioOrCheckbox = isRadio || isCheckBox;\r\n const isEmpty = ((valueAsNumber || isFileInput(ref)) && !ref.value) ||\r\n inputValue === '' ||\r\n (Array.isArray(inputValue) && !inputValue.length);\r\n const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\r\n const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {\r\n const message = exceedMax ? maxLengthMessage : minLengthMessage;\r\n error[name] = Object.assign({ type: exceedMax ? maxType : minType, message,\r\n ref }, appendErrorsCurry(exceedMax ? maxType : minType, message));\r\n };\r\n if (required &&\r\n ((!isRadio && !isCheckBox && (isEmpty || isNullOrUndefined(inputValue))) ||\r\n (isBoolean(inputValue) && !inputValue) ||\r\n (isCheckBox && !getCheckboxValue(refs).isValid) ||\r\n (isRadio && !getRadioValue(refs).isValid))) {\r\n const { value, message } = isMessage(required)\r\n ? { value: !!required, message: required }\r\n : getValueAndMessage(required);\r\n if (value) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.required, message, ref: isRadioOrCheckbox ? (refs || [])[0] || {} : ref }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if ((!isNullOrUndefined(min) || !isNullOrUndefined(max)) &&\r\n inputValue !== '') {\r\n let exceedMax;\r\n let exceedMin;\r\n const maxOutput = getValueAndMessage(max);\r\n const minOutput = getValueAndMessage(min);\r\n if (!isNaN(inputValue)) {\r\n const valueNumber = ref.valueAsNumber || parseFloat(inputValue);\r\n if (!isNullOrUndefined(maxOutput.value)) {\r\n exceedMax = valueNumber > maxOutput.value;\r\n }\r\n if (!isNullOrUndefined(minOutput.value)) {\r\n exceedMin = valueNumber < minOutput.value;\r\n }\r\n }\r\n else {\r\n const valueDate = ref.valueAsDate || new Date(inputValue);\r\n if (isString(maxOutput.value)) {\r\n exceedMax = valueDate > new Date(maxOutput.value);\r\n }\r\n if (isString(minOutput.value)) {\r\n exceedMin = valueDate < new Date(minOutput.value);\r\n }\r\n }\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (isString(inputValue) && !isEmpty && (maxLength || minLength)) {\r\n const maxLengthOutput = getValueAndMessage(maxLength);\r\n const minLengthOutput = getValueAndMessage(minLength);\r\n const exceedMax = !isNullOrUndefined(maxLengthOutput.value) &&\r\n inputValue.length > maxLengthOutput.value;\r\n const exceedMin = !isNullOrUndefined(minLengthOutput.value) &&\r\n inputValue.length < minLengthOutput.value;\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (isString(inputValue) && pattern && !isEmpty) {\r\n const { value: patternValue, message } = getValueAndMessage(pattern);\r\n if (isRegex(patternValue) && !inputValue.match(patternValue)) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.pattern, message,\r\n ref }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n if (validate) {\r\n const validateRef = isRadioOrCheckbox && refs ? refs[0] : ref;\r\n if (isFunction(validate)) {\r\n const result = await validate(inputValue);\r\n const validateError = getValidateError(result, validateRef);\r\n if (validateError) {\r\n error[name] = Object.assign(Object.assign({}, validateError), appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n else if (isObject(validate)) {\r\n let validationResult = {};\r\n for (const [key, validateFunction] of Object.entries(validate)) {\r\n if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\r\n break;\r\n }\r\n const validateResult = await validateFunction(inputValue);\r\n const validateError = getValidateError(validateResult, validateRef, key);\r\n if (validateError) {\r\n validationResult = Object.assign(Object.assign({}, validateError), appendErrorsCurry(key, validateError.message));\r\n if (validateAllFieldCriteria) {\r\n error[name] = validationResult;\r\n }\r\n }\r\n }\r\n if (!isEmptyObject(validationResult)) {\r\n error[name] = Object.assign({ ref: validateRef }, validationResult);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n }\r\n return error;\r\n};\n\nvar getValidationModes = (mode) => ({\r\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\r\n isOnBlur: mode === VALIDATION_MODE.onBlur,\r\n isOnChange: mode === VALIDATION_MODE.onChange,\r\n isOnAll: mode === VALIDATION_MODE.all,\r\n isOnTouch: mode === VALIDATION_MODE.onTouched,\r\n});\n\nvar isHTMLElement = (value) => value instanceof HTMLElement;\n\nvar isRadioOrCheckboxFunction = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);\n\nclass Subscription {\r\n constructor() {\r\n this.tearDowns = [];\r\n }\r\n add(tearDown) {\r\n this.tearDowns.push(tearDown);\r\n }\r\n unsubscribe() {\r\n for (const teardown of this.tearDowns) {\r\n teardown();\r\n }\r\n this.tearDowns = [];\r\n }\r\n}\r\nclass Subscriber {\r\n constructor(observer, subscription) {\r\n this.observer = observer;\r\n this.closed = false;\r\n subscription.add(() => (this.closed = true));\r\n }\r\n next(value) {\r\n if (!this.closed) {\r\n this.observer.next(value);\r\n }\r\n }\r\n}\r\nclass Subject {\r\n constructor() {\r\n this.observers = [];\r\n }\r\n next(value) {\r\n for (const observer of this.observers) {\r\n observer.next(value);\r\n }\r\n }\r\n subscribe(observer) {\r\n const subscription = new Subscription();\r\n const subscriber = new Subscriber(observer, subscription);\r\n this.observers.push(subscriber);\r\n return subscription;\r\n }\r\n unsubscribe() {\r\n this.observers = [];\r\n }\r\n}\n\nconst isWindowUndefined = typeof window === UNDEFINED;\r\nfunction useForm({ mode = VALIDATION_MODE.onSubmit, reValidateMode = VALIDATION_MODE.onChange, resolver, context, defaultValues = {}, shouldFocusError = true, shouldUnregister, criteriaMode, } = {}) {\r\n const fieldsRef = React.useRef({});\r\n const fieldsNamesRef = React.useRef(new Set());\r\n const formStateSubjectRef = React.useRef(new Subject());\r\n const unregisterFieldsNamesRef = React.useRef(new Set());\r\n const watchSubjectRef = React.useRef(new Subject());\r\n const controllerSubjectRef = React.useRef(new Subject());\r\n const fieldArraySubjectRef = React.useRef(new Subject());\r\n const fieldArrayDefaultValuesRef = React.useRef({});\r\n const inFieldArrayActionRef = React.useRef(false);\r\n const watchFieldsRef = React.useRef(new Set());\r\n const isMountedRef = React.useRef(false);\r\n const fieldsWithValidationRef = React.useRef({});\r\n const validFieldsRef = React.useRef({});\r\n const defaultValuesRef = React.useRef(defaultValues);\r\n const isWatchAllRef = React.useRef(false);\r\n const contextRef = React.useRef(context);\r\n const resolverRef = React.useRef(resolver);\r\n const fieldArrayNamesRef = React.useRef(new Set());\r\n const validationMode = getValidationModes(mode);\r\n const isValidateAllFieldCriteria = criteriaMode === VALIDATION_MODE.all;\r\n const [formState, updateFormState] = React.useState({\r\n isDirty: false,\r\n isValidating: false,\r\n dirtyFields: {},\r\n isSubmitted: false,\r\n submitCount: 0,\r\n touchedFields: {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n isValid: !validationMode.isOnSubmit,\r\n errors: {},\r\n });\r\n const readFormStateRef = React.useRef({\r\n isDirty: !isProxyEnabled,\r\n dirtyFields: !isProxyEnabled,\r\n touchedFields: !isProxyEnabled,\r\n isValidating: !isProxyEnabled,\r\n isValid: !isProxyEnabled,\r\n errors: !isProxyEnabled,\r\n });\r\n const formStateRef = React.useRef(formState);\r\n contextRef.current = context;\r\n resolverRef.current = resolver;\r\n const getIsValid = () => (formStateRef.current.isValid =\r\n deepEqual(validFieldsRef.current, fieldsWithValidationRef.current) &&\r\n isEmptyObject(formStateRef.current.errors));\r\n const shouldRenderBaseOnError = React.useCallback((name, error, shouldRender = false, state = {}, isValid, isWatched) => {\r\n const previousError = get(formStateRef.current.errors, name);\r\n let shouldReRender = shouldRender ||\r\n !deepEqual(previousError, error, true) ||\r\n (readFormStateRef.current.isValid &&\r\n isUndefined(error) &&\r\n get(fieldsWithValidationRef.current, name) &&\r\n !get(validFieldsRef.current, name));\r\n if (error) {\r\n unset(validFieldsRef.current, name);\r\n shouldReRender =\r\n shouldReRender ||\r\n !previousError ||\r\n !deepEqual(previousError, error, true);\r\n set(formStateRef.current.errors, name, error);\r\n }\r\n else {\r\n if (get(fieldsWithValidationRef.current, name) || resolverRef.current) {\r\n set(validFieldsRef.current, name, true);\r\n shouldReRender = shouldReRender || previousError;\r\n }\r\n unset(formStateRef.current.errors, name);\r\n }\r\n if ((shouldReRender && !isNullOrUndefined(shouldRender)) ||\r\n !isEmptyObject(state) ||\r\n isWatched) {\r\n const updatedFormState = Object.assign(Object.assign({}, state), { isValid: resolverRef.current ? !!isValid : getIsValid(), errors: formStateRef.current.errors, name });\r\n formStateRef.current = Object.assign(Object.assign({}, formStateRef.current), updatedFormState);\r\n formStateSubjectRef.current.next(isWatched ? { name } : updatedFormState);\r\n }\r\n formStateSubjectRef.current.next({\r\n isValidating: false,\r\n });\r\n }, []);\r\n const setFieldValue = React.useCallback((name, rawValue, options = {}, shouldRender, shouldRegister) => {\r\n shouldRegister && register(name);\r\n const _f = get(fieldsRef.current, name, {})._f;\r\n if (_f) {\r\n const value = isWeb && isHTMLElement(_f.ref) && isNullOrUndefined(rawValue)\r\n ? ''\r\n : rawValue;\r\n _f.value = getFieldValueAs(rawValue, _f);\r\n if (isRadioInput(_f.ref)) {\r\n (_f.refs || []).forEach((radioRef) => (radioRef.checked = radioRef.value === value));\r\n }\r\n else if (isFileInput(_f.ref) && !isString(value)) {\r\n _f.ref.files = value;\r\n }\r\n else if (isMultipleSelect(_f.ref)) {\r\n [..._f.ref.options].forEach((selectRef) => (selectRef.selected = value.includes(selectRef.value)));\r\n }\r\n else if (isCheckBoxInput(_f.ref) && _f.refs) {\r\n _f.refs.length > 1\r\n ? _f.refs.forEach((checkboxRef) => (checkboxRef.checked = Array.isArray(value)\r\n ? !!value.find((data) => data === checkboxRef.value)\r\n : value === checkboxRef.value))\r\n : (_f.refs[0].checked = !!value);\r\n }\r\n else {\r\n _f.ref.value = value;\r\n }\r\n if (shouldRender) {\r\n const values = getFieldsValues(fieldsRef);\r\n set(values, name, rawValue);\r\n controllerSubjectRef.current.next({\r\n values: Object.assign(Object.assign({}, defaultValuesRef.current), values),\r\n name,\r\n });\r\n }\r\n options.shouldDirty && updateAndGetDirtyState(name, value);\r\n options.shouldValidate && trigger(name);\r\n }\r\n }, []);\r\n const getIsDirty = React.useCallback((name, data) => {\r\n const formValues = getFieldsValues(fieldsRef);\r\n name && data && set(formValues, name, data);\r\n return !deepEqual(formValues, defaultValuesRef.current);\r\n }, []);\r\n const updateAndGetDirtyState = React.useCallback((name, inputValue, shouldRender = true) => {\r\n if (readFormStateRef.current.isDirty ||\r\n readFormStateRef.current.dirtyFields) {\r\n const isFieldDirty = !deepEqual(get(defaultValuesRef.current, name), inputValue);\r\n const isDirtyFieldExist = get(formStateRef.current.dirtyFields, name);\r\n const previousIsDirty = formStateRef.current.isDirty;\r\n isFieldDirty\r\n ? set(formStateRef.current.dirtyFields, name, true)\r\n : unset(formStateRef.current.dirtyFields, name);\r\n formStateRef.current.isDirty = getIsDirty();\r\n const state = {\r\n isDirty: formStateRef.current.isDirty,\r\n dirtyFields: formStateRef.current.dirtyFields,\r\n name,\r\n };\r\n const isChanged = (readFormStateRef.current.isDirty &&\r\n previousIsDirty !== state.isDirty) ||\r\n (readFormStateRef.current.dirtyFields &&\r\n isDirtyFieldExist !== get(formStateRef.current.dirtyFields, name));\r\n isChanged && shouldRender && formStateSubjectRef.current.next(state);\r\n return isChanged ? state : {};\r\n }\r\n return {};\r\n }, []);\r\n const executeValidation = React.useCallback(async (name, skipReRender) => {\r\n const error = (await validateField(get(fieldsRef.current, name), isValidateAllFieldCriteria))[name];\r\n shouldRenderBaseOnError(name, error, skipReRender);\r\n return isUndefined(error);\r\n }, [isValidateAllFieldCriteria]);\r\n const executeSchemaOrResolverValidation = React.useCallback(async (names, currentNames = []) => {\r\n const { errors } = await resolverRef.current(getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current), contextRef.current, {\r\n criteriaMode,\r\n names: currentNames,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n for (const name of names) {\r\n const error = get(errors, name);\r\n error\r\n ? set(formStateRef.current.errors, name, error)\r\n : unset(formStateRef.current.errors, name);\r\n }\r\n return errors;\r\n }, [criteriaMode]);\r\n const validateForm = async (fieldsRef) => {\r\n let isValid = true;\r\n for (const name in fieldsRef) {\r\n const field = fieldsRef[name];\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n if (_f) {\r\n const fieldError = await validateField(field, isValidateAllFieldCriteria);\r\n if (fieldError[_f.name]) {\r\n isValid = false;\r\n set(formStateRef.current.errors, _f.name, fieldError[_f.name]);\r\n unset(validFieldsRef.current, _f.name);\r\n }\r\n else if (get(fieldsWithValidationRef.current, _f.name)) {\r\n set(validFieldsRef.current, _f.name, true);\r\n unset(formStateRef.current.errors, _f.name);\r\n }\r\n }\r\n current && (await validateForm(current));\r\n }\r\n }\r\n return isValid;\r\n };\r\n const trigger = React.useCallback(async (name) => {\r\n const fields = isUndefined(name)\r\n ? Object.keys(fieldsRef.current)\r\n : convertToArrayPayload(name);\r\n let isValid;\r\n let schemaResult = {};\r\n formStateSubjectRef.current.next({\r\n isValidating: true,\r\n });\r\n if (resolverRef.current) {\r\n schemaResult = await executeSchemaOrResolverValidation(fields, isUndefined(name) ? undefined : fields);\r\n isValid = fields.every((name) => !get(schemaResult, name));\r\n }\r\n else {\r\n isValid = isUndefined(name)\r\n ? await validateForm(fieldsRef.current)\r\n : (await Promise.all(fields\r\n .filter((fieldName) => get(fieldsRef.current, fieldName))\r\n .map(async (fieldName) => await executeValidation(fieldName, null)))).every(Boolean);\r\n }\r\n formStateSubjectRef.current.next(Object.assign(Object.assign({}, (isString(name) ? { name } : {})), { errors: formStateRef.current.errors, isValidating: false, isValid: resolverRef.current\r\n ? isEmptyObject(schemaResult)\r\n : getIsValid() }));\r\n return isValid;\r\n }, [executeSchemaOrResolverValidation, executeValidation]);\r\n const setInternalValues = React.useCallback((name, value, options) => Object.entries(value).forEach(([inputKey, inputValue]) => {\r\n const fieldName = `${name}.${inputKey}`;\r\n const field = get(fieldsRef.current, fieldName);\r\n const isFieldArray = fieldArrayNamesRef.current.has(name);\r\n isFieldArray || (field && !field._f)\r\n ? setInternalValues(fieldName, inputValue, options)\r\n : setFieldValue(fieldName, inputValue, options, true, !field);\r\n }), [trigger]);\r\n const isFieldWatched = (name) => isWatchAllRef.current ||\r\n watchFieldsRef.current.has(name) ||\r\n watchFieldsRef.current.has((name.match(/\\w+/) || [])[0]);\r\n const updateValidAndValue = (name, options, ref, isWithinRefCallback) => {\r\n const field = get(fieldsRef.current, name);\r\n const defaultValue = isUndefined(field._f.value)\r\n ? get(defaultValuesRef.current, name)\r\n : field._f.value;\r\n if (field && !isUndefined(defaultValue)) {\r\n if (ref && ref.defaultChecked) {\r\n field._f.value = getFieldValue(field);\r\n }\r\n else if (!isNameInFieldArray(fieldArrayNamesRef.current, name)) {\r\n setFieldValue(name, defaultValue);\r\n }\r\n else {\r\n field._f.value = defaultValue;\r\n }\r\n }\r\n if ((!isUndefined(defaultValue) || isWithinRefCallback) &&\r\n hasValidation(options, field._f.mount) &&\r\n !validationMode.isOnSubmit &&\r\n field &&\r\n readFormStateRef.current.isValid) {\r\n validateField(field, isValidateAllFieldCriteria).then((error) => {\r\n isEmptyObject(error)\r\n ? set(validFieldsRef.current, name, true)\r\n : unset(validFieldsRef.current, name);\r\n formStateRef.current.isValid !== getIsValid() &&\r\n updateFormState(Object.assign(Object.assign({}, formStateRef.current), { isValid: getIsValid() }));\r\n });\r\n }\r\n return defaultValue;\r\n };\r\n const setValue = (name, value, options = {}) => {\r\n const field = get(fieldsRef.current, name);\r\n const isFieldArray = fieldArrayNamesRef.current.has(name);\r\n if (isFieldArray) {\r\n fieldArraySubjectRef.current.next({\r\n fields: value,\r\n name,\r\n isReset: true,\r\n });\r\n if ((readFormStateRef.current.isDirty ||\r\n readFormStateRef.current.dirtyFields) &&\r\n options.shouldDirty) {\r\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(value, get(defaultValuesRef.current, name, []), get(formStateRef.current.dirtyFields, name, [])));\r\n formStateSubjectRef.current.next({\r\n name,\r\n dirtyFields: formStateRef.current.dirtyFields,\r\n isDirty: getIsDirty(name, value),\r\n });\r\n }\r\n !value.length &&\r\n set(fieldsRef.current, name, []) &&\r\n set(fieldArrayDefaultValuesRef.current, name, []);\r\n }\r\n (field && !field._f) || isFieldArray\r\n ? setInternalValues(name, value, isFieldArray ? {} : options)\r\n : setFieldValue(name, value, options, true, !field);\r\n isFieldWatched(name) && formStateSubjectRef.current.next({});\r\n watchSubjectRef.current.next({ name, value });\r\n };\r\n const handleChange = React.useCallback(async ({ type, target, target: { value, type: inputType } }) => {\r\n let name = target.name;\r\n let error;\r\n let isValid;\r\n const field = get(fieldsRef.current, name);\r\n if (field) {\r\n let inputValue = inputType ? getFieldValue(field) : undefined;\r\n inputValue = isUndefined(inputValue) ? value : inputValue;\r\n const isBlurEvent = type === EVENTS.BLUR;\r\n const { isOnBlur: isReValidateOnBlur, isOnChange: isReValidateOnChange, } = getValidationModes(reValidateMode);\r\n const shouldSkipValidation = (!hasValidation(field._f, field._f.mount) &&\r\n !resolverRef.current &&\r\n !get(formStateRef.current.errors, name)) ||\r\n skipValidation(Object.assign({ isBlurEvent, isTouched: !!get(formStateRef.current.touchedFields, name), isSubmitted: formStateRef.current.isSubmitted, isReValidateOnBlur,\r\n isReValidateOnChange }, validationMode));\r\n const isWatched = !isBlurEvent && isFieldWatched(name);\r\n if (!isUndefined(inputValue)) {\r\n field._f.value = inputValue;\r\n }\r\n const state = updateAndGetDirtyState(name, field._f.value, false);\r\n if (isBlurEvent && !get(formStateRef.current.touchedFields, name)) {\r\n set(formStateRef.current.touchedFields, name, true);\r\n readFormStateRef.current.touchedFields &&\r\n (state.touchedFields = formStateRef.current.touchedFields);\r\n }\r\n let shouldRender = !isEmptyObject(state) || isWatched;\r\n if (shouldSkipValidation) {\r\n !isBlurEvent &&\r\n watchSubjectRef.current.next({\r\n name,\r\n type,\r\n value: inputValue,\r\n });\r\n return (shouldRender &&\r\n formStateSubjectRef.current.next(isWatched ? { name } : Object.assign(Object.assign({}, state), { name })));\r\n }\r\n formStateSubjectRef.current.next({\r\n isValidating: true,\r\n });\r\n if (resolverRef.current) {\r\n const { errors } = await resolverRef.current(getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current), contextRef.current, {\r\n criteriaMode,\r\n fields: getFields([name], fieldsRef.current),\r\n names: [name],\r\n });\r\n const previousFormIsValid = formStateRef.current.isValid;\r\n error = get(errors, name);\r\n if (isCheckBoxInput(target) && !error) {\r\n const parentNodeName = getNodeParentName(name);\r\n const currentError = get(errors, parentNodeName, {});\r\n currentError.type && currentError.message && (error = currentError);\r\n if (currentError ||\r\n get(formStateRef.current.errors, parentNodeName)) {\r\n name = parentNodeName;\r\n }\r\n }\r\n isValid = isEmptyObject(errors);\r\n previousFormIsValid !== isValid && (shouldRender = true);\r\n }\r\n else {\r\n error = (await validateField(field, isValidateAllFieldCriteria))[name];\r\n }\r\n !isBlurEvent &&\r\n watchSubjectRef.current.next({\r\n name,\r\n type,\r\n value: inputValue,\r\n });\r\n shouldRenderBaseOnError(name, error, shouldRender, state, isValid, isWatched);\r\n }\r\n }, []);\r\n const getValues = (fieldNames) => {\r\n const values = isMountedRef.current\r\n ? getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current)\r\n : defaultValuesRef.current;\r\n return isUndefined(fieldNames)\r\n ? values\r\n : isString(fieldNames)\r\n ? get(values, fieldNames)\r\n : fieldNames.map((name) => get(values, name));\r\n };\r\n const updateIsValid = React.useCallback(async (values = {}) => {\r\n const previousIsValid = formStateRef.current.isValid;\r\n if (resolver) {\r\n const { errors } = await resolverRef.current(Object.assign(Object.assign({}, getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current)), values), contextRef.current, {\r\n criteriaMode,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n formStateRef.current.isValid = isEmptyObject(errors);\r\n }\r\n else {\r\n getIsValid();\r\n }\r\n previousIsValid !== formStateRef.current.isValid &&\r\n formStateSubjectRef.current.next({\r\n isValid: formStateRef.current.isValid,\r\n });\r\n }, [criteriaMode]);\r\n const clearErrors = (name) => {\r\n name\r\n ? convertToArrayPayload(name).forEach((inputName) => unset(formStateRef.current.errors, inputName))\r\n : (formStateRef.current.errors = {});\r\n formStateSubjectRef.current.next({\r\n errors: formStateRef.current.errors,\r\n });\r\n };\r\n const setError = (name, error, options) => {\r\n const ref = ((get(fieldsRef.current, name) || { _f: {} })._f || {}).ref;\r\n set(formStateRef.current.errors, name, Object.assign(Object.assign({}, error), { ref }));\r\n formStateSubjectRef.current.next({\r\n name,\r\n errors: formStateRef.current.errors,\r\n isValid: false,\r\n });\r\n options && options.shouldFocus && ref && ref.focus && ref.focus();\r\n };\r\n const watchInternal = React.useCallback((fieldNames, defaultValue, isGlobal) => {\r\n const isArrayNames = Array.isArray(fieldNames);\r\n const fieldValues = isMountedRef.current\r\n ? getFieldsValues(fieldsRef, defaultValuesRef.current)\r\n : isUndefined(defaultValue)\r\n ? defaultValuesRef.current\r\n : isArrayNames\r\n ? defaultValue || {}\r\n : { [fieldNames]: defaultValue };\r\n if (isUndefined(fieldNames)) {\r\n isGlobal && (isWatchAllRef.current = true);\r\n return fieldValues;\r\n }\r\n const result = [];\r\n for (const fieldName of isArrayNames ? fieldNames : [fieldNames]) {\r\n isGlobal && watchFieldsRef.current.add(fieldName);\r\n result.push(get(fieldValues, fieldName));\r\n }\r\n return isArrayNames ? result : result[0];\r\n }, []);\r\n const watch = (fieldName, defaultValue) => isFunction(fieldName)\r\n ? watchSubjectRef.current.subscribe({\r\n next: (info) => fieldName(watchInternal(undefined, defaultValue), info),\r\n })\r\n : watchInternal(fieldName, defaultValue, true);\r\n const unregister = (name, options = {}) => {\r\n for (const inputName of name\r\n ? convertToArrayPayload(name)\r\n : Object.keys(fieldsNamesRef.current)) {\r\n fieldsNamesRef.current.delete(inputName);\r\n fieldArrayNamesRef.current.delete(inputName);\r\n if (get(fieldsRef.current, inputName)) {\r\n if (!options.keepIsValid) {\r\n unset(fieldsWithValidationRef.current, inputName);\r\n unset(validFieldsRef.current, inputName);\r\n }\r\n !options.keepError && unset(formStateRef.current.errors, inputName);\r\n !options.keepValue && unset(fieldsRef.current, inputName);\r\n !options.keepDirty &&\r\n unset(formStateRef.current.dirtyFields, inputName);\r\n !options.keepTouched &&\r\n unset(formStateRef.current.touchedFields, inputName);\r\n !shouldUnregister &&\r\n !options.keepDefaultValue &&\r\n unset(defaultValuesRef.current, inputName);\r\n watchSubjectRef.current.next({\r\n name: inputName,\r\n });\r\n }\r\n }\r\n formStateSubjectRef.current.next(Object.assign(Object.assign(Object.assign({}, formStateRef.current), (!options.keepDirty ? {} : { isDirty: getIsDirty() })), (resolverRef.current ? {} : { isValid: getIsValid() })));\r\n !options.keepIsValid && updateIsValid();\r\n };\r\n const registerFieldRef = (name, ref, options) => {\r\n register(name, options);\r\n let field = get(fieldsRef.current, name);\r\n const isRadioOrCheckbox = isRadioOrCheckboxFunction(ref);\r\n if (ref === field._f.ref ||\r\n (isWeb && isHTMLElement(field._f.ref) && !isHTMLElement(ref)) ||\r\n (isRadioOrCheckbox &&\r\n Array.isArray(field._f.refs) &&\r\n compact(field._f.refs).find((option) => option === ref))) {\r\n return;\r\n }\r\n field = {\r\n _f: isRadioOrCheckbox\r\n ? Object.assign(Object.assign({}, field._f), { refs: [\r\n ...compact(field._f.refs || []).filter((ref) => isHTMLElement(ref) && document.contains(ref)),\r\n ref,\r\n ], ref: { type: ref.type, name } }) : Object.assign(Object.assign({}, field._f), { ref }),\r\n };\r\n set(fieldsRef.current, name, field);\r\n const defaultValue = updateValidAndValue(name, options, ref, true);\r\n if (isRadioOrCheckbox && Array.isArray(defaultValue)\r\n ? !deepEqual(get(fieldsRef.current, name)._f.value, defaultValue)\r\n : isUndefined(get(fieldsRef.current, name)._f.value)) {\r\n get(fieldsRef.current, name)._f.value = getFieldValue(get(fieldsRef.current, name));\r\n }\r\n };\r\n const register = React.useCallback((name, options) => {\r\n const isInitialRegister = !get(fieldsRef.current, name);\r\n set(fieldsRef.current, name, {\r\n _f: Object.assign(Object.assign(Object.assign({}, (isInitialRegister\r\n ? { ref: { name } }\r\n : Object.assign({ ref: (get(fieldsRef.current, name)._f || {}).ref }, get(fieldsRef.current, name)._f))), { name, mount: true }), options),\r\n });\r\n hasValidation(options, true) &&\r\n set(fieldsWithValidationRef.current, name, true);\r\n fieldsNamesRef.current.add(name);\r\n isInitialRegister && updateValidAndValue(name, options);\r\n return isWindowUndefined\r\n ? { name: name }\r\n : {\r\n name,\r\n onChange: handleChange,\r\n onBlur: handleChange,\r\n ref: (ref) => {\r\n if (ref) {\r\n registerFieldRef(name, ref, options);\r\n }\r\n else {\r\n const field = get(fieldsRef.current, name);\r\n const shouldUnmount = shouldUnregister || (options && options.shouldUnregister);\r\n field && (field._f.mount = false);\r\n if (isWeb &&\r\n (isNameInFieldArray(fieldArrayNamesRef.current, name)\r\n ? shouldUnmount && !inFieldArrayActionRef.current\r\n : shouldUnmount)) {\r\n unregisterFieldsNamesRef.current.add(name);\r\n }\r\n }\r\n },\r\n };\r\n }, [defaultValuesRef.current]);\r\n const handleSubmit = React.useCallback((onValid, onInvalid) => async (e) => {\r\n if (e) {\r\n e.preventDefault && e.preventDefault();\r\n e.persist && e.persist();\r\n }\r\n let hasNoPromiseError = true;\r\n let fieldValues = getFieldsValues(fieldsRef, shouldUnregister ? {} : defaultValuesRef.current);\r\n formStateSubjectRef.current.next({\r\n isSubmitting: true,\r\n });\r\n try {\r\n if (resolverRef.current) {\r\n const { errors, values } = await resolverRef.current(fieldValues, contextRef.current, {\r\n criteriaMode,\r\n fields: getFields(fieldsNamesRef.current, fieldsRef.current),\r\n });\r\n formStateRef.current.errors = errors;\r\n fieldValues = values;\r\n }\r\n else {\r\n await validateForm(fieldsRef.current);\r\n }\r\n if (isEmptyObject(formStateRef.current.errors) &&\r\n Object.keys(formStateRef.current.errors).every((name) => get(fieldValues, name))) {\r\n formStateSubjectRef.current.next({\r\n errors: {},\r\n isSubmitting: true,\r\n });\r\n await onValid(fieldValues, e);\r\n }\r\n else {\r\n onInvalid && (await onInvalid(formStateRef.current.errors, e));\r\n shouldFocusError &&\r\n focusFieldBy(fieldsRef.current, (key) => get(formStateRef.current.errors, key), fieldsNamesRef.current);\r\n }\r\n }\r\n catch (_a) {\r\n hasNoPromiseError = false;\r\n }\r\n finally {\r\n formStateRef.current.isSubmitted = true;\r\n formStateSubjectRef.current.next({\r\n isSubmitted: true,\r\n isSubmitting: false,\r\n isSubmitSuccessful: isEmptyObject(formStateRef.current.errors) && hasNoPromiseError,\r\n submitCount: formStateRef.current.submitCount + 1,\r\n errors: formStateRef.current.errors,\r\n });\r\n }\r\n }, [shouldFocusError, isValidateAllFieldCriteria, criteriaMode]);\r\n const resetFromState = React.useCallback(({ keepErrors, keepDirty, keepIsSubmitted, keepTouched, keepDefaultValues, keepIsValid, keepSubmitCount, }, values) => {\r\n if (!keepIsValid) {\r\n validFieldsRef.current = {};\r\n fieldsWithValidationRef.current = {};\r\n }\r\n watchFieldsRef.current = new Set();\r\n isWatchAllRef.current = false;\r\n formStateSubjectRef.current.next({\r\n submitCount: keepSubmitCount ? formStateRef.current.submitCount : 0,\r\n isDirty: keepDirty\r\n ? formStateRef.current.isDirty\r\n : keepDefaultValues\r\n ? deepEqual(values, defaultValuesRef.current)\r\n : false,\r\n isSubmitted: keepIsSubmitted ? formStateRef.current.isSubmitted : false,\r\n isValid: keepIsValid\r\n ? formStateRef.current.isValid\r\n : !!updateIsValid(values),\r\n dirtyFields: keepDirty ? formStateRef.current.dirtyFields : {},\r\n touchedFields: keepTouched ? formStateRef.current.touchedFields : {},\r\n errors: keepErrors ? formStateRef.current.errors : {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n });\r\n }, []);\r\n const reset = (values, keepStateOptions = {}) => {\r\n const updatedValues = values || defaultValuesRef.current;\r\n if (isWeb && !keepStateOptions.keepValues) {\r\n for (const name of fieldsNamesRef.current) {\r\n const field = get(fieldsRef.current, name);\r\n if (field && field._f) {\r\n const inputRef = Array.isArray(field._f.refs)\r\n ? field._f.refs[0]\r\n : field._f.ref;\r\n if (isHTMLElement(inputRef)) {\r\n try {\r\n inputRef.closest('form').reset();\r\n break;\r\n }\r\n catch (_a) { }\r\n }\r\n }\r\n }\r\n }\r\n !keepStateOptions.keepDefaultValues &&\r\n (defaultValuesRef.current = Object.assign({}, updatedValues));\r\n if (!keepStateOptions.keepValues) {\r\n fieldsRef.current = {};\r\n controllerSubjectRef.current.next({\r\n values: Object.assign({}, updatedValues),\r\n });\r\n watchSubjectRef.current.next({\r\n value: Object.assign({}, updatedValues),\r\n });\r\n fieldArraySubjectRef.current.next({\r\n fields: Object.assign({}, updatedValues),\r\n isReset: true,\r\n });\r\n }\r\n resetFromState(keepStateOptions, values);\r\n isMountedRef.current = false;\r\n };\r\n const setFocus = (name) => get(fieldsRef.current, name)._f.ref.focus();\r\n React.useEffect(() => {\r\n const formStateSubscription = formStateSubjectRef.current.subscribe({\r\n next(formState) {\r\n if (shouldRenderFormState(formState, readFormStateRef.current, true)) {\r\n formStateRef.current = Object.assign(Object.assign({}, formStateRef.current), formState);\r\n updateFormState(formStateRef.current);\r\n }\r\n },\r\n });\r\n const useFieldArraySubscription = fieldArraySubjectRef.current.subscribe({\r\n next(state) {\r\n if (state.fields && state.name && readFormStateRef.current.isValid) {\r\n const values = getFieldsValues(fieldsRef);\r\n set(values, state.name, state.fields);\r\n updateIsValid(values);\r\n }\r\n },\r\n });\r\n resolverRef.current && readFormStateRef.current.isValid && updateIsValid();\r\n return () => {\r\n watchSubjectRef.current.unsubscribe();\r\n formStateSubscription.unsubscribe();\r\n useFieldArraySubscription.unsubscribe();\r\n };\r\n }, []);\r\n React.useEffect(() => {\r\n const isLiveInDom = (ref) => !isHTMLElement(ref) || !document.contains(ref);\r\n isMountedRef.current = true;\r\n unregisterFieldsNamesRef.current.forEach((name) => {\r\n const field = get(fieldsRef.current, name);\r\n field &&\r\n (field._f.refs\r\n ? field._f.refs.every(isLiveInDom)\r\n : isLiveInDom(field._f.ref)) &&\r\n unregister(name);\r\n });\r\n unregisterFieldsNamesRef.current = new Set();\r\n });\r\n return {\r\n control: React.useMemo(() => ({\r\n register,\r\n isWatchAllRef,\r\n inFieldArrayActionRef,\r\n watchFieldsRef,\r\n getIsDirty,\r\n formStateSubjectRef,\r\n fieldArraySubjectRef,\r\n controllerSubjectRef,\r\n watchSubjectRef,\r\n watchInternal,\r\n fieldsRef,\r\n validFieldsRef,\r\n fieldsWithValidationRef,\r\n fieldArrayNamesRef,\r\n readFormStateRef,\r\n formStateRef,\r\n defaultValuesRef,\r\n fieldArrayDefaultValuesRef,\r\n unregister,\r\n shouldUnmountUnregister: shouldUnregister,\r\n }), []),\r\n formState: getProxyFormState(isProxyEnabled, formState, readFormStateRef),\r\n trigger,\r\n register,\r\n handleSubmit,\r\n watch: React.useCallback(watch, []),\r\n setValue: React.useCallback(setValue, [setInternalValues]),\r\n getValues: React.useCallback(getValues, []),\r\n reset: React.useCallback(reset, []),\r\n clearErrors: React.useCallback(clearErrors, []),\r\n unregister: React.useCallback(unregister, []),\r\n setError: React.useCallback(setError, []),\r\n setFocus: React.useCallback(setFocus, []),\r\n };\r\n}\n\nfunction useWatch(props) {\r\n const { control, name, defaultValue } = props || {};\r\n const methods = useFormContext();\r\n const nameRef = React.useRef(name);\r\n nameRef.current = name;\r\n const { watchInternal, watchSubjectRef } = control || methods.control;\r\n const [value, updateValue] = React.useState(isUndefined(defaultValue)\r\n ? watchInternal(name)\r\n : defaultValue);\r\n React.useEffect(() => {\r\n watchInternal(name);\r\n const watchSubscription = watchSubjectRef.current.subscribe({\r\n next: ({ name: inputName, value }) => (!nameRef.current ||\r\n !inputName ||\r\n convertToArrayPayload(nameRef.current).some((fieldName) => inputName &&\r\n fieldName &&\r\n (fieldName.startsWith(inputName) ||\r\n inputName.startsWith(fieldName)))) &&\r\n updateValue(isString(inputName) &&\r\n nameRef.current === inputName &&\r\n !isUndefined(value)\r\n ? value\r\n : watchInternal(nameRef.current, defaultValue)),\r\n });\r\n return () => watchSubscription.unsubscribe();\r\n }, []);\r\n return value;\r\n}\n\nexport { Controller, FormProvider, appendErrors, get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };\n//# sourceMappingURL=index.esm.js.map\n","import React, { useEffect } from 'react';\nimport { SelectableValue, DateTime } from '@grafana/data';\nimport {\n Button,\n Field,\n FieldSet,\n FormAPI,\n Icon,\n InlineField,\n InlineFieldRow,\n Input,\n Select,\n TimeOfDayPicker,\n} from '@grafana/ui';\nimport { getIntervals, getWeekDays } from '../../constants';\nimport { Panel, PanelListSelectedType, ReportGroupType, ScheduleType } from 'types';\nimport { formatTimeToDate } from 'utils';\nimport { PanelList } from 'components';\nimport { Controller } from 'react-hook-form';\n\nexport const CreateScheduleFormPartial = ({\n register,\n errors,\n control,\n setValue,\n watch,\n reportGroups,\n isEditMode,\n defaultSchedule,\n}: FormAPI & {\n reportGroups: ReportGroupType[] | undefined;\n isEditMode: boolean;\n defaultSchedule: ScheduleType;\n}) => {\n useEffect(() => {\n register('reportGroupID', { required: 'Report group is required' });\n register('time', { required: 'time of day is required' });\n register('interval', { required: 'Interval is required' });\n }, [register]);\n\n const getReportGroupOptions = (reportGroups: ReportGroupType[] | undefined) =>\n reportGroups?.map((reportGroup: ReportGroupType) => ({\n label: reportGroup.name,\n description: reportGroup.description,\n value: reportGroup,\n }));\n\n const renderInterval = () => {\n switch (watch('interval')) {\n case 0:\n return false;\n case 1:\n return (\n \n inter.value === watch('day'))}\n options={getWeekDays()}\n prefix={}\n onChange={(option: any) => {\n setValue('day', option.value);\n }}\n />\n \n );\n case 2:\n return (\n \n ({ label: (key + 1).toString(), value: key + 1 }))}\n prefix={}\n onChange={(option: any) => {\n setValue('day', option.value);\n }}\n />\n \n );\n default:\n return (\n \n \n \n );\n }\n };\n\n return (\n <>\n
    \n \n \n \n \n \n \n
    \n\n \n reportGroup.id === watch('reportGroupID'))\n .map((reportGroup: ReportGroupType) => ({\n label: reportGroup.name,\n description: reportGroup.description,\n value: reportGroup,\n }))}\n options={getReportGroupOptions(reportGroups)}\n onChange={(selected: SelectableValue) => {\n setValue('reportGroupID', selected?.value?.id ?? '');\n }}\n prefix={}\n />\n \n\n \n \n interval.value === watch('interval'))}\n options={getIntervals()}\n prefix={}\n onChange={(option: any) => {\n setValue('interval', option.value);\n }}\n />\n \n \n {\n setValue('time', selected.format('HH:mm'));\n }}\n />\n \n {renderInterval()}\n \n\n {\n return (\n {\n const foundElement = selectedPanels.find(\n (selectedPanel: PanelListSelectedType) =>\n selectedPanel.panelID === panel.id && selectedPanel.dashboardID === panel.dashboardID\n );\n\n const updatedSelectedPanels = foundElement\n ? selectedPanels.filter(\n (selectedPanel: PanelListSelectedType) =>\n !(selectedPanel.panelID === panel.id && selectedPanel.dashboardID === panel.dashboardID)\n )\n : [...selectedPanels, { panelID: panel.id, dashboardID: panel.dashboardID }];\n\n onChange(updatedSelectedPanels);\n }}\n />\n );\n }}\n name=\"panels\"\n control={control}\n defaultValue={defaultSchedule.panelDetails.map((panelDetail) => ({\n panelID: panelDetail.panelID,\n dashboardID: panelDetail.dashboardID,\n }))}\n />\n\n
    \n \n
    \n \n );\n};\n","import { AppPluginMeta, PluginConfigPageProps } from '@grafana/data';\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { AppConfigForm } from '../components';\nimport { AppConfigProps } from '../types';\n\nconst queryClient = new QueryClient();\n\ninterface Props extends PluginConfigPageProps> {}\n\nconst AppConfig = ({ plugin, ...rest }: Props) => {\n return (\n \n \n \n );\n};\n\nexport { AppConfig };\n","import React, { useState } from 'react';\nimport { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Card, ConfirmModal, HorizontalGroup, LinkButton, Spinner, Tag, useStyles2 } from '@grafana/ui';\nimport intl from 'react-intl-universal';\nimport { useMutation, useQuery } from 'react-query';\n\nimport { EmptyListCTA } from 'components/common';\nimport { prefixRoute } from '../../utils';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { ReportGroupType } from 'types';\nimport { deleteReportGroup, getReportGroups } from 'api';\nimport { useToggle } from '../../hooks';\n\nconst EmptyList = () => {\n return (\n \n );\n};\n\nconst ReportGroup = () => {\n const styles = useStyles2(getStyles);\n\n const [deleteAlertIsOpen, setDeleteAlertIsOpen] = useToggle(false);\n const [deleteReportGroupID, setDeleteReportGroupID] = useState('');\n\n const { mutate: deleteGroup } = useMutation(deleteReportGroup, {\n onSuccess: () => {\n refetchReportGroups();\n return;\n },\n });\n\n const onConfirmDeleteGroup = () => {\n deleteGroup(deleteReportGroupID);\n setDeleteAlertIsOpen();\n };\n\n const {\n data: reportGroups,\n isLoading,\n refetch: refetchReportGroups,\n } = useQuery(`reportGroups`, getReportGroups, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const onReportGroupDelete = (reportGroupID: string) => {\n setDeleteAlertIsOpen();\n setDeleteReportGroupID(reportGroupID);\n };\n\n if (isLoading) {\n return ;\n }\n\n if (!!!reportGroups || !reportGroups.length) {\n return ;\n }\n\n return (\n
    \n
    \n \n {intl.get('add_report_group')}\n \n
    \n
      \n {reportGroups.map((reportGroup) => {\n return (\n
    • \n \n {reportGroup.name}\n {reportGroup.description}\n {reportGroup.members && (\n \n {[\n \n {reportGroup.members.map(({ id, name, email }: any) => {\n return `} />;\n })}\n ,\n ]}\n \n )}\n \n \n Edit\n \n onReportGroupDelete(reportGroup.id)}\n >\n {intl.get('delete')}\n \n \n \n
    • \n );\n })}\n
    \n \n
    \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginTop: css`\n margin-top: ${theme.spacing(2)};\n `,\n list: css({\n listStyle: 'none',\n display: 'grid',\n // gap: '8px', Add back when legacy support for old Card interface is dropped\n }),\n adjustButtonToRight: css`\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n `,\n heading: css({\n fontSize: theme.v1.typography.heading.h5,\n fontWeight: 'inherit',\n }),\n card: css({\n gridTemplateAreas: `\n \"Figure Heading Actions\"\n \"Figure Description Actions\"\n \"Figure Meta Actions\"\n \"Figure - Actions\"`,\n }),\n description: css({\n margin: '0px',\n fontSize: theme.typography.size.sm,\n }),\n actions: css({\n position: 'relative',\n alignSelf: 'center',\n marginTop: '0px',\n opacity: 0,\n\n '.card-parent:hover &, .card-parent:focus-within &': {\n opacity: 1,\n },\n }),\n});\n\nexport { ReportGroup, EmptyList };\n","import React from 'react';\nimport { Controller } from 'react-hook-form';\nimport { Alert, Button, Field, FieldSet, Form, Input, PageToolbar } from '@grafana/ui';\nimport { useMutation, useQuery } from 'react-query';\n\nimport { Loading, Page, UserList } from '../../components';\nimport { ROUTES, NAVIGATION_TITLE, NAVIGATION_SUBTITLE, PLUGIN_BASE_URL } from '../../constants';\nimport { prefixRoute } from '../../utils';\nimport { useDatasourceID } from '../../hooks';\nimport { getUsers, createReportGroup, getReportGroupByID } from '../../api';\nimport { ReportGroupType, ReportGroupTypeWithMembersDetail, User } from '../../types';\n\nconst defaultFormValues: ReportGroupType = {\n id: '',\n name: '',\n description: '',\n members: [],\n};\n\nconst CreateReportGroup = ({ history, match }: any) => {\n const datasourceID = useDatasourceID();\n const { id: reportGroupIdToEdit } = match.params;\n const isEditMode = !!reportGroupIdToEdit;\n const [ready, setReady] = React.useState(false);\n\n const { data: users, isLoading: isUsersLoading } = useQuery(\n `users-${datasourceID}`,\n () => getUsers(datasourceID),\n {\n enabled: !!datasourceID,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n }\n );\n\n const [defaultReportGroup, setDefaultReportGroup] = React.useState(defaultFormValues);\n\n const {\n data: defaultReportGroupFetched,\n isLoading: isReportGroupByIDLoading,\n isRefetching,\n } = useQuery(\n `report-group-${reportGroupIdToEdit}`,\n () => getReportGroupByID(reportGroupIdToEdit),\n {\n enabled: isEditMode,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n onError: () => {\n history.push(`${PLUGIN_BASE_URL}/report-groups/`);\n return;\n },\n }\n );\n\n React.useEffect(() => {\n if (!!defaultReportGroupFetched) {\n setDefaultReportGroup({\n ...defaultReportGroupFetched,\n members: defaultReportGroupFetched.members.map((member: User) => member.id),\n });\n }\n }, [defaultReportGroupFetched]);\n\n React.useEffect(() => {\n if (!isEditMode && !isUsersLoading) {\n setReady(true);\n }\n\n if (isEditMode && !isUsersLoading && !isRefetching && !isReportGroupByIDLoading) {\n setReady(true);\n }\n }, [isEditMode, isRefetching, isReportGroupByIDLoading, isUsersLoading]);\n\n const createReportGroupMutation = useMutation(\n (newReportGroup: ReportGroupType) => createReportGroup(newReportGroup),\n {\n onSuccess: () => {\n history.push(`${PLUGIN_BASE_URL}/report-groups/`);\n return;\n },\n }\n );\n\n const submitCreateReportGroup = (data: ReportGroupType): any => {\n createReportGroupMutation.mutate(data);\n };\n\n if (!ready) {\n return ;\n }\n\n return (\n \n \n history.push(prefixRoute(ROUTES.REPORT_GROUP))}\n />\n \n {({ register, errors, control }) => {\n return (\n <>\n
    \n \n \n \n\n \n \n \n
    \n\n {users ? (\n (\n {\n const updatedSelectedMembers = selectedMembers.includes(userID)\n ? selectedMembers.filter((el) => el !== userID)\n : [...selectedMembers, userID];\n\n onChange(updatedSelectedMembers);\n }}\n />\n )}\n name=\"members\"\n control={control}\n />\n ) : (\n \n Report group must have members to be assigned from mSupply user. Please make sure you have mSupply\n datasource selected in Plugin configuration.\n \n )}\n\n
    \n \n
    \n \n );\n }}\n \n
    \n \n );\n};\n\nexport { CreateReportGroup };\n","import React, { useState } from 'react';\nimport { css, cx } from '@emotion/css';\nimport intl from 'react-intl-universal';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { PLUGIN_BASE_URL, ROUTES } from '../../constants';\nimport { prefixRoute } from '../../utils/navigation';\nimport { EmptyListCTA, Loading } from 'components/common';\nimport { Panel, PanelDetails, ScheduleType } from 'types';\nimport { useQuery, useMutation } from 'react-query';\nimport { deleteSchedule, getSchedules } from 'api';\nimport { Button, Card, ConfirmModal, HorizontalGroup, LinkButton, Spinner, Tag, useStyles2 } from '@grafana/ui';\nimport { useToggle } from 'hooks';\nimport { PanelContext, PanelProvider } from 'context';\n// eslint-disable-next-line no-restricted-imports\nimport moment from 'moment';\n\nconst Schedule: React.FC = () => {\n const styles = useStyles2(getStyles);\n\n const [deleteAlertIsOpen, setDeleteAlertIsOpen] = useToggle(false);\n const [deleteScheduleID, setDeleteScheduleID] = useState('');\n\n const {\n data: schedules,\n isLoading,\n refetch: refetchSchedules,\n } = useQuery(`scheduled`, getSchedules, {\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n retry: 0,\n });\n\n const onScheduleDelete = (reportGroupID: string) => {\n setDeleteAlertIsOpen();\n setDeleteScheduleID(reportGroupID);\n };\n\n const { mutate: deleteScheduleMutate } = useMutation(deleteSchedule, {\n onSuccess: () => {\n refetchSchedules();\n return;\n },\n });\n\n const onConfirmDeleteGroup = () => {\n deleteScheduleMutate(deleteScheduleID);\n setDeleteAlertIsOpen();\n };\n\n if (isLoading) {\n return ;\n }\n\n if (!!!schedules || !schedules.length) {\n return ;\n }\n\n return (\n
    \n
    \n \n {intl.get('add_schedule')}\n \n
    \n
      \n {schedules.map((schedule) => (\n
    • \n \n {schedule.name}\n {schedule.description}\n \n {schedule.nextReportTime ? (\n
      Next schedule: {moment.unix(schedule.nextReportTime).format('LLLL')}
      \n ) : (\n ''\n )}\n {schedule.panelDetails && (\n \n
      \n \n \n {({ panels }) => {\n if (!panels || !panels.length) {\n return ;\n }\n\n return (\n !!panels &&\n schedule.panelDetails.map(({ id, panelID, dashboardID }: PanelDetails) => {\n const panel = panels.find(\n (panel: Panel) => panel.id === panelID && panel.dashboardID === dashboardID\n );\n\n if (!panel) {\n return false;\n }\n\n return ;\n })\n );\n }}\n \n \n
      \n \n )}\n
      \n \n \n Edit\n \n onScheduleDelete(schedule.id)}\n >\n {intl.get('delete')}\n \n \n
      \n
    • \n ))}\n
    \n \n
    \n );\n};\n\nconst EmptyList = () => {\n return (\n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n marginTop: css`\n margin-top: ${theme.spacing(2)};\n `,\n tag: css`\n margin-bottom: 6px;\n margin-right: 7px;\n padding: 5px;\n `,\n list: css({\n listStyle: 'none',\n display: 'grid',\n gap: '8px',\n }),\n adjustButtonToRight: css`\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n `,\n heading: css({\n fontSize: theme.v1.typography.heading.h5,\n fontWeight: 'inherit',\n }),\n card: css({\n gridTemplateAreas: `\n \"Figure Heading Actions\"\n \"Figure Description Actions\"\n \"Figure Meta Actions\"\n \"Figure - Actions\"`,\n }),\n description: css({\n margin: '0px',\n fontSize: theme.typography.size.sm,\n }),\n actions: css({\n position: 'relative',\n alignSelf: 'center',\n marginTop: '0px',\n opacity: 0,\n\n '.card-parent:hover &, .card-parent:focus-within &': {\n opacity: 1,\n },\n }),\n});\n\nexport { Schedule };\n","import React from 'react';\n\nimport { NAVIGATION_TITLE, NAVIGATION_SUBTITLE } from '../../constants';\nimport { Page } from '../../components';\nimport { PanelProvider } from 'context';\nimport { CreateScheduleForm } from 'components/schedule/CreateScheduleForm';\nimport { RouteComponentProps } from 'react-router-dom';\n\nconst CreateSchedule: React.FC = () => (\n \n \n \n \n \n \n \n);\n\nexport { CreateSchedule };\n","import { ROUTES } from '../constants';\nimport { Redirect, Route, Switch } from 'react-router-dom';\nimport { prefixRoute, useNavigation } from '../utils/navigation';\nimport { ReportGroup, Schedule, CreateReportGroup, CreateSchedule } from '../Pages';\nimport React from 'react';\n\nconst AppRoutes = () => {\n useNavigation();\n\n return (\n \n \n \n\n {/* Full-width page (this page will have no navigation bar) */}\n \n \n\n \n \n\n {/* Default page */}\n \n \n \n \n );\n};\n\nexport { AppRoutes };\n","import { NavModel } from '@grafana/data';\nimport { NAVIGATION } from '../../constants';\nimport { usePluginProps } from 'context';\nimport { useLocation } from 'react-router-dom';\nimport { getNavModel } from '.';\nimport { useEffect } from 'react';\n\n// Displays a top navigation tab-bar if needed\nfunction useNavigation() {\n const pluginProps = usePluginProps();\n const location = useLocation();\n\n useEffect(() => {\n const excludeURIs: string[] = ['create', 'edit'];\n\n if (!pluginProps) {\n console.error('Root plugin props are not available in the context.');\n return;\n }\n\n const activeId = excludeURIs.some((uri) => location.pathname.includes(uri))\n ? ''\n : Object.keys(NAVIGATION).find((routeId) => location.pathname.includes(routeId)) || '';\n const activeNavItem = NAVIGATION[activeId];\n\n const { onNavChanged, meta, basename } = pluginProps;\n\n // Disable tab navigation\n // (the route is not registered as a navigation item)\n if (!activeNavItem) {\n onNavChanged(undefined as unknown as NavModel);\n }\n\n // Show tabbed navigation with the active tab\n else {\n onNavChanged(\n getNavModel({\n activeId,\n basePath: basename,\n logoUrl: meta.info.logos.large,\n })\n );\n }\n }, [location.pathname, pluginProps]);\n}\n\nexport { useNavigation };\n","import { NAVIGATION_TITLE, NAVIGATION_SUBTITLE, NAVIGATION } from '../../constants';\n\nfunction getNavModel({ activeId, basePath, logoUrl }: { activeId: string; basePath: string; logoUrl: string }) {\n const main = {\n text: NAVIGATION_TITLE,\n subTitle: NAVIGATION_SUBTITLE,\n url: basePath,\n img: logoUrl,\n children: Object.values(NAVIGATION).map((navItem) => ({\n ...navItem,\n active: navItem.id === activeId,\n })),\n };\n\n return {\n main,\n node: main,\n };\n}\n\nexport { getNavModel };\n","import React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport intl from 'react-intl-universal';\n\nimport { AppRootProps } from '@grafana/data';\n\nimport { PluginPropsContext } from '../context';\nimport { AppRoutes } from './AppRoutes';\n\nimport { AppSettings } from 'types';\n\nimport { locales } from '../locales';\nimport { Loading } from 'components';\n\nconst queryClient = new QueryClient();\n\ntype AppRootState = { initDone: boolean };\nclass App extends React.PureComponent, AppRootState> {\n state: AppRootState = {\n // optional second annotation for better type inference\n initDone: false,\n };\n\n componentDidMount() {\n this.loadLocales();\n }\n\n loadLocales() {\n // init method will load CLDR locale data according to currentLocale\n // react-intl-universal is singleton, so you should init it only once in your app\n intl\n .init({\n currentLocale: 'en-UK', // TODO: determine locale here\n fallbackLocale: 'en-US',\n locales,\n })\n .then(() => {\n // After loading CLDR locale data, start to render\n this.setState({\n initDone: true,\n });\n });\n }\n\n render() {\n return this.state.initDone ? (\n \n \n \n \n \n ) : (\n
    \n \n
    \n );\n }\n}\n\nexport { App };\n","import { AppPlugin } from '@grafana/data';\nimport { App } from 'components/App';\nimport { AppSettings } from 'types';\nimport { AppConfig } from './Pages/AppConfig';\n\nexport const plugin = new AppPlugin().setRootPage(App).addConfigPage({\n title: 'Configuration',\n icon: 'fa fa-cog',\n // @ts-ignore - Would expect a Class component, however works absolutely fine with a functional one\n // Implementation: https://github.com/grafana/grafana/blob/fd44c01675e54973370969dfb9e78f173aff7910/public/app/features/plugins/PluginPage.tsx#L157\n body: AppConfig,\n id: 'configuration',\n});\n"],"names":["module","exports","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","_interopDefault","ex","React","IntlMessageFormat","escapeHtml","cookie","queryParser","invariant","merge","currency","numberFormat","i","length","style","defaultFormats","number","createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","Constructor","protoProps","staticProps","prototype","String","defaultMessage","d","msg","this","ReactIntlUniversal","instance","TypeError","classCallCheck","options","currentLocale","locales","warningHandler","_console","console","warn","apply","arguments","fallbackLocale","value","variables","intlGetHook","e","log","_options","formats","getDescendantProp","assign","indexOf","format","err","message","get","el","createElement","dangerouslySetInnerHTML","__html","messageDescriptor","id","getHTML","undefined","getLocaleFromURL","getLocaleFromCookie","getLocaleFromLocalStorage","getLocaleFromBrowser","Promise","resolve","reject","cookieLocaleKey","params","parse","document","localStorageLocaleKey","window","localStorage","getItem","urlLocaleKey","query","location","search","split","locale","reduce","a","b","navigator","language","userLanguage","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","g","freeSelf","self","root","Function","freeExports","nodeType","freeModule","moduleExports","freeProcess","process","nodeUtil","require","types","binding","nodeIsTypedArray","isTypedArray","func","thisArg","args","call","uid","transform","arrayProto","Array","funcProto","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","exec","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","Symbol","Uint8Array","getPrototype","allocUnsafe","getPrototypeOf","arg","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","max","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","index","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","has","pop","push","getMapData","pairs","LARGE_ARRAY_SIZE","baseGetTag","isOwn","tag","unmasked","getRawTag","objectToString","baseIsArguments","isObjectLike","baseMerge","source","srcIndex","customizer","stack","iteratee","keysFunc","iterable","baseFor","srcValue","mergeFunc","safeGet","stacked","typedArray","buffer","arrayBuffer","newValue","isCommon","isArr","isArray","isBuff","isTyped","isArrayLike","copyArray","isDeep","slice","cloneBuffer","constructor","byteLength","byteOffset","Ctor","isPlainObject","isArguments","isNew","copyObject","keysIn","toPlainObject","isFunction","isPrototype","initCloneObject","baseMergeDeep","baseSetToString","string","identity","map","type","getValue","isMasked","test","toSource","baseIsNative","isIndex","setToString","count","lastCalled","stamp","remaining","shortOut","other","isLength","baseUnary","inherited","isArg","isType","skipIndexes","n","baseTimes","arrayLikeKeys","nativeKeysIn","isProto","baseKeysIn","assigner","start","otherArgs","overRest","baseRest","sources","guard","isIterateeCall","__WEBPACK_EXTERNAL_MODULE__6__","__WEBPACK_EXTERNAL_MODULE__7__","__WEBPACK_EXTERNAL_MODULE__8__","IntlPolyfill","Intl","__applyLocaleSensitivePrototypes","REACT_ELEMENT_TYPE","_typeof","iterator","obj","jsx","for","children","defaultProps","childrenLength","propName","childArray","$$typeof","ref","_owner","defineProperty$1","_extends","selfGlobal","babelHelpers$1","freeze","asyncToGenerator","fn","gen","step","info","error","done","then","defineEnumerableProperties","descs","desc","defaults","getOwnPropertyNames","getOwnPropertyDescriptor","property","receiver","parent","getter","inherits","subClass","superClass","setPrototypeOf","__proto__","interopRequireDefault","__esModule","default","interopRequireWildcard","newObj","newArrowCheck","innerThis","boundThis","objectDestructuringEmpty","objectWithoutProperties","possibleConstructorReturn","ReferenceError","setter","slicedToArray","arr","_arr","_n","_d","_e","_s","_i","next","sliceIterator","slicedToArrayLoose","_step","_iterator","taggedTemplateLiteral","strings","raw","taggedTemplateLiteralLoose","temporalRef","val","name","undef","temporalUndefined","toArray","from","toConsumableArray","arr2","typeof","extends","instanceof","left","right","hasInstance","realDefineProp","sentinel","es3","__defineGetter__","hop","arrIndexOf","t","objCreate","F","k","arrSlice","arrConcat","concat","arrPush","arrJoin","join","arrShift","shift","fnBind","bind","thisObj","internals","secret","random","Record","List","createRegExpRestore","disableRegExpRestore","regExpCache","lastMatch","leftContext","multiline","input","esc","lm","reg","m","exprStr","match","expr","lastIndex","toObject","toNumber","Number","getInternalProperties","__getInternalProperties","expBCP47Syntax","expVariantDupes","expSingletonDupes","expExtSequences","defaultLocale","redundantTags","tags","subtags","BU","DD","FX","TP","YD","ZR","heploc","iw","ji","jw","mo","ayx","bjd","ccq","cjr","cka","cmk","drh","drw","gav","hrr","ibi","kgh","lcq","mst","myt","sca","tie","tkk","tlw","tnf","ybd","yma","extLang","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","aed","aen","afb","afg","ajp","apc","apd","arb","arq","ars","ary","arz","ase","asf","asp","asq","asw","auz","avl","ayh","ayl","ayn","ayp","bbz","bfi","bfk","bjn","bog","bqn","bqy","btj","bve","bvl","bvu","bzs","cdo","cds","cjy","cmn","coa","cpx","csc","csd","cse","csf","csg","csl","csn","csq","csr","czh","czo","doq","dse","dsl","dup","ecs","esl","esn","eso","eth","fcs","fse","fsl","fss","gan","gds","gom","gse","gsg","gsm","gss","gus","hab","haf","hak","hds","hji","hks","hos","hps","hsh","hsl","hsn","icl","ils","inl","ins","ise","isg","isr","jak","jax","jcs","jhs","jls","jos","jsl","jus","kgi","knn","kvb","kvk","kvr","kxd","lbs","lce","lcf","liw","lls","lsg","lsl","lso","lsp","lst","lsy","ltg","lvs","lzh","mdl","meo","mfa","mfb","mfs","min","mnp","mqg","mre","msd","msi","msr","mui","mzc","mzg","mzy","nan","nbs","ncs","nsi","nsl","nsp","nsr","nzs","okl","orn","ors","pel","pga","pks","prl","prz","psc","psd","pse","psg","psl","pso","psp","psr","pys","rms","rsi","rsl","sdl","sfb","sfs","sgg","sgx","shu","slf","sls","sqk","sqs","ssh","ssp","ssr","svk","swc","swh","swl","syy","tmw","tse","tsm","tsq","tss","tsy","tza","ugn","ugy","ukl","uks","urk","uzn","uzs","vgt","vkk","vkt","vsi","vsl","vsv","wuu","xki","xml","xmm","xms","yds","ysl","yue","zib","zlm","zmi","zsl","zsm","toLatinUpperCase","str","ch","charAt","toUpperCase","IsStructurallyValidLanguageTag","CanonicalizeLanguageTag","parts","toLowerCase","sort","_max","expCurrencyCode","expUnicodeExSeq","CanonicalizeLocaleList","seen","O","len","isNaN","floor","abs","toInteger","Infinity","pow","toLength","Pk","kValue","RangeError","BestAvailableLocale","availableLocales","candidate","pos","lastIndexOf","substring","LookupMatcher","requestedLocales","availableLocale","noExtensionsLocale","extension","extensionIndex","ResolveLocale","relevantExtensionKeys","localeData","r","BestFitMatcher","foundLocale","extensionSubtags","extensionSubtagsLength","supportedExtension","keyLocaleData","supportedExtensionAddition","keyPos","requestedValue","optionsValue","privateIndex","preExtension","postExtension","LookupSupportedLocales","subset","SupportedLocales","matcher","localeMatcher","P","BestFitSupportedLocales","GetOption","values","fallback","Boolean","GetNumberOption","minimum","maximum","ll","currencyMinorUnits","BHD","BYR","XOF","BIF","XAF","CLF","CLP","KMF","DJF","XPF","GNF","ISK","IQD","JPY","JOD","KRW","KWD","LYD","OMR","PYG","RWF","TND","UGX","UYI","VUV","VND","NumberFormatConstructor","InitializeNumberFormat","NumberFormat","internal","regexpRestore","opt","dataLocale","s","normalized","c","cDigits","cd","mnid","mnfd","mxfd","mnsd","minimumSignificantDigits","mxsd","maximumSignificantDigits","stylePatterns","patterns","positivePattern","negativePattern","GetFormatNumber","bf","FormatNumber","FormatNumberToParts","x","PartitionNumberPattern","part","nums","ild","symbols","latn","pattern","beginIndex","endIndex","nextIndex","Error","literal","p","isFinite","_n2","ToRawPrecision","ToRawFixed","numSys","digits","digit","integer","fraction","decimalSepIndex","groupSepSymbol","group","groups","pgSize","primaryGroupSize","sgSize","secondaryGroupSize","end","idx","integerGroup","decimalSepSymbol","decimal","infinity","plusSignSymbol","plusSign","minusSignSymbol","minusSign","percentSignSymbol","percentSign","currencies","_literal","_literal2","minPrecision","maxPrecision","log10","round","LOG10E","log10Floor","f","exp","LN10","cut","minInteger","minFraction","maxFraction","toFixed","int","arab","arabext","bali","beng","deva","fullwide","gujr","guru","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","prop","expDTComponents","expPatternTrimmer","unwantedDTCs","dtKeys","tmKeys","isDateFormatOnly","isTimeFormatOnly","joinDateAndTimeFormats","dateFormatObj","timeFormatObj","o","_","j","computeFinalPatterns","formatObj","pattern12","extendedPattern","$0","expDTComponentsMeta","era","year","quarter","month","week","day","weekday","hour12","hour","minute","second","timeZoneName","createDateTimeFormat","skeleton","originalPattern","validSyntheticProps","numeric","narrow","short","long","dateWidths","resolveDateString","ca","component","width","gregory","alts","resolved","DateTimeFormatConstructor","InitializeDateTimeFormat","DateTimeFormat","dateTimeFormat","ToDateTimeOptions","tz","timeZone","dateTimeComponents","bestFormat","dataLocaleData","availableFormats","timeFormats","dateFormats","computed","timeRelatedFormats","dateRelatedFormats","full","medium","createDateTimeFormats","ToDateTimeFormats","bestScore","score","optionsProp","formatProp","optionsPropIndex","formatPropIndex","delta","BasicFormatMatcher","_hr","optionsPropNames","_bestFormat","propValue","_ref2","generateSyntheticFormat","_property","BestFitFormatMatcher","_prop","hr12","hourNo0","GetFormatDateTime","required","opt2","needDefaults","date","FormatDateTime","CreateDateTimeParts","nf","useGrouping","nf2","minimumIntegerDigits","tm","calendars","fv","v","substr","FormatToPartsDateTime","ls","__localeSensitiveProtos","toLocaleString","toLocaleDateString","toLocaleTimeString","nu","setDefaultLocale","addLocaleData","matchHtmlRegExp","escape","html","charCodeAt","qs","sep","regexp","maxKeys","kstr","vstr","decodeURIComponent","stringifyPrimitive","ks","encodeURIComponent","filter","condition","argIndex","framesToPop","global","method","con","dummy","properties","methods","unstable_batchedUpdates","notifyManager","defaultContext","QueryClientSharingContext","getQueryClientContext","contextSharing","ReactQueryClientContext","useQueryClient","queryClient","QueryClientProvider","_ref","client","_ref$contextSharing","mount","unmount","Context","Provider","MutationObserver","_Subscribable","_this","setOptions","bindMethods","updateResult","_proto","mutate","reset","defaultMutationOptions","onUnsubscribe","_this$currentMutation","listeners","currentMutation","removeObserver","onMutationUpdate","action","notifyOptions","onSuccess","onError","notify","getCurrentResult","currentResult","mutateOptions","getMutationCache","build","addObserver","execute","state","isLoading","status","isSuccess","isError","isIdle","_this2","context","onSettled","forEach","listener","shouldThrowError","suspense","_useErrorBoundary","useMutation","arg1","arg2","arg3","mountedRef","forceUpdate","obsRef","current","unsubscribe","subscribe","catch","useErrorBoundary","mutateAsync","QueryObserver","trackedProps","previousSelectError","remove","refetch","onSubscribe","currentQuery","shouldFetchOnMount","executeFetch","updateTimers","destroy","shouldFetchOnReconnect","enabled","refetchOnReconnect","isStale","shouldFetchOnWindowFocus","refetchOnWindowFocus","clearTimers","prevOptions","prevQuery","defaultQueryObserverOptions","queryKey","updateQuery","mounted","hasListeners","shouldFetchOptionally","staleTime","updateStaleTimeout","nextRefetchInterval","computeRefetchInterval","currentRefetchInterval","updateRefetchInterval","getOptimisticResult","defaultedOptions","getQueryCache","createResult","trackResult","trackedResult","trackProp","includes","getNextResult","_this3","isFetching","throwOnError","getCurrentQuery","fetch","meta","refetchPage","fetchOptimistic","_this4","fetchOptions","_this5","promise","_this6","clearStaleTimeout","timeout","dataUpdatedAt","staleTimeoutId","setTimeout","_this$options$refetch","refetchInterval","nextInterval","_this7","clearRefetchInterval","refetchIntervalId","setInterval","refetchIntervalInBackground","focusManager","clearTimeout","clearInterval","prevResult","prevResultState","currentResultState","prevResultOptions","currentResultOptions","queryChange","queryInitialState","currentQueryInitialState","prevQueryResult","previousQueryResult","errorUpdatedAt","isPreviousData","isPlaceholderData","optimisticResults","fetchOnMount","fetchOptionally","keepPreviousData","dataUpdateCount","select","_this$previousSelect","previousSelect","structuralSharing","selectError","placeholderData","failureCount","fetchFailureCount","isFetched","errorUpdateCount","isFetchedAfterMount","isRefetching","isLoadingError","isRefetchError","shouldNotifyListeners","_this$options","notifyOnChangeProps","notifyOnChangePropsExclusions","includedProps","some","typedKey","changed","isIncluded","isExcluded","defaultNotifyOptions","cache","onQueryUpdate","_this8","retryOnMount","shouldLoadOnMount","refetchOnMount","shouldRefetchOnMount","isStaleByTime","_isReset","QueryErrorResetBoundaryContext","clearReset","isReset","useQuery","Observer","errorResetBoundary","cacheTime","observer","useBaseQuery","Query","config","abortSignalConsumed","hadObservers","defaultOptions","observers","queryHash","initialState","getDefaultState","scheduleGc","_this$options$cacheTi","setDefaultOptions","clearGcTimeout","gcTimeout","optionalRemove","setData","updater","_this$options$isDataE","prevData","isDataEqual","dispatch","updatedAt","setState","setStateOptions","cancel","_this$retryer","retryer","silent","isActive","isInvalidated","onFocus","_this$retryer2","find","continue","onOnline","_this$retryer3","isTransportCancelable","revert","cancelRetry","getObserversCount","invalidate","_this$options$behavio","_context$fetchOptions","_abortController$abor","cancelRefetch","_this$retryer4","continueRetry","queryFn","abortController","queryFnContext","pageParam","signal","_this$options$behavio2","_context$fetchOptions2","fetchFn","behavior","onFetch","revertState","fetchMeta","abort","onFail","onPause","onContinue","retry","retryDelay","reducer","initialData","initialDataUpdatedAt","hasData","isPaused","_action$meta","_action$dataUpdatedAt","QueryCache","queries","queriesMap","_options$queryHash","defaultQueryOptions","getQueryDefaults","add","queryInMap","getAll","filters","exact","findAll","event","MutationCache","mutations","mutationId","mutation","mutationCache","mutationKey","getMutationDefaults","resumePausedMutations","pausedMutations","getNextPageParam","pages","QueryClient","queryCache","queryDefaults","mutationDefaults","unsubscribeFocus","onlineManager","unsubscribeOnline","_this$unsubscribeFocu","_this$unsubscribeOnli","fetching","isMutating","getQueryData","_this$queryCache$find","getQueriesData","queryKeyOrFilters","setQueryData","parsedOptions","setQueriesData","getQueryState","_this$queryCache$find2","removeQueries","resetQueries","_parseFilterArgs3","refetchFilters","active","refetchQueries","cancelQueries","_parseFilterArgs4","_parseFilterArgs4$","cancelOptions","promises","all","invalidateQueries","_ref3","_filters$refetchActiv","_filters$refetchInact","_parseFilterArgs5","refetchActive","inactive","refetchInactive","_parseFilterArgs6","fetchQuery","prefetchQuery","fetchInfiniteQuery","_context$fetchOptions3","_context$fetchOptions4","_context$state$data","_context$state$data2","fetchMore","isFetchingNextPage","direction","isFetchingPreviousPage","oldPages","oldPageParams","pageParams","abortSignal","newPageParams","cancelled","buildNewPages","param","page","previous","fetchPage","manual","queryFnResult","_manual","_param","getPreviousPageParam","shouldFetchFirstPage","_loop","_param2","finalPromise","prefetchInfiniteQuery","cancelMutations","executeMutation","getDefaultOptions","setQueryDefaults","_this$queryDefaults$f","setMutationDefaults","_this$mutationDefault","_defaulted","__WEBPACK_EXTERNAL_MODULE__21__","TYPE","isLiteralElement","isArgumentElement","argument","isNumberElement","isDateElement","isTimeElement","time","isSelectElement","isPluralElement","plural","isPoundElement","pound","isNumberSkeleton","isDateTimeSkeleton","extendStatics","__extends","__","__assign","SyntaxError","_super","expected","found","captureStackTrace","buildMessage","hex","literalEscape","classEscape","describeExpectation","expectation","text","escapedParts","inverted","description","expected1","descriptions","describeExpected","found1","pegParse","peg$result","peg$FAILED","peg$startRuleFunctions","peg$parsestart","peg$startRuleFunction","peg$c3","peg$literalExpectation","peg$c5","peg$otherExpectation","peg$c6","peg$c7","peg$c8","peg$c9","peg$c11","peg$c12","peg$c13","peg$classExpectation","peg$c14","peg$c15","peg$c17","peg$c19","peg$c22","peg$c23","peg$c26","messageCtx","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","insertLocation","peg$c32","peg$c33","peg$c34","peg$c35","peg$c36","peg$c37","peg$c38","peg$c39","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","peg$c50","peg$c51","peg$c53","peg$c54","peg$c57","peg$c62","peg$c63","peg$c64","peg$c65","peg$c66","peg$c67","peg$c68","peg$c69","peg$c71","peg$c74","peg$c75","peg$c76","peg$c81","peg$c83","peg$c84","peg$c86","peg$c88","peg$c89","peg$c90","peg$c91","peg$c93","peg$currPos","peg$savedPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","peg$computeLocation","location1","peg$buildSimpleError","text1","ignoreCase","peg$computePosDetails","details","startPos","endPos","startPosDetails","endPosDetails","offset","peg$fail","peg$parsemessage","s0","s1","peg$parsemessageElement","messageText","peg$parsemessageText","peg$parseliteralElement","s3","s5","peg$parse_","peg$parseargNameOrNumber","peg$parseargumentElement","s7","s9","s10","s11","s12","s2","peg$parsenumberSkeletonToken","tokens","peg$parsenumberSkeleton","peg$parsenumberArgStyle","peg$parsenumberFormatElement","peg$parsedateTimeSkeletonLiteral","peg$parsedateTimeSkeletonPattern","peg$parsedateTimeSkeleton","peg$parsedateOrTimeArgStyle","peg$parsedateOrTimeFormatElement","peg$parsesimpleFormatElement","s13","s14","s15","peg$parsenumber","peg$parsepluralOption","pluralType","_a","optionLocation","peg$c52","peg$parsepluralElement","peg$parseselectOption","peg$c55","peg$parseselectElement","peg$parsepoundElement","peg$parsedoubleApostrophes","peg$parsequotedString","peg$parseunquotedString","peg$parsenumberSkeletonId","s4","peg$parsewhiteSpace","peg$parsenumberSkeletonTokenOption","stem","peg$c20","s6","peg$parseargName","peg$parsepluralRuleSelectValue","peg$parsepatternSyntax","num","peg$parseargNumber","isInPluralOption","peg$parseescapedChar","parseInt","captureLocation","PLURAL_HASHTAG_REGEX","normalizeHashtagInPlural","els","matchingLiteralElIndex","literalEl","el_1","newEls","il","jl","__spreadArrays","opts","getCacheId","inputs","JSON","stringify","FormatConstructor","cacheId","DATE_TIME_REGEX","parseDateTimeSkeleton","hourCycle","FRACTION_PRECISION_REGEX","SIGNIFICANT_PRECISION_REGEX","parseSignificantPrecision","g1","g2","parseSign","signDisplay","currencySign","parseNotationOptions","convertNumberSkeletonToNumberFormatOptions","tokens_1","token","maximumFractionDigits","unit","notation","compactDisplay","currencyDisplay","unitDisplay","minimumFractionDigits","signOpts","domParser","FormatError","variableId","formatToParts","formatters","currentPluralValue","originalMessage","els_1","getNumberFormat","varName","getDateTimeFormat","PluralRules","rule","getPluralRules","lastPart","formatToString","TOKEN_REGEX","counter","restoreRichPlaceholderMessage","objectParts","SIMPLE_XML_REGEX","TEMPLATE_ID","VOID_ELEMENTS","formatHTMLElement","tagName","outerHTML","textContent","childNodes","isVoidElement","formatFnOrValue","chunks","child","formatHTMLMessage","formattedMessage","DOMParser","content","parseFromString","getElementById","tagsToFormat","getElementsByTagName","caseSensitiveTags","createDefaultFormatters","dateTime","pluralRules","overrideFormats","defaultConfig","configs","formatterCache","ast","resolvedOptions","supportedLocalesOf","getAst","__parse","c1","c2","percent","pairSplitRegExp","dec","decode","pair","eq_idx","trim","tryDecode","serialize","enc","encode","fieldContentRegExp","maxAge","domain","path","expires","toUTCString","httpOnly","secure","sameSite","TimePicker","openButton","fromField","toField","applyTimeRange","calendar","label","closeButton","absoluteTimeRangeTitle","DataSource","TestData","QueryTab","scenarioSelectContainer","scenarioSelect","noise","seriesCount","spread","startValue","drop","DataSourceHttpSettings","urlInput","Jaeger","traceIDInput","Prometheus","configPage","exemplarsAddButton","internalLinkSwitch","exemplarMarker","Menu","MenuComponent","MenuGroup","MenuItem","SubMenu","container","icon","Panels","Panel","title","headerItems","containerByTitle","headerCornerInfo","Visualization","Graph","VisualizationTab","legendSection","Legend","legendItemAlias","showLegendSwitch","xAxis","labels","BarGauge","valueV2","PieChart","svgSlice","Text","Table","header","footer","VizLegend","seriesName","Drawer","General","expand","contract","close","rcContentWrapper","PanelEditor","OptionsPane","fieldLabel","DataPane","applyButton","toggleVizPicker","toggleVizOptions","toggleTableView","PanelInspector","Data","Stats","Json","refreshButton","jsonObjectKeys","Tab","RefreshPicker","runButton","intervalButton","runButtonV2","intervalButtonV2","queryInspectorButton","addQuery","QueryEditorRows","rows","QueryEditorRow","actionButton","AlertTab","Alert","alert","alertV2","TransformTab","newTransform","transformationEditor","transformationEditorDebugger","Transforms","card","Reduce","modeLabel","calculationsLabel","searchInput","PageToolbar","item","QueryEditorToolbarItem","button","BackButton","backArrow","OptionsGroup","toggle","PluginVisualization","Select","option","singleValue","FieldConfigEditor","OverridesConfigEditor","FolderPicker","containerV2","ReadonlyFolderPicker","DataSourcePicker","inputV2","TimeZonePicker","WeekStartPicker","placeholder","TraceViewer","spanBar","QueryField","ValuePicker","Search","section","sectionV2","items","itemsV2","cards","collapseFolder","expandFolder","dashboardItem","dashboardItems","dashboardCard","DashboardLinks","dropDown","link","LoadingIndicator","CallToActionCard","buttonV2","DataLinksContextMenu","singleLink","CodeEditor","DashboardImportPage","textarea","submit","ImportDashboardForm","PanelAlertTabContent","VisualizationPreview","ColorSwatch","DashboardRow","UserProfile","profileSaveButton","preferencesSaveButton","orgsTable","sessionsTable","Login","url","username","password","skip","Home","delete","readOnly","saveAndTest","DataSources","dataSources","AddDataSource","dataSourcePlugins","dataSourcePluginsV2","ConfirmModal","AddDashboard","addNewPanel","addNewRow","addNewPanelLibrary","Dashboard","DashNav","nav","navV2","submenu","submenuItem","submenuItemLabels","submenuItemValueDropDownValueLinkTexts","submenuItemValueDropDownDropDown","submenuItemValueDropDownOptionTexts","Settings","deleteDashBoard","sectionItems","saveDashBoard","saveAsDashBoard","timezone","Annotations","addAnnotationCTA","addAnnotationCTAV2","Variables","addVariableCTA","addVariableCTAV2","newButton","table","tableRowNameFields","tableRowDefinitionFields","tableRowArrowUpButtons","tableRowArrowDownButtons","tableRowDuplicateButtons","tableRowRemoveButtons","Edit","headerLink","modeLabelNew","modeLabelEdit","generalNameInput","generalTypeSelect","generalLabelInput","generalHideSelect","selectionOptionsMultiSwitch","selectionOptionsIncludeAllSwitch","selectionOptionsCustomAllInput","previewOfValuesOption","submitButton","QueryVariable","queryOptionsDataSourceSelect","queryOptionsRefreshSelect","queryOptionsRegExInput","queryOptionsSortSelect","queryOptionsQueryInput","valueGroupsTagsEnabledSwitch","valueGroupsTagsTagsQueryInput","valueGroupsTagsTagsValuesQueryInput","ConstantVariable","constantOptionsQueryInput","TextBoxVariable","textBoxOptionsQueryInput","Dashboards","dashboards","SaveDashboardAsModal","newName","save","SaveDashboardModal","saveVariables","saveTimerange","SharePanelModal","linkToRenderedImage","Explore","graph","scrollBar","SoloPanel","PluginsList","list","listItem","signatureErrorNotice","PluginPage","signatureInfo","disabledInfo","PlaylistForm","interval","itemRow","itemIdType","itemTagType","itemMoveUp","itemMoveDown","itemDelete","components","selectors","__WEBPACK_EXTERNAL_MODULE__29__","_setPrototypeOf","_inheritsLoose","isServer","noop","functionalUpdate","isValidTimeout","ensureQueryKeyArray","timeUntilStale","parseQueryArgs","isQueryKey","parseMutationArgs","mutationFn","parseFilterArgs","matchQuery","predicate","stale","hashQueryKeyByOptions","partialMatchKey","queryStatusFilter","mapQueryStatusFilter","matchMutation","hashQueryKey","queryKeyHashFn","partialDeepEqual","replaceEqualDeep","aSize","bItems","bSize","copy","equalItems","shallowEqualObjects","hasObjectPrototype","ctor","prot","sleep","scheduleMicrotask","callback","getAbortController","AbortController","defaultRetryDelay","isCancelable","CancelledError","isCancelledError","Retryer","cancelFn","continueFn","promiseResolve","promiseReject","isResolved","outerResolve","outerReject","run","promiseOrValue","_unused","_config$retry","_config$retryDelay","delay","shouldRetry","continueResolve","FocusManager","setup","_window","addEventListener","removeEventListener","cleanup","setEventListener","_this$cleanup","_this$cleanup2","focused","setFocused","isFocused","visibilityState","Subscribable","OnlineManager","online","setOnline","isOnline","onLine","logger","getLogger","setLogger","newLogger","NotifyManager","queue","transactions","notifyFn","batchNotifyFn","batch","flush","schedule","batchCalls","_len","_key","setNotifyFunction","setBatchNotifyFunction","Mutation","restored","onMutate","_this$options$retry","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","loaded","__webpack_modules__","definition","globalThis","nmd","paths","PluginPropsContext","usePluginProps","useContext","__rest","getOwnPropertySymbols","__awaiter","_arguments","generator","fulfilled","rejected","getReportGroups","getBackendSrv","deleteReportGroup","reportGroupID","getDatasources","getDatasource","panelUsesVariable","sql","variableName","getDashboard","uuid","searchForDashboards","getSchedules","deleteSchedule","scheduleID","sendTestEmail","useDatasourceID","pluginProps","pluginMeta","settings","jsonData","datasourceID","useToggle","initial","useState","setToggle","useCallback","ROUTES","PLUGIN_ID","PLUGIN_BASE_URL","NAVIGATION_TITLE","NAVIGATION_SUBTITLE","NAVIGATION","REPORT_GROUP","sub","SCHEDULES","getIntervals","getWeekDays","prefixRoute","route","parseOrDefault","defaultValue","PanelContext","isPanelsLoading","panels","panelDetails","setPanelDetails","onUpdateVariable","panel","selectedValue","onUpdateLookback","selectableValue","PanelProvider","setIsPanelsLoading","dashboardMeta","newDashboardMeta","folderTitle","dashboardResponses","dashboard","datasource","datasourceName","templating","mappedPanels","rawPanel","rawSql","targets","variable","varDatasource","dashboardID","acc","flat","getPanels","useEffect","newPanelDetails","panelID","lookback","prevPanels","myIndex","findIndex","newVariable","newVariables","SecretInput","isConfigured","onReset","HorizontalGroup","Input","disabled","Button","onClick","variant","ctaStyle","css","infoBoxStyles","EmptyListCTA","buttonIcon","buttonLink","buttonTitle","buttonDisabled","proTip","proTipLink","proTipLinkTitle","proTipTarget","infoBox","infoBoxTitle","Icon","href","className","ctaElementClassName","ButtonEl","LinkButton","CallToActionElement","callToActionElement","Pagination","currentPage","numberOfPages","onNavigate","hideWhenSinglePage","showSmallVersion","styles","useStyles2","getStyles","pageLengthToCondense","pageButtons","useMemo","condensePages","getListItem","pagesToRender","pageIndex","lowerBoundIndex","upperBoundIndex","differenceOfBounds","currentPageIsBetweenBounds","ellipsisOffset","pageOffset","ellipsis","PageHeader","subTitle","headerCanvas","backButton","theme","colors","background","canvas","Page","headerProps","otherProps","cx","wrapper","CustomScrollbar","autoHeightMin","Contents","marginTop","Loading","rest","loadingWrapper","LoadingPlaceholder","AppConfigForm","plugin","loading","setLoading","datasources","isDatasourceListLoading","pinned","grafanaUsername","grafanaPassword","grafanaURL","isGrafanaPasswordSet","senderEmailAddress","senderEmailPassword","isSenderEmailPasswordSet","senderEmailHost","senderEmailPort","FieldSet","Field","onChange","menuShouldPortal","selectedDatasource","updatePluginAndReload","secureJsonData","fromEntries","colorWeak","secondary","spacing","marginTopXl","pluginId","updatePlugin","locationService","post","response","UserList","users","userListError","onUserChecked","checkedUsers","searchQuery","setSearchQuery","isNoEmailUsersHidden","setIsNoEmailUsersHidden","totalPages","paginationStates","setPaginationStates","onIsNoEmailUsersHiddenChange","currentTarget","checked","filteredUser","user","e_mail","getPaginatedUsers","ceil","wrap","marginBottom","align","justify","userID","Tag","EmptySearchResult","InlineField","grow","prefix","suffix","transparent","InlineSwitch","VerticalGroup","severity","checkboxWrapper","Checkbox","padding","renderUser","PanelItem","onPanelChecked","panelDetail","checkedPanels","cursor","preventDefault","marginForCheckbox","checkedPanel","PanelVariables","PanelList","panelListError","Card","display","flex","alignItems","Tooltip","placement","marginLeft","marginRight","detail","PanelVariableOptions","onUpdate","multiSelectable","selectableOptions","selectedOptions","refresh","includeAll","selectAllOption","datasourceId","optionsResponse","frames","results","A","datum","refreshPanelOptions","flexDirection","InlineFormLabel","MultiSelect","selected","filterOption","closeMenuOnSelect","timeToRegEx","timeFromRegEx","timeFilterRegEx","lookbacks","vars","usesMacro","border","tooltip","variableOptions","multi","PanelVariableTextInput","defaultFormValues","CreateScheduleForm","defaultSchedule","setDefaultSchedule","history","useHistory","scheduleIdToEdit","useParams","isEditMode","ready","setReady","isDefaultScheduleFetched","setIsDefaultScheduleFetched","defaultScheduleFetched","isScheduleByIDLoading","nextReportTime","restDefaultScheduleFetched","prevDetails","prevDetail","defaultDetail","reportGroups","createScheduleMutation","newSchedule","testEmails","isSendTestEmailLoading","titleHref","parentHref","onGoBack","Spinner","ToolbarButton","Form","onSubmit","selectedPanels","validateOnMount","defaultValues","validateOn","CreateScheduleFormPartial","isNullOrUndefined","isObjectType","isUndefined","VALIDATION_MODE","UNDEFINED","FormContext","displayName","useFormContext","shouldRenderFormState","formStateData","readFormStateRef","isRoot","formState","omit","isProxyEnabled","HTMLElement","Proxy","useController","rules","control","shouldUnregister","defaultValuesRef","register","fieldsRef","unregister","fieldArrayNamesRef","controllerSubjectRef","shouldUnmountUnregister","inFieldArrayActionRef","onBlur","isFieldArray","names","getNodeParentName","isNameInFieldArray","setInputStateValue","_f","formStateRef","formStateSubjectRef","nameRef","updateFormState","readFormState","isDirty","dirtyFields","touchedFields","isValidating","isValid","errors","formStateSubscription","convertToArrayPayload","localReadFormStateRef","getProxyFormState","useFormState","controllerSubscription","shouldUnmount","field","getControllerValue","elm","fieldState","invalid","isTouched","Controller","render","setValue","watch","reportGroup","getReportGroupOptions","InlineFieldRow","TimeOfDayPicker","inter","valueAsNumber","renderInterval","updatedSelectedPanels","selectedPanel","EmptyList","ReportGroup","deleteAlertIsOpen","setDeleteAlertIsOpen","deleteReportGroupID","setDeleteReportGroupID","deleteGroup","refetchReportGroups","adjustButtonToRight","heading","members","email","actions","isOpen","body","confirmText","onConfirm","onDismiss","listStyle","fontSize","v1","typography","h5","fontWeight","gridTemplateAreas","margin","sm","position","alignSelf","opacity","CreateReportGroup","reportGroupIdToEdit","fields","schema","columnsToExtract","indexes","myObj","getUsers","isUsersLoading","defaultReportGroup","setDefaultReportGroup","defaultReportGroupFetched","isReportGroupByIDLoading","member","createReportGroupMutation","newReportGroup","selectedMembers","updatedSelectedMembers","Schedule","deleteScheduleID","setDeleteScheduleID","schedules","refetchSchedules","deleteScheduleMutate","flexWrap","lineHeight","Consumer","gap","CreateSchedule","AppRoutes","useLocation","activeId","uri","pathname","routeId","activeNavItem","onNavChanged","basename","main","basePath","img","logoUrl","navItem","node","getNavModel","logos","large","useNavigation","Switch","Route","Redirect","to","App","initDone","loadLocales","AppPlugin","setRootPage","addConfigPage"],"sourceRoot":""} \ No newline at end of file diff --git a/release/data/plugins/excel_report_email_scheduler/plugin.json b/release/data/plugins/excel_report_email_scheduler/plugin.json new file mode 100644 index 00000000..513ea7ab --- /dev/null +++ b/release/data/plugins/excel_report_email_scheduler/plugin.json @@ -0,0 +1,69 @@ +{ + "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json", + "type": "app", + "name": "Excel report e-mail scheduler", + "id": "msupplyfoundation-datasource", + "backend": true, + "alerting": false, + "metrics": false, + "annotations": false, + "executable": "gpx_excel_report_email_scheduler", + "info": { + "description": "Grafana plugin for mSupply Dashboard application. The plugin takes data from panels of mSupply dashboard to generate excel reports. The reports are then emailed to a custom user group created with mSupply users pulled from mSupply Dashboard's datasource. The timing of the scheduler can be set in the plugin.", + "author": { + "name": "mSupply Foundation", + "url": "https://msupply.foundation/" + }, + "keywords": ["grafana-plugin", "mSupply-foundation", "mSupply-dashboard", "datasource", "panel"], + "logos": { + "small": "img/msupply_light_icon.svg", + "large": "img/msupply_light_icon.svg" + }, + "links": [ + { + "name": "Website", + "url": "https://github.com/openmsupply/msupply-dashboard-app" + }, + { + "name": "License", + "url": "https://github.com/openmsupply/msupply-dashboard-app/blob/master/LICENSE" + } + ], + "screenshots": [], + "version": "2.1.1", + "updated": "2022-09-16" + }, + "includes": [ + { + "type": "page", + "name": "Report Groups", + "icon": "fa fa-group", + "path": "/a/msupplyfoundation-datasource", + "role": "Admin", + "addToNav": true, + "defaultNav": true + }, + { + "type": "page", + "name": "Schedules", + "icon": "fa fa-calendar", + "path": "/a/msupplyfoundation-datasource/schedules", + "role": "Admin", + "addToNav": true + }, + + { + "type": "page", + "icon": "fa fa-cog", + "name": "Configuration", + "path": "/plugins/msupplyfoundation-datasource", + "role": "Admin", + "addToNav": true + } + ], + "dependencies": { + "grafanaDependency": ">=8.0.0", + "grafanaVersion": "8.0.0", + "plugins": [] + } +} diff --git a/release/data/plugins/msupply-dashboard-app/backend/LICENSE b/release/data/plugins/msupply-dashboard-app/backend/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/release/data/plugins/msupply-dashboard-app/backend/MANIFEST.txt b/release/data/plugins/msupply-dashboard-app/backend/MANIFEST.txt deleted file mode 100644 index b1331be3..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/MANIFEST.txt +++ /dev/null @@ -1,45 +0,0 @@ - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "manifestVersion": "2.0.0", - "signatureType": "private", - "signedByOrg": "msupplyfoundation", - "signedByOrgName": "msupplyfoundation", - "rootUrls": [ - "https://demo-board.msupply.org:3000/", - "https://ci.msupply.org:3000/", - "https://liberia.msupply.org:3000/", - "https://tonga-vax.msupply.org:3000/", - "https://timor.msupply.org:3000/", - "http://localhost:3000/", - "https://vanuatu-vax.msupply.org:3000/", - "https://tokelau.msupply.org:3000/", - "https://tonga.msupply.org:3000/", - "https://who-demo.msupply.org:3000/" - ], - "plugin": "msupplyfoundation-datasource", - "version": "1.0.0", - "time": 1630713468977, - "keyId": "7e4d0c6a708866e7", - "files": { - "gpx_msupply-datasource_windows_amd64.exe": "3bd870e32e4264057300ef58e1161b002b86415e6ba10ece05d5f701d440e770", - "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", - "module.js.map": "6bb926e74abe6020fdf6672647f99791507c7592781ef2f6676c5ada66da4a4f", - "plugin.json": "0afc849543822e164c8383afa05ff3e7b526d161712eec3a92670c5afe9f2555", - "README.md": "b9bc43fc2b2f7ce74864ccf40de24cb465ccc953902071467916390a8e8b4a45", - "module.js": "e157158bb5ae7b498345ae08029093d7517f689fc02f03429184e7a026f15928", - "msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2" - } -} ------BEGIN PGP SIGNATURE----- -Version: OpenPGP.js v4.10.1 -Comment: https://openpgpjs.org - -wqIEARMKAAYFAmEytn0ACgkQfk0ManCIZudAOgIJARVCW8ArfcRyVseEUlFC -BN7fgXhEIlSvdf72mkzXfDe1cy4ea1KWcdC+Wtpn5gryFLB0eK9TALe08z6N -bIvP69RIAgkBUJ2lRDDX1ynXYXN1Np/SiuZU1/+vGTvOm8sxjV1Wzr+KBHei -9EgDvnfz4OekHOt+wEaiGQ6IwTYlG3Qfg75Qinw= -=Djuk ------END PGP SIGNATURE----- diff --git a/release/data/plugins/msupply-dashboard-app/backend/README.md b/release/data/plugins/msupply-dashboard-app/backend/README.md deleted file mode 100644 index b7cdcdb4..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# mSupply Data Source - -This data source is a backend datastore for the mSupply Dashboard App plugin. - -The backend plugin uses a simple SQLite database and runs a HTTP restFUL server over Grafana's internal gRPC network to serve specific query requests. - -Currently the mSupply Dashboard App Plugin supports automatic emailing of reports which this datasource holds configurations for. - -Currently querying this datasource is unsupported for regular grafana operations. diff --git a/release/data/plugins/msupply-dashboard-app/backend/module.js b/release/data/plugins/msupply-dashboard-app/backend/module.js deleted file mode 100644 index fa63cee5..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/module.js +++ /dev/null @@ -1,2 +0,0 @@ -define(["react","@grafana/data","@grafana/runtime"],(function(t,n,e){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="/",e(e.s=3)}([function(n,e){n.exports=t},function(t,e){t.exports=n},function(t,n){t.exports=e},function(t,n,e){"use strict";e.r(n);var r=e(0),o=e.n(r),u=e(1),i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function c(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var f=function(t){function n(n){return t.call(this,n)||this}return c(n,t),n}(e(2).DataSourceWithBackend),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){return o.a.createElement("div",{className:"gf-form-group"})},n}(r.PureComponent),l=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){return o.a.createElement("div",{className:"gf-form"})},n}(r.PureComponent);e.d(n,"plugin",(function(){return p})),e.d(n,"Hello",(function(){return s}));var p=new u.DataSourcePlugin(f).setConfigEditor(a).setQueryEditor(l),s=function(){return o.a.createElement("div",null,"Hello")}}])})); -//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/release/data/plugins/msupply-dashboard-app/backend/module.js.map b/release/data/plugins/msupply-dashboard-app/backend/module.js.map deleted file mode 100644 index 1c1cdb27..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@grafana/data\"","webpack:///external \"@grafana/runtime\"","webpack:///../node_modules/tslib/tslib.es6.js","webpack:///./DataSource.ts","webpack:///./ConfigEditor.tsx","webpack:///./QueryEditor.tsx","webpack:///./module.tsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","extendStatics","b","setPrototypeOf","__proto__","Array","__extends","__","this","constructor","instanceSettings","DataSource","render","className","setConfigEditor","setQueryEditor"],"mappings":"wFACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,IAIjBlC,EAAoBA,EAAoBmC,EAAI,G,gBClFrDhC,EAAOD,QAAUkC,G,cCAjBjC,EAAOD,QAAUmC,G,cCAjBlC,EAAOD,QAAUoC,G,+DCgBbC,EAAgB,SAAS7B,EAAG8B,GAI5B,OAHAD,EAAgBzB,OAAO2B,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUjC,EAAG8B,GAAK9B,EAAEgC,UAAYF,IACvE,SAAU9B,EAAG8B,GAAK,IAAK,IAAIN,KAAKM,EAAOA,EAAEP,eAAeC,KAAIxB,EAAEwB,GAAKM,EAAEN,MACpDxB,EAAG8B,IAGrB,SAASI,EAAUlC,EAAG8B,GAEzB,SAASK,IAAOC,KAAKC,YAAcrC,EADnC6B,EAAc7B,EAAG8B,GAEjB9B,EAAEsB,UAAkB,OAANQ,EAAa1B,OAAOY,OAAOc,IAAMK,EAAGb,UAAYQ,EAAER,UAAW,IAAIa,G,ICtBnF,cACE,WAAYG,G,OACV,YAAMA,IAAiB,KAE3B,OAJgC,EAAAC,EAAA,GAIhC,EAJA,C,KAAgC,uBCKhC,2B,+CAIA,OAJkC,OAChC,YAAAC,OAAA,WACE,OAAO,yBAAKC,UAAU,mBAE1B,EAJA,CAAkC,iBCDlC,2B,+CAIA,OAJiC,OAC/B,YAAAD,OAAA,WACE,OAAO,yBAAKC,UAAU,aAE1B,EAJA,CAAiC,iBCRjC,6EAOO,IAAM,EAAS,IAAI,mBAA2D,GAClFC,gBAAgB,GAChBC,eAAe,GAEL,EAAQ,WAAM","file":"module.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DataSourceInstanceSettings } from '@grafana/data';\nimport { DataSourceWithBackend } from '@grafana/runtime';\nimport { MyDataSourceOptions, MyQuery } from './types';\n\nexport class DataSource extends DataSourceWithBackend {\n constructor(instanceSettings: DataSourceInstanceSettings) {\n super(instanceSettings);\n }\n}\n","import React, { PureComponent } from 'react';\n\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { MyDataSourceOptions } from './types';\n\ninterface Props extends DataSourcePluginOptionsEditorProps {}\n\ninterface State {}\n\nexport class ConfigEditor extends PureComponent {\n render() {\n return
    ;\n }\n}\n","import React, { PureComponent } from 'react';\n\nimport { QueryEditorProps } from '@grafana/data';\nimport { DataSource } from './DataSource';\nimport { MyDataSourceOptions, MyQuery } from './types';\n\ntype Props = QueryEditorProps;\n\nexport class QueryEditor extends PureComponent {\n render() {\n return
    ;\n }\n}\n","import React from 'react';\nimport { DataSourcePlugin } from '@grafana/data';\nimport { DataSource } from './DataSource';\nimport { ConfigEditor } from './ConfigEditor';\nimport { QueryEditor } from './QueryEditor';\nimport { MyQuery, MyDataSourceOptions } from './types';\n\nexport const plugin = new DataSourcePlugin(DataSource)\n .setConfigEditor(ConfigEditor)\n .setQueryEditor(QueryEditor);\n\nexport const Hello = () =>
    Hello
    ;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/release/data/plugins/msupply-dashboard-app/backend/msupply_light_icon.svg b/release/data/plugins/msupply-dashboard-app/backend/msupply_light_icon.svg deleted file mode 100644 index 2ed30968..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/msupply_light_icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/release/data/plugins/msupply-dashboard-app/backend/plugin.json b/release/data/plugins/msupply-dashboard-app/backend/plugin.json deleted file mode 100644 index 9365703f..00000000 --- a/release/data/plugins/msupply-dashboard-app/backend/plugin.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "datasource", - "name": "mSupply Datasource", - "id": "msupplyfoundation-datasource", - "metrics": true, - "backend": true, - "executable": "gpx_msupply-datasource", - "info": { - "description": "", - "author": { - "name": "mSupply Foundation", - "url": "https://msupply.foundation/" - }, - "keywords": [], - "logos": { - "small": "msupply_light_icon.svg", - "large": "msupply_light_icon.svg" - }, - "links": [ - { - "name": "Website", - "url": "https://github.com/openmsupply/msupply-dashboard-app/tree/master/backend" - }, - { - "name": "License", - "url": "https://github.com/openmsupply/msupply-dashboard-app/blob/master/backend/LICENSE" - } - ], - "screenshots": [], - "version": "1.0.0", - "updated": "2021-05-06" - }, - "dependencies": { - "grafanaVersion": "7.x.x", - "plugins": [] - } -} diff --git a/release/data/plugins/msupply-dashboard-app/frontend/LICENSE b/release/data/plugins/msupply-dashboard-app/frontend/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/release/data/plugins/msupply-dashboard-app/frontend/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/release/data/plugins/msupply-dashboard-app/frontend/MANIFEST.txt b/release/data/plugins/msupply-dashboard-app/frontend/MANIFEST.txt deleted file mode 100644 index 4e997eb8..00000000 --- a/release/data/plugins/msupply-dashboard-app/frontend/MANIFEST.txt +++ /dev/null @@ -1,41 +0,0 @@ - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "manifestVersion": "2.0.0", - "signatureType": "private", - "signedByOrg": "msupplyfoundation", - "signedByOrgName": "msupplyfoundation", - "rootUrls": [ - "https://demo-board.msupply.org:3000/", - "https://ci.msupply.org:3000/", - "https://liberia.msupply.org:3000/", - "https://tonga-vax.msupply.org:3000/", - "https://timor.msupply.org:3000/" - ], - "plugin": "msupplyfoundation-scheduler", - "version": "1.0.0", - "time": 1623288570617, - "keyId": "7e4d0c6a708866e7", - "files": { - "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", - "module.js.LICENSE.txt": "42c1e051dfd53a9bb999495ef45df40051c66ab871060317457d17cb3ac6ac24", - "module.js.map": "eee6889704d222242d97e405ee3d3b525c46c65c76979fbd8b89a1cf255e725c", - "plugin.json": "9749beb0e6c81f87f7e225f645981603baa685faf9ce4780a4d2f48af43e4a91", - "README.md": "5b90c1aa9295a02ae248fb6165d7f024743ab5ceca9598d4118e30254de40fe6", - "common/translations/en.json": "9dec59ea1953ea14d8ecd8a39b106f568fdc08b9e07653c9975b9dd4f0925ef3", - "module.js": "1a9acbe39bff37985b58d59640eb2e61ead016af08d18f4d573459a91e9944fa", - "msupply_light_icon.svg": "b4b32af01d584ecc186d19d73977c6f8262dcb18ac011e5ea11d4b915b6e1eb2" - } -} ------BEGIN PGP SIGNATURE----- -Version: OpenPGP.js v4.10.1 -Comment: https://openpgpjs.org - -wqEEARMKAAYFAmDBavoACgkQfk0ManCIZufqiAII6gj/xsERzEAMwlYFZEja -KH5++wZg9UqYTXQ8Agl2k8RVGUjTUAGTHpZyqQX6iEUYSTUcUu8vfQaXiOyb -9qi2QrkCCQF4R4IpUtsSmoXllQWa7OXL4Lq5c/aLwKKijLcoIy/gQ0tyPSo2 -SxE++1lodt5+5PZtYlZFvhowgx9YIiJjrUezwA== -=lBwB ------END PGP SIGNATURE----- diff --git a/release/data/plugins/msupply-dashboard-app/frontend/README.md b/release/data/plugins/msupply-dashboard-app/frontend/README.md deleted file mode 100644 index 43ccceaa..00000000 --- a/release/data/plugins/msupply-dashboard-app/frontend/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# mSupply Dashboard App - -The mSupply dashboard app is a Grafana App plugin which handles configuration of automatic email reporting when combined with the msupplyfoundation-datasource datasource plugin. diff --git a/release/data/plugins/msupply-dashboard-app/frontend/module.js b/release/data/plugins/msupply-dashboard-app/frontend/module.js deleted file mode 100644 index 3703158f..00000000 --- a/release/data/plugins/msupply-dashboard-app/frontend/module.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see module.js.LICENSE.txt */ -define(["react","@grafana/ui","@grafana/runtime","emotion","@grafana/data","react-dom"],(function(e,t,r,n,a,i){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=23)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}n(r(10));var a=n(r(0)),i=n(r(24)),o=n(r(13)),u=n(r(14)),s=n(r(15)),l=n(r(18));r(19);for(var c=n(r(20)),f=["AFN","EUR","ALL","DZD","USD","AOA","XCD","ARS","AMD","AWG","AUD","AZN","BSD","BHD","BDT","BBD","BYN","BZD","XOF","BMD","INR","BTN","BOB","BOV","BAM","BWP","NOK","BRL","BND","BGN","BIF","CVE","KHR","XAF","CAD","KYD","CLP","CLF","CNY","COP","COU","KMF","CDF","NZD","CRC","HRK","CUP","CUC","ANG","CZK","DKK","DJF","DOP","EGP","SVC","ERN","ETB","FKP","FJD","XPF","GMD","GEL","GHS","GIP","GTQ","GBP","GNF","GYD","HTG","HNL","HKD","HUF","ISK","IDR","XDR","IRR","IQD","ILS","JMD","JPY","JOD","KZT","KES","KPW","KRW","KWD","KGS","LAK","LBP","LSL","ZAR","LRD","LYD","CHF","MOP","MKD","MGA","MWK","MYR","MVR","MRO","MUR","XUA","MXN","MXV","MDL","MNT","MAD","MZN","MMK","NAD","NPR","NIO","NGN","OMR","PKR","PAB","PGK","PYG","PEN","PHP","PLN","QAR","RON","RUB","RWF","SHP","WST","STD","SAR","RSD","SCR","SLL","SGD","XSU","SBD","SOS","SSP","LKR","SDG","SRD","SZL","SEK","CHE","CHW","SYP","TWD","TJS","TZS","THB","TOP","TTD","TND","TRY","TMT","UGX","UAH","AED","USN","UYU","UYI","UZS","VUV","VEF","VND","YER","ZMW","ZWL","XBA","XBB","XBC","XBD","XTS","XXX","XAU","XPD","XPT","XAG"],d={},p=0;p=0&&f.indexOf(">")>=0&&(f=o(f)),t[c]=f}try{return new i(s,a,u).format(t)}catch(t){return this.options.warningHandler("react-intl-universal format message failed for key='"+e+"'.",t.message),s}}},{key:"getHTML",value:function(e,t){if(this.options.intlGetHook)try{this.options.intlGetHook(e,this.options.currentLocale)}catch(e){}var r=this.get(e,t);if(r){var n=a.createElement("span",{dangerouslySetInnerHTML:{__html:r}}),i=function(){return n};return Object.assign({defaultMessage:i,d:i},n)}return""}},{key:"formatMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.get(r,t).defaultMessage(n)}},{key:"formatHTMLMessage",value:function(e,t){var r=e.id,n=e.defaultMessage;return this.getHTML(r,t).defaultMessage(n)}},{key:"determineLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getLocaleFromURL(e)||this.getLocaleFromCookie(e)||this.getLocaleFromLocalStorage(e)||this.getLocaleFromBrowser()}},{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(e.currentLocale,"options.currentLocale is required"),l(e.locales,"options.locales is required"),Object.assign(this.options,e),this.options.formats=Object.assign({},this.options.formats,h),new Promise((function(e,t){e()}))}},{key:"getInitOptions",value:function(){return this.options}},{key:"load",value:function(e){c(this.options.locales,e)}},{key:"getLocaleFromCookie",value:function(e){var t=e.cookieLocaleKey;if(t){var r=u.parse(document.cookie);return r&&r[t]}}},{key:"getLocaleFromLocalStorage",value:function(e){var t=e.localStorageLocaleKey;if(t&&window.localStorage)return localStorage.getItem(t)}},{key:"getLocaleFromURL",value:function(e){var t=e.urlLocaleKey;if(t){var r=location.search.split("?");if(r.length>=2){var n=s.parse(r[1]);return n&&n[t]}}}},{key:"getDescendantProp",value:function(e,t){return e[t]?e[t]:t.split(".").reduce((function(e,t){return null!=e?e[t]:e}),e)}},{key:"getLocaleFromBrowser",value:function(){return navigator.language||navigator.userLanguage}}]),e}();e.exports=new m,e.exports.ReactIntlUniversal=m},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t1){for(var s=Array(o),l=0;l=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},possibleConstructorReturn:function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},selfGlobal:s,set:function e(t,r,n,a){var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);null!==o&&e(o,r,n,a)}else if("value"in i&&i.writable)i.value=n;else{var u=i.set;void 0!==u&&u.call(a,n)}return n},slicedToArray:l,slicedToArrayLoose:function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e)){for(var r,n=[],a=e[Symbol.iterator]();!(r=a.next()).done&&(n.push(r.value),!t||n.length!==t););return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},taggedTemplateLiteral:function(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},taggedTemplateLiteralLoose:function(e,t){return e.raw=t,e},temporalRef:function(e,t,r){if(e===r)throw new ReferenceError(t+" is not defined - temporal dead zone");return e},temporalUndefined:{},toArray:function(e){return Array.isArray(e)?e:Array.from(e)},toConsumableArray:function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t="a"&&r<="z"&&(e=e.slice(0,t)+r.toUpperCase()+e.slice(t+1))}return e}function B(e){return!!L.test(e)&&(!P.test(e)&&!R.test(e))}function G(e){for(var t=void 0,r=void 0,n=1,a=(r=(e=e.toLowerCase()).split("-")).length;n1&&(t.sort(),e=e.replace(RegExp("(?:"+N.source+")+","i"),w.call(t,""))),p.call(z.tags,e)&&(e=z.tags[e]);for(var i=1,o=(r=e.split("-")).length;i-1)return r;var n=r.lastIndexOf("-");if(n<0)return;n>=2&&"-"===r.charAt(n-2)&&(n-=2),r=r.substring(0,n)}}function V(e,t){for(var r=0,n=t.length,a=void 0,i=void 0,o=void 0;r2){var E=u[_+1];-1!==w.call(g,E)&&(b="-"+m+"-"+(y=E))}else{-1!==w(g,"true")&&(y="true")}}if(p.call(r,"[["+m+"]]")){var x=r["[["+m+"]]"];-1!==w.call(g,x)&&x!==y&&(y=x,b="")}c["[["+m+"]]"]=y,f+=b,d++}if(f.length>2){var S=o.indexOf("-x-");if(-1===S)o+=f;else{var D=o.substring(0,S),j=o.substring(S);o=D+f+j}o=G(o)}return c["[[locale]]"]=o,c}function Y(e,t){for(var r=t.length,n=new D,a=0;an)throw new RangeError("Value is not a number or outside accepted range");return Math.floor(i)}return a}var J={};Object.defineProperty(J,"getCanonicalLocales",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=H(e),r=[],n=t.length,a=0;ai;i++){var o=r[i],u={};u.type=o["[[type]]"],u.value=o["[[value]]"],n[a]=u,a+=1}return n}function ie(e,t){var r=C(e),n=r["[[dataLocale]]"],a=r["[[numberingSystem]]"],i=x.NumberFormat["[[localeData]]"][n],o=i.symbols[a]||i.symbols.latn,u=void 0;!isNaN(t)&&t<0?(t=-t,u=r["[[negativePattern]]"]):u=r["[[positivePattern]]"];for(var s=new D,l=u.indexOf("{",0),c=0,f=0,d=u.length;l>-1&&lf){var h=u.substring(f,l);b.call(s,{"[[type]]":"literal","[[value]]":h})}var v=u.substring(l+1,c);if("number"===v)if(isNaN(t)){var m=o.nan;b.call(s,{"[[type]]":"nan","[[value]]":m})}else if(isFinite(t)){"percent"===r["[[style]]"]&&isFinite(t)&&(t*=100);var g=void 0;g=p.call(r,"[[minimumSignificantDigits]]")&&p.call(r,"[[maximumSignificantDigits]]")?ue(t,r["[[minimumSignificantDigits]]"],r["[[maximumSignificantDigits]]"]):se(t,r["[[minimumIntegerDigits]]"],r["[[minimumFractionDigits]]"],r["[[maximumFractionDigits]]"]),le[a]?function(){var e=le[a];g=String(g).replace(/\d/g,(function(t){return e[t]}))}():g=String(g);var y=void 0,w=void 0,E=g.indexOf(".",0);if(E>0?(y=g.substring(0,E),w=g.substring(E+1,E.length)):(y=g,w=void 0),!0===r["[[useGrouping]]"]){var S=o.group,O=[],j=i.patterns.primaryGroupSize||3,k=i.patterns.secondaryGroupSize||j;if(y.length>j){var F=y.length-j,A=F%k,T=y.slice(0,A);for(T.length&&b.call(O,T);Aa;a++){n+=r[a]["[[value]]"]}return n}function ue(e,t,r){var n=r,a=void 0,i=void 0;if(0===e)a=w.call(Array(n+1),"0"),i=0;else{i=function(e){if("function"==typeof Math.log10)return Math.floor(Math.log10(e));var t=Math.round(Math.log(e)*Math.LOG10E);return t-(Number("1e"+t)>e)}(Math.abs(e));var o=Math.round(Math.exp(Math.abs(i-n+1)*Math.LN10));a=String(Math.round(i-n+1<0?e*o:e/o))}if(i>=n)return a+w.call(Array(i-n+1+1),"0");if(i===n-1)return a;if(i>=0?a=a.slice(0,i+1)+"."+a.slice(i+1):i<0&&(a="0."+w.call(Array(1-(i+1)),"0")+a),a.indexOf(".")>=0&&r>t){for(var u=r-t;u>0&&"0"===a.charAt(a.length-1);)a=a.slice(0,-1),u--;"."===a.charAt(a.length-1)&&(a=a.slice(0,-1))}return a}function se(e,t,r,n){var a,i=n,o=Math.pow(10,i)*e,u=0===o?"0":o.toFixed(0),s=(a=u.indexOf("e"))>-1?u.slice(a+1):0;s&&(u=u.slice(0,a).replace(".",""),u+=w.call(Array(s-(u.length-1)+1),"0"));var l=void 0;if(0!==i){var c=u.length;if(c<=i)u=w.call(Array(i+1-c+1),"0")+u,c=i+1;var f=u.substring(0,c-i),d=u.substring(c-i,u.length);u=f+"."+d,l=f.length}else l=u.length;for(var p=n-r;p>0&&"0"===u.slice(-1);)u=u.slice(0,-1),p--;("."===u.slice(-1)&&(u=u.slice(0,-1)),lr&&(r=u,n=o),a++}return n}(u,E);else{var k=X(r,"hour12","boolean");u.hour12=void 0===k?_.hour12:k,w=function(e,t){var r=[];for(var n in De)p.call(De,n)&&void 0!==e["[["+n+"]]"]&&r.push(n);if(1===r.length){var a=function(e,t){var r;if(_e[e]&&_e[e][t])return r={originalPattern:_e[e][t],_:o({},e,t),extendedPattern:"{"+e+"}"},o(r,e,t),o(r,"pattern12","{"+e+"}"),o(r,"pattern","{"+e+"}"),r}(r[0],e["[["+r[0]+"]]"]);if(a)return a}var i=-1/0,u=void 0,s=0,l=t.length;for(;s=2||w>=2&&b<=1?_>0?f-=6:_<0&&(f-=8):_>1?f-=3:_<-1&&(f-=6)}}c._.hour12!==e.hour12&&(f-=1),f>i&&(i=f,u=c),s++}return u}(u,E)}for(var F in De)if(p.call(De,F)&&p.call(w,F)){var A=w[F];A=w._&&p.call(w._,F)?w._[F]:A,n["[["+F+"]]"]=A}var T=void 0,I=X(r,"hour12","boolean");if(n["[[hour]]"])if(I=void 0===I?_.hour12:I,n["[[hour12]]"]=I,!0===I){var L=_.hourNo0;n["[[hourNo0]]"]=L,T=w.pattern12}else T=w.pattern;else T=w.pattern;return n["[[pattern]]"]=T,n["[[boundFormat]]"]=void 0,n["[[initializedDateTimeFormat]]"]=!0,d&&(e.format=ke.call(e)),a(),e}h(J,"DateTimeFormat",{configurable:!0,writable:!0,value:Se}),h(Se,"prototype",{writable:!1});var De={weekday:["narrow","short","long"],era:["narrow","short","long"],year:["2-digit","numeric"],month:["2-digit","numeric","narrow","short","long"],day:["2-digit","numeric"],hour:["2-digit","numeric"],minute:["2-digit","numeric"],second:["2-digit","numeric"],timeZoneName:["short","long"]};function je(e,t,r){if(void 0===e)e=null;else{var n=k(e);for(var a in e=new O,n)e[a]=n[a]}e=m(e);var i=!0;return"date"!==t&&"any"!==t||void 0===e.weekday&&void 0===e.year&&void 0===e.month&&void 0===e.day||(i=!1),"time"!==t&&"any"!==t||void 0===e.hour&&void 0===e.minute&&void 0===e.second||(i=!1),!i||"date"!==r&&"all"!==r||(e.year=e.month=e.day="numeric"),!i||"time"!==r&&"all"!==r||(e.hour=e.minute=e.second="numeric"),e}function ke(){var e=null!==this&&"object"===c.typeof(this)&&C(this);if(!e||!e["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for format() is not an initialized Intl.DateTimeFormat object.");if(void 0===e["[[boundFormat]]"]){var t=E.call((function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=void 0===e?Date.now():F(e);return Ae(this,t)}),this);e["[[boundFormat]]"]=t}return e["[[boundFormat]]"]}function Fe(e,t){if(!isFinite(t))throw new RangeError("Invalid valid date passed to format");var r=e.__getInternalProperties(S);j();for(var n,a,i,o,u=r["[[locale]]"],s=new J.NumberFormat([u],{useGrouping:!1}),l=new J.NumberFormat([u],{minimumIntegerDigits:2,useGrouping:!1}),c=(n=t,r["[[calendar]]"],a=r["[[timeZone]]"],new O({"[[weekday]]":(i=new Date(n))[(o="get"+(a||""))+"Day"](),"[[era]]":+(i[o+"FullYear"]()>=0),"[[year]]":i[o+"FullYear"](),"[[month]]":i[o+"Month"](),"[[day]]":i[o+"Date"](),"[[hour]]":i[o+"Hours"](),"[[minute]]":i[o+"Minutes"](),"[[second]]":i[o+"Seconds"](),"[[inDST]]":!1})),f=r["[[pattern]]"],d=new D,p=0,h=f.indexOf("{"),v=0,m=r["[[dataLocale]]"],g=x.DateTimeFormat["[[localeData]]"][m].calendars,y=r["[[calendar]]"];-1!==h;){var w=void 0;if(-1===(v=f.indexOf("}",h)))throw new Error("Unclosed pattern");h>p&&b.call(d,{type:"literal",value:f.substring(p,h)});var _=f.substring(h+1,v);if(De.hasOwnProperty(_)){var E=r["[["+_+"]]"],k=c["[["+_+"]]"];if("year"===_&&k<=0?k=1-k:"month"===_?k++:"hour"===_&&!0===r["[[hour12]]"]&&0===(k%=12)&&!0===r["[[hourNo0]]"]&&(k=12),"numeric"===E)w=oe(s,k);else if("2-digit"===E)(w=oe(l,k)).length>2&&(w=w.slice(-2));else if(E in Ee)switch(_){case"month":w=xe(g,y,"months",E,c["[["+_+"]]"]);break;case"weekday":try{w=xe(g,y,"days",E,c["[["+_+"]]"])}catch(e){throw new Error("Could not find weekday data for locale "+u)}break;case"timeZoneName":w="";break;case"era":try{w=xe(g,y,"eras",E,c["[["+_+"]]"])}catch(e){throw new Error("Could not find era data for locale "+u)}break;default:w=c["[["+_+"]]"]}b.call(d,{type:_,value:w})}else if("ampm"===_){w=xe(g,y,"dayPeriods",c["[[hour]]"]>11?"pm":"am",null),b.call(d,{type:"dayPeriod",value:w})}else b.call(d,{type:"literal",value:f.substring(h,v+1)});p=v+1,h=f.indexOf("{",p)}return va;a++){n+=r[a].value}return n}function Ce(e,t){for(var r=Fe(e,t),n=[],a=0;r.length>a;a++){var i=r[a];n.push({type:i.type,value:i.value})}return n}x.DateTimeFormat={"[[availableLocales]]":[],"[[relevantExtensionKeys]]":["ca","nu"],"[[localeData]]":{}},h(J.DateTimeFormat,"supportedLocalesOf",{configurable:!0,writable:!0,value:E.call((function(e){if(!p.call(this,"[[availableLocales]]"))throw new TypeError("supportedLocalesOf() is not a constructor");var t=j(),r=arguments[1],n=this["[[availableLocales]]"],a=H(e);return t(),$(n,a,r)}),x.NumberFormat)}),h(J.DateTimeFormat.prototype,"format",{configurable:!0,get:ke}),Object.defineProperty(J.DateTimeFormat.prototype,"formatToParts",{enumerable:!1,writable:!0,configurable:!0,value:function(){var e=arguments.length<=0||void 0===arguments[0]?void 0:arguments[0],t=null!==this&&"object"===c.typeof(this)&&C(this);if(!t||!t["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.");var r=void 0===e?Date.now():F(e);return Ce(this,r)}}),h(J.DateTimeFormat.prototype,"resolvedOptions",{writable:!0,configurable:!0,value:function(){var e=void 0,t=new O,r=["locale","calendar","numberingSystem","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"],n=null!==this&&"object"===c.typeof(this)&&C(this);if(!n||!n["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.");for(var a=0,i=r.length;a2&&4===a[1].length&&b.call(n,a[0]+"-"+a[2]);for(;r=_.call(n);)b.call(x.NumberFormat["[[availableLocales]]"],r),x.NumberFormat["[[localeData]]"][r]=e.number,e.date&&(e.date.nu=e.number.nu,b.call(x.DateTimeFormat["[[availableLocales]]"],r),x.DateTimeFormat["[[localeData]]"][r]=e.date);void 0===M&&function(e){M=e}(t)}(e,e.locale)}}),h(J,"__disableRegExpRestore",{value:function(){x.disableRegExpRestore=!0}}),e.exports=J}).call(this,r(7))},function(e,t){},function(e,t,r){"use strict";var n=/["'&<>]/;e.exports=function(e){var t,r=""+e,a=n.exec(r);if(!a)return r;var i="",o=0,u=0;for(o=a.index;o0&&l>s&&(l=s);for(var c=0;c=0?(f=v.substr(0,m),d=v.substr(m+1)):(f=v,d=""),p=decodeURIComponent(f),h=decodeURIComponent(d),n(o,p)?a(o[p])?o[p].push(h):o[p]=[o[p],h]:o[p]=h}return o};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,u){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?i(o(e),(function(o){var u=encodeURIComponent(n(o))+r;return a(e[o])?i(e[o],(function(e){return u+encodeURIComponent(n(e))})).join(t):u+encodeURIComponent(n(e[o]))})).join(t):u?encodeURIComponent(n(u))+r+encodeURIComponent(n(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n-1},K.prototype.set=function(e,t){var r=this.__data__,n=W(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},V.prototype.clear=function(){this.size=0,this.__data__={hash:new H,map:new(G||K),string:new H}},V.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},V.prototype.get=function(e){return se(this,e).get(e)},V.prototype.has=function(e){return se(this,e).has(e)},V.prototype.set=function(e,t){var r=se(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new K,this.size=0},Z.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Z.prototype.get=function(e){return this.__data__.get(e)},Z.prototype.has=function(e){return this.__data__.has(e)},Z.prototype.set=function(e,t){var r=this.__data__;if(r instanceof K){var n=r.__data__;if(!G||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new V(n)}return r.set(e,t),this.size=r.size,this};var ee,te=function(e,t,r){for(var n=-1,a=Object(e),i=r(e),o=i.length;o--;){var u=i[ee?o:++n];if(!1===t(a[u],u,a))break}return e};function re(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":N&&N in Object(e)?function(e){var t=S.call(e,N),r=e[N];try{e[N]=void 0;var n=!0}catch(e){}var a=D.call(e);n&&(t?e[N]=r:delete e[N]);return a}(e):function(e){return D.call(e)}(e)}function ne(e){return Ee(e)&&"[object Arguments]"==re(e)}function ae(e){return!(!_e(e)||function(e){return!!O&&O in e}(e))&&(be(e)?k:n).test(function(e){if(null!=e){try{return x.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function ie(e){if(!_e(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=fe(e),r=[];for(var n in e)("constructor"!=n||!t&&S.call(e,n))&&r.push(n);return r}function oe(e,t,r,n,a){e!==t&&te(t,(function(i,o){if(a||(a=new Z),_e(i))!function(e,t,r,n,a,i,o){var u=de(e,r),s=de(t,r),l=o.get(s);if(l)return void $(e,r,l);var c=i?i(u,s,r+"",e,t,o):void 0,f=void 0===c;if(f){var d=me(s),p=!d&&ye(s),h=!d&&!p&&xe(s);c=s,d||p||h?me(u)?c=u:Ee(b=u)&&ge(b)?c=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(M?function(e,t){return M(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:je);function he(e,t){return e===t||e!=e&&t!=t}var ve=ne(function(){return arguments}())?ne:function(e){return Ee(e)&&S.call(e,"callee")&&!P.call(e,"callee")},me=Array.isArray;function ge(e){return null!=e&&we(e.length)&&!be(e)}var ye=z||function(){return!1};function be(e){if(!_e(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function we(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function _e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ee(e){return null!=e&&"object"==typeof e}var xe=h?function(e){return function(t){return e(t)}}(h):function(e){return Ee(e)&&we(e.length)&&!!i[re(e)]};function Se(e){return ge(e)?Y(e,!0):ie(e)}var Oe,De=(Oe=function(e,t,r){oe(e,t,r)},ue((function(e,t){var r=-1,n=t.length,a=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(a=Oe.length>3&&"function"==typeof a?(n--,a):void 0,i&&function(e,t,r){if(!_e(r))return!1;var n=typeof t;return!!("number"==n?ge(r)&&ce(t,r.length):"string"==n&&t in r)&&he(r[t],e)}(t[0],t[1],i)&&(a=n<3?void 0:a,n=1),e=Object(e);++r0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}function l(e,t){for(var r=0,n=t.length,a=e.length;r=0&&e!==1/0}function T(){return"undefined"==typeof document||[void 0,"visible","prerender"].includes(document.visibilityState)}function I(){return void 0===navigator.onLine||navigator.onLine}function L(e,t,r,n){var a,i,o,u;return P(e)?(a=e.queryKey,i=e.queryFn,o=e.config,u=t):P(t)?(a=e,o=t,u=r):(a=e,i=t,o=r,u=n),o=o||{},i&&(o=x({},o,{queryFn:i})),[a,o,u]}function P(e){if(!R(e))return!1;var t=e.constructor;if(void 0===t)return!0;var r=t.prototype;return!!R(r)&&!!r.hasOwnProperty("isPrototypeOf")}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function N(e){return e instanceof S}function M(e){return{status:e,isLoading:e===d.Loading,isSuccess:e===d.Success,isError:e===d.Error,isIdle:e===d.Idle}}function z(e){var t;return function(r){t&&t(),t=r(e)}}function q(e){Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}var B=function(e){e()};var G={queries:{cacheTime:3e5,enabled:!0,notifyOnStatusChange:!0,queryFn:function(){return Promise.reject()},queryKeySerializerFn:function(e){try{var t=Array.isArray(e)?e:[e],r=(n=t,JSON.stringify(n,A));return[r,t=JSON.parse(r)]}catch(e){throw new Error("A valid query key is required!")}var n},refetchOnMount:!0,refetchOnReconnect:!0,refetchOnWindowFocus:!0,retry:3,retryDelay:function(e){return Math.min(1e3*Math.pow(2,e),3e4)},staleTime:0,structuralSharing:!0}};function Q(e,t,r,n){var a=e.getDefaultConfig(),i=x({},G.queries,null==a?void 0:a.shared,null==a?void 0:a.queries,null==r?void 0:r.shared,null==r?void 0:r.queries,n),o=i.queryKeySerializerFn(t);return i.queryCache=e,i.queryHash=o[0],i.queryKey=o[1],i}var U=new(function(){function e(){this.queue=[],this.transactions=0}var t=e.prototype;return t.batch=function(e){this.transactions++;var t=e();return this.transactions--,this.transactions||this.flush(),t},t.schedule=function(e){this.transactions?this.queue.push(e):q((function(){e()}))},t.flush=function(){var e=this.queue;this.queue=[],e.length&&q((function(){B((function(){e.forEach((function(e){e()}))}))}))},e}()),H=function(){function e(e){this.config=e,this.isStale=!0,this.initialUpdateCount=0,this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this),this.fetchMore=this.fetchMore.bind(this),this.unsubscribe=this.unsubscribe.bind(this),this.updateQuery()}var t=e.prototype;return t.subscribe=function(e){return this.listener=e||j,this.currentQuery.subscribeObserver(this),this.config.enabled&&(this.config.forceFetchOnMount||"always"===this.config.refetchOnMount)?this.fetch():this.optionalFetch(),this.updateTimers(),this.unsubscribe},t.unsubscribe=function(){this.listener=void 0,this.clearTimers(),this.currentQuery.unsubscribeObserver(this)},t.updateConfig=function(e){var t=this.config,r=this.currentQuery;if(this.config=function(e){return Boolean(e.queryHash)}(e)?e:this.config.queryCache.getResolvedQueryConfig(this.config.queryKey,e),this.updateQuery(),this.listener){if(this.currentQuery!==r)return this.optionalFetch(),void this.updateTimers();e.enabled&&!t.enabled&&this.optionalFetch(),e.enabled===t.enabled&&e.staleTime===t.staleTime||this.updateStaleTimeout(),e.enabled===t.enabled&&e.refetchInterval===t.refetchInterval||this.updateRefetchInterval()}},t.getCurrentQuery=function(){return this.currentQuery},t.getCurrentResult=function(){return this.currentResult},t.clear=function(){this.remove()},t.remove=function(){this.currentQuery.remove()},t.refetch=function(e){return this.currentQuery.refetch(e,this.config)},t.fetchMore=function(e,t){return this.currentQuery.fetchMore(e,t,this.config).catch(j)},t.fetch=function(){var e;return this.config.queryFn===(null==(e=G.queries)?void 0:e.queryFn)?Promise.resolve(this.currentResult.data):this.currentQuery.fetch(void 0,this.config).catch(j)},t.optionalFetch=function(){!this.config.enabled||!this.isStale||this.config.suspense&&this.currentResult.isFetched||!this.config.refetchOnMount&&1!==this.currentQuery.observers.length||this.fetch()},t.updateStaleTimeout=function(){var e=this;if(!D&&(this.clearStaleTimeout(),!this.isStale&&C(this.config.staleTime))){var t=Date.now()-this.currentResult.updatedAt,r=this.config.staleTime-t+1,n=Math.max(r,0);this.staleTimeoutId=setTimeout((function(){e.isStale||(e.isStale=!0,e.updateResult(),e.notify({listener:!0,globalListeners:!0}))}),n)}},t.updateRefetchInterval=function(){var e=this;D||(this.clearRefetchInterval(),this.config.enabled&&C(this.config.refetchInterval)&&(this.refetchIntervalId=setInterval((function(){(e.config.refetchIntervalInBackground||T())&&e.fetch()}),this.config.refetchInterval)))},t.updateTimers=function(){this.updateStaleTimeout(),this.updateRefetchInterval()},t.clearTimers=function(){this.clearStaleTimeout(),this.clearRefetchInterval()},t.clearStaleTimeout=function(){this.staleTimeoutId&&(clearInterval(this.staleTimeoutId),this.staleTimeoutId=void 0)},t.clearRefetchInterval=function(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)},t.updateResult=function(){var e,t=this.currentQuery.state,r=t.data,n=t.status,a=t.updatedAt,i=!1,o=!1;if(this.config.keepPreviousData&&t.isInitialData&&(null==(e=this.previousQueryResult)?void 0:e.isSuccess)&&(r=this.previousQueryResult.data,a=this.previousQueryResult.updatedAt,n=this.previousQueryResult.status,i=!0),"loading"===n&&this.config.placeholderData){var u="function"==typeof this.config.placeholderData?this.config.placeholderData():this.config.placeholderData;void 0!==u&&(n=d.Success,r=u,o=!0)}this.currentResult=x({},M(n),{canFetchMore:t.canFetchMore,clear:this.remove,data:r,error:t.error,failureCount:t.failureCount,fetchMore:this.fetchMore,isFetched:t.updateCount>0,isFetchedAfterMount:t.updateCount>this.initialUpdateCount,isFetching:t.isFetching,isFetchingMore:t.isFetchingMore,isInitialData:t.isInitialData,isPreviousData:i,isPlaceholderData:o,isStale:this.isStale,refetch:this.refetch,remove:this.remove,updatedAt:a})},t.updateQuery=function(){var e=this.config,t=this.currentQuery,r=e.queryCache.getQueryByHash(e.queryHash);r||(r=e.queryCache.createQuery(e)),r!==t&&(this.previousQueryResult=this.currentResult,this.currentQuery=r,this.initialUpdateCount=r.state.updateCount,r.state.isInitialData?e.keepPreviousData&&t?this.isStale=!0:"function"==typeof e.initialStale?this.isStale=e.initialStale():"boolean"==typeof e.initialStale?this.isStale=e.initialStale:this.isStale=void 0===r.state.data:this.isStale=r.isStaleByTime(e.staleTime),this.updateResult(),this.listener&&(null==t||t.unsubscribeObserver(this),this.currentQuery.subscribeObserver(this)))},t.onQueryUpdate=function(e){var t=this.config,r=e.type;2!==r&&3!==r&&4!==r||(this.isStale=this.currentQuery.isStaleByTime(t.staleTime));var n=this.currentResult;this.updateResult();var a=this.currentResult;if(2!==r&&3!==r&&4!==r||this.updateTimers(),4!==r||a.isStale!==n.isStale){var i={};2===r?i.onSuccess=!0:3===r&&(i.onError=!0),(t.notifyOnStatusChange||a.data!==n.data||a.error!==n.error)&&(i.listener=!0),this.notify(i)}},t.notify=function(e){var t=this.config,r=this.currentResult,n=this.currentQuery,a=this.listener,i=t.onSuccess,o=t.onSettled,u=t.onError;U.batch((function(){e.onSuccess?(i&&U.schedule((function(){i(r.data)})),o&&U.schedule((function(){o(r.data,null)}))):e.onError&&(u&&U.schedule((function(){u(r.error)})),o&&U.schedule((function(){o(void 0,r.error)}))),e.listener&&a&&U.schedule((function(){a(r)})),e.globalListeners&&t.queryCache.notifyGlobalListeners(n)}))},e}();function K(){}var V=0,Z=1,Y=2,$=3,X=4;function W(e,t){if(!t)return e&&e.then?e.then(K):Promise.resolve()}function J(e,t){var r=e();return r&&r.then?r.then(t):t(r)}function ee(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function te(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function re(e){return function(){for(var t=[],r=0;r0||!C(this.cacheTime)||(this.gcTimeout=setTimeout((function(){e.remove()}),this.cacheTime)))},t.cancel=function(e){var t=this.promise;return t&&this.cancelFetch?(this.cancelFetch(e),t.then(j).catch(j)):Promise.resolve(void 0)},t.continue=function(){var e;null==(e=this.continueFetch)||e.call(this)},t.clearTimersObservers=function(){this.observers.forEach((function(e){e.clearTimers()}))},t.clearGcTimeout=function(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)},t.setData=function(e,t){var r,n,a=this.state.data,i=F(e,a);this.config.structuralSharing&&(i=function e(t,r){if(t===r)return t;var n=Array.isArray(t)&&Array.isArray(r);if(n||P(t)&&P(r)){for(var a=n?t.length:Object.keys(t).length,i=n?r:Object.keys(r),o=i.length,u=n?[]:{},s=0,l=0;l0})).map((function(e){var t=e.panels,r=e.templating,n=e.uid;return t.filter((function(e){var t=e.type;return"table"===t||"table-old"===t||"msupplyfoundation-table"===t})).map((function(e){var t,n=s(e.targets,1)[0].rawSql,o="";return r.list.filter((function(e){var t=e.datasource,r=e.type;return"datasource"===r||"adhoc"===r||"query"===r&&a!==t})).some((function(e){var t=e.name;return Le(n,t)}))?o="This panel uses an unsupported variable.":(t=n,RegExp(/(?!.*\$__timeFrom\(\).*)(?!.*\$__timeTo\(\).*)(?!.*\$__timeFilter\(.+\).*)(\$__.*)/g).test(t)&&(o="This panel uses an unsupported macro.")),i(i({},e),{error:o})})).map((function(e){var t,a=e.targets,i=e.description,o=e.title,u=e.id,c=e.type,f=e.error,d=s(a,1)[0].rawSql,p=n,h=r.list,v=null!==(t=null==h?void 0:h.reduce((function(e,t){return Le(d,t.name)?l(l([],s(e)),[t]):e}),[]))&&void 0!==t?t:[];return{error:f,rawSql:d,description:i,title:o,id:u,variables:v,dashboardID:p,type:c}}))})).flat()]}var d}))}))},$e=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().put("./api/plugins/msupplyfoundation-datasource/resources/schedule/"+(null==e?void 0:e.id),e)]}))}))},Xe=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().post("./api/plugins/msupplyfoundation-datasource/resources/report-content",e)]}))}))},We=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().delete("./api/plugins/msupplyfoundation-datasource/resources/report-content/"+(null==e?void 0:e.id))]}))}))},Je=function(e){return o(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,Object(E.getBackendSrv)().put("./api/plugins/msupplyfoundation-datasource/resources/report-content/"+(null==e?void 0:e.id),e)]}))}))},et=function(){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,Object(E.getBackendSrv)().get("./api/datasources")]}))}))},tt=function(e){var t=e.tooltip,r=e.type,n=void 0===r?"text":r,a=e.label,i=e.register,o=e.defaultValue,u=e.placeholder,s=e.inputName,l=e.invalid,c=e.errorMessage;return h.a.createElement("div",{className:"gf-form"},h.a.createElement(b.InlineFormLabel,{className:"width-14",tooltip:t},a),h.a.createElement("div",{style:{display:"flex",flex:1,flexDirection:"column"}},h.a.createElement(b.Input,{type:n,defaultValue:o,placeholder:u,name:s,ref:i(),css:""}),l&&h.a.createElement("div",null,h.a.createElement(b.FieldValidationMessage,null,c))))},rt=function(e){var t=e.tooltip,r=e.value,n=e.options,a=e.onChange,i=e.label;return h.a.createElement("div",{className:"gf-form"},h.a.createElement(b.InlineFormLabel,{className:"width-14",tooltip:t},i),h.a.createElement("div",{style:{display:"flex",flex:1,flexDirection:"column"}},h.a.createElement(b.Select,{value:r,options:n,onChange:a})))},nt=function(e){var t=e.formValues,r=e.onSubmit,n=ke("datasources",et).data,a=s(Object(p.useState)(null),2),o=a[0],u=a[1];return Object(p.useEffect)((function(){var e=null==n?void 0:n.find((function(e){return e.id===t.datasourceID}));e&&u({label:e.name,value:e})}),[n,t.datasourceID]),h.a.createElement(b.Form,{defaultValues:t,onSubmit:function(e){var t;return r(i(i({},e),{datasourceID:null===(t=null==o?void 0:o.value)||void 0===t?void 0:t.id}))}},(function(e){var t,r,a,i,s,l,c,f,d,p,v,g,y,w,_,E=e.register,x=e.errors,S=e.getValues,O=e.formState,D=S(),j=D.grafanaUsername,k=void 0===j?"":j,F=D.email,A=void 0===F?"":F,C=D.grafanaPassword,T=void 0===C?"":C,I=D.grafanaURL,L=void 0===I?"":I,P=D.emailPassword,R=void 0===P?"":P,N=D.emailHost,M=D.emailPort;return h.a.createElement(h.a.Fragment,null,h.a.createElement(b.FieldSet,{label:m.a.get("grafana_details")},h.a.createElement(tt,{tooltip:m.a.get("grafana_username_tooltip"),label:m.a.get("grafana_username"),defaultValue:k,placeholder:m.a.get("grafana_username"),inputName:"grafanaUsername",invalid:!!x.grafanaUsername,errorMessage:null!==(r=null===(t=x.grafanaUsername)||void 0===t?void 0:t.message)&&void 0!==r?r:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{type:"password",tooltip:m.a.get("grafana_password_tooltip"),label:m.a.get("grafana_password"),defaultValue:T,placeholder:m.a.get("grafana_password"),inputName:"grafanaPassword",invalid:!!x.grafanaPassword,errorMessage:null!==(i=null===(a=x.grafanaPassword)||void 0===a?void 0:a.message)&&void 0!==i?i:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("grafana_url_tooltip"),label:m.a.get("grafana_url"),defaultValue:L,placeholder:m.a.get("grafana_url"),inputName:"grafanaURL",invalid:!!x.grafanaURL,errorMessage:null!==(l=null===(s=x.grafanaURL)||void 0===s?void 0:s.message)&&void 0!==l?l:"",register:function(){return E({required:m.a.get("required")})}})),h.a.createElement(b.FieldSet,{label:m.a.get("email_details")},h.a.createElement(tt,{tooltip:m.a.get("email_tooltip"),label:m.a.get("email_address"),defaultValue:A,placeholder:m.a.get("email_address"),inputName:"email",invalid:!!x.email,errorMessage:null!==(f=null===(c=x.email)||void 0===c?void 0:c.message)&&void 0!==f?f:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{type:"password",tooltip:m.a.get("email_password_tooltip"),label:m.a.get("email_password"),defaultValue:R,placeholder:m.a.get("email_password"),inputName:"emailPassword",invalid:!!x.emailPassword,errorMessage:null!==(p=null===(d=x.emailPassword)||void 0===d?void 0:d.message)&&void 0!==p?p:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("email_host_tooltip"),label:m.a.get("email_host"),defaultValue:N,placeholder:m.a.get("email_host"),inputName:"emailHost",invalid:!!x.emailHost,errorMessage:null!==(g=null===(v=x.emailHost)||void 0===v?void 0:v.message)&&void 0!==g?g:"",register:function(){return E({required:m.a.get("required")})}}),h.a.createElement(tt,{tooltip:m.a.get("email_port_tooltip"),label:m.a.get("email_port"),defaultValue:M,placeholder:m.a.get("email_port"),inputName:"emailPort",invalid:!!x.emailPort,errorMessage:null!==(w=null===(y=x.emailPort)||void 0===y?void 0:y.message)&&void 0!==w?w:"",register:function(){return E({required:m.a.get("required")})}})),h.a.createElement(b.FieldSet,{label:m.a.get("datasource_details")},h.a.createElement(rt,{label:m.a.get("datasource"),tooltip:m.a.get("datasource_tooltip"),value:o,options:null!==(_=null==n?void 0:n.map((function(e){return{label:e.name,value:e}})))&&void 0!==_?_:[],onChange:function(e){u(e)}})),h.a.createElement(b.Field,{label:m.a.get("save_details"),description:m.a.get("save_details_description")},h.a.createElement(b.Input,{value:m.a.get("submit"),type:"submit",placeholder:m.a.get("submit"),name:"submit",css:"",disabled:O.dirty})))}))},at=r(9),it=function(){var e=Object(p.useContext)(y).pluginID,t=ke("settings",(function(){return t=e,o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,Object(E.getBackendSrv)().get("/api/plugins/"+t+"/settings")]}))}));var t})).data,r=(null!=t?t:{}).jsonData;return(null!=r?r:{}).datasourceID},ot=function(e){var t=s(Object(p.useState)(e),2),r=t[0],n=t[1];return[r,Object(p.useCallback)((function(){n((function(e){return!e}))}),[n])]},ut=function(e,t,r,n,a,o){void 0===o&&(o={});var u=s(De(t,i({onSuccess:function(){return ue.refetchQueries(e)},onMutate:function(t){var i=r(t);ue.cancelQueries(e);var o=ue.getQueryData(e);return ue.setQueryData(e,(function(e){return n(e,i)})),null!=o?o:a},onError:function(t,r,n){ue.setQueryData(e,n)}},o)),2);return[u[0],u[1]]},st=r(5),lt=r.n(st),ct=function(){var e=s(Object(p.useState)({width:void 0,height:void 0}),2),t=e[0],r=e[1];return Object(p.useEffect)((function(){var e=function(){r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}}),[]),t},ft=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),dt=Object(w.css)(Ae||(Ae=c(["\n margin-right: 10px;\n"],["\n margin-right: 10px;\n"]))),pt=function(e){var t=e.reportGroup,r=it(),n=(null!=t?t:{}).id,a=ct().height,o=s(Object(p.useState)(""),2),u=o[0],c=o[1],f=ke("users-"+r,(function(){return function(e){return Object(E.getBackendSrv)().post("/api/tsdb/query",{queries:[{datasourceId:e,rawSql:'SELECT id, name, first_name, last_name, e_mail FROM "user"',format:"table"}]}).then((function(e){var t=s(e.results.A.tables,1)[0],r=t.rows,n=t.columns,a=["id","name","first_name","last_name","e_mail"],o=n.reduce((function(e,t,r){var n=t.text;return a.includes(n)?l(l([],s(e)),[r]):e}),[]);return r.map((function(e){return o.reduce((function(t,r,a){var o;return i(i({},t),((o={})[n[r].text]=e[a],o))}),{})}))}))}(r)}),{enabled:!!r,refetchOnMount:!0,retry:0}),d=f.data,v=f.error,g=ke(["groupMembers",n],Re).data,y=s(ut(["groupMembers",n],Me,(function(e){return i(i({},e),{userID:e.user.id,id:""})}),(function(e,t){return e?l(l([],s(e)),[t]):e}),[]),1)[0],w=s(ut(["groupMembers",n],ze,(function(e){return e}),(function(e,t){return e?e.filter((function(e){return e.id!==t.id})):e}),[]),1)[0];return h.a.createElement("div",{style:{}},h.a.createElement("div",{style:{marginTop:"25px",display:"flex",alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("users_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,v?"There was a problem finding users. Is your Datasource setup correctly?":m.a.get("users"))),d?h.a.createElement(h.a.Fragment,null,h.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",flexDirection:"row"}},h.a.createElement(b.Icon,{style:{marginRight:"10px"},name:"search"}),h.a.createElement(b.Input,{css:"",placeholder:"Search for users",onChange:function(e){var t=e.target.value;return c(t)}}),h.a.createElement(b.Icon,{style:{marginRight:"10px"},size:"xl",name:"trash-alt",onClick:function(){return c("")}})),h.a.createElement("ol",{className:ft,style:{maxHeight:(null!=a?a:0)/2+"px",overflow:"scroll"}},null==d?void 0:d.filter((function(e){return e.name.toLowerCase().includes(u.toLowerCase())})).map((function(e){var t=e.name,r=e.e_mail,a=e.id,i=null==g?void 0:g.find((function(e){return e.userID===a}));return h.a.createElement("li",{className:"card-item-wrapper",style:r?{cursor:"pointer"}:{},key:t},h.a.createElement("div",{className:"card-item",onClick:function(){return r&&function(e){var t=e.id,r=null==g?void 0:g.find((function(e){return e.userID===t}));r?w(r):y({user:e,reportGroupID:null!=n?n:""})}(e)}},h.a.createElement("div",{className:"card-item-body"},h.a.createElement("div",{className:dt},h.a.createElement(b.Checkbox,{value:!!i,css:""})),h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},t),h.a.createElement("div",{className:"card-item-type"},r||m.a.get("no_email"))))))})))):!v&&h.a.createElement(b.Spinner,{style:{flex:1,display:"flex",justifyContent:"center"}}))};!function(e){e.NAME="name",e.DESCRIPTION="description",e.ID="id"}(Ce||(Ce={})),function(e){e.NAME="name",e.DESCRIPTION="description",e.ID="id",e.INTERVAL="interval",e.REPORT_GROUP_ID="reportGroupID",e.TIME_OF_DAY="time",e.DAY_OF_INTERVAL="day"}(Te||(Te={})),function(e){e.ID="id",e.LOOKBACK="lookback",e.PANEL_ID="panelID",e.VARIABLES="variables"}(Ie||(Ie={}));var ht,vt,mt,gt,yt,bt,wt,_t,Et,xt,St,Ot=Object(w.css)(ht||(ht=c(["\n display: flex;\n flex-direction: column;\n flex: 1;\n padding-right: 30px;\n"],["\n display: flex;\n flex-direction: column;\n flex: 1;\n padding-right: 30px;\n"]))),Dt=Object(w.css)(vt||(vt=c(["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n"],["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n"]))),jt=function(e){var t=e.onUpdate,r=e.reportGroup;return h.a.createElement("div",{className:Ot},h.a.createElement("div",{style:{marginTop:"25px",display:"flex",alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("edit_details_report_group_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("edit_details"))),h.a.createElement("div",{className:Dt},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_name")},m.a.get("name")),h.a.createElement(b.Input,{onChange:function(e){var r=e.currentTarget.value;return t(Ce.NAME,r)},name:m.a.get("name"),defaultValue:null==r?void 0:r.name,placeholder:m.a.get("name"),css:""})),h.a.createElement("div",{className:Dt},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("description")},m.a.get("group_description")),h.a.createElement(b.Input,{onChange:function(e){var r=e.currentTarget.value;return t(Ce.DESCRIPTION,r)},name:m.a.get("description"),defaultValue:null==r?void 0:r.description,placeholder:m.a.get("description"),css:""})))},kt=Object(w.css)(mt||(mt=c(["\n top: 0;\n bottom: 0;\n width: 80%;\n"],["\n top: 0;\n bottom: 0;\n width: 80%;\n"]))),Ft=function(e){var t=e.reportGroup,r=e.onClose,n=e.isOpen,a=s(ot(!1),2),o=a[0],u=a[1],f=s(ut(["reportGroup"],qe,(function(e){return e}),(function(e,t){if(e){var r=e.findIndex((function(e){return e.id===t.id}));if(r>=0)return e[r]=t,l([],s(e))}return e}),[]),1)[0],d=s(De(Be,{onSuccess:function(){return ue.refetchQueries(["reportGroup"])}}),1)[0];return h.a.createElement(b.Modal,{className:kt,title:m.a.get("edit_report_group"),isOpen:n,onDismiss:r},h.a.createElement("div",{className:Object(w.css)(gt||(gt=c(["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n "],["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n "])))},h.a.createElement(jt,{onUpdate:function(e,r){var n,a=i(i({},t),((n={})[e]=r,n));f(a)},reportGroup:t}),h.a.createElement(b.Button,{size:"md",variant:"destructive",onClick:u},m.a.get("delete"))),h.a.createElement(pt,{reportGroup:t}),h.a.createElement(b.ConfirmModal,{isOpen:o,title:m.a.get("delete_report_group"),body:m.a.get("delete_report_group_question"),confirmText:m.a.get("delete"),icon:"exclamation-triangle",onConfirm:function(){d(t),u(),r()},onDismiss:u}))},At=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),Ct=function(e){var t=e.onRowPress,r=ke("reportGroup",Ne),n=r.data;return r.isLoading?h.a.createElement(b.Spinner,null):h.a.createElement("ol",{className:At},null==n?void 0:n.map((function(e){var r=e.name,n=e.description;return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:"pointer"},key:r},h.a.createElement("div",{className:"card-item",onClick:function(){return t(null==e?void 0:e.id)}},h.a.createElement("div",{className:"card-item-name"},r),n&&h.a.createElement("div",{className:"card-item-type"},n)))})))},Tt=Object(w.css)(yt||(yt=c(["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"],["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"]))),It=function(){var e=s(Object(p.useState)(null),2),t=e[0],r=e[1],n=ue.getQueryData("reportGroup"),a=null==n?void 0:n.find((function(e){return e.id===t})),i=s(ut(["reportGroup"],Ge,(function(){return{id:"",name:m.a.get("new_report_group"),description:""}}),(function(e,t){return e?l(l([],s(e)),[t]):[t]}),[]),1)[0];return h.a.createElement("div",null,h.a.createElement("div",{className:Tt},h.a.createElement(b.Legend,null,"Report Groups"),h.a.createElement(b.Button,{onClick:i,variant:"primary"},m.a.get("add_report_group"))),h.a.createElement(Ct,{onRowPress:r}),a&&n&&h.a.createElement(Ft,{reportGroup:a,isOpen:!!t,onClose:function(){return r(null)}}))},Lt=function(e,t){try{return JSON.parse(e)}catch(e){return t}},Pt=function(e){var t=e.onUpdate,r=e.name,n=e.variable,a=e.multiSelectable,i=e.selectedOptions,s=e.selectableOptions,l=n.refresh,c=it(),f=ke(r,(function(){return function(e,t){return o(void 0,void 0,Promise,(function(){var r,n,a,i,o,s,l,c;return u(this,(function(u){switch(u.label){case 0:return r=e.definition,n=e.name,[4,Object(E.getBackendSrv)().post("/api/tsdb/query",{queries:[{datasourceId:t,rawSql:r,format:"table"}]})];case 1:return a=u.sent(),[2,null===(c=null===(l=null===(s=null===(o=null===(i=a.results)||void 0===i?void 0:i.A)||void 0===o?void 0:o.tables)||void 0===s?void 0:s[0])||void 0===l?void 0:l.rows)||void 0===c?void 0:c.flat().map((function(e){return{label:e,value:{name:n,value:e}}}))]}}))}))}(n,c)}),{enabled:!!l}).data,d=(null==s?void 0:s.length)>0?s:f;return h.a.createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},h.a.createElement(b.InlineFormLabel,null,r),a?h.a.createElement(b.MultiSelect,{onChange:function(e){if(e.some((function(e){var t=e.value;return"$__all"===(null==t?void 0:t.value)})))return t(s);t(e)},value:null==d?void 0:d.filter((function(e){return!!(null==i?void 0:i.find((function(t){var r;return t===(null===(r=null==e?void 0:e.value)||void 0===r?void 0:r.value)})))})),filterOption:function(e,t){var r;return!!(null===(r=null==e?void 0:e.label)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))},closeMenuOnSelect:!1,options:d}):h.a.createElement(b.Select,{value:null==d?void 0:d.filter((function(e){return!!(null==i?void 0:i.find((function(t){return t===e.value.value})))})),onChange:function(e){var r;if("$__all"===(null===(r=e.value)||void 0===r?void 0:r.value))return t(s);t([e])},options:d}))},Rt=function(e){var t=e.onUpdate,r=e.name,n=e.value;return h.a.createElement("div",{style:{display:"flex",flexDirection:"row",marginTop:"5px"}},h.a.createElement(b.InlineFormLabel,null,r),h.a.createElement(b.Input,{type:"text",defaultValue:n,placeholder:"",onChange:function(e){var n=e.target.value;t([{value:{name:r,value:n}}])},css:""}))},Nt=function(e){var t,r,n,a,i=e.onUpdateVariable,o=e.panel,u=e.onUpdateContent,s=e.lookback,l=e.variables,c=[{label:m.a.get("1day"),value:864e5},{label:m.a.get("2days"),value:1728e5},{label:m.a.get("3days"),value:2592e5},{label:m.a.get("1week"),value:6048e5},{label:m.a.get("2weeks"),value:12096e5},{label:m.a.get("4weeks"),value:24192e5},{label:m.a.get("3months"),value:72576e5},{label:m.a.get("6months"),value:145152e5},{label:m.a.get("1year"),value:307584e5}],f=Lt(l,{}),d=(t=o.rawSql,r=RegExp(/\$__timeTo()/g),n=RegExp(/\$__timeFrom()/g),a=RegExp(/\$__timeFilter\([a-zA-Z]+\)/g),r.test(t)||n.test(t)||a.test(t));return o.variables.length>0||d?h.a.createElement("div",{style:{border:"1px solid grey",padding:"20px"}},h.a.createElement("div",{className:"card-item-type"},m.a.get("variables")),h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("variables_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})),d&&h.a.createElement("div",{style:{display:"flex",flexDirection:"row"}},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("lookback_period_description")},m.a.get("lookback_period")),h.a.createElement(b.Select,{options:c,onChange:function(e){return u(Ie.LOOKBACK,e)},value:c.filter((function(e){return e.value===s}))})),o.variables.map((function(e){var t,r,n,a=e.name,o=e.options,u=e.multi,s=e.label,l=f[e.name],c=o.map((function(t){return{label:t.text,value:{name:e.name,value:t.value}}}));if("textbox"===e.type){var d=null!==(t=null==l?void 0:l[0])&&void 0!==t?t:null===(n=null===(r=c[0])||void 0===r?void 0:r.value)||void 0===n?void 0:n.value;return h.a.createElement(Rt,{onUpdate:i(a),name:null!=s?s:a,value:d})}return h.a.createElement(Pt,{onUpdate:i(a),multiSelectable:u,name:null!=s?s:a,selectedOptions:l,selectableOptions:c,variable:e,key:a})}))):null},Mt=Object(w.css)(bt||(bt=c(["\n margin-right: 10px;\n"],["\n margin-right: 10px;\n"]))),zt=function(e){var t=e.panel,r=e.reportContent,n=e.onToggle,a=e.scheduleID,o=t.title,u=t.description,c=t.error;Object(p.useEffect)((function(){c&&r&&n(t)}),[c,r,t,n]);var f,d=s(ut(["reportContent",a],Je,(function(e){return e}),(function(e,t){var r=t.id;if(e){var n=e.findIndex((function(e){return e.id===r}));return e[n]=t,l([],s(e))}return e}),[]),1)[0];return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:c?"":"pointer"}},h.a.createElement("div",{className:"card-item"},h.a.createElement("div",{className:"card-item-body",onClick:function(){if(!c)return n(t)}},h.a.createElement("div",{className:Mt},c?null:h.a.createElement(b.Checkbox,{value:!!r,css:""})),h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},o),h.a.createElement("div",{className:"card-item-type"},u))),r&&!c&&h.a.createElement(Nt,{panel:t,lookback:r.lookback,variables:r.variables,onUpdateContent:(f=r,function(e,t){var r;d(i(i({},f),((r={})[e]=t.value,r)))}),onUpdateVariable:function(e){return function(t){return function(r){var n=r.map((function(e){return e.value.value})),a=Lt(e.variables,{});a[t]=n,d(i(i({},e),{variables:JSON.stringify(a)}))}}}(r)}),c))},qt=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),Bt=function(e){var t=e.schedule,r=ct().height,n=it(),a=t.id,c=ke(["panels"],(function(){return Ye(n)})).data,f=ke(["reportContent",a],Ke).data,d=Object(p.useCallback)((function(e){return f?function(e,t){var r;return null!==(r=null==e?void 0:e.find((function(e){var r=e.panelID,n=e.dashboardID,a=t.id,i=t.dashboardID;return a===r&&n===i})))&&void 0!==r?r:null}(f,e):null}),[f]),v=s(ut(["reportContent",a],Xe,(function(e){return i(i({},e),{lookback:0,id:""})}),(function(e,t){return e?l(l([],s(e)),[t]):[t]}),[]),1)[0],g=s(ut(["reportContent",a],We,(function(e){return e}),(function(e,t){return e?e.filter((function(e){return e.id!==t.id})):e}),[]),1)[0],y=function(e){return o(void 0,void 0,void 0,(function(){var t;return u(this,(function(r){switch(r.label){case 0:return(null==(t=d(e))?void 0:t.id)?[4,g(t)]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,v({scheduleID:null!=a?a:"",panelID:null==e?void 0:e.id,dashboardID:null==e?void 0:e.dashboardID,variables:""})];case 3:r.sent(),r.label=4;case 4:return[2]}}))}))};return h.a.createElement("div",{style:{marginTop:"25px"}},h.a.createElement("div",{style:{display:"flex",flex:1,alignItems:"center"}},h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("available_panels_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("available_panels"))),h.a.createElement("ol",{className:qt,style:{maxHeight:(null!=r?r:0)/2+"px",overflow:"scroll"}},null==c?void 0:c.map((function(e){var t=d(e);return h.a.createElement(zt,{reportContent:t,panel:e,scheduleID:a,onToggle:y,key:a})}))))},Gt=function(){return[{label:m.a.get("daily"),value:0},{label:m.a.get("weekly"),value:1},{label:m.a.get("fortnightly"),value:2},{label:m.a.get("monthly"),value:3},{label:m.a.get("quarterly"),value:4},{label:m.a.get("yearly"),value:5}]},Qt=Object(w.css)(wt||(wt=c(["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n flex: 1;\n padding-right: 30px;\n flex-direction: row;\n"],["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n flex: 1;\n padding-right: 30px;\n flex-direction: row;\n"]))),Ut=Object(w.css)(_t||(_t=c(["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n margin-left: 20px;\n"],["\n display: flex;\n flex-direction: row;\n flex: 1;\n flex-basis: calc(50% - 20px);\n margin-left: 20px;\n"]))),Ht=function(e){var t,r,a,i=e.onUpdate,o=e.schedule,u=ke("reportGroup",Ne).data;return h.a.createElement("div",{style:{width:"100%"}},h.a.createElement("div",null,h.a.createElement(b.Tooltip,{placement:"top",content:m.a.get("edit_details_schedule_tooltip"),theme:"info"},h.a.createElement(b.Icon,{name:"info-circle",size:"sm",style:{marginLeft:"10px",marginRight:"10px",marginBottom:"16px"}})),h.a.createElement(b.Legend,null,m.a.get("edit_details"))),h.a.createElement("div",{className:Qt},h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_name")},m.a.get("name")),h.a.createElement(b.Input,{onChange:function(e){var t=e.currentTarget.value;return i(Te.NAME,t)},name:m.a.get("name"),defaultValue:o.name,placeholder:m.a.get("name"),css:""})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_interval_description")},m.a.get("report_interval")),h.a.createElement(b.Select,{value:Gt().filter((function(e){return e.value===(null==o?void 0:o.interval)})),options:Gt(),onChange:function(e){i(Te.INTERVAL,e.value)}})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("group_description")},m.a.get("description")),h.a.createElement(b.Input,{onChange:function(e){var t=e.currentTarget.value;return i(Te.DESCRIPTION,t)},name:m.a.get("description"),defaultValue:o.description,placeholder:m.a.get("description"),css:""})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_time_description")},m.a.get("report_time")),h.a.createElement(b.TimeOfDayPicker,{onChange:function(e){i(Te.TIME_OF_DAY,e.format("HH:mm"))},value:(t=null==o?void 0:o.time,r=Object(n.dateTime)(Date.now()),a=Object(n.dateTime)(r.format("YYYY-MM-DD")+" "+t,"YYYY-MM-DD HH:mm"),a.isValid()?a:void 0)})),h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_group_description")},m.a.get("report_group")),h.a.createElement(b.Select,{value:null==u?void 0:u.filter((function(e){return e.id===o.reportGroupID})).map((function(e){return{label:e.name,description:e.description,value:e}})),options:null==u?void 0:u.map((function(e){return{label:e.name,description:e.description,value:e}})),onChange:function(e){var t,r;i(Te.REPORT_GROUP_ID,null!==(r=null===(t=null==e?void 0:e.value)||void 0===t?void 0:t.id)&&void 0!==r?r:"")}})),(o.interval||0)>2?h.a.createElement("div",{className:Ut},h.a.createElement(b.InlineFormLabel,{tooltip:m.a.get("report_day_description")},m.a.get("report_day")),h.a.createElement(b.Input,{css:"",defaultValue:1,min:1,name:m.a.get("report_day"),onChange:function(e){var t=e.currentTarget.value;return i(Te.DAY_OF_INTERVAL,parseInt(t,10))},placeholder:m.a.get("report_day"),type:"number",value:(null==o?void 0:o.day)||1})):h.a.createElement("div",{className:Ut})))},Kt=Object(w.css)(Et||(Et=c(["\n top: 0;\n bottom: 0;\n width: 80%;\n"],["\n top: 0;\n bottom: 0;\n width: 80%;\n"]))),Vt=Object(w.css)(xt||(xt=c(["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n"],["\n display: flex;\n flex: 1;\n justify-content: flex-end;\n"]))),Zt=function(e){var t=e.reportSchedule,r=e.onClose,n=e.isOpen,a=s(Object(p.useState)(t),2),o=a[0],u=a[1],l=s(ot(!1),2),c=l[0],f=l[1],d=s(De(Pe),2),v=d[0],g=d[1].isLoading,y=s(De($e,{onSuccess:function(){return ue.refetchQueries(["reportSchedules"])}}),1)[0],w=s(De(He,{onSuccess:function(){return ue.refetchQueries(["reportSchedules"])}}),1)[0];Object(p.useEffect)((function(){o||u(t)}),[o,t]);return h.a.createElement(b.Modal,{className:Kt,onClickBackdrop:function(){},title:m.a.get("edit_report_schedule"),isOpen:n,onDismiss:r},h.a.createElement("div",{className:Vt},h.a.createElement(Ht,{schedule:o,onUpdate:function(e,t){var r,n=i(i({},o),((r={})[e]=t,r));u(n),y(n)}}),h.a.createElement("div",{style:{display:"flex",flexDirection:"column"}},h.a.createElement(b.Button,{size:"md",variant:"destructive",onClick:f},m.a.get("delete")),g?h.a.createElement(b.Spinner,null):h.a.createElement(b.Button,{size:"md",variant:"primary",style:{marginTop:"10px"},onClick:function(){return v(o.id)}},m.a.get("send_test_emails")))),h.a.createElement(Bt,{schedule:t}),h.a.createElement(b.ConfirmModal,{isOpen:c,title:m.a.get("delete_report_schedule"),body:m.a.get("delete_report_schedule_question"),confirmText:m.a.get("delete"),icon:"exclamation-triangle",onConfirm:function(){w(o),f(),r()},onDismiss:f}))},Yt=lt()({"card-section":!0,"card-list-layout-grid":!0,"card-list-layout-list":!0,"card-list":!0}),$t=function(e){var t=e.onRowPress,r=ke("reportSchedules",Qe),n=r.data;return r.isLoading?h.a.createElement(b.Spinner,null):h.a.createElement("ol",{className:Yt},null==n?void 0:n.map((function(e){var r=e.name,n=e.description;return h.a.createElement("li",{className:"card-item-wrapper",style:{cursor:"pointer"},key:r},h.a.createElement("div",{className:"card-item",onClick:function(){return t(e)}},h.a.createElement("div",{className:"card-item-details"},h.a.createElement("div",{className:"card-item-name"},r),h.a.createElement("div",{className:"card-item-type"},n))))})))},Xt=Object(w.css)(St||(St=c(["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"],["\n display: flex;\n justify-content: flex-end;\n margin-bottom: 10px;\n"]))),Wt=function(){var e=s(Object(p.useState)(null),2),t=e[0],r=e[1],n=s(De(Ue,{onSuccess:function(){return ue.refetchQueries("reportSchedules")}}),1)[0];return h.a.createElement("div",null,h.a.createElement("div",{className:Xt},h.a.createElement(b.Legend,null,m.a.get("report_schedules")),h.a.createElement(b.Button,{onClick:function(){return o(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,n()]}))}))},variant:"primary"},m.a.get("add_schedule"))),h.a.createElement($t,{onRowPress:r}),t&&h.a.createElement(Zt,{reportSchedule:t,isOpen:!!t,onClose:function(){return r(null)}}))},Jt="report-group",er="report-schedule";r.d(t,"plugin",(function(){return rr}));var tr,rr=(new n.AppPlugin).setRootPage((function(e){var t=e.path,r=e.onNavChanged,n=e.query,a=e.meta,i=t.replace(/^\//,""),o={pluginID:null==a?void 0:a.id};Object(p.useEffect)((function(){m.a.init({currentLocale:"en",locales:g})}),[]),function(e,t,r,n){Object(p.useEffect)((function(){var e=[{text:" "+m.a.get("report_groups"),icon:"fa fa-fw fa-file-text-o",url:r+"?tab="+Jt,id:Jt},{text:" "+m.a.get("report_schedules"),icon:"fa fa-users",url:r+"?tab="+er,id:er}],a={text:m.a.get("msupply"),img:t,url:r,children:e};n({node:a,main:a})}),[e,r,t,n])}(n.tab,a.info.logos.large,i,r);return h.a.createElement("div",null,h.a.createElement(y.Provider,{value:o},function(){switch(n.tab){default:case Jt:return h.a.createElement(It,{meta:a,path:t,onNavChanged:r,query:n});case er:return h.a.createElement(Wt,{meta:a,path:t,onNavChanged:r,query:n})}}(),h.a.createElement(at.ReactQueryDevtools,null)))})).addConfigPage({title:"\tApp Configuration",icon:"fa fa-cogs",body:(tr=function(e){var t,r,n,a,o,u,s,l,f,d,p,v,g,y,x,S,O,D,j=function(t){void 0===t&&(t=!0),Object(E.getBackendSrv)().post("/api/plugins/"+e.plugin.meta.id+"/settings",i(i({},e.plugin.meta),{enabled:t,pinned:t})).then((function(){return window.location.href=window.location.href}))},k={grafanaPassword:null!==(r=null===(t=e.plugin.meta.jsonData)||void 0===t?void 0:t.grafanaPassword)&&void 0!==r?r:"",grafanaUsername:null!==(a=null===(n=e.plugin.meta.jsonData)||void 0===n?void 0:n.grafanaUsername)&&void 0!==a?a:"",grafanaURL:null!==(u=null===(o=e.plugin.meta.jsonData)||void 0===o?void 0:o.grafanaURL)&&void 0!==u?u:"",email:null!==(l=null===(s=e.plugin.meta.jsonData)||void 0===s?void 0:s.email)&&void 0!==l?l:"",emailPassword:null!==(d=null===(f=e.plugin.meta.jsonData)||void 0===f?void 0:f.emailPassword)&&void 0!==d?d:"",datasourceID:null!==(v=null===(p=e.plugin.meta.jsonData)||void 0===p?void 0:p.datasourceID)&&void 0!==v?v:1,datasourceName:null!==(y=null===(g=e.plugin.meta.jsonData)||void 0===g?void 0:g.datasourceName)&&void 0!==y?y:"",emailHost:null!==(S=null===(x=e.plugin.meta.jsonData)||void 0===x?void 0:x.emailHost)&&void 0!==S?S:"smtp.gmail.com",emailPort:null!==(D=null===(O=e.plugin.meta.jsonData)||void 0===O?void 0:O.emailPort)&&void 0!==D?D:587};return e.plugin.meta.enabled?h.a.createElement("div",{className:Object(w.css)(Fe||(Fe=c(["\n margin: auto;\n "],["\n margin: auto;\n "])))},h.a.createElement(nt,{formValues:k,onSubmit:function(t){var r=i(i({},t),{emailPort:Number(t.emailPort)});Object(E.getBackendSrv)().post("/api/plugins/msupplyfoundation-datasource/resources/settings",r),Object(E.getBackendSrv)().post("/api/plugins/"+e.plugin.meta.id+"/settings",i(i({},e.plugin.meta),{jsonData:r}))}}),h.a.createElement(b.Button,{variant:"destructive",onClick:function(){return j(!1)}},m.a.get("disable"))):h.a.createElement(_,{toggle:j})},function(e){function t(t){var r=e.call(this,t)||this;return r.displayName="ConfigPageFactory",r.state={shouldLoad:!1},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.componentDidMount=function(){return o(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,m.a.init({currentLocale:"en",locales:g})];case 1:return e.sent(),this.setState({shouldLoad:!0}),[2]}}))}))},t.prototype.render=function(){return this.state.shouldLoad?h.a.createElement(tr,i({},this.props)):null},t}(p.Component)),id:"page1"})},function(e,t,r){"use strict";var n;function a(e){return e.type===n.literal}function i(e){return e.type===n.argument}function o(e){return e.type===n.number}function u(e){return e.type===n.date}function s(e){return e.type===n.time}function l(e){return e.type===n.select}function c(e){return e.type===n.plural}function f(e){return e.type===n.pound}function d(e){return!(!e||"object"!=typeof e||0!==e.type)}function p(e){return!(!e||"object"!=typeof e||1!==e.type)}r.r(t),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound"}(n||(n={}));var h,v=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),m=function(){return(m=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0){for(t=1,r=1;t1&&"}"===e)},X=ve("\n",!1),W=ge("argNameOrNumber"),J=ge("argNumber"),ee=ve("0",!1),te=/^[1-9]/,re=me([["1","9"]],!1,!1),ne=/^[0-9]/,ae=me([["0","9"]],!1,!1),ie=ge("argName"),oe=0,ue=0,se=[{line:1,column:1}],le=0,ce=[],fe=0;if(void 0!==t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=i[t.startRule]}function de(){return e.substring(ue,oe)}function pe(){return be(ue,oe)}function he(e,t){throw function(e,t){return new g(e,[],"",t)}(e,t=void 0!==t?t:be(ue,oe))}function ve(e,t){return{type:"literal",text:e,ignoreCase:t}}function me(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ge(e){return{type:"other",description:e}}function ye(t){var r,n=se[t];if(n)return n;for(r=t-1;!se[r];)r--;for(n={line:(n=se[r]).line,column:n.column};rle&&(le=oe,ce=[]),ce.push(e))}function _e(e,t,r){return new g(g.buildMessage(e,t),e,t,r)}function Ee(){return xe()}function xe(){var e,t;for(e=[],t=Se();t!==a;)e.push(t),t=Se();return e}function Se(){var t;return(t=function(){var e,t;e=oe,(t=Oe())!==a&&(ue=e,r=t,t=m({type:n.literal,value:r},He()));var r;return e=t}())===a&&(t=function(){var t,r,i,o;fe++,t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(i=qe())!==a&&Pe()!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=i,r=m({type:n.argument,value:u},He()),t=r):(oe=t,t=a)):(oe=t,t=a);var u;fe--,t===a&&(r=a,0===fe&&we(s));return t}())===a&&(t=function(){var t;(t=function(){var t,r,n,i,o,u,s,f,d;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(n=qe())!==a&&Pe()!==a?(44===e.charCodeAt(oe)?(i=",",oe++):(i=a,0===fe&&we(E)),i!==a&&Pe()!==a?("number"===e.substr(oe,6)?(o="number",oe+=6):(o=a,0===fe&&we(x)),o!==a&&Pe()!==a?(u=oe,44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a&&(f=Pe())!==a&&(d=function(){var t,r,n;t=oe,"::"===e.substr(oe,2)?(r="::",oe+=2):(r=a,0===fe&&we(w));r!==a&&(n=function(){var e,t,r;if(e=oe,t=[],(r=ke())!==a)for(;r!==a;)t.push(r),r=ke();else t=a;t!==a&&(ue=e,t=m({type:0,tokens:t},He()));return e=t}())!==a?(ue=t,t=r=n):(oe=t,t=a);t===a&&(t=oe,ue=oe,Qe.push("numberArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Oe())!==a?(ue=t,r=_(n),t=r):(oe=t,t=a));return t}())!==a?u=s=[s,f,d]:(oe=u,u=a),u===a&&(u=null),u!==a&&(s=Pe())!==a?(125===e.charCodeAt(oe)?(f="}",oe++):(f=a,0===fe&&we(c)),f!==a?(ue=t,r=S(n,o,u),t=r):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a);return t}())===a&&(t=function(){var t,r,n,i,o,u,s,f,d;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));r!==a&&Pe()!==a&&(n=qe())!==a&&Pe()!==a?(44===e.charCodeAt(oe)?(i=",",oe++):(i=a,0===fe&&we(E)),i!==a&&Pe()!==a?("date"===e.substr(oe,4)?(o="date",oe+=4):(o=a,0===fe&&we(T)),o===a&&("time"===e.substr(oe,4)?(o="time",oe+=4):(o=a,0===fe&&we(I))),o!==a&&Pe()!==a?(u=oe,44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a&&(f=Pe())!==a&&(d=function(){var t,r,n;t=oe,"::"===e.substr(oe,2)?(r="::",oe+=2):(r=a,0===fe&&we(w));r!==a&&(n=function(){var t,r,n,i;t=oe,r=oe,n=[],(i=Fe())===a&&(i=Ae());if(i!==a)for(;i!==a;)n.push(i),(i=Fe())===a&&(i=Ae());else n=a;r=n!==a?e.substring(r,oe):n;r!==a&&(ue=t,r=m({type:1,pattern:r},He()));return t=r}())!==a?(ue=t,t=r=n):(oe=t,t=a);t===a&&(t=oe,ue=oe,Qe.push("dateOrTimeArgStyle"),(r=(r=!0)?void 0:a)!==a&&(n=Oe())!==a?(ue=t,r=_(n),t=r):(oe=t,t=a));return t}())!==a?u=s=[s,f,d]:(oe=u,u=a),u===a&&(u=null),u!==a&&(s=Pe())!==a?(125===e.charCodeAt(oe)?(f="}",oe++):(f=a,0===fe&&we(c)),f!==a?(ue=t,r=S(n,o,u),t=r):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a);return t}());return t}())===a&&(t=function(){var t,r,i,o,u,s,f,d,p,h,v;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));if(r!==a)if(Pe()!==a)if((i=qe())!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(o=",",oe++):(o=a,0===fe&&we(E)),o!==a)if(Pe()!==a)if("plural"===e.substr(oe,6)?(u="plural",oe+=6):(u=a,0===fe&&we(L)),u===a&&("selectordinal"===e.substr(oe,13)?(u="selectordinal",oe+=13):(u=a,0===fe&&we(P))),u!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a)if(Pe()!==a)if(f=oe,"offset:"===e.substr(oe,7)?(d="offset:",oe+=7):(d=a,0===fe&&we(R)),d!==a&&(p=Pe())!==a&&(h=Re())!==a?f=d=[d,p,h]:(oe=f,f=a),f===a&&(f=null),f!==a)if((d=Pe())!==a){if(p=[],(h=Te())!==a)for(;h!==a;)p.push(h),h=Te();else p=a;p!==a&&(h=Pe())!==a?(125===e.charCodeAt(oe)?(v="}",oe++):(v=a,0===fe&&we(c)),v!==a?(ue=t,r=function(e,t,r,a){return m({type:n.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:a.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&he('Duplicate option "'+r+'" in plural element: "'+de()+'"',pe()),e[r]={value:n,location:a},e}),{})},He())}(i,u,f,p),t=r):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;return t}())===a&&(t=function(){var t,r,i,o,u,s,f,d,p;t=oe,123===e.charCodeAt(oe)?(r="{",oe++):(r=a,0===fe&&we(l));if(r!==a)if(Pe()!==a)if((i=qe())!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(o=",",oe++):(o=a,0===fe&&we(E)),o!==a)if(Pe()!==a)if("select"===e.substr(oe,6)?(u="select",oe+=6):(u=a,0===fe&&we(N)),u!==a)if(Pe()!==a)if(44===e.charCodeAt(oe)?(s=",",oe++):(s=a,0===fe&&we(E)),s!==a)if(Pe()!==a){if(f=[],(d=Ce())!==a)for(;d!==a;)f.push(d),d=Ce();else f=a;f!==a&&(d=Pe())!==a?(125===e.charCodeAt(oe)?(p="}",oe++):(p=a,0===fe&&we(c)),p!==a?(ue=t,r=function(e,t){return m({type:n.select,value:e,options:t.reduce((function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&he('Duplicate option "'+r+'" in select element: "'+de()+'"',pe()),e[r]={value:n,location:a},e}),{})},He())}(i,f),t=r):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;else oe=t,t=a;return t}())===a&&(t=function(){var t,r;t=oe,35===e.charCodeAt(oe)?(r="#",oe++):(r=a,0===fe&&we(u));r!==a&&(ue=t,r=m({type:n.pound},He()));return t=r}()),t}function Oe(){var e,t,r;if(e=oe,t=[],(r=Ne())===a&&(r=Me())===a&&(r=ze()),r!==a)for(;r!==a;)t.push(r),(r=Ne())===a&&(r=Me())===a&&(r=ze());else t=a;return t!==a&&(ue=e,t=t.join("")),e=t}function De(){var t,r,n,i,o;if(fe++,t=oe,r=[],n=oe,i=oe,fe++,(o=Ie())===a&&(d.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(p))),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a),n!==a)for(;n!==a;)r.push(n),n=oe,i=oe,fe++,(o=Ie())===a&&(d.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(p))),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a);else r=a;return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(f)),t}function je(){var t,r,n;return fe++,t=oe,47===e.charCodeAt(oe)?(r="/",oe++):(r=a,0===fe&&we(y)),r!==a&&(n=De())!==a?(ue=t,t=r=n):(oe=t,t=a),fe--,t===a&&(r=a,0===fe&&we(v)),t}function ke(){var e,t,r,n;if(fe++,e=oe,Pe()!==a)if((t=De())!==a){for(r=[],n=je();n!==a;)r.push(n),n=je();r!==a?(ue=e,e=function(e,t){return{stem:e,options:t}}(t,r)):(oe=e,e=a)}else oe=e,e=a;else oe=e,e=a;return fe--,e===a&&(a,0===fe&&we(b)),e}function Fe(){var t,r,n,i;if(t=oe,39===e.charCodeAt(oe)?(r="'",oe++):(r=a,0===fe&&we(O)),r!==a){if(n=[],(i=Ne())===a&&(D.test(e.charAt(oe))?(i=e.charAt(oe),oe++):(i=a,0===fe&&we(j))),i!==a)for(;i!==a;)n.push(i),(i=Ne())===a&&(D.test(e.charAt(oe))?(i=e.charAt(oe),oe++):(i=a,0===fe&&we(j)));else n=a;n!==a?(39===e.charCodeAt(oe)?(i="'",oe++):(i=a,0===fe&&we(O)),i!==a?t=r=[r,n,i]:(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;if(t===a)if(t=[],(r=Ne())===a&&(k.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(F))),r!==a)for(;r!==a;)t.push(r),(r=Ne())===a&&(k.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(F)));else t=a;return t}function Ae(){var t,r;if(t=[],A.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(C)),r!==a)for(;r!==a;)t.push(r),A.test(e.charAt(oe))?(r=e.charAt(oe),oe++):(r=a,0===fe&&we(C));else t=a;return t}function Ce(){var t,r,n,i,o,u,s;return t=oe,Pe()!==a&&(r=Ge())!==a&&Pe()!==a?(123===e.charCodeAt(oe)?(n="{",oe++):(n=a,0===fe&&we(l)),n!==a?(ue=oe,Qe.push("select"),(!0?void 0:a)!==a&&(i=xe())!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=r,s=i,Qe.pop(),t=m({id:u,value:s},He())):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a),t}function Te(){var t,r,n,i,o,u,s;return t=oe,Pe()!==a&&(r=function(){var t,r,n,i;return t=oe,r=oe,61===e.charCodeAt(oe)?(n="=",oe++):(n=a,0===fe&&we(M)),n!==a&&(i=Re())!==a?r=n=[n,i]:(oe=r,r=a),(t=r!==a?e.substring(t,oe):r)===a&&(t=Ge()),t}())!==a&&Pe()!==a?(123===e.charCodeAt(oe)?(n="{",oe++):(n=a,0===fe&&we(l)),n!==a?(ue=oe,Qe.push("plural"),(!0?void 0:a)!==a&&(i=xe())!==a?(125===e.charCodeAt(oe)?(o="}",oe++):(o=a,0===fe&&we(c)),o!==a?(ue=t,u=r,s=i,Qe.pop(),t=m({id:u,value:s},He())):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a)):(oe=t,t=a),t}function Ie(){var t;return fe++,q.test(e.charAt(oe))?(t=e.charAt(oe),oe++):(t=a,0===fe&&we(B)),fe--,t===a&&(a,0===fe&&we(z)),t}function Le(){var t;return fe++,Q.test(e.charAt(oe))?(t=e.charAt(oe),oe++):(t=a,0===fe&&we(U)),fe--,t===a&&(a,0===fe&&we(G)),t}function Pe(){var t,r,n;for(fe++,t=oe,r=[],n=Ie();n!==a;)r.push(n),n=Ie();return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(H)),t}function Re(){var t,r,n,i,o;return fe++,t=oe,45===e.charCodeAt(oe)?(r="-",oe++):(r=a,0===fe&&we(V)),r===a&&(r=null),r!==a&&(n=Be())!==a?(ue=t,i=r,t=r=(o=n)?i?-o:o:0):(oe=t,t=a),fe--,t===a&&(r=a,0===fe&&we(K)),t}function Ne(){var t,r;return fe++,t=oe,"''"===e.substr(oe,2)?(r="''",oe+=2):(r=a,0===fe&&we(Y)),r!==a&&(ue=t,r="'"),fe--,(t=r)===a&&(r=a,0===fe&&we(Z)),t}function Me(){var t,r,n,i,o,u;if(t=oe,39===e.charCodeAt(oe)?(r="'",oe++):(r=a,0===fe&&we(O)),r!==a)if((n=function(){var t,r,n,i;t=oe,r=oe,e.length>oe?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(h));n!==a?(ue=oe,(i=(i="{"===(o=n)||"}"===o||Ue()&&"#"===o)?void 0:a)!==a?r=n=[n,i]:(oe=r,r=a)):(oe=r,r=a);var o;t=r!==a?e.substring(t,oe):r;return t}())!==a){for(i=oe,o=[],"''"===e.substr(oe,2)?(u="''",oe+=2):(u=a,0===fe&&we(Y)),u===a&&(D.test(e.charAt(oe))?(u=e.charAt(oe),oe++):(u=a,0===fe&&we(j)));u!==a;)o.push(u),"''"===e.substr(oe,2)?(u="''",oe+=2):(u=a,0===fe&&we(Y)),u===a&&(D.test(e.charAt(oe))?(u=e.charAt(oe),oe++):(u=a,0===fe&&we(j)));(i=o!==a?e.substring(i,oe):o)!==a?(39===e.charCodeAt(oe)?(o="'",oe++):(o=a,0===fe&&we(O)),o===a&&(o=null),o!==a?(ue=t,t=r=n+i.replace("''","'")):(oe=t,t=a)):(oe=t,t=a)}else oe=t,t=a;else oe=t,t=a;return t}function ze(){var t,r,n,i;return t=oe,r=oe,e.length>oe?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(h)),n!==a?(ue=oe,(i=(i=$(n))?void 0:a)!==a?r=n=[n,i]:(oe=r,r=a)):(oe=r,r=a),r===a&&(10===e.charCodeAt(oe)?(r="\n",oe++):(r=a,0===fe&&we(X))),t=r!==a?e.substring(t,oe):r}function qe(){var t,r;return fe++,t=oe,(r=Be())===a&&(r=Ge()),t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(W)),t}function Be(){var t,r,n,i,o;if(fe++,t=oe,48===e.charCodeAt(oe)?(r="0",oe++):(r=a,0===fe&&we(ee)),r!==a&&(ue=t,r=0),(t=r)===a){if(t=oe,r=oe,te.test(e.charAt(oe))?(n=e.charAt(oe),oe++):(n=a,0===fe&&we(re)),n!==a){for(i=[],ne.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(ae));o!==a;)i.push(o),ne.test(e.charAt(oe))?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(ae));i!==a?r=n=[n,i]:(oe=r,r=a)}else oe=r,r=a;r!==a&&(ue=t,r=parseInt(r.join(""),10)),t=r}return fe--,t===a&&(r=a,0===fe&&we(J)),t}function Ge(){var t,r,n,i,o;if(fe++,t=oe,r=[],n=oe,i=oe,fe++,(o=Ie())===a&&(o=Le()),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a),n!==a)for(;n!==a;)r.push(n),n=oe,i=oe,fe++,(o=Ie())===a&&(o=Le()),fe--,o===a?i=void 0:(oe=i,i=a),i!==a?(e.length>oe?(o=e.charAt(oe),oe++):(o=a,0===fe&&we(h)),o!==a?n=i=[i,o]:(oe=n,n=a)):(oe=n,n=a);else r=a;return t=r!==a?e.substring(t,oe):r,fe--,t===a&&(r=a,0===fe&&we(ie)),t}var Qe=["root"];function Ue(){return"plural"===Qe[Qe.length-1]}function He(){return t&&t.captureLocation?{location:pe()}:{}}if((r=o())!==a&&oe===e.length)return r;throw r!==a&&oe1)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(k,(function(e,r,n){return"."===e?t.maximumFractionDigits=0:"+"===n?t.minimumFractionDigits=n.length:"#"===r[0]?t.maximumFractionDigits=r.length:(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length+("string"==typeof n?n.length:0)),""})),a.options.length&&(t=O(O({},t),A(a.options[0])))}else if(F.test(a.stem))t=O(O({},t),A(a.stem));else{var i=C(a.stem);i&&(t=O(O({},t),i))}}return t}var L,P=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),R=function(){for(var e=0,t=0,r=arguments.length;t(.*?)<\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\/>)/,U=Date.now()+"@@",H=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function K(e,t,r,n,a,i){var o=M(e,t,r,n,a,void 0,i),u={},s=o.reduce((function(e,t){if(0===t.type)return e+t.value;var r=Date.now()+"_"+ ++B;return u[r]=t.value,e+"@@"+r+"@@"}),"");if(!Q.test(s))return G(s,u);if(!a)throw new N("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new N("Cannot format XML message without DOMParser");L||(L=new DOMParser);var l=L.parseFromString(''+s+"","text/html").getElementById(U);if(!l)throw new N("Malformed HTML message "+s);var c=Object.keys(a).filter((function(e){return!!l.getElementsByTagName(e).length}));if(!c.length)return G(s,u);var f=c.filter((function(e){return e!==e.toLowerCase()}));if(f.length)throw new N("HTML tag must be lowercased but the following tags are not: "+f.join(", "));return Array.prototype.slice.call(l.childNodes).reduce((function(e,t){return e.concat(function e(t,r,n){var a=t.tagName,i=t.outerHTML,o=t.textContent,u=t.childNodes;if(!a)return G(o||"",r);a=a.toLowerCase();var s=~H.indexOf(a),l=n[a];if(l&&s)throw new N(a+" is a self-closing tag and can not be used, please use another tag name.");if(!u.length)return[i];var c=Array.prototype.slice.call(u).reduce((function(t,a){return t.concat(e(a,r,n))}),[]);return l?"function"==typeof l?[l.apply(void 0,c)]:[l]:R(["<"+a+">"],c,[""])}(t,u,a))}),[])}var V=function(){return(V=Object.assign||function(e){for(var t,r=1,n=arguments.length;r= 0 && value.indexOf(\">\") >= 0) {\n value = escapeHtml(value);\n }\n variables[i] = value;\n }\n }\n\n try {\n var msgFormatter = new IntlMessageFormat(msg, currentLocale, formats);\n return msgFormatter.format(variables);\n } catch (err) {\n this.options.warningHandler(\"react-intl-universal format message failed for key='\" + key + \"'.\", err.message);\n return msg;\n }\n }\n\n /**\n * Get the formatted html message by key.\n * @param {string} key The string representing key in locale data file\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"getHTML\",\n value: function getHTML(key, variables) {\n if (this.options.intlGetHook) {\n try {\n this.options.intlGetHook(key, this.options.currentLocale);\n } catch (e) {\n console.log('intl get hook error: ', e);\n }\n }\n var msg = this.get(key, variables);\n if (msg) {\n var el = React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: msg\n }\n });\n // when key exists, it should still return element if there's defaultMessage() after getHTML()\n var defaultMessage = function defaultMessage() {\n return el;\n };\n return Object.assign({ defaultMessage: defaultMessage, d: defaultMessage }, el);\n }\n return \"\";\n }\n\n /**\n * As same as get(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {string} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {string} message\n */\n\n }, {\n key: \"formatMessage\",\n value: function formatMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.get(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * As same as getHTML(...) API\n * @param {Object} options\n * @param {string} options.id\n * @param {React.Element} options.defaultMessage\n * @param {Object} variables Variables in message\n * @returns {React.Element} message\n */\n\n }, {\n key: \"formatHTMLMessage\",\n value: function formatHTMLMessage(messageDescriptor, variables) {\n var id = messageDescriptor.id,\n defaultMessage = messageDescriptor.defaultMessage;\n\n return this.getHTML(id, variables).defaultMessage(defaultMessage);\n }\n\n /**\n * Helper: determine user's locale via URL, cookie, localStorage, and browser's language.\n * You may not this API, if you have other rules to determine user's locale.\n * @param {string} options.urlLocaleKey URL's query Key to determine locale. Example: if URL=http://localhost?lang=en-US, then set it 'lang'\n * @param {string} options.cookieLocaleKey Cookie's Key to determine locale. Example: if cookie=lang:en-US, then set it 'lang'\n * @param {string} options.localStorageLocaleKey LocalStorage's Key to determine locale such as 'lang'\n * @returns {string} determined locale such as 'en-US'\n */\n\n }, {\n key: \"determineLocale\",\n value: function determineLocale() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n return this.getLocaleFromURL(options) || this.getLocaleFromCookie(options) || this.getLocaleFromLocalStorage(options) || this.getLocaleFromBrowser();\n }\n\n /**\n * Initialize properties and load CLDR locale data according to currentLocale\n * @param {Object} options\n * @param {string} options.currentLocale Current locale such as 'en-US'\n * @param {string} options.locales App locale data like {\"en-US\":{\"key1\":\"value1\"},\"zh-CN\":{\"key1\":\"值1\"}}\n * @returns {Promise}\n */\n\n }, {\n key: \"init\",\n value: function init() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n invariant(options.currentLocale, \"options.currentLocale is required\");\n invariant(options.locales, \"options.locales is required\");\n\n Object.assign(this.options, options);\n\n this.options.formats = Object.assign({}, this.options.formats, defaultFormats);\n\n return new Promise(function (resolve, reject) {\n // init() will not load external common locale data anymore.\n // But, it still return a Promise for abckward compatibility.\n resolve();\n });\n }\n\n /**\n * Get the inital options\n */\n\n }, {\n key: \"getInitOptions\",\n value: function getInitOptions() {\n return this.options;\n }\n\n /**\n * Load more locales after init\n */\n\n }, {\n key: \"load\",\n value: function load(locales) {\n merge(this.options.locales, locales);\n }\n }, {\n key: \"getLocaleFromCookie\",\n value: function getLocaleFromCookie(options) {\n var cookieLocaleKey = options.cookieLocaleKey;\n\n if (cookieLocaleKey) {\n var params = cookie.parse(document.cookie);\n return params && params[cookieLocaleKey];\n }\n }\n }, {\n key: \"getLocaleFromLocalStorage\",\n value: function getLocaleFromLocalStorage(options) {\n var localStorageLocaleKey = options.localStorageLocaleKey;\n\n if (localStorageLocaleKey && window.localStorage) {\n return localStorage.getItem(localStorageLocaleKey);\n }\n }\n }, {\n key: \"getLocaleFromURL\",\n value: function getLocaleFromURL(options) {\n var urlLocaleKey = options.urlLocaleKey;\n\n if (urlLocaleKey) {\n var query = location.search.split(\"?\");\n if (query.length >= 2) {\n var params = queryParser.parse(query[1]);\n return params && params[urlLocaleKey];\n }\n }\n }\n }, {\n key: \"getDescendantProp\",\n value: function getDescendantProp(locale, key) {\n\n if (locale[key]) {\n return locale[key];\n }\n\n var msg = key.split(\".\").reduce(function (a, b) {\n return a != undefined ? a[b] : a;\n }, locale);\n\n return msg;\n }\n }, {\n key: \"getLocaleFromBrowser\",\n value: function getLocaleFromBrowser() {\n return navigator.language || navigator.userLanguage;\n }\n }]);\n return ReactIntlUniversal;\n}();\n\nmodule.exports = new ReactIntlUniversal();\nmodule.exports.ReactIntlUniversal = ReactIntlUniversal;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","module.exports = __WEBPACK_EXTERNAL_MODULE__3__;","module.exports = __WEBPACK_EXTERNAL_MODULE__4__;","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","module.exports = __WEBPACK_EXTERNAL_MODULE__6__;","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__8__;","if (process.env.NODE_ENV === 'production') {\n module.exports = {\n ReactQueryDevtools: function() {return null;},\n ReactQueryDevtoolsPanel: function() {return null;},\n }\n} else {\n module.exports = require('./dist/react-query-devtools.development.js')\n}\n","// Expose `IntlPolyfill` as global to add locale data into runtime later on.\nglobal.IntlPolyfill = require('./lib/core.js');\n\n// Require all locale data for `Intl`. This module will be\n// ignored when bundling for the browser with Browserify/Webpack.\nrequire('./locale-data/complete.js');\n\n// hack to export the polyfill as global Intl if needed\nif (!global.Intl) {\n global.Intl = global.IntlPolyfill;\n global.IntlPolyfill.__applyLocaleSensitivePrototypes();\n}\n\n// providing an idiomatic api for the nodejs version of this module\nmodule.exports = global.IntlPolyfill;\n","'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n};\n\nvar jsx = function () {\n var REACT_ELEMENT_TYPE = typeof Symbol === \"function\" && Symbol.for && Symbol.for(\"react.element\") || 0xeac7;\n return function createRawReactElement(type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n props = {};\n }\n\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : '' + key,\n ref: null,\n props: props,\n _owner: null\n };\n };\n}();\n\nvar asyncToGenerator = function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n return step(\"next\", value);\n }, function (err) {\n return step(\"throw\", err);\n });\n }\n }\n\n return step(\"next\");\n });\n };\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar defineEnumerableProperties = function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n\n return obj;\n};\n\nvar defaults = function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n\n return obj;\n};\n\nvar defineProperty$1 = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n};\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar get = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar _instanceof = function (left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n};\n\nvar interopRequireDefault = function (obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n};\n\nvar interopRequireWildcard = function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n};\n\nvar newArrowCheck = function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n};\n\nvar objectDestructuringEmpty = function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n};\n\nvar objectWithoutProperties = function (obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar selfGlobal = typeof global === \"undefined\" ? self : global;\n\nvar set = function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if (\"value\" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n};\n\nvar slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\nvar slicedToArrayLoose = function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n\n if (i && _arr.length === i) break;\n }\n\n return _arr;\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n};\n\nvar taggedTemplateLiteral = function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n};\n\nvar taggedTemplateLiteralLoose = function (strings, raw) {\n strings.raw = raw;\n return strings;\n};\n\nvar temporalRef = function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + \" is not defined - temporal dead zone\");\n } else {\n return val;\n }\n};\n\nvar temporalUndefined = {};\n\nvar toArray = function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n};\n\nvar toConsumableArray = function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n};\n\n\n\nvar babelHelpers$1 = Object.freeze({\n jsx: jsx,\n asyncToGenerator: asyncToGenerator,\n classCallCheck: classCallCheck,\n createClass: createClass,\n defineEnumerableProperties: defineEnumerableProperties,\n defaults: defaults,\n defineProperty: defineProperty$1,\n get: get,\n inherits: inherits,\n interopRequireDefault: interopRequireDefault,\n interopRequireWildcard: interopRequireWildcard,\n newArrowCheck: newArrowCheck,\n objectDestructuringEmpty: objectDestructuringEmpty,\n objectWithoutProperties: objectWithoutProperties,\n possibleConstructorReturn: possibleConstructorReturn,\n selfGlobal: selfGlobal,\n set: set,\n slicedToArray: slicedToArray,\n slicedToArrayLoose: slicedToArrayLoose,\n taggedTemplateLiteral: taggedTemplateLiteral,\n taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,\n temporalRef: temporalRef,\n temporalUndefined: temporalUndefined,\n toArray: toArray,\n toConsumableArray: toConsumableArray,\n typeof: _typeof,\n extends: _extends,\n instanceof: _instanceof\n});\n\nvar realDefineProp = function () {\n var sentinel = function sentinel() {};\n try {\n Object.defineProperty(sentinel, 'a', {\n get: function get() {\n return 1;\n }\n });\n Object.defineProperty(sentinel, 'prototype', { writable: false });\n return sentinel.a === 1 && sentinel.prototype instanceof Object;\n } catch (e) {\n return false;\n }\n}();\n\n// Need a workaround for getters in ES3\nvar es3 = !realDefineProp && !Object.prototype.__defineGetter__;\n\n// We use this a lot (and need it for proto-less objects)\nvar hop = Object.prototype.hasOwnProperty;\n\n// Naive defineProperty for compatibility\nvar defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) {\n if ('get' in desc && obj.__defineGetter__) obj.__defineGetter__(name, desc.get);else if (!hop.call(obj, name) || 'value' in desc) obj[name] = desc.value;\n};\n\n// Array.prototype.indexOf, as good as we need it to be\nvar arrIndexOf = Array.prototype.indexOf || function (search) {\n /*jshint validthis:true */\n var t = this;\n if (!t.length) return -1;\n\n for (var i = arguments[1] || 0, max = t.length; i < max; i++) {\n if (t[i] === search) return i;\n }\n\n return -1;\n};\n\n// Create an object with the specified prototype (2nd arg required for Record)\nvar objCreate = Object.create || function (proto, props) {\n var obj = void 0;\n\n function F() {}\n F.prototype = proto;\n obj = new F();\n\n for (var k in props) {\n if (hop.call(props, k)) defineProperty(obj, k, props[k]);\n }\n\n return obj;\n};\n\n// Snapshot some (hopefully still) native built-ins\nvar arrSlice = Array.prototype.slice;\nvar arrConcat = Array.prototype.concat;\nvar arrPush = Array.prototype.push;\nvar arrJoin = Array.prototype.join;\nvar arrShift = Array.prototype.shift;\n\n// Naive Function.prototype.bind for compatibility\nvar fnBind = Function.prototype.bind || function (thisObj) {\n var fn = this,\n args = arrSlice.call(arguments, 1);\n\n // All our (presently) bound functions have either 1 or 0 arguments. By returning\n // different function signatures, we can pass some tests in ES3 environments\n if (fn.length === 1) {\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n }\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n};\n\n// Object housing internal properties for constructors\nvar internals = objCreate(null);\n\n// Keep internal properties internal\nvar secret = Math.random();\n\n// Helper functions\n// ================\n\n/**\n * A function to deal with the inaccuracy of calculating log10 in pre-ES6\n * JavaScript environments. Math.log(num) / Math.LN10 was responsible for\n * causing issue #62.\n */\nfunction log10Floor(n) {\n // ES6 provides the more accurate Math.log10\n if (typeof Math.log10 === 'function') return Math.floor(Math.log10(n));\n\n var x = Math.round(Math.log(n) * Math.LOG10E);\n return x - (Number('1e' + x) > n);\n}\n\n/**\n * A map that doesn't contain Object in its prototype chain\n */\nfunction Record(obj) {\n // Copy only own properties over unless this object is already a Record instance\n for (var k in obj) {\n if (obj instanceof Record || hop.call(obj, k)) defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });\n }\n}\nRecord.prototype = objCreate(null);\n\n/**\n * An ordered list\n */\nfunction List() {\n defineProperty(this, 'length', { writable: true, value: 0 });\n\n if (arguments.length) arrPush.apply(this, arrSlice.call(arguments));\n}\nList.prototype = objCreate(null);\n\n/**\n * Constructs a regular expression to restore tainted RegExp properties\n */\nfunction createRegExpRestore() {\n if (internals.disableRegExpRestore) {\n return function () {/* no-op */};\n }\n\n var regExpCache = {\n lastMatch: RegExp.lastMatch || '',\n leftContext: RegExp.leftContext,\n multiline: RegExp.multiline,\n input: RegExp.input\n },\n has = false;\n\n // Create a snapshot of all the 'captured' properties\n for (var i = 1; i <= 9; i++) {\n has = (regExpCache['$' + i] = RegExp['$' + i]) || has;\n }return function () {\n // Now we've snapshotted some properties, escape the lastMatch string\n var esc = /[.?*+^$[\\]\\\\(){}|-]/g,\n lm = regExpCache.lastMatch.replace(esc, '\\\\$&'),\n reg = new List();\n\n // If any of the captured strings were non-empty, iterate over them all\n if (has) {\n for (var _i = 1; _i <= 9; _i++) {\n var m = regExpCache['$' + _i];\n\n // If it's empty, add an empty capturing group\n if (!m) lm = '()' + lm;\n\n // Else find the string in lm and escape & wrap it to capture it\n else {\n m = m.replace(esc, '\\\\$&');\n lm = lm.replace(m, '(' + m + ')');\n }\n\n // Push it to the reg and chop lm to make sure further groups come after\n arrPush.call(reg, lm.slice(0, lm.indexOf('(') + 1));\n lm = lm.slice(lm.indexOf('(') + 1);\n }\n }\n\n var exprStr = arrJoin.call(reg, '') + lm;\n\n // Shorten the regex by replacing each part of the expression with a match\n // for a string of that exact length. This is safe for the type of\n // expressions generated above, because the expression matches the whole\n // match string, so we know each group and each segment between capturing\n // groups can be matched by its length alone.\n exprStr = exprStr.replace(/(\\\\\\(|\\\\\\)|[^()])+/g, function (match) {\n return '[\\\\s\\\\S]{' + match.replace('\\\\', '').length + '}';\n });\n\n // Create the regular expression that will reconstruct the RegExp properties\n var expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g');\n\n // Set the lastIndex of the generated expression to ensure that the match\n // is found in the correct index.\n expr.lastIndex = regExpCache.leftContext.length;\n\n expr.exec(regExpCache.input);\n };\n}\n\n/**\n * Mimics ES5's abstract ToObject() function\n */\nfunction toObject(arg) {\n if (arg === null) throw new TypeError('Cannot convert null or undefined to object');\n\n if ((typeof arg === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](arg)) === 'object') return arg;\n return Object(arg);\n}\n\nfunction toNumber(arg) {\n if (typeof arg === 'number') return arg;\n return Number(arg);\n}\n\nfunction toInteger(arg) {\n var number = toNumber(arg);\n if (isNaN(number)) return 0;\n if (number === +0 || number === -0 || number === +Infinity || number === -Infinity) return number;\n if (number < 0) return Math.floor(Math.abs(number)) * -1;\n return Math.floor(Math.abs(number));\n}\n\nfunction toLength(arg) {\n var len = toInteger(arg);\n if (len <= 0) return 0;\n if (len === Infinity) return Math.pow(2, 53) - 1;\n return Math.min(len, Math.pow(2, 53) - 1);\n}\n\n/**\n * Returns \"internal\" properties for an object\n */\nfunction getInternalProperties(obj) {\n if (hop.call(obj, '__getInternalProperties')) return obj.__getInternalProperties(secret);\n\n return objCreate(null);\n}\n\n/**\n* Defines regular expressions for various operations related to the BCP 47 syntax,\n* as defined at http://tools.ietf.org/html/bcp47#section-2.1\n*/\n\n// extlang = 3ALPHA ; selected ISO 639 codes\n// *2(\"-\" 3ALPHA) ; permanently reserved\nvar extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';\n\n// language = 2*3ALPHA ; shortest ISO 639 code\n// [\"-\" extlang] ; sometimes followed by\n// ; extended language subtags\n// / 4ALPHA ; or reserved for future use\n// / 5*8ALPHA ; or registered language subtag\nvar language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';\n\n// script = 4ALPHA ; ISO 15924 code\nvar script = '[a-z]{4}';\n\n// region = 2ALPHA ; ISO 3166-1 code\n// / 3DIGIT ; UN M.49 code\nvar region = '(?:[a-z]{2}|\\\\d{3})';\n\n// variant = 5*8alphanum ; registered variants\n// / (DIGIT 3alphanum)\nvar variant = '(?:[a-z0-9]{5,8}|\\\\d[a-z0-9]{3})';\n\n// ; Single alphanumerics\n// ; \"x\" reserved for private use\n// singleton = DIGIT ; 0 - 9\n// / %x41-57 ; A - W\n// / %x59-5A ; Y - Z\n// / %x61-77 ; a - w\n// / %x79-7A ; y - z\nvar singleton = '[0-9a-wy-z]';\n\n// extension = singleton 1*(\"-\" (2*8alphanum))\nvar extension = singleton + '(?:-[a-z0-9]{2,8})+';\n\n// privateuse = \"x\" 1*(\"-\" (1*8alphanum))\nvar privateuse = 'x(?:-[a-z0-9]{1,8})+';\n\n// irregular = \"en-GB-oed\" ; irregular tags do not match\n// / \"i-ami\" ; the 'langtag' production and\n// / \"i-bnn\" ; would not otherwise be\n// / \"i-default\" ; considered 'well-formed'\n// / \"i-enochian\" ; These tags are all valid,\n// / \"i-hak\" ; but most are deprecated\n// / \"i-klingon\" ; in favor of more modern\n// / \"i-lux\" ; subtags or subtag\n// / \"i-mingo\" ; combination\n// / \"i-navajo\"\n// / \"i-pwn\"\n// / \"i-tao\"\n// / \"i-tay\"\n// / \"i-tsu\"\n// / \"sgn-BE-FR\"\n// / \"sgn-BE-NL\"\n// / \"sgn-CH-DE\"\nvar irregular = '(?:en-GB-oed' + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)' + '|sgn-(?:BE-FR|BE-NL|CH-DE))';\n\n// regular = \"art-lojban\" ; these tags match the 'langtag'\n// / \"cel-gaulish\" ; production, but their subtags\n// / \"no-bok\" ; are not extended language\n// / \"no-nyn\" ; or variant subtags: their meaning\n// / \"zh-guoyu\" ; is defined by their registration\n// / \"zh-hakka\" ; and all of these are deprecated\n// / \"zh-min\" ; in favor of a more modern\n// / \"zh-min-nan\" ; subtag or sequence of subtags\n// / \"zh-xiang\"\nvar regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn' + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';\n\n// grandfathered = irregular ; non-redundant tags registered\n// / regular ; during the RFC 3066 era\nvar grandfathered = '(?:' + irregular + '|' + regular + ')';\n\n// langtag = language\n// [\"-\" script]\n// [\"-\" region]\n// *(\"-\" variant)\n// *(\"-\" extension)\n// [\"-\" privateuse]\nvar langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-' + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';\n\n// Language-Tag = langtag ; normal language tags\n// / privateuse ; private use tag\n// / grandfathered ; grandfathered tags\nvar expBCP47Syntax = RegExp('^(?:' + langtag + '|' + privateuse + '|' + grandfathered + ')$', 'i');\n\n// Match duplicate variants in a language tag\nvar expVariantDupes = RegExp('^(?!x).*?-(' + variant + ')-(?:\\\\w{4,8}-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match duplicate singletons in a language tag (except in private use)\nvar expSingletonDupes = RegExp('^(?!x).*?-(' + singleton + ')-(?:\\\\w+-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match all extension sequences\nvar expExtSequences = RegExp('-' + extension, 'ig');\n\n// Default locale is the first-added locale data for us\nvar defaultLocale = void 0;\nfunction setDefaultLocale(locale) {\n defaultLocale = locale;\n}\n\n// IANA Subtag Registry redundant tag and subtag maps\nvar redundantTags = {\n tags: {\n \"art-lojban\": \"jbo\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"no-bok\": \"nb\",\n \"no-nyn\": \"nn\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"zh-guoyu\": \"cmn\",\n \"zh-hakka\": \"hak\",\n \"zh-min-nan\": \"nan\",\n \"zh-xiang\": \"hsn\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsl\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"zh-cmn\": \"cmn\",\n \"zh-cmn-Hans\": \"cmn-Hans\",\n \"zh-cmn-Hant\": \"cmn-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-wuu\": \"wuu\",\n \"zh-yue\": \"yue\"\n },\n subtags: {\n BU: \"MM\",\n DD: \"DE\",\n FX: \"FR\",\n TP: \"TL\",\n YD: \"YE\",\n ZR: \"CD\",\n heploc: \"alalc97\",\n 'in': \"id\",\n iw: \"he\",\n ji: \"yi\",\n jw: \"jv\",\n mo: \"ro\",\n ayx: \"nun\",\n bjd: \"drl\",\n ccq: \"rki\",\n cjr: \"mom\",\n cka: \"cmr\",\n cmk: \"xch\",\n drh: \"khk\",\n drw: \"prs\",\n gav: \"dev\",\n hrr: \"jal\",\n ibi: \"opa\",\n kgh: \"kml\",\n lcq: \"ppr\",\n mst: \"mry\",\n myt: \"mry\",\n sca: \"hle\",\n tie: \"ras\",\n tkk: \"twm\",\n tlw: \"weo\",\n tnf: \"prs\",\n ybd: \"rki\",\n yma: \"lrr\"\n },\n extLang: {\n aao: [\"aao\", \"ar\"],\n abh: [\"abh\", \"ar\"],\n abv: [\"abv\", \"ar\"],\n acm: [\"acm\", \"ar\"],\n acq: [\"acq\", \"ar\"],\n acw: [\"acw\", \"ar\"],\n acx: [\"acx\", \"ar\"],\n acy: [\"acy\", \"ar\"],\n adf: [\"adf\", \"ar\"],\n ads: [\"ads\", \"sgn\"],\n aeb: [\"aeb\", \"ar\"],\n aec: [\"aec\", \"ar\"],\n aed: [\"aed\", \"sgn\"],\n aen: [\"aen\", \"sgn\"],\n afb: [\"afb\", \"ar\"],\n afg: [\"afg\", \"sgn\"],\n ajp: [\"ajp\", \"ar\"],\n apc: [\"apc\", \"ar\"],\n apd: [\"apd\", \"ar\"],\n arb: [\"arb\", \"ar\"],\n arq: [\"arq\", \"ar\"],\n ars: [\"ars\", \"ar\"],\n ary: [\"ary\", \"ar\"],\n arz: [\"arz\", \"ar\"],\n ase: [\"ase\", \"sgn\"],\n asf: [\"asf\", \"sgn\"],\n asp: [\"asp\", \"sgn\"],\n asq: [\"asq\", \"sgn\"],\n asw: [\"asw\", \"sgn\"],\n auz: [\"auz\", \"ar\"],\n avl: [\"avl\", \"ar\"],\n ayh: [\"ayh\", \"ar\"],\n ayl: [\"ayl\", \"ar\"],\n ayn: [\"ayn\", \"ar\"],\n ayp: [\"ayp\", \"ar\"],\n bbz: [\"bbz\", \"ar\"],\n bfi: [\"bfi\", \"sgn\"],\n bfk: [\"bfk\", \"sgn\"],\n bjn: [\"bjn\", \"ms\"],\n bog: [\"bog\", \"sgn\"],\n bqn: [\"bqn\", \"sgn\"],\n bqy: [\"bqy\", \"sgn\"],\n btj: [\"btj\", \"ms\"],\n bve: [\"bve\", \"ms\"],\n bvl: [\"bvl\", \"sgn\"],\n bvu: [\"bvu\", \"ms\"],\n bzs: [\"bzs\", \"sgn\"],\n cdo: [\"cdo\", \"zh\"],\n cds: [\"cds\", \"sgn\"],\n cjy: [\"cjy\", \"zh\"],\n cmn: [\"cmn\", \"zh\"],\n coa: [\"coa\", \"ms\"],\n cpx: [\"cpx\", \"zh\"],\n csc: [\"csc\", \"sgn\"],\n csd: [\"csd\", \"sgn\"],\n cse: [\"cse\", \"sgn\"],\n csf: [\"csf\", \"sgn\"],\n csg: [\"csg\", \"sgn\"],\n csl: [\"csl\", \"sgn\"],\n csn: [\"csn\", \"sgn\"],\n csq: [\"csq\", \"sgn\"],\n csr: [\"csr\", \"sgn\"],\n czh: [\"czh\", \"zh\"],\n czo: [\"czo\", \"zh\"],\n doq: [\"doq\", \"sgn\"],\n dse: [\"dse\", \"sgn\"],\n dsl: [\"dsl\", \"sgn\"],\n dup: [\"dup\", \"ms\"],\n ecs: [\"ecs\", \"sgn\"],\n esl: [\"esl\", \"sgn\"],\n esn: [\"esn\", \"sgn\"],\n eso: [\"eso\", \"sgn\"],\n eth: [\"eth\", \"sgn\"],\n fcs: [\"fcs\", \"sgn\"],\n fse: [\"fse\", \"sgn\"],\n fsl: [\"fsl\", \"sgn\"],\n fss: [\"fss\", \"sgn\"],\n gan: [\"gan\", \"zh\"],\n gds: [\"gds\", \"sgn\"],\n gom: [\"gom\", \"kok\"],\n gse: [\"gse\", \"sgn\"],\n gsg: [\"gsg\", \"sgn\"],\n gsm: [\"gsm\", \"sgn\"],\n gss: [\"gss\", \"sgn\"],\n gus: [\"gus\", \"sgn\"],\n hab: [\"hab\", \"sgn\"],\n haf: [\"haf\", \"sgn\"],\n hak: [\"hak\", \"zh\"],\n hds: [\"hds\", \"sgn\"],\n hji: [\"hji\", \"ms\"],\n hks: [\"hks\", \"sgn\"],\n hos: [\"hos\", \"sgn\"],\n hps: [\"hps\", \"sgn\"],\n hsh: [\"hsh\", \"sgn\"],\n hsl: [\"hsl\", \"sgn\"],\n hsn: [\"hsn\", \"zh\"],\n icl: [\"icl\", \"sgn\"],\n ils: [\"ils\", \"sgn\"],\n inl: [\"inl\", \"sgn\"],\n ins: [\"ins\", \"sgn\"],\n ise: [\"ise\", \"sgn\"],\n isg: [\"isg\", \"sgn\"],\n isr: [\"isr\", \"sgn\"],\n jak: [\"jak\", \"ms\"],\n jax: [\"jax\", \"ms\"],\n jcs: [\"jcs\", \"sgn\"],\n jhs: [\"jhs\", \"sgn\"],\n jls: [\"jls\", \"sgn\"],\n jos: [\"jos\", \"sgn\"],\n jsl: [\"jsl\", \"sgn\"],\n jus: [\"jus\", \"sgn\"],\n kgi: [\"kgi\", \"sgn\"],\n knn: [\"knn\", \"kok\"],\n kvb: [\"kvb\", \"ms\"],\n kvk: [\"kvk\", \"sgn\"],\n kvr: [\"kvr\", \"ms\"],\n kxd: [\"kxd\", \"ms\"],\n lbs: [\"lbs\", \"sgn\"],\n lce: [\"lce\", \"ms\"],\n lcf: [\"lcf\", \"ms\"],\n liw: [\"liw\", \"ms\"],\n lls: [\"lls\", \"sgn\"],\n lsg: [\"lsg\", \"sgn\"],\n lsl: [\"lsl\", \"sgn\"],\n lso: [\"lso\", \"sgn\"],\n lsp: [\"lsp\", \"sgn\"],\n lst: [\"lst\", \"sgn\"],\n lsy: [\"lsy\", \"sgn\"],\n ltg: [\"ltg\", \"lv\"],\n lvs: [\"lvs\", \"lv\"],\n lzh: [\"lzh\", \"zh\"],\n max: [\"max\", \"ms\"],\n mdl: [\"mdl\", \"sgn\"],\n meo: [\"meo\", \"ms\"],\n mfa: [\"mfa\", \"ms\"],\n mfb: [\"mfb\", \"ms\"],\n mfs: [\"mfs\", \"sgn\"],\n min: [\"min\", \"ms\"],\n mnp: [\"mnp\", \"zh\"],\n mqg: [\"mqg\", \"ms\"],\n mre: [\"mre\", \"sgn\"],\n msd: [\"msd\", \"sgn\"],\n msi: [\"msi\", \"ms\"],\n msr: [\"msr\", \"sgn\"],\n mui: [\"mui\", \"ms\"],\n mzc: [\"mzc\", \"sgn\"],\n mzg: [\"mzg\", \"sgn\"],\n mzy: [\"mzy\", \"sgn\"],\n nan: [\"nan\", \"zh\"],\n nbs: [\"nbs\", \"sgn\"],\n ncs: [\"ncs\", \"sgn\"],\n nsi: [\"nsi\", \"sgn\"],\n nsl: [\"nsl\", \"sgn\"],\n nsp: [\"nsp\", \"sgn\"],\n nsr: [\"nsr\", \"sgn\"],\n nzs: [\"nzs\", \"sgn\"],\n okl: [\"okl\", \"sgn\"],\n orn: [\"orn\", \"ms\"],\n ors: [\"ors\", \"ms\"],\n pel: [\"pel\", \"ms\"],\n pga: [\"pga\", \"ar\"],\n pks: [\"pks\", \"sgn\"],\n prl: [\"prl\", \"sgn\"],\n prz: [\"prz\", \"sgn\"],\n psc: [\"psc\", \"sgn\"],\n psd: [\"psd\", \"sgn\"],\n pse: [\"pse\", \"ms\"],\n psg: [\"psg\", \"sgn\"],\n psl: [\"psl\", \"sgn\"],\n pso: [\"pso\", \"sgn\"],\n psp: [\"psp\", \"sgn\"],\n psr: [\"psr\", \"sgn\"],\n pys: [\"pys\", \"sgn\"],\n rms: [\"rms\", \"sgn\"],\n rsi: [\"rsi\", \"sgn\"],\n rsl: [\"rsl\", \"sgn\"],\n sdl: [\"sdl\", \"sgn\"],\n sfb: [\"sfb\", \"sgn\"],\n sfs: [\"sfs\", \"sgn\"],\n sgg: [\"sgg\", \"sgn\"],\n sgx: [\"sgx\", \"sgn\"],\n shu: [\"shu\", \"ar\"],\n slf: [\"slf\", \"sgn\"],\n sls: [\"sls\", \"sgn\"],\n sqk: [\"sqk\", \"sgn\"],\n sqs: [\"sqs\", \"sgn\"],\n ssh: [\"ssh\", \"ar\"],\n ssp: [\"ssp\", \"sgn\"],\n ssr: [\"ssr\", \"sgn\"],\n svk: [\"svk\", \"sgn\"],\n swc: [\"swc\", \"sw\"],\n swh: [\"swh\", \"sw\"],\n swl: [\"swl\", \"sgn\"],\n syy: [\"syy\", \"sgn\"],\n tmw: [\"tmw\", \"ms\"],\n tse: [\"tse\", \"sgn\"],\n tsm: [\"tsm\", \"sgn\"],\n tsq: [\"tsq\", \"sgn\"],\n tss: [\"tss\", \"sgn\"],\n tsy: [\"tsy\", \"sgn\"],\n tza: [\"tza\", \"sgn\"],\n ugn: [\"ugn\", \"sgn\"],\n ugy: [\"ugy\", \"sgn\"],\n ukl: [\"ukl\", \"sgn\"],\n uks: [\"uks\", \"sgn\"],\n urk: [\"urk\", \"ms\"],\n uzn: [\"uzn\", \"uz\"],\n uzs: [\"uzs\", \"uz\"],\n vgt: [\"vgt\", \"sgn\"],\n vkk: [\"vkk\", \"ms\"],\n vkt: [\"vkt\", \"ms\"],\n vsi: [\"vsi\", \"sgn\"],\n vsl: [\"vsl\", \"sgn\"],\n vsv: [\"vsv\", \"sgn\"],\n wuu: [\"wuu\", \"zh\"],\n xki: [\"xki\", \"sgn\"],\n xml: [\"xml\", \"sgn\"],\n xmm: [\"xmm\", \"ms\"],\n xms: [\"xms\", \"sgn\"],\n yds: [\"yds\", \"sgn\"],\n ysl: [\"ysl\", \"sgn\"],\n yue: [\"yue\", \"zh\"],\n zib: [\"zib\", \"sgn\"],\n zlm: [\"zlm\", \"ms\"],\n zmi: [\"zmi\", \"ms\"],\n zsl: [\"zsl\", \"sgn\"],\n zsm: [\"zsm\", \"ms\"]\n }\n};\n\n/**\n * Convert only a-z to uppercase as per section 6.1 of the spec\n */\nfunction toLatinUpperCase(str) {\n var i = str.length;\n\n while (i--) {\n var ch = str.charAt(i);\n\n if (ch >= \"a\" && ch <= \"z\") str = str.slice(0, i) + ch.toUpperCase() + str.slice(i + 1);\n }\n\n return str;\n}\n\n/**\n * The IsStructurallyValidLanguageTag abstract operation verifies that the locale\n * argument (which must be a String value)\n *\n * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section\n * 2.1, or successor,\n * - does not include duplicate variant subtags, and\n * - does not include duplicate singleton subtags.\n *\n * The abstract operation returns true if locale can be generated from the ABNF\n * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not\n * contain duplicate variant or singleton subtags (other than as a private use\n * subtag). It returns false otherwise. Terminal value characters in the grammar are\n * interpreted as the Unicode equivalents of the ASCII octet values given.\n */\nfunction /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {\n // represents a well-formed BCP 47 language tag as specified in RFC 5646\n if (!expBCP47Syntax.test(locale)) return false;\n\n // does not include duplicate variant subtags, and\n if (expVariantDupes.test(locale)) return false;\n\n // does not include duplicate singleton subtags.\n if (expSingletonDupes.test(locale)) return false;\n\n return true;\n}\n\n/**\n * The CanonicalizeLanguageTag abstract operation returns the canonical and case-\n * regularized form of the locale argument (which must be a String value that is\n * a structurally valid BCP 47 language tag as verified by the\n * IsStructurallyValidLanguageTag abstract operation). It takes the steps\n * specified in RFC 5646 section 4.5, or successor, to bring the language tag\n * into canonical form, and to regularize the case of the subtags, but does not\n * take the steps to bring a language tag into “extlang form” and to reorder\n * variant subtags.\n\n * The specifications for extensions to BCP 47 language tags, such as RFC 6067,\n * may include canonicalization rules for the extension subtag sequences they\n * define that go beyond the canonicalization rules of RFC 5646 section 4.5.\n * Implementations are allowed, but not required, to apply these additional rules.\n */\nfunction /* 6.2.3 */CanonicalizeLanguageTag(locale) {\n var match = void 0,\n parts = void 0;\n\n // A language tag is in 'canonical form' when the tag is well-formed\n // according to the rules in Sections 2.1 and 2.2\n\n // Section 2.1 says all subtags use lowercase...\n locale = locale.toLowerCase();\n\n // ...with 2 exceptions: 'two-letter and four-letter subtags that neither\n // appear at the start of the tag nor occur after singletons. Such two-letter\n // subtags are all uppercase (as in the tags \"en-CA-x-ca\" or \"sgn-BE-FR\") and\n // four-letter subtags are titlecase (as in the tag \"az-Latn-x-latn\").\n parts = locale.split('-');\n for (var i = 1, max = parts.length; i < max; i++) {\n // Two-letter subtags are all uppercase\n if (parts[i].length === 2) parts[i] = parts[i].toUpperCase();\n\n // Four-letter subtags are titlecase\n else if (parts[i].length === 4) parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);\n\n // Is it a singleton?\n else if (parts[i].length === 1 && parts[i] !== 'x') break;\n }\n locale = arrJoin.call(parts, '-');\n\n // The steps laid out in RFC 5646 section 4.5 are as follows:\n\n // 1. Extension sequences are ordered into case-insensitive ASCII order\n // by singleton subtag.\n if ((match = locale.match(expExtSequences)) && match.length > 1) {\n // The built-in sort() sorts by ASCII order, so use that\n match.sort();\n\n // Replace all extensions with the joined, sorted array\n locale = locale.replace(RegExp('(?:' + expExtSequences.source + ')+', 'i'), arrJoin.call(match, ''));\n }\n\n // 2. Redundant or grandfathered tags are replaced by their 'Preferred-\n // Value', if there is one.\n if (hop.call(redundantTags.tags, locale)) locale = redundantTags.tags[locale];\n\n // 3. Subtags are replaced by their 'Preferred-Value', if there is one.\n // For extlangs, the original primary language subtag is also\n // replaced if there is a primary language subtag in the 'Preferred-\n // Value'.\n parts = locale.split('-');\n\n for (var _i = 1, _max = parts.length; _i < _max; _i++) {\n if (hop.call(redundantTags.subtags, parts[_i])) parts[_i] = redundantTags.subtags[parts[_i]];else if (hop.call(redundantTags.extLang, parts[_i])) {\n parts[_i] = redundantTags.extLang[parts[_i]][0];\n\n // For extlang tags, the prefix needs to be removed if it is redundant\n if (_i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {\n parts = arrSlice.call(parts, _i++);\n _max -= 1;\n }\n }\n }\n\n return arrJoin.call(parts, '-');\n}\n\n/**\n * The DefaultLocale abstract operation returns a String value representing the\n * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the\n * host environment’s current locale.\n */\nfunction /* 6.2.4 */DefaultLocale() {\n return defaultLocale;\n}\n\n// Sect 6.3 Currency Codes\n// =======================\n\nvar expCurrencyCode = /^[A-Z]{3}$/;\n\n/**\n * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument\n * (after conversion to a String value) represents a well-formed 3-letter ISO currency\n * code. The following steps are taken:\n */\nfunction /* 6.3.1 */IsWellFormedCurrencyCode(currency) {\n // 1. Let `c` be ToString(currency)\n var c = String(currency);\n\n // 2. Let `normalized` be the result of mapping c to upper case as described\n // in 6.1.\n var normalized = toLatinUpperCase(c);\n\n // 3. If the string length of normalized is not 3, return false.\n // 4. If normalized contains any character that is not in the range \"A\" to \"Z\"\n // (U+0041 to U+005A), return false.\n if (expCurrencyCode.test(normalized) === false) return false;\n\n // 5. Return true\n return true;\n}\n\nvar expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below\n\nfunction /* 9.2.1 */CanonicalizeLocaleList(locales) {\n // The abstract operation CanonicalizeLocaleList takes the following steps:\n\n // 1. If locales is undefined, then a. Return a new empty List\n if (locales === undefined) return new List();\n\n // 2. Let seen be a new empty List.\n var seen = new List();\n\n // 3. If locales is a String value, then\n // a. Let locales be a new array created as if by the expression new\n // Array(locales) where Array is the standard built-in constructor with\n // that name and locales is the value of locales.\n locales = typeof locales === 'string' ? [locales] : locales;\n\n // 4. Let O be ToObject(locales).\n var O = toObject(locales);\n\n // 5. Let lenValue be the result of calling the [[Get]] internal method of\n // O with the argument \"length\".\n // 6. Let len be ToUint32(lenValue).\n var len = toLength(O.length);\n\n // 7. Let k be 0.\n var k = 0;\n\n // 8. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ToString(k).\n var Pk = String(k);\n\n // b. Let kPresent be the result of calling the [[HasProperty]] internal\n // method of O with argument Pk.\n var kPresent = Pk in O;\n\n // c. If kPresent is true, then\n if (kPresent) {\n // i. Let kValue be the result of calling the [[Get]] internal\n // method of O with argument Pk.\n var kValue = O[Pk];\n\n // ii. If the type of kValue is not String or Object, then throw a\n // TypeError exception.\n if (kValue === null || typeof kValue !== 'string' && (typeof kValue === \"undefined\" ? \"undefined\" : babelHelpers$1[\"typeof\"](kValue)) !== 'object') throw new TypeError('String or Object type expected');\n\n // iii. Let tag be ToString(kValue).\n var tag = String(kValue);\n\n // iv. If the result of calling the abstract operation\n // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as\n // the argument, is false, then throw a RangeError exception.\n if (!IsStructurallyValidLanguageTag(tag)) throw new RangeError(\"'\" + tag + \"' is not a structurally valid language tag\");\n\n // v. Let tag be the result of calling the abstract operation\n // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the\n // argument.\n tag = CanonicalizeLanguageTag(tag);\n\n // vi. If tag is not an element of seen, then append tag as the last\n // element of seen.\n if (arrIndexOf.call(seen, tag) === -1) arrPush.call(seen, tag);\n }\n\n // d. Increase k by 1.\n k++;\n }\n\n // 9. Return seen.\n return seen;\n}\n\n/**\n * The BestAvailableLocale abstract operation compares the provided argument\n * locale, which must be a String value with a structurally valid and\n * canonicalized BCP 47 language tag, against the locales in availableLocales and\n * returns either the longest non-empty prefix of locale that is an element of\n * availableLocales, or undefined if there is no such element. It uses the\n * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:\n */\nfunction /* 9.2.2 */BestAvailableLocale(availableLocales, locale) {\n // 1. Let candidate be locale\n var candidate = locale;\n\n // 2. Repeat\n while (candidate) {\n // a. If availableLocales contains an element equal to candidate, then return\n // candidate.\n if (arrIndexOf.call(availableLocales, candidate) > -1) return candidate;\n\n // b. Let pos be the character index of the last occurrence of \"-\"\n // (U+002D) within candidate. If that character does not occur, return\n // undefined.\n var pos = candidate.lastIndexOf('-');\n\n if (pos < 0) return;\n\n // c. If pos ≥ 2 and the character \"-\" occurs at index pos-2 of candidate,\n // then decrease pos by 2.\n if (pos >= 2 && candidate.charAt(pos - 2) === '-') pos -= 2;\n\n // d. Let candidate be the substring of candidate from position 0, inclusive,\n // to position pos, exclusive.\n candidate = candidate.substring(0, pos);\n }\n}\n\n/**\n * The LookupMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The following steps are taken:\n */\nfunction /* 9.2.3 */LookupMatcher(availableLocales, requestedLocales) {\n // 1. Let i be 0.\n var i = 0;\n\n // 2. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n\n // 3. Let availableLocale be undefined.\n var availableLocale = void 0;\n\n var locale = void 0,\n noExtensionsLocale = void 0;\n\n // 4. Repeat while i < len and availableLocale is undefined:\n while (i < len && !availableLocale) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position i.\n locale = requestedLocales[i];\n\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. Increase i by 1.\n i++;\n }\n\n // 5. Let result be a new Record.\n var result = new Record();\n\n // 6. If availableLocale is not undefined, then\n if (availableLocale !== undefined) {\n // a. Set result.[[locale]] to availableLocale.\n result['[[locale]]'] = availableLocale;\n\n // b. If locale and noExtensionsLocale are not the same String value, then\n if (String(locale) !== String(noExtensionsLocale)) {\n // i. Let extension be the String value consisting of the first\n // substring of locale that is a Unicode locale extension sequence.\n var extension = locale.match(expUnicodeExSeq)[0];\n\n // ii. Let extensionIndex be the character position of the initial\n // \"-\" of the first Unicode locale extension sequence within locale.\n var extensionIndex = locale.indexOf('-u-');\n\n // iii. Set result.[[extension]] to extension.\n result['[[extension]]'] = extension;\n\n // iv. Set result.[[extensionIndex]] to extensionIndex.\n result['[[extensionIndex]]'] = extensionIndex;\n }\n }\n // 7. Else\n else\n // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract\n // operation (defined in 6.2.4).\n result['[[locale]]'] = DefaultLocale();\n\n // 8. Return result\n return result;\n}\n\n/**\n * The BestFitMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The algorithm is implementation dependent, but should produce results\n * that a typical user of the requested locales would perceive as at least as\n * good as those produced by the LookupMatcher abstract operation. Options\n * specified through Unicode locale extension sequences must be ignored by the\n * algorithm. Information about such subsequences is returned separately.\n * The abstract operation returns a record with a [[locale]] field, whose value\n * is the language tag of the selected locale, which must be an element of\n * availableLocales. If the language tag of the request locale that led to the\n * selected locale contained a Unicode locale extension sequence, then the\n * returned record also contains an [[extension]] field whose value is the first\n * Unicode locale extension sequence, and an [[extensionIndex]] field whose value\n * is the index of the first Unicode locale extension sequence within the request\n * locale language tag.\n */\nfunction /* 9.2.4 */BestFitMatcher(availableLocales, requestedLocales) {\n return LookupMatcher(availableLocales, requestedLocales);\n}\n\n/**\n * The ResolveLocale abstract operation compares a BCP 47 language priority list\n * requestedLocales against the locales in availableLocales and determines the\n * best available language to meet the request. availableLocales and\n * requestedLocales must be provided as List values, options as a Record.\n */\nfunction /* 9.2.5 */ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n if (availableLocales.length === 0) {\n throw new ReferenceError('No locale data has been provided for this object yet.');\n }\n\n // The following steps are taken:\n // 1. Let matcher be the value of options.[[localeMatcher]].\n var matcher = options['[[localeMatcher]]'];\n\n var r = void 0;\n\n // 2. If matcher is \"lookup\", then\n if (matcher === 'lookup')\n // a. Let r be the result of calling the LookupMatcher abstract operation\n // (defined in 9.2.3) with arguments availableLocales and\n // requestedLocales.\n r = LookupMatcher(availableLocales, requestedLocales);\n\n // 3. Else\n else\n // a. Let r be the result of calling the BestFitMatcher abstract\n // operation (defined in 9.2.4) with arguments availableLocales and\n // requestedLocales.\n r = BestFitMatcher(availableLocales, requestedLocales);\n\n // 4. Let foundLocale be the value of r.[[locale]].\n var foundLocale = r['[[locale]]'];\n\n var extensionSubtags = void 0,\n extensionSubtagsLength = void 0;\n\n // 5. If r has an [[extension]] field, then\n if (hop.call(r, '[[extension]]')) {\n // a. Let extension be the value of r.[[extension]].\n var extension = r['[[extension]]'];\n // b. Let split be the standard built-in function object defined in ES5,\n // 15.5.4.14.\n var split = String.prototype.split;\n // c. Let extensionSubtags be the result of calling the [[Call]] internal\n // method of split with extension as the this value and an argument\n // list containing the single item \"-\".\n extensionSubtags = split.call(extension, '-');\n // d. Let extensionSubtagsLength be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument \"length\".\n extensionSubtagsLength = extensionSubtags.length;\n }\n\n // 6. Let result be a new Record.\n var result = new Record();\n\n // 7. Set result.[[dataLocale]] to foundLocale.\n result['[[dataLocale]]'] = foundLocale;\n\n // 8. Let supportedExtension be \"-u\".\n var supportedExtension = '-u';\n // 9. Let i be 0.\n var i = 0;\n // 10. Let len be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument \"length\".\n var len = relevantExtensionKeys.length;\n\n // 11 Repeat while i < len:\n while (i < len) {\n // a. Let key be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument ToString(i).\n var key = relevantExtensionKeys[i];\n // b. Let foundLocaleData be the result of calling the [[Get]] internal\n // method of localeData with the argument foundLocale.\n var foundLocaleData = localeData[foundLocale];\n // c. Let keyLocaleData be the result of calling the [[Get]] internal\n // method of foundLocaleData with the argument key.\n var keyLocaleData = foundLocaleData[key];\n // d. Let value be the result of calling the [[Get]] internal method of\n // keyLocaleData with argument \"0\".\n var value = keyLocaleData['0'];\n // e. Let supportedExtensionAddition be \"\".\n var supportedExtensionAddition = '';\n // f. Let indexOf be the standard built-in function object defined in\n // ES5, 15.4.4.14.\n var indexOf = arrIndexOf;\n\n // g. If extensionSubtags is not undefined, then\n if (extensionSubtags !== undefined) {\n // i. Let keyPos be the result of calling the [[Call]] internal\n // method of indexOf with extensionSubtags as the this value and\n // an argument list containing the single item key.\n var keyPos = indexOf.call(extensionSubtags, key);\n\n // ii. If keyPos ≠ -1, then\n if (keyPos !== -1) {\n // 1. If keyPos + 1 < extensionSubtagsLength and the length of the\n // result of calling the [[Get]] internal method of\n // extensionSubtags with argument ToString(keyPos +1) is greater\n // than 2, then\n if (keyPos + 1 < extensionSubtagsLength && extensionSubtags[keyPos + 1].length > 2) {\n // a. Let requestedValue be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument\n // ToString(keyPos + 1).\n var requestedValue = extensionSubtags[keyPos + 1];\n // b. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the\n // this value and an argument list containing the single\n // item requestedValue.\n var valuePos = indexOf.call(keyLocaleData, requestedValue);\n\n // c. If valuePos ≠ -1, then\n if (valuePos !== -1) {\n // i. Let value be requestedValue.\n value = requestedValue,\n // ii. Let supportedExtensionAddition be the\n // concatenation of \"-\", key, \"-\", and value.\n supportedExtensionAddition = '-' + key + '-' + value;\n }\n }\n // 2. Else\n else {\n // a. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the this\n // value and an argument list containing the single item\n // \"true\".\n var _valuePos = indexOf(keyLocaleData, 'true');\n\n // b. If valuePos ≠ -1, then\n if (_valuePos !== -1)\n // i. Let value be \"true\".\n value = 'true';\n }\n }\n }\n // h. If options has a field [[]], then\n if (hop.call(options, '[[' + key + ']]')) {\n // i. Let optionsValue be the value of options.[[]].\n var optionsValue = options['[[' + key + ']]'];\n\n // ii. If the result of calling the [[Call]] internal method of indexOf\n // with keyLocaleData as the this value and an argument list\n // containing the single item optionsValue is not -1, then\n if (indexOf.call(keyLocaleData, optionsValue) !== -1) {\n // 1. If optionsValue is not equal to value, then\n if (optionsValue !== value) {\n // a. Let value be optionsValue.\n value = optionsValue;\n // b. Let supportedExtensionAddition be \"\".\n supportedExtensionAddition = '';\n }\n }\n }\n // i. Set result.[[]] to value.\n result['[[' + key + ']]'] = value;\n\n // j. Append supportedExtensionAddition to supportedExtension.\n supportedExtension += supportedExtensionAddition;\n\n // k. Increase i by 1.\n i++;\n }\n // 12. If the length of supportedExtension is greater than 2, then\n if (supportedExtension.length > 2) {\n // a.\n var privateIndex = foundLocale.indexOf(\"-x-\");\n // b.\n if (privateIndex === -1) {\n // i.\n foundLocale = foundLocale + supportedExtension;\n }\n // c.\n else {\n // i.\n var preExtension = foundLocale.substring(0, privateIndex);\n // ii.\n var postExtension = foundLocale.substring(privateIndex);\n // iii.\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n // d. asserting - skipping\n // e.\n foundLocale = CanonicalizeLanguageTag(foundLocale);\n }\n // 13. Set result.[[locale]] to foundLocale.\n result['[[locale]]'] = foundLocale;\n\n // 14. Return result.\n return result;\n}\n\n/**\n * The LookupSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.\n * Locales appear in the same order in the returned list as in requestedLocales.\n * The following steps are taken:\n */\nfunction /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) {\n // 1. Let len be the number of elements in requestedLocales.\n var len = requestedLocales.length;\n // 2. Let subset be a new empty List.\n var subset = new List();\n // 3. Let k be 0.\n var k = 0;\n\n // 4. Repeat while k < len\n while (k < len) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position k.\n var locale = requestedLocales[k];\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n var noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. If availableLocale is not undefined, then append locale to the end of\n // subset.\n if (availableLocale !== undefined) arrPush.call(subset, locale);\n\n // e. Increment k by 1.\n k++;\n }\n\n // 5. Let subsetArray be a new Array object whose elements are the same\n // values in the same order as the elements of subset.\n var subsetArray = arrSlice.call(subset);\n\n // 6. Return subsetArray.\n return subsetArray;\n}\n\n/**\n * The BestFitSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the Best Fit Matcher\n * algorithm. Locales appear in the same order in the returned list as in\n * requestedLocales. The steps taken are implementation dependent.\n */\nfunction /*9.2.7 */BestFitSupportedLocales(availableLocales, requestedLocales) {\n // ###TODO: implement this function as described by the specification###\n return LookupSupportedLocales(availableLocales, requestedLocales);\n}\n\n/**\n * The SupportedLocales abstract operation returns the subset of the provided BCP\n * 47 language priority list requestedLocales for which availableLocales has a\n * matching locale. Two algorithms are available to match the locales: the Lookup\n * algorithm described in RFC 4647 section 3.4, and an implementation dependent\n * best-fit algorithm. Locales appear in the same order in the returned list as\n * in requestedLocales. The following steps are taken:\n */\nfunction /*9.2.8 */SupportedLocales(availableLocales, requestedLocales, options) {\n var matcher = void 0,\n subset = void 0;\n\n // 1. If options is not undefined, then\n if (options !== undefined) {\n // a. Let options be ToObject(options).\n options = new Record(toObject(options));\n // b. Let matcher be the result of calling the [[Get]] internal method of\n // options with argument \"localeMatcher\".\n matcher = options.localeMatcher;\n\n // c. If matcher is not undefined, then\n if (matcher !== undefined) {\n // i. Let matcher be ToString(matcher).\n matcher = String(matcher);\n\n // ii. If matcher is not \"lookup\" or \"best fit\", then throw a RangeError\n // exception.\n if (matcher !== 'lookup' && matcher !== 'best fit') throw new RangeError('matcher should be \"lookup\" or \"best fit\"');\n }\n }\n // 2. If matcher is undefined or \"best fit\", then\n if (matcher === undefined || matcher === 'best fit')\n // a. Let subset be the result of calling the BestFitSupportedLocales\n // abstract operation (defined in 9.2.7) with arguments\n // availableLocales and requestedLocales.\n subset = BestFitSupportedLocales(availableLocales, requestedLocales);\n // 3. Else\n else\n // a. Let subset be the result of calling the LookupSupportedLocales\n // abstract operation (defined in 9.2.6) with arguments\n // availableLocales and requestedLocales.\n subset = LookupSupportedLocales(availableLocales, requestedLocales);\n\n // 4. For each named own property name P of subset,\n for (var P in subset) {\n if (!hop.call(subset, P)) continue;\n\n // a. Let desc be the result of calling the [[GetOwnProperty]] internal\n // method of subset with P.\n // b. Set desc.[[Writable]] to false.\n // c. Set desc.[[Configurable]] to false.\n // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,\n // and true as arguments.\n defineProperty(subset, P, {\n writable: false, configurable: false, value: subset[P]\n });\n }\n // \"Freeze\" the array so no new elements can be added\n defineProperty(subset, 'length', { writable: false });\n\n // 5. Return subset\n return subset;\n}\n\n/**\n * The GetOption abstract operation extracts the value of the property named\n * property from the provided options object, converts it to the required type,\n * checks whether it is one of a List of allowed values, and fills in a fallback\n * value if necessary.\n */\nfunction /*9.2.9 */GetOption(options, property, type, values, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Assert: type is \"boolean\" or \"string\".\n // b. If type is \"boolean\", then let value be ToBoolean(value).\n // c. If type is \"string\", then let value be ToString(value).\n value = type === 'boolean' ? Boolean(value) : type === 'string' ? String(value) : value;\n\n // d. If values is not undefined, then\n if (values !== undefined) {\n // i. If values does not contain an element equal to value, then throw a\n // RangeError exception.\n if (arrIndexOf.call(values, value) === -1) throw new RangeError(\"'\" + value + \"' is not an allowed value for `\" + property + '`');\n }\n\n // e. Return value.\n return value;\n }\n // Else return fallback.\n return fallback;\n}\n\n/**\n * The GetNumberOption abstract operation extracts a property value from the\n * provided options object, converts it to a Number value, checks whether it is\n * in the allowed range, and fills in a fallback value if necessary.\n */\nfunction /* 9.2.10 */GetNumberOption(options, property, minimum, maximum, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n var value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Let value be ToNumber(value).\n value = Number(value);\n\n // b. If value is NaN or less than minimum or greater than maximum, throw a\n // RangeError exception.\n if (isNaN(value) || value < minimum || value > maximum) throw new RangeError('Value is not a number or outside accepted range');\n\n // c. Return floor(value).\n return Math.floor(value);\n }\n // 3. Else return fallback.\n return fallback;\n}\n\n// 8 The Intl Object\nvar Intl = {};\n\n// 8.2 Function Properties of the Intl Object\n\n// 8.2.1\n// @spec[tc39/ecma402/master/spec/intl.html]\n// @clause[sec-intl.getcanonicallocales]\nfunction getCanonicalLocales(locales) {\n // 1. Let ll be ? CanonicalizeLocaleList(locales).\n var ll = CanonicalizeLocaleList(locales);\n // 2. Return CreateArrayFromList(ll).\n {\n var result = [];\n\n var len = ll.length;\n var k = 0;\n\n while (k < len) {\n result[k] = ll[k];\n k++;\n }\n return result;\n }\n}\n\nObject.defineProperty(Intl, 'getCanonicalLocales', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: getCanonicalLocales\n});\n\n// Currency minor units output from get-4217 grunt task, formatted\nvar currencyMinorUnits = {\n BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,\n XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,\n OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0\n};\n\n// Define the NumberFormat constructor internally so it cannot be tainted\nfunction NumberFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.NumberFormat(locales, options);\n }\n\n return InitializeNumberFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'NumberFormat', {\n configurable: true,\n writable: true,\n value: NumberFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(Intl.NumberFormat, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeNumberFormat accepts the arguments\n * numberFormat (which must be an object), locales, and options. It initializes\n * numberFormat as a NumberFormat object.\n */\nfunction /*11.1.1.1 */InitializeNumberFormat(numberFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(numberFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If numberFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(numberFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. If options is undefined, then\n if (options === undefined)\n // a. Let options be the result of creating a new object as if by the\n // expression new Object() where Object is the standard built-in constructor\n // with that name.\n options = {};\n\n // 5. Else\n else\n // a. Let options be ToObject(options).\n options = toObject(options);\n\n // 6. Let opt be a new Record.\n var opt = new Record(),\n\n\n // 7. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with the arguments options, \"localeMatcher\", \"string\",\n // a List containing the two String values \"lookup\" and \"best fit\", and\n // \"best fit\".\n matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 8. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 9. Let NumberFormat be the standard built-in object that is the initial value\n // of Intl.NumberFormat.\n // 10. Let localeData be the value of the [[localeData]] internal property of\n // NumberFormat.\n var localeData = internals.NumberFormat['[[localeData]]'];\n\n // 11. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of NumberFormat, and localeData.\n var r = ResolveLocale(internals.NumberFormat['[[availableLocales]]'], requestedLocales, opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 12. Set the [[locale]] internal property of numberFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 13. Set the [[numberingSystem]] internal property of numberFormat to the value\n // of r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let s be the result of calling the GetOption abstract operation with the\n // arguments options, \"style\", \"string\", a List containing the three String\n // values \"decimal\", \"percent\", and \"currency\", and \"decimal\".\n var s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');\n\n // 16. Set the [[style]] internal property of numberFormat to s.\n internal['[[style]]'] = s;\n\n // 17. Let c be the result of calling the GetOption abstract operation with the\n // arguments options, \"currency\", \"string\", undefined, and undefined.\n var c = GetOption(options, 'currency', 'string');\n\n // 18. If c is not undefined and the result of calling the\n // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with\n // argument c is false, then throw a RangeError exception.\n if (c !== undefined && !IsWellFormedCurrencyCode(c)) throw new RangeError(\"'\" + c + \"' is not a valid currency code\");\n\n // 19. If s is \"currency\" and c is undefined, throw a TypeError exception.\n if (s === 'currency' && c === undefined) throw new TypeError('Currency code is required when style is currency');\n\n var cDigits = void 0;\n\n // 20. If s is \"currency\", then\n if (s === 'currency') {\n // a. Let c be the result of converting c to upper case as specified in 6.1.\n c = c.toUpperCase();\n\n // b. Set the [[currency]] internal property of numberFormat to c.\n internal['[[currency]]'] = c;\n\n // c. Let cDigits be the result of calling the CurrencyDigits abstract\n // operation (defined below) with argument c.\n cDigits = CurrencyDigits(c);\n }\n\n // 21. Let cd be the result of calling the GetOption abstract operation with the\n // arguments options, \"currencyDisplay\", \"string\", a List containing the\n // three String values \"code\", \"symbol\", and \"name\", and \"symbol\".\n var cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');\n\n // 22. If s is \"currency\", then set the [[currencyDisplay]] internal property of\n // numberFormat to cd.\n if (s === 'currency') internal['[[currencyDisplay]]'] = cd;\n\n // 23. Let mnid be the result of calling the GetNumberOption abstract operation\n // (defined in 9.2.10) with arguments options, \"minimumIntegerDigits\", 1, 21,\n // and 1.\n var mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);\n\n // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.\n internal['[[minimumIntegerDigits]]'] = mnid;\n\n // 25. If s is \"currency\", then let mnfdDefault be cDigits; else let mnfdDefault\n // be 0.\n var mnfdDefault = s === 'currency' ? cDigits : 0;\n\n // 26. Let mnfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"minimumFractionDigits\", 0, 20, and mnfdDefault.\n var mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);\n\n // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.\n internal['[[minimumFractionDigits]]'] = mnfd;\n\n // 28. If s is \"currency\", then let mxfdDefault be max(mnfd, cDigits); else if s\n // is \"percent\", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault\n // be max(mnfd, 3).\n var mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits) : s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3);\n\n // 29. Let mxfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"maximumFractionDigits\", mnfd, 20, and mxfdDefault.\n var mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);\n\n // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.\n internal['[[maximumFractionDigits]]'] = mxfd;\n\n // 31. Let mnsd be the result of calling the [[Get]] internal method of options\n // with argument \"minimumSignificantDigits\".\n var mnsd = options.minimumSignificantDigits;\n\n // 32. Let mxsd be the result of calling the [[Get]] internal method of options\n // with argument \"maximumSignificantDigits\".\n var mxsd = options.maximumSignificantDigits;\n\n // 33. If mnsd is not undefined or mxsd is not undefined, then:\n if (mnsd !== undefined || mxsd !== undefined) {\n // a. Let mnsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"minimumSignificantDigits\", 1, 21,\n // and 1.\n mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);\n\n // b. Let mxsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"maximumSignificantDigits\", mnsd,\n // 21, and 21.\n mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);\n\n // c. Set the [[minimumSignificantDigits]] internal property of numberFormat\n // to mnsd, and the [[maximumSignificantDigits]] internal property of\n // numberFormat to mxsd.\n internal['[[minimumSignificantDigits]]'] = mnsd;\n internal['[[maximumSignificantDigits]]'] = mxsd;\n }\n // 34. Let g be the result of calling the GetOption abstract operation with the\n // arguments options, \"useGrouping\", \"boolean\", undefined, and true.\n var g = GetOption(options, 'useGrouping', 'boolean', undefined, true);\n\n // 35. Set the [[useGrouping]] internal property of numberFormat to g.\n internal['[[useGrouping]]'] = g;\n\n // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 37. Let patterns be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"patterns\".\n var patterns = dataLocaleData.patterns;\n\n // 38. Assert: patterns is an object (see 11.2.3)\n\n // 39. Let stylePatterns be the result of calling the [[Get]] internal method of\n // patterns with argument s.\n var stylePatterns = patterns[s];\n\n // 40. Set the [[positivePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"positivePattern\".\n internal['[[positivePattern]]'] = stylePatterns.positivePattern;\n\n // 41. Set the [[negativePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"negativePattern\".\n internal['[[negativePattern]]'] = stylePatterns.negativePattern;\n\n // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to\n // true.\n internal['[[initializedNumberFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) numberFormat.format = GetFormatNumber.call(numberFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return numberFormat;\n}\n\nfunction CurrencyDigits(currency) {\n // When the CurrencyDigits abstract operation is called with an argument currency\n // (which must be an upper case String value), the following steps are taken:\n\n // 1. If the ISO 4217 currency and funds code list contains currency as an\n // alphabetic code, then return the minor unit value corresponding to the\n // currency from the list; else return 2.\n return currencyMinorUnits[currency] !== undefined ? currencyMinorUnits[currency] : 2;\n}\n\n/* 11.2.3 */internals.NumberFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.NumberFormat is called, the\n * following steps are taken:\n */\n/* 11.2.2 */\ndefineProperty(Intl.NumberFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * NumberFormat object.\n */\n/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatNumber\n});\n\nfunction GetFormatNumber() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this NumberFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 1, that takes the argument value and\n // performs the following steps:\n var F = function F(value) {\n // i. If value is not provided, then let value be undefined.\n // ii. Let x be ToNumber(value).\n // iii. Return the result of calling the FormatNumber abstract\n // operation (defined below) with arguments this and x.\n return FormatNumber(this, /* x = */Number(value));\n };\n\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts() {\n var value = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');\n\n var x = Number(value);\n return FormatNumberToParts(this, x);\n}\n\nObject.defineProperty(Intl.NumberFormat.prototype, 'formatToParts', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: formatToParts\n});\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumbertoparts]\n */\nfunction FormatNumberToParts(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be ArrayCreate(0).\n var result = [];\n // 3. Let n be 0.\n var n = 0;\n // 4. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Let O be ObjectCreate(%ObjectPrototype%).\n var O = {};\n // a. Perform ? CreateDataPropertyOrThrow(O, \"type\", part.[[type]]).\n O.type = part['[[type]]'];\n // a. Perform ? CreateDataPropertyOrThrow(O, \"value\", part.[[value]]).\n O.value = part['[[value]]'];\n // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).\n result[n] = O;\n // a. Increment n by 1.\n n += 1;\n }\n // 5. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-partitionnumberpattern]\n */\nfunction PartitionNumberPattern(numberFormat, x) {\n\n var internal = getInternalProperties(numberFormat),\n locale = internal['[[dataLocale]]'],\n nums = internal['[[numberingSystem]]'],\n data = internals.NumberFormat['[[localeData]]'][locale],\n ild = data.symbols[nums] || data.symbols.latn,\n pattern = void 0;\n\n // 1. If x is not NaN and x < 0, then:\n if (!isNaN(x) && x < 0) {\n // a. Let x be -x.\n x = -x;\n // a. Let pattern be the value of numberFormat.[[negativePattern]].\n pattern = internal['[[negativePattern]]'];\n }\n // 2. Else,\n else {\n // a. Let pattern be the value of numberFormat.[[positivePattern]].\n pattern = internal['[[positivePattern]]'];\n }\n // 3. Let result be a new empty List.\n var result = new List();\n // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, \"{\", 0).\n var beginIndex = pattern.indexOf('{', 0);\n // 5. Let endIndex be 0.\n var endIndex = 0;\n // 6. Let nextIndex be 0.\n var nextIndex = 0;\n // 7. Let length be the number of code units in pattern.\n var length = pattern.length;\n // 8. Repeat while beginIndex is an integer index into pattern:\n while (beginIndex > -1 && beginIndex < length) {\n // a. Set endIndex to Call(%StringProto_indexOf%, pattern, \"}\", beginIndex)\n endIndex = pattern.indexOf('}', beginIndex);\n // a. If endIndex = -1, throw new Error exception.\n if (endIndex === -1) throw new Error();\n // a. If beginIndex is greater than nextIndex, then:\n if (beginIndex > nextIndex) {\n // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.\n var literal = pattern.substring(nextIndex, beginIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // a. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // a. If p is equal \"number\", then:\n if (p === \"number\") {\n // i. If x is NaN,\n if (isNaN(x)) {\n // 1. Let n be an ILD String value indicating the NaN value.\n var n = ild.nan;\n // 2. Add new part record { [[type]]: \"nan\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });\n }\n // ii. Else if isFinite(x) is false,\n else if (!isFinite(x)) {\n // 1. Let n be an ILD String value indicating infinity.\n var _n = ild.infinity;\n // 2. Add new part record { [[type]]: \"infinity\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': _n });\n }\n // iii. Else,\n else {\n // 1. If the value of numberFormat.[[style]] is \"percent\" and isFinite(x), let x be 100 × x.\n if (internal['[[style]]'] === 'percent' && isFinite(x)) x *= 100;\n\n var _n2 = void 0;\n // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then\n if (hop.call(internal, '[[minimumSignificantDigits]]') && hop.call(internal, '[[maximumSignificantDigits]]')) {\n // a. Let n be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).\n _n2 = ToRawPrecision(x, internal['[[minimumSignificantDigits]]'], internal['[[maximumSignificantDigits]]']);\n }\n // 3. Else,\n else {\n // a. Let n be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).\n _n2 = ToRawFixed(x, internal['[[minimumIntegerDigits]]'], internal['[[minimumFractionDigits]]'], internal['[[maximumFractionDigits]]']);\n }\n // 4. If the value of the numberFormat.[[numberingSystem]] matches one of the values in the \"Numbering System\" column of Table 2 below, then\n if (numSys[nums]) {\n (function () {\n // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the \"Digits\" column of the matching row in Table 2.\n var digits = numSys[nums];\n // a. Replace each digit in n with the value of digits[digit].\n _n2 = String(_n2).replace(/\\d/g, function (digit) {\n return digits[digit];\n });\n })();\n }\n // 5. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.\n else _n2 = String(_n2); // ###TODO###\n\n var integer = void 0;\n var fraction = void 0;\n // 6. Let decimalSepIndex be Call(%StringProto_indexOf%, n, \".\", 0).\n var decimalSepIndex = _n2.indexOf('.', 0);\n // 7. If decimalSepIndex > 0, then:\n if (decimalSepIndex > 0) {\n // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.\n integer = _n2.substring(0, decimalSepIndex);\n // a. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.\n fraction = _n2.substring(decimalSepIndex + 1, decimalSepIndex.length);\n }\n // 8. Else:\n else {\n // a. Let integer be n.\n integer = _n2;\n // a. Let fraction be undefined.\n fraction = undefined;\n }\n // 9. If the value of the numberFormat.[[useGrouping]] is true,\n if (internal['[[useGrouping]]'] === true) {\n // a. Let groupSepSymbol be the ILND String representing the grouping separator.\n var groupSepSymbol = ild.group;\n // a. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.\n var groups = [];\n // ----> implementation:\n // Primary group represents the group closest to the decimal\n var pgSize = data.patterns.primaryGroupSize || 3;\n // Secondary group is every other group\n var sgSize = data.patterns.secondaryGroupSize || pgSize;\n // Group only if necessary\n if (integer.length > pgSize) {\n // Index of the primary grouping separator\n var end = integer.length - pgSize;\n // Starting index for our loop\n var idx = end % sgSize;\n var start = integer.slice(0, idx);\n if (start.length) arrPush.call(groups, start);\n // Loop to separate into secondary grouping digits\n while (idx < end) {\n arrPush.call(groups, integer.slice(idx, idx + sgSize));\n idx += sgSize;\n }\n // Add the primary grouping digits\n arrPush.call(groups, integer.slice(end));\n } else {\n arrPush.call(groups, integer);\n }\n // a. Assert: The number of elements in groups List is greater than 0.\n if (groups.length === 0) throw new Error();\n // a. Repeat, while groups List is not empty:\n while (groups.length) {\n // i. Remove the first element from groups and let integerGroup be the value of that element.\n var integerGroup = arrShift.call(groups);\n // ii. Add new part record { [[type]]: \"integer\", [[value]]: integerGroup } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });\n // iii. If groups List is not empty, then:\n if (groups.length) {\n // 1. Add new part record { [[type]]: \"group\", [[value]]: groupSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });\n }\n }\n }\n // 10. Else,\n else {\n // a. Add new part record { [[type]]: \"integer\", [[value]]: integer } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });\n }\n // 11. If fraction is not undefined, then:\n if (fraction !== undefined) {\n // a. Let decimalSepSymbol be the ILND String representing the decimal separator.\n var decimalSepSymbol = ild.decimal;\n // a. Add new part record { [[type]]: \"decimal\", [[value]]: decimalSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });\n // a. Add new part record { [[type]]: \"fraction\", [[value]]: fraction } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });\n }\n }\n }\n // a. Else if p is equal \"plusSign\", then:\n else if (p === \"plusSign\") {\n // i. Let plusSignSymbol be the ILND String representing the plus sign.\n var plusSignSymbol = ild.plusSign;\n // ii. Add new part record { [[type]]: \"plusSign\", [[value]]: plusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });\n }\n // a. Else if p is equal \"minusSign\", then:\n else if (p === \"minusSign\") {\n // i. Let minusSignSymbol be the ILND String representing the minus sign.\n var minusSignSymbol = ild.minusSign;\n // ii. Add new part record { [[type]]: \"minusSign\", [[value]]: minusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });\n }\n // a. Else if p is equal \"percentSign\" and numberFormat.[[style]] is \"percent\", then:\n else if (p === \"percentSign\" && internal['[[style]]'] === \"percent\") {\n // i. Let percentSignSymbol be the ILND String representing the percent sign.\n var percentSignSymbol = ild.percentSign;\n // ii. Add new part record { [[type]]: \"percentSign\", [[value]]: percentSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });\n }\n // a. Else if p is equal \"currency\" and numberFormat.[[style]] is \"currency\", then:\n else if (p === \"currency\" && internal['[[style]]'] === \"currency\") {\n // i. Let currency be the value of numberFormat.[[currency]].\n var currency = internal['[[currency]]'];\n\n var cd = void 0;\n\n // ii. If numberFormat.[[currencyDisplay]] is \"code\", then\n if (internal['[[currencyDisplay]]'] === \"code\") {\n // 1. Let cd be currency.\n cd = currency;\n }\n // iii. Else if numberFormat.[[currencyDisplay]] is \"symbol\", then\n else if (internal['[[currencyDisplay]]'] === \"symbol\") {\n // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.\n cd = data.currencies[currency] || currency;\n }\n // iv. Else if numberFormat.[[currencyDisplay]] is \"name\", then\n else if (internal['[[currencyDisplay]]'] === \"name\") {\n // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.\n cd = currency;\n }\n // v. Add new part record { [[type]]: \"currency\", [[value]]: cd } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });\n }\n // a. Else,\n else {\n // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.\n var _literal = pattern.substring(beginIndex, endIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal });\n }\n // a. Set nextIndex to endIndex + 1.\n nextIndex = endIndex + 1;\n // a. Set beginIndex to Call(%StringProto_indexOf%, pattern, \"{\", nextIndex)\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n // 9. If nextIndex is less than length, then:\n if (nextIndex < length) {\n // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.\n var _literal2 = pattern.substring(nextIndex, length);\n // a. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal2 });\n }\n // 10. Return result.\n return result;\n}\n\n/*\n * @spec[stasm/ecma402/number-format-to-parts/spec/numberformat.html]\n * @clause[sec-formatnumber]\n */\nfunction FormatNumber(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n var parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be an empty String.\n var result = '';\n // 3. For each part in parts, do:\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n // a. Set result to a String value produced by concatenating result and part.[[value]].\n result += part['[[value]]'];\n }\n // 4. Return result.\n return result;\n}\n\n/**\n * When the ToRawPrecision abstract operation is called with arguments x (which\n * must be a finite non-negative number), minPrecision, and maxPrecision (both\n * must be integers between 1 and 21) the following steps are taken:\n */\nfunction ToRawPrecision(x, minPrecision, maxPrecision) {\n // 1. Let p be maxPrecision.\n var p = maxPrecision;\n\n var m = void 0,\n e = void 0;\n\n // 2. If x = 0, then\n if (x === 0) {\n // a. Let m be the String consisting of p occurrences of the character \"0\".\n m = arrJoin.call(Array(p + 1), '0');\n // b. Let e be 0.\n e = 0;\n }\n // 3. Else\n else {\n // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the\n // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as\n // possible. If there are two such sets of e and n, pick the e and n for\n // which n × 10ᵉ⁻ᵖ⁺¹ is larger.\n e = log10Floor(Math.abs(x));\n\n // Easier to get to m from here\n var f = Math.round(Math.exp(Math.abs(e - p + 1) * Math.LN10));\n\n // b. Let m be the String consisting of the digits of the decimal\n // representation of n (in order, with no leading zeroes)\n m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));\n }\n\n // 4. If e ≥ p, then\n if (e >= p)\n // a. Return the concatenation of m and e-p+1 occurrences of the character \"0\".\n return m + arrJoin.call(Array(e - p + 1 + 1), '0');\n\n // 5. If e = p-1, then\n else if (e === p - 1)\n // a. Return m.\n return m;\n\n // 6. If e ≥ 0, then\n else if (e >= 0)\n // a. Let m be the concatenation of the first e+1 characters of m, the character\n // \".\", and the remaining p–(e+1) characters of m.\n m = m.slice(0, e + 1) + '.' + m.slice(e + 1);\n\n // 7. If e < 0, then\n else if (e < 0)\n // a. Let m be the concatenation of the String \"0.\", –(e+1) occurrences of the\n // character \"0\", and the string m.\n m = '0.' + arrJoin.call(Array(-(e + 1) + 1), '0') + m;\n\n // 8. If m contains the character \".\", and maxPrecision > minPrecision, then\n if (m.indexOf(\".\") >= 0 && maxPrecision > minPrecision) {\n // a. Let cut be maxPrecision – minPrecision.\n var cut = maxPrecision - minPrecision;\n\n // b. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.charAt(m.length - 1) === '0') {\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n\n // ii. Decrease cut by 1.\n cut--;\n }\n\n // c. If the last character of m is \".\", then\n if (m.charAt(m.length - 1) === '.')\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. Return m.\n return m;\n}\n\n/**\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-torawfixed]\n * When the ToRawFixed abstract operation is called with arguments x (which must\n * be a finite non-negative number), minInteger (which must be an integer between\n * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and\n * 20) the following steps are taken:\n */\nfunction ToRawFixed(x, minInteger, minFraction, maxFraction) {\n // 1. Let f be maxFraction.\n var f = maxFraction;\n // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.\n var n = Math.pow(10, f) * x; // diverging...\n // 3. If n = 0, let m be the String \"0\". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).\n var m = n === 0 ? \"0\" : n.toFixed(0); // divering...\n\n {\n // this diversion is needed to take into consideration big numbers, e.g.:\n // 1.2344501e+37 -> 12344501000000000000000000000000000000\n var idx = void 0;\n var exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;\n if (exp) {\n m = m.slice(0, idx).replace('.', '');\n m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');\n }\n }\n\n var int = void 0;\n // 4. If f ≠ 0, then\n if (f !== 0) {\n // a. Let k be the number of characters in m.\n var k = m.length;\n // a. If k ≤ f, then\n if (k <= f) {\n // i. Let z be the String consisting of f+1–k occurrences of the character \"0\".\n var z = arrJoin.call(Array(f + 1 - k + 1), '0');\n // ii. Let m be the concatenation of Strings z and m.\n m = z + m;\n // iii. Let k be f+1.\n k = f + 1;\n }\n // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.\n var a = m.substring(0, k - f),\n b = m.substring(k - f, m.length);\n // a. Let m be the concatenation of the three Strings a, \".\", and b.\n m = a + \".\" + b;\n // a. Let int be the number of characters in a.\n int = a.length;\n }\n // 5. Else, let int be the number of characters in m.\n else int = m.length;\n // 6. Let cut be maxFraction – minFraction.\n var cut = maxFraction - minFraction;\n // 7. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.slice(-1) === \"0\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n // a. Decrease cut by 1.\n cut--;\n }\n // 8. If the last character of m is \".\", then\n if (m.slice(-1) === \".\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. If int < minInteger, then\n if (int < minInteger) {\n // a. Let z be the String consisting of minInteger–int occurrences of the character \"0\".\n var _z = arrJoin.call(Array(minInteger - int + 1), '0');\n // a. Let m be the concatenation of Strings z and m.\n m = _z + m;\n }\n // 10. Return m.\n return m;\n}\n\n// Sect 11.3.2 Table 2, Numbering systems\n// ======================================\nvar numSys = {\n arab: [\"٠\", \"١\", \"٢\", \"٣\", \"٤\", \"٥\", \"٦\", \"٧\", \"٨\", \"٩\"],\n arabext: [\"۰\", \"۱\", \"۲\", \"۳\", \"۴\", \"۵\", \"۶\", \"۷\", \"۸\", \"۹\"],\n bali: [\"᭐\", \"᭑\", \"᭒\", \"᭓\", \"᭔\", \"᭕\", \"᭖\", \"᭗\", \"᭘\", \"᭙\"],\n beng: [\"০\", \"১\", \"২\", \"৩\", \"৪\", \"৫\", \"৬\", \"৭\", \"৮\", \"৯\"],\n deva: [\"०\", \"१\", \"२\", \"३\", \"४\", \"५\", \"६\", \"७\", \"८\", \"९\"],\n fullwide: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n gujr: [\"૦\", \"૧\", \"૨\", \"૩\", \"૪\", \"૫\", \"૬\", \"૭\", \"૮\", \"૯\"],\n guru: [\"੦\", \"੧\", \"੨\", \"੩\", \"੪\", \"੫\", \"੬\", \"੭\", \"੮\", \"੯\"],\n hanidec: [\"〇\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\", \"七\", \"八\", \"九\"],\n khmr: [\"០\", \"១\", \"២\", \"៣\", \"៤\", \"៥\", \"៦\", \"៧\", \"៨\", \"៩\"],\n knda: [\"೦\", \"೧\", \"೨\", \"೩\", \"೪\", \"೫\", \"೬\", \"೭\", \"೮\", \"೯\"],\n laoo: [\"໐\", \"໑\", \"໒\", \"໓\", \"໔\", \"໕\", \"໖\", \"໗\", \"໘\", \"໙\"],\n latn: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"],\n limb: [\"᥆\", \"᥇\", \"᥈\", \"᥉\", \"᥊\", \"᥋\", \"᥌\", \"᥍\", \"᥎\", \"᥏\"],\n mlym: [\"൦\", \"൧\", \"൨\", \"൩\", \"൪\", \"൫\", \"൬\", \"൭\", \"൮\", \"൯\"],\n mong: [\"᠐\", \"᠑\", \"᠒\", \"᠓\", \"᠔\", \"᠕\", \"᠖\", \"᠗\", \"᠘\", \"᠙\"],\n mymr: [\"၀\", \"၁\", \"၂\", \"၃\", \"၄\", \"၅\", \"၆\", \"၇\", \"၈\", \"၉\"],\n orya: [\"୦\", \"୧\", \"୨\", \"୩\", \"୪\", \"୫\", \"୬\", \"୭\", \"୮\", \"୯\"],\n tamldec: [\"௦\", \"௧\", \"௨\", \"௩\", \"௪\", \"௫\", \"௬\", \"௭\", \"௮\", \"௯\"],\n telu: [\"౦\", \"౧\", \"౨\", \"౩\", \"౪\", \"౫\", \"౬\", \"౭\", \"౮\", \"౯\"],\n thai: [\"๐\", \"๑\", \"๒\", \"๓\", \"๔\", \"๕\", \"๖\", \"๗\", \"๘\", \"๙\"],\n tibt: [\"༠\", \"༡\", \"༢\", \"༣\", \"༤\", \"༥\", \"༦\", \"༧\", \"༨\", \"༩\"]\n};\n\n/**\n * This function provides access to the locale and formatting options computed\n * during initialization of the object.\n *\n * The function returns a new object whose properties and attributes are set as\n * if constructed by an object literal assigning to each of the following\n * properties the value of the corresponding internal property of this\n * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,\n * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,\n * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and\n * useGrouping. Properties whose corresponding internal properties are not present\n * are not assigned.\n */\n/* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {\n configurable: true,\n writable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\n/* jslint esnext: true */\n\n// Match these datetime components in a CLDR pattern, except those in single quotes\nvar expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nvar expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n// Skip over patterns with these datetime components because we don't have data\n// to back them up:\n// timezone, weekday, amoung others\nvar unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string\n\nvar dtKeys = [\"era\", \"year\", \"month\", \"day\", \"weekday\", \"quarter\"];\nvar tmKeys = [\"hour\", \"minute\", \"second\", \"hour12\", \"timeZoneName\"];\n\nfunction isDateFormatOnly(obj) {\n for (var i = 0; i < tmKeys.length; i += 1) {\n if (obj.hasOwnProperty(tmKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isTimeFormatOnly(obj) {\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (obj.hasOwnProperty(dtKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {\n var o = { _: {} };\n for (var i = 0; i < dtKeys.length; i += 1) {\n if (dateFormatObj[dtKeys[i]]) {\n o[dtKeys[i]] = dateFormatObj[dtKeys[i]];\n }\n if (dateFormatObj._[dtKeys[i]]) {\n o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];\n }\n }\n for (var j = 0; j < tmKeys.length; j += 1) {\n if (timeFormatObj[tmKeys[j]]) {\n o[tmKeys[j]] = timeFormatObj[tmKeys[j]];\n }\n if (timeFormatObj._[tmKeys[j]]) {\n o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];\n }\n }\n return o;\n}\n\nfunction computeFinalPatterns(formatObj) {\n // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:\n // 'In patterns, two single quotes represents a literal single quote, either\n // inside or outside single quotes. Text within single quotes is not\n // interpreted in any way (except for two adjacent single quotes).'\n formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, function ($0, literal) {\n return literal ? literal : \"'\";\n });\n\n // pattern 12 is always the default. we can produce the 24 by removing {ampm}\n formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');\n return formatObj;\n}\n\nfunction expDTComponentsMeta($0, formatObj) {\n switch ($0.charAt(0)) {\n // --- Era\n case 'G':\n formatObj.era = ['short', 'short', 'short', 'long', 'narrow'][$0.length - 1];\n return '{era}';\n\n // --- Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';\n return '{year}';\n\n // --- Quarter (not supported in this polyfill)\n case 'Q':\n case 'q':\n formatObj.quarter = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{quarter}';\n\n // --- Month\n case 'M':\n case 'L':\n formatObj.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1];\n return '{month}';\n\n // --- Week (not supported in this polyfill)\n case 'w':\n // week of the year\n formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';\n return '{weekday}';\n case 'W':\n // week of the month\n formatObj.week = 'numeric';\n return '{weekday}';\n\n // --- Day\n case 'd':\n // day of the month\n formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';\n return '{day}';\n case 'D': // day of the year\n case 'F': // day of the week\n case 'g':\n // 1..n: Modified Julian day\n formatObj.day = 'numeric';\n return '{day}';\n\n // --- Week Day\n case 'E':\n // day of the week\n formatObj.weekday = ['short', 'short', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'e':\n // local day of the week\n formatObj.weekday = ['numeric', '2-digit', 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n case 'c':\n // stand alone local day of the week\n formatObj.weekday = ['numeric', undefined, 'short', 'long', 'narrow', 'short'][$0.length - 1];\n return '{weekday}';\n\n // --- Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B':\n // flexible day periods\n formatObj.hour12 = true;\n return '{ampm}';\n\n // --- Hour\n case 'h':\n case 'H':\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n case 'k':\n case 'K':\n formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n\n // --- Minute\n case 'm':\n formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';\n return '{minute}';\n\n // --- Second\n case 's':\n formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';\n return '{second}';\n case 'S':\n case 'A':\n formatObj.second = 'numeric';\n return '{second}';\n\n // --- Timezone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x':\n // 1, 2, 3, 4: The ISO8601 varios formats\n // this polyfill only supports much, for now, we are just doing something dummy\n formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n}\n\n/**\n * Converts the CLDR availableFormats into the objects and patterns required by\n * the ECMAScript Internationalization API specification.\n */\nfunction createDateTimeFormat(skeleton, pattern) {\n // we ignore certain patterns that are unsupported to avoid this expensive op.\n if (unwantedDTCs.test(pattern)) return undefined;\n\n var formatObj = {\n originalPattern: pattern,\n _: {}\n };\n\n // Replace the pattern string with the one required by the specification, whilst\n // at the same time evaluating it for the subsets and formats\n formatObj.extendedPattern = pattern.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj._);\n });\n\n // Match the skeleton string with the one required by the specification\n // this implementation is based on the Date Field Symbol Table:\n // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n // Note: we are adding extra data to the formatObject even though this polyfill\n // might not support it.\n skeleton.replace(expDTComponents, function ($0) {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj);\n });\n\n return computeFinalPatterns(formatObj);\n}\n\n/**\n * Processes DateTime formats from CLDR to an easier-to-parse format.\n * the result of this operation should be cached the first time a particular\n * calendar is analyzed.\n *\n * The specification requires we support at least the following subsets of\n * date/time components:\n *\n * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'\n * - 'weekday', 'year', 'month', 'day'\n * - 'year', 'month', 'day'\n * - 'year', 'month'\n * - 'month', 'day'\n * - 'hour', 'minute', 'second'\n * - 'hour', 'minute'\n *\n * We need to cherry pick at least these subsets from the CLDR data and convert\n * them into the pattern objects used in the ECMA-402 API.\n */\nfunction createDateTimeFormats(formats) {\n var availableFormats = formats.availableFormats;\n var timeFormats = formats.timeFormats;\n var dateFormats = formats.dateFormats;\n var result = [];\n var skeleton = void 0,\n pattern = void 0,\n computed = void 0,\n i = void 0,\n j = void 0;\n var timeRelatedFormats = [];\n var dateRelatedFormats = [];\n\n // Map available (custom) formats into a pattern for createDateTimeFormats\n for (skeleton in availableFormats) {\n if (availableFormats.hasOwnProperty(skeleton)) {\n pattern = availableFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n // in some cases, the format is only displaying date specific props\n // or time specific props, in which case we need to also produce the\n // combined formats.\n if (isDateFormatOnly(computed)) {\n dateRelatedFormats.push(computed);\n } else if (isTimeFormatOnly(computed)) {\n timeRelatedFormats.push(computed);\n }\n }\n }\n }\n\n // Map time formats into a pattern for createDateTimeFormats\n for (skeleton in timeFormats) {\n if (timeFormats.hasOwnProperty(skeleton)) {\n pattern = timeFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n timeRelatedFormats.push(computed);\n }\n }\n }\n\n // Map date formats into a pattern for createDateTimeFormats\n for (skeleton in dateFormats) {\n if (dateFormats.hasOwnProperty(skeleton)) {\n pattern = dateFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n dateRelatedFormats.push(computed);\n }\n }\n }\n\n // combine custom time and custom date formats when they are orthogonals to complete the\n // formats supported by CLDR.\n // This Algo is based on section \"Missing Skeleton Fields\" from:\n // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems\n for (i = 0; i < timeRelatedFormats.length; i += 1) {\n for (j = 0; j < dateRelatedFormats.length; j += 1) {\n if (dateRelatedFormats[j].month === 'long') {\n pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;\n } else if (dateRelatedFormats[j].month === 'short') {\n pattern = formats.medium;\n } else {\n pattern = formats.short;\n }\n computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);\n computed.originalPattern = pattern;\n computed.extendedPattern = pattern.replace('{0}', timeRelatedFormats[i].extendedPattern).replace('{1}', dateRelatedFormats[j].extendedPattern).replace(/^[,\\s]+|[,\\s]+$/gi, '');\n result.push(computeFinalPatterns(computed));\n }\n }\n\n return result;\n}\n\n// this represents the exceptions of the rule that are not covered by CLDR availableFormats\n// for single property configurations, they play no role when using multiple properties, and\n// those that are not in this table, are not exceptions or are not covered by the data we\n// provide.\nvar validSyntheticProps = {\n second: {\n numeric: 's',\n '2-digit': 'ss'\n },\n minute: {\n numeric: 'm',\n '2-digit': 'mm'\n },\n year: {\n numeric: 'y',\n '2-digit': 'yy'\n },\n day: {\n numeric: 'd',\n '2-digit': 'dd'\n },\n month: {\n numeric: 'L',\n '2-digit': 'LL',\n narrow: 'LLLLL',\n short: 'LLL',\n long: 'LLLL'\n },\n weekday: {\n narrow: 'ccccc',\n short: 'ccc',\n long: 'cccc'\n }\n};\n\nfunction generateSyntheticFormat(propName, propValue) {\n if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) {\n var _ref2;\n\n return _ref2 = {\n originalPattern: validSyntheticProps[propName][propValue],\n _: defineProperty$1({}, propName, propValue),\n extendedPattern: \"{\" + propName + \"}\"\n }, defineProperty$1(_ref2, propName, propValue), defineProperty$1(_ref2, \"pattern12\", \"{\" + propName + \"}\"), defineProperty$1(_ref2, \"pattern\", \"{\" + propName + \"}\"), _ref2;\n }\n}\n\n// An object map of date component keys, saves using a regex later\nvar dateWidths = objCreate(null, { narrow: {}, short: {}, long: {} });\n\n/**\n * Returns a string for a date component, resolved using multiple inheritance as specified\n * as specified in the Unicode Technical Standard 35.\n */\nfunction resolveDateString(data, ca, component, width, key) {\n // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:\n // 'In clearly specified instances, resources may inherit from within the same locale.\n // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'\n var obj = data[ca] && data[ca][component] ? data[ca][component] : data.gregory[component],\n\n\n // \"sideways\" inheritance resolves strings when a key doesn't exist\n alts = {\n narrow: ['short', 'long'],\n short: ['long', 'narrow'],\n long: ['short', 'narrow']\n },\n\n\n //\n resolved = hop.call(obj, width) ? obj[width] : hop.call(obj, alts[width][0]) ? obj[alts[width][0]] : obj[alts[width][1]];\n\n // `key` wouldn't be specified for components 'dayPeriods'\n return key !== null ? resolved[key] : resolved;\n}\n\n// Define the DateTimeFormat constructor internally so it cannot be tainted\nfunction DateTimeFormatConstructor() {\n var locales = arguments[0];\n var options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.DateTimeFormat(locales, options);\n }\n return InitializeDateTimeFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'DateTimeFormat', {\n configurable: true,\n writable: true,\n value: DateTimeFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(DateTimeFormatConstructor, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat\n * (which must be an object), locales, and options. It initializes dateTimeFormat as a\n * DateTimeFormat object.\n */\nfunction /* 12.1.1.1 */InitializeDateTimeFormat(dateTimeFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n var internal = getInternalProperties(dateTimeFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore();\n\n // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(dateTimeFormat, '__getInternalProperties', {\n value: function value() {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret) return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n var requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined below) with arguments options, \"any\", and \"date\".\n options = ToDateTimeOptions(options, 'any', 'date');\n\n // 5. Let opt be a new Record.\n var opt = new Record();\n\n // 6. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with arguments options, \"localeMatcher\", \"string\", a List\n // containing the two String values \"lookup\" and \"best fit\", and \"best fit\".\n var matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 7. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 8. Let DateTimeFormat be the standard built-in object that is the initial\n // value of Intl.DateTimeFormat.\n var DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need\n\n // 9. Let localeData be the value of the [[localeData]] internal property of\n // DateTimeFormat.\n var localeData = DateTimeFormat['[[localeData]]'];\n\n // 10. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of DateTimeFormat, and localeData.\n var r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales, opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 11. Set the [[locale]] internal property of dateTimeFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of\n // r.[[ca]].\n internal['[[calendar]]'] = r['[[ca]]'];\n\n // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of\n // r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n var dataLocale = r['[[dataLocale]]'];\n\n // 15. Let tz be the result of calling the [[Get]] internal method of options with\n // argument \"timeZone\".\n var tz = options.timeZone;\n\n // 16. If tz is not undefined, then\n if (tz !== undefined) {\n // a. Let tz be ToString(tz).\n // b. Convert tz to upper case as described in 6.1.\n // NOTE: If an implementation accepts additional time zone values, as permitted\n // under certain conditions by the Conformance clause, different casing\n // rules apply.\n tz = toLatinUpperCase(tz);\n\n // c. If tz is not \"UTC\", then throw a RangeError exception.\n // ###TODO: accept more time zones###\n if (tz !== 'UTC') throw new RangeError('timeZone is not supported.');\n }\n\n // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.\n internal['[[timeZone]]'] = tz;\n\n // 18. Let opt be a new Record.\n opt = new Record();\n\n // 19. For each row of Table 3, except the header row, do:\n for (var prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop)) continue;\n\n // 20. Let prop be the name given in the Property column of the row.\n // 21. Let value be the result of calling the GetOption abstract operation,\n // passing as argument options, the name given in the Property column of the\n // row, \"string\", a List containing the strings given in the Values column of\n // the row, and undefined.\n var value = GetOption(options, prop, 'string', dateTimeComponents[prop]);\n\n // 22. Set opt.[[]] to value.\n opt['[[' + prop + ']]'] = value;\n }\n\n // Assigned a value below\n var bestFormat = void 0;\n\n // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n var dataLocaleData = localeData[dataLocale];\n\n // 24. Let formats be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"formats\".\n // Note: we process the CLDR formats into the spec'd structure\n var formats = ToDateTimeFormats(dataLocaleData.formats);\n\n // 25. Let matcher be the result of calling the GetOption abstract operation with\n // arguments options, \"formatMatcher\", \"string\", a List containing the two String\n // values \"basic\" and \"best fit\", and \"best fit\".\n matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');\n\n // Optimization: caching the processed formats as a one time operation by\n // replacing the initial structure from localeData\n dataLocaleData.formats = formats;\n\n // 26. If matcher is \"basic\", then\n if (matcher === 'basic') {\n // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract\n // operation (defined below) with opt and formats.\n bestFormat = BasicFormatMatcher(opt, formats);\n\n // 28. Else\n } else {\n {\n // diverging\n var _hr = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n opt.hour12 = _hr === undefined ? dataLocaleData.hour12 : _hr;\n }\n // 29. Let bestFormat be the result of calling the BestFitFormatMatcher\n // abstract operation (defined below) with opt and formats.\n bestFormat = BestFitFormatMatcher(opt, formats);\n }\n\n // 30. For each row in Table 3, except the header row, do\n for (var _prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _prop)) continue;\n\n // a. Let prop be the name given in the Property column of the row.\n // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of\n // bestFormat with argument prop.\n // c. If pDesc is not undefined, then\n if (hop.call(bestFormat, _prop)) {\n // i. Let p be the result of calling the [[Get]] internal method of bestFormat\n // with argument prop.\n var p = bestFormat[_prop];\n {\n // diverging\n p = bestFormat._ && hop.call(bestFormat._, _prop) ? bestFormat._[_prop] : p;\n }\n\n // ii. Set the [[]] internal property of dateTimeFormat to p.\n internal['[[' + _prop + ']]'] = p;\n }\n }\n\n var pattern = void 0; // Assigned a value below\n\n // 31. Let hr12 be the result of calling the GetOption abstract operation with\n // arguments options, \"hour12\", \"boolean\", undefined, and undefined.\n var hr12 = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/);\n\n // 32. If dateTimeFormat has an internal property [[hour]], then\n if (internal['[[hour]]']) {\n // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]\n // internal method of dataLocaleData with argument \"hour12\".\n hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n\n // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.\n internal['[[hour12]]'] = hr12;\n\n // c. If hr12 is true, then\n if (hr12 === true) {\n // i. Let hourNo0 be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"hourNo0\".\n var hourNo0 = dataLocaleData.hourNo0;\n\n // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.\n internal['[[hourNo0]]'] = hourNo0;\n\n // iii. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern12\".\n pattern = bestFormat.pattern12;\n }\n\n // d. Else\n else\n // i. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n }\n\n // 33. Else\n else\n // a. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n\n // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.\n internal['[[pattern]]'] = pattern;\n\n // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to\n // true.\n internal['[[initializedDateTimeFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3) dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return dateTimeFormat;\n}\n\n/**\n * Several DateTimeFormat algorithms use values from the following table, which provides\n * property names and allowable values for the components of date and time formats:\n */\nvar dateTimeComponents = {\n weekday: [\"narrow\", \"short\", \"long\"],\n era: [\"narrow\", \"short\", \"long\"],\n year: [\"2-digit\", \"numeric\"],\n month: [\"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\"],\n day: [\"2-digit\", \"numeric\"],\n hour: [\"2-digit\", \"numeric\"],\n minute: [\"2-digit\", \"numeric\"],\n second: [\"2-digit\", \"numeric\"],\n timeZoneName: [\"short\", \"long\"]\n};\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeFormats(formats) {\n if (Object.prototype.toString.call(formats) === '[object Array]') {\n return formats;\n }\n return createDateTimeFormats(formats);\n}\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeOptions(options, required, defaults) {\n // 1. If options is undefined, then let options be null, else let options be\n // ToObject(options).\n if (options === undefined) options = null;else {\n // (#12) options needs to be a Record, but it also needs to inherit properties\n var opt2 = toObject(options);\n options = new Record();\n\n for (var k in opt2) {\n options[k] = opt2[k];\n }\n }\n\n // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.\n var create = objCreate;\n\n // 3. Let options be the result of calling the [[Call]] internal method of create with\n // undefined as the this value and an argument list containing the single item\n // options.\n options = create(options);\n\n // 4. Let needDefaults be true.\n var needDefaults = true;\n\n // 5. If required is \"date\" or \"any\", then\n if (required === 'date' || required === 'any') {\n // a. For each of the property names \"weekday\", \"year\", \"month\", \"day\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined) needDefaults = false;\n }\n\n // 6. If required is \"time\" or \"any\", then\n if (required === 'time' || required === 'any') {\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined) needDefaults = false;\n }\n\n // 7. If needDefaults is true and defaults is either \"date\" or \"all\", then\n if (needDefaults && (defaults === 'date' || defaults === 'all'))\n // a. For each of the property names \"year\", \"month\", \"day\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.year = options.month = options.day = 'numeric';\n\n // 8. If needDefaults is true and defaults is either \"time\" or \"all\", then\n if (needDefaults && (defaults === 'time' || defaults === 'all'))\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.hour = options.minute = options.second = 'numeric';\n\n // 9. Return options.\n return options;\n}\n\n/**\n * When the BasicFormatMatcher abstract operation is called with two arguments options and\n * formats, the following steps are taken:\n */\nfunction BasicFormatMatcher(options, formats) {\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta === 2) score -= longMorePenalty;\n\n // 6. Else if delta = 1, decrease score by shortMorePenalty.\n else if (delta === 1) score -= shortMorePenalty;\n\n // 7. Else if delta = -1, decrease score by shortLessPenalty.\n else if (delta === -1) score -= shortLessPenalty;\n\n // 8. Else if delta = -2, decrease score by longLessPenalty.\n else if (delta === -2) score -= longLessPenalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/**\n * When the BestFitFormatMatcher abstract operation is called with two arguments options\n * and formats, it performs implementation dependent steps, which should return a set of\n * component representations that a typical user of the selected locale would perceive as\n * at least as good as the one returned by BasicFormatMatcher.\n *\n * This polyfill defines the algorithm to be the same as BasicFormatMatcher,\n * with the addition of bonus points awarded where the requested format is of\n * the same data type as the potentially matching format.\n *\n * This algo relies on the concept of closest distance matching described here:\n * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n * Typically a “best match” is found using a closest distance match, such as:\n *\n * Symbols requesting a best choice for the locale are replaced.\n * j → one of {H, k, h, K}; C → one of {a, b, B}\n * -> Covered by cldr.js matching process\n *\n * For fields with symbols representing the same type (year, month, day, etc):\n * Most symbols have a small distance from each other.\n * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...\n * -> Covered by cldr.js matching process\n *\n * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.\n * MMM ≅ MMMM\n * MM ≅ M\n * Numeric and text fields are given a larger distance from each other.\n * MMM ≈ MM\n * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.\n * d ≋ D; ...\n * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).\n *\n *\n * For example,\n *\n * { month: 'numeric', day: 'numeric' }\n *\n * should match\n *\n * { month: '2-digit', day: '2-digit' }\n *\n * rather than\n *\n * { month: 'short', day: 'numeric' }\n *\n * This makes sense because a user requesting a formatted date with numeric parts would\n * not expect to see the returned format containing narrow, short or long part names\n */\nfunction BestFitFormatMatcher(options, formats) {\n /** Diverging: this block implements the hack for single property configuration, eg.:\n *\n * `new Intl.DateTimeFormat('en', {day: 'numeric'})`\n *\n * should produce a single digit with the day of the month. This is needed because\n * CLDR `availableFormats` data structure doesn't cover these cases.\n */\n {\n var optionsPropNames = [];\n for (var property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property)) continue;\n\n if (options['[[' + property + ']]'] !== undefined) {\n optionsPropNames.push(property);\n }\n }\n if (optionsPropNames.length === 1) {\n var _bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[[' + optionsPropNames[0] + ']]']);\n if (_bestFormat) {\n return _bestFormat;\n }\n }\n }\n\n // 1. Let removalPenalty be 120.\n var removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n var additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n var longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n var longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n var shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n var shortMorePenalty = 3;\n\n var patternPenalty = 2;\n\n var hour12Penalty = 1;\n\n // 7. Let bestScore be -Infinity.\n var bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n var bestFormat = void 0;\n\n // 9. Let i be 0.\n var i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n var len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n var format = formats[i];\n\n // b. Let score be 0.\n var score = 0;\n\n // c. For each property shown in Table 3:\n for (var _property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, _property)) continue;\n\n // i. Let optionsProp be options.[[]].\n var optionsProp = options['[[' + _property + ']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n var formatProp = hop.call(format, _property) ? format[_property] : undefined;\n\n // Diverging: using the default properties produced by the pattern/skeleton\n // to match it with user options, and apply a penalty\n var patternProp = hop.call(format._, _property) ? format._[_property] : undefined;\n if (optionsProp !== patternProp) {\n score -= patternPenalty;\n }\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n var optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n var formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n {\n // diverging from spec\n // When the bestFit argument is true, subtract additional penalty where data types are not the same\n if (formatPropIndex <= 1 && optionsPropIndex >= 2 || formatPropIndex >= 2 && optionsPropIndex <= 1) {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 0) score -= longMorePenalty;else if (delta < 0) score -= longLessPenalty;\n } else {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 1) score -= shortMorePenalty;else if (delta < -1) score -= shortLessPenalty;\n }\n }\n }\n }\n\n {\n // diverging to also take into consideration differences between 12 or 24 hours\n // which is special for the best fit only.\n if (format._.hour12 !== options.hour12) {\n score -= hour12Penalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/* 12.2.3 */internals.DateTimeFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['ca', 'nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the\n * following steps are taken:\n */\n/* 12.2.2 */\ndefineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n var regexpRestore = createRegExpRestore(),\n\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * DateTimeFormat object.\n */\n/* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatDateTime\n});\n\nfunction GetFormatDateTime() {\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this DateTimeFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 0, that takes the argument date and\n // performs the following steps:\n var F = function F() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n // i. If date is not provided or is undefined, then let x be the\n // result as if by the expression Date.now() where Date.now is\n // the standard built-in function defined in ES5, 15.9.4.4.\n // ii. Else let x be ToNumber(date).\n // iii. Return the result of calling the FormatDateTime abstract\n // operation (defined below) with arguments this and x.\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatDateTime(this, x);\n };\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n var bf = fnBind.call(F, this);\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts$1() {\n var date = arguments.length <= 0 || arguments[0] === undefined ? undefined : arguments[0];\n\n var internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');\n\n var x = date === undefined ? Date.now() : toNumber(date);\n return FormatToPartsDateTime(this, x);\n}\n\nObject.defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: formatToParts$1\n});\n\nfunction CreateDateTimeParts(dateTimeFormat, x) {\n // 1. If x is not a finite Number, then throw a RangeError exception.\n if (!isFinite(x)) throw new RangeError('Invalid valid date passed to format');\n\n var internal = dateTimeFormat.__getInternalProperties(secret);\n\n // Creating restore point for properties on the RegExp object... please wait\n /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this\n\n // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.\n var locale = internal['[[locale]]'];\n\n // 3. Let nf be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {useGrouping: false}) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n var nf = new Intl.NumberFormat([locale], { useGrouping: false });\n\n // 4. Let nf2 be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:\n // false}) where Intl.NumberFormat is the standard built-in constructor defined in\n // 11.1.3.\n var nf2 = new Intl.NumberFormat([locale], { minimumIntegerDigits: 2, useGrouping: false });\n\n // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined\n // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,\n // and the value of the [[timeZone]] internal property of dateTimeFormat.\n var tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);\n\n // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.\n var pattern = internal['[[pattern]]'];\n\n // 7.\n var result = new List();\n\n // 8.\n var index = 0;\n\n // 9.\n var beginIndex = pattern.indexOf('{');\n\n // 10.\n var endIndex = 0;\n\n // Need the locale minus any extensions\n var dataLocale = internal['[[dataLocale]]'];\n\n // Need the calendar data from CLDR\n var localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;\n var ca = internal['[[calendar]]'];\n\n // 11.\n while (beginIndex !== -1) {\n var fv = void 0;\n // a.\n endIndex = pattern.indexOf('}', beginIndex);\n // b.\n if (endIndex === -1) {\n throw new Error('Unclosed pattern');\n }\n // c.\n if (beginIndex > index) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(index, beginIndex)\n });\n }\n // d.\n var p = pattern.substring(beginIndex + 1, endIndex);\n // e.\n if (dateTimeComponents.hasOwnProperty(p)) {\n // i. Let f be the value of the [[

    ]] internal property of dateTimeFormat.\n var f = internal['[[' + p + ']]'];\n // ii. Let v be the value of tm.[[

    ]].\n var v = tm['[[' + p + ']]'];\n // iii. If p is \"year\" and v ≤ 0, then let v be 1 - v.\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n // iv. If p is \"month\", then increase v by 1.\n else if (p === 'month') {\n v++;\n }\n // v. If p is \"hour\" and the value of the [[hour12]] internal property of\n // dateTimeFormat is true, then\n else if (p === 'hour' && internal['[[hour12]]'] === true) {\n // 1. Let v be v modulo 12.\n v = v % 12;\n // 2. If v is 0 and the value of the [[hourNo0]] internal property of\n // dateTimeFormat is true, then let v be 12.\n if (v === 0 && internal['[[hourNo0]]'] === true) {\n v = 12;\n }\n }\n\n // vi. If f is \"numeric\", then\n if (f === 'numeric') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments nf and v.\n fv = FormatNumber(nf, v);\n }\n // vii. Else if f is \"2-digit\", then\n else if (f === '2-digit') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // with arguments nf2 and v.\n fv = FormatNumber(nf2, v);\n // 2. If the length of fv is greater than 2, let fv be the substring of fv\n // containing the last two characters.\n if (fv.length > 2) {\n fv = fv.slice(-2);\n }\n }\n // viii. Else if f is \"narrow\", \"short\", or \"long\", then let fv be a String\n // value representing f in the desired form; the String value depends upon\n // the implementation and the effective locale and calendar of\n // dateTimeFormat. If p is \"month\", then the String value may also depend\n // on whether dateTimeFormat has a [[day]] internal property. If p is\n // \"timeZoneName\", then the String value may also depend on the value of\n // the [[inDST]] field of tm.\n else if (f in dateWidths) {\n switch (p) {\n case 'month':\n fv = resolveDateString(localeData, ca, 'months', f, tm['[[' + p + ']]']);\n break;\n\n case 'weekday':\n try {\n fv = resolveDateString(localeData, ca, 'days', f, tm['[[' + p + ']]']);\n // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];\n } catch (e) {\n throw new Error('Could not find weekday data for locale ' + locale);\n }\n break;\n\n case 'timeZoneName':\n fv = ''; // ###TODO\n break;\n\n case 'era':\n try {\n fv = resolveDateString(localeData, ca, 'eras', f, tm['[[' + p + ']]']);\n } catch (e) {\n throw new Error('Could not find era data for locale ' + locale);\n }\n break;\n\n default:\n fv = tm['[[' + p + ']]'];\n }\n }\n // ix\n arrPush.call(result, {\n type: p,\n value: fv\n });\n // f.\n } else if (p === 'ampm') {\n // i.\n var _v = tm['[[hour]]'];\n // ii./iii.\n fv = resolveDateString(localeData, ca, 'dayPeriods', _v > 11 ? 'pm' : 'am', null);\n // iv.\n arrPush.call(result, {\n type: 'dayPeriod',\n value: fv\n });\n // g.\n } else {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(beginIndex, endIndex + 1)\n });\n }\n // h.\n index = endIndex + 1;\n // i.\n beginIndex = pattern.indexOf('{', index);\n }\n // 12.\n if (endIndex < pattern.length - 1) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substr(endIndex + 1)\n });\n }\n // 13.\n return result;\n}\n\n/**\n * When the FormatDateTime abstract operation is called with arguments dateTimeFormat\n * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number\n * value), it returns a String value representing x (interpreted as a time value as\n * specified in ES5, 15.9.1.1) according to the effective locale and the formatting\n * options of dateTimeFormat.\n */\nfunction FormatDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = '';\n\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result += part.value;\n }\n return result;\n}\n\nfunction FormatToPartsDateTime(dateTimeFormat, x) {\n var parts = CreateDateTimeParts(dateTimeFormat, x);\n var result = [];\n for (var i = 0; parts.length > i; i++) {\n var part = parts[i];\n result.push({\n type: part.type,\n value: part.value\n });\n }\n return result;\n}\n\n/**\n * When the ToLocalTime abstract operation is called with arguments date, calendar, and\n * timeZone, the following steps are taken:\n */\nfunction ToLocalTime(date, calendar, timeZone) {\n // 1. Apply calendrical calculations on date for the given calendar and time zone to\n // produce weekday, era, year, month, day, hour, minute, second, and inDST values.\n // The calculations should use best available information about the specified\n // calendar and time zone. If the calendar is \"gregory\", then the calculations must\n // match the algorithms specified in ES5, 15.9.1, except that calculations are not\n // bound by the restrictions on the use of best available information on time zones\n // for local time zone adjustment and daylight saving time adjustment imposed by\n // ES5, 15.9.1.7 and 15.9.1.8.\n // ###TODO###\n var d = new Date(date),\n m = 'get' + (timeZone || '');\n\n // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],\n // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding\n // calculated value.\n return new Record({\n '[[weekday]]': d[m + 'Day'](),\n '[[era]]': +(d[m + 'FullYear']() >= 0),\n '[[year]]': d[m + 'FullYear'](),\n '[[month]]': d[m + 'Month'](),\n '[[day]]': d[m + 'Date'](),\n '[[hour]]': d[m + 'Hours'](),\n '[[minute]]': d[m + 'Minutes'](),\n '[[second]]': d[m + 'Seconds'](),\n '[[inDST]]': false // ###TODO###\n });\n}\n\n/**\n * The function returns a new object whose properties and attributes are set as if\n * constructed by an object literal assigning to each of the following properties the\n * value of the corresponding internal property of this DateTimeFormat object (see 12.4):\n * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,\n * hour, minute, second, and timeZoneName. Properties whose corresponding internal\n * properties are not present are not assigned.\n */\n/* 12.3.3 */defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {\n writable: true,\n configurable: true,\n value: function value() {\n var prop = void 0,\n descs = new Record(),\n props = ['locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'],\n internal = this !== null && babelHelpers$1[\"typeof\"](this) === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');\n\n for (var i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n\nvar ls = Intl.__localeSensitiveProtos = {\n Number: {},\n Date: {}\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.2.1 */ls.Number.toLocaleString = function () {\n // Satisfy test 13.2.1_1\n if (Object.prototype.toString.call(this) !== '[object Number]') throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');\n\n // 1. Let x be this Number value (as defined in ES5, 15.7.4).\n // 2. If locales is not provided, then let locales be undefined.\n // 3. If options is not provided, then let options be undefined.\n // 4. Let numberFormat be the result of creating a new object as if by the\n // expression new Intl.NumberFormat(locales, options) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n // 5. Return the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments numberFormat and x.\n return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.3.1 */ls.Date.toLocaleString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"any\", and \"all\".\n options = ToDateTimeOptions(options, 'any', 'all');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleDateString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.2 */ls.Date.toLocaleDateString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0],\n\n\n // 4. If options is not provided, then let options be undefined.\n options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"date\", and \"date\".\n options = ToDateTimeOptions(options, 'date', 'date');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleTimeString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.3 */ls.Date.toLocaleTimeString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n var x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x)) return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n var locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n var options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"time\", and \"time\".\n options = ToDateTimeOptions(options, 'time', 'time');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n var dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\ndefineProperty(Intl, '__applyLocaleSensitivePrototypes', {\n writable: true,\n configurable: true,\n value: function value() {\n defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });\n // Need this here for IE 8, to avoid the _DontEnum_ bug\n defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });\n\n for (var k in ls.Date) {\n if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });\n }\n }\n});\n\n/**\n * Can't really ship a single script with data for hundreds of locales, so we provide\n * this __addLocaleData method as a means for the developer to add the data on an\n * as-needed basis\n */\ndefineProperty(Intl, '__addLocaleData', {\n value: function value(data) {\n if (!IsStructurallyValidLanguageTag(data.locale)) throw new Error(\"Object passed doesn't identify itself with a valid language tag\");\n\n addLocaleData(data, data.locale);\n }\n});\n\nfunction addLocaleData(data, tag) {\n // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present\n if (!data.number) throw new Error(\"Object passed doesn't contain locale data for Intl.NumberFormat\");\n\n var locale = void 0,\n locales = [tag],\n parts = tag.split('-');\n\n // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc\n if (parts.length > 2 && parts[1].length === 4) arrPush.call(locales, parts[0] + '-' + parts[2]);\n\n while (locale = arrShift.call(locales)) {\n // Add to NumberFormat internal properties as per 11.2.3\n arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);\n internals.NumberFormat['[[localeData]]'][locale] = data.number;\n\n // ...and DateTimeFormat internal properties as per 12.2.3\n if (data.date) {\n data.date.nu = data.number.nu;\n arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);\n internals.DateTimeFormat['[[localeData]]'][locale] = data.date;\n }\n }\n\n // If this is the first set of locale data added, make it the default\n if (defaultLocale === undefined) setDefaultLocale(tag);\n}\n\ndefineProperty(Intl, '__disableRegExpRestore', {\n value: function value() {\n internals.disableRegExpRestore = true;\n }\n});\n\nmodule.exports = Intl;","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar decode = decodeURIComponent;\nvar encode = encodeURIComponent;\nvar pairSplitRegExp = /; */;\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var pairs = str.split(pairSplitRegExp);\n var dec = opt.decode || decode;\n\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n continue;\n }\n\n var key = pair.substr(0, eq_idx).trim()\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n if (isNaN(maxAge)) throw new Error('maxAge should be a Number');\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (typeof opt.expires.toUTCString !== 'function') {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","// Console-polyfill. MIT license.\n// https://github.com/paulmillr/console-polyfill\n// Make it safe to do console.log() always.\n(function(global) {\n 'use strict';\n if (!global.console) {\n global.console = {};\n }\n var con = global.console;\n var prop, method;\n var dummy = function() {};\n var properties = ['memory'];\n var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = {};\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n // Using `this` for web workers & supports Browserify / Webpack.\n})(typeof window === 'undefined' ? this : window);\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = merge;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","export var QueryStatus;\n\n(function (QueryStatus) {\n QueryStatus[\"Idle\"] = \"idle\";\n QueryStatus[\"Loading\"] = \"loading\";\n QueryStatus[\"Error\"] = \"error\";\n QueryStatus[\"Success\"] = \"success\";\n})(QueryStatus || (QueryStatus = {}));","const en = require('./en.json');\n\n// TODO: Type this somehow\nexport const locales: any = {\n en,\n};\n","import React from 'react';\nimport { AppData } from 'common/types';\n\nexport const AppDataContext = React.createContext({\n pluginID: undefined,\n});\n","import React, { FC } from 'react';\nimport intl from 'react-intl-universal';\nimport { Button } from '@grafana/ui';\nimport { css } from 'emotion';\n\ntype DisabledProps = {\n toggle: Function;\n};\n\nexport const DisabledState: FC = ({ toggle }) => {\n const centered = css`\n align-items: center;\n justify-content: center;\n flex: 1;\n display: flex;\n height: 100%;\n `;\n\n return (\n

    \n \n
    \n );\n};\n","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { QueryStatus } from './types'; // TYPES\n\nexport var CancelledError = function CancelledError(silent) {\n this.silent = silent;\n}; // UTILS\n\nvar _uid = 0;\nexport function uid() {\n return _uid++;\n}\nexport var isServer = typeof window === 'undefined';\nexport function noop() {\n return undefined;\n}\nexport var Console = console || {\n error: noop,\n warn: noop,\n log: noop\n};\nexport function setConsole(c) {\n Console = c;\n}\nexport function functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\n\nfunction stableStringifyReplacer(_key, value) {\n if (typeof value === 'function') {\n throw new Error();\n }\n\n if (isPlainObject(value)) {\n return Object.keys(value).sort().reduce(function (result, key) {\n result[key] = value[key];\n return result;\n }, {});\n }\n\n return value;\n}\n\nexport function stableStringify(value) {\n return JSON.stringify(value, stableStringifyReplacer);\n}\nexport function deepIncludes(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a === 'object') {\n return !Object.keys(b).some(function (key) {\n return !deepIncludes(a[key], b[key]);\n });\n }\n\n return false;\n}\nexport function isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nexport function isDocumentVisible() {\n // document global can be unavailable in react native\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n}\nexport function isOnline() {\n return navigator.onLine === undefined || navigator.onLine;\n}\nexport function getQueryArgs(arg1, arg2, arg3, arg4) {\n var queryKey;\n var queryFn;\n var config;\n var options;\n\n if (isPlainObject(arg1)) {\n queryKey = arg1.queryKey;\n queryFn = arg1.queryFn;\n config = arg1.config;\n options = arg2;\n } else if (isPlainObject(arg2)) {\n queryKey = arg1;\n config = arg2;\n options = arg3;\n } else {\n queryKey = arg1;\n queryFn = arg2;\n config = arg3;\n options = arg4;\n }\n\n config = config || {};\n\n if (queryFn) {\n config = _extends({}, config, {\n queryFn: queryFn\n });\n }\n\n return [queryKey, config, options];\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nexport function replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n var array = Array.isArray(a) && Array.isArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n var aSize = array ? a.length : Object.keys(a).length;\n var bItems = array ? b : Object.keys(b);\n var bSize = bItems.length;\n var copy = array ? [] : {};\n var equalItems = 0;\n\n for (var i = 0; i < bSize; i++) {\n var key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nexport function isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n var ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n var prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isCancelable(value) {\n return typeof (value == null ? void 0 : value.cancel) === 'function';\n}\nexport function isError(value) {\n return value instanceof Error;\n}\nexport function isCancelledError(value) {\n return value instanceof CancelledError;\n}\nexport function sleep(timeout) {\n return new Promise(function (resolve) {\n setTimeout(resolve, timeout);\n });\n}\nexport function getStatusProps(status) {\n return {\n status: status,\n isLoading: status === QueryStatus.Loading,\n isSuccess: status === QueryStatus.Success,\n isError: status === QueryStatus.Error,\n isIdle: status === QueryStatus.Idle\n };\n}\nexport function createSetHandler(fn) {\n var removePreviousHandler;\n return function (callback) {\n // Unsub the old handler\n if (removePreviousHandler) {\n removePreviousHandler();\n } // Sub the new handler\n\n\n removePreviousHandler = callback(fn);\n };\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nexport function scheduleMicrotask(callback) {\n Promise.resolve().then(callback).catch(function (error) {\n return setTimeout(function () {\n throw error;\n });\n });\n}\n\n// Default to a dummy \"batch\" implementation that just runs the callback\nvar batchedUpdates = function batchedUpdates(callback) {\n callback();\n}; // Allow injecting another batching function later\n\n\nexport function setBatchedUpdates(fn) {\n batchedUpdates = fn;\n} // Supply a getter just to skip dealing with ESM bindings\n\nexport function getBatchedUpdates() {\n return batchedUpdates;\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { stableStringify } from './utils';\n// CONFIG\nexport var defaultQueryKeySerializerFn = function defaultQueryKeySerializerFn(queryKey) {\n try {\n var arrayQueryKey = Array.isArray(queryKey) ? queryKey : [queryKey];\n var queryHash = stableStringify(arrayQueryKey);\n arrayQueryKey = JSON.parse(queryHash);\n return [queryHash, arrayQueryKey];\n } catch (_unused) {\n throw new Error('A valid query key is required!');\n }\n};\n/**\n * Config merging strategy\n *\n * When using hooks the config will be merged in the following order:\n *\n * 1. These defaults.\n * 2. Defaults from the hook query cache.\n * 3. Combined defaults from any config providers in the tree.\n * 4. Query/mutation config provided to the hook.\n *\n * When using a query cache directly the config will be merged in the following order:\n *\n * 1. These defaults.\n * 2. Defaults from the query cache.\n * 3. Query/mutation config provided to the query cache method.\n */\n\nexport var DEFAULT_CONFIG = {\n queries: {\n cacheTime: 5 * 60 * 1000,\n enabled: true,\n notifyOnStatusChange: true,\n queryFn: function queryFn() {\n return Promise.reject();\n },\n queryKeySerializerFn: defaultQueryKeySerializerFn,\n refetchOnMount: true,\n refetchOnReconnect: true,\n refetchOnWindowFocus: true,\n retry: 3,\n retryDelay: function retryDelay(attemptIndex) {\n return Math.min(1000 * Math.pow(2, attemptIndex), 30000);\n },\n staleTime: 0,\n structuralSharing: true\n }\n};\nexport function getDefaultReactQueryConfig() {\n return {\n queries: _extends({}, DEFAULT_CONFIG.queries),\n mutations: _extends({}, DEFAULT_CONFIG.mutations)\n };\n}\nexport function mergeReactQueryConfigs(a, b) {\n return {\n shared: _extends({}, a.shared, b.shared),\n queries: _extends({}, a.queries, b.queries),\n mutations: _extends({}, a.mutations, b.mutations)\n };\n}\nexport function getResolvedQueryConfig(queryCache, queryKey, contextConfig, config) {\n var queryCacheConfig = queryCache.getDefaultConfig();\n\n var resolvedConfig = _extends({}, DEFAULT_CONFIG.queries, queryCacheConfig == null ? void 0 : queryCacheConfig.shared, queryCacheConfig == null ? void 0 : queryCacheConfig.queries, contextConfig == null ? void 0 : contextConfig.shared, contextConfig == null ? void 0 : contextConfig.queries, config);\n\n var result = resolvedConfig.queryKeySerializerFn(queryKey);\n resolvedConfig.queryCache = queryCache;\n resolvedConfig.queryHash = result[0];\n resolvedConfig.queryKey = result[1];\n return resolvedConfig;\n}\nexport function isResolvedQueryConfig(config) {\n return Boolean(config.queryHash);\n}\nexport function getResolvedMutationConfig(queryCache, contextConfig, config) {\n var queryCacheConfig = queryCache.getDefaultConfig();\n return _extends({}, DEFAULT_CONFIG.mutations, queryCacheConfig == null ? void 0 : queryCacheConfig.shared, queryCacheConfig == null ? void 0 : queryCacheConfig.mutations, contextConfig == null ? void 0 : contextConfig.shared, contextConfig == null ? void 0 : contextConfig.mutations, config);\n}","import { getBatchedUpdates, scheduleMicrotask } from './utils'; // TYPES\n\n// CLASS\nexport var NotifyManager = /*#__PURE__*/function () {\n function NotifyManager() {\n this.queue = [];\n this.transactions = 0;\n }\n\n var _proto = NotifyManager.prototype;\n\n _proto.batch = function batch(callback) {\n this.transactions++;\n var result = callback();\n this.transactions--;\n\n if (!this.transactions) {\n this.flush();\n }\n\n return result;\n };\n\n _proto.schedule = function schedule(notify) {\n if (this.transactions) {\n this.queue.push(notify);\n } else {\n scheduleMicrotask(function () {\n notify();\n });\n }\n };\n\n _proto.flush = function flush() {\n var queue = this.queue;\n this.queue = [];\n\n if (queue.length) {\n scheduleMicrotask(function () {\n var batchedUpdates = getBatchedUpdates();\n batchedUpdates(function () {\n queue.forEach(function (notify) {\n notify();\n });\n });\n });\n }\n };\n\n return NotifyManager;\n}(); // SINGLETON\n\nexport var notifyManager = new NotifyManager();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { getStatusProps, isDocumentVisible, isServer, isValidTimeout, noop } from './utils';\nimport { notifyManager } from './notifyManager';\nimport { QueryStatus } from './types';\nimport { DEFAULT_CONFIG, isResolvedQueryConfig } from './config';\nexport var QueryObserver = /*#__PURE__*/function () {\n function QueryObserver(config) {\n this.config = config;\n this.isStale = true;\n this.initialUpdateCount = 0; // Bind exposed methods\n\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n this.fetchMore = this.fetchMore.bind(this);\n this.unsubscribe = this.unsubscribe.bind(this); // Subscribe to the query\n\n this.updateQuery();\n }\n\n var _proto = QueryObserver.prototype;\n\n _proto.subscribe = function subscribe(listener) {\n this.listener = listener || noop;\n this.currentQuery.subscribeObserver(this);\n\n if (this.config.enabled && (this.config.forceFetchOnMount || this.config.refetchOnMount === 'always')) {\n this.fetch();\n } else {\n this.optionalFetch();\n }\n\n this.updateTimers();\n return this.unsubscribe;\n };\n\n _proto.unsubscribe = function unsubscribe() {\n this.listener = undefined;\n this.clearTimers();\n this.currentQuery.unsubscribeObserver(this);\n };\n\n _proto.updateConfig = function updateConfig(config) {\n var prevConfig = this.config;\n var prevQuery = this.currentQuery;\n this.config = isResolvedQueryConfig(config) ? config : this.config.queryCache.getResolvedQueryConfig(this.config.queryKey, config);\n this.updateQuery(); // Take no further actions if there is no subscriber\n\n if (!this.listener) {\n return;\n } // If we subscribed to a new query, optionally fetch and update refetch\n\n\n if (this.currentQuery !== prevQuery) {\n this.optionalFetch();\n this.updateTimers();\n return;\n } // Optionally fetch if the query became enabled\n\n\n if (config.enabled && !prevConfig.enabled) {\n this.optionalFetch();\n } // Update stale interval if needed\n\n\n if (config.enabled !== prevConfig.enabled || config.staleTime !== prevConfig.staleTime) {\n this.updateStaleTimeout();\n } // Update refetch interval if needed\n\n\n if (config.enabled !== prevConfig.enabled || config.refetchInterval !== prevConfig.refetchInterval) {\n this.updateRefetchInterval();\n }\n };\n\n _proto.getCurrentQuery = function getCurrentQuery() {\n return this.currentQuery;\n };\n\n _proto.getCurrentResult = function getCurrentResult() {\n return this.currentResult;\n }\n /**\n * @deprecated\n */\n ;\n\n _proto.clear = function clear() {\n this.remove();\n };\n\n _proto.remove = function remove() {\n this.currentQuery.remove();\n };\n\n _proto.refetch = function refetch(options) {\n return this.currentQuery.refetch(options, this.config);\n };\n\n _proto.fetchMore = function fetchMore(fetchMoreVariable, options) {\n return this.currentQuery.fetchMore(fetchMoreVariable, options, this.config).catch(noop);\n };\n\n _proto.fetch = function fetch() {\n var _DEFAULT_CONFIG$queri;\n\n // Never try to fetch if no query function has been set\n if (this.config.queryFn === ((_DEFAULT_CONFIG$queri = DEFAULT_CONFIG.queries) == null ? void 0 : _DEFAULT_CONFIG$queri.queryFn)) {\n return Promise.resolve(this.currentResult.data);\n }\n\n return this.currentQuery.fetch(undefined, this.config).catch(noop);\n };\n\n _proto.optionalFetch = function optionalFetch() {\n if (this.config.enabled && // Only fetch if enabled\n this.isStale && // Only fetch if stale\n !(this.config.suspense && this.currentResult.isFetched) && ( // Don't refetch if in suspense mode and the data is already fetched\n this.config.refetchOnMount || this.currentQuery.observers.length === 1)) {\n this.fetch();\n }\n };\n\n _proto.updateStaleTimeout = function updateStaleTimeout() {\n var _this = this;\n\n if (isServer) {\n return;\n }\n\n this.clearStaleTimeout();\n\n if (this.isStale || !isValidTimeout(this.config.staleTime)) {\n return;\n }\n\n var timeElapsed = Date.now() - this.currentResult.updatedAt;\n var timeUntilStale = this.config.staleTime - timeElapsed + 1;\n var timeout = Math.max(timeUntilStale, 0);\n this.staleTimeoutId = setTimeout(function () {\n if (!_this.isStale) {\n _this.isStale = true;\n\n _this.updateResult();\n\n _this.notify({\n listener: true,\n globalListeners: true\n });\n }\n }, timeout);\n };\n\n _proto.updateRefetchInterval = function updateRefetchInterval() {\n var _this2 = this;\n\n if (isServer) {\n return;\n }\n\n this.clearRefetchInterval();\n\n if (!this.config.enabled || !isValidTimeout(this.config.refetchInterval)) {\n return;\n }\n\n this.refetchIntervalId = setInterval(function () {\n if (_this2.config.refetchIntervalInBackground || isDocumentVisible()) {\n _this2.fetch();\n }\n }, this.config.refetchInterval);\n };\n\n _proto.updateTimers = function updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval();\n };\n\n _proto.clearTimers = function clearTimers() {\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n };\n\n _proto.clearStaleTimeout = function clearStaleTimeout() {\n if (this.staleTimeoutId) {\n clearInterval(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n }\n };\n\n _proto.clearRefetchInterval = function clearRefetchInterval() {\n if (this.refetchIntervalId) {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n }\n };\n\n _proto.updateResult = function updateResult() {\n var _this$previousQueryRe;\n\n var state = this.currentQuery.state;\n var data = state.data,\n status = state.status,\n updatedAt = state.updatedAt;\n var isPreviousData = false;\n var isPlaceholderData = false; // Keep previous data if needed\n\n if (this.config.keepPreviousData && state.isInitialData && ((_this$previousQueryRe = this.previousQueryResult) == null ? void 0 : _this$previousQueryRe.isSuccess)) {\n data = this.previousQueryResult.data;\n updatedAt = this.previousQueryResult.updatedAt;\n status = this.previousQueryResult.status;\n isPreviousData = true;\n }\n\n if (status === 'loading' && this.config.placeholderData) {\n var placeholderData = typeof this.config.placeholderData === 'function' ? this.config.placeholderData() : this.config.placeholderData;\n\n if (typeof placeholderData !== 'undefined') {\n status = QueryStatus.Success;\n data = placeholderData;\n isPlaceholderData = true;\n }\n }\n\n this.currentResult = _extends({}, getStatusProps(status), {\n canFetchMore: state.canFetchMore,\n clear: this.remove,\n data: data,\n error: state.error,\n failureCount: state.failureCount,\n fetchMore: this.fetchMore,\n isFetched: state.updateCount > 0,\n isFetchedAfterMount: state.updateCount > this.initialUpdateCount,\n isFetching: state.isFetching,\n isFetchingMore: state.isFetchingMore,\n isInitialData: state.isInitialData,\n isPreviousData: isPreviousData,\n isPlaceholderData: isPlaceholderData,\n isStale: this.isStale,\n refetch: this.refetch,\n remove: this.remove,\n updatedAt: updatedAt\n });\n };\n\n _proto.updateQuery = function updateQuery() {\n var config = this.config;\n var prevQuery = this.currentQuery;\n var query = config.queryCache.getQueryByHash(config.queryHash);\n\n if (!query) {\n query = config.queryCache.createQuery(config);\n }\n\n if (query === prevQuery) {\n return;\n }\n\n this.previousQueryResult = this.currentResult;\n this.currentQuery = query;\n this.initialUpdateCount = query.state.updateCount; // Update stale state on query switch\n\n if (query.state.isInitialData) {\n if (config.keepPreviousData && prevQuery) {\n this.isStale = true;\n } else if (typeof config.initialStale === 'function') {\n this.isStale = config.initialStale();\n } else if (typeof config.initialStale === 'boolean') {\n this.isStale = config.initialStale;\n } else {\n this.isStale = typeof query.state.data === 'undefined';\n }\n } else {\n this.isStale = query.isStaleByTime(config.staleTime);\n }\n\n this.updateResult();\n\n if (this.listener) {\n prevQuery == null ? void 0 : prevQuery.unsubscribeObserver(this);\n this.currentQuery.subscribeObserver(this);\n }\n };\n\n _proto.onQueryUpdate = function onQueryUpdate(action) {\n var config = this.config;\n var type = action.type; // Update stale state on success, error or invalidation\n\n if (type === 2 || type === 3 || type === 4) {\n this.isStale = this.currentQuery.isStaleByTime(config.staleTime);\n } // Store current result and get new result\n\n\n var prevResult = this.currentResult;\n this.updateResult();\n var currentResult = this.currentResult; // Update timers on success, error or invalidation\n\n if (type === 2 || type === 3 || type === 4) {\n this.updateTimers();\n } // Do not notify if the query was invalidated but the stale state did not changed\n\n\n if (type === 4 && currentResult.isStale === prevResult.isStale) {\n return;\n } // Determine which callbacks to trigger\n\n\n var notifyOptions = {};\n\n if (type === 2) {\n notifyOptions.onSuccess = true;\n } else if (type === 3) {\n notifyOptions.onError = true;\n }\n\n if ( // Always notify if notifyOnStatusChange is set\n config.notifyOnStatusChange || // Otherwise only notify on data or error change\n currentResult.data !== prevResult.data || currentResult.error !== prevResult.error) {\n notifyOptions.listener = true;\n }\n\n this.notify(notifyOptions);\n };\n\n _proto.notify = function notify(options) {\n var config = this.config,\n currentResult = this.currentResult,\n currentQuery = this.currentQuery,\n listener = this.listener;\n var onSuccess = config.onSuccess,\n onSettled = config.onSettled,\n onError = config.onError;\n notifyManager.batch(function () {\n // First trigger the configuration callbacks\n if (options.onSuccess) {\n if (onSuccess) {\n notifyManager.schedule(function () {\n onSuccess(currentResult.data);\n });\n }\n\n if (onSettled) {\n notifyManager.schedule(function () {\n onSettled(currentResult.data, null);\n });\n }\n } else if (options.onError) {\n if (onError) {\n notifyManager.schedule(function () {\n onError(currentResult.error);\n });\n }\n\n if (onSettled) {\n notifyManager.schedule(function () {\n onSettled(undefined, currentResult.error);\n });\n }\n } // Then trigger the listener\n\n\n if (options.listener && listener) {\n notifyManager.schedule(function () {\n listener(currentResult);\n });\n } // Then the global listeners\n\n\n if (options.globalListeners) {\n config.queryCache.notifyGlobalListeners(currentQuery);\n }\n });\n };\n\n return QueryObserver;\n}();","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { CancelledError, Console, functionalUpdate, isCancelable, isCancelledError, isDocumentVisible, isOnline, isServer, isValidTimeout, noop, replaceEqualDeep, sleep } from './utils';\nimport { QueryStatus } from './types';\nimport { QueryObserver } from './queryObserver';\nimport { notifyManager } from './notifyManager'; // TYPES\n\nfunction _empty() {}\n\nvar ActionType = {\n Failed: 0,\n Fetch: 1,\n Success: 2,\n Error: 3,\n Invalidate: 4\n};\n\n// CLASS\nfunction _awaitIgnored(value, direct) {\n if (!direct) {\n return value && value.then ? value.then(_empty) : Promise.resolve();\n }\n}\n\nfunction _invoke(body, then) {\n var result = body();\n\n if (result && result.then) {\n return result.then(then);\n }\n\n return then(result);\n}\n\nfunction _await(value, then, direct) {\n if (direct) {\n return then ? then(value) : value;\n }\n\n if (!value || !value.then) {\n value = Promise.resolve(value);\n }\n\n return then ? value.then(then) : value;\n}\n\nfunction _catch(body, recover) {\n try {\n var result = body();\n } catch (e) {\n return recover(e);\n }\n\n if (result && result.then) {\n return result.then(void 0, recover);\n }\n\n return result;\n}\n\nfunction _async(f) {\n return function () {\n for (var args = [], i = 0; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n\n try {\n return Promise.resolve(f.apply(this, args));\n } catch (e) {\n return Promise.reject(e);\n }\n };\n}\n\nexport var Query = /*#__PURE__*/function () {\n function Query(config) {\n this.config = config;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.queryCache = config.queryCache;\n this.cacheTime = config.cacheTime;\n this.observers = [];\n this.state = getDefaultState(config);\n this.scheduleGc();\n }\n\n var _proto = Query.prototype;\n\n _proto.updateConfig = function updateConfig(config) {\n this.config = config;\n this.cacheTime = Math.max(this.cacheTime, config.cacheTime);\n };\n\n _proto.dispatch = function dispatch(action) {\n var _this = this;\n\n this.state = queryReducer(this.state, action);\n notifyManager.batch(function () {\n _this.observers.forEach(function (observer) {\n observer.onQueryUpdate(action);\n });\n\n _this.queryCache.notifyGlobalListeners(_this);\n });\n };\n\n _proto.scheduleGc = function scheduleGc() {\n var _this2 = this;\n\n if (isServer) {\n return;\n }\n\n this.clearGcTimeout();\n\n if (this.observers.length > 0 || !isValidTimeout(this.cacheTime)) {\n return;\n }\n\n this.gcTimeout = setTimeout(function () {\n _this2.remove();\n }, this.cacheTime);\n };\n\n _proto.cancel = function cancel(silent) {\n var promise = this.promise;\n\n if (promise && this.cancelFetch) {\n this.cancelFetch(silent);\n return promise.then(noop).catch(noop);\n }\n\n return Promise.resolve(undefined);\n };\n\n _proto.continue = function _continue() {\n var _this$continueFetch;\n\n (_this$continueFetch = this.continueFetch) == null ? void 0 : _this$continueFetch.call(this);\n };\n\n _proto.clearTimersObservers = function clearTimersObservers() {\n this.observers.forEach(function (observer) {\n observer.clearTimers();\n });\n };\n\n _proto.clearGcTimeout = function clearGcTimeout() {\n if (this.gcTimeout) {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n }\n };\n\n _proto.setData = function setData(updater, options) {\n var _this$config$isDataEq, _this$config;\n\n var prevData = this.state.data; // Get the new data\n\n var data = functionalUpdate(updater, prevData); // Structurally share data between prev and new data if needed\n\n if (this.config.structuralSharing) {\n data = replaceEqualDeep(prevData, data);\n } // Use prev data if an isDataEqual function is defined and returns `true`\n\n\n if ((_this$config$isDataEq = (_this$config = this.config).isDataEqual) == null ? void 0 : _this$config$isDataEq.call(_this$config, prevData, data)) {\n data = prevData;\n } // Try to determine if more data can be fetched\n\n\n var canFetchMore = hasMorePages(this.config, data); // Set data and mark it as cached\n\n this.dispatch({\n type: ActionType.Success,\n data: data,\n canFetchMore: canFetchMore,\n updatedAt: options == null ? void 0 : options.updatedAt\n });\n }\n /**\n * @deprecated\n */\n ;\n\n _proto.clear = function clear() {\n Console.warn('react-query: clear() has been deprecated, please use remove() instead');\n this.remove();\n };\n\n _proto.remove = function remove() {\n this.queryCache.removeQuery(this);\n };\n\n _proto.destroy = function destroy() {\n this.clearGcTimeout();\n this.clearTimersObservers();\n this.cancel();\n };\n\n _proto.isActive = function isActive() {\n return this.observers.some(function (observer) {\n return observer.config.enabled;\n });\n };\n\n _proto.isStale = function isStale() {\n return this.state.isInvalidated || this.state.status !== QueryStatus.Success || this.observers.some(function (observer) {\n return observer.getCurrentResult().isStale;\n });\n };\n\n _proto.isStaleByTime = function isStaleByTime(staleTime) {\n if (staleTime === void 0) {\n staleTime = 0;\n }\n\n return this.state.isInvalidated || this.state.status !== QueryStatus.Success || this.state.updatedAt + staleTime <= Date.now();\n };\n\n _proto.onInteraction = function onInteraction(type) {\n // Execute the first observer which is enabled,\n // stale and wants to refetch on this interaction.\n var staleObserver = this.observers.find(function (observer) {\n var config = observer.config;\n\n var _observer$getCurrentR = observer.getCurrentResult(),\n isStale = _observer$getCurrentR.isStale;\n\n return config.enabled && (type === 'focus' && (config.refetchOnWindowFocus === 'always' || config.refetchOnWindowFocus && isStale) || type === 'online' && (config.refetchOnReconnect === 'always' || config.refetchOnReconnect && isStale));\n });\n\n if (staleObserver) {\n staleObserver.fetch();\n } // Continue any paused fetch\n\n\n this.continue();\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.subscribe = function subscribe(listener) {\n var observer = new QueryObserver(this.config);\n observer.subscribe(listener);\n return observer;\n };\n\n _proto.subscribeObserver = function subscribeObserver(observer) {\n this.observers.push(observer); // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n };\n\n _proto.unsubscribeObserver = function unsubscribeObserver(observer) {\n this.observers = this.observers.filter(function (x) {\n return x !== observer;\n });\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.isTransportCancelable) {\n this.cancel();\n }\n\n this.scheduleGc();\n }\n };\n\n _proto.invalidate = function invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: ActionType.Invalidate\n });\n }\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.refetch = function refetch(options, config) {\n var promise = this.fetch(undefined, config);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n /**\n * @deprectated\n */\n ;\n\n _proto.fetchMore = function fetchMore(fetchMoreVariable, options, config) {\n return this.fetch({\n fetchMore: {\n fetchMoreVariable: fetchMoreVariable,\n previous: (options == null ? void 0 : options.previous) || false\n }\n }, config);\n };\n\n _proto.fetch = function fetch(options, config) {\n try {\n var _exit2 = false;\n\n var _this4 = this;\n\n return _invoke(function () {\n if (_this4.promise) {\n return function () {\n if ((options == null ? void 0 : options.fetchMore) && _this4.state.data) {\n // Silently cancel current fetch if the user wants to fetch more\n return _awaitIgnored(_this4.cancel(true));\n } else {\n // Return current promise if we are already fetching\n _exit2 = true;\n return _this4.promise;\n }\n }();\n }\n }, function (_result2) {\n if (_exit2) return _result2;\n\n // Update config if passed, otherwise the config from the last execution is used\n if (config) {\n _this4.updateConfig(config);\n }\n\n config = _this4.config; // Get the query function params\n\n var filter = config.queryFnParamsFilter;\n var params = filter ? filter(_this4.queryKey) : _this4.queryKey;\n _this4.promise = _async(function () {\n return _catch(function () {\n var data;\n return _invoke(function () {\n if (config.infinite) {\n return _await(_this4.startInfiniteFetch(config, params, options), function (_this4$startInfiniteF) {\n data = _this4$startInfiniteF;\n });\n } else {\n return _await(_this4.startFetch(config, params, options), function (_this4$startFetch) {\n data = _this4$startFetch;\n });\n }\n }, function () {\n // Set success state\n _this4.setData(data); // Cleanup\n\n\n delete _this4.promise; // Return data\n\n return data;\n });\n }, function (error) {\n // Set error state if needed\n if (!(isCancelledError(error) && error.silent)) {\n _this4.dispatch({\n type: ActionType.Error,\n error: error\n });\n } // Log error\n\n\n if (!isCancelledError(error)) {\n Console.error(error);\n } // Cleanup\n\n\n delete _this4.promise; // Propagate error\n\n throw error;\n });\n })();\n return _this4.promise;\n });\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n _proto.startFetch = function startFetch(config, params, _options) {\n // Create function to fetch the data\n var fetchData = function fetchData() {\n return config.queryFn.apply(config, params);\n }; // Set to fetching state if not already in it\n\n\n if (!this.state.isFetching) {\n this.dispatch({\n type: ActionType.Fetch\n });\n } // Try to fetch the data\n\n\n return this.tryFetchData(config, fetchData);\n };\n\n _proto.startInfiniteFetch = function startInfiniteFetch(config, params, options) {\n var fetchMore = options == null ? void 0 : options.fetchMore;\n\n var _ref = fetchMore || {},\n previous = _ref.previous,\n fetchMoreVariable = _ref.fetchMoreVariable;\n\n var isFetchingMore = fetchMore ? previous ? 'previous' : 'next' : false;\n var prevPages = this.state.data || []; // Create function to fetch a page\n\n var fetchPage = _async(function (pages, prepend, cursor) {\n var lastPage = getLastPage(pages, prepend);\n\n if (typeof cursor === 'undefined' && typeof lastPage !== 'undefined' && config.getFetchMore) {\n cursor = config.getFetchMore(lastPage, pages);\n }\n\n return !Boolean(cursor) && typeof lastPage !== 'undefined' ? pages : _await(config.queryFn.apply(config, params.concat([cursor])), function (page) {\n return prepend ? [page].concat(pages) : [].concat(pages, [page]);\n });\n }); // Create function to fetch the data\n\n\n var fetchData = function fetchData() {\n if (isFetchingMore) {\n return fetchPage(prevPages, previous, fetchMoreVariable);\n } else if (!prevPages.length) {\n return fetchPage([]);\n } else {\n var promise = fetchPage([]);\n\n for (var i = 1; i < prevPages.length; i++) {\n promise = promise.then(fetchPage);\n }\n\n return promise;\n }\n }; // Set to fetching state if not already in it\n\n\n if (!this.state.isFetching || this.state.isFetchingMore !== isFetchingMore) {\n this.dispatch({\n type: ActionType.Fetch,\n isFetchingMore: isFetchingMore\n });\n } // Try to get the data\n\n\n return this.tryFetchData(config, fetchData);\n };\n\n _proto.tryFetchData = function tryFetchData(config, fn) {\n var _this5 = this;\n\n return new Promise(function (outerResolve, outerReject) {\n var resolved = false;\n var continueLoop;\n var cancelTransport;\n\n var done = function done() {\n resolved = true;\n delete _this5.cancelFetch;\n delete _this5.continueFetch;\n delete _this5.isTransportCancelable; // End loop if currently paused\n\n continueLoop == null ? void 0 : continueLoop();\n };\n\n var resolve = function resolve(value) {\n done();\n outerResolve(value);\n };\n\n var reject = function reject(value) {\n done();\n outerReject(value);\n }; // Create callback to cancel this fetch\n\n\n _this5.cancelFetch = function (silent) {\n reject(new CancelledError(silent));\n cancelTransport == null ? void 0 : cancelTransport();\n }; // Create callback to continue this fetch\n\n\n _this5.continueFetch = function () {\n continueLoop == null ? void 0 : continueLoop();\n }; // Create loop function\n\n\n var run = _async(function () {\n return _catch(function () {\n // Execute query\n var promiseOrValue = fn(); // Check if the transport layer support cancellation\n\n if (isCancelable(promiseOrValue)) {\n cancelTransport = function cancelTransport() {\n try {\n promiseOrValue.cancel();\n } catch (_unused) {}\n };\n\n _this5.isTransportCancelable = true;\n } // Await data\n\n\n return _await(promiseOrValue, function (_promiseOrValue) {\n resolve(_promiseOrValue);\n });\n }, function (error) {\n // Stop if the fetch is already resolved\n if (resolved) {\n return;\n } // Do we need to retry the request?\n\n\n var failureCount = _this5.state.failureCount;\n var retry = config.retry,\n retryDelay = config.retryDelay;\n var shouldRetry = retry === true || failureCount < retry || typeof retry === 'function' && retry(failureCount, error);\n\n if (!shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n } // Increase the failureCount\n\n\n _this5.dispatch({\n type: ActionType.Failed\n }); // Delay\n\n\n return _await(sleep(functionalUpdate(retryDelay, failureCount) || 0), function () {\n // Pause retry if the document is not visible or when the device is offline\n return _invoke(function () {\n if (!isDocumentVisible() || !isOnline()) {\n return _awaitIgnored(new Promise(function (continueResolve) {\n continueLoop = continueResolve;\n }));\n }\n }, function () {\n if (!resolved) {\n run();\n }\n }); // Try again if not resolved yet\n });\n });\n }); // Start loop\n\n\n run();\n });\n };\n\n return Query;\n}();\n\nfunction getLastPage(pages, previous) {\n return previous ? pages[0] : pages[pages.length - 1];\n}\n\nfunction hasMorePages(config, pages, previous) {\n if (config.infinite && config.getFetchMore && Array.isArray(pages)) {\n return Boolean(config.getFetchMore(getLastPage(pages, previous), pages));\n }\n}\n\nfunction getDefaultState(config) {\n var data = typeof config.initialData === 'function' ? config.initialData() : config.initialData;\n var status = typeof data !== 'undefined' ? QueryStatus.Success : config.enabled ? QueryStatus.Loading : QueryStatus.Idle;\n return {\n canFetchMore: hasMorePages(config, data),\n data: data,\n error: null,\n failureCount: 0,\n isFetching: status === QueryStatus.Loading,\n isFetchingMore: false,\n isInitialData: true,\n isInvalidated: false,\n status: status,\n updateCount: 0,\n updatedAt: Date.now()\n };\n}\n\nexport function queryReducer(state, action) {\n var _action$updatedAt;\n\n switch (action.type) {\n case ActionType.Failed:\n return _extends({}, state, {\n failureCount: state.failureCount + 1\n });\n\n case ActionType.Fetch:\n return _extends({}, state, {\n failureCount: 0,\n isFetching: true,\n isFetchingMore: action.isFetchingMore || false,\n status: typeof state.data !== 'undefined' ? QueryStatus.Success : QueryStatus.Loading\n });\n\n case ActionType.Success:\n return _extends({}, state, {\n canFetchMore: action.canFetchMore,\n data: action.data,\n error: null,\n failureCount: 0,\n isFetching: false,\n isFetchingMore: false,\n isInitialData: false,\n isInvalidated: false,\n status: QueryStatus.Success,\n updateCount: state.updateCount + 1,\n updatedAt: (_action$updatedAt = action.updatedAt) != null ? _action$updatedAt : Date.now()\n });\n\n case ActionType.Error:\n return _extends({}, state, {\n error: action.error,\n failureCount: state.failureCount + 1,\n isFetching: false,\n isFetchingMore: false,\n status: QueryStatus.Error,\n throwInErrorBoundary: true,\n updateCount: state.updateCount + 1\n });\n\n case ActionType.Invalidate:\n return _extends({}, state, {\n isInvalidated: true\n });\n\n default:\n return state;\n }\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { deepIncludes, getQueryArgs, isDocumentVisible, isOnline, isPlainObject, isServer, noop } from './utils';\nimport { getResolvedQueryConfig as _getResolvedQueryConfig } from './config';\nimport { Query } from './query';\nimport { notifyManager } from './notifyManager';\nimport { QueryObserver } from './queryObserver'; // TYPES\n\n// CLASS\nexport var QueryCache = /*#__PURE__*/function () {\n function QueryCache(config) {\n this.config = config || {};\n this.globalListeners = [];\n this.queries = {};\n this.queriesArray = [];\n this.isFetching = 0;\n }\n\n var _proto = QueryCache.prototype;\n\n _proto.notifyGlobalListeners = function notifyGlobalListeners(query) {\n var _this = this;\n\n this.isFetching = this.getQueries().reduce(function (acc, q) {\n return q.state.isFetching ? acc + 1 : acc;\n }, 0);\n notifyManager.batch(function () {\n _this.globalListeners.forEach(function (listener) {\n notifyManager.schedule(function () {\n listener(_this, query);\n });\n });\n });\n };\n\n _proto.getDefaultConfig = function getDefaultConfig() {\n return this.config.defaultConfig;\n };\n\n _proto.getResolvedQueryConfig = function getResolvedQueryConfig(queryKey, config) {\n return _getResolvedQueryConfig(this, queryKey, undefined, config);\n };\n\n _proto.subscribe = function subscribe(listener) {\n var _this2 = this;\n\n this.globalListeners.push(listener);\n return function () {\n _this2.globalListeners = _this2.globalListeners.filter(function (x) {\n return x !== listener;\n });\n };\n };\n\n _proto.clear = function clear(options) {\n this.removeQueries();\n\n if (options == null ? void 0 : options.notify) {\n this.notifyGlobalListeners();\n }\n };\n\n _proto.getQueries = function getQueries(predicate, options) {\n var anyKey = predicate === true || typeof predicate === 'undefined';\n\n if (anyKey && !options) {\n return this.queriesArray;\n }\n\n var predicateFn;\n\n if (typeof predicate === 'function') {\n predicateFn = predicate;\n } else {\n var _ref = options || {},\n exact = _ref.exact,\n active = _ref.active,\n stale = _ref.stale;\n\n var resolvedConfig = this.getResolvedQueryConfig(predicate);\n\n predicateFn = function predicateFn(query) {\n // Check query key if needed\n if (!anyKey) {\n if (exact) {\n // Check if the query key matches exactly\n if (query.queryHash !== resolvedConfig.queryHash) {\n return false;\n }\n } else {\n // Check if the query key matches partially\n if (!deepIncludes(query.queryKey, resolvedConfig.queryKey)) {\n return false;\n }\n }\n } // Check active state if needed\n\n\n if (typeof active === 'boolean' && query.isActive() !== active) {\n return false;\n } // Check stale state if needed\n\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n return true;\n };\n }\n\n return this.queriesArray.filter(predicateFn);\n };\n\n _proto.getQuery = function getQuery(predicate) {\n return this.getQueries(predicate, {\n exact: true\n })[0];\n };\n\n _proto.getQueryByHash = function getQueryByHash(queryHash) {\n return this.queries[queryHash];\n };\n\n _proto.getQueryData = function getQueryData(predicate) {\n var _this$getQuery;\n\n return (_this$getQuery = this.getQuery(predicate)) == null ? void 0 : _this$getQuery.state.data;\n };\n\n _proto.removeQuery = function removeQuery(query) {\n if (this.queries[query.queryHash]) {\n query.destroy();\n delete this.queries[query.queryHash];\n this.queriesArray = this.queriesArray.filter(function (x) {\n return x !== query;\n });\n this.notifyGlobalListeners(query);\n }\n };\n\n _proto.removeQueries = function removeQueries(predicate, options) {\n var _this3 = this;\n\n this.getQueries(predicate, options).forEach(function (query) {\n _this3.removeQuery(query);\n });\n };\n\n _proto.cancelQueries = function cancelQueries(predicate, options) {\n this.getQueries(predicate, options).forEach(function (query) {\n query.cancel();\n });\n }\n /**\n * @return Promise resolving to an array with the invalidated queries.\n */\n ;\n\n _proto.invalidateQueries = function invalidateQueries(predicate, options) {\n var queries = this.getQueries(predicate, options);\n notifyManager.batch(function () {\n queries.forEach(function (query) {\n query.invalidate();\n });\n });\n\n var _ref2 = options || {},\n _ref2$refetchActive = _ref2.refetchActive,\n refetchActive = _ref2$refetchActive === void 0 ? true : _ref2$refetchActive,\n _ref2$refetchInactive = _ref2.refetchInactive,\n refetchInactive = _ref2$refetchInactive === void 0 ? false : _ref2$refetchInactive;\n\n if (!refetchInactive && !refetchActive) {\n return Promise.resolve(queries);\n }\n\n var refetchOptions = _extends({}, options);\n\n if (refetchActive && !refetchInactive) {\n refetchOptions.active = true;\n } else if (refetchInactive && !refetchActive) {\n refetchOptions.active = false;\n }\n\n var promise = this.refetchQueries(predicate, refetchOptions);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(function () {\n return queries;\n });\n }\n\n return promise.then(function () {\n return queries;\n });\n }\n /**\n * @return Promise resolving to an array with the refetched queries.\n */\n ;\n\n _proto.refetchQueries = function refetchQueries(predicate, options) {\n var _this4 = this;\n\n var promises = [];\n notifyManager.batch(function () {\n _this4.getQueries(predicate, options).forEach(function (query) {\n var promise = query.fetch().then(function () {\n return query;\n });\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(function () {\n return query;\n });\n }\n\n promises.push(promise);\n });\n });\n return Promise.all(promises);\n };\n\n _proto.resetErrorBoundaries = function resetErrorBoundaries() {\n this.getQueries().forEach(function (query) {\n query.state.throwInErrorBoundary = false;\n });\n };\n\n _proto.buildQuery = function buildQuery(queryKey, config) {\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, config);\n var query = this.getQueryByHash(resolvedConfig.queryHash);\n\n if (!query) {\n query = this.createQuery(resolvedConfig);\n }\n\n return query;\n };\n\n _proto.createQuery = function createQuery(config) {\n var query = new Query(config); // A frozen cache does not add new queries to the cache\n\n if (!this.config.frozen) {\n this.queries[query.queryHash] = query;\n this.queriesArray.push(query);\n this.notifyGlobalListeners(query);\n }\n\n return query;\n } // Parameter syntax\n ;\n\n // Implementation\n _proto.fetchQuery = function fetchQuery(arg1, arg2, arg3) {\n var _getQueryArgs = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs[0],\n config = _getQueryArgs[1];\n\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, _extends({\n // https://github.com/tannerlinsley/react-query/issues/652\n retry: false\n }, config));\n var query = this.getQueryByHash(resolvedConfig.queryHash);\n\n if (!query) {\n query = this.createQuery(resolvedConfig);\n }\n\n if (!query.isStaleByTime(config.staleTime)) {\n return Promise.resolve(query.state.data);\n }\n\n return query.fetch(undefined, resolvedConfig);\n } // Parameter syntax with optional prefetch options\n ;\n\n // Implementation\n _proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3, arg4) {\n if (isPlainObject(arg2) && (arg2.hasOwnProperty('throwOnError') || arg2.hasOwnProperty('force'))) {\n arg4 = arg2;\n arg2 = undefined;\n arg3 = undefined;\n }\n\n var _getQueryArgs2 = getQueryArgs(arg1, arg2, arg3, arg4),\n queryKey = _getQueryArgs2[0],\n config = _getQueryArgs2[1],\n options = _getQueryArgs2[2];\n\n if (options == null ? void 0 : options.force) {\n config.staleTime = 0;\n }\n\n var promise = this.fetchQuery(queryKey, config);\n\n if (!(options == null ? void 0 : options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n } // Parameter syntax\n ;\n\n // Implementation\n _proto.watchQuery = function watchQuery(arg1, arg2, arg3) {\n var _getQueryArgs3 = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs3[0],\n config = _getQueryArgs3[1];\n\n var resolvedConfig = this.getResolvedQueryConfig(queryKey, config);\n return new QueryObserver(resolvedConfig);\n };\n\n _proto.setQueryData = function setQueryData(queryKey, updater, config) {\n this.buildQuery(queryKey, config).setData(updater);\n };\n\n return QueryCache;\n}();\nvar defaultQueryCache = new QueryCache({\n frozen: isServer\n});\nexport { defaultQueryCache as queryCache };\nexport var queryCaches = [defaultQueryCache];\n/**\n * @deprecated\n */\n\nexport function makeQueryCache(config) {\n return new QueryCache(config);\n}\nexport function onVisibilityOrOnlineChange(type) {\n if (isDocumentVisible() && isOnline()) {\n notifyManager.batch(function () {\n queryCaches.forEach(function (queryCache) {\n queryCache.getQueries().forEach(function (query) {\n query.onInteraction(type);\n });\n });\n });\n }\n}","import { createSetHandler, isServer } from './utils';\nimport { onVisibilityOrOnlineChange } from './queryCache';\nexport var setFocusHandler = createSetHandler(function () {\n return onVisibilityOrOnlineChange('focus');\n});\nsetFocusHandler(function (handleFocus) {\n var _window;\n\n if (isServer || !((_window = window) == null ? void 0 : _window.addEventListener)) {\n return;\n } // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', handleFocus, false);\n window.addEventListener('focus', handleFocus, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', handleFocus);\n window.removeEventListener('focus', handleFocus);\n };\n});","import { createSetHandler, isServer } from './utils';\nimport { onVisibilityOrOnlineChange } from './queryCache';\nexport var setOnlineHandler = createSetHandler(function () {\n return onVisibilityOrOnlineChange('online');\n});\nsetOnlineHandler(function (handleOnline) {\n var _window;\n\n if (isServer || !((_window = window) == null ? void 0 : _window.addEventListener)) {\n return;\n } // Listen to online\n\n\n window.addEventListener('online', handleOnline, false);\n return function () {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', handleOnline);\n };\n});","import ReactDOM from 'react-dom';\nexport var unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates;","import React from 'react';\nimport { QueryCache, queryCache as defaultQueryCache, queryCaches } from '../core';\nvar queryCacheContext = /*#__PURE__*/React.createContext(defaultQueryCache);\nexport var useQueryCache = function useQueryCache() {\n return React.useContext(queryCacheContext);\n};\nexport var ReactQueryCacheProvider = function ReactQueryCacheProvider(_ref) {\n var queryCache = _ref.queryCache,\n children = _ref.children;\n var resolvedQueryCache = React.useMemo(function () {\n return queryCache || new QueryCache();\n }, [queryCache]);\n React.useEffect(function () {\n queryCaches.push(resolvedQueryCache);\n return function () {\n // remove the cache from the active list\n var i = queryCaches.indexOf(resolvedQueryCache);\n\n if (i > -1) {\n queryCaches.splice(i, 1);\n } // if the resolvedQueryCache was created by us, we need to tear it down\n\n\n if (queryCache == null) {\n resolvedQueryCache.clear({\n notify: false\n });\n }\n };\n }, [resolvedQueryCache, queryCache]);\n return /*#__PURE__*/React.createElement(queryCacheContext.Provider, {\n value: resolvedQueryCache\n }, children);\n};","import React from 'react';\nimport { mergeReactQueryConfigs } from '../core/config';\nvar configContext = /*#__PURE__*/React.createContext(undefined);\nexport function useContextConfig() {\n return React.useContext(configContext);\n}\nexport var ReactQueryConfigProvider = function ReactQueryConfigProvider(_ref) {\n var config = _ref.config,\n children = _ref.children;\n var parentConfig = useContextConfig();\n var mergedConfig = React.useMemo(function () {\n return parentConfig ? mergeReactQueryConfigs(parentConfig, config) : config;\n }, [config, parentConfig]);\n return /*#__PURE__*/React.createElement(configContext.Provider, {\n value: mergedConfig\n }, children);\n};","import React from 'react'; // CONTEXT\n\nfunction createValue() {\n var _isReset = false;\n return {\n clearReset: function clearReset() {\n _isReset = false;\n },\n reset: function reset() {\n _isReset = true;\n },\n isReset: function isReset() {\n return _isReset;\n }\n };\n}\n\nvar context = /*#__PURE__*/React.createContext(createValue()); // HOOK\n\nexport var useErrorResetBoundary = function useErrorResetBoundary() {\n return React.useContext(context);\n}; // COMPONENT\n\nexport var ReactQueryErrorResetBoundary = function ReactQueryErrorResetBoundary(_ref) {\n var children = _ref.children;\n var value = React.useMemo(function () {\n return createValue();\n }, []);\n return /*#__PURE__*/React.createElement(context.Provider, {\n value: value\n }, typeof children === 'function' ? children(value) : children);\n};","import React from 'react';\nimport { isServer } from '../core/utils';\nexport function useIsMounted() {\n var mountedRef = React.useRef(false);\n var isMounted = React.useCallback(function () {\n return mountedRef.current;\n }, []);\n React[isServer ? 'useEffect' : 'useLayoutEffect'](function () {\n mountedRef.current = true;\n return function () {\n mountedRef.current = false;\n };\n }, []);\n return isMounted;\n}\nexport function useMountedCallback(callback) {\n var isMounted = useIsMounted();\n return React.useCallback(function () {\n if (isMounted()) {\n return callback.apply(void 0, arguments);\n }\n }, [callback, isMounted]);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport React from 'react';\nimport { useMountedCallback } from './utils';\nimport { getResolvedMutationConfig } from '../core/config';\nimport { Console, uid, getStatusProps } from '../core/utils';\nimport { QueryStatus } from '../core/types';\nimport { useQueryCache } from './ReactQueryCacheProvider';\nimport { useContextConfig } from './ReactQueryConfigProvider'; // TYPES\n\nfunction _await(value, then, direct) {\n if (direct) {\n return then ? then(value) : value;\n }\n\n if (!value || !value.then) {\n value = Promise.resolve(value);\n }\n\n return then ? value.then(then) : value;\n}\n\nvar ActionType = {\n Reset: 0,\n Loading: 1,\n Resolve: 2,\n Reject: 3\n};\n\n// HOOK\nfunction _catch(body, recover) {\n try {\n var result = body();\n } catch (e) {\n return recover(e);\n }\n\n if (result && result.then) {\n return result.then(void 0, recover);\n }\n\n return result;\n}\n\nfunction _async(f) {\n return function () {\n for (var args = [], i = 0; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n\n try {\n return Promise.resolve(f.apply(this, args));\n } catch (e) {\n return Promise.reject(e);\n }\n };\n}\n\nfunction getDefaultState() {\n return _extends({}, getStatusProps(QueryStatus.Idle), {\n data: undefined,\n error: null\n });\n}\n\nfunction mutationReducer(state, action) {\n switch (action.type) {\n case ActionType.Reset:\n return getDefaultState();\n\n case ActionType.Loading:\n return _extends({}, getStatusProps(QueryStatus.Loading), {\n data: undefined,\n error: null\n });\n\n case ActionType.Resolve:\n return _extends({}, getStatusProps(QueryStatus.Success), {\n data: action.data,\n error: null\n });\n\n case ActionType.Reject:\n return _extends({}, getStatusProps(QueryStatus.Error), {\n data: undefined,\n error: action.error\n });\n\n default:\n return state;\n }\n}\n\nexport function useMutation(mutationFn, config) {\n if (config === void 0) {\n config = {};\n }\n\n var cache = useQueryCache();\n var contextConfig = useContextConfig(); // Get resolved config\n\n var resolvedConfig = getResolvedMutationConfig(cache, contextConfig, config);\n\n var _React$useReducer = React.useReducer(mutationReducer, null, getDefaultState),\n state = _React$useReducer[0],\n unsafeDispatch = _React$useReducer[1];\n\n var dispatch = useMountedCallback(unsafeDispatch);\n var latestMutationRef = React.useRef();\n var latestMutationFnRef = React.useRef(mutationFn);\n latestMutationFnRef.current = mutationFn;\n var latestConfigRef = React.useRef(resolvedConfig);\n latestConfigRef.current = resolvedConfig;\n var mutate = React.useCallback(_async(function (variables, mutateConfig) {\n if (mutateConfig === void 0) {\n mutateConfig = {};\n }\n\n var latestConfig = latestConfigRef.current;\n var mutationId = uid();\n latestMutationRef.current = mutationId;\n\n var isLatest = function isLatest() {\n return latestMutationRef.current === mutationId;\n };\n\n var snapshotValue;\n return _catch(function () {\n dispatch({\n type: ActionType.Loading\n });\n return _await(latestConfig.onMutate == null ? void 0 : latestConfig.onMutate(variables), function (_latestConfig$onMutat) {\n snapshotValue = _latestConfig$onMutat;\n var latestMutationFn = latestMutationFnRef.current;\n return _await(latestMutationFn(variables), function (data) {\n if (isLatest()) {\n dispatch({\n type: ActionType.Resolve,\n data: data\n });\n }\n\n return _await(latestConfig.onSuccess == null ? void 0 : latestConfig.onSuccess(data, variables), function () {\n return _await(mutateConfig.onSuccess == null ? void 0 : mutateConfig.onSuccess(data, variables), function () {\n return _await(latestConfig.onSettled == null ? void 0 : latestConfig.onSettled(data, null, variables), function () {\n return _await(mutateConfig.onSettled == null ? void 0 : mutateConfig.onSettled(data, null, variables), function () {\n return data;\n });\n });\n });\n });\n });\n });\n }, function (error) {\n Console.error(error);\n return _await(latestConfig.onError == null ? void 0 : latestConfig.onError(error, variables, snapshotValue), function () {\n return _await(mutateConfig.onError == null ? void 0 : mutateConfig.onError(error, variables, snapshotValue), function () {\n return _await(latestConfig.onSettled == null ? void 0 : latestConfig.onSettled(undefined, error, variables, snapshotValue), function () {\n return _await(mutateConfig.onSettled == null ? void 0 : mutateConfig.onSettled(undefined, error, variables, snapshotValue), function () {\n if (isLatest()) {\n dispatch({\n type: ActionType.Reject,\n error: error\n });\n }\n\n if (mutateConfig.throwOnError || latestConfig.throwOnError) {\n throw error;\n }\n });\n });\n });\n });\n });\n }), [dispatch]);\n React.useEffect(function () {\n var latestConfig = latestConfigRef.current;\n var suspense = latestConfig.suspense,\n useErrorBoundary = latestConfig.useErrorBoundary;\n\n if ((useErrorBoundary || suspense) && state.error) {\n throw state.error;\n }\n }, [state.error]);\n var reset = React.useCallback(function () {\n dispatch({\n type: ActionType.Reset\n });\n }, [dispatch]);\n\n var result = _extends({}, state, {\n reset: reset\n });\n\n return [mutate, result];\n}","import React from 'react';\nimport { useIsMounted } from './utils';\nimport { getResolvedQueryConfig } from '../core/config';\nimport { QueryObserver } from '../core/queryObserver';\nimport { useErrorResetBoundary } from './ReactQueryErrorResetBoundary';\nimport { useQueryCache } from './ReactQueryCacheProvider';\nimport { useContextConfig } from './ReactQueryConfigProvider';\nexport function useBaseQuery(queryKey, config) {\n var _React$useReducer = React.useReducer(function (c) {\n return c + 1;\n }, 0),\n rerender = _React$useReducer[1];\n\n var isMounted = useIsMounted();\n var cache = useQueryCache();\n var contextConfig = useContextConfig();\n var errorResetBoundary = useErrorResetBoundary(); // Get resolved config\n\n var resolvedConfig = getResolvedQueryConfig(cache, queryKey, contextConfig, config); // Create query observer\n\n var observerRef = React.useRef();\n var firstRender = !observerRef.current;\n var observer = observerRef.current || new QueryObserver(resolvedConfig);\n observerRef.current = observer; // Subscribe to the observer\n\n React.useEffect(function () {\n errorResetBoundary.clearReset();\n return observer.subscribe(function () {\n if (isMounted()) {\n rerender();\n }\n });\n }, [isMounted, observer, rerender, errorResetBoundary]); // Update config\n\n if (!firstRender) {\n observer.updateConfig(resolvedConfig);\n }\n\n var result = observer.getCurrentResult(); // Handle suspense\n\n if (resolvedConfig.suspense || resolvedConfig.useErrorBoundary) {\n var query = observer.getCurrentQuery();\n\n if (result.isError && !errorResetBoundary.isReset() && query.state.throwInErrorBoundary) {\n throw result.error;\n }\n\n if (resolvedConfig.enabled && resolvedConfig.suspense && !result.isSuccess) {\n errorResetBoundary.clearReset();\n var unsubscribe = observer.subscribe();\n throw observer.fetch().finally(unsubscribe);\n }\n }\n\n return result;\n}","import { getQueryArgs } from '../core/utils';\nimport { useBaseQuery } from './useBaseQuery'; // TYPES\n\n// Implementation\nexport function useQuery(arg1, arg2, arg3) {\n var _getQueryArgs = getQueryArgs(arg1, arg2, arg3),\n queryKey = _getQueryArgs[0],\n config = _getQueryArgs[1];\n\n return useBaseQuery(queryKey, config);\n}","import { setBatchedUpdates } from './core/index';\nimport { unstable_batchedUpdates } from './react/reactBatchedUpdates';\nsetBatchedUpdates(unstable_batchedUpdates);\nexport * from './core/index';\nexport * from './react/index';","export const panelUsesVariable = (sql: string, variableName: string): boolean => {\n return sql.includes(`\\${${variableName}`);\n};\n\nexport const panelUsesMacro = (sql: string): boolean => {\n const timeToRegEx = RegExp(/\\$__timeTo()/g);\n const timeFromRegEx = RegExp(/\\$__timeFrom()/g);\n const timeFilterRegEx = RegExp(/\\$__timeFilter\\([a-zA-Z]+\\)/g);\n\n return timeToRegEx.test(sql) || timeFromRegEx.test(sql) || timeFilterRegEx.test(sql);\n};\n\nexport const panelUsesUnsupportedMacro = (sql: string) => {\n // Match all macros starting with $__ except supported ones: timeFrom, timeTo, timeFilter\n const regexp = RegExp(/(?!.*\\$__timeFrom\\(\\).*)(?!.*\\$__timeTo\\(\\).*)(?!.*\\$__timeFilter\\(.+\\).*)(\\$__.*)/g);\n return regexp.test(sql);\n};\n","export enum ReportGroupKey {\n NAME = 'name',\n DESCRIPTION = 'description',\n ID = 'id',\n}\n\nexport enum ScheduleKey {\n NAME = 'name',\n DESCRIPTION = 'description',\n ID = 'id',\n INTERVAL = 'interval',\n REPORT_GROUP_ID = 'reportGroupID',\n TIME_OF_DAY = 'time',\n DAY_OF_INTERVAL = 'day',\n}\n\nexport enum ReportContentKey {\n ID = 'id',\n LOOKBACK = 'lookback',\n PANEL_ID = 'panelID',\n VARIABLES = 'variables',\n}\n","import { SelectableValue } from '@grafana/data';\nimport { panelUsesVariable, panelUsesUnsupportedMacro } from './common/utils/checkers';\nimport { DashboardResponse, DashboardMeta, CreateContentVars, ReportContent, SelectableVariable } from './common/types';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Variable, Panel, ReportGroupMember, Schedule, Store, ReportGroup, User } from 'common/types';\n\nexport const refreshPanelOptions = async (\n variable: Variable,\n datasourceID: number\n): Promise>> => {\n const { definition, name } = variable;\n const optionsResponse = await getBackendSrv().post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: definition,\n format: 'table',\n },\n ],\n });\n\n const rows = optionsResponse.results?.A?.tables?.[0]?.rows?.flat().map((datum: string) => {\n const selectableVariable = { name, value: datum } as SelectableVariable;\n const selectableValue = { label: datum, value: selectableVariable } as SelectableValue;\n\n return selectableValue;\n });\n\n return rows;\n};\n\nexport const sendTestEmail = (scheduleID: string) =>\n getBackendSrv().get(`api/plugins/msupplyfoundation-datasource/resources/test-email?schedule-id=${scheduleID}`);\n\nexport const getGroupMembers = (_: string, groupId: string): Promise =>\n getBackendSrv().get(\n `api/plugins/msupplyfoundation-datasource/resources/report-group-membership/?group-id=${groupId}`\n );\n\nexport const getReportGroups = (): Promise =>\n getBackendSrv().get('api/plugins/msupplyfoundation-datasource/resources/report-group');\n\nexport const getUsers = (datasourceID: number): Promise => {\n return getBackendSrv()\n .post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: 'SELECT id, name, first_name, last_name, e_mail FROM \"user\"',\n format: 'table',\n },\n ],\n })\n .then(result => {\n const {\n results: {\n A: {\n tables: [{ rows, columns }],\n },\n },\n } = result;\n\n const columnsToExtract = ['id', 'name', 'first_name', 'last_name', 'e_mail'];\n const indexes = columns.reduce((acc: number[], { text }: any, i: number) => {\n if (columnsToExtract.includes(text)) {\n return [...acc, i];\n }\n return acc;\n }, []);\n\n return rows.map((rowData: any) => {\n return indexes.reduce((acc: any, value: any, i: any) => {\n return { ...acc, [columns[value].text]: rowData[i] };\n }, {});\n });\n });\n};\n\nexport const getStores = (datasourceID: number): Promise => {\n return getBackendSrv()\n .post('/api/tsdb/query', {\n queries: [\n {\n datasourceId: datasourceID,\n rawSql: 'SELECT id, name, code FROM \"store\"',\n format: 'table',\n },\n ],\n })\n .then(result => {\n const {\n results: {\n A: {\n tables: [{ rows, columns }],\n },\n },\n } = result;\n\n const columnsToExtract = ['id', 'name', 'code'];\n const indexes = columns.reduce((acc: number[], { text }: any, i: number) => {\n if (columnsToExtract.includes(text)) {\n return [...acc, i];\n }\n return acc;\n }, []);\n\n return rows.map((rowData: any) => {\n return indexes.reduce((acc: any, value: any, i: any) => {\n return { ...acc, [columns[value].text]: rowData[i] };\n }, {});\n });\n });\n};\n\nexport const createReportGroupMembership = async (params: any) => {\n const { user, reportGroupID } = params;\n\n const membership = { userID: user.id, reportGroupID };\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/report-group-membership', [\n membership,\n ]);\n};\n\nexport const deleteReportGroupMembership = async (reportGroupMembership: ReportGroupMember) => {\n const { id } = reportGroupMembership;\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-group-membership/${id}`);\n};\n\nexport const updateReportGroup = async (reportGroup: any) => {\n return getBackendSrv().put(\n `./api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroup?.id}`,\n reportGroup\n );\n};\n\nexport const deleteReportGroup = async (reportGroup: ReportGroup) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-group/${reportGroup?.id}`);\n};\n\nexport const createReportGroup = async () => {\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/report-group');\n};\n\nexport const getSchedules = async () => {\n return getBackendSrv().get('./api/plugins/msupplyfoundation-datasource/resources/schedule');\n};\n\nexport const createSchedule = async () => {\n return getBackendSrv().post('./api/plugins/msupplyfoundation-datasource/resources/schedule');\n};\n\nexport const deleteSchedule = async (schedule: Schedule) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/schedule/${schedule?.id}`);\n};\n\nexport const getReportContent = async (_: string, scheduleID: string) => {\n const content: ReportContent[] = await getBackendSrv().get(\n `./api/plugins/msupplyfoundation-datasource/resources/report-content?schedule-id=${scheduleID}`\n );\n return content;\n};\n\nexport const getDashboards = async () => {\n const dashboardMeta = await searchForDashboards();\n const dashboardResponses = await Promise.all(dashboardMeta.map(({ uid }) => getDashboard(uid)));\n return dashboardResponses.map(({ dashboard }) => dashboard);\n};\n\nexport const getDashboard = async (uuid: string): Promise => {\n return getBackendSrv().get(`./api/dashboards/uid/${uuid}`);\n};\n\nexport const searchForDashboards = async (): Promise => {\n return getBackendSrv().get('./api/search');\n};\n\nexport const getDatasource = async (id: number) => {\n return getBackendSrv().get(`./api/datasources/${id}`);\n};\n\nexport const getPanels = async (datasourceID: number): Promise => {\n const dashboards = (await getDashboards()) ?? [];\n const datasource = await getDatasource(datasourceID);\n const { name: datasourceName = '' } = datasource ?? {};\n\n const panels: Panel[] = dashboards\n .filter(({ panels }) => panels?.length > 0)\n .map(({ panels, templating, uid }) => {\n const mappedPanels = panels\n .filter(({ type }) => type === 'table' || type === 'table-old' || type === 'msupplyfoundation-table')\n .map(rawPanel => {\n const { targets } = rawPanel;\n const [target] = targets;\n const { rawSql } = target;\n\n const { list } = templating;\n\n // Want to filter out any panel which uses variables which aren't supported\n // Supported variables are custom and query types where the query type must\n // use the datasource specified in mSupply App Configuration.\n const unusableVariables = list.filter((variable: Variable) => {\n const { datasource, type } = variable;\n if (type === 'datasource' || type === 'adhoc') {\n return true;\n } else if (type === 'query') {\n return datasourceName !== datasource;\n } else {\n return false;\n }\n });\n\n const usesUnusableVariables = unusableVariables.some(variable => {\n const { name: variableName } = variable;\n return panelUsesVariable(rawSql, variableName);\n });\n\n let error = '';\n if (usesUnusableVariables) {\n error = 'This panel uses an unsupported variable.';\n } else if (panelUsesUnsupportedMacro(rawSql)) {\n error = 'This panel uses an unsupported macro.';\n }\n\n return { ...rawPanel, error };\n })\n .map(({ targets, description, title, id, type, error }) => {\n const [target] = targets;\n const { rawSql } = target;\n\n const dashboardID = uid;\n\n const { list } = templating;\n\n const variables =\n list?.reduce((acc: any, variable: Variable) => {\n if (panelUsesVariable(rawSql, variable.name)) {\n return [...acc, variable];\n } else {\n return acc;\n }\n }, []) ?? [];\n\n const mappedPanel = { error, rawSql, description, title, id, variables, dashboardID, type };\n\n return mappedPanel;\n });\n return mappedPanels;\n })\n .flat();\n\n return panels;\n};\n\nexport const updateSchedule = async (schedule: Schedule) => {\n return getBackendSrv().put(`./api/plugins/msupplyfoundation-datasource/resources/schedule/${schedule?.id}`, schedule);\n};\n\nexport const createReportContent = async (contents: CreateContentVars) => {\n return getBackendSrv().post(`./api/plugins/msupplyfoundation-datasource/resources/report-content`, contents);\n};\n\nexport const deleteReportContent = async (contents: any) => {\n return getBackendSrv().delete(`./api/plugins/msupplyfoundation-datasource/resources/report-content/${contents?.id}`);\n};\n\nexport const updateReportContent = async (reportContent: any) => {\n return getBackendSrv().put(\n `./api/plugins/msupplyfoundation-datasource/resources/report-content/${reportContent?.id}`,\n reportContent\n );\n};\n\nexport const getDatasources = async () => {\n return getBackendSrv().get(`./api/datasources`);\n};\n\nexport const getSettings = async (id: any) => {\n return getBackendSrv().get(`/api/plugins/${id}/settings`);\n};\n","import React, { FC } from 'react';\n\nimport { FieldValidationMessage, InlineFormLabel, Input } from '@grafana/ui';\n\ntype Props = {\n label: string;\n defaultValue: string | number;\n placeholder?: string;\n inputName: string;\n invalid: boolean;\n errorMessage: string;\n tooltip: string;\n register: any;\n type?: string;\n};\n\nexport const FieldInput: FC = ({\n tooltip,\n type = 'text',\n label,\n register,\n defaultValue,\n placeholder,\n inputName,\n invalid,\n errorMessage,\n}) => {\n return (\n
    \n \n {label}\n \n
    \n \n\n {invalid && (\n
    \n {errorMessage}\n
    \n )}\n
    \n
    \n );\n};\n","import React, { FC } from 'react';\n\nimport { InlineFormLabel, Select } from '@grafana/ui';\nimport { SelectableValue } from '@grafana/data';\n\ntype Props = {\n tooltip: string;\n value: any;\n options: SelectableValue[];\n onChange: (selected: SelectableValue) => void;\n label: string;\n};\n\nexport const FieldSelect: FC = ({ tooltip, value, options, onChange, label }) => {\n return (\n
    \n \n {label}\n \n
    \n