From 159e6358dada9114347c8c660e3dce9c121aa091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Fri, 28 Jan 2022 02:18:10 +0100 Subject: [PATCH 01/12] NuGet publishing basics --- .github/workflows/publish.yml | 12 ++++++++++++ Lombiq.JsonEditor.csproj | 18 ++++++++++++++++++ NuGetIcon.png | Bin 0 -> 4657 bytes Readme.md | 3 +++ 4 files changed, 33 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 NuGetIcon.png diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f64e9da --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,12 @@ +name: publish + +on: + push: + tags: + - v* + +jobs: + call-publish-workflow: + uses: Lombiq/GitHub-Actions/.github/workflows/publish.yml@dev + secrets: + API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} diff --git a/Lombiq.JsonEditor.csproj b/Lombiq.JsonEditor.csproj index 8d22e76..e725e25 100644 --- a/Lombiq.JsonEditor.csproj +++ b/Lombiq.JsonEditor.csproj @@ -5,6 +5,24 @@ true $(DefaultItemExcludes);.git*;node_modules\**;Tests\** + + + Lombiq JSON Editor for Orchard Core + Lombiq Technologies + Copyright © 2021, Lombiq Technologies Ltd. + Orchard Core module for displaying a JSON Editor like on (https://jsoneditoronline.org/. See the project website for detailed documentation. + NuGetIcon.png + OrchardCore;Lombiq;AspNetCore;JSONEditor + https://github.com/Lombiq/Orchard-JSON-Editor + https://github.com/Lombiq/Orchard-JSON-Editor + Licence.md + + + + + + + diff --git a/NuGetIcon.png b/NuGetIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..162a00508d8041833604d427216238c1b23b2d47 GIT binary patch literal 4657 zcmV-163*?3P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!Thn=~eB5))%gn$#O#QK7n$s4=L-h!O=vF^a;>Ff(Vme>2-ILt$p`^By>#th3Jf zo%mwTcYcq(e|sM=Ffi!HnCMv&IXStx>whD37Ty5YY(6YhyZU* z`lOOYjz@!+Y#0L27(o!^cm}spNxZ;7dL0%+0GcCv2#O=eyx?Vc`gIPV2NX&{?xE+f z^lJ~Gha`}M044qbL+Cjyh5$6L0{q&ILJ^D{pl{-(=dc(#fX0vrAa*1$6xZoFEQSZr z7(wvK@eI17ssIcRAOVts$TB0_jdpqtOTYI3UN3XFj3f*Ju%dMh;Pd&EP@s_mL<&Rz zN`wG)1dx-Hi@zU-9u4$`Y9Szs9MQo`12K>gq(l@_Ed*c%po9zSHwZo@h5^*`01;mT z`ZTTr{2)t5P^2*{ z(gugaA-4-MJOC@WCeUuzc2!$!Tr9nk4OKlrL<=A$CPveRp~&DtgXxuQsOkYCIs_yq zi&{?^z~AA7u04mq{oY>iHJqn+`58HKgxn#(@Bplg966F+@!_re3a*ts4jq4d89JYP z9onnbLFfOxj>C%dSFkgE`n~i@HjEsAm1)zb(JOZRolfXjw;uf0ZqPdf^4#6;?gjV% z*U%g6Oqw*&Muh00rW_a^fQ3PW2Eoi3GpNOmYs&{9eADxn%=PE(0fF#fA}n9NT+Rsz zbv!^$PAKcLm^UY6aK!J=FSVgm12cYx7^I#ZE!NeYVupRJo=lRr3H? zKy$4{*9(~ZJ^0`Q)MCfEVJmLwL9L!~y}JhlA`~9XX0xfHqCze&pqc=%6)fU5hC)h8 zN+3F#uaU{~X&rd}cAQ!v@c5u}JrN2gd3pER#*ZH_M=qdR5*U#sU|L!l+<*TZYBA#T zfs^B*dJY{A2!;oe3c%X6k6=n5)f1>DfQU-~@k4&(k!l=&r+3(JzrPQBjV;t-BOn;g zUW1H`3~OOwq10SJwGa?-0+=;x7AdDH$H1CrGW$J@o54 zdjZ@Z9H16IC>-a;9n@lH$&$sEl#~>)p}-J8cZLri4vQ8oq!v4!FT6=qAZ@xH1%yK4 zAu1}$OhSQ}WY9&9uHYpb{UQWZRjuJ3^yxZy1iVMBmOMCLd^;d49`3wzf-OHkkLNdWRRBnz7Qp=Z^I`PpQPg5X zXuAroH~va3`9MLTuz0DgtTfqdHr7N$RS%%+93UYf0ZK|%Qi~nu%kO~S$=p`Y1qurV z#>3E|L#+!IEMSf6h6lJwX=y3M$Mb2_d#VAtb|0pe{GhNOXG>Zs~8~_gd-5!`6aMlE#+CYv~L$Id; z=GCiLbx#KSR|vq>y%iPZ)M7_WtCrGW=MV~$hgq{`Su-;;Z_Qv;6M!y40JeDz9?ZAA z+Sk|&?)N{YmVWTJ6R$*s$pZ;{CK~?G6X3zE>WK9K!-frm;^IZrVkgk9E&6r6%7Vf~ zf$}hZe3otI%o&&q;HVOJJsYtCShI$|&CC0FJ$ODnK`k9Zgo$0qysTcm+C)B!>%8q? zNJI)CJ3AYfQc;T?&tZn8T^i&4q>jWXzUO$`ZMRuVOH1%|^4vsR4uG?KxVlFSzGl8r zH!bkHxUfnSdjEAUs`P9-M=0OP%H8+o1 z+^FUOu=wVica=z9ULGm^rcg^7jvvnjYt|TQ=?9bD3b8+30Vd8V?ORYy02qYj-rTTP z#I||$ip>gfkF5gxy?lLxN@7k0Jp?*a&jLf zr{4rE`Eih#zh(0#(R=x~IIlp>r4!KD(F$I{2g%V1aA)FZm_QCu9>wDY*VdijdUGfE zUF^%oZFhYa9OVm%fWAZT@Nu!z4WD0b51a)*KvJ{~?nsJ*F$q0}C+r4_AwM7AQX_&G z0sN7i{w-+9PkDK{sLa2qvkjg-^)Bpd{hWMY_<4Mr^Z~=*;q*B$HCfy@5qk*TAJu~A zz-Qq7vJraf;x!LW2vipKSve%j7dK;x5B#mu&2aeQ)gIp}ojSk)3(|%{)}U|g(~Vn{ z4a9P);O|Nlx`W$Ti0vxA;vt^ngLAF$^Zh4aN5e(#hmUMK(-QC;1W^?LqKhg(Y@64fmZR|5m9MD9 zkIyf__Vcw+{P7d;{HYyq-6L*GSRODx+23>p{`0^|*izpFH^RJsAQUdI09#4EKoC^{ zAiD4XMMXup>Xlk-boo5+3`zRrz)k+FjSahC(Z1ioYiD)^Y$f=t^&0%D<`iuBq7m9$ zTpN1!%7Nx9aO`q>caw-+k=C%3k9%v>dpPaONobYV@4p>Y)!bi<~8#{*L{BSzO8=-{r@LW23?v&YVgRxFnQNCJrYldK^C-`;^+y76$C#Oznj@b9_DN-O#E zA3OR=AV2W>r7a>kNWP)JIaCi{UgcZ%#RJJ7_})}?3%nixw}z2zc1CQQ*Yo6C>h#Iu zLPLT1!DC1M9LN>Ku>0%Fu>N=>N%+E-brMl636%9cLDkh&+^=q}yLt{jZ2FX1%Cq<4 z=kUzQ?bKoiNAWhEI^W}9jsmDA0NLU{Zs3d?IrHEr|NZI2w!m3U-Z-}p4qZM;t?*!G zzn&y|%75|yf#{{qng{?#`fv+(UjEwj34C$w9JSN~pW~A!-ewL3?|jt)?Oo!_I}xbn z0c1%4@#PKp5(gffJ~ye=wcFI8vEvf#ZaG4&-oXdI_kz4TjWZBAApl?5itGA$d6i`S zm)z=)*xkyG^M9jPy;DQ7eif3wZ$U~k)y4rN3jo`^@C8mh;1utshP~9%jw4sjK!-PU z9e?DK=r5yah}={YfTR$RnVBi7%?qb_-GVZsb3EXfKz;jpYW*`fDAUlc{BUv)=syHt zGX}2iF`N1R$|G04BC%Jyz5Kd!p|kf@*w?x|q9%2u5)mPwpr8P^Gocn60?E3cI*DbU zeh4)HrNzTXbRPm74hO7SwTfEoyhoC*`gXoot|^Vp)cZJ?RqZBLirJ*|5U_07Qb5EVvz^aV^I$kQ6D0<3LQ4cVA z@?=qMUQeHV2RwqbX;`JOn|t>FR#M?;AOX<{AflK6u+0nK-Gk*H4>;*^;8Gp6^hYQU zfIq1QVL;NzlVTxY-n@B`mNu4JZ20^>_;2#<*E696fS?yp8Ff5BPEIb?KTKQ0V4GK2 zSt+&H+17Xv8g5*qmOcrU1R@$#0;+`o=Jy1xT=@_T9LTpwqP?pFHk{^vhmP7rg~$OA zoBCq`s)Yci_&;jYD0tw32dKr)hSMKFy9#aDQn7^z0e#s6FbP0Rn^(j2X4v+14Yl-5 z*bvZ%lfbYE;IwJeVCvMV)MDo;lK6>jyi}X0a2`N?0qDa6*ladYZC?9ZkHg`%dTQyP za8-b-2)21u zbGLcjWSoRuI@DxZawe?Je2`kY|Ev_cpZ#XZBU z8qpRzl&8;uCnh}Rs9 zN??l;(X_eSVawS)aN^q6x)}?Iu|&aLNn>Enuxv<@C{SD@aJc0gIC8liuDLyO_c!{R zJKV`n&loRyC5mVPl$Di<%KQyv1;@^DcQDc49G(!+LeG$xlmttb@V9vx$WDiphmY_G z;4nQy0g3&*ZC(b7ASnSvcm#m2v<$3^nmBPHo(!}{QUZuD3!t{P28Zl6;B{hRBAyJi zM^z7i;6A~PZEdPAe>UhD^*jJVya2wRcHaI2`y*!nzi%Vi1Be=|nlWQ$`b#hU-^;0~ nsrq~UR{!D^QUyrZxEtW_r%bs;&;Z{U00000NkvXXu0mjfi0rae literal 0 HcmV?d00001 diff --git a/Readme.md b/Readme.md index a010995..6136819 100644 --- a/Readme.md +++ b/Readme.md @@ -2,6 +2,9 @@ +[![Lombiq.JsonEditor NuGet](https://img.shields.io/nuget/v/Lombiq.JsonEditor?label=Lombiq.JsonEditor)](https://www.nuget.org/packages/Lombiq.JsonEditor/) + + ## About Orchard Core module for displaying a JSON Editor like on [jsoneditoronline.org](https://jsoneditoronline.org/). Watch a demo video of it from the Orchard Community Meeting [here](https://www.youtube.com/watch?app=desktop&v=nFhRjhXTKAY). From d1c829c88bc50e5779ea4bb9c54fca7208947806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Fri, 28 Jan 2022 02:36:05 +0100 Subject: [PATCH 02/12] Better gitignore --- .gitignore | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1ad7031..fd70fd2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ -/node_modules/ -/bin/ -/obj/ -/wwwroot/ +.vs/ +obj/ +bin/ +artifacts/ +wwwroot/ +node_modules/ +*.user +.pnpm-debug.log From cb70a759958d215c8d10e9d60c70081e9a5a0c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 2 Feb 2022 19:44:55 +0100 Subject: [PATCH 03/12] Using NPM Targets from NuGet when necessary --- Lombiq.JsonEditor.csproj | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Lombiq.JsonEditor.csproj b/Lombiq.JsonEditor.csproj index e725e25..57f45de 100644 --- a/Lombiq.JsonEditor.csproj +++ b/Lombiq.JsonEditor.csproj @@ -23,15 +23,12 @@ - + - - - @@ -44,10 +41,17 @@ - + + + + + + + + From 9d6c14f011d229f420e3fb352cbe82f00187dbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 10 Feb 2022 19:07:31 +0100 Subject: [PATCH 04/12] Adding missing csproj elements --- Lombiq.JsonEditor.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lombiq.JsonEditor.csproj b/Lombiq.JsonEditor.csproj index 57f45de..555182e 100644 --- a/Lombiq.JsonEditor.csproj +++ b/Lombiq.JsonEditor.csproj @@ -9,7 +9,7 @@ Lombiq JSON Editor for Orchard Core Lombiq Technologies - Copyright © 2021, Lombiq Technologies Ltd. + Copyright © 2021, Lombiq Technologies Ltd. - https://lombiq.com Orchard Core module for displaying a JSON Editor like on (https://jsoneditoronline.org/. See the project website for detailed documentation. NuGetIcon.png OrchardCore;Lombiq;AspNetCore;JSONEditor @@ -51,6 +51,7 @@ + From 48e994ef88708a5e0b4e18ee70179a8a215955ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 10 Feb 2022 20:00:42 +0100 Subject: [PATCH 05/12] Committing wwwroot folder for GitHub NuGet-publishing build --- .gitignore | 1 - wwwroot/css/json-editor.css | 8 + wwwroot/css/json-editor.css.map | 1 + wwwroot/css/json-editor.min.css | 1 + .../jsoneditor/img/jsoneditor-icons.svg | 749 + .../jsoneditor/jsoneditor-minimalist.js | 21616 +++++++ .../jsoneditor/jsoneditor-minimalist.map | 1 + .../jsoneditor/jsoneditor-minimalist.min.js | 35 + wwwroot/vendors/jsoneditor/jsoneditor.css | 2016 + wwwroot/vendors/jsoneditor/jsoneditor.js | 53086 ++++++++++++++++ wwwroot/vendors/jsoneditor/jsoneditor.map | 1 + wwwroot/vendors/jsoneditor/jsoneditor.min.css | 6 + wwwroot/vendors/jsoneditor/jsoneditor.min.js | 47 + .../jsoneditor/which files do I need.md | 44 + 14 files changed, 77611 insertions(+), 1 deletion(-) create mode 100644 wwwroot/css/json-editor.css create mode 100644 wwwroot/css/json-editor.css.map create mode 100644 wwwroot/css/json-editor.min.css create mode 100644 wwwroot/vendors/jsoneditor/img/jsoneditor-icons.svg create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor-minimalist.js create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor-minimalist.map create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor-minimalist.min.js create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor.css create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor.js create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor.map create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor.min.css create mode 100644 wwwroot/vendors/jsoneditor/jsoneditor.min.js create mode 100644 wwwroot/vendors/jsoneditor/which files do I need.md diff --git a/.gitignore b/.gitignore index fd70fd2..346bfcc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ obj/ bin/ artifacts/ -wwwroot/ node_modules/ *.user .pnpm-debug.log diff --git a/wwwroot/css/json-editor.css b/wwwroot/css/json-editor.css new file mode 100644 index 0000000..2e5102d --- /dev/null +++ b/wwwroot/css/json-editor.css @@ -0,0 +1,8 @@ +.jsonEditor__editor { + height: 60vh; +} + +.jsoneditor-contextmenu .jsoneditor-menu, .jsoneditor-contextmenu .jsoneditor-menu button { + width: 200px; +} +/*# sourceMappingURL=json-editor.css.map */ diff --git a/wwwroot/css/json-editor.css.map b/wwwroot/css/json-editor.css.map new file mode 100644 index 0000000..7511e03 --- /dev/null +++ b/wwwroot/css/json-editor.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["json-editor.scss","json-editor.css"],"names":[],"mappings":"AAAA;EACI,YAAA;ACCJ;;ADGI;EAEI,YAAA;ACDR","file":"json-editor.css","sourcesContent":[".jsonEditor__editor {\r\n height: 60vh;\r\n}\r\n\r\n.jsoneditor-contextmenu .jsoneditor-menu {\r\n &, & button {\r\n // This overrides the default 128px value from the vendor library to make more space for longer template names.\r\n width: 200px;\r\n }\r\n}\r\n",".jsonEditor__editor {\r\n height: 60vh;\r\n}\r\n\r\n.jsoneditor-contextmenu .jsoneditor-menu, .jsoneditor-contextmenu .jsoneditor-menu button {\r\n width: 200px;\r\n}"]} \ No newline at end of file diff --git a/wwwroot/css/json-editor.min.css b/wwwroot/css/json-editor.min.css new file mode 100644 index 0000000..82a7f78 --- /dev/null +++ b/wwwroot/css/json-editor.min.css @@ -0,0 +1 @@ +.jsonEditor__editor{height:60vh}.jsoneditor-contextmenu .jsoneditor-menu,.jsoneditor-contextmenu .jsoneditor-menu button{width:200px} \ No newline at end of file diff --git a/wwwroot/vendors/jsoneditor/img/jsoneditor-icons.svg b/wwwroot/vendors/jsoneditor/img/jsoneditor-icons.svg new file mode 100644 index 0000000..c2c2765 --- /dev/null +++ b/wwwroot/vendors/jsoneditor/img/jsoneditor-icons.svg @@ -0,0 +1,749 @@ + + + JSON Editor Icons + + + + image/svg+xml + + JSON Editor Icons + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/vendors/jsoneditor/jsoneditor-minimalist.js b/wwwroot/vendors/jsoneditor/jsoneditor-minimalist.js new file mode 100644 index 0000000..171d921 --- /dev/null +++ b/wwwroot/vendors/jsoneditor/jsoneditor-minimalist.js @@ -0,0 +1,21616 @@ +/*! + * jsoneditor.js + * + * @brief + * JSONEditor is a web-based tool to view, edit, format, and validate JSON. + * It has various modes such as a tree editor, a code editor, and a plain text + * editor. + * + * Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+ + * + * @license + * 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. + * + * Copyright (c) 2011-2021 Jos de Jong, http://jsoneditoronline.org + * + * @author Jos de Jong, + * @version 9.5.0 + * @date 2021-06-05 + */ + +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["JSONEditor"] = factory(); + else + root["JSONEditor"] = factory(); +})(self, function() { +return /******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 897: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "x": function() { return /* binding */ ContextMenu; } +/* harmony export */ }); +/* harmony import */ var _createAbsoluteAnchor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(602); +/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(791); +/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(907); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + + + + +/** + * A context menu + * @param {Object[]} items Array containing the menu structure + * TODO: describe structure + * @param {Object} [options] Object with options. Available options: + * {function} close Callback called when the + * context menu is being closed. + * {boolean} limitHeight Whether ContextMenu height should be + * limited or not. + * @constructor + */ + +var ContextMenu = /*#__PURE__*/function () { + function ContextMenu(items, options) { + _classCallCheck(this, ContextMenu); + + this.dom = {}; + var me = this; + var dom = this.dom; + this.anchor = undefined; + this.items = items; + this.eventListeners = {}; + this.selection = undefined; // holds the selection before the menu was opened + + this.onClose = options ? options.close : undefined; + this.limitHeight = options ? options.limitHeight : false; // create root element + + var root = document.createElement('div'); + root.className = 'jsoneditor-contextmenu-root'; + dom.root = root; // create a container element + + var menu = document.createElement('div'); + menu.className = 'jsoneditor-contextmenu'; + dom.menu = menu; + root.appendChild(menu); // create a list to hold the menu items + + var list = document.createElement('ul'); + list.className = 'jsoneditor-menu'; + menu.appendChild(list); + dom.list = list; + dom.items = []; // list with all buttons + // create a (non-visible) button to set the focus to the menu + + var focusButton = document.createElement('button'); + focusButton.type = 'button'; + dom.focusButton = focusButton; + var li = document.createElement('li'); + li.style.overflow = 'hidden'; + li.style.height = '0'; + li.appendChild(focusButton); + list.appendChild(li); + + function createMenuItems(list, domItems, items) { + items.forEach(function (item) { + if (item.type === 'separator') { + // create a separator + var separator = document.createElement('div'); + separator.className = 'jsoneditor-separator'; + + var _li = document.createElement('li'); + + _li.appendChild(separator); + + list.appendChild(_li); + } else { + var domItem = {}; // create a menu item + + var _li2 = document.createElement('li'); + + list.appendChild(_li2); // create a button in the menu item + + var button = document.createElement('button'); + button.type = 'button'; + button.className = item.className; + domItem.button = button; + + if (item.title) { + button.title = item.title; + } + + if (item.click) { + button.onclick = function (event) { + event.preventDefault(); + me.hide(); + item.click(); + }; + } + + _li2.appendChild(button); // create the contents of the button + + + if (item.submenu) { + // add the icon to the button + var divIcon = document.createElement('div'); + divIcon.className = 'jsoneditor-icon'; + button.appendChild(divIcon); + var divText = document.createElement('div'); + divText.className = 'jsoneditor-text' + (item.click ? '' : ' jsoneditor-right-margin'); + divText.appendChild(document.createTextNode(item.text)); + button.appendChild(divText); + var buttonSubmenu; + + if (item.click) { + // submenu and a button with a click handler + button.className += ' jsoneditor-default'; + var buttonExpand = document.createElement('button'); + buttonExpand.type = 'button'; + domItem.buttonExpand = buttonExpand; + buttonExpand.className = 'jsoneditor-expand'; + var buttonExpandInner = document.createElement('div'); + buttonExpandInner.className = 'jsoneditor-expand'; + buttonExpand.appendChild(buttonExpandInner); + + _li2.appendChild(buttonExpand); + + if (item.submenuTitle) { + buttonExpand.title = item.submenuTitle; + } + + buttonSubmenu = buttonExpand; + } else { + // submenu and a button without a click handler + var divExpand = document.createElement('div'); + divExpand.className = 'jsoneditor-expand'; + button.appendChild(divExpand); + buttonSubmenu = button; + } // attach a handler to expand/collapse the submenu + + + buttonSubmenu.onclick = function (event) { + event.preventDefault(); + + me._onExpandItem(domItem); + + buttonSubmenu.focus(); + }; // create the submenu + + + var domSubItems = []; + domItem.subItems = domSubItems; + var ul = document.createElement('ul'); + domItem.ul = ul; + ul.className = 'jsoneditor-menu'; + ul.style.height = '0'; + + _li2.appendChild(ul); + + createMenuItems(ul, domSubItems, item.submenu); + } else { + // no submenu, just a button with clickhandler + var icon = document.createElement('div'); + icon.className = 'jsoneditor-icon'; + button.appendChild(icon); + var text = document.createElement('div'); + text.className = 'jsoneditor-text'; + text.appendChild(document.createTextNode((0,_i18n__WEBPACK_IMPORTED_MODULE_2__/* .translate */ .Iu)(item.text))); + button.appendChild(text); + } + + domItems.push(domItem); + } + }); + } + + createMenuItems(list, this.dom.items, items); // TODO: when the editor is small, show the submenu on the right instead of inline? + // calculate the max height of the menu with one submenu expanded + + this.maxHeight = 0; // height in pixels + + items.forEach(function (item) { + var height = (items.length + (item.submenu ? item.submenu.length : 0)) * 24; + me.maxHeight = Math.max(me.maxHeight, height); + }); + } + /** + * Get the currently visible buttons + * @return {Array.} buttons + * @private + */ + + + _createClass(ContextMenu, [{ + key: "_getVisibleButtons", + value: function _getVisibleButtons() { + var buttons = []; + var me = this; + this.dom.items.forEach(function (item) { + buttons.push(item.button); + + if (item.buttonExpand) { + buttons.push(item.buttonExpand); + } + + if (item.subItems && item === me.expandedItem) { + item.subItems.forEach(function (subItem) { + buttons.push(subItem.button); + + if (subItem.buttonExpand) { + buttons.push(subItem.buttonExpand); + } // TODO: change to fully recursive method + + }); + } + }); + return buttons; + } + /** + * Attach the menu to an anchor + * @param {HTMLElement} anchor Anchor where the menu will be attached as sibling. + * @param {HTMLElement} frame The root of the JSONEditor window + * @param {Boolean=} ignoreParent ignore anchor parent in regard to the calculation of the position, needed when the parent position is absolute + */ + + }, { + key: "show", + value: function show(anchor, frame, ignoreParent) { + this.hide(); // determine whether to display the menu below or above the anchor + + var showBelow = true; + var parent = anchor.parentNode; + var anchorRect = anchor.getBoundingClientRect(); + var parentRect = parent.getBoundingClientRect(); + var frameRect = frame.getBoundingClientRect(); + var me = this; + this.dom.absoluteAnchor = (0,_createAbsoluteAnchor__WEBPACK_IMPORTED_MODULE_0__/* .createAbsoluteAnchor */ .w)(anchor, frame, function () { + me.hide(); + }); + + if (anchorRect.bottom + this.maxHeight < frameRect.bottom) {// fits below -> show below + } else if (anchorRect.top - this.maxHeight > frameRect.top) { + // fits above -> show above + showBelow = false; + } else {// doesn't fit above nor below -> show below + } + + var topGap = ignoreParent ? 0 : anchorRect.top - parentRect.top; // position the menu + + if (showBelow) { + // display the menu below the anchor + var anchorHeight = anchor.offsetHeight; + this.dom.menu.style.left = '0'; + this.dom.menu.style.top = topGap + anchorHeight + 'px'; + this.dom.menu.style.bottom = ''; + } else { + // display the menu above the anchor + this.dom.menu.style.left = '0'; + this.dom.menu.style.top = ''; + this.dom.menu.style.bottom = '0px'; + } + + if (this.limitHeight) { + var margin = 10; // make sure there is a little margin left + + var maxPossibleMenuHeight = showBelow ? frameRect.bottom - anchorRect.bottom - margin : anchorRect.top - frameRect.top - margin; + this.dom.list.style.maxHeight = maxPossibleMenuHeight + 'px'; + this.dom.list.style.overflowY = 'auto'; + } // attach the menu to the temporary, absolute anchor + // parent.insertBefore(this.dom.root, anchor); + + + this.dom.absoluteAnchor.appendChild(this.dom.root); // move focus to the first button in the context menu + + this.selection = (0,_util__WEBPACK_IMPORTED_MODULE_1__.getSelection)(); + this.anchor = anchor; + setTimeout(function () { + me.dom.focusButton.focus(); + }, 0); + + if (ContextMenu.visibleMenu) { + ContextMenu.visibleMenu.hide(); + } + + ContextMenu.visibleMenu = this; + } + /** + * Hide the context menu if visible + */ + + }, { + key: "hide", + value: function hide() { + // remove temporary absolutely positioned anchor + if (this.dom.absoluteAnchor) { + this.dom.absoluteAnchor.destroy(); + delete this.dom.absoluteAnchor; + } // remove the menu from the DOM + + + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + + if (this.onClose) { + this.onClose(); + } + } + + if (ContextMenu.visibleMenu === this) { + ContextMenu.visibleMenu = undefined; + } + } + /** + * Expand a submenu + * Any currently expanded submenu will be hided. + * @param {Object} domItem + * @private + */ + + }, { + key: "_onExpandItem", + value: function _onExpandItem(domItem) { + var me = this; + var alreadyVisible = domItem === this.expandedItem; // hide the currently visible submenu + + var expandedItem = this.expandedItem; + + if (expandedItem) { + // var ul = expandedItem.ul; + expandedItem.ul.style.height = '0'; + expandedItem.ul.style.padding = ''; + setTimeout(function () { + if (me.expandedItem !== expandedItem) { + expandedItem.ul.style.display = ''; + (0,_util__WEBPACK_IMPORTED_MODULE_1__.removeClassName)(expandedItem.ul.parentNode, 'jsoneditor-selected'); + } + }, 300); // timeout duration must match the css transition duration + + this.expandedItem = undefined; + } + + if (!alreadyVisible) { + var ul = domItem.ul; + ul.style.display = 'block'; // eslint-disable-next-line no-unused-expressions + + ul.clientHeight; // force a reflow in Firefox + + setTimeout(function () { + if (me.expandedItem === domItem) { + var childsHeight = 0; + + for (var i = 0; i < ul.childNodes.length; i++) { + childsHeight += ul.childNodes[i].clientHeight; + } + + ul.style.height = childsHeight + 'px'; + ul.style.padding = '5px 10px'; + } + }, 0); + (0,_util__WEBPACK_IMPORTED_MODULE_1__.addClassName)(ul.parentNode, 'jsoneditor-selected'); + this.expandedItem = domItem; + } + } + /** + * Handle onkeydown event + * @param {Event} event + * @private + */ + + }, { + key: "_onKeyDown", + value: function _onKeyDown(event) { + var target = event.target; + var keynum = event.which; + var handled = false; + var buttons, targetIndex, prevButton, nextButton; + + if (keynum === 27) { + // ESC + // hide the menu on ESC key + // restore previous selection and focus + if (this.selection) { + (0,_util__WEBPACK_IMPORTED_MODULE_1__.setSelection)(this.selection); + } + + if (this.anchor) { + this.anchor.focus(); + } + + this.hide(); + handled = true; + } else if (keynum === 9) { + // Tab + if (!event.shiftKey) { + // Tab + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + + if (targetIndex === buttons.length - 1) { + // move to first button + buttons[0].focus(); + handled = true; + } + } else { + // Shift+Tab + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + + if (targetIndex === 0) { + // move to last button + buttons[buttons.length - 1].focus(); + handled = true; + } + } + } else if (keynum === 37) { + // Arrow Left + if (target.className === 'jsoneditor-expand') { + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + prevButton = buttons[targetIndex - 1]; + + if (prevButton) { + prevButton.focus(); + } + } + + handled = true; + } else if (keynum === 38) { + // Arrow Up + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + prevButton = buttons[targetIndex - 1]; + + if (prevButton && prevButton.className === 'jsoneditor-expand') { + // skip expand button + prevButton = buttons[targetIndex - 2]; + } + + if (!prevButton) { + // move to last button + prevButton = buttons[buttons.length - 1]; + } + + if (prevButton) { + prevButton.focus(); + } + + handled = true; + } else if (keynum === 39) { + // Arrow Right + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + nextButton = buttons[targetIndex + 1]; + + if (nextButton && nextButton.className === 'jsoneditor-expand') { + nextButton.focus(); + } + + handled = true; + } else if (keynum === 40) { + // Arrow Down + buttons = this._getVisibleButtons(); + targetIndex = buttons.indexOf(target); + nextButton = buttons[targetIndex + 1]; + + if (nextButton && nextButton.className === 'jsoneditor-expand') { + // skip expand button + nextButton = buttons[targetIndex + 2]; + } + + if (!nextButton) { + // move to first button + nextButton = buttons[0]; + } + + if (nextButton) { + nextButton.focus(); + handled = true; + } + + handled = true; + } // TODO: arrow left and right + + + if (handled) { + event.stopPropagation(); + event.preventDefault(); + } + } + }]); + + return ContextMenu; +}(); // currently displayed context menu, a singleton. We may only have one visible context menu + +ContextMenu.visibleMenu = undefined; + +/***/ }), + +/***/ 436: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Q": function() { return /* binding */ ErrorTable; } +/* harmony export */ }); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +/** + * Show errors and schema warnings in a clickable table view + * @param {Object} config + * @property {boolean} errorTableVisible + * @property {function (boolean) : void} onToggleVisibility + * @property {function (number)} [onFocusLine] + * @property {function (number)} onChangeHeight + * @constructor + */ +var ErrorTable = /*#__PURE__*/function () { + function ErrorTable(config) { + _classCallCheck(this, ErrorTable); + + this.errorTableVisible = config.errorTableVisible; + this.onToggleVisibility = config.onToggleVisibility; + + this.onFocusLine = config.onFocusLine || function () {}; + + this.onChangeHeight = config.onChangeHeight; + this.dom = {}; + var validationErrorsContainer = document.createElement('div'); + validationErrorsContainer.className = 'jsoneditor-validation-errors-container'; + this.dom.validationErrorsContainer = validationErrorsContainer; + var additionalErrorsIndication = document.createElement('div'); + additionalErrorsIndication.style.display = 'none'; + additionalErrorsIndication.className = 'jsoneditor-additional-errors fadein'; + additionalErrorsIndication.textContent = "Scroll for more \u25BF"; + this.dom.additionalErrorsIndication = additionalErrorsIndication; + validationErrorsContainer.appendChild(additionalErrorsIndication); + var validationErrorIcon = document.createElement('span'); + validationErrorIcon.className = 'jsoneditor-validation-error-icon'; + validationErrorIcon.style.display = 'none'; + this.dom.validationErrorIcon = validationErrorIcon; + var validationErrorCount = document.createElement('span'); + validationErrorCount.className = 'jsoneditor-validation-error-count'; + validationErrorCount.style.display = 'none'; + this.dom.validationErrorCount = validationErrorCount; + this.dom.parseErrorIndication = document.createElement('span'); + this.dom.parseErrorIndication.className = 'jsoneditor-parse-error-icon'; + this.dom.parseErrorIndication.style.display = 'none'; + } + + _createClass(ErrorTable, [{ + key: "getErrorTable", + value: function getErrorTable() { + return this.dom.validationErrorsContainer; + } + }, { + key: "getErrorCounter", + value: function getErrorCounter() { + return this.dom.validationErrorCount; + } + }, { + key: "getWarningIcon", + value: function getWarningIcon() { + return this.dom.validationErrorIcon; + } + }, { + key: "getErrorIcon", + value: function getErrorIcon() { + return this.dom.parseErrorIndication; + } + }, { + key: "toggleTableVisibility", + value: function toggleTableVisibility() { + this.errorTableVisible = !this.errorTableVisible; + this.onToggleVisibility(this.errorTableVisible); + } + }, { + key: "setErrors", + value: function setErrors(errors, errorLocations) { + var _this = this; + + // clear any previous errors + if (this.dom.validationErrors) { + this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors); + this.dom.validationErrors = null; + this.dom.additionalErrorsIndication.style.display = 'none'; + } // create the table with errors + // keep default behavior for parse errors + + + if (this.errorTableVisible && errors.length > 0) { + var validationErrors = document.createElement('div'); + validationErrors.className = 'jsoneditor-validation-errors'; + var table = document.createElement('table'); + table.className = 'jsoneditor-text-errors'; + validationErrors.appendChild(table); + var tbody = document.createElement('tbody'); + table.appendChild(tbody); + errors.forEach(function (error) { + var line; + + if (!isNaN(error.line)) { + line = error.line; + } else if (error.dataPath) { + var errLoc = errorLocations.find(function (loc) { + return loc.path === error.dataPath; + }); + + if (errLoc) { + line = errLoc.line + 1; + } + } + + var trEl = document.createElement('tr'); + trEl.className = !isNaN(line) ? 'jump-to-line' : ''; + + if (error.type === 'error') { + trEl.className += ' parse-error'; + } else { + trEl.className += ' validation-error'; + } + + var td1 = document.createElement('td'); + var button = document.createElement('button'); + button.className = 'jsoneditor-schema-error'; + td1.appendChild(button); + trEl.appendChild(td1); + var td2 = document.createElement('td'); + td2.style = 'white-space: nowrap;'; + td2.textContent = !isNaN(line) ? 'Ln ' + line : ''; + trEl.appendChild(td2); + + if (typeof error === 'string') { + var td34 = document.createElement('td'); + td34.colSpan = 2; + var pre = document.createElement('pre'); + pre.appendChild(document.createTextNode(error)); + td34.appendChild(pre); + trEl.appendChild(td34); + } else { + var td3 = document.createElement('td'); + td3.appendChild(document.createTextNode(error.dataPath || '')); + trEl.appendChild(td3); + var td4 = document.createElement('td'); + + var _pre = document.createElement('pre'); + + _pre.appendChild(document.createTextNode(error.message)); + + td4.appendChild(_pre); + trEl.appendChild(td4); + } + + trEl.onclick = function () { + _this.onFocusLine(line); + }; + + tbody.appendChild(trEl); + }); + this.dom.validationErrors = validationErrors; + this.dom.validationErrorsContainer.appendChild(validationErrors); + this.dom.additionalErrorsIndication.title = errors.length + ' errors total'; + + if (this.dom.validationErrorsContainer.clientHeight < this.dom.validationErrorsContainer.scrollHeight) { + this.dom.additionalErrorsIndication.style.display = 'block'; + + this.dom.validationErrorsContainer.onscroll = function () { + _this.dom.additionalErrorsIndication.style.display = _this.dom.validationErrorsContainer.clientHeight > 0 && _this.dom.validationErrorsContainer.scrollTop === 0 ? 'block' : 'none'; + }; + } else { + this.dom.validationErrorsContainer.onscroll = undefined; + } + + var height = this.dom.validationErrorsContainer.clientHeight + (this.dom.statusBar ? this.dom.statusBar.clientHeight : 0); // this.content.style.marginBottom = (-height) + 'px'; + // this.content.style.paddingBottom = height + 'px'; + + this.onChangeHeight(height); + } else { + this.onChangeHeight(0); + } // update the status bar + + + var validationErrorsCount = errors.filter(function (error) { + return error.type !== 'error'; + }).length; + + if (validationErrorsCount > 0) { + this.dom.validationErrorCount.style.display = 'inline'; + this.dom.validationErrorCount.innerText = validationErrorsCount; + this.dom.validationErrorCount.onclick = this.toggleTableVisibility.bind(this); + this.dom.validationErrorIcon.style.display = 'inline'; + this.dom.validationErrorIcon.title = validationErrorsCount + ' schema validation error(s) found'; + this.dom.validationErrorIcon.onclick = this.toggleTableVisibility.bind(this); + } else { + this.dom.validationErrorCount.style.display = 'none'; + this.dom.validationErrorIcon.style.display = 'none'; + } // update the parse error icon + + + var hasParseErrors = errors.some(function (error) { + return error.type === 'error'; + }); + + if (hasParseErrors) { + var line = errors[0].line; + this.dom.parseErrorIndication.style.display = 'block'; + this.dom.parseErrorIndication.title = !isNaN(line) ? 'parse error on line ' + line : 'parse error - check that the json is valid'; + this.dom.parseErrorIndication.onclick = this.toggleTableVisibility.bind(this); + } else { + this.dom.parseErrorIndication.style.display = 'none'; + } + } + }]); + + return ErrorTable; +}(); + +/***/ }), + +/***/ 474: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "R": function() { return /* binding */ FocusTracker; } +/* harmony export */ }); + +/** + * @constructor FocusTracker + * A custom focus tracker for a DOM element with complex internal DOM structure + * @param {[Object]} config A set of configurations for the FocusTracker + * {DOM Object} target * The DOM object to track (required) + * {Function} onFocus onFocus callback + * {Function} onBlur onBlur callback + * + * @return + */ + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var FocusTracker = /*#__PURE__*/function () { + function FocusTracker(config) { + _classCallCheck(this, FocusTracker); + + this.target = config.target || null; + + if (!this.target) { + throw new Error('FocusTracker constructor called without a "target" to track.'); + } + + this.onFocus = typeof config.onFocus === 'function' ? config.onFocus : null; + this.onBlur = typeof config.onBlur === 'function' ? config.onBlur : null; + this._onClick = this._onEvent.bind(this); + + this._onKeyUp = function (event) { + if (event.which === 9 || event.keyCode === 9) { + this._onEvent(event); + } + }.bind(this); + + this.focusFlag = false; + this.firstEventFlag = true; + /* + Adds required (click and keyup) event listeners to the 'document' object + to track the focus of the given 'target' + */ + + if (this.onFocus || this.onBlur) { + document.addEventListener('click', this._onClick); + document.addEventListener('keyup', this._onKeyUp); + } + } + /** + * Removes the event listeners on the 'document' object + * that were added to track the focus of the given 'target' + */ + + + _createClass(FocusTracker, [{ + key: "destroy", + value: function destroy() { + document.removeEventListener('click', this._onClick); + document.removeEventListener('keyup', this._onKeyUp); + + this._onEvent({ + target: document.body + }); // calling _onEvent with body element in the hope that the FocusTracker is added to an element inside the body tag + + } + /** + * Tracks the focus of the target and calls the onFocus and onBlur + * event callbacks if available. + * @param {Event} [event] The 'click' or 'keyup' event object, + * from the respective events set on + * document object + * @private + */ + + }, { + key: "_onEvent", + value: function _onEvent(event) { + var target = event.target; + var focusFlag; + + if (target === this.target) { + focusFlag = true; + } else if (this.target.contains(target) || this.target.contains(document.activeElement)) { + focusFlag = true; + } else { + focusFlag = false; + } + + if (focusFlag) { + if (!this.focusFlag) { + // trigger the onFocus callback + if (this.onFocus) { + this.onFocus({ + type: 'focus', + target: this.target + }); + } + + this.focusFlag = true; + } + } else { + if (this.focusFlag || this.firstEventFlag) { + // trigger the onBlur callback + if (this.onBlur) { + this.onBlur({ + type: 'blur', + target: this.target + }); + } + + this.focusFlag = false; + /* + When switching from one mode to another in the editor, the FocusTracker gets recreated. + At that time, this.focusFlag will be init to 'false' and will fail the above if condition, when blur occurs + this.firstEventFlag is added to overcome that issue + */ + + if (this.firstEventFlag) { + this.firstEventFlag = false; + } + } + } + } + }]); + + return FocusTracker; +}(); + +/***/ }), + +/***/ 161: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var ace = __webpack_require__(170); // may be undefined in case of minimalist bundle + + +var VanillaPicker = __webpack_require__(37); // may be undefined in case of minimalist bundle + + +var _require = __webpack_require__(38), + treeModeMixins = _require.treeModeMixins; + +var _require2 = __webpack_require__(956), + textModeMixins = _require2.textModeMixins; + +var _require3 = __webpack_require__(341), + previewModeMixins = _require3.previewModeMixins; + +var _require4 = __webpack_require__(791), + clear = _require4.clear, + extend = _require4.extend, + getInnerText = _require4.getInnerText, + getInternetExplorerVersion = _require4.getInternetExplorerVersion, + parse = _require4.parse; + +var _require5 = __webpack_require__(744), + tryRequireAjv = _require5.tryRequireAjv; + +var _require6 = __webpack_require__(558), + showTransformModal = _require6.showTransformModal; + +var _require7 = __webpack_require__(210), + showSortModal = _require7.showSortModal; + +var Ajv = tryRequireAjv(); + +if (typeof Promise === 'undefined') { + console.error('Promise undefined. Please load a Promise polyfill in the browser in order to use JSONEditor'); +} +/** + * @constructor JSONEditor + * @param {Element} container Container element + * @param {Object} [options] Object with options. available options: + * {String} mode Editor mode. Available values: + * 'tree' (default), 'view', + * 'form', 'text', and 'code'. + * {function} onChange Callback method, triggered + * on change of contents. + * Does not pass the contents itself. + * See also `onChangeJSON` and + * `onChangeText`. + * {function} onChangeJSON Callback method, triggered + * in modes on change of contents, + * passing the changed contents + * as JSON. + * Only applicable for modes + * 'tree', 'view', and 'form'. + * {function} onChangeText Callback method, triggered + * in modes on change of contents, + * passing the changed contents + * as stringified JSON. + * {function} onError Callback method, triggered + * when an error occurs + * {Boolean} search Enable search box. + * True by default + * Only applicable for modes + * 'tree', 'view', and 'form' + * {Boolean} history Enable history (undo/redo). + * True by default + * Only applicable for modes + * 'tree', 'view', and 'form' + * {String} name Field name for the root node. + * Only applicable for modes + * 'tree', 'view', and 'form' + * {Number} indentation Number of indentation + * spaces. 4 by default. + * Only applicable for + * modes 'text' and 'code' + * {boolean} escapeUnicode If true, unicode + * characters are escaped. + * false by default. + * {boolean} sortObjectKeys If true, object keys are + * sorted before display. + * false by default. + * {function} onSelectionChange Callback method, + * triggered on node selection change + * Only applicable for modes + * 'tree', 'view', and 'form' + * {function} onTextSelectionChange Callback method, + * triggered on text selection change + * Only applicable for modes + * {HTMLElement} modalAnchor The anchor element to apply an + * overlay and display the modals in a + * centered location. + * Defaults to document.body + * 'text' and 'code' + * {function} onEvent Callback method, triggered + * when an event occurs in + * a JSON field or value. + * Only applicable for + * modes 'form', 'tree' and + * 'view' + * {function} onFocus Callback method, triggered + * when the editor comes into focus, + * passing an object {type, target}, + * Applicable for all modes + * {function} onBlur Callback method, triggered + * when the editor goes out of focus, + * passing an object {type, target}, + * Applicable for all modes + * {function} onClassName Callback method, triggered + * when a Node DOM is rendered. Function returns + * a css class name to be set on a node. + * Only applicable for + * modes 'form', 'tree' and + * 'view' + * {Number} maxVisibleChilds Number of children allowed for a node + * in 'tree', 'view', or 'form' mode before + * the "show more/show all" buttons appear. + * 100 by default. + * + * @param {Object | undefined} json JSON object + */ + + +function JSONEditor(container, options, json) { + if (!(this instanceof JSONEditor)) { + throw new Error('JSONEditor constructor called without "new".'); + } // check for unsupported browser (IE8 and older) + + + var ieVersion = getInternetExplorerVersion(); + + if (ieVersion !== -1 && ieVersion < 9) { + throw new Error('Unsupported browser, IE9 or newer required. ' + 'Please install the newest version of your browser.'); + } + + if (options) { + // check for deprecated options + if (options.error) { + console.warn('Option "error" has been renamed to "onError"'); + options.onError = options.error; + delete options.error; + } + + if (options.change) { + console.warn('Option "change" has been renamed to "onChange"'); + options.onChange = options.change; + delete options.change; + } + + if (options.editable) { + console.warn('Option "editable" has been renamed to "onEditable"'); + options.onEditable = options.editable; + delete options.editable; + } // warn if onChangeJSON is used when mode can be `text` or `code` + + + if (options.onChangeJSON) { + if (options.mode === 'text' || options.mode === 'code' || options.modes && (options.modes.indexOf('text') !== -1 || options.modes.indexOf('code') !== -1)) { + console.warn('Option "onChangeJSON" is not applicable to modes "text" and "code". ' + 'Use "onChangeText" or "onChange" instead.'); + } + } // validate options + + + if (options) { + Object.keys(options).forEach(function (option) { + if (JSONEditor.VALID_OPTIONS.indexOf(option) === -1) { + console.warn('Unknown option "' + option + '". This option will be ignored'); + } + }); + } + } + + if (arguments.length) { + this._create(container, options, json); + } +} +/** + * Configuration for all registered modes. Example: + * { + * tree: { + * mixin: TreeEditor, + * data: 'json' + * }, + * text: { + * mixin: TextEditor, + * data: 'text' + * } + * } + * + * @type { Object. } + */ + + +JSONEditor.modes = {}; // debounce interval for JSON schema validation in milliseconds + +JSONEditor.prototype.DEBOUNCE_INTERVAL = 150; +JSONEditor.VALID_OPTIONS = ['ajv', 'schema', 'schemaRefs', 'templates', 'ace', 'theme', 'autocomplete', 'onChange', 'onChangeJSON', 'onChangeText', 'onEditable', 'onError', 'onEvent', 'onModeChange', 'onNodeName', 'onValidate', 'onCreateMenu', 'onSelectionChange', 'onTextSelectionChange', 'onClassName', 'onFocus', 'onBlur', 'colorPicker', 'onColorPicker', 'timestampTag', 'timestampFormat', 'escapeUnicode', 'history', 'search', 'mode', 'modes', 'name', 'indentation', 'sortObjectKeys', 'navigationBar', 'statusBar', 'mainMenuBar', 'languages', 'language', 'enableSort', 'enableTransform', 'limitDragging', 'maxVisibleChilds', 'onValidationError', 'modalAnchor', 'popupAnchor', 'createQuery', 'executeQuery', 'queryDescription']; +/** + * Create the JSONEditor + * @param {Element} container Container element + * @param {Object} [options] See description in constructor + * @param {Object | undefined} json JSON object + * @private + */ + +JSONEditor.prototype._create = function (container, options, json) { + this.container = container; + this.options = options || {}; + this.json = json || {}; + var mode = this.options.mode || this.options.modes && this.options.modes[0] || 'tree'; + this.setMode(mode); +}; +/** + * Destroy the editor. Clean up DOM, event listeners, and web workers. + */ + + +JSONEditor.prototype.destroy = function () {}; +/** + * Set JSON object in editor + * @param {Object | undefined} json JSON data + */ + + +JSONEditor.prototype.set = function (json) { + this.json = json; +}; +/** + * Get JSON from the editor + * @returns {Object} json + */ + + +JSONEditor.prototype.get = function () { + return this.json; +}; +/** + * Set string containing JSON for the editor + * @param {String | undefined} jsonText + */ + + +JSONEditor.prototype.setText = function (jsonText) { + this.json = parse(jsonText); +}; +/** + * Get stringified JSON contents from the editor + * @returns {String} jsonText + */ + + +JSONEditor.prototype.getText = function () { + return JSON.stringify(this.json); +}; +/** + * Set a field name for the root node. + * @param {String | undefined} name + */ + + +JSONEditor.prototype.setName = function (name) { + if (!this.options) { + this.options = {}; + } + + this.options.name = name; +}; +/** + * Get the field name for the root node. + * @return {String | undefined} name + */ + + +JSONEditor.prototype.getName = function () { + return this.options && this.options.name; +}; +/** + * Change the mode of the editor. + * JSONEditor will be extended with all methods needed for the chosen mode. + * @param {String} mode Available modes: 'tree' (default), 'view', 'form', + * 'text', and 'code'. + */ + + +JSONEditor.prototype.setMode = function (mode) { + // if the mode is the same as current mode (and it's not the first time), do nothing. + if (mode === this.options.mode && this.create) { + return; + } + + var container = this.container; + var options = extend({}, this.options); + var oldMode = options.mode; + var data; + var name; + options.mode = mode; + var config = JSONEditor.modes[mode]; + + if (config) { + try { + var asText = config.data === 'text'; + name = this.getName(); + data = this[asText ? 'getText' : 'get'](); // get text or json + + this.destroy(); + clear(this); + extend(this, config.mixin); + this.create(container, options); + this.setName(name); + this[asText ? 'setText' : 'set'](data); // set text or json + + if (typeof config.load === 'function') { + try { + config.load.call(this); + } catch (err) { + console.error(err); + } + } + + if (typeof options.onModeChange === 'function' && mode !== oldMode) { + try { + options.onModeChange(mode, oldMode); + } catch (err) { + console.error(err); + } + } + } catch (err) { + this._onError(err); + } + } else { + throw new Error('Unknown mode "' + options.mode + '"'); + } +}; +/** + * Get the current mode + * @return {string} + */ + + +JSONEditor.prototype.getMode = function () { + return this.options.mode; +}; +/** + * Throw an error. If an error callback is configured in options.error, this + * callback will be invoked. Else, a regular error is thrown. + * @param {Error} err + * @private + */ + + +JSONEditor.prototype._onError = function (err) { + if (this.options && typeof this.options.onError === 'function') { + this.options.onError(err); + } else { + throw err; + } +}; +/** + * Set a JSON schema for validation of the JSON object. + * To remove the schema, call JSONEditor.setSchema(null) + * @param {Object | null} schema + * @param {Object.=} schemaRefs Schemas that are referenced using the `$ref` property from the JSON schema that are set in the `schema` option, + + the object structure in the form of `{reference_key: schemaObject}` + */ + + +JSONEditor.prototype.setSchema = function (schema, schemaRefs) { + // compile a JSON schema validator if a JSON schema is provided + if (schema) { + var ajv; + + try { + // grab ajv from options if provided, else create a new instance + if (this.options.ajv) { + ajv = this.options.ajv; + } else { + ajv = Ajv({ + allErrors: true, + verbose: true, + schemaId: 'auto', + $data: true + }); // support both draft-04 and draft-06 alongside the latest draft-07 + + ajv.addMetaSchema(__webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'ajv/lib/refs/json-schema-draft-04.json'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()))); + ajv.addMetaSchema(__webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'ajv/lib/refs/json-schema-draft-06.json'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()))); + } + } catch (err) { + console.warn('Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`.'); + } + + if (ajv) { + if (schemaRefs) { + for (var ref in schemaRefs) { + ajv.removeSchema(ref); // When updating a schema - old refs has to be removed first + + if (schemaRefs[ref]) { + ajv.addSchema(schemaRefs[ref], ref); + } + } + + this.options.schemaRefs = schemaRefs; + } + + this.validateSchema = ajv.compile(schema); // add schema to the options, so that when switching to an other mode, + // the set schema is not lost + + this.options.schema = schema; // validate now + + this.validate(); + } + + this.refresh(); // update DOM + } else { + // remove current schema + this.validateSchema = null; + this.options.schema = null; + this.options.schemaRefs = null; + this.validate(); // to clear current error messages + + this.refresh(); // update DOM + } +}; +/** + * Validate current JSON object against the configured JSON schema + * Throws an exception when no JSON schema is configured + */ + + +JSONEditor.prototype.validate = function () {// must be implemented by treemode and textmode +}; +/** + * Refresh the rendered contents + */ + + +JSONEditor.prototype.refresh = function () {// can be implemented by treemode and textmode +}; +/** + * Register a plugin with one ore multiple modes for the JSON Editor. + * + * A mode is described as an object with properties: + * + * - `mode: String` The name of the mode. + * - `mixin: Object` An object containing the mixin functions which + * will be added to the JSONEditor. Must contain functions + * create, get, getText, set, and setText. May have + * additional functions. + * When the JSONEditor switches to a mixin, all mixin + * functions are added to the JSONEditor, and then + * the function `create(container, options)` is executed. + * - `data: 'text' | 'json'` The type of data that will be used to load the mixin. + * - `[load: function]` An optional function called after the mixin + * has been loaded. + * + * @param {Object | Array} mode A mode object or an array with multiple mode objects. + */ + + +JSONEditor.registerMode = function (mode) { + var i, prop; + + if (Array.isArray(mode)) { + // multiple modes + for (i = 0; i < mode.length; i++) { + JSONEditor.registerMode(mode[i]); + } + } else { + // validate the new mode + if (!('mode' in mode)) throw new Error('Property "mode" missing'); + if (!('mixin' in mode)) throw new Error('Property "mixin" missing'); + if (!('data' in mode)) throw new Error('Property "data" missing'); + var name = mode.mode; + + if (name in JSONEditor.modes) { + throw new Error('Mode "' + name + '" already registered'); + } // validate the mixin + + + if (typeof mode.mixin.create !== 'function') { + throw new Error('Required function "create" missing on mixin'); + } + + var reserved = ['setMode', 'registerMode', 'modes']; + + for (i = 0; i < reserved.length; i++) { + prop = reserved[i]; + + if (prop in mode.mixin) { + throw new Error('Reserved property "' + prop + '" not allowed in mixin'); + } + } + + JSONEditor.modes[name] = mode; + } +}; // register tree, text, and preview modes + + +JSONEditor.registerMode(treeModeMixins); +JSONEditor.registerMode(textModeMixins); +JSONEditor.registerMode(previewModeMixins); // expose some of the libraries that can be used customized + +JSONEditor.ace = ace; +JSONEditor.Ajv = Ajv; +JSONEditor.VanillaPicker = VanillaPicker; // expose some utils (this is undocumented, unofficial) + +JSONEditor.showTransformModal = showTransformModal; +JSONEditor.showSortModal = showSortModal; +JSONEditor.getInnerText = getInnerText; // default export for TypeScript ES6 projects + +JSONEditor["default"] = JSONEditor; +module.exports = JSONEditor; + +/***/ }), + +/***/ 617: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "x": function() { return /* binding */ ModeSwitcher; } +/* harmony export */ }); +/* harmony import */ var _ContextMenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(897); +/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(907); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + + + +/** + * Create a select box to be used in the editor menu's, which allows to switch mode + * @param {HTMLElement} container + * @param {String[]} modes Available modes: 'code', 'form', 'text', 'tree', 'view', 'preview' + * @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view', 'preview' + * @param {function(mode: string)} onSwitch Callback invoked on switch + * @constructor + */ + +var ModeSwitcher = /*#__PURE__*/function () { + function ModeSwitcher(container, modes, current, onSwitch) { + _classCallCheck(this, ModeSwitcher); + + // available modes + var availableModes = { + code: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeCodeText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeCodeTitle'), + click: function click() { + onSwitch('code'); + } + }, + form: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeFormText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeFormTitle'), + click: function click() { + onSwitch('form'); + } + }, + text: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeTextText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeTextTitle'), + click: function click() { + onSwitch('text'); + } + }, + tree: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeTreeText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeTreeTitle'), + click: function click() { + onSwitch('tree'); + } + }, + view: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeViewText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeViewTitle'), + click: function click() { + onSwitch('view'); + } + }, + preview: { + text: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modePreviewText'), + title: (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modePreviewTitle'), + click: function click() { + onSwitch('preview'); + } + } + }; // list the selected modes + + var items = []; + + for (var i = 0; i < modes.length; i++) { + var mode = modes[i]; + var item = availableModes[mode]; + + if (!item) { + throw new Error('Unknown mode "' + mode + '"'); + } + + item.className = 'jsoneditor-type-modes' + (current === mode ? ' jsoneditor-selected' : ''); + items.push(item); + } // retrieve the title of current mode + + + var currentMode = availableModes[current]; + + if (!currentMode) { + throw new Error('Unknown mode "' + current + '"'); + } + + var currentTitle = currentMode.text; // create the html element + + var box = document.createElement('button'); + box.type = 'button'; + box.className = 'jsoneditor-modes jsoneditor-separator'; + box.textContent = currentTitle + " \u25BE"; + box.title = (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('modeEditorTitle'); + + box.onclick = function () { + var menu = new _ContextMenu__WEBPACK_IMPORTED_MODULE_0__/* .ContextMenu */ .x(items); + menu.show(box, container); + }; + + var frame = document.createElement('div'); + frame.className = 'jsoneditor-modes'; + frame.style.position = 'relative'; + frame.appendChild(box); + container.appendChild(frame); + this.dom = { + container: container, + box: box, + frame: frame + }; + } + /** + * Set focus to switcher + */ + + + _createClass(ModeSwitcher, [{ + key: "focus", + value: function focus() { + this.dom.box.focus(); + } + /** + * Destroy the ModeSwitcher, remove from DOM + */ + + }, { + key: "destroy", + value: function destroy() { + if (this.dom && this.dom.frame && this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + + this.dom = null; + } + }]); + + return ModeSwitcher; +}(); + +/***/ }), + +/***/ 170: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var ace; + +if (window.ace) { + // use the already loaded instance of Ace + ace = window.ace; +} else { + try { + // load Ace editor + ace = __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'ace-builds/src-noconflict/ace'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); // load required Ace plugins + + __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'ace-builds/src-noconflict/mode-json'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + + __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module 'ace-builds/src-noconflict/ext-searchbox'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); // embed Ace json worker + // https://github.com/ajaxorg/ace/issues/3913 + + + var jsonWorkerDataUrl = __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module '../generated/worker-json-data-url'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + + ace.config.setModuleUrl('ace/mode/json_worker', jsonWorkerDataUrl); + } catch (err) {// failed to load Ace (can be minimalist bundle). + // No worries, the editor will fall back to plain text if needed. + } +} + +module.exports = ace; + +/***/ }), + +/***/ 864: +/***/ (function() { + +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ***** END LICENSE BLOCK ***** */ +window.ace.define('ace/theme/jsoneditor', ['require', 'exports', 'module', 'ace/lib/dom'], function (acequire, exports, module) { + exports.isDark = false; + exports.cssClass = 'ace-jsoneditor'; + exports.cssText = ".ace-jsoneditor .ace_gutter {\nbackground: #ebebeb;\ncolor: #333\n}\n\n.ace-jsoneditor.ace_editor {\nfont-family: \"dejavu sans mono\", \"droid sans mono\", consolas, monaco, \"lucida console\", \"courier new\", courier, monospace, sans-serif;\nline-height: 1.3;\nbackground-color: #fff;\n}\n.ace-jsoneditor .ace_print-margin {\nwidth: 1px;\nbackground: #e8e8e8\n}\n.ace-jsoneditor .ace_scroller {\nbackground-color: #FFFFFF\n}\n.ace-jsoneditor .ace_text-layer {\ncolor: gray\n}\n.ace-jsoneditor .ace_variable {\ncolor: #1a1a1a\n}\n.ace-jsoneditor .ace_cursor {\nborder-left: 2px solid #000000\n}\n.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\nborder-left: 0px;\nborder-bottom: 1px solid #000000\n}\n.ace-jsoneditor .ace_marker-layer .ace_selection {\nbackground: lightgray\n}\n.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\nbox-shadow: 0 0 3px 0px #FFFFFF;\nborder-radius: 2px\n}\n.ace-jsoneditor .ace_marker-layer .ace_step {\nbackground: rgb(255, 255, 0)\n}\n.ace-jsoneditor .ace_marker-layer .ace_bracket {\nmargin: -1px 0 0 -1px;\nborder: 1px solid #BFBFBF\n}\n.ace-jsoneditor .ace_marker-layer .ace_active-line {\nbackground: #FFFBD1\n}\n.ace-jsoneditor .ace_gutter-active-line {\nbackground-color : #dcdcdc\n}\n.ace-jsoneditor .ace_marker-layer .ace_selected-word {\nborder: 1px solid lightgray\n}\n.ace-jsoneditor .ace_invisible {\ncolor: #BFBFBF\n}\n.ace-jsoneditor .ace_keyword,\n.ace-jsoneditor .ace_meta,\n.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\ncolor: #AF956F\n}\n.ace-jsoneditor .ace_keyword.ace_operator {\ncolor: #484848\n}\n.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\ncolor: #96DC5F\n}\n.ace-jsoneditor .ace_constant.ace_language {\ncolor: darkorange\n}\n.ace-jsoneditor .ace_constant.ace_numeric {\ncolor: red\n}\n.ace-jsoneditor .ace_constant.ace_character.ace_entity {\ncolor: #BF78CC\n}\n.ace-jsoneditor .ace_invalid {\ncolor: #FFFFFF;\nbackground-color: #FF002A;\n}\n.ace-jsoneditor .ace_fold {\nbackground-color: #AF956F;\nborder-color: #000000\n}\n.ace-jsoneditor .ace_storage,\n.ace-jsoneditor .ace_support.ace_class,\n.ace-jsoneditor .ace_support.ace_function,\n.ace-jsoneditor .ace_support.ace_other,\n.ace-jsoneditor .ace_support.ace_type {\ncolor: #C52727\n}\n.ace-jsoneditor .ace_string {\ncolor: green\n}\n.ace-jsoneditor .ace_comment {\ncolor: #BCC8BA\n}\n.ace-jsoneditor .ace_entity.ace_name.ace_tag,\n.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\ncolor: #606060\n}\n.ace-jsoneditor .ace_markup.ace_underline {\ntext-decoration: underline\n}\n.ace-jsoneditor .ace_indent-guide {\nbackground: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y\n}"; + var dom = acequire('../lib/dom'); + dom.importCssString(exports.cssText, exports.cssClass); +}); + +/***/ }), + +/***/ 589: +/***/ (function(__unused_webpack_module, exports) { + +/* Jison generated parser */ +var jsonlint = function () { + var parser = { + trace: function trace() {}, + yy: {}, + symbols_: { + "error": 2, + "JSONString": 3, + "STRING": 4, + "JSONNumber": 5, + "NUMBER": 6, + "JSONNullLiteral": 7, + "NULL": 8, + "JSONBooleanLiteral": 9, + "TRUE": 10, + "FALSE": 11, + "JSONText": 12, + "JSONValue": 13, + "EOF": 14, + "JSONObject": 15, + "JSONArray": 16, + "{": 17, + "}": 18, + "JSONMemberList": 19, + "JSONMember": 20, + ":": 21, + ",": 22, + "[": 23, + "]": 24, + "JSONElementList": 25, + "$accept": 0, + "$end": 1 + }, + terminals_: { + 2: "error", + 4: "STRING", + 6: "NUMBER", + 8: "NULL", + 10: "TRUE", + 11: "FALSE", + 14: "EOF", + 17: "{", + 18: "}", + 21: ":", + 22: ",", + 23: "[", + 24: "]" + }, + productions_: [0, [3, 1], [5, 1], [7, 1], [9, 1], [9, 1], [12, 2], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [15, 2], [15, 3], [20, 3], [19, 1], [19, 3], [16, 2], [16, 3], [25, 1], [25, 3]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + + switch (yystate) { + case 1: + // replace escaped characters with actual character + this.$ = yytext.replace(/\\(\\|")/g, "$" + "1").replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\v/g, '\v').replace(/\\f/g, '\f').replace(/\\b/g, '\b'); + break; + + case 2: + this.$ = Number(yytext); + break; + + case 3: + this.$ = null; + break; + + case 4: + this.$ = true; + break; + + case 5: + this.$ = false; + break; + + case 6: + return this.$ = $$[$0 - 1]; + break; + + case 13: + this.$ = {}; + break; + + case 14: + this.$ = $$[$0 - 1]; + break; + + case 15: + this.$ = [$$[$0 - 2], $$[$0]]; + break; + + case 16: + this.$ = {}; + this.$[$$[$0][0]] = $$[$0][1]; + break; + + case 17: + this.$ = $$[$0 - 2]; + $$[$0 - 2][$$[$0][0]] = $$[$0][1]; + break; + + case 18: + this.$ = []; + break; + + case 19: + this.$ = $$[$0 - 1]; + break; + + case 20: + this.$ = [$$[$0]]; + break; + + case 21: + this.$ = $$[$0 - 2]; + $$[$0 - 2].push($$[$0]); + break; + } + }, + table: [{ + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 12: 1, + 13: 2, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, { + 1: [3] + }, { + 14: [1, 16] + }, { + 14: [2, 7], + 18: [2, 7], + 22: [2, 7], + 24: [2, 7] + }, { + 14: [2, 8], + 18: [2, 8], + 22: [2, 8], + 24: [2, 8] + }, { + 14: [2, 9], + 18: [2, 9], + 22: [2, 9], + 24: [2, 9] + }, { + 14: [2, 10], + 18: [2, 10], + 22: [2, 10], + 24: [2, 10] + }, { + 14: [2, 11], + 18: [2, 11], + 22: [2, 11], + 24: [2, 11] + }, { + 14: [2, 12], + 18: [2, 12], + 22: [2, 12], + 24: [2, 12] + }, { + 14: [2, 3], + 18: [2, 3], + 22: [2, 3], + 24: [2, 3] + }, { + 14: [2, 4], + 18: [2, 4], + 22: [2, 4], + 24: [2, 4] + }, { + 14: [2, 5], + 18: [2, 5], + 22: [2, 5], + 24: [2, 5] + }, { + 14: [2, 1], + 18: [2, 1], + 21: [2, 1], + 22: [2, 1], + 24: [2, 1] + }, { + 14: [2, 2], + 18: [2, 2], + 22: [2, 2], + 24: [2, 2] + }, { + 3: 20, + 4: [1, 12], + 18: [1, 17], + 19: 18, + 20: 19 + }, { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 23, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15], + 24: [1, 21], + 25: 22 + }, { + 1: [2, 6] + }, { + 14: [2, 13], + 18: [2, 13], + 22: [2, 13], + 24: [2, 13] + }, { + 18: [1, 24], + 22: [1, 25] + }, { + 18: [2, 16], + 22: [2, 16] + }, { + 21: [1, 26] + }, { + 14: [2, 18], + 18: [2, 18], + 22: [2, 18], + 24: [2, 18] + }, { + 22: [1, 28], + 24: [1, 27] + }, { + 22: [2, 20], + 24: [2, 20] + }, { + 14: [2, 14], + 18: [2, 14], + 22: [2, 14], + 24: [2, 14] + }, { + 3: 20, + 4: [1, 12], + 20: 29 + }, { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 30, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, { + 14: [2, 19], + 18: [2, 19], + 22: [2, 19], + 24: [2, 19] + }, { + 3: 5, + 4: [1, 12], + 5: 6, + 6: [1, 13], + 7: 3, + 8: [1, 9], + 9: 4, + 10: [1, 10], + 11: [1, 11], + 13: 31, + 15: 7, + 16: 8, + 17: [1, 14], + 23: [1, 15] + }, { + 18: [2, 17], + 22: [2, 17] + }, { + 18: [2, 15], + 22: [2, 15] + }, { + 22: [2, 21], + 24: [2, 21] + }], + defaultActions: { + 16: [2, 6] + }, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], + // semantic value stack + lstack = [], + // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + if (typeof this.yy.parseError === 'function') this.parseError = this.yy.parseError; + + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || 1; // $end = 1 + // if token isn't its numeric value, convert + + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + return token; + } + + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + + while (true) { + // retreive state number from top of stack + state = stack[stack.length - 1]; // use default actions if available + + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol == null) symbol = lex(); // read action for current state and first input + + action = table[state] && table[state][symbol]; + } // handle parse error + + + _handle_error: if (typeof action === 'undefined' || !action.length || !action[0]) { + if (!recovering) { + // Report error + expected = []; + + for (p in table[state]) { + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + + var errStr = ''; + + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + this.terminals_[symbol] + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + (symbol == 1 + /*EOF*/ + ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + + this.parseError(errStr, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected + }); + } // just recovered from another error + + + if (recovering == 3) { + if (symbol == EOF) { + throw new Error(errStr || 'Parsing halted.'); + } // discard current lookahead and grab another + + + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } // try to recover from error + + + while (1) { + // check for error recovery rule in this state + if (TERROR.toString() in table[state]) { + break; + } + + if (state == 0) { + throw new Error(errStr || 'Parsing halted.'); + } + + popStack(1); + state = stack[stack.length - 1]; + } + + preErrorSymbol = symbol; // save the lookahead token + + symbol = TERROR; // insert generic error symbol as new lookahead + + state = stack[stack.length - 1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } // this shouldn't happen, unless resolve defaults are off + + + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + + switch (action[0]) { + case 1: + // shift + //this.shiftCount++; + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + + symbol = null; + + if (!preErrorSymbol) { + // normal execution/no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) recovering--; + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + + break; + + case 2: + // reduce + //this.reductionCount++; + len = this.productions_[action[1]][1]; // perform semantic action + + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + + if (typeof r !== 'undefined') { + return r; + } // pop off stack + + + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + + vstack.push(yyval.$); + lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] + + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + + case 3: + // accept + return true; + } + } + + return true; + } + }; + /* Jison generated lexer */ + + var lexer = function () { + var lexer = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parseError) { + this.yy.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function setInput(input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + return this; + }, + input: function input() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/\n/); + if (lines) this.yylineno++; + this._input = this._input.slice(1); + return ch; + }, + unput: function unput(ch) { + this._input = ch + this._input; + return this; + }, + more: function more() { + this._more = true; + return this; + }, + less: function less(n) { + this._input = this.match.slice(n) + this._input; + }, + pastInput: function pastInput() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput: function upcomingInput() { + var next = this.match; + + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + + return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + showPosition: function showPosition() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + next: function next() { + if (this.done) { + return this.EOF; + } + + if (!this._input) this.done = true; + var token, match, tempMatch, index, col, lines; + + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + + var rules = this._currentRules(); + + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + + if (match) { + lines = match[0].match(/\n.*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - 1 : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.yyleng = this.yytext.length; + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) this.done = false; + if (token) return token;else return; + } + + if (this._input === "") { + return this.EOF; + } else { + this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + lex: function lex() { + var r = this.next(); + + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + return this.conditionStack.pop(); + }, + _currentRules: function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + }, + topState: function topState() { + return this.conditionStack[this.conditionStack.length - 2]; + }, + pushState: function begin(condition) { + this.begin(condition); + } + }; + lexer.options = {}; + + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + + switch ($avoiding_name_collisions) { + case 0: + /* skip whitespace */ + break; + + case 1: + return 6; + break; + + case 2: + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); + return 4; + break; + + case 3: + return 17; + break; + + case 4: + return 18; + break; + + case 5: + return 23; + break; + + case 6: + return 24; + break; + + case 7: + return 22; + break; + + case 8: + return 21; + break; + + case 9: + return 10; + break; + + case 10: + return 11; + break; + + case 11: + return 8; + break; + + case 12: + return 14; + break; + + case 13: + return 'INVALID'; + break; + } + }; + + lexer.rules = [/^(?:\s+)/, /^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/, /^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/, /^(?:\{)/, /^(?:\})/, /^(?:\[)/, /^(?:\])/, /^(?:,)/, /^(?::)/, /^(?:true\b)/, /^(?:false\b)/, /^(?:null\b)/, /^(?:$)/, /^(?:.)/]; + lexer.conditions = { + "INITIAL": { + "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], + "inclusive": true + } + }; + ; + return lexer; + }(); + + parser.lexer = lexer; + return parser; +}(); + +if (true) { + exports.parser = jsonlint; + exports.parse = jsonlint.parse.bind(jsonlint); +} + +/***/ }), + +/***/ 879: +/***/ (function(module) { + +"use strict"; +/*! + * Selectr 2.4.0 + * https://github.com/Mobius1/Selectr + * + * Released under the MIT license + */ + +/** + * Default configuration options + * @type {Object} + */ + +var defaultConfig = { + /** + * Emulates browser behaviour by selecting the first option by default + * @type {Boolean} + */ + defaultSelected: true, + + /** + * Sets the width of the container + * @type {String} + */ + width: "auto", + + /** + * Enables/ disables the container + * @type {Boolean} + */ + disabled: false, + + /** + * Enables / disables the search function + * @type {Boolean} + */ + searchable: true, + + /** + * Enable disable the clear button + * @type {Boolean} + */ + clearable: false, + + /** + * Sort the tags / multiselect options + * @type {Boolean} + */ + sortSelected: false, + + /** + * Allow deselecting of select-one options + * @type {Boolean} + */ + allowDeselect: false, + + /** + * Close the dropdown when scrolling (@AlexanderReiswich, #11) + * @type {Boolean} + */ + closeOnScroll: false, + + /** + * Allow the use of the native dropdown (@jonnyscholes, #14) + * @type {Boolean} + */ + nativeDropdown: false, + + /** + * Set the main placeholder + * @type {String} + */ + placeholder: "Select an option...", + + /** + * Allow the tagging feature + * @type {Boolean} + */ + taggable: false, + + /** + * Set the tag input placeholder (@labikmartin, #21, #22) + * @type {String} + */ + tagPlaceholder: "Enter a tag..." +}; +/** + * Event Emitter + */ + +var Events = function Events() {}; +/** + * Event Prototype + * @type {Object} + */ + + +Events.prototype = { + /** + * Add custom event listener + * @param {String} event Event type + * @param {Function} func Callback + * @return {Void} + */ + on: function on(event, func) { + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + + this._events[event].push(func); + }, + + /** + * Remove custom event listener + * @param {String} event Event type + * @param {Function} func Callback + * @return {Void} + */ + off: function off(event, func) { + this._events = this._events || {}; + if (event in this._events === false) return; + + this._events[event].splice(this._events[event].indexOf(func), 1); + }, + + /** + * Fire a custom event + * @param {String} event Event type + * @return {Void} + */ + emit: function emit(event + /* , args... */ + ) { + this._events = this._events || {}; + if (event in this._events === false) return; + + for (var i = 0; i < this._events[event].length; i++) { + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + } +}; +/** + * Event mixin + * @param {Object} obj + * @return {Object} + */ + +Events.mixin = function (obj) { + var props = ['on', 'off', 'emit']; + + for (var i = 0; i < props.length; i++) { + if (typeof obj === 'function') { + obj.prototype[props[i]] = Events.prototype[props[i]]; + } else { + obj[props[i]] = Events.prototype[props[i]]; + } + } + + return obj; +}; +/** + * Helpers + * @type {Object} + */ + + +var util = { + extend: function extend(src, props) { + props = props || {}; + var p; + + for (p in src) { + if (src.hasOwnProperty(p)) { + if (!props.hasOwnProperty(p)) { + props[p] = src[p]; + } + } + } + + return props; + }, + each: function each(a, b, c) { + if ("[object Object]" === Object.prototype.toString.call(a)) { + for (var d in a) { + if (Object.prototype.hasOwnProperty.call(a, d)) { + b.call(c, d, a[d], a); + } + } + } else { + for (var e = 0, f = a.length; e < f; e++) { + b.call(c, e, a[e], a); + } + } + }, + createElement: function createElement(e, a) { + var d = document, + el = d.createElement(e); + + if (a && "[object Object]" === Object.prototype.toString.call(a)) { + var i; + + for (i in a) { + if (i in el) el[i] = a[i];else if ("html" === i) el.textContent = a[i];else if ("text" === i) { + var t = d.createTextNode(a[i]); + el.appendChild(t); + } else el.setAttribute(i, a[i]); + } + } + + return el; + }, + hasClass: function hasClass(a, b) { + if (a) return a.classList ? a.classList.contains(b) : !!a.className && !!a.className.match(new RegExp("(\\s|^)" + b + "(\\s|$)")); + }, + addClass: function addClass(a, b) { + if (!util.hasClass(a, b)) { + if (a.classList) { + a.classList.add(b); + } else { + a.className = a.className.trim() + " " + b; + } + } + }, + removeClass: function removeClass(a, b) { + if (util.hasClass(a, b)) { + if (a.classList) { + a.classList.remove(b); + } else { + a.className = a.className.replace(new RegExp("(^|\\s)" + b.split(" ").join("|") + "(\\s|$)", "gi"), " "); + } + } + }, + closest: function closest(el, fn) { + return el && el !== document.body && (fn(el) ? el : util.closest(el.parentNode, fn)); + }, + isInt: function isInt(val) { + return typeof val === 'number' && isFinite(val) && Math.floor(val) === val; + }, + debounce: function debounce(a, b, c) { + var d; + return function () { + var e = this, + f = arguments, + g = function g() { + d = null; + if (!c) a.apply(e, f); + }, + h = c && !d; + + clearTimeout(d); + d = setTimeout(g, b); + + if (h) { + a.apply(e, f); + } + }; + }, + rect: function rect(el, abs) { + var w = window; + var r = el.getBoundingClientRect(); + var x = abs ? w.pageXOffset : 0; + var y = abs ? w.pageYOffset : 0; + return { + bottom: r.bottom + y, + height: r.height, + left: r.left + x, + right: r.right + x, + top: r.top + y, + width: r.width + }; + }, + includes: function includes(a, b) { + return a.indexOf(b) > -1; + }, + truncate: function truncate(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + } +}; + +function isset(obj, prop) { + return obj.hasOwnProperty(prop) && (obj[prop] === true || obj[prop].length); +} +/** + * Append an item to the list + * @param {Object} item + * @param {Object} custom + * @return {Void} + */ + + +function appendItem(item, parent, custom) { + if (item.parentNode) { + if (!item.parentNode.parentNode) { + parent.appendChild(item.parentNode); + } + } else { + parent.appendChild(item); + } + + util.removeClass(item, "excluded"); + + if (!custom) { + item.textContent = item.textContent + ''; // clear highlighting + } +} +/** + * Render the item list + * @return {Void} + */ + + +var render = function render() { + if (this.items.length) { + var f = document.createDocumentFragment(); + + if (this.config.pagination) { + var pages = this.pages.slice(0, this.pageIndex); + util.each(pages, function (i, items) { + util.each(items, function (j, item) { + appendItem(item, f, this.customOption); + }, this); + }, this); + } else { + util.each(this.items, function (i, item) { + appendItem(item, f, this.customOption); + }, this); + } + + if (f.childElementCount) { + util.removeClass(this.items[this.navIndex], "active"); + this.navIndex = f.querySelector(".selectr-option").idx; + util.addClass(this.items[this.navIndex], "active"); + } + + this.tree.appendChild(f); + } +}; +/** + * Dismiss / close the dropdown + * @param {obj} e + * @return {void} + */ + + +var dismiss = function dismiss(e) { + var target = e.target; + + if (!this.container.contains(target) && (this.opened || util.hasClass(this.container, "notice"))) { + this.close(); + } +}; +/** + * Build a list item from the HTMLOptionElement + * @param {int} i HTMLOptionElement index + * @param {HTMLOptionElement} option + * @param {bool} group Has parent optgroup + * @return {void} + */ + + +var createItem = function createItem(option, data) { + data = data || option; + var content = this.customOption ? this.config.renderOption(data) : option.textContent; + var opt = util.createElement("li", { + "class": "selectr-option", + html: content, + role: "treeitem", + "aria-selected": false + }); + opt.idx = option.idx; + this.items.push(opt); + + if (option.defaultSelected) { + this.defaultSelected.push(option.idx); + } + + if (option.disabled) { + opt.disabled = true; + util.addClass(opt, "disabled"); + } + + return opt; +}; +/** + * Build the container + * @return {Void} + */ + + +var build = function build() { + this.requiresPagination = this.config.pagination && this.config.pagination > 0; // Set width + + if (isset(this.config, "width")) { + if (util.isInt(this.config.width)) { + this.width = this.config.width + "px"; + } else { + if (this.config.width === "auto") { + this.width = "100%"; + } else if (util.includes(this.config.width, "%")) { + this.width = this.config.width; + } + } + } + + this.container = util.createElement("div", { + "class": "selectr-container" + }); // Custom className + + if (this.config.customClass) { + util.addClass(this.container, this.config.customClass); + } // Mobile device + + + if (this.mobileDevice) { + util.addClass(this.container, "selectr-mobile"); + } else { + util.addClass(this.container, "selectr-desktop"); + } // Hide the HTMLSelectElement and prevent focus + + + this.el.tabIndex = -1; // Native dropdown + + if (this.config.nativeDropdown || this.mobileDevice) { + util.addClass(this.el, "selectr-visible"); + } else { + util.addClass(this.el, "selectr-hidden"); + } + + this.selected = util.createElement("div", { + "class": "selectr-selected", + disabled: this.disabled, + tabIndex: 1, + // enable tabIndex (#9) + "aria-expanded": false + }); + this.label = util.createElement(this.el.multiple ? "ul" : "span", { + "class": "selectr-label" + }); + var dropdown = util.createElement("div", { + "class": "selectr-options-container" + }); + this.tree = util.createElement("ul", { + "class": "selectr-options", + role: "tree", + "aria-hidden": true, + "aria-expanded": false + }); + this.notice = util.createElement("div", { + "class": "selectr-notice" + }); + this.el.setAttribute("aria-hidden", true); + + if (this.disabled) { + this.el.disabled = true; + } + + if (this.el.multiple) { + util.addClass(this.label, "selectr-tags"); + util.addClass(this.container, "multiple"); // Collection of tags + + this.tags = []; // Collection of selected values + + this.selectedValues = this.getSelectedProperties('value'); // Collection of selected indexes + + this.selectedIndexes = this.getSelectedProperties('idx'); + } + + this.selected.appendChild(this.label); + + if (this.config.clearable) { + this.selectClear = util.createElement("button", { + "class": "selectr-clear", + type: "button" + }); + this.container.appendChild(this.selectClear); + util.addClass(this.container, "clearable"); + } + + if (this.config.taggable) { + var li = util.createElement('li', { + "class": 'input-tag' + }); + this.input = util.createElement("input", { + "class": "selectr-tag-input", + placeholder: this.config.tagPlaceholder, + tagIndex: 0, + autocomplete: "off", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + role: "textbox", + type: "search" + }); + li.appendChild(this.input); + this.label.appendChild(li); + util.addClass(this.container, "taggable"); + this.tagSeperators = [","]; + + if (this.config.tagSeperators) { + this.tagSeperators = this.tagSeperators.concat(this.config.tagSeperators); + } + } + + if (this.config.searchable) { + this.input = util.createElement("input", { + "class": "selectr-input", + tagIndex: -1, + autocomplete: "off", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + role: "textbox", + type: "search" + }); + this.inputClear = util.createElement("button", { + "class": "selectr-input-clear", + type: "button" + }); + this.inputContainer = util.createElement("div", { + "class": "selectr-input-container" + }); + this.inputContainer.appendChild(this.input); + this.inputContainer.appendChild(this.inputClear); + dropdown.appendChild(this.inputContainer); + } + + dropdown.appendChild(this.notice); + dropdown.appendChild(this.tree); // List of items for the dropdown + + this.items = []; // Establish options + + this.options = []; // Check for options in the element + + if (this.el.options.length) { + this.options = [].slice.call(this.el.options); + } // Element may have optgroups so + // iterate element.children instead of element.options + + + var group = false, + j = 0; + + if (this.el.children.length) { + util.each(this.el.children, function (i, element) { + if (element.nodeName === "OPTGROUP") { + group = util.createElement("ul", { + "class": "selectr-optgroup", + role: "group", + html: "
  • " + element.label + "
  • " + }); + util.each(element.children, function (x, el) { + el.idx = j; + group.appendChild(createItem.call(this, el, group)); + j++; + }, this); + } else { + element.idx = j; + createItem.call(this, element); + j++; + } + }, this); + } // Options defined by the data option + + + if (this.config.data && Array.isArray(this.config.data)) { + this.data = []; + var optgroup = false, + option; + group = false; + j = 0; + util.each(this.config.data, function (i, opt) { + // Check for group options + if (isset(opt, "children")) { + optgroup = util.createElement("optgroup", { + label: opt.text + }); + group = util.createElement("ul", { + "class": "selectr-optgroup", + role: "group", + html: "
  • " + opt.text + "
  • " + }); + util.each(opt.children, function (x, data) { + option = new Option(data.text, data.value, false, data.hasOwnProperty("selected") && data.selected === true); + option.disabled = isset(data, "disabled"); + this.options.push(option); + optgroup.appendChild(option); + option.idx = j; + group.appendChild(createItem.call(this, option, data)); + this.data[j] = data; + j++; + }, this); + } else { + option = new Option(opt.text, opt.value, false, opt.hasOwnProperty("selected") && opt.selected === true); + option.disabled = isset(opt, "disabled"); + this.options.push(option); + option.idx = j; + createItem.call(this, option, opt); + this.data[j] = opt; + j++; + } + }, this); + } + + this.setSelected(true); + var first; + this.navIndex = 0; + + for (var i = 0; i < this.items.length; i++) { + first = this.items[i]; + + if (!util.hasClass(first, "disabled")) { + util.addClass(first, "active"); + this.navIndex = i; + break; + } + } // Check for pagination / infinite scroll + + + if (this.requiresPagination) { + this.pageIndex = 1; // Create the pages + + this.paginate(); + } + + this.container.appendChild(this.selected); + this.container.appendChild(dropdown); + this.placeEl = util.createElement("div", { + "class": "selectr-placeholder" + }); // Set the placeholder + + this.setPlaceholder(); + this.selected.appendChild(this.placeEl); // Disable if required + + if (this.disabled) { + this.disable(); + } + + this.el.parentNode.insertBefore(this.container, this.el); + this.container.appendChild(this.el); +}; +/** + * Navigate through the dropdown + * @param {obj} e + * @return {void} + */ + + +var navigate = function navigate(e) { + e = e || window.event; // Filter out the keys we don"t want + + if (!this.items.length || !this.opened || !util.includes([13, 38, 40], e.which)) { + this.navigating = false; + return; + } + + e.preventDefault(); + + if (e.which === 13) { + if (this.config.taggable && this.input.value.length > 0) { + return false; + } + + return this.change(this.navIndex); + } + + var direction, + prevEl = this.items[this.navIndex]; + + switch (e.which) { + case 38: + direction = 0; + + if (this.navIndex > 0) { + this.navIndex--; + } + + break; + + case 40: + direction = 1; + + if (this.navIndex < this.items.length - 1) { + this.navIndex++; + } + + } + + this.navigating = true; // Instead of wasting memory holding a copy of this.items + // with disabled / excluded options omitted, skip them instead + + while (util.hasClass(this.items[this.navIndex], "disabled") || util.hasClass(this.items[this.navIndex], "excluded")) { + if (direction) { + this.navIndex++; + } else { + this.navIndex--; + } + + if (this.searching) { + if (this.navIndex > this.tree.lastElementChild.idx) { + this.navIndex = this.tree.lastElementChild.idx; + break; + } else if (this.navIndex < this.tree.firstElementChild.idx) { + this.navIndex = this.tree.firstElementChild.idx; + break; + } + } + } // Autoscroll the dropdown during navigation + + + var r = util.rect(this.items[this.navIndex]); + + if (!direction) { + if (this.navIndex === 0) { + this.tree.scrollTop = 0; + } else if (r.top - this.optsRect.top < 0) { + this.tree.scrollTop = this.tree.scrollTop + (r.top - this.optsRect.top); + } + } else { + if (this.navIndex === 0) { + this.tree.scrollTop = 0; + } else if (r.top + r.height > this.optsRect.top + this.optsRect.height) { + this.tree.scrollTop = this.tree.scrollTop + (r.top + r.height - (this.optsRect.top + this.optsRect.height)); + } // Load another page if needed + + + if (this.navIndex === this.tree.childElementCount - 1 && this.requiresPagination) { + load.call(this); + } + } + + if (prevEl) { + util.removeClass(prevEl, "active"); + } + + util.addClass(this.items[this.navIndex], "active"); +}; +/** + * Add a tag + * @param {HTMLElement} item + */ + + +var addTag = function addTag(item) { + var that = this, + r; + var docFrag = document.createDocumentFragment(); + var option = this.options[item.idx]; + var data = this.data ? this.data[item.idx] : option; + var content = this.customSelected ? this.config.renderSelection(data) : option.textContent; + var tag = util.createElement("li", { + "class": "selectr-tag", + html: content + }); + var btn = util.createElement("button", { + "class": "selectr-tag-remove", + type: "button" + }); + tag.appendChild(btn); // Set property to check against later + + tag.idx = item.idx; + tag.tag = option.value; + this.tags.push(tag); + + if (this.config.sortSelected) { + var tags = this.tags.slice(); // Deal with values that contain numbers + + r = function r(val, arr) { + val.replace(/(\d+)|(\D+)/g, function (that, $1, $2) { + arr.push([$1 || Infinity, $2 || ""]); + }); + }; + + tags.sort(function (a, b) { + var x = [], + y = [], + ac, + bc; + + if (that.config.sortSelected === true) { + ac = a.tag; + bc = b.tag; + } else if (that.config.sortSelected === 'text') { + ac = a.textContent; + bc = b.textContent; + } + + r(ac, x); + r(bc, y); + + while (x.length && y.length) { + var ax = x.shift(); + var by = y.shift(); + var nn = ax[0] - by[0] || ax[1].localeCompare(by[1]); + if (nn) return nn; + } + + return x.length - y.length; + }); + util.each(tags, function (i, tg) { + docFrag.appendChild(tg); + }); + this.label.textContent = ""; + } else { + docFrag.appendChild(tag); + } + + if (this.config.taggable) { + this.label.insertBefore(docFrag, this.input.parentNode); + } else { + this.label.appendChild(docFrag); + } +}; +/** + * Remove a tag + * @param {HTMLElement} item + * @return {void} + */ + + +var removeTag = function removeTag(item) { + var tag = false; + util.each(this.tags, function (i, t) { + if (t.idx === item.idx) { + tag = t; + } + }, this); + + if (tag) { + this.label.removeChild(tag); + this.tags.splice(this.tags.indexOf(tag), 1); + } +}; +/** + * Load the next page of items + * @return {void} + */ + + +var load = function load() { + var tree = this.tree; + var scrollTop = tree.scrollTop; + var scrollHeight = tree.scrollHeight; + var offsetHeight = tree.offsetHeight; + var atBottom = scrollTop >= scrollHeight - offsetHeight; + + if (atBottom && this.pageIndex < this.pages.length) { + var f = document.createDocumentFragment(); + util.each(this.pages[this.pageIndex], function (i, item) { + appendItem(item, f, this.customOption); + }, this); + tree.appendChild(f); + this.pageIndex++; + this.emit("selectr.paginate", { + items: this.items.length, + total: this.data.length, + page: this.pageIndex, + pages: this.pages.length + }); + } +}; +/** + * Clear a search + * @return {void} + */ + + +var clearSearch = function clearSearch() { + if (this.config.searchable || this.config.taggable) { + this.input.value = null; + this.searching = false; + + if (this.config.searchable) { + util.removeClass(this.inputContainer, "active"); + } + + if (util.hasClass(this.container, "notice")) { + util.removeClass(this.container, "notice"); + util.addClass(this.container, "open"); + this.input.focus(); + } + + util.each(this.items, function (i, item) { + // Items that didn't match need the class + // removing to make them visible again + util.removeClass(item, "excluded"); // Remove the span element for underlining matched items + + if (!this.customOption) { + item.textContent = item.textContent + ''; // clear highlighting + } + }, this); + } +}; +/** + * Query matching for searches + * @param {string} query + * @param {string} text + */ + + +var match = function match(query, text) { + var result = new RegExp(query, "i").exec(text); + + if (result) { + var start = result.index; + var end = result.index + result[0].length; + return { + before: text.substring(0, start), + match: text.substring(start, end), + after: text.substring(end) + }; + } + + return null; +}; // Main Lib + + +var Selectr = function Selectr(el, config) { + config = config || {}; + + if (!el) { + throw new Error("You must supply either a HTMLSelectElement or a CSS3 selector string."); + } + + this.el = el; // CSS3 selector string + + if (typeof el === "string") { + this.el = document.querySelector(el); + } + + if (this.el === null) { + throw new Error("The element you passed to Selectr can not be found."); + } + + if (this.el.nodeName.toLowerCase() !== "select") { + throw new Error("The element you passed to Selectr is not a HTMLSelectElement."); + } + + this.render(config); +}; +/** + * Render the instance + * @param {object} config + * @return {void} + */ + + +Selectr.prototype.render = function (config) { + if (this.rendered) return; // Merge defaults with user set config + + this.config = util.extend(defaultConfig, config); // Store type + + this.originalType = this.el.type; // Store tabIndex + + this.originalIndex = this.el.tabIndex; // Store defaultSelected options for form reset + + this.defaultSelected = []; // Store the original option count + + this.originalOptionCount = this.el.options.length; + + if (this.config.multiple || this.config.taggable) { + this.el.multiple = true; + } // Disabled? + + + this.disabled = isset(this.config, "disabled"); + this.opened = false; + + if (this.config.taggable) { + this.config.searchable = false; + } + + this.navigating = false; + this.mobileDevice = false; + + if (/Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i.test(navigator.userAgent)) { + this.mobileDevice = true; + } + + this.customOption = this.config.hasOwnProperty("renderOption") && typeof this.config.renderOption === "function"; + this.customSelected = this.config.hasOwnProperty("renderSelection") && typeof this.config.renderSelection === "function"; // Enable event emitter + + Events.mixin(this); + build.call(this); + this.bindEvents(); + this.update(); + this.optsRect = util.rect(this.tree); + this.rendered = true; // Fixes macOS Safari bug #28 + + if (!this.el.multiple) { + this.el.selectedIndex = this.selectedIndex; + } + + var that = this; + setTimeout(function () { + that.emit("selectr.init"); + }, 20); +}; + +Selectr.prototype.getSelected = function () { + var selected = this.el.querySelectorAll('option:checked'); + return selected; +}; + +Selectr.prototype.getSelectedProperties = function (prop) { + var selected = this.getSelected(); + var values = [].slice.call(selected).map(function (option) { + return option[prop]; + }).filter(function (i) { + return i !== null && i !== undefined; + }); + return values; +}; +/** + * Attach the required event listeners + */ + + +Selectr.prototype.bindEvents = function () { + var that = this; + this.events = {}; + this.events.dismiss = dismiss.bind(this); + this.events.navigate = navigate.bind(this); + this.events.reset = this.reset.bind(this); + + if (this.config.nativeDropdown || this.mobileDevice) { + this.container.addEventListener("touchstart", function (e) { + if (e.changedTouches[0].target === that.el) { + that.toggle(); + } + }); + + if (this.config.nativeDropdown || this.mobileDevice) { + this.container.addEventListener("click", function (e) { + e.preventDefault(); // Jos: Added to prevent emitting clear directly after select + + e.stopPropagation(); // Jos: Added to prevent emitting clear directly after select + + if (e.target === that.el) { + that.toggle(); + } + }); + } + + var getChangedOptions = function getChangedOptions(last, current) { + var added = [], + removed = last.slice(0); + var idx; + + for (var i = 0; i < current.length; i++) { + idx = removed.indexOf(current[i]); + if (idx > -1) removed.splice(idx, 1);else added.push(current[i]); + } + + return [added, removed]; + }; // Listen for the change on the native select + // and update accordingly + + + this.el.addEventListener("change", function (e) { + if (that.el.multiple) { + var indexes = that.getSelectedProperties('idx'); + var changes = getChangedOptions(that.selectedIndexes, indexes); + util.each(changes[0], function (i, idx) { + that.select(idx); + }, that); + util.each(changes[1], function (i, idx) { + that.deselect(idx); + }, that); + } else { + if (that.el.selectedIndex > -1) { + that.select(that.el.selectedIndex); + } + } + }); + } // Open the dropdown with Enter key if focused + + + if (this.config.nativeDropdown) { + this.container.addEventListener("keydown", function (e) { + if (e.key === "Enter" && that.selected === document.activeElement) { + // Show the native + that.toggle(); // Focus on the native multiselect + + setTimeout(function () { + that.el.focus(); + }, 200); + } + }); + } // Non-native dropdown + + + this.selected.addEventListener("click", function (e) { + if (!that.disabled) { + that.toggle(); + } + + e.preventDefault(); + e.stopPropagation(); // Jos: Added to prevent emitting clear directly after select + }); // Remove tag + + this.label.addEventListener("click", function (e) { + if (util.hasClass(e.target, "selectr-tag-remove")) { + that.deselect(e.target.parentNode.idx); + } + }); // Clear input + + if (this.selectClear) { + this.selectClear.addEventListener("click", this.clear.bind(this)); + } // Prevent text selection + + + this.tree.addEventListener("mousedown", function (e) { + e.preventDefault(); + }); // Select / deselect items + + this.tree.addEventListener("click", function (e) { + e.preventDefault(); // Jos: Added to prevent emitting clear directly after select + + e.stopPropagation(); // Jos: Added to prevent emitting clear directly after select + + var item = util.closest(e.target, function (el) { + return el && util.hasClass(el, "selectr-option"); + }); + + if (item) { + if (!util.hasClass(item, "disabled")) { + if (util.hasClass(item, "selected")) { + if (that.el.multiple || !that.el.multiple && that.config.allowDeselect) { + that.deselect(item.idx); + } + } else { + that.select(item.idx); + } + + if (that.opened && !that.el.multiple) { + that.close(); + } + } + } + }); // Mouseover list items + + this.tree.addEventListener("mouseover", function (e) { + if (util.hasClass(e.target, "selectr-option")) { + if (!util.hasClass(e.target, "disabled")) { + util.removeClass(that.items[that.navIndex], "active"); + util.addClass(e.target, "active"); + that.navIndex = [].slice.call(that.items).indexOf(e.target); + } + } + }); // Searchable + + if (this.config.searchable) { + // Show / hide the search input clear button + this.input.addEventListener("focus", function (e) { + that.searching = true; + }); + this.input.addEventListener("blur", function (e) { + that.searching = false; + }); + this.input.addEventListener("keyup", function (e) { + that.search(); + + if (!that.config.taggable) { + // Show / hide the search input clear button + if (this.value.length) { + util.addClass(this.parentNode, "active"); + } else { + util.removeClass(this.parentNode, "active"); + } + } + }); // Clear the search input + + this.inputClear.addEventListener("click", function (e) { + that.input.value = null; + clearSearch.call(that); + + if (!that.tree.childElementCount) { + render.call(that); + } + }); + } + + if (this.config.taggable) { + this.input.addEventListener("keyup", function (e) { + that.search(); + + if (that.config.taggable && this.value.length) { + var val = this.value.trim(); + + if (e.which === 13 || util.includes(that.tagSeperators, e.key)) { + util.each(that.tagSeperators, function (i, k) { + val = val.replace(k, ''); + }); + var option = that.add({ + value: val, + text: val, + selected: true + }, true); + + if (!option) { + this.value = ''; + that.setMessage('That tag is already in use.'); + } else { + that.close(); + clearSearch.call(that); + } + } + } + }); + } + + this.update = util.debounce(function () { + // Optionally close dropdown on scroll / resize (#11) + if (that.opened && that.config.closeOnScroll) { + that.close(); + } + + if (that.width) { + that.container.style.width = that.width; + } + + that.invert(); + }, 50); + + if (this.requiresPagination) { + this.paginateItems = util.debounce(function () { + load.call(this); + }, 50); + this.tree.addEventListener("scroll", this.paginateItems.bind(this)); + } // Dismiss when clicking outside the container + + + document.addEventListener("click", this.events.dismiss); + window.addEventListener("keydown", this.events.navigate); + window.addEventListener("resize", this.update); + window.addEventListener("scroll", this.update); // Listen for form.reset() (@ambrooks, #13) + + if (this.el.form) { + this.el.form.addEventListener("reset", this.events.reset); + } +}; +/** + * Check for selected options + * @param {bool} reset + */ + + +Selectr.prototype.setSelected = function (reset) { + // Select first option as with a native select-one element - #21, #24 + if (!this.config.data && !this.el.multiple && this.el.options.length) { + // Browser has selected the first option by default + if (this.el.selectedIndex === 0) { + if (!this.el.options[0].defaultSelected && !this.config.defaultSelected) { + this.el.selectedIndex = -1; + } + } + + this.selectedIndex = this.el.selectedIndex; + + if (this.selectedIndex > -1) { + this.select(this.selectedIndex); + } + } // If we're changing a select-one to select-multiple via the config + // and there are no selected options, the first option will be selected by the browser + // Let's prevent that here. + + + if (this.config.multiple && this.originalType === "select-one" && !this.config.data) { + if (this.el.options[0].selected && !this.el.options[0].defaultSelected) { + this.el.options[0].selected = false; + } + } + + util.each(this.options, function (i, option) { + if (option.selected && option.defaultSelected) { + this.select(option.idx); + } + }, this); + + if (this.config.selectedValue) { + this.setValue(this.config.selectedValue); + } + + if (this.config.data) { + if (!this.el.multiple && this.config.defaultSelected && this.el.selectedIndex < 0) { + this.select(0); + } + + var j = 0; + util.each(this.config.data, function (i, opt) { + // Check for group options + if (isset(opt, "children")) { + util.each(opt.children, function (x, item) { + if (item.hasOwnProperty("selected") && item.selected === true) { + this.select(j); + } + + j++; + }, this); + } else { + if (opt.hasOwnProperty("selected") && opt.selected === true) { + this.select(j); + } + + j++; + } + }, this); + } +}; +/** + * Destroy the instance + * @return {void} + */ + + +Selectr.prototype.destroy = function () { + if (!this.rendered) return; + this.emit("selectr.destroy"); // Revert to select-single if programtically set to multiple + + if (this.originalType === 'select-one') { + this.el.multiple = false; + } + + if (this.config.data) { + this.el.textContent = ""; + } // Remove the className from select element + + + util.removeClass(this.el, 'selectr-hidden'); // Remove reset listener from parent form + + if (this.el.form) { + util.off(this.el.form, "reset", this.events.reset); + } // Remove event listeners attached to doc and win + + + util.off(document, "click", this.events.dismiss); + util.off(document, "keydown", this.events.navigate); + util.off(window, "resize", this.update); + util.off(window, "scroll", this.update); // Replace the container with the original select element + + this.container.parentNode.replaceChild(this.el, this.container); + this.rendered = false; +}; +/** + * Change an options state + * @param {Number} index + * @return {void} + */ + + +Selectr.prototype.change = function (index) { + var item = this.items[index], + option = this.options[index]; + + if (option.disabled) { + return; + } + + if (option.selected && util.hasClass(item, "selected")) { + this.deselect(index); + } else { + this.select(index); + } + + if (this.opened && !this.el.multiple) { + this.close(); + } +}; +/** + * Select an option + * @param {Number} index + * @return {void} + */ + + +Selectr.prototype.select = function (index) { + var item = this.items[index], + options = [].slice.call(this.el.options), + option = this.options[index]; + + if (this.el.multiple) { + if (util.includes(this.selectedIndexes, index)) { + return false; + } + + if (this.config.maxSelections && this.tags.length === this.config.maxSelections) { + this.setMessage("A maximum of " + this.config.maxSelections + " items can be selected.", true); + return false; + } + + this.selectedValues.push(option.value); + this.selectedIndexes.push(index); + addTag.call(this, item); + } else { + var data = this.data ? this.data[index] : option; + this.label.textContent = this.customSelected ? this.config.renderSelection(data) : option.textContent; + this.selectedValue = option.value; + this.selectedIndex = index; + util.each(this.options, function (i, o) { + var opt = this.items[i]; + + if (i !== index) { + if (opt) { + util.removeClass(opt, "selected"); + } + + o.selected = false; + o.removeAttribute("selected"); + } + }, this); + } + + if (!util.includes(options, option)) { + this.el.add(option); + } + + item.setAttribute("aria-selected", true); + util.addClass(item, "selected"); + util.addClass(this.container, "has-selected"); + option.selected = true; + option.setAttribute("selected", ""); + this.emit("selectr.change", option); + this.emit("selectr.select", option); +}; +/** + * Deselect an option + * @param {Number} index + * @return {void} + */ + + +Selectr.prototype.deselect = function (index, force) { + var item = this.items[index], + option = this.options[index]; + + if (this.el.multiple) { + var selIndex = this.selectedIndexes.indexOf(index); + this.selectedIndexes.splice(selIndex, 1); + var valIndex = this.selectedValues.indexOf(option.value); + this.selectedValues.splice(valIndex, 1); + removeTag.call(this, item); + + if (!this.tags.length) { + util.removeClass(this.container, "has-selected"); + } + } else { + if (!force && !this.config.clearable && !this.config.allowDeselect) { + return false; + } + + this.label.textContent = ""; + this.selectedValue = null; + this.el.selectedIndex = this.selectedIndex = -1; + util.removeClass(this.container, "has-selected"); + } + + this.items[index].setAttribute("aria-selected", false); + util.removeClass(this.items[index], "selected"); + option.selected = false; + option.removeAttribute("selected"); + this.emit("selectr.change", null); + this.emit("selectr.deselect", option); +}; +/** + * Programmatically set selected values + * @param {String|Array} value - A string or an array of strings + */ + + +Selectr.prototype.setValue = function (value) { + var isArray = Array.isArray(value); + + if (!isArray) { + value = value.toString().trim(); + } // Can't pass array to select-one + + + if (!this.el.multiple && isArray) { + return false; + } + + util.each(this.options, function (i, option) { + if (isArray && util.includes(value.toString(), option.value) || option.value === value) { + this.change(option.idx); + } + }, this); +}; +/** + * Set the selected value(s) + * @param {bool} toObject Return only the raw values or an object + * @param {bool} toJson Return the object as a JSON string + * @return {mixed} Array or String + */ + + +Selectr.prototype.getValue = function (toObject, toJson) { + var value; + + if (this.el.multiple) { + if (toObject) { + if (this.selectedIndexes.length) { + value = {}; + value.values = []; + util.each(this.selectedIndexes, function (i, index) { + var option = this.options[index]; + value.values[i] = { + value: option.value, + text: option.textContent + }; + }, this); + } + } else { + value = this.selectedValues.slice(); + } + } else { + if (toObject) { + var option = this.options[this.selectedIndex]; + value = { + value: option.value, + text: option.textContent + }; + } else { + value = this.selectedValue; + } + } + + if (toObject && toJson) { + value = JSON.stringify(value); + } + + return value; +}; +/** + * Add a new option or options + * @param {object} data + */ + + +Selectr.prototype.add = function (data, checkDuplicate) { + if (data) { + this.data = this.data || []; + this.items = this.items || []; + this.options = this.options || []; + + if (Array.isArray(data)) { + // We have an array on items + util.each(data, function (i, obj) { + this.add(obj, checkDuplicate); + }, this); + } // User passed a single object to the method + // or Selectr passed an object from an array + else if ("[object Object]" === Object.prototype.toString.call(data)) { + if (checkDuplicate) { + var dupe = false; + util.each(this.options, function (i, option) { + if (option.value.toLowerCase() === data.value.toLowerCase()) { + dupe = true; + } + }); + + if (dupe) { + return false; + } + } + + var option = util.createElement('option', data); + this.data.push(data); // Add the new option to the list + + this.options.push(option); // Add the index for later use + + option.idx = this.options.length > 0 ? this.options.length - 1 : 0; // Create a new item + + createItem.call(this, option); // Select the item if required + + if (data.selected) { + this.select(option.idx); + } + + return option; + } // We may have had an empty select so update + // the placeholder to reflect the changes. + + + this.setPlaceholder(); // Recount the pages + + if (this.config.pagination) { + this.paginate(); + } + + return true; + } +}; +/** + * Remove an option or options + * @param {Mixed} o Array, integer (index) or string (value) + * @return {Void} + */ + + +Selectr.prototype.remove = function (o) { + var options = []; + + if (Array.isArray(o)) { + util.each(o, function (i, opt) { + if (util.isInt(opt)) { + options.push(this.getOptionByIndex(opt)); + } else if (typeof o === "string") { + options.push(this.getOptionByValue(opt)); + } + }, this); + } else if (util.isInt(o)) { + options.push(this.getOptionByIndex(o)); + } else if (typeof o === "string") { + options.push(this.getOptionByValue(o)); + } + + if (options.length) { + var index; + util.each(options, function (i, option) { + index = option.idx; // Remove the HTMLOptionElement + + this.el.remove(option); // Remove the reference from the option array + + this.options.splice(index, 1); // If the item has a parentNode (group element) it needs to be removed + // otherwise the render function will still append it to the dropdown + + var parentNode = this.items[index].parentNode; + + if (parentNode) { + parentNode.removeChild(this.items[index]); + } // Remove reference from the items array + + + this.items.splice(index, 1); // Reset the indexes + + util.each(this.options, function (i, opt) { + opt.idx = i; + this.items[i].idx = i; + }, this); + }, this); // We may have had an empty select now so update + // the placeholder to reflect the changes. + + this.setPlaceholder(); // Recount the pages + + if (this.config.pagination) { + this.paginate(); + } + } +}; +/** + * Remove all options + */ + + +Selectr.prototype.removeAll = function () { + // Clear any selected options + this.clear(true); // Remove the HTMLOptionElements + + util.each(this.el.options, function (i, option) { + this.el.remove(option); + }, this); // Empty the dropdown + + util.truncate(this.tree); // Reset variables + + this.items = []; + this.options = []; + this.data = []; + this.navIndex = 0; + + if (this.requiresPagination) { + this.requiresPagination = false; + this.pageIndex = 1; + this.pages = []; + } // Update the placeholder + + + this.setPlaceholder(); +}; +/** + * Perform a search + * @param {string} query The query string + */ + + +Selectr.prototype.search = function (string) { + if (this.navigating) return; + string = string || this.input.value; + var f = document.createDocumentFragment(); // Remove message + + this.removeMessage(); // Clear the dropdown + + util.truncate(this.tree); + + if (string.length > 1) { + // Check the options for the matching string + util.each(this.options, function (i, option) { + var item = this.items[option.idx]; + var includes = util.includes(option.textContent.toLowerCase(), string.toLowerCase()); + + if (includes && !option.disabled) { + appendItem(item, f, this.customOption); + util.removeClass(item, "excluded"); // Underline the matching results + + if (!this.customOption) { + item.textContent = ''; + var result = match(string, option.textContent); + + if (result) { + item.appendChild(document.createTextNode(result.before)); + var highlight = document.createElement('span'); + highlight.className = 'selectr-match'; + highlight.appendChild(document.createTextNode(result.match)); + item.appendChild(highlight); + item.appendChild(document.createTextNode(result.after)); + } + } + } else { + util.addClass(item, "excluded"); + } + }, this); + + if (!f.childElementCount) { + if (!this.config.taggable) { + this.setMessage("no results."); + } + } else { + // Highlight top result (@binary-koan #26) + var prevEl = this.items[this.navIndex]; + var firstEl = f.firstElementChild; + util.removeClass(prevEl, "active"); + this.navIndex = firstEl.idx; + util.addClass(firstEl, "active"); + } + } else { + render.call(this); + } + + this.tree.appendChild(f); +}; +/** + * Toggle the dropdown + * @return {void} + */ + + +Selectr.prototype.toggle = function () { + if (!this.disabled) { + if (this.opened) { + this.close(); + } else { + this.open(); + } + } +}; +/** + * Open the dropdown + * @return {void} + */ + + +Selectr.prototype.open = function () { + var that = this; + + if (!this.options.length) { + return false; + } + + if (!this.opened) { + this.emit("selectr.open"); + } + + this.opened = true; + + if (this.mobileDevice || this.config.nativeDropdown) { + util.addClass(this.container, "native-open"); + + if (this.config.data) { + // Dump the options into the select + // otherwise the native dropdown will be empty + util.each(this.options, function (i, option) { + this.el.add(option); + }, this); + } + + return; + } + + util.addClass(this.container, "open"); + render.call(this); + this.invert(); + this.tree.scrollTop = 0; + util.removeClass(this.container, "notice"); + this.selected.setAttribute("aria-expanded", true); + this.tree.setAttribute("aria-hidden", false); + this.tree.setAttribute("aria-expanded", true); + + if (this.config.searchable && !this.config.taggable) { + setTimeout(function () { + that.input.focus(); // Allow tab focus + + that.input.tabIndex = 0; + }, 10); + } +}; +/** + * Close the dropdown + * @return {void} + */ + + +Selectr.prototype.close = function () { + if (this.opened) { + this.emit("selectr.close"); + } + + this.opened = false; + + if (this.mobileDevice || this.config.nativeDropdown) { + util.removeClass(this.container, "native-open"); + return; + } + + var notice = util.hasClass(this.container, "notice"); + + if (this.config.searchable && !notice) { + this.input.blur(); // Disable tab focus + + this.input.tabIndex = -1; + this.searching = false; + } + + if (notice) { + util.removeClass(this.container, "notice"); + this.notice.textContent = ""; + } + + util.removeClass(this.container, "open"); + util.removeClass(this.container, "native-open"); + this.selected.setAttribute("aria-expanded", false); + this.tree.setAttribute("aria-hidden", true); + this.tree.setAttribute("aria-expanded", false); + util.truncate(this.tree); + clearSearch.call(this); +}; +/** + * Enable the element + * @return {void} + */ + + +Selectr.prototype.enable = function () { + this.disabled = false; + this.el.disabled = false; + this.selected.tabIndex = this.originalIndex; + + if (this.el.multiple) { + util.each(this.tags, function (i, t) { + t.lastElementChild.tabIndex = 0; + }); + } + + util.removeClass(this.container, "selectr-disabled"); +}; +/** + * Disable the element + * @param {boolean} container Disable the container only (allow value submit with form) + * @return {void} + */ + + +Selectr.prototype.disable = function (container) { + if (!container) { + this.el.disabled = true; + } + + this.selected.tabIndex = -1; + + if (this.el.multiple) { + util.each(this.tags, function (i, t) { + t.lastElementChild.tabIndex = -1; + }); + } + + this.disabled = true; + util.addClass(this.container, "selectr-disabled"); +}; +/** + * Reset to initial state + * @return {void} + */ + + +Selectr.prototype.reset = function () { + if (!this.disabled) { + this.clear(); + this.setSelected(true); + util.each(this.defaultSelected, function (i, idx) { + this.select(idx); + }, this); + this.emit("selectr.reset"); + } +}; +/** + * Clear all selections + * @return {void} + */ + + +Selectr.prototype.clear = function (force) { + if (this.el.multiple) { + // Loop over the selectedIndexes so we don't have to loop over all the options + // which can be costly if there are a lot of them + if (this.selectedIndexes.length) { + // Copy the array or we'll get an error + var indexes = this.selectedIndexes.slice(); + util.each(indexes, function (i, idx) { + this.deselect(idx); + }, this); + } + } else { + if (this.selectedIndex > -1) { + this.deselect(this.selectedIndex, force); + } + } + + this.emit("selectr.clear"); +}; +/** + * Return serialised data + * @param {boolean} toJson + * @return {mixed} Returns either an object or JSON string + */ + + +Selectr.prototype.serialise = function (toJson) { + var data = []; + util.each(this.options, function (i, option) { + var obj = { + value: option.value, + text: option.textContent + }; + + if (option.selected) { + obj.selected = true; + } + + if (option.disabled) { + obj.disabled = true; + } + + data[i] = obj; + }); + return toJson ? JSON.stringify(data) : data; +}; +/** + * Localised version of serialise() method + */ + + +Selectr.prototype.serialize = function (toJson) { + return this.serialise(toJson); +}; +/** + * Sets the placeholder + * @param {String} placeholder + */ + + +Selectr.prototype.setPlaceholder = function (placeholder) { + // Set the placeholder + placeholder = placeholder || this.config.placeholder || this.el.getAttribute("placeholder"); + + if (!this.options.length) { + placeholder = "No options available"; + } + + this.placeEl.textContent = placeholder; +}; +/** + * Paginate the option list + * @return {Array} + */ + + +Selectr.prototype.paginate = function () { + if (this.items.length) { + var that = this; + this.pages = this.items.map(function (v, i) { + return i % that.config.pagination === 0 ? that.items.slice(i, i + that.config.pagination) : null; + }).filter(function (pages) { + return pages; + }); + return this.pages; + } +}; +/** + * Display a message + * @param {String} message The message + */ + + +Selectr.prototype.setMessage = function (message, close) { + if (close) { + this.close(); + } + + util.addClass(this.container, "notice"); + this.notice.textContent = message; +}; +/** + * Dismiss the current message + */ + + +Selectr.prototype.removeMessage = function () { + util.removeClass(this.container, "notice"); + this.notice.textContent = ""; +}; +/** + * Keep the dropdown within the window + * @return {void} + */ + + +Selectr.prototype.invert = function () { + var rt = util.rect(this.selected), + oh = this.tree.parentNode.offsetHeight, + wh = window.innerHeight, + doInvert = rt.top + rt.height + oh > wh; + + if (doInvert) { + util.addClass(this.container, "inverted"); + this.isInverted = true; + } else { + util.removeClass(this.container, "inverted"); + this.isInverted = false; + } + + this.optsRect = util.rect(this.tree); +}; +/** + * Get an option via it's index + * @param {Integer} index The index of the HTMLOptionElement required + * @return {HTMLOptionElement} + */ + + +Selectr.prototype.getOptionByIndex = function (index) { + return this.options[index]; +}; +/** + * Get an option via it's value + * @param {String} value The value of the HTMLOptionElement required + * @return {HTMLOptionElement} + */ + + +Selectr.prototype.getOptionByValue = function (value) { + var option = false; + + for (var i = 0, l = this.options.length; i < l; i++) { + if (this.options[i].value.trim() === value.toString().trim()) { + option = this.options[i]; + break; + } + } + + return option; +}; + +module.exports = Selectr; + +/***/ }), + +/***/ 188: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "qD": function() { return /* binding */ DEFAULT_MODAL_ANCHOR; }, +/* harmony export */ "EX": function() { return /* binding */ SIZE_LARGE; }, +/* harmony export */ "WF": function() { return /* binding */ MAX_PREVIEW_CHARACTERS; }, +/* harmony export */ "oW": function() { return /* binding */ PREVIEW_HISTORY_LIMIT; } +/* harmony export */ }); +var DEFAULT_MODAL_ANCHOR = document.body; +var SIZE_LARGE = 10 * 1024 * 1024; // 10 MB + +var MAX_PREVIEW_CHARACTERS = 20000; +var PREVIEW_HISTORY_LIMIT = 2 * 1024 * 1024 * 1024; // 2 GB + +/***/ }), + +/***/ 602: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "w": function() { return /* binding */ createAbsoluteAnchor; } +/* harmony export */ }); +/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(791); + +/** + * Create an anchor element absolutely positioned in the `parent` + * element. + * @param {HTMLElement} anchor + * @param {HTMLElement} parent + * @param {function(HTMLElement)} [onDestroy] Callback when the anchor is destroyed + * @param {boolean} [destroyOnMouseOut=false] If true, anchor will be removed on mouse out + * @returns {HTMLElement} + */ + +function createAbsoluteAnchor(anchor, parent, onDestroy) { + var destroyOnMouseOut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + var root = getRootNode(anchor); + var eventListeners = {}; + var anchorRect = anchor.getBoundingClientRect(); + var parentRect = parent.getBoundingClientRect(); + var absoluteAnchor = document.createElement('div'); + absoluteAnchor.className = 'jsoneditor-anchor'; + absoluteAnchor.style.position = 'absolute'; + absoluteAnchor.style.left = anchorRect.left - parentRect.left + 'px'; + absoluteAnchor.style.top = anchorRect.top - parentRect.top + 'px'; + absoluteAnchor.style.width = anchorRect.width - 2 + 'px'; + absoluteAnchor.style.height = anchorRect.height - 2 + 'px'; + absoluteAnchor.style.boxSizing = 'border-box'; + parent.appendChild(absoluteAnchor); + + function destroy() { + // remove temporary absolutely positioned anchor + if (absoluteAnchor && absoluteAnchor.parentNode) { + absoluteAnchor.parentNode.removeChild(absoluteAnchor); // remove all event listeners + // all event listeners are supposed to be attached to document. + + for (var name in eventListeners) { + if (hasOwnProperty(eventListeners, name)) { + var fn = eventListeners[name]; + + if (fn) { + (0,_util__WEBPACK_IMPORTED_MODULE_0__.removeEventListener)(root, name, fn); + } + + delete eventListeners[name]; + } + } + + if (typeof onDestroy === 'function') { + onDestroy(anchor); + } + } + } + + function isOutside(target) { + return target !== absoluteAnchor && !(0,_util__WEBPACK_IMPORTED_MODULE_0__.isChildOf)(target, absoluteAnchor); + } // create and attach event listeners + + + function destroyIfOutside(event) { + if (isOutside(event.target)) { + destroy(); + } + } + + eventListeners.mousedown = (0,_util__WEBPACK_IMPORTED_MODULE_0__.addEventListener)(root, 'mousedown', destroyIfOutside); + eventListeners.mousewheel = (0,_util__WEBPACK_IMPORTED_MODULE_0__.addEventListener)(root, 'mousewheel', destroyIfOutside); + + if (destroyOnMouseOut) { + var destroyTimer = null; + + absoluteAnchor.onmouseover = function () { + clearTimeout(destroyTimer); + destroyTimer = null; + }; + + absoluteAnchor.onmouseout = function () { + if (!destroyTimer) { + destroyTimer = setTimeout(destroy, 200); + } + }; + } + + absoluteAnchor.destroy = destroy; + return absoluteAnchor; +} +/** + * Node.getRootNode shim + * @param {HTMLElement} node node to check + * @return {HTMLElement} node's rootNode or `window` if there is ShadowDOM is not supported. + */ + +function getRootNode(node) { + return typeof node.getRootNode === 'function' ? node.getRootNode() : window; +} + +function hasOwnProperty(object, key) { + return Object.prototype.hasOwnProperty.call(object, key); +} + +/***/ }), + +/***/ 907: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "m0": function() { return /* binding */ setLanguage; }, +/* harmony export */ "cC": function() { return /* binding */ setLanguages; }, +/* harmony export */ "Iu": function() { return /* binding */ translate; } +/* harmony export */ }); +/* harmony import */ var _polyfills__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(987); +/* harmony import */ var _polyfills__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_polyfills__WEBPACK_IMPORTED_MODULE_0__); + +/* eslint-disable no-template-curly-in-string */ + + +var _defs = { + en: { + array: 'Array', + auto: 'Auto', + appendText: 'Append', + appendTitle: 'Append a new field with type \'auto\' after this field (Ctrl+Shift+Ins)', + appendSubmenuTitle: 'Select the type of the field to be appended', + appendTitleAuto: 'Append a new field with type \'auto\' (Ctrl+Shift+Ins)', + ascending: 'Ascending', + ascendingTitle: 'Sort the childs of this ${type} in ascending order', + actionsMenu: 'Click to open the actions menu (Ctrl+M)', + cannotParseFieldError: 'Cannot parse field into JSON', + cannotParseValueError: 'Cannot parse value into JSON', + collapseAll: 'Collapse all fields', + compactTitle: 'Compact JSON data, remove all whitespaces (Ctrl+Shift+I)', + descending: 'Descending', + descendingTitle: 'Sort the childs of this ${type} in descending order', + drag: 'Drag to move this field (Alt+Shift+Arrows)', + duplicateKey: 'duplicate key', + duplicateText: 'Duplicate', + duplicateTitle: 'Duplicate selected fields (Ctrl+D)', + duplicateField: 'Duplicate this field (Ctrl+D)', + duplicateFieldError: 'Duplicate field name', + empty: 'empty', + expandAll: 'Expand all fields', + expandTitle: 'Click to expand/collapse this field (Ctrl+E). \n' + 'Ctrl+Click to expand/collapse including all childs.', + formatTitle: 'Format JSON data, with proper indentation and line feeds (Ctrl+I)', + insert: 'Insert', + insertTitle: 'Insert a new field with type \'auto\' before this field (Ctrl+Ins)', + insertSub: 'Select the type of the field to be inserted', + object: 'Object', + ok: 'Ok', + redo: 'Redo (Ctrl+Shift+Z)', + removeText: 'Remove', + removeTitle: 'Remove selected fields (Ctrl+Del)', + removeField: 'Remove this field (Ctrl+Del)', + repairTitle: 'Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.', + searchTitle: 'Search fields and values', + searchNextResultTitle: 'Next result (Enter)', + searchPreviousResultTitle: 'Previous result (Shift + Enter)', + selectNode: 'Select a node...', + showAll: 'show all', + showMore: 'show more', + showMoreStatus: 'displaying ${visibleChilds} of ${totalChilds} items.', + sort: 'Sort', + sortTitle: 'Sort the childs of this ${type}', + sortTitleShort: 'Sort contents', + sortFieldLabel: 'Field:', + sortDirectionLabel: 'Direction:', + sortFieldTitle: 'Select the nested field by which to sort the array or object', + sortAscending: 'Ascending', + sortAscendingTitle: 'Sort the selected field in ascending order', + sortDescending: 'Descending', + sortDescendingTitle: 'Sort the selected field in descending order', + string: 'String', + transform: 'Transform', + transformTitle: 'Filter, sort, or transform the childs of this ${type}', + transformTitleShort: 'Filter, sort, or transform contents', + extract: 'Extract', + extractTitle: 'Extract this ${type}', + transformQueryTitle: 'Enter a JMESPath query', + transformWizardLabel: 'Wizard', + transformWizardFilter: 'Filter', + transformWizardSortBy: 'Sort by', + transformWizardSelectFields: 'Select fields', + transformQueryLabel: 'Query', + transformPreviewLabel: 'Preview', + type: 'Type', + typeTitle: 'Change the type of this field', + openUrl: 'Ctrl+Click or Ctrl+Enter to open url in new window', + undo: 'Undo last action (Ctrl+Z)', + validationCannotMove: 'Cannot move a field into a child of itself', + autoType: 'Field type "auto". ' + 'The field type is automatically determined from the value ' + 'and can be a string, number, boolean, or null.', + objectType: 'Field type "object". ' + 'An object contains an unordered set of key/value pairs.', + arrayType: 'Field type "array". ' + 'An array contains an ordered collection of values.', + stringType: 'Field type "string". ' + 'Field type is not determined from the value, ' + 'but always returned as string.', + modeEditorTitle: 'Switch Editor Mode', + modeCodeText: 'Code', + modeCodeTitle: 'Switch to code highlighter', + modeFormText: 'Form', + modeFormTitle: 'Switch to form editor', + modeTextText: 'Text', + modeTextTitle: 'Switch to plain text editor', + modeTreeText: 'Tree', + modeTreeTitle: 'Switch to tree editor', + modeViewText: 'View', + modeViewTitle: 'Switch to tree view', + modePreviewText: 'Preview', + modePreviewTitle: 'Switch to preview mode', + examples: 'Examples', + "default": 'Default', + containsInvalidProperties: 'Contains invalid properties', + containsInvalidItems: 'Contains invalid items' + }, + es: { + array: 'Matriz', + auto: 'Auto', + appendText: 'Agregar', + appendTitle: 'Agregue un nuevo campo con el tipo \'auto\' después de este campo (Ctrl + Shift + Ins)', + appendSubmenuTitle: 'Seleccione el tipo de campo que se agregará', + appendTitleAuto: 'Agregue un nuevo campo con el tipo \'auto\' (Ctrl + Shift + Ins)', + ascending: 'Ascendente', + ascendingTitle: 'Ordene los elementos secundarios de este ${type} en orden ascendente', + actionsMenu: 'Haga clic para abrir el menú de acciones (Ctrl + M)', + cannotParseFieldError: 'No se puede parsear el campo en JSON', + cannotParseValueError: 'No se puede parsear el valor en JSON', + collapseAll: 'Contraer todos los campos', + compactTitle: 'Compactar datos JSON, eliminar todos los espacios en blanco (Ctrl + Shift + I)', + descending: 'Descendente', + descendingTitle: 'Ordene los hijos de este ${type} en orden descendente', + drag: 'Arrastre para mover este campo (Alt + Mayús + Flechas)', + duplicateKey: 'llave duplicada', + duplicateText: 'Duplicar', + duplicateTitle: 'Duplicar campos seleccionados (Ctrl + D)', + duplicateField: 'Duplicar este campo (Ctrl + D)', + duplicateFieldError: 'Nombre de campo duplicado', + empty: 'vacio', + expandAll: 'Expandir todos los campos', + expandTitle: 'Haga clic para expandir/contraer este campo (Ctrl + E). \n ' + ' Ctrl+Clic para expandir/contraer incluyendo todos los niños.', + formatTitle: 'Formatee los datos JSON, con la sangría y los avances de línea adecuados (Ctrl + I)', + insert: 'Insertar', + insertTitle: 'Inserte un nuevo campo con el tipo \'auto\' antes de este campo (Ctrl + Ins)', + insertSub: 'Seleccione el tipo de campo a insertar', + object: 'Objeto', + ok: 'Ok', + redo: 'Rehacer (Ctrl+Mayús+Z)', + removeText: 'Eliminar', + removeTitle: 'Eliminar campos seleccionados (Ctrl+Supr)', + removeField: 'Eliminar este campo (Ctrl+Supr)', + repairTitle: 'Reparar JSON: corrija comillas y caracteres de escape, elimine comentarios y notación JSONP, convierta objetos JavaScript en JSON.', + searchTitle: 'Campos de búsqueda y valores', + searchNextResultTitle: 'Siguiente resultado (Entrar)', + searchPreviousResultTitle: 'Resultado anterior (Shift + Enter)', + selectNode: 'Seleccione un nodo...', + showAll: 'mostrar todo', + showMore: 'mostrar más', + showMoreStatus: 'mostrando ${visibleChilds} de ${totalChilds} elementos.', + sort: 'Ordenar', + sortTitle: 'Ordene los hijos de este ${type}', + sortTitleShort: 'Ordenar contenidos', + sortFieldLabel: 'Campo:', + sortDirectionLabel: 'Dirección:', + sortFieldTitle: 'Seleccione el campo anidado por el cual ordenar la matriz u objeto', + sortAscending: 'Ascendente', + sortAscendingTitle: 'Ordenar el campo seleccionado en orden ascendente', + sortDescending: 'Descendente', + sortDescendingTitle: 'Ordenar por el campo seleccionado, en orden descendente', + string: 'Texto', + transform: 'Transformar', + transformTitle: 'Filtrar, ordenar o transformar los hijos de este ${type}', + transformTitleShort: 'Filtrar, ordenar o transformar contenidos', + extract: 'Extraer', + extractTitle: 'Extrae este ${type}', + transformQueryTitle: 'Ingrese una consulta JMESPath', + transformWizardLabel: 'Wizard', + transformWizardFilter: 'Filtro', + transformWizardSortBy: 'Ordenar por', + transformWizardSelectFields: 'Seleccione un campo', + transformQueryLabel: 'Consulta', + transformPreviewLabel: 'Vista Previa', + type: 'Tipo', + typeTitle: 'Cambiar el tipo de campo', + openUrl: 'Ctrl+Click o Ctrl+Enter para abrir la URL en una nueva ventana', + undo: 'Deshacer la última acción (Ctrl+Z)', + validationCannotMove: 'No se puede mover un campo a un hijo de sí mismo.', + autoType: 'Field type "auto". ' + 'The field type is automatically determined from the value ' + 'and can be a string, number, boolean, or null.', + objectType: 'Tipo de campo "objeto". ' + ' Un objeto contiene un conjunto desordenado de pares clave/valor.', + arrayType: 'Tipo de campo "matriz". ' + ' Una matriz contiene una colección ordenada de valores.', + stringType: 'Tipo de campo "cadena". ' + ' El tipo de campo no se determina a partir del valor, ' + ' pero siempre se devuelve como una cadena.', + modeEditorTitle: 'Cambiar modo de editor', + modeCodeText: 'Codigo', + modeCodeTitle: 'Cambiar al resaltador de código', + modeFormText: 'Formulario', + modeFormTitle: 'Cambiar al editor de formularios', + modeTextText: 'Texto', + modeTextTitle: 'Cambiar al editor de texto sin formato', + modeTreeText: 'Arbol', + modeTreeTitle: 'Cambiar al editor de árbol', + modeViewText: 'Vista', + modeViewTitle: 'Cambiar a la vista de árbol', + modePreviewText: 'Vista Previa', + modePreviewTitle: 'Cambiar al modo de vista previa', + examples: 'Ejemplos', + "default": 'Predeterminado', + containsInvalidProperties: 'Contiene propiedades no validas', + containsInvalidItems: 'Contiene items no validos' + }, + 'zh-CN': { + array: '数组', + auto: '自动', + appendText: '追加', + appendTitle: '在此字段后追加一个类型为“auto”的新字段 (Ctrl+Shift+Ins)', + appendSubmenuTitle: '选择要追加的字段类型', + appendTitleAuto: '追加类型为“auto”的新字段 (Ctrl+Shift+Ins)', + ascending: '升序', + ascendingTitle: '升序排列${type}的子节点', + actionsMenu: '点击打开动作菜单(Ctrl+M)', + cannotParseFieldError: '无法将字段解析为JSON', + cannotParseValueError: '无法将值解析为JSON', + collapseAll: '缩进所有字段', + compactTitle: '压缩JSON数据,删除所有空格 (Ctrl+Shift+I)', + descending: '降序', + descendingTitle: '降序排列${type}的子节点', + drag: '拖拽移动该节点(Alt+Shift+Arrows)', + duplicateKey: '重复键', + duplicateText: '复制', + duplicateTitle: '复制选中字段(Ctrl+D)', + duplicateField: '复制该字段(Ctrl+D)', + duplicateFieldError: '重复的字段名称', + empty: '清空', + expandAll: '展开所有字段', + expandTitle: '点击 展开/收缩 该字段(Ctrl+E). \n' + 'Ctrl+Click 展开/收缩 包含所有子节点.', + formatTitle: '使用适当的缩进和换行符格式化JSON数据 (Ctrl+I)', + insert: '插入', + insertTitle: '在此字段前插入类型为“auto”的新字段 (Ctrl+Ins)', + insertSub: '选择要插入的字段类型', + object: '对象', + ok: 'Ok', + redo: '重做 (Ctrl+Shift+Z)', + removeText: '移除', + removeTitle: '移除选中字段 (Ctrl+Del)', + removeField: '移除该字段 (Ctrl+Del)', + repairTitle: '修复JSON:修复引号和转义符,删除注释和JSONP表示法,将JavaScript对象转换为JSON。', + selectNode: '选择一个节点...', + showAll: '展示全部', + showMore: '展示更多', + showMoreStatus: '显示${totalChilds}的${visibleChilds}项目.', + sort: '排序', + sortTitle: '排序${type}的子节点', + sortTitleShort: '内容排序', + sortFieldLabel: '字段:', + sortDirectionLabel: '方向:', + sortFieldTitle: '选择用于对数组或对象排序的嵌套字段', + sortAscending: '升序排序', + sortAscendingTitle: '按照该字段升序排序', + sortDescending: '降序排序', + sortDescendingTitle: '按照该字段降序排序', + string: '字符串', + transform: '变换', + transformTitle: '筛选,排序,或者转换${type}的子节点', + transformTitleShort: '筛选,排序,或者转换内容', + extract: '提取', + extractTitle: '提取这个 ${type}', + transformQueryTitle: '输入JMESPath查询', + transformWizardLabel: '向导', + transformWizardFilter: '筛选', + transformWizardSortBy: '排序', + transformWizardSelectFields: '选择字段', + transformQueryLabel: '查询', + transformPreviewLabel: '预览', + type: '类型', + typeTitle: '更改字段类型', + openUrl: 'Ctrl+Click 或者 Ctrl+Enter 在新窗口打开链接', + undo: '撤销上次动作 (Ctrl+Z)', + validationCannotMove: '无法将字段移入其子节点', + autoType: '字段类型 "auto". ' + '字段类型由值自动确定 ' + '可以为 string,number,boolean,或者 null.', + objectType: '字段类型 "object". ' + '对象包含一组无序的键/值对.', + arrayType: '字段类型 "array". ' + '数组包含值的有序集合.', + stringType: '字段类型 "string". ' + '字段类型由值自动确定,' + '但始终作为字符串返回.', + modeCodeText: '代码', + modeCodeTitle: '切换至代码高亮', + modeFormText: '表单', + modeFormTitle: '切换至表单编辑', + modeTextText: '文本', + modeTextTitle: '切换至文本编辑', + modeTreeText: '树', + modeTreeTitle: '切换至树编辑', + modeViewText: '视图', + modeViewTitle: '切换至树视图', + modePreviewText: '预览', + modePreviewTitle: '切换至预览模式', + examples: '例子', + "default": '缺省', + containsInvalidProperties: '包含无效的属性', + containsInvalidItems: '包含无效项目' + }, + 'pt-BR': { + array: 'Lista', + auto: 'Automatico', + appendText: 'Adicionar', + appendTitle: 'Adicionar novo campo com tipo \'auto\' depois deste campo (Ctrl+Shift+Ins)', + appendSubmenuTitle: 'Selecione o tipo do campo a ser adicionado', + appendTitleAuto: 'Adicionar novo campo com tipo \'auto\' (Ctrl+Shift+Ins)', + ascending: 'Ascendente', + ascendingTitle: 'Organizar filhor do tipo ${type} em crescente', + actionsMenu: 'Clique para abrir o menu de ações (Ctrl+M)', + cannotParseFieldError: 'Não é possível analisar o campo no JSON', + cannotParseValueError: 'Não é possível analisar o valor em JSON', + collapseAll: 'Fechar todos campos', + compactTitle: 'Dados JSON compactos, remova todos os espaços em branco (Ctrl+Shift+I)', + descending: 'Descendente', + descendingTitle: 'Organizar o filhos do tipo ${type} em decrescente', + duplicateKey: 'chave duplicada', + drag: 'Arraste para mover este campo (Alt+Shift+Arrows)', + duplicateText: 'Duplicar', + duplicateTitle: 'Duplicar campos selecionados (Ctrl+D)', + duplicateField: 'Duplicar este campo (Ctrl+D)', + duplicateFieldError: 'Nome do campo duplicado', + empty: 'vazio', + expandAll: 'Expandir todos campos', + expandTitle: 'Clique para expandir/encolher este campo (Ctrl+E). \n' + 'Ctrl+Click para expandir/encolher incluindo todos os filhos.', + formatTitle: 'Formate dados JSON, com recuo e feeds de linha adequados (Ctrl+I)', + insert: 'Inserir', + insertTitle: 'Inserir um novo campo do tipo \'auto\' antes deste campo (Ctrl+Ins)', + insertSub: 'Selecionar o tipo de campo a ser inserido', + object: 'Objeto', + ok: 'Ok', + redo: 'Refazer (Ctrl+Shift+Z)', + removeText: 'Remover', + removeTitle: 'Remover campos selecionados (Ctrl+Del)', + removeField: 'Remover este campo (Ctrl+Del)', + repairTitle: 'Repare JSON: corrija aspas e caracteres de escape, remova comentários e notação JSONP, transforme objetos JavaScript em JSON.', + selectNode: 'Selecione um nódulo...', + showAll: 'mostrar todos', + showMore: 'mostrar mais', + showMoreStatus: 'exibindo ${visibleChilds} de ${totalChilds} itens.', + sort: 'Organizar', + sortTitle: 'Organizar os filhos deste ${type}', + sortTitleShort: 'Organizar os filhos', + sortFieldLabel: 'Campo:', + sortDirectionLabel: 'Direção:', + sortFieldTitle: 'Selecione um campo filho pelo qual ordenar o array ou objeto', + sortAscending: 'Ascendente', + sortAscendingTitle: 'Ordenar o campo selecionado por ordem ascendente', + sortDescending: 'Descendente', + sortDescendingTitle: 'Ordenar o campo selecionado por ordem descendente', + string: 'Texto', + transform: 'Transformar', + transformTitle: 'Filtrar, ordenar ou transformar os filhos deste ${type}', + transformTitleShort: 'Filtrar, ordenar ou transformar conteúdos', + transformQueryTitle: 'Insira uma expressão JMESPath', + transformWizardLabel: 'Assistente', + transformWizardFilter: 'Filtro', + transformWizardSortBy: 'Ordenar por', + transformWizardSelectFields: 'Selecionar campos', + transformQueryLabel: 'Expressão', + transformPreviewLabel: 'Visualizar', + type: 'Tipo', + typeTitle: 'Mudar o tipo deste campo', + openUrl: 'Ctrl+Click ou Ctrl+Enter para abrir link em nova janela', + undo: 'Desfazer último ação (Ctrl+Z)', + validationCannotMove: 'Não pode mover um campo como filho dele mesmo', + autoType: 'Campo do tipo "auto". ' + 'O tipo do campo é determinao automaticamente a partir do seu valor ' + 'e pode ser texto, número, verdade/falso ou nulo.', + objectType: 'Campo do tipo "objeto". ' + 'Um objeto contém uma lista de pares com chave e valor.', + arrayType: 'Campo do tipo "lista". ' + 'Uma lista contem uma coleção de valores ordenados.', + stringType: 'Campo do tipo "string". ' + 'Campo do tipo nao é determinado através do seu valor, ' + 'mas sempre retornara um texto.', + examples: 'Exemplos', + "default": 'Revelia', + containsInvalidProperties: 'Contém propriedades inválidas', + containsInvalidItems: 'Contém itens inválidos' + }, + tr: { + array: 'Dizin', + auto: 'Otomatik', + appendText: 'Ekle', + appendTitle: 'Bu alanın altına \'otomatik\' tipinde yeni bir alan ekle (Ctrl+Shift+Ins)', + appendSubmenuTitle: 'Eklenecek alanın tipini seç', + appendTitleAuto: '\'Otomatik\' tipinde yeni bir alan ekle (Ctrl+Shift+Ins)', + ascending: 'Artan', + ascendingTitle: '${type}\'ın alt tiplerini artan düzende sırala', + actionsMenu: 'Aksiyon menüsünü açmak için tıklayın (Ctrl+M)', + collapseAll: 'Tüm alanları kapat', + descending: 'Azalan', + descendingTitle: '${type}\'ın alt tiplerini azalan düzende sırala', + drag: 'Bu alanı taşımak için sürükleyin (Alt+Shift+Arrows)', + duplicateKey: 'Var olan anahtar', + duplicateText: 'Aşağıya kopyala', + duplicateTitle: 'Seçili alanlardan bir daha oluştur (Ctrl+D)', + duplicateField: 'Bu alandan bir daha oluştur (Ctrl+D)', + duplicateFieldError: 'Duplicate field name', + cannotParseFieldError: 'Alan JSON\'a ayrıştırılamıyor', + cannotParseValueError: 'JSON\'a değer ayrıştırılamıyor', + empty: 'boş', + expandAll: 'Tüm alanları aç', + expandTitle: 'Bu alanı açmak/kapatmak için tıkla (Ctrl+E). \n' + 'Alt alanlarda dahil tüm alanları açmak için Ctrl+Click ', + insert: 'Ekle', + insertTitle: 'Bu alanın üstüne \'otomatik\' tipinde yeni bir alan ekle (Ctrl+Ins)', + insertSub: 'Araya eklenecek alanın tipini seç', + object: 'Nesne', + ok: 'Tamam', + redo: 'Yeniden yap (Ctrl+Shift+Z)', + removeText: 'Kaldır', + removeTitle: 'Seçilen alanları kaldır (Ctrl+Del)', + removeField: 'Bu alanı kaldır (Ctrl+Del)', + selectNode: 'Bir nesne seç...', + showAll: 'tümünü göster', + showMore: 'daha fazla göster', + showMoreStatus: '${totalChilds} alanın ${visibleChilds} alt alanları gösteriliyor', + sort: 'Sırala', + sortTitle: '${type}\'ın alt alanlarını sırala', + sortTitleShort: 'İçerikleri sırala', + sortFieldLabel: 'Alan:', + sortDirectionLabel: 'Yön:', + sortFieldTitle: 'Diziyi veya nesneyi sıralamak için iç içe geçmiş alanı seçin', + sortAscending: 'Artan', + sortAscendingTitle: 'Seçili alanı artan düzende sırala', + sortDescending: 'Azalan', + sortDescendingTitle: 'Seçili alanı azalan düzende sırala', + string: 'Karakter Dizisi', + transform: 'Dönüştür', + transformTitle: '${type}\'ın alt alanlarını filtrele, sırala veya dönüştür', + transformTitleShort: 'İçerikleri filterele, sırala veya dönüştür', + transformQueryTitle: 'JMESPath sorgusu gir', + transformWizardLabel: 'Sihirbaz', + transformWizardFilter: 'Filtre', + transformWizardSortBy: 'Sırala', + transformWizardSelectFields: 'Alanları seç', + transformQueryLabel: 'Sorgu', + transformPreviewLabel: 'Önizleme', + type: 'Tip', + typeTitle: 'Bu alanın tipini değiştir', + openUrl: 'URL\'i yeni bir pencerede açmak için Ctrl+Click veya Ctrl+Enter', + undo: 'Son değişikliği geri al (Ctrl+Z)', + validationCannotMove: 'Alt alan olarak taşınamıyor', + autoType: 'Alan tipi "otomatik". ' + 'Alan türü otomatik olarak değerden belirlenir' + 've bir dize, sayı, boolean veya null olabilir.', + objectType: 'Alan tipi "nesne". ' + 'Bir nesne, sıralanmamış bir anahtar / değer çifti kümesi içerir.', + arrayType: 'Alan tipi "dizi". ' + 'Bir dizi, düzenli değerler koleksiyonu içerir.', + stringType: 'Alan tipi "karakter dizisi". ' + 'Alan türü değerden belirlenmez,' + 'ancak her zaman karakter dizisi olarak döndürülür.', + modeCodeText: 'Kod', + modeCodeTitle: 'Kod vurgulayıcıya geç', + modeFormText: 'Form', + modeFormTitle: 'Form düzenleyiciye geç', + modeTextText: 'Metin', + modeTextTitle: 'Düz metin düzenleyiciye geç', + modeTreeText: 'Ağaç', + modeTreeTitle: 'Ağaç düzenleyiciye geç', + modeViewText: 'Görünüm', + modeViewTitle: 'Ağaç görünümüne geç', + examples: 'Örnekler', + "default": 'Varsayılan', + containsInvalidProperties: 'Geçersiz özellikler içeriyor', + containsInvalidItems: 'Geçersiz öğeler içeriyor' + }, + ja: { + array: '配列', + auto: 'オート', + appendText: '追加', + appendTitle: '次のフィールドに"オート"のフィールドを追加 (Ctrl+Shift+Ins)', + appendSubmenuTitle: '追加するフィールドの型を選択してください', + appendTitleAuto: '"オート"のフィールドを追加 (Ctrl+Shift+Ins)', + ascending: '昇順', + ascendingTitle: '${type}の子要素を昇順に並べ替え', + actionsMenu: 'クリックしてアクションメニューを開く (Ctrl+M)', + collapseAll: 'すべてを折りたたむ', + descending: '降順', + descendingTitle: '${type}の子要素を降順に並べ替え', + drag: 'ドラッグして選択中のフィールドを移動 (Alt+Shift+Arrows)', + duplicateKey: '複製キー', + duplicateText: '複製', + duplicateTitle: '選択中のフィールドを複製 (Ctrl+D)', + duplicateField: '選択中のフィールドを複製 (Ctrl+D)', + duplicateFieldError: 'フィールド名が重複しています', + cannotParseFieldError: 'JSONのフィールドを解析できません', + cannotParseValueError: 'JSONの値を解析できません', + empty: '空', + expandAll: 'すべてを展開', + expandTitle: 'クリックしてフィールドを展開/折りたたむ (Ctrl+E). \n' + 'Ctrl+Click ですべての子要素を展開/折りたたむ', + insert: '挿入', + insertTitle: '選択中のフィールドの前に新しいフィールドを挿入 (Ctrl+Ins)', + insertSub: '挿入するフィールドの型を選択', + object: 'オブジェクト', + ok: '実行', + redo: 'やり直す (Ctrl+Shift+Z)', + removeText: '削除', + removeTitle: '選択中のフィールドを削除 (Ctrl+Del)', + removeField: '選択中のフィールドを削除 (Ctrl+Del)', + selectNode: 'ノードを選択...', + showAll: 'すべてを表示', + showMore: 'もっと見る', + showMoreStatus: '${totalChilds}個のアイテムのうち ${visibleChilds}個を表示しています。', + sort: '並べ替え', + sortTitle: '${type}の子要素を並べ替え', + sortTitleShort: '並べ替え', + sortFieldLabel: 'フィールド:', + sortDirectionLabel: '順序:', + sortFieldTitle: '配列またはオブジェクトを並び替えるためのフィールドを選択', + sortAscending: '昇順', + sortAscendingTitle: '選択中のフィールドを昇順に並び替え', + sortDescending: '降順', + sortDescendingTitle: '選択中のフィールドを降順に並び替え', + string: '文字列', + transform: '変換', + transformTitle: '${type}の子要素をフィルター・並び替え・変換する', + transformTitleShort: '内容をフィルター・並び替え・変換する', + extract: '抽出', + extractTitle: '${type}を抽出', + transformQueryTitle: 'JMESPathクエリを入力', + transformWizardLabel: 'ウィザード', + transformWizardFilter: 'フィルター', + transformWizardSortBy: '並び替え', + transformWizardSelectFields: 'フィールドを選択', + transformQueryLabel: 'クエリ', + transformPreviewLabel: 'プレビュー', + type: '型', + typeTitle: '選択中のフィールドの型を変更', + openUrl: 'Ctrl+Click または Ctrl+Enter で 新規ウィンドウでURLを開く', + undo: '元に戻す (Ctrl+Z)', + validationCannotMove: '子要素に移動できません ', + autoType: 'オート: ' + 'フィールドの型は値から自動的に決定されます。 ' + '(文字列・数値・ブール・null)', + objectType: 'オブジェクト: ' + 'オブジェクトは順序が決まっていないキーと値のペア組み合わせです。', + arrayType: '配列: ' + '配列は順序が決まっている値の集合体です。', + stringType: '文字列: ' + 'フィールド型は値から決定されませんが、' + '常に文字列として返されます。', + modeCodeText: 'コードモード', + modeCodeTitle: 'ハイライトモードに切り替え', + modeFormText: 'フォームモード', + modeFormTitle: 'フォームモードに切り替え', + modeTextText: 'テキストモード', + modeTextTitle: 'テキストモードに切り替え', + modeTreeText: 'ツリーモード', + modeTreeTitle: 'ツリーモードに切り替え', + modeViewText: 'ビューモード', + modeViewTitle: 'ビューモードに切り替え', + modePreviewText: 'プレビュー', + modePreviewTitle: 'プレビューに切り替え', + examples: '例', + "default": 'デフォルト', + containsInvalidProperties: '無効なプロパティが含まれています', + containsInvalidItems: '無効なアイテムが含まれています' + }, + 'fr-FR': { + array: 'Liste', + auto: 'Auto', + appendText: 'Ajouter', + appendTitle: 'Ajouter un champ de type \'auto\' après ce champ (Ctrl+Shift+Ins)', + appendSubmenuTitle: 'Sélectionner le type du champ à ajouter', + appendTitleAuto: 'Ajouter un champ de type \'auto\' (Ctrl+Shift+Ins)', + ascending: 'Ascendant', + ascendingTitle: 'Trier les enfants de ce ${type} par ordre ascendant', + actionsMenu: 'Ouvrir le menu des actions (Ctrl+M)', + collapseAll: 'Regrouper', + descending: 'Descendant', + descendingTitle: 'Trier les enfants de ce ${type} par ordre descendant', + drag: 'Déplacer (Alt+Shift+Arrows)', + duplicateKey: 'Dupliquer la clé', + duplicateText: 'Dupliquer', + duplicateTitle: 'Dupliquer les champs sélectionnés (Ctrl+D)', + duplicateField: 'Dupliquer ce champ (Ctrl+D)', + duplicateFieldError: 'Dupliquer le nom de champ', + cannotParseFieldError: 'Champ impossible à parser en JSON', + cannotParseValueError: 'Valeur impossible à parser en JSON', + empty: 'vide', + expandAll: 'Étendre', + expandTitle: 'Étendre/regrouper ce champ (Ctrl+E). \n' + 'Ctrl+Click pour étendre/regrouper avec tous les champs.', + insert: 'Insérer', + insertTitle: 'Insérer un champ de type \'auto\' avant ce champ (Ctrl+Ins)', + insertSub: 'Sélectionner le type de champ à insérer', + object: 'Objet', + ok: 'Ok', + redo: 'Rejouer (Ctrl+Shift+Z)', + removeText: 'Supprimer', + removeTitle: 'Supprimer les champs sélectionnés (Ctrl+Del)', + removeField: 'Supprimer ce champ (Ctrl+Del)', + searchTitle: 'Rechercher champs et valeurs', + searchNextResultTitle: 'Résultat suivant (Enter)', + searchPreviousResultTitle: 'Résultat précédent (Shift + Enter)', + selectNode: 'Sélectionner un nœud...', + showAll: 'voir tout', + showMore: 'voir plus', + showMoreStatus: '${visibleChilds} éléments affichés de ${totalChilds}.', + sort: 'Trier', + sortTitle: 'Trier les champs de ce ${type}', + sortTitleShort: 'Trier', + sortFieldLabel: 'Champ:', + sortDirectionLabel: 'Direction:', + sortFieldTitle: 'Sélectionner les champs permettant de trier les listes et objet', + sortAscending: 'Ascendant', + sortAscendingTitle: 'Trier les champs sélectionnés par ordre ascendant', + sortDescending: 'Descendant', + sortDescendingTitle: 'Trier les champs sélectionnés par ordre descendant', + string: 'Chaîne', + transform: 'Transformer', + transformTitle: 'Filtrer, trier, or transformer les enfants de ce ${type}', + transformTitleShort: 'Filtrer, trier ou transformer le contenu', + extract: 'Extraire', + extractTitle: 'Extraire ce ${type}', + transformQueryTitle: 'Saisir une requête JMESPath', + transformWizardLabel: 'Assistant', + transformWizardFilter: 'Filtrer', + transformWizardSortBy: 'Trier par', + transformWizardSelectFields: 'Sélectionner les champs', + transformQueryLabel: 'Requête', + transformPreviewLabel: 'Prévisualisation', + type: 'Type', + typeTitle: 'Changer le type de ce champ', + openUrl: 'Ctrl+Click ou Ctrl+Enter pour ouvrir l\'url dans une autre fenêtre', + undo: 'Annuler la dernière action (Ctrl+Z)', + validationCannotMove: 'Cannot move a field into a child of itself', + autoType: 'Champe de type "auto". ' + 'Ce type de champ est automatiquement déterminé en fonction de la valeur ' + 'et peut être de type "chaîne", "nombre", "booléen" ou null.', + objectType: 'Champ de type "objet". ' + 'Un objet contient un ensemble non ordonné de paires clé/valeur.', + arrayType: 'Champ de type "liste". ' + 'Une liste contient une collection ordonnée de valeurs.', + stringType: 'Champ de type "chaîne". ' + 'Ce type de champ n\'est pas déterminé en fonction de la valeur, ' + 'mais retourne systématiquement une chaîne de caractères.', + modeEditorTitle: 'Changer mode d\'édition', + modeCodeText: 'Code', + modeCodeTitle: 'Activer surlignage code', + modeFormText: 'Formulaire', + modeFormTitle: 'Activer formulaire', + modeTextText: 'Texte', + modeTextTitle: 'Activer éditeur texte', + modeTreeText: 'Arbre', + modeTreeTitle: 'Activer éditeur arbre', + modeViewText: 'Lecture seule', + modeViewTitle: 'Activer vue arbre', + modePreviewText: 'Prévisualisation', + modePreviewTitle: 'Activer mode prévisualiser', + examples: 'Exemples', + "default": 'Défaut', + containsInvalidProperties: 'Contient des propriétés non valides', + containsInvalidItems: 'Contient des éléments invalides' + }, + de: { + array: 'Auflistung', + auto: 'Auto', + appendText: 'anhängen', + appendTitle: 'Fügen Sie nach diesem Feld ein neues Feld mit dem Typ \'auto\' ein (Strg+Umschalt+Ein)', + appendSubmenuTitle: 'Wählen Sie den Typ des neuen Feldes', + appendTitleAuto: 'Ein neues Feld vom Typ \'auto\' hinzufügen (Strg+Umschalt+Ein)', + ascending: 'Aufsteigend', + ascendingTitle: 'Sortieren Sie die Elemente dieses ${type} in aufsteigender Reihenfolge', + actionsMenu: 'Klicken Sie zum Öffnen des Aktionsmenüs (Strg+M)', + cannotParseFieldError: 'Feld kann nicht in JSON geparst werden', + cannotParseValueError: 'Wert kann nicht in JSON geparst werden', + collapseAll: 'Alle Felder zuklappen', + compactTitle: 'JSON-Daten verdichten, alle Leerzeichen entfernen (Strg+Umschalt+\\)', + descending: 'Absteigend', + descendingTitle: 'Sortieren Sie die Elemente dieses ${type} in absteigender Reihenfolge', + drag: 'Ziehen, um dieses Feld zu verschieben (Alt+Umschalt+Pfeile)', + duplicateKey: 'Doppelter Schlüssel', + duplicateText: 'Duplikat', + duplicateTitle: 'Ausgewählte Felder duplizieren (Strg+D)', + duplicateField: 'Dieses Feld duplizieren (Strg+D)', + duplicateFieldError: 'Doppelter Feldname', + empty: 'leer', + expandAll: 'Alle Felder anzeigen', + expandTitle: 'Klicken Sie, um dieses Feld zu erweitern/zu kollabieren (Strg+E). \nStrg+Klicken Sie, um dieses Feld einschließlich aller Elemente zu erweitern/zu kollabieren.', + formatTitle: 'JSON-Daten mit korrekter Einrückung und Zeilenvorschüben formatieren (Strg+\\)', + insert: 'einfügen', + insertTitle: 'Fügen Sie vor diesem Feld ein neues Feld mit dem Typ \'auto\' ein (Strg+Einfg)', + insertSub: 'Wählen Sie den Typ des neuen Feldes', + object: 'Objekt', + ok: 'Ok', + redo: 'Wiederholen (Strg+Umschalt+Z)', + removeText: 'entfernen', + removeTitle: 'Ausgewählte Felder entfernen (Strg+Entf)', + removeField: 'Dieses Feld entfernen (Strg+Entf)', + repairTitle: 'JSON reparieren: Anführungszeichen und Escape-Zeichen korrigieren, Kommentare und JSONP-Notation entfernen, JavaScript-Objekte in JSON umwandeln.', + searchTitle: 'Suchfelder und Werte', + searchNextResultTitle: 'Nächstes Ergebnis (Enter)', + searchPreviousResultTitle: 'Vorheriges Ergebnis (Umschalt + Eingabe)', + selectNode: 'Wählen Sie einen Knoten aus...', + showAll: 'alle anzeigen', + showMore: 'mehr anzeigen', + showMoreStatus: 'Anzeige von ${visibleChilds} von ${totalChilds}-Elementen.', + sort: 'Sortieren', + sortTitle: 'Sortieren Sie die Elemente dieses ${type}', + sortTitleShort: 'Inhalt sortieren', + sortFieldLabel: 'Feld:', + sortDirectionLabel: 'Richtung:', + sortFieldTitle: 'Wählen Sie das verschachtelte Feld, nach dem das Array oder Objekt sortiert werden soll.', + sortAscending: 'Aufsteigend', + sortAscendingTitle: 'Sortieren Sie das ausgewählte Feld in aufsteigender Reihenfolge', + sortDescending: 'Absteigend', + sortDescendingTitle: 'Sortieren Sie das ausgewählte Feld in absteigender Reihenfolge', + string: 'Zeichenfolge', + transform: 'Verwandeln', + transformTitle: 'Die Elemente dieses ${type} filtern, sortieren oder transformieren', + transformTitleShort: 'Inhalte filtern, sortieren oder transformieren', + extract: 'Auszug', + extractTitle: 'Extrahieren Sie diesen ${type}', + transformQueryTitle: 'Eine JMESPath-Abfrage eingeben', + transformWizardLabel: 'Zauberer', + transformWizardFilter: 'Filter', + transformWizardSortBy: 'Sortieren nach', + transformWizardSelectFields: 'Felder auswählen', + transformQueryLabel: 'Anfrage', + transformPreviewLabel: 'Vorschau', + type: 'Geben Sie ein.', + typeTitle: 'Ändern Sie den Typ dieses Feldes', + openUrl: 'Strg+Klicken oder Strg+Eingabe, um die URL in einem neuen Fenster zu öffnen', + undo: 'Letzte Aktion rückgängig machen (Strg+Z)', + validationCannotMove: 'Kann ein Feld nicht in ein Kind seiner selbst verschieben', + autoType: 'Feldtyp "auto". Der Feldtyp wird automatisch aus dem Wert bestimmt und kann ein String, eine Zahl, boolesch oder null sein.', + objectType: 'Feldtyp "Objekt". Ein Objekt enthält eine ungeordnete Menge von Schlüssel/Wert-Paaren.', + arrayType: 'Feldtyp "Array". Ein Array enthält eine geordnete Sammlung von Werten.', + stringType: 'Feldtyp "Zeichenfolge". Der Feldtyp wird nicht aus dem Wert bestimmt, sondern immer als Zeichenfolge zurückgegeben.', + modeEditorTitle: 'Editor-Modus umschalten', + modeCodeText: 'Code', + modeCodeTitle: 'Umschalten auf Code-Highlighter', + modeFormText: 'Formular', + modeFormTitle: 'Zum Formular-Editor wechseln', + modeTextText: 'Text', + modeTextTitle: 'Zum Editor für einfachen Text wechseln', + modeTreeText: 'Baum', + modeTreeTitle: 'Zum Baum-Editor wechseln', + modeViewText: 'Siehe', + modeViewTitle: 'Zur Baumansicht wechseln', + modePreviewText: 'Vorschau', + modePreviewTitle: 'In den Vorschau-Modus wechseln', + examples: 'Beispiele', + "default": 'Standardmäßig', + containsInvalidProperties: 'Enthält ungültige Eigenschaften', + containsInvalidItems: 'Enthält ungültige Elemente' + }, + ru: { + array: 'Массив', + auto: 'Авто', + appendText: 'Добавить', + appendTitle: 'Добавить новое поле с типом \'авто\' после этого поля (Ctrl+Shift+Ins)', + appendSubmenuTitle: 'Выбрать тип поля для добавления', + appendTitleAuto: 'Добавить новое поле с типом \'авто\' (Ctrl+Shift+Ins)', + ascending: 'По возрастанию', + ascendingTitle: 'Сортировать ${type} по возрастанию', + actionsMenu: 'Нажмите для открытия меню действий (Ctrl+M)', + cannotParseFieldError: 'Невозможно преобразовать поле в JSON', + cannotParseValueError: 'Невозможно преобразовать значение в JSON', + collapseAll: 'Свернуть все', + compactTitle: 'Минификация JSON (Ctrl+Shift+I)', + descending: 'По убыванию', + descendingTitle: 'Сортировать ${type} по убыванию', + drag: 'Потяните для перемещения этого поля (Alt+Shift+Arrows)', + duplicateKey: 'повторяющийся ключ', + duplicateText: 'Дублировать', + duplicateTitle: 'Дублирование полей (Ctrl+D)', + duplicateField: 'Дублировать поле (Ctrl+D)', + duplicateFieldError: 'Дублирование названия поля', + empty: 'пустой', + expandAll: 'Развернуть все', + expandTitle: 'Нажмите для раскрытия/скрытия поля (Ctrl+E)\n' + 'или Ctrl+Click для раскрытия/скрытия всех потомков.', + formatTitle: 'Форматирование JSON (Ctrl+I)', + insert: 'Вставить', + insertTitle: 'Вставить новое поле с типом \'авто\' перед этим полем (Ctrl+Ins)', + insertSub: 'Выбрать тип поля для вставки', + object: 'Объект', + ok: 'ОК', + redo: 'Повторить (Ctrl+Shift+Z)', + removeText: 'Удалить', + removeTitle: 'Удалить выбранные поля (Ctrl+Del)', + removeField: 'Удалить поле (Ctrl+Del)', + repairTitle: 'Восстановите JSON: исправьте кавычки и escape-символы, удалите комментарии и нотацию JSONP, модифицируйте объекты JavaScript в JSON.', + searchTitle: 'Поиск', + searchNextResultTitle: 'Следующий результат (Enter)', + searchPreviousResultTitle: 'Предыдущий результат (Shift + Enter)', + selectNode: 'Выбор узла...', + showAll: 'показать все', + showMore: 'больше', + showMoreStatus: '${visibleChilds} из ${totalChilds}', + sort: 'Сортировка', + sortTitle: 'Сортировка потомков типа ${type}', + sortTitleShort: 'Сортировка содержимого', + sortFieldLabel: 'Поле:', + sortDirectionLabel: 'Направление:', + sortFieldTitle: 'Выберите поле для сортировки массива или объекта', + sortAscending: 'По возрастанию', + sortAscendingTitle: 'Сортировка выбранного поря по возрастанию', + sortDescending: 'По убыванию', + sortDescendingTitle: 'Сортировка выбранного поря по убыванию', + string: 'Строка', + transform: 'Модификация', + transformTitle: 'Фильтрация, сортировка или модификация данных типа ${type}', + transformTitleShort: 'Фильтрация, сортировка или модификация данных', + extract: 'Извлечение', + extractTitle: 'Извлечь тип ${type}', + transformQueryTitle: 'Введите JMESpath запрос', + transformWizardLabel: 'Мастер', + transformWizardFilter: 'Фильтр', + transformWizardSortBy: 'Сортировка', + transformWizardSelectFields: 'Поля', + transformQueryLabel: 'Запрос', + transformPreviewLabel: 'Просмотр', + type: 'Тип', + typeTitle: 'Изменить тип этого поля', + openUrl: 'Ctrl+Click или Ctrl+Enter для открытия url в новом окне', + undo: 'Отменить (Ctrl+Z)', + validationCannotMove: 'Поле не может быть перемещено в потомка', + autoType: 'Тип поля автоматически определяется по значению ' + 'и может быть строкой, числом, логическим значением или null.', + objectType: 'Объект содержит неупорядоченный набор пар ключ/значение.', + arrayType: 'Массив содержит упорядоченный набор значений.', + stringType: 'Тип поля не определяется из значения, ' + 'но всегда возвращается как строка.', + modeEditorTitle: 'Переключение режима редактора', + modeCodeText: 'Код', + modeCodeTitle: 'Переключить в режим редактора кода', + modeFormText: 'Форма', + modeFormTitle: 'Переключить в режим формы', + modeTextText: 'Текст', + modeTextTitle: 'Переключить в режим редактора текста', + modeTreeText: 'Дерево', + modeTreeTitle: 'Переключить в режим редактора дерева', + modeViewText: 'Просмотр дерева', + modeViewTitle: 'Переключить в режим просмотра дерева', + modePreviewText: 'Просмотр', + modePreviewTitle: 'Переключить в режим просмотра', + examples: 'Примеры', + "default": 'По умолчанию', + containsInvalidProperties: 'Содержит недопустимые свойства', + containsInvalidItems: 'Содержит недопустимые элементы' + }, + ko: { + array: '배열', + auto: '자동', + appendText: '추가', + appendTitle: '선택한 요소 아래에 "자동" 요소를 추가합니다. (Ctrl + Shift + Ins)', + appendSubmenuTitle: '추가할 요소의 유형을 선택해주세요.', + appendTitleAuto: '"자동" 요소를 추가합니다. (Ctrl + Shift + Ins)', + ascending: '오름차순', + ascendingTitle: '선택한 ${type}의 하위 요소를 오름차순 정렬합니다.', + actionsMenu: '메뉴 열기 (Ctrl + M)', + cannotParseFieldError: 'JSON의 요소를 해석할 수 없습니다.', + cannotParseValueError: 'JSON의 값을 해석할 수 없습니다.', + collapseAll: '모두 접기', + compactTitle: '모든 공백을 제거하여 JSON 데이터를 작게 만듭니다. (Ctrl + Shift + I)', + descending: '내림차순', + descendingTitle: '선택한 ${type}의 하위 요소를 내림차순으로 정렬', + drag: '드래그하여 요소를 이동합니다. (Alt + Shift + Arrows)', + duplicateKey: '복제키', + duplicateText: '복제', + duplicateTitle: '선택한 요소를 복제합니다. (Ctrl + D)', + duplicateField: '선택한 요소를 복제합니다. (Ctrl + D)', + duplicateFieldError: '요소 이름이 중복되었습니다.', + empty: '비어있음', + expandAll: '모두 열기', + expandTitle: '클릭하여 요소를 열거나 닫습니다. (Ctrl + E) \nCtrl + Click으로 모든 하위 요소를 열거나 닫습니다.', + formatTitle: '적절한 들여쓰기 및 줄바꿈으로 JSON 데이터를 정형화합니다. (Ctrl + I)', + insert: '삽입', + insertTitle: '선택한 요소 위에 새요소를 삽입합니다. (Ctrl + Ins)', + insertSub: '삽입할 요소의 유형을 선택해주세요.', + object: '객체', + ok: '확인', + redo: '다시 실행 (Ctrl + Shift + Z)', + removeText: '삭제', + removeTitle: '선택한 요소를 삭제합니다. (Ctrl + Del)', + removeField: '선택한 요소를 삭제합니다. (Ctrl + Del)', + repairTitle: 'JSON 교정: JSON 내의 주석과 JSONP 표기법을 지우고 따옴표와 이스케이프 문자를 수정합니다.', + searchTitle: '요소 또는 값 찾기', + searchNextResultTitle: '다음으로 찾기 (Enter)', + searchPreviousResultTitle: '이전으로 찾기 (Shift + Enter)', + selectNode: '요소를 선택해주세요...', + showAll: '모두보기', + showMore: '더보기', + showMoreStatus: '${totalChilds} 개의 항목 중 ${visibleChilds} 개를 표시합니다.', + sort: '정렬', + sortTitle: '선택한 ${type}의 하위 요소를 정렬합니다.', + sortTitleShort: '정렬', + sortFieldLabel: '요소:', + sortDirectionLabel: '순서:', + sortFieldTitle: '배열이나 객체를 정렬하는 요소를 선택해주세요.', + sortAscending: '오름차순', + sortAscendingTitle: '선택한 요소를 오름차순으로 정렬합니다.', + sortDescending: '내림차순', + sortDescendingTitle: '선택한 요소를 내림차순으로 정렬합니다.', + string: '문자', + transform: '변환', + transformTitle: '선택한 ${type}의 하위 요소를 필터하거나 정렬 또는 변환합니다.', + transformTitleShort: '내용을 필터하거나 정렬 또는 변환합니다.', + extract: '추출', + extractTitle: '선택한 ${type}의 값을 최상위에 위치시킵니다.', + transformQueryTitle: 'JMESPath 쿼리를 입력해주세요.', + transformWizardLabel: '마법사', + transformWizardFilter: '필터', + transformWizardSortBy: '정렬', + transformWizardSelectFields: '요소를 선택해주세요.', + transformQueryLabel: '쿼리', + transformPreviewLabel: '미리보기', + type: '유형', + typeTitle: '선택한 요소의 유형을 변경합니다.', + openUrl: 'Ctrl + Click 또는 Ctrl + Enter로 새 창에서 URL 열기', + undo: '실행 취소 (Ctrl + Z)', + validationCannotMove: '하위 요소로 이동할 수 없습니다.', + autoType: '자동: 요소의 형식이 값의 유형으로 결정됩니다. 문자, 숫자, 부울, 또는 null만 허용됩니다.', + objectType: '객체: 순서대로 나열되지 않은 이름/값 쌍으로 이루어진 집합입니다.', + arrayType: '배열: 순서대로 나열된 값의 집합입니다.', + stringType: '문자: 요소의 유형이 값에서 결정되지 않지만 항상 문자로 반환됩니다.', + modeEditorTitle: '편집기 유형 변경', + modeCodeText: '코드', + modeCodeTitle: '형식 교정을 도와주는 기능이 포함된 문자 편집기', + modeFormText: '입력 양식', + modeFormTitle: '정해진 요소에 값을 입력하는 편집기', + modeTextText: '문자', + modeTextTitle: '단순 문자 편집기', + modeTreeText: '트리', + modeTreeTitle: '트리 구조로 표시되는 편집기', + modeViewText: '보기', + modeViewTitle: '읽기전용 트리 구조로 JSON을 표시', + modePreviewText: '미리보기', + modePreviewTitle: '읽기전용 문자로 JSON을 표시', + examples: '예제', + "default": '기본값', + containsInvalidProperties: '잘못된 속성이 포함되어 있습니다.', + containsInvalidItems: '잘못된 항목이 포함되어 있습니다' + } +}; + +var _locales = Object.keys(_defs); + +var _defaultLang = 'en'; +var userLang = typeof navigator !== 'undefined' ? navigator.language || navigator.userLanguage : undefined; + +var _lang = _locales.find(function (l) { + return l === userLang; +}) || _defaultLang; + +function setLanguage(lang) { + if (!lang) { + return; + } + + var langFound = _locales.find(function (l) { + return l === lang; + }); + + if (langFound) { + _lang = langFound; + } else { + console.error('Language not found'); + } +} +function setLanguages(languages) { + if (!languages) { + return; + } + + var _loop = function _loop(language) { + var langFound = _locales.find(function (l) { + return l === language; + }); + + if (!langFound) { + _locales.push(language); + } + + _defs[language] = Object.assign({}, _defs[_defaultLang], _defs[language], languages[language]); + }; + + for (var language in languages) { + _loop(language); + } +} +function translate(key, data, lang) { + if (!lang) { + lang = _lang; + } + + var text = _defs[lang][key] || _defs[_defaultLang][key] || key; + + if (data) { + for (var dataKey in data) { + text = text.replace('${' + dataKey + '}', data[dataKey]); + } + } + + return text; +} + +/***/ }), + +/***/ 56: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "r": function() { return /* binding */ createQuery; }, +/* harmony export */ "J": function() { return /* binding */ executeQuery; } +/* harmony export */ }); +/* harmony import */ var jmespath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156); +/* harmony import */ var jmespath__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jmespath__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(791); + + +/** + * Build a JMESPath query based on query options coming from the wizard + * @param {JSON} json The JSON document for which to build the query. + * Used for context information like determining + * the type of values (string or number) + * @param {QueryOptions} queryOptions + * @return {string} Returns a query (as string) + */ + +function createQuery(json, queryOptions) { + var sort = queryOptions.sort, + filter = queryOptions.filter, + projection = queryOptions.projection; + var query = ''; + + if (filter) { + var examplePath = filter.field !== '@' ? ['0'].concat((0,_util__WEBPACK_IMPORTED_MODULE_1__.parsePath)('.' + filter.field)) : ['0']; + var exampleValue = (0,_util__WEBPACK_IMPORTED_MODULE_1__.get)(json, examplePath); + var value1 = typeof exampleValue === 'string' ? filter.value : (0,_util__WEBPACK_IMPORTED_MODULE_1__.parseString)(filter.value); + query += '[? ' + filter.field + ' ' + filter.relation + ' ' + '`' + JSON.stringify(value1) + '`' + ']'; + } else { + query += Array.isArray(json) ? '[*]' : '@'; + } + + if (sort) { + if (sort.direction === 'desc') { + query += ' | reverse(sort_by(@, &' + sort.field + '))'; + } else { + query += ' | sort_by(@, &' + sort.field + ')'; + } + } + + if (projection) { + if (query[query.length - 1] !== ']') { + query += ' | [*]'; + } + + if (projection.fields.length === 1) { + query += '.' + projection.fields[0]; + } else if (projection.fields.length > 1) { + query += '.{' + projection.fields.map(function (value) { + var parts = value.split('.'); + var last = parts[parts.length - 1]; + return last + ': ' + value; + }).join(', ') + '}'; + } else {// values.length === 0 + // ignore + } + } + + return query; +} +/** + * Execute a JMESPath query + * @param {JSON} json + * @param {string} query + * @return {JSON} Returns the transformed JSON + */ + +function executeQuery(json, query) { + return jmespath__WEBPACK_IMPORTED_MODULE_0___default().search(json, query); +} + +/***/ }), + +/***/ 987: +/***/ (function() { + +if (typeof Element !== 'undefined') { + // Polyfill for array remove + (function () { + function polyfill(item) { + if ('remove' in item) { + return; + } + + Object.defineProperty(item, 'remove', { + configurable: true, + enumerable: true, + writable: true, + value: function remove() { + if (this.parentNode !== undefined) { + this.parentNode.removeChild(this); + } + } + }); + } + + if (typeof window.Element !== 'undefined') { + polyfill(window.Element.prototype); + } + + if (typeof window.CharacterData !== 'undefined') { + polyfill(window.CharacterData.prototype); + } + + if (typeof window.DocumentType !== 'undefined') { + polyfill(window.DocumentType.prototype); + } + })(); +} // simple polyfill for Array.findIndex + + +if (!Array.prototype.findIndex) { + // eslint-disable-next-line no-extend-native + Object.defineProperty(Array.prototype, 'findIndex', { + value: function value(predicate) { + for (var i = 0; i < this.length; i++) { + var element = this[i]; + + if (predicate.call(this, element, i, this)) { + return i; + } + } + + return -1; + }, + configurable: true, + writable: true + }); +} // Polyfill for Array.find + + +if (!Array.prototype.find) { + // eslint-disable-next-line no-extend-native + Object.defineProperty(Array.prototype, 'find', { + value: function value(predicate) { + var i = this.findIndex(predicate); + return this[i]; + }, + configurable: true, + writable: true + }); +} // Polyfill for String.trim + + +if (!String.prototype.trim) { + // eslint-disable-next-line no-extend-native + String.prototype.trim = function () { + return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + }; +} + +/***/ }), + +/***/ 341: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "previewModeMixins": function() { return /* binding */ previewModeMixins; } +}); + +// EXTERNAL MODULE: ./node_modules/jsonrepair/lib/umd/jsonrepair.min.js +var jsonrepair_min = __webpack_require__(664); +var jsonrepair_min_default = /*#__PURE__*/__webpack_require__.n(jsonrepair_min); +// EXTERNAL MODULE: ./src/js/constants.js +var constants = __webpack_require__(188); +// EXTERNAL MODULE: ./src/js/ErrorTable.js +var ErrorTable = __webpack_require__(436); +// EXTERNAL MODULE: ./src/js/FocusTracker.js +var FocusTracker = __webpack_require__(474); +;// CONCATENATED MODULE: ./src/js/History.js +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +/** + * Keep track on any history, be able + * @param {function} onChange + * @param {function} calculateItemSize + * @param {number} limit Maximum size of all items in history + * @constructor + */ +var History = /*#__PURE__*/function () { + function History(onChange, calculateItemSize, limit) { + _classCallCheck(this, History); + + this.onChange = onChange; + + this.calculateItemSize = calculateItemSize || function () { + return 1; + }; + + this.limit = limit; + this.items = []; + this.index = -1; + } + + _createClass(History, [{ + key: "add", + value: function add(item) { + // limit number of items in history so that the total size doesn't + // always keep at least one item in memory + while (this._calculateHistorySize() > this.limit && this.items.length > 1) { + this.items.shift(); + this.index--; + } // cleanup any redo action that are not valid anymore + + + this.items = this.items.slice(0, this.index + 1); + this.items.push(item); + this.index++; + this.onChange(); + } + }, { + key: "_calculateHistorySize", + value: function _calculateHistorySize() { + var calculateItemSize = this.calculateItemSize; + var totalSize = 0; + this.items.forEach(function (item) { + totalSize += calculateItemSize(item); + }); + return totalSize; + } + }, { + key: "undo", + value: function undo() { + if (!this.canUndo()) { + return; + } + + this.index--; + this.onChange(); + return this.items[this.index]; + } + }, { + key: "redo", + value: function redo() { + if (!this.canRedo()) { + return; + } + + this.index++; + this.onChange(); + return this.items[this.index]; + } + }, { + key: "canUndo", + value: function canUndo() { + return this.index > 0; + } + }, { + key: "canRedo", + value: function canRedo() { + return this.index < this.items.length - 1; + } + }, { + key: "clear", + value: function clear() { + this.items = []; + this.index = -1; + this.onChange(); + } + }]); + + return History; +}(); +// EXTERNAL MODULE: ./src/js/i18n.js +var i18n = __webpack_require__(907); +// EXTERNAL MODULE: ./src/js/jmespathQuery.js +var jmespathQuery = __webpack_require__(56); +// EXTERNAL MODULE: ./src/js/ModeSwitcher.js +var ModeSwitcher = __webpack_require__(617); +// EXTERNAL MODULE: ./src/js/showSortModal.js +var showSortModal = __webpack_require__(210); +// EXTERNAL MODULE: ./src/js/showTransformModal.js + 1 modules +var showTransformModal = __webpack_require__(558); +// EXTERNAL MODULE: ./src/js/textmode.js + 1 modules +var textmode = __webpack_require__(956); +// EXTERNAL MODULE: ./src/js/util.js +var util = __webpack_require__(791); +;// CONCATENATED MODULE: ./src/js/previewmode.js + + + + + + + + + + + + + + +var previewmode_textmode = textmode.textModeMixins[0].mixin; // create a mixin with the functions for text mode + +var previewmode = {}; +/** + * Create a JSON document preview, suitable for processing of large documents + * @param {Element} container + * @param {Object} [options] Object with options. See docs for details. + * @private + */ + +previewmode.create = function (container) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (typeof options.statusBar === 'undefined') { + options.statusBar = true; + } // setting default for previewmode + + + options.mainMenuBar = options.mainMenuBar !== false; + options.enableSort = options.enableSort !== false; + options.enableTransform = options.enableTransform !== false; + options.createQuery = options.createQuery || jmespathQuery/* createQuery */.r; + options.executeQuery = options.executeQuery || jmespathQuery/* executeQuery */.J; + this.options = options; // indentation + + if (typeof options.indentation === 'number') { + this.indentation = Number(options.indentation); + } else { + this.indentation = 2; // number of spaces + } // language + + + (0,i18n/* setLanguages */.cC)(this.options.languages); + (0,i18n/* setLanguage */.m0)(this.options.language); // determine mode + + this.mode = 'preview'; + var me = this; + this.container = container; + this.dom = {}; + this.json = undefined; + this.text = ''; // TODO: JSON Schema support + // create a debounced validate function + + this._debouncedValidate = (0,util.debounce)(this.validate.bind(this), this.DEBOUNCE_INTERVAL); + this.width = container.clientWidth; + this.height = container.clientHeight; + this.frame = document.createElement('div'); + this.frame.className = 'jsoneditor jsoneditor-mode-preview'; + + this.frame.onclick = function (event) { + // prevent default submit action when the editor is located inside a form + event.preventDefault(); + }; // setting the FocusTracker on 'this.frame' to track the editor's focus event + + + var focusTrackerConfig = { + target: this.frame, + onFocus: this.options.onFocus || null, + onBlur: this.options.onBlur || null + }; + this.frameFocusTracker = new FocusTracker/* FocusTracker */.R(focusTrackerConfig); + this.content = document.createElement('div'); + this.content.className = 'jsoneditor-outer'; + this.dom.busy = document.createElement('div'); + this.dom.busy.className = 'jsoneditor-busy'; + this.dom.busyContent = document.createElement('span'); + this.dom.busyContent.textContent = 'busy...'; + this.dom.busy.appendChild(this.dom.busyContent); + this.content.appendChild(this.dom.busy); + this.dom.previewContent = document.createElement('pre'); + this.dom.previewContent.className = 'jsoneditor-preview'; + this.dom.previewText = document.createTextNode(''); + this.dom.previewContent.appendChild(this.dom.previewText); + this.content.appendChild(this.dom.previewContent); + + if (this.options.mainMenuBar) { + (0,util.addClassName)(this.content, 'has-main-menu-bar'); // create menu + + this.menu = document.createElement('div'); + this.menu.className = 'jsoneditor-menu'; + this.frame.appendChild(this.menu); // create format button + + var buttonFormat = document.createElement('button'); + buttonFormat.type = 'button'; + buttonFormat.className = 'jsoneditor-format'; + buttonFormat.title = (0,i18n/* translate */.Iu)('formatTitle'); + this.menu.appendChild(buttonFormat); + + buttonFormat.onclick = function handleFormat() { + me.executeWithBusyMessage(function () { + try { + me.format(); + } catch (err) { + me._onError(err); + } + }, 'formatting...'); + }; // create compact button + + + var buttonCompact = document.createElement('button'); + buttonCompact.type = 'button'; + buttonCompact.className = 'jsoneditor-compact'; + buttonCompact.title = (0,i18n/* translate */.Iu)('compactTitle'); + this.menu.appendChild(buttonCompact); + + buttonCompact.onclick = function handleCompact() { + me.executeWithBusyMessage(function () { + try { + me.compact(); + } catch (err) { + me._onError(err); + } + }, 'compacting...'); + }; // create sort button + + + if (this.options.enableSort) { + var _sort = document.createElement('button'); + + _sort.type = 'button'; + _sort.className = 'jsoneditor-sort'; + _sort.title = (0,i18n/* translate */.Iu)('sortTitleShort'); + + _sort.onclick = function () { + me._showSortModal(); + }; + + this.menu.appendChild(_sort); + } // create transform button + + + if (this.options.enableTransform) { + var transform = document.createElement('button'); + transform.type = 'button'; + transform.title = (0,i18n/* translate */.Iu)('transformTitleShort'); + transform.className = 'jsoneditor-transform'; + + transform.onclick = function () { + me._showTransformModal(); + }; + + this.dom.transform = transform; + this.menu.appendChild(transform); + } // create repair button + + + var buttonRepair = document.createElement('button'); + buttonRepair.type = 'button'; + buttonRepair.className = 'jsoneditor-repair'; + buttonRepair.title = (0,i18n/* translate */.Iu)('repairTitle'); + this.menu.appendChild(buttonRepair); + + buttonRepair.onclick = function () { + if (me.json === undefined) { + // only repair if we don't have valid JSON + me.executeWithBusyMessage(function () { + try { + me.repair(); + } catch (err) { + me._onError(err); + } + }, 'repairing...'); + } + }; // create history and undo/redo buttons + + + if (this.options.history !== false) { + // default option value is true + var onHistoryChange = function onHistoryChange() { + me.dom.undo.disabled = !me.history.canUndo(); + me.dom.redo.disabled = !me.history.canRedo(); + }; + + var calculateItemSize = function calculateItemSize(item) { + return (// times two to account for the json object + item.text.length * 2 + ); + }; + + this.history = new History(onHistoryChange, calculateItemSize, constants/* PREVIEW_HISTORY_LIMIT */.oW); // create undo button + + var undo = document.createElement('button'); + undo.type = 'button'; + undo.className = 'jsoneditor-undo jsoneditor-separator'; + undo.title = (0,i18n/* translate */.Iu)('undo'); + + undo.onclick = function () { + var action = me.history.undo(); + + if (action) { + me._applyHistory(action); + } + }; + + this.menu.appendChild(undo); + this.dom.undo = undo; // create redo button + + var redo = document.createElement('button'); + redo.type = 'button'; + redo.className = 'jsoneditor-redo'; + redo.title = (0,i18n/* translate */.Iu)('redo'); + + redo.onclick = function () { + var action = me.history.redo(); + + if (action) { + me._applyHistory(action); + } + }; + + this.menu.appendChild(redo); + this.dom.redo = redo; // force enabling/disabling the undo/redo button + + this.history.onChange(); + } // create mode box + + + if (this.options && this.options.modes && this.options.modes.length) { + this.modeSwitcher = new ModeSwitcher/* ModeSwitcher */.x(this.menu, this.options.modes, this.options.mode, function onSwitch(mode) { + // switch mode and restore focus + me.setMode(mode); + me.modeSwitcher.focus(); + }); + } + } + + this.errorTable = new ErrorTable/* ErrorTable */.Q({ + errorTableVisible: true, + onToggleVisibility: function onToggleVisibility() { + me.validate(); + }, + onFocusLine: null, + onChangeHeight: function onChangeHeight(height) { + // TODO: change CSS to using flex box, remove setting height using JavaScript + var statusBarHeight = me.dom.statusBar ? me.dom.statusBar.clientHeight : 0; + var totalHeight = height + statusBarHeight + 1; + me.content.style.marginBottom = -totalHeight + 'px'; + me.content.style.paddingBottom = totalHeight + 'px'; + } + }); + this.frame.appendChild(this.content); + this.frame.appendChild(this.errorTable.getErrorTable()); + this.container.appendChild(this.frame); + + if (options.statusBar) { + (0,util.addClassName)(this.content, 'has-status-bar'); + var statusBar = document.createElement('div'); + this.dom.statusBar = statusBar; + statusBar.className = 'jsoneditor-statusbar'; + this.frame.appendChild(statusBar); + this.dom.fileSizeInfo = document.createElement('span'); + this.dom.fileSizeInfo.className = 'jsoneditor-size-info'; + this.dom.fileSizeInfo.innerText = ''; + statusBar.appendChild(this.dom.fileSizeInfo); + this.dom.arrayInfo = document.createElement('span'); + this.dom.arrayInfo.className = 'jsoneditor-size-info'; + this.dom.arrayInfo.innerText = ''; + statusBar.appendChild(this.dom.arrayInfo); + statusBar.appendChild(this.errorTable.getErrorCounter()); + statusBar.appendChild(this.errorTable.getWarningIcon()); + statusBar.appendChild(this.errorTable.getErrorIcon()); + } + + this._renderPreview(); + + this.setSchema(this.options.schema, this.options.schemaRefs); +}; + +previewmode._renderPreview = function () { + var text = this.getText(); + this.dom.previewText.nodeValue = (0,util.limitCharacters)(text, constants/* MAX_PREVIEW_CHARACTERS */.WF); + + if (this.dom.fileSizeInfo) { + this.dom.fileSizeInfo.innerText = 'Size: ' + (0,util.formatSize)(text.length); + } + + if (this.dom.arrayInfo) { + if (Array.isArray(this.json)) { + this.dom.arrayInfo.innerText = 'Array: ' + this.json.length + ' items'; + } else { + this.dom.arrayInfo.innerText = ''; + } + } +}; +/** + * Handle a change: + * - Validate JSON schema + * - Send a callback to the onChange listener if provided + * @private + */ + + +previewmode._onChange = function () { + // validate JSON schema (if configured) + this._debouncedValidate(); // trigger the onChange callback + + + if (this.options.onChange) { + try { + this.options.onChange(); + } catch (err) { + console.error('Error in onChange callback: ', err); + } + } // trigger the onChangeJSON callback + + + if (this.options.onChangeJSON) { + try { + this.options.onChangeJSON(this.get()); + } catch (err) { + console.error('Error in onChangeJSON callback: ', err); + } + } // trigger the onChangeText callback + + + if (this.options.onChangeText) { + try { + this.options.onChangeText(this.getText()); + } catch (err) { + console.error('Error in onChangeText callback: ', err); + } + } +}; +/** + * Open a sort modal + * @private + */ + + +previewmode._showSortModal = function () { + var me = this; + + function onSort(json, sortedBy) { + if (Array.isArray(json)) { + var sortedArray = (0,util.sort)(json, sortedBy.path, sortedBy.direction); + me.sortedBy = sortedBy; + + me._setAndFireOnChange(sortedArray); + } + + if ((0,util.isObject)(json)) { + var sortedObject = (0,util.sortObjectKeys)(json, sortedBy.direction); + me.sortedBy = sortedBy; + + me._setAndFireOnChange(sortedObject); + } + } + + this.executeWithBusyMessage(function () { + var container = me.options.modalAnchor || constants/* DEFAULT_MODAL_ANCHOR */.qD; + var json = me.get(); + + me._renderPreview(); // update array count + + + (0,showSortModal.showSortModal)(container, json, function (sortedBy) { + me.executeWithBusyMessage(function () { + onSort(json, sortedBy); + }, 'sorting...'); + }, me.sortedBy); + }, 'parsing...'); +}; +/** + * Open a transform modal + * @private + */ + + +previewmode._showTransformModal = function () { + var _this = this; + + this.executeWithBusyMessage(function () { + var _this$options = _this.options, + createQuery = _this$options.createQuery, + executeQuery = _this$options.executeQuery, + modalAnchor = _this$options.modalAnchor, + queryDescription = _this$options.queryDescription; + + var json = _this.get(); + + _this._renderPreview(); // update array count + + + (0,showTransformModal.showTransformModal)({ + container: modalAnchor || constants/* DEFAULT_MODAL_ANCHOR */.qD, + json: json, + queryDescription: queryDescription, + // can be undefined + createQuery: createQuery, + executeQuery: executeQuery, + onTransform: function onTransform(query) { + _this.executeWithBusyMessage(function () { + var updatedJson = executeQuery(json, query); + + _this._setAndFireOnChange(updatedJson); + }, 'transforming...'); + } + }); + }, 'parsing...'); +}; +/** + * Destroy the editor. Clean up DOM, event listeners, and web workers. + */ + + +previewmode.destroy = function () { + if (this.frame && this.container && this.frame.parentNode === this.container) { + this.container.removeChild(this.frame); + } + + if (this.modeSwitcher) { + this.modeSwitcher.destroy(); + this.modeSwitcher = null; + } + + this._debouncedValidate = null; + + if (this.history) { + this.history.clear(); + this.history = null; + } // Removing the FocusTracker set to track the editor's focus event + + + this.frameFocusTracker.destroy(); +}; +/** + * Compact the code in the text editor + */ + + +previewmode.compact = function () { + var json = this.get(); + var text = JSON.stringify(json); // we know that in this case the json is still the same, so we pass json too + + this._setTextAndFireOnChange(text, json); +}; +/** + * Format the code in the text editor + */ + + +previewmode.format = function () { + var json = this.get(); + var text = JSON.stringify(json, null, this.indentation); // we know that in this case the json is still the same, so we pass json too + + this._setTextAndFireOnChange(text, json); +}; +/** + * Repair the code in the text editor + */ + + +previewmode.repair = function () { + var text = this.getText(); + + try { + var repairedText = jsonrepair_min_default()(text); + + this._setTextAndFireOnChange(repairedText); + } catch (err) {// repair was not successful, do nothing + } +}; +/** + * Set focus to the editor + */ + + +previewmode.focus = function () { + // we don't really have a place to focus, + // let's focus on the transform button + this.dom.transform.focus(); +}; +/** + * Set json data in the editor + * @param {*} json + */ + + +previewmode.set = function (json) { + if (this.history) { + this.history.clear(); + } + + this._set(json); +}; +/** + * Update data. Same as calling `set` in text/code mode. + * @param {*} json + */ + + +previewmode.update = function (json) { + this._set(json); +}; +/** + * Set json data + * @param {*} json + */ + + +previewmode._set = function (json) { + this.text = undefined; + this.json = json; + + this._renderPreview(); + + this._pushHistory(); // validate JSON schema + + + this._debouncedValidate(); +}; + +previewmode._setAndFireOnChange = function (json) { + this._set(json); + + this._onChange(); +}; +/** + * Get json data + * @return {*} json + */ + + +previewmode.get = function () { + if (this.json === undefined) { + var text = this.getText(); + this.json = (0,util.parse)(text); // this can throw an error + } + + return this.json; +}; +/** + * Get the text contents of the editor + * @return {String} jsonText + */ + + +previewmode.getText = function () { + if (this.text === undefined) { + this.text = JSON.stringify(this.json, null, this.indentation); + + if (this.options.escapeUnicode === true) { + this.text = (0,util.escapeUnicodeChars)(this.text); + } + } + + return this.text; +}; +/** + * Set the text contents of the editor + * @param {String} jsonText + */ + + +previewmode.setText = function (jsonText) { + if (this.history) { + this.history.clear(); + } + + this._setText(jsonText); +}; +/** + * Update the text contents + * @param {string} jsonText + */ + + +previewmode.updateText = function (jsonText) { + // don't update if there are no changes + if (this.getText() === jsonText) { + return; + } + + this._setText(jsonText); +}; +/** + * Set the text contents of the editor + * @param {string} jsonText + * @param {*} [json] Optional JSON instance of the text + * @private + */ + + +previewmode._setText = function (jsonText, json) { + if (this.options.escapeUnicode === true) { + this.text = (0,util.escapeUnicodeChars)(jsonText); + } else { + this.text = jsonText; + } + + this.json = json; + + this._renderPreview(); + + if (this.json === undefined) { + var me = this; + this.executeWithBusyMessage(function () { + try { + // force parsing the json now, else it will be done in validate without feedback + me.json = me.get(); + + me._renderPreview(); + + me._pushHistory(); + } catch (err) {// no need to throw an error, validation will show an error + } + }, 'parsing...'); + } else { + this._pushHistory(); + } + + this._debouncedValidate(); +}; +/** + * Set text and fire onChange callback + * @param {string} jsonText + * @param {*} [json] Optional JSON instance of the text + * @private + */ + + +previewmode._setTextAndFireOnChange = function (jsonText, json) { + this._setText(jsonText, json); + + this._onChange(); +}; +/** + * Apply history to the current state + * @param {{json?: JSON, text?: string}} action + * @private + */ + + +previewmode._applyHistory = function (action) { + this.json = action.json; + this.text = action.text; + + this._renderPreview(); + + this._debouncedValidate(); +}; +/** + * Push the current state to history + * @private + */ + + +previewmode._pushHistory = function () { + if (!this.history) { + return; + } + + var action = { + text: this.text, + json: this.json + }; + this.history.add(action); +}; +/** + * Execute a heavy, blocking action. + * Before starting the action, show a message on screen like "parsing..." + * @param {function} fn + * @param {string} message + */ + + +previewmode.executeWithBusyMessage = function (fn, message) { + var size = this.getText().length; + + if (size > constants/* SIZE_LARGE */.EX) { + var me = this; + (0,util.addClassName)(me.frame, 'busy'); + me.dom.busyContent.innerText = message; + setTimeout(function () { + fn(); + (0,util.removeClassName)(me.frame, 'busy'); + me.dom.busyContent.innerText = ''; + }, 100); + } else { + fn(); + } +}; // TODO: refactor into composable functions instead of this shaky mixin-like structure + + +previewmode.validate = previewmode_textmode.validate; +previewmode._renderErrors = previewmode_textmode._renderErrors; // define modes + +var previewModeMixins = [{ + mode: 'preview', + mixin: previewmode, + data: 'json' +}]; + +/***/ }), + +/***/ 210: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "showSortModal": function() { return /* binding */ showSortModal; } +/* harmony export */ }); +/* harmony import */ var picomodal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(483); +/* harmony import */ var picomodal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(picomodal__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(907); +/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(791); + + + +/** + * Show advanced sorting modal + * @param {HTMLElement} container The container where to center + * the modal and create an overlay + * @param {JSON} json The JSON data to be sorted. + * @param {function} onSort Callback function, invoked with + * an object containing the selected + * path and direction + * @param {Object} options + * Available options: + * - {string} path The selected path + * - {'asc' | 'desc'} direction The selected direction + */ + +function showSortModal(container, json, onSort, options) { + var paths = Array.isArray(json) ? (0,_util__WEBPACK_IMPORTED_MODULE_2__.getChildPaths)(json) : ['']; + var selectedPath = options && options.path && (0,_util__WEBPACK_IMPORTED_MODULE_2__.contains)(paths, options.path) ? options.path : paths[0]; + var selectedDirection = options && options.direction || 'asc'; + var content = '
    ' + '
    ' + (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('sort') + '
    ' + '
    ' + '' + '' + '' + ' ' + ' ' + '' + '' + ' ' + ' ' + '' + '' + '' + '' + '' + '
    ' + (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('sortFieldLabel') + ' ' + '
    ' + ' ' + '
    ' + '
    ' + (0,_i18n__WEBPACK_IMPORTED_MODULE_1__/* .translate */ .Iu)('sortDirectionLabel') + ' ' + '
    ' + '' + '' + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    '; + picomodal__WEBPACK_IMPORTED_MODULE_0___default()({ + parent: container, + content: content, + overlayClass: 'jsoneditor-modal-overlay', + overlayStyles: { + backgroundColor: 'rgb(1,1,1)', + opacity: 0.3 + }, + modalClass: 'jsoneditor-modal jsoneditor-modal-sort' + }).afterCreate(function (modal) { + var form = modal.modalElem().querySelector('form'); + var ok = modal.modalElem().querySelector('#ok'); + var field = modal.modalElem().querySelector('#field'); + var direction = modal.modalElem().querySelector('#direction'); + + function preprocessPath(path) { + return path === '' ? '@' : path[0] === '.' ? path.slice(1) : path; + } + + paths.forEach(function (path) { + var option = document.createElement('option'); + option.text = preprocessPath(path); + option.value = path; + field.appendChild(option); + }); + + function setDirection(value) { + direction.value = value; + direction.className = 'jsoneditor-button-group jsoneditor-button-group-value-' + direction.value; + } + + field.value = selectedPath || paths[0]; + setDirection(selectedDirection || 'asc'); + + direction.onclick = function (event) { + setDirection(event.target.getAttribute('data-value')); + }; + + ok.onclick = function (event) { + event.preventDefault(); + event.stopPropagation(); + modal.close(); + onSort({ + path: field.value, + direction: direction.value + }); + }; + + if (form) { + // form is not available when JSONEditor is created inside a form + form.onsubmit = ok.onclick; + } + }).afterClose(function (modal) { + modal.destroy(); + }).show(); +} + +/***/ }), + +/***/ 558: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "showTransformModal": function() { return /* binding */ showTransformModal; } +}); + +// EXTERNAL MODULE: ./node_modules/picomodal/src/picoModal.js +var picoModal = __webpack_require__(483); +var picoModal_default = /*#__PURE__*/__webpack_require__.n(picoModal); +// EXTERNAL MODULE: ./src/js/assets/selectr/selectr.js +var selectr = __webpack_require__(879); +var selectr_default = /*#__PURE__*/__webpack_require__.n(selectr); +// EXTERNAL MODULE: ./src/js/i18n.js +var i18n = __webpack_require__(907); +;// CONCATENATED MODULE: ./src/js/jsonUtils.js + +/** + * Convert part of a JSON object to a JSON string. + * Use case is to stringify a small part of a large JSON object so you can see + * a preview. + * + * @param {*} value + * The value to convert to a JSON string. + * + * @param {number | string | null} [space] + * A String or Number object that's used to insert white space into the output + * JSON string for readability purposes. If this is a Number, it indicates the + * number of space characters to use as white space; this number is capped at 10 + * if it's larger than that. Values less than 1 indicate that no space should be + * used. If this is a String, the string (or the first 10 characters of the string, + * if it's longer than that) is used as white space. If this parameter is not + * provided (or is null), no white space is used. + * + * @param {number} [limit] Maximum size of the string output. + * + * @returns {string | undefined} Returns the string representation of the JSON object. + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function stringifyPartial(value, space, limit) { + var _space; // undefined by default + + + if (typeof space === 'number') { + if (space > 10) { + _space = repeat(' ', 10); + } else if (space >= 1) { + _space = repeat(' ', space); + } // else ignore + + } else if (typeof space === 'string' && space !== '') { + _space = space; + } + + var output = stringifyValue(value, _space, '', limit); + return output.length > limit ? slice(output, limit) + '...' : output; +} +/** + * Stringify a value + * @param {*} value + * @param {string} space + * @param {string} indent + * @param {number} limit + * @return {string | undefined} + */ + +function stringifyValue(value, space, indent, limit) { + // boolean, null, number, string, or date + if (typeof value === 'boolean' || value instanceof Boolean || value === null || typeof value === 'number' || value instanceof Number || typeof value === 'string' || value instanceof String || value instanceof Date) { + return JSON.stringify(value); + } // array + + + if (Array.isArray(value)) { + return stringifyArray(value, space, indent, limit); + } // object (test lastly!) + + + if (value && _typeof(value) === 'object') { + return stringifyObject(value, space, indent, limit); + } + + return undefined; +} +/** + * Stringify an array + * @param {Array} array + * @param {string} space + * @param {string} indent + * @param {number} limit + * @return {string} + */ + + +function stringifyArray(array, space, indent, limit) { + var childIndent = space ? indent + space : undefined; + var str = space ? '[\n' : '['; + + for (var i = 0; i < array.length; i++) { + var item = array[i]; + + if (space) { + str += childIndent; + } + + if (typeof item !== 'undefined' && typeof item !== 'function') { + str += stringifyValue(item, space, childIndent, limit); + } else { + str += 'null'; + } + + if (i < array.length - 1) { + str += space ? ',\n' : ','; + } // stop as soon as we're exceeding the limit + + + if (str.length > limit) { + return str + '...'; + } + } + + str += space ? '\n' + indent + ']' : ']'; + return str; +} +/** + * Stringify an object + * @param {Object} object + * @param {string} space + * @param {string} indent + * @param {number} limit + * @return {string} + */ + + +function stringifyObject(object, space, indent, limit) { + var childIndent = space ? indent + space : undefined; + var first = true; + var str = space ? '{\n' : '{'; + + if (typeof object.toJSON === 'function') { + return stringifyValue(object.toJSON(), space, indent, limit); + } + + for (var key in object) { + if (jsonUtils_hasOwnProperty(object, key)) { + var value = object[key]; + + if (first) { + first = false; + } else { + str += space ? ',\n' : ','; + } + + str += space ? childIndent + '"' + key + '": ' : '"' + key + '":'; + str += stringifyValue(value, space, childIndent, limit); // stop as soon as we're exceeding the limit + + if (str.length > limit) { + return str + '...'; + } + } + } + + str += space ? '\n' + indent + '}' : '}'; + return str; +} +/** + * Repeat a string a number of times. + * Simple linear solution, we only need up to 10 iterations in practice + * @param {string} text + * @param {number} times + * @return {string} + */ + + +function repeat(text, times) { + var res = ''; + + while (times-- > 0) { + res += text; + } + + return res; +} +/** + * Limit the length of text + * @param {string} text + * @param {number} [limit] + * @return {string} + */ + + +function slice(text, limit) { + return typeof limit === 'number' ? text.slice(0, limit) : text; +} +/** + * Test whether some text contains a JSON array, i.e. the first + * non-white space character is a [ + * @param {string} jsonText + * @return {boolean} + */ + + +function containsArray(jsonText) { + return /^\s*\[/.test(jsonText); +} + +function jsonUtils_hasOwnProperty(object, key) { + return Object.prototype.hasOwnProperty.call(object, key); +} +// EXTERNAL MODULE: ./src/js/util.js +var util = __webpack_require__(791); +// EXTERNAL MODULE: ./src/js/constants.js +var constants = __webpack_require__(188); +;// CONCATENATED MODULE: ./src/js/showTransformModal.js + + + + + + +var DEFAULT_DESCRIPTION = 'Enter a JMESPath query to filter, sort, or transform the JSON data.
    ' + 'To learn JMESPath, go to the interactive tutorial.'; +/** + * Show advanced filter and transform modal using JMESPath + * @param {Object} params + * @property {HTMLElement} container The container where to center + * the modal and create an overlay + * @property {JSON} json The json data to be transformed + * @property {string} [queryDescription] Optional custom description explaining + * the transform functionality + * @property {function} createQuery Function called to create a query + * from the wizard form + * @property {function} executeQuery Execute a query for the preview pane + * @property {function} onTransform Callback invoked with the created + * query as callback + */ + +function showTransformModal(_ref) { + var container = _ref.container, + json = _ref.json, + _ref$queryDescription = _ref.queryDescription, + queryDescription = _ref$queryDescription === void 0 ? DEFAULT_DESCRIPTION : _ref$queryDescription, + createQuery = _ref.createQuery, + executeQuery = _ref.executeQuery, + onTransform = _ref.onTransform; + var value = json; + var content = '