New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mstform

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mstform - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

9

CHANGES.md

@@ -0,1 +1,10 @@

# 0.21.0
- Added a warning and error hook to the `Subform`, `RepeatingForm`,
and `Form` accessors. These hooks are accessible the same way as
the warning and error hooks of the field accessors.
- Removed functionality to add errors to `RepeatingForm` directly; instead
this can be done via the error hook.
# 0.20.0

@@ -2,0 +11,0 @@

2

dist/mstform.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("mobx"),require("mobx-state-tree")):"function"==typeof define&&define.amd?define(["mobx","mobx-state-tree"],t):"object"==typeof exports?exports.mstform=t(require("mobx"),require("mobx-state-tree")):e.mstform=t(e.mobx,e["mobx-state-tree"])}(window,function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";r.r(t);var n={value:function(e){return{value:e.raw,onChange:function(t){return e.setRaw(t.target.value)}}},checked:function(e){return{checked:e.raw,onChange:function(t){return e.setRaw(t.target.checked)}}},object:function(e){return{value:e.raw,onChange:function(t){return e.setRaw(t)}}}},o=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},i=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=function(){return function(e){this.value=e}}(),s=function(){function e(e){this.definition=e,this.neverRequired=!1,this.emptyRaw=e.emptyRaw,this.defaultControlled=e.defaultControlled?e.defaultControlled:n.object,this.neverRequired=!!e.neverRequired}return e.prototype.preprocessRaw=function(e){return e},e.prototype.convert=function(e){return o(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return this.definition.rawValidate?[4,this.definition.rawValidate(e)]:[3,2];case 1:if(!r.sent())return[2,"ConversionError"];r.label=2;case 2:return t=this.definition.convert(e),this.definition.validate?[4,this.definition.validate(t)]:[3,4];case 3:if(!r.sent())return[2,"ConversionError"];r.label=4;case 4:return[2,new a(t)]}})})},e.prototype.render=function(e){return this.definition.render(e)},e}(),u=r(0),c=r(1);function p(e){return e}function l(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/")}function f(e){return Number.isInteger(parseInt(e,10))}function d(e,t){return function e(t,r){var n=r[0],o=r.slice(1);if(0===o.length)return t[n];var i=t[n];if(void 0===i)return;return e(i,o)}(e,l(t))}function y(e,t){return function e(t,r){var n=r[0],o=r.slice(1);0===o.length&&delete t[n];var i=t[n];if(void 0===i)return;e(i,o)}(e,l(t))}var h=function(){return{}};function g(e){h=e}var b=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},v=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},m=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},w=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},O=function(){function e(e,t,r,n){var o=this;this.state=e,this.field=t,this.parent=r,this._isValidating=!1,this._addMode=!1,this.handleChange=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return m(o,void 0,void 0,function(){var t,r;return w(this,function(n){switch(n.label){case 0:return r=(t=this.field).getRaw.apply(t,e),[4,this.setRaw(r)];case 1:return n.sent(),[2]}})})},this.handleFocus=function(e){null!=o.state.focusFunc&&o.state.focusFunc(e,o)},this.name=n,this.createDerivedReaction()}var t,r,n;return e.prototype.clear=function(){null!=this._disposer&&this._disposer()},Object.defineProperty(e.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),e.prototype.setDisposer=function(e){this._disposer=e},e.prototype.createDerivedReaction=function(){var e=this,t=this.field.derivedFunc;if(null!=t&&null==this._disposer){var r=Object(u.reaction)(function(){return e.node?t(e.node):void 0},function(t){void 0!==t&&e.setRaw(e.field.render(t))});this._disposer=r}},Object.defineProperty(e.prototype,"node",{get:function(){try{return this.state.getValue(this.parent.path)}catch(e){return}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addMode",{get:function(){return void 0===this._raw&&(this._addMode||this.parent.addMode)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"raw",{get:function(){var e=this._raw;return void 0!==e?!Object(u.isObservable)(e)||e instanceof Array?Object(u.toJS)(e):e:this.addMode?this.field.converter.emptyRaw:this.field.render(this.value)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){if(this.addMode)throw new Error("Cannot access field in add mode until it has been set once");return this.state.getValue(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorValue",{get:function(){return void 0===this._error?this.state.getErrorFunc(this):this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canShowValidationMessages",{get:function(){if("rightAfter"===this.state.saveStatus)return!0;var e="before"===this.state.saveStatus?this.state.validationBeforeSave:this.state.validationAfterSave;return"immediate"===e||"no"!==e&&("blur"!==e&&"pause"!==e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this.canShowValidationMessages?this.errorValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warning",{get:function(){return this.canShowValidationMessages?this.warningValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValidating",{get:function(){return this._isValidating},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.state.isDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hidden",{get:function(){return this.state.isHiddenFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readOnly",{get:function(){return this.state.isReadOnlyFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return!this.field.converter.neverRequired&&(this.field.required||this.state.isRequiredFunc(this))},enumerable:!0,configurable:!0}),e.prototype.validate=function(){return m(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.setRaw(this.raw)];case 1:return e.sent(),[2,this.isValid]}})})},Object.defineProperty(e.prototype,"isValid",{get:function(){return void 0===this.errorValue},enumerable:!0,configurable:!0}),e.prototype.setRaw=function(e){return m(this,void 0,void 0,function(){var t,r,n,o;return w(this,function(i){switch(i.label){case 0:"rightAfter"===this.state.saveStatus&&this.state.setSaveStatus("after"),this._raw=e,this.setValidating(!0),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.field.process(e,this.required)];case 2:return t=i.sent(),[3,4];case 3:return i.sent(),this.setError("Something went wrong"),this.setValidating(!1),[2];case 4:if(r=this._raw,!u.comparer.structural(r,e))return[2];if(this.setValidating(!1),t instanceof oe)return this.setError(t.message),[2];if(this.clearError(),!(t instanceof ie))throw new Error("Unknown process result");return"string"==typeof(n=this.state.extraValidationFunc(this,t.value))&&n&&this.setError(n),u.comparer.structural(this.value,t.value)?[2]:(this.state.setValueWithoutRawUpdate(this.path,t.value),null!=(o=this.field.changeFunc)&&o(this.node,t.value),[2])}})})},e.prototype.setRawFromValue=function(){var e=this.state.getValue(this.path);this._raw=this.field.render(e),this.validate()},e.prototype.setError=function(e){this._error=e},e.prototype.clearError=function(){this._error=void 0},e.prototype.setValidating=function(e){this._isValidating=e},Object.defineProperty(e.prototype,"inputProps",{get:function(){var e=this.field.controlled(this);return e.disabled=this.disabled,this.readOnly&&(e.readOnly=this.readOnly),null!=this.state.focusFunc&&(e.onFocus=this.handleFocus),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"validationProps",{get:function(){return h(this)},enumerable:!0,configurable:!0}),e.prototype.accessBySteps=function(e){throw new Error("Cannot step through field accessor")},b([u.observable,v("design:type",Object)],e.prototype,"_raw",void 0),b([u.observable,v("design:type",Object)],e.prototype,"_error",void 0),b([u.observable,v("design:type",Boolean)],e.prototype,"_isValidating",void 0),b([u.observable,v("design:type",Boolean)],e.prototype,"_addMode",void 0),b([u.computed,v("design:type",String),v("design:paramtypes",[])],e.prototype,"path",null),b([u.action,v("design:type",Function),v("design:paramtypes",[Function]),v("design:returntype",void 0)],e.prototype,"setDisposer",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"node",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"addMode",null),b([u.computed,v("design:type","function"==typeof(t="undefined"!=typeof R&&R)&&t||Object),v("design:paramtypes",[])],e.prototype,"raw",null),b([u.computed,v("design:type","function"==typeof(r="undefined"!=typeof V&&V)&&r||Object),v("design:paramtypes",[])],e.prototype,"value",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"errorValue",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"warningValue",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"canShowValidationMessages",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"error",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"warning",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValidating",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"disabled",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"hidden",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"readOnly",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"required",null),b([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValid",null),b([u.action,v("design:type",Function),v("design:paramtypes",["function"==typeof(n="undefined"!=typeof R&&R)&&n||Object]),v("design:returntype",Promise)],e.prototype,"setRaw",null),b([u.action,v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",void 0)],e.prototype,"setError",null),b([u.action,v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"clearError",null),b([u.action,v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",void 0)],e.prototype,"setValidating",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"inputProps",null),b([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"validationProps",null),e}(),j=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},F=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},P=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},x=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},E=function(){function e(){}return e.prototype.initialize=function(){this.formAccessor.initialize()},e.prototype.validate=function(){return P(this,void 0,void 0,function(){return x(this,function(e){return[2,this.formAccessor.validate()]})})},e.prototype.setError=function(e){this.formAccessor.setError(e)},e.prototype.clearError=function(){this.formAccessor.clearError()},Object.defineProperty(e.prototype,"error",{get:function(){return this.formAccessor.error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),e.prototype.access=function(e){return this.formAccessor.access(e)},e.prototype.accessBySteps=function(e){if(0===e.length){if(null==this.formAccessor.parent)throw new Error("Unknown parent");return this.formAccessor.parent}return this.formAccessor.accessBySteps(e)},e.prototype.field=function(e){return this.formAccessor.field(e)},e.prototype.repeatingForm=function(e){return this.formAccessor.repeatingForm(e)},e.prototype.subForm=function(e){return this.formAccessor.subForm(e)},Object.defineProperty(e.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),j([u.action,F("design:type",Function),F("design:paramtypes",[String]),F("design:returntype",void 0)],e.prototype,"setError",null),j([u.action,F("design:type",Function),F("design:paramtypes",[]),F("design:returntype",void 0)],e.prototype,"clearError",null),j([u.computed,F("design:type",Object),F("design:paramtypes",[])],e.prototype,"error",null),j([u.computed,F("design:type",Boolean),F("design:paramtypes",[])],e.prototype,"isValid",null),j([u.computed,F("design:type",Array),F("design:paramtypes",[])],e.prototype,"accessors",null),j([u.computed,F("design:type",Array),F("design:paramtypes",[])],e.prototype,"flatAccessors",null),e}(),S=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},k=function(e){function t(t,r,n,o){var i=e.call(this)||this;return i.state=t,i.definition=r,i.parent=n,i.name=o,i.name=o,i.formAccessor=new J(t,r,i,!1),i}return S(t,e),t.prototype.clear=function(){},Object.defineProperty(t.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"addMode",{get:function(){return this.parent.addMode},enumerable:!0,configurable:!0}),A([u.computed,_("design:type",String),_("design:paramtypes",[])],t.prototype,"path",null),A([u.computed,_("design:type",Boolean),_("design:paramtypes",[])],t.prototype,"addMode",null),t}(E),M=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),B=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},C=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},q=function(e){function t(t,r,n,o){var i=e.call(this)||this;return i.state=t,i.definition=r,i.parent=n,i._addMode=!1,i.index=o,i.formAccessor=new J(t,r,i,!1),i}return M(t,e),t.prototype.clear=function(){return this.formAccessor.flatAccessors.forEach(function(e){e.clear()}),this.parent.removeIndex(this.index)},Object.defineProperty(t.prototype,"path",{get:function(){return this.parent.path+"/"+this.index},enumerable:!0,configurable:!0}),t.prototype.setIndex=function(e){this.index=e},t.prototype.setAddMode=function(){this._addMode=!0},Object.defineProperty(t.prototype,"addMode",{get:function(){return this._addMode||this.parent.addMode},enumerable:!0,configurable:!0}),B([u.observable,C("design:type",Number)],t.prototype,"index",void 0),B([u.observable,C("design:type",Boolean)],t.prototype,"_addMode",void 0),B([u.computed,C("design:type",String),C("design:paramtypes",[])],t.prototype,"path",null),B([u.action,C("design:type",Function),C("design:paramtypes",[Number]),C("design:returntype",void 0)],t.prototype,"setIndex",null),B([u.action,C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",void 0)],t.prototype,"setAddMode",null),B([u.computed,C("design:type",Boolean),C("design:paramtypes",[])],t.prototype,"addMode",null),t}(E),D=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},I=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},T=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},W=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},N=function(){function e(e,t,r,n){this.state=e,this.repeatingForm=t,this.parent=r,this.repeatingFormIndexedAccessors=u.observable.map(),this.name=n}return e.prototype.clear=function(){},Object.defineProperty(e.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),e.prototype.setError=function(e){this._error=e},e.prototype.clearError=function(){this._error=void 0},e.prototype.validate=function(){return T(this,void 0,void 0,function(){var e,t,r,n;return W(this,function(o){switch(o.label){case 0:for(e=[],t=0,r=this.accessors;t<r.length;t++)n=r[t],e.push(n.validate());return[4,Promise.all(e)];case 1:return[2,o.sent().every(function(e){return e})]}})})},Object.defineProperty(e.prototype,"addMode",{get:function(){return this.parent.addMode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.accessors.every(function(e){return e.isValid})},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){var e=this,t=0;this.state.getValue(this.path).forEach(function(){e.createFormIndexedAccessor(t),t++})},e.prototype.createFormIndexedAccessor=function(e){var t=new q(this.state,this.repeatingForm.definition,this,e);this.repeatingFormIndexedAccessors.set(e,t),t.initialize()},e.prototype.index=function(e){var t=this.repeatingFormIndexedAccessors.get(e);if(null==t)throw new Error(e+" is not a RepeatingFormIndexedAccessor");return t},Object.defineProperty(e.prototype,"disabled",{get:function(){return this.state.isRepeatingFormDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accessors",{get:function(){for(var e=[],t=0;t<this.length;t++)e.push(this.index(t));return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){var e=[];return this.accessors.forEach(function(t){e.push.apply(e,t.flatAccessors)}),e},enumerable:!0,configurable:!0}),e.prototype.accessBySteps=function(e){var t=e[0],r=e.slice(1),n=parseInt(t,10);if(isNaN(n))throw new Error("Expected index of repeating form");return this.index(n).accessBySteps(r)},Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!0,configurable:!0}),e.prototype.insert=function(e,t){var r=this.path+"/"+e;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:t}]),this.index(e).setAddMode()},e.prototype.push=function(e){var t=Object(c.resolvePath)(this.state.node,this.path).length,r=this.path+"/"+t;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:e}]),this.index(t).setAddMode()},e.prototype.remove=function(e){var t=Object(c.resolvePath)(this.state.node,this.path).indexOf(e);if(-1===t)throw new Error("Cannot find node to remove.");Object(c.applyPatch)(this.state.node,[{op:"remove",path:this.path+"/"+t}])},e.prototype.removeIndex=function(e){var t=this.repeatingFormIndexedAccessors;if(t.delete(e)){var r=[],n=[];t.forEach(function(t,o){o<=e||(t.setIndex(o-1),r.push(o),n.push(t))}),this.executeRenumber(r,n)}},e.prototype.addIndex=function(e){var t=[],r=[];this.repeatingFormIndexedAccessors.forEach(function(n,o){o<e||(n.setIndex(o+1),t.push(o),r.push(n))}),this.executeRenumber(t,r),this.createFormIndexedAccessor(e)},e.prototype.executeRenumber=function(e,t){var r=this.repeatingFormIndexedAccessors;e.forEach(function(e){r.delete(e)}),t.forEach(function(e){r.set(e.index,e)})},Object.defineProperty(e.prototype,"length",{get:function(){return Object(c.resolvePath)(this.state.node,this.path).length},enumerable:!0,configurable:!0}),D([u.observable,I("design:type",Object)],e.prototype,"_error",void 0),D([u.observable,I("design:type",Map)],e.prototype,"repeatingFormIndexedAccessors",void 0),D([u.computed,I("design:type",String),I("design:paramtypes",[])],e.prototype,"path",null),D([u.action,I("design:type",Function),I("design:paramtypes",[String]),I("design:returntype",void 0)],e.prototype,"setError",null),D([u.action,I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",void 0)],e.prototype,"clearError",null),D([u.computed,I("design:type",Boolean),I("design:paramtypes",[])],e.prototype,"addMode",null),D([u.computed,I("design:type",Boolean),I("design:paramtypes",[])],e.prototype,"isValid",null),D([u.computed,I("design:type",Boolean),I("design:paramtypes",[])],e.prototype,"disabled",null),D([u.computed,I("design:type",Array),I("design:paramtypes",[])],e.prototype,"accessors",null),D([u.computed,I("design:type",Array),I("design:paramtypes",[])],e.prototype,"flatAccessors",null),D([u.computed,I("design:type",Object),I("design:paramtypes",[])],e.prototype,"error",null),e}(),z=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},U=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},G=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},H=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},J=function(){function e(e,t,r,n,o){this.state=e,this.definition=t,this.parent=r,this.allowedKeys=o,this.fieldAccessors=u.observable.map(),this.repeatingFormAccessors=u.observable.map(),this.subFormAccessors=u.observable.map(),this.keys=null!=o?o:Object.keys(this.definition),this._addMode=n,this.initialize()}return e.prototype.validate=function(){return G(this,void 0,void 0,function(){var e;return H(this,function(t){switch(t.label){case 0:return e=this.accessors.map(function(e){return e.validate()}),[4,Promise.all(e)];case 1:return[2,t.sent().every(function(e){return e})]}})})},e.prototype.setError=function(e){this._error=e},e.prototype.clearError=function(){this._error=void 0},e.prototype.clear=function(){},Object.defineProperty(e.prototype,"path",{get:function(){return null==this.parent?"":this.parent.path},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this.error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.accessors.every(function(e){return e.isValid})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accessors",{get:function(){var e=this,t=[];return this.keys.forEach(function(r){var n=e.definition[r];n instanceof ae?t.push(e.field(r)):n instanceof se?t.push(e.repeatingForm(r)):n instanceof ne&&t.push(e.subForm(r))}),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){var e=[];return this.accessors.forEach(function(t){t instanceof O?e.push(t):t instanceof N?(e.push.apply(e,t.flatAccessors),e.push(t)):t instanceof k&&(e.push.apply(e,t.flatAccessors),e.push(t))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addMode",{get:function(){return!!this._addMode||null!=this.parent&&this.parent.addMode},enumerable:!0,configurable:!0}),e.prototype.access=function(e){if(this.keys.includes(e))try{return this.field(e)}catch(t){try{return this.repeatingForm(e)}catch(t){try{return this.subForm(e)}catch(e){return}}}},e.prototype.accessBySteps=function(e){if(0===e.length)return this;var t=e[0],r=e.slice(1),n=this.access(t);return 0===r.length?n:void 0===n?n:n.accessBySteps(r)},e.prototype.initialize=function(){var e=this;this.keys.forEach(function(t){var r=e.definition[t];r instanceof ae?e.createField(t,r):r instanceof se?e.createRepeatingForm(t,r):r instanceof ne&&e.createSubForm(t,r)})},e.prototype.createField=function(e,t){var r=new O(this.state,t,this,e);this.fieldAccessors.set(e,r)},e.prototype.field=function(e){var t=this.fieldAccessors.get(e);if(null==t)throw new Error(e+" is not a Field");return t},e.prototype.createRepeatingForm=function(e,t){var r=new N(this.state,t,this,e);this.repeatingFormAccessors.set(e,r),r.initialize()},e.prototype.repeatingForm=function(e){var t=this.repeatingFormAccessors.get(e);if(null==t)throw new Error(e+" is not a RepeatingForm");return t},e.prototype.createSubForm=function(e,t){var r=new k(this.state,t.definition,this,e);this.subFormAccessors.set(e,r),r.initialize()},e.prototype.subForm=function(e){var t=this.subFormAccessors.get(e);if(null==t)throw new Error(e+" is not a SubForm");return t},e.prototype.repeatingField=function(e){},z([u.observable,U("design:type",Object)],e.prototype,"_error",void 0),z([u.observable,U("design:type",Boolean)],e.prototype,"_addMode",void 0),z([u.action,U("design:type",Function),U("design:paramtypes",[String]),U("design:returntype",void 0)],e.prototype,"setError",null),z([u.action,U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"clearError",null),z([u.computed,U("design:type",String),U("design:paramtypes",[])],e.prototype,"path",null),z([u.computed,U("design:type",Object),U("design:paramtypes",[])],e.prototype,"error",null),z([u.computed,U("design:type",Boolean),U("design:paramtypes",[])],e.prototype,"isValid",null),z([u.computed,U("design:type",Array),U("design:paramtypes",[])],e.prototype,"accessors",null),z([u.computed,U("design:type",Array),U("design:paramtypes",[])],e.prototype,"flatAccessors",null),z([u.computed,U("design:type",Boolean),U("design:paramtypes",[])],e.prototype,"addMode",null),e}(),$=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),K=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},L=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Q=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},X=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Y=function(e){function t(t,r,n){var o=e.call(this)||this;o.form=t,o.node=r,o.saveStatus="before",o.additionalErrorTree={},o.noRawUpdate=!1,Object(c.onPatch)(r,function(e){"remove"===e.op?o.removePath(e.path):"add"===e.op?o.addPath(e.path):"replace"===e.op&&o.replacePath(e.path)});var i=null!=n&&n.addMode||!1;if(o.formAccessor=new J(o,o.form.definition,null,i),o.formAccessor.initialize(),null==n)o.saveFunc=Z,o.isDisabledFunc=function(){return!1},o.isHiddenFunc=function(){return!1},o.isReadOnlyFunc=function(){return!1},o.isRequiredFunc=function(){return!1},o.isRepeatingFormDisabledFunc=function(){return!1},o.getErrorFunc=function(){},o.getWarningFunc=function(){},o.extraValidationFunc=function(){return!1},o.validationBeforeSave="immediate",o.validationAfterSave="immediate",o.validationPauseDuration=0,o.focusFunc=null;else{o.saveFunc=n.save?n.save:Z,o.isDisabledFunc=n.isDisabled?n.isDisabled:function(){return!1},o.isHiddenFunc=n.isHidden?n.isHidden:function(){return!1},o.isReadOnlyFunc=n.isReadOnly?n.isReadOnly:function(){return!1},o.isRequiredFunc=n.isRequired?n.isRequired:function(){return!1},o.isRepeatingFormDisabledFunc=n.isRepeatingFormDisabled?n.isRepeatingFormDisabled:function(){return!1},o.getErrorFunc=n.getError?n.getError:function(){},o.getWarningFunc=n.getWarning?n.getWarning:function(){},o.extraValidationFunc=n.extraValidation?n.extraValidation:function(){return!1};var a=n.validation||{};o.validationBeforeSave=a.beforeSave||"immediate",o.validationAfterSave=a.afterSave||"immediate",o.validationPauseDuration=a.pauseDuration||0,o.focusFunc=n.focus?n.focus:null}return o}return $(t,e),t.prototype.setSaveStatus=function(e){this.saveStatus=e},t.prototype.setValueWithoutRawUpdate=function(e,t){this.noRawUpdate=!0,Object(c.applyPatch)(this.node,[{op:"replace",path:e,value:t}]),this.noRawUpdate=!1},t.prototype.replacePath=function(e){if(!this.noRawUpdate){var t=this.accessByPath(e);void 0!==t&&t instanceof O&&t.setRawFromValue()}},t.prototype.removePath=function(e){var t;try{t=this.accessByPath(e)}catch(e){return}void 0!==t&&t instanceof q&&t.clear()},t.prototype.addPath=function(e){var t=l(e);if(0!==t.length){var r=parseInt(t[t.length-1],10);if(!isNaN(r)){var n=this.accessByPath(function(e){var t=e.join("/");return t.startsWith("/")?t:"/"+t}(t.slice(0,t.length-1)));void 0!==n&&n instanceof N&&n.addIndex(r)}}},t.prototype.save=function(){return Q(this,void 0,void 0,function(){var e,t;return X(this,function(r){switch(r.label){case 0:return[4,this.validate()];case 1:return e=r.sent(),this.setSaveStatus("rightAfter"),e?[4,this.saveFunc(this.node)]:[2,!1];case 2:return null!=(t=r.sent())?(this.setErrors(t),[2,!1]):(this.clearErrors(),[2,!0])}})})},t.prototype.setErrors=function(e){var t=function(e){return JSON.parse(JSON.stringify(e))}(e);this.flatAccessors.map(function(r){var n=d(e,r.path);null!=n&&(r.setError(n),y(t,r.path))}),this.additionalErrorTree=t},t.prototype.clearErrors=function(){this.additionalErrorTree={},this.flatAccessors.map(function(e){e.clearError()})},t.prototype.getValue=function(e){return Object(c.resolvePath)(this.node,e)},t.prototype.getMstType=function(e){for(var t=l(e),r=this.form.model,n=0,o=t;n<o.length;n++){var i=o[n];f(i)?r=r.getChildType(i):r=r.getChildType(i)}return r},Object.defineProperty(t.prototype,"isValidating",{get:function(){return this.flatAccessors.some(function(e){return e instanceof O&&e.isValidating})},enumerable:!0,configurable:!0}),t.prototype.accessByPath=function(e){var t=l(e);return this.accessBySteps(t)},t.prototype.accessBySteps=function(e){return this.formAccessor.accessBySteps(e)},t.prototype.additionalError=function(e){var t=this.additionalErrorTree[e];if("string"==typeof t)return t},Object.defineProperty(t.prototype,"additionalErrors",{get:function(){var e=this,t=[];return Object.keys(this.additionalErrorTree).forEach(function(r){var n=e.additionalErrorTree[r];"string"==typeof n&&t.push(n)}),t.sort(),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isWarningFree",{get:function(){return!this.flatAccessors.some(function(e){return e instanceof O&&void 0!==e.warningValue})},enumerable:!0,configurable:!0}),K([u.observable,L("design:type",Object)],t.prototype,"additionalErrorTree",void 0),K([u.observable,L("design:type",String)],t.prototype,"saveStatus",void 0),K([u.action,L("design:type",Function),L("design:paramtypes",[String]),L("design:returntype",void 0)],t.prototype,"setSaveStatus",null),K([u.action,L("design:type",Function),L("design:paramtypes",[String,Object]),L("design:returntype",void 0)],t.prototype,"setValueWithoutRawUpdate",null),K([u.action,L("design:type",Function),L("design:paramtypes",[String]),L("design:returntype",void 0)],t.prototype,"replacePath",null),K([u.action,L("design:type",Function),L("design:paramtypes",[String]),L("design:returntype",void 0)],t.prototype,"removePath",null),K([u.action,L("design:type",Function),L("design:paramtypes",[String]),L("design:returntype",void 0)],t.prototype,"addPath",null),K([u.action,L("design:type",Function),L("design:paramtypes",[]),L("design:returntype",Promise)],t.prototype,"save",null),K([u.action,L("design:type",Function),L("design:paramtypes",[Object]),L("design:returntype",void 0)],t.prototype,"setErrors",null),K([u.action,L("design:type",Function),L("design:paramtypes",[]),L("design:returntype",void 0)],t.prototype,"clearErrors",null),K([u.computed,L("design:type",Boolean),L("design:paramtypes",[])],t.prototype,"isValidating",null),K([u.computed,L("design:type",Array),L("design:paramtypes",[])],t.prototype,"additionalErrors",null),K([u.computed,L("design:type",Boolean),L("design:paramtypes",[])],t.prototype,"isWarningFree",null),t}(E);function Z(){return Q(this,void 0,void 0,function(){return X(this,function(e){return console.warn("No mstform save function configured"),[2,null]})})}var ee=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},te=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(){function e(e,t){this.model=e,this.definition=t}return Object.defineProperty(e.prototype,"FormStateType",{get:function(){throw new Error("For introspection")},enumerable:!0,configurable:!0}),e.prototype.state=function(e,t){return new Y(this,e,t)},e}(),ne=function(){return function(e){this.definition=e}}(),oe=function(){return function(e){this.message=e}}(),ie=function(){return function(e){this.value=e}}(),ae=function(){function e(e,t){if(this.converter=e,this.options=t,t){if(this.rawValidators=t.rawValidators?t.rawValidators:[],this.validators=t.validators?t.validators:[],this.conversionError=t.conversionError||"Could not convert",this.requiredError=t.requiredError||"Required",this.required=t.required||!1,t.fromEvent){if(t.getRaw)throw new Error("Cannot have fromEvent and getRaw defined at same time");this.getRaw=function(e){return e.target.value}}else this.getRaw=t.getRaw||p;this.derivedFunc=t.derived,this.changeFunc=t.change,this.controlled=t.controlled||this.createDefaultControlled()}else this.rawValidators=[],this.validators=[],this.conversionError="Could not convert",this.requiredError="Required",this.required=!1,this.getRaw=p,this.controlled=this.createDefaultControlled()}return e.prototype.createDefaultControlled=function(){var e=this;return this.getRaw!==p?function(t){return{value:t.raw,onChange:function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.setRaw(e.getRaw.apply(e,r))}}}:this.converter.defaultControlled},Object.defineProperty(e.prototype,"RawType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ValueType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),e.prototype.process=function(e,t){return ee(this,void 0,void 0,function(){var r,n,o,i,a,s;return te(this,function(u){switch(u.label){case 0:if(e=this.converter.preprocessRaw(e),!this.converter.neverRequired&&e===this.converter.emptyRaw&&t)return[2,new oe(this.requiredError)];r=0,n=this.rawValidators,u.label=1;case 1:return r<n.length?[4,(0,n[r])(e)]:[3,4];case 2:if("string"==typeof(s=u.sent())&&s)return[2,new oe(s)];u.label=3;case 3:return r++,[3,1];case 4:return[4,this.converter.convert(e)];case 5:if("ConversionError"===(o=u.sent()))return e===this.converter.emptyRaw?[2,new oe(this.requiredError)]:[2,new oe(this.conversionError)];i=0,a=this.validators,u.label=6;case 6:return i<a.length?[4,(0,a[i])(o.value)]:[3,9];case 7:if("string"==typeof(s=u.sent())&&s)return[2,new oe(s)];u.label=8;case 8:return i++,[3,6];case 9:return[2,new ie(o.value)]}})})},e.prototype.render=function(e){return this.converter.render(e)},e}(),se=function(){return function(e){this.definition=e}}(),ue=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ce=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},pe=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},le=new RegExp("^-?(0|[1-9]\\d*)(\\.\\d*)?$"),fe=new RegExp("^-?(0|[1-9]\\d*)$"),de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultControlled=n.value,t}return ue(t,e),t.prototype.preprocessRaw=function(e){return e.trim()},t}(s),ye=new de({emptyRaw:"",convert:function(e){return e},render:function(e){return e}}),he=new de({emptyRaw:"",rawValidate:function(e){return e.startsWith(".")&&(e="0"+e),le.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),ge=new de({emptyRaw:"",rawValidate:function(e){return fe.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),be=new s({emptyRaw:!1,convert:function(e){return e},render:function(e){return e},defaultControlled:n.checked,neverRequired:!0}),ve=function(){function e(e,t){this.maxWholeDigits=e,this.decimalPlaces=t,this.defaultControlled=n.value,this.neverRequired=!1,this.emptyRaw="";var r=new RegExp("^-?(0|[1-9]\\d{0,"+(e-1)+"})(\\.\\d{0,"+t+"})?$");this.converter=new de({emptyRaw:"",rawValidate:function(e){return e.startsWith(".")&&(e="0"+e),r.test(e)},convert:function(e){return e},render:function(e){return e}})}return e.prototype.preprocessRaw=function(e){return e.trim()},e.prototype.convert=function(e){return this.converter.convert(e)},e.prototype.render=function(e){return this.converter.render(e)},e.prototype.getRaw=function(e){return e},e}();var me=new s({emptyRaw:[],convert:function(e){return u.observable.array(e)},render:function(e){return e.slice()}});var we=function(){function e(e){this.converter=e,this.defaultControlled=n.value,this.neverRequired=!1,this.emptyRaw=""}return e.prototype.preprocessRaw=function(e){return e.trim()},e.prototype.convert=function(e){return ce(this,void 0,void 0,function(){return pe(this,function(t){return""===e.trim()?[2,new a(null)]:[2,this.converter.convert(e)]})})},e.prototype.render=function(e){return null===e?"":this.converter.render(e)},e}(),Re=function(){function e(e){this.neverRequired=!1,this.emptyRaw=null,this.defaultControlled=n.object}return e.prototype.preprocessRaw=function(e){return e},e.prototype.convert=function(e){return ce(this,void 0,void 0,function(){return pe(this,function(t){return null===e?[2,"ConversionError"]:[2,new a(e)]})})},e.prototype.render=function(e){return e},e}();var Oe={string:ye,number:he,integer:ge,decimal:function(e,t){return new ve(e,t)},boolean:be,stringArray:me,maybe:function(e){return e instanceof de?new we(e):new s({emptyRaw:null,convert:p,render:p,defaultControlled:n.object})},model:function(e){return new Re(e)},object:new s({emptyRaw:null,convert:p,render:p})};r.d(t,"Form",function(){return re}),r.d(t,"SubForm",function(){return ne}),r.d(t,"ValidationMessage",function(){return oe}),r.d(t,"ProcessValue",function(){return ie}),r.d(t,"Field",function(){return ae}),r.d(t,"RepeatingForm",function(){return se}),r.d(t,"ConversionValue",function(){return a}),r.d(t,"CONVERSION_ERROR",function(){return"ConversionError"}),r.d(t,"Converter",function(){return s}),r.d(t,"StringConverter",function(){return de}),r.d(t,"converters",function(){return Oe}),r.d(t,"FieldAccessor",function(){return O}),r.d(t,"FormAccessor",function(){return J}),r.d(t,"RepeatingFormAccessor",function(){return N}),r.d(t,"RepeatingFormIndexedAccessor",function(){return q}),r.d(t,"SubFormAccessor",function(){return k}),r.d(t,"currentValidationProps",function(){return h}),r.d(t,"setupValidationProps",function(){return g}),r.d(t,"controlled",function(){return n}),r.d(t,"FormState",function(){return Y})}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("mobx"),require("mobx-state-tree")):"function"==typeof define&&define.amd?define(["mobx","mobx-state-tree"],t):"object"==typeof exports?exports.mstform=t(require("mobx"),require("mobx-state-tree")):e.mstform=t(e.mobx,e["mobx-state-tree"])}(window,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";n.r(t);var r={value:function(e){return{value:e.raw,onChange:function(t){return e.setRaw(t.target.value)}}},checked:function(e){return{checked:e.raw,onChange:function(t){return e.setRaw(t.target.checked)}}},object:function(e){return{value:e.raw,onChange:function(t){return e.setRaw(t)}}}},o=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},i=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},a=function(){return function(e){this.value=e}}(),u=function(){function e(e){this.definition=e,this.neverRequired=!1,this.emptyRaw=e.emptyRaw,this.defaultControlled=e.defaultControlled?e.defaultControlled:r.object,this.neverRequired=!!e.neverRequired}return e.prototype.preprocessRaw=function(e){return e},e.prototype.convert=function(e){return o(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return this.definition.rawValidate?[4,this.definition.rawValidate(e)]:[3,2];case 1:if(!n.sent())return[2,"ConversionError"];n.label=2;case 2:return t=this.definition.convert(e),this.definition.validate?[4,this.definition.validate(t)]:[3,4];case 3:if(!n.sent())return[2,"ConversionError"];n.label=4;case 4:return[2,new a(t)]}})})},e.prototype.render=function(e){return this.definition.render(e)},e}(),s=n(0),c=n(1);function p(e){return e}function l(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/")}function f(e){return Number.isInteger(parseInt(e,10))}function d(e,t){return function e(t,n){var r=n[0],o=n.slice(1);if(0===o.length)return t[r];var i=t[r];if(void 0===i)return;return e(i,o)}(e,l(t))}function y(e,t){return function e(t,n){var r=n[0],o=n.slice(1);0===o.length&&delete t[r];var i=t[r];if(void 0===i)return;e(i,o)}(e,l(t))}var h=function(){return{}};function g(e){h=e}var b=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},v=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},m=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},w=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},O=function(){function e(e,t,n,r){var o=this;this.state=e,this.field=t,this.parent=n,this._isValidating=!1,this._addMode=!1,this.handleChange=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return m(o,void 0,void 0,function(){var t,n;return w(this,function(r){switch(r.label){case 0:return n=(t=this.field).getRaw.apply(t,e),[4,this.setRaw(n)];case 1:return r.sent(),[2]}})})},this.handleFocus=function(e){null!=o.state.focusFunc&&o.state.focusFunc(e,o)},this.name=r,this.createDerivedReaction()}var t,n,r;return e.prototype.clear=function(){null!=this._disposer&&this._disposer()},Object.defineProperty(e.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),e.prototype.setDisposer=function(e){this._disposer=e},e.prototype.createDerivedReaction=function(){var e=this,t=this.field.derivedFunc;if(null!=t&&null==this._disposer){var n=Object(s.reaction)(function(){return e.node?t(e.node):void 0},function(t){void 0!==t&&e.setRaw(e.field.render(t))});this._disposer=n}},Object.defineProperty(e.prototype,"node",{get:function(){try{return this.state.getValue(this.parent.path)}catch(e){return}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addMode",{get:function(){return void 0===this._raw&&(this._addMode||this.parent.addMode)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"raw",{get:function(){var e=this._raw;return void 0!==e?!Object(s.isObservable)(e)||e instanceof Array?Object(s.toJS)(e):e:this.addMode?this.field.converter.emptyRaw:this.field.render(this.value)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){if(this.addMode)throw new Error("Cannot access field in add mode until it has been set once");return this.state.getValue(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorValue",{get:function(){return void 0===this._error?this.state.getErrorFunc(this):this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canShowValidationMessages",{get:function(){if("rightAfter"===this.state.saveStatus)return!0;var e="before"===this.state.saveStatus?this.state.validationBeforeSave:this.state.validationAfterSave;return"immediate"===e||"no"!==e&&("blur"!==e&&"pause"!==e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this.canShowValidationMessages?this.errorValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warning",{get:function(){return this.canShowValidationMessages?this.warningValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValidating",{get:function(){return this._isValidating},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.state.isDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hidden",{get:function(){return this.state.isHiddenFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readOnly",{get:function(){return this.state.isReadOnlyFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return!this.field.converter.neverRequired&&(this.field.required||this.state.isRequiredFunc(this))},enumerable:!0,configurable:!0}),e.prototype.validate=function(){return m(this,void 0,void 0,function(){return w(this,function(e){switch(e.label){case 0:return[4,this.setRaw(this.raw)];case 1:return e.sent(),[2,this.isValid]}})})},Object.defineProperty(e.prototype,"isValid",{get:function(){return void 0===this.errorValue},enumerable:!0,configurable:!0}),e.prototype.setRaw=function(e){return m(this,void 0,void 0,function(){var t,n,r,o;return w(this,function(i){switch(i.label){case 0:"rightAfter"===this.state.saveStatus&&this.state.setSaveStatus("after"),this._raw=e,this.setValidating(!0),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.field.process(e,this.required)];case 2:return t=i.sent(),[3,4];case 3:return i.sent(),this.setError("Something went wrong"),this.setValidating(!1),[2];case 4:if(n=this._raw,!s.comparer.structural(n,e))return[2];if(this.setValidating(!1),t instanceof ae)return this.setError(t.message),[2];if(this.clearError(),!(t instanceof ue))throw new Error("Unknown process result");return"string"==typeof(r=this.state.extraValidationFunc(this,t.value))&&r&&this.setError(r),s.comparer.structural(this.value,t.value)?[2]:(this.state.setValueWithoutRawUpdate(this.path,t.value),null!=(o=this.field.changeFunc)&&o(this.node,t.value),[2])}})})},e.prototype.setRawFromValue=function(){var e=this.state.getValue(this.path);this._raw=this.field.render(e),this.validate()},e.prototype.setError=function(e){this._error=e},e.prototype.clearError=function(){this._error=void 0},e.prototype.setValidating=function(e){this._isValidating=e},Object.defineProperty(e.prototype,"inputProps",{get:function(){var e=this.field.controlled(this);return e.disabled=this.disabled,this.readOnly&&(e.readOnly=this.readOnly),null!=this.state.focusFunc&&(e.onFocus=this.handleFocus),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"validationProps",{get:function(){return h(this)},enumerable:!0,configurable:!0}),e.prototype.accessBySteps=function(e){throw new Error("Cannot step through field accessor")},b([s.observable,v("design:type",Object)],e.prototype,"_raw",void 0),b([s.observable,v("design:type",Object)],e.prototype,"_error",void 0),b([s.observable,v("design:type",Boolean)],e.prototype,"_isValidating",void 0),b([s.observable,v("design:type",Boolean)],e.prototype,"_addMode",void 0),b([s.computed,v("design:type",String),v("design:paramtypes",[])],e.prototype,"path",null),b([s.action,v("design:type",Function),v("design:paramtypes",[Function]),v("design:returntype",void 0)],e.prototype,"setDisposer",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"node",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"addMode",null),b([s.computed,v("design:type","function"==typeof(t="undefined"!=typeof R&&R)&&t||Object),v("design:paramtypes",[])],e.prototype,"raw",null),b([s.computed,v("design:type","function"==typeof(n="undefined"!=typeof V&&V)&&n||Object),v("design:paramtypes",[])],e.prototype,"value",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"errorValue",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"warningValue",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"canShowValidationMessages",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"error",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"warning",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValidating",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"disabled",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"hidden",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"readOnly",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"required",null),b([s.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValid",null),b([s.action,v("design:type",Function),v("design:paramtypes",["function"==typeof(r="undefined"!=typeof R&&R)&&r||Object]),v("design:returntype",Promise)],e.prototype,"setRaw",null),b([s.action,v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",void 0)],e.prototype,"setError",null),b([s.action,v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"clearError",null),b([s.action,v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",void 0)],e.prototype,"setValidating",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"inputProps",null),b([s.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"validationProps",null),e}(),j=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},P=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},F=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},x=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},E=function(){function e(){}return e.prototype.initialize=function(){this.formAccessor.initialize()},e.prototype.validate=function(){return F(this,void 0,void 0,function(){return x(this,function(e){return[2,this.formAccessor.validate()]})})},Object.defineProperty(e.prototype,"error",{get:function(){return this.formAccessor.error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),e.prototype.access=function(e){return this.formAccessor.access(e)},e.prototype.accessBySteps=function(e){if(0===e.length){if(null==this.formAccessor.parent)throw new Error("Unknown parent");return this.formAccessor.parent}return this.formAccessor.accessBySteps(e)},e.prototype.field=function(e){return this.formAccessor.field(e)},e.prototype.repeatingForm=function(e){return this.formAccessor.repeatingForm(e)},e.prototype.subForm=function(e){return this.formAccessor.subForm(e)},Object.defineProperty(e.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),j([s.computed,P("design:type",Object),P("design:paramtypes",[])],e.prototype,"error",null),j([s.computed,P("design:type",Boolean),P("design:paramtypes",[])],e.prototype,"isValid",null),j([s.computed,P("design:type",Array),P("design:paramtypes",[])],e.prototype,"accessors",null),j([s.computed,P("design:type",Array),P("design:paramtypes",[])],e.prototype,"flatAccessors",null),e}(),S=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),A=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},k=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},M=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},B=function(e){function t(t,n,r,o){var i=e.call(this)||this;return i.state=t,i.definition=n,i.parent=r,i.name=o,i.name=o,i.formAccessor=new K(t,n,i,!1),i}return S(t,e),t.prototype.clear=function(){},t.prototype.validate=function(){return k(this,void 0,void 0,function(){var e,t;return M(this,function(n){switch(n.label){case 0:return e=this.accessors.map(function(e){return e.validate()}),[4,Promise.all(e)];case 1:return(t=n.sent()).push(void 0===this.errorValue),[2,t.every(function(e){return e})]}})})},Object.defineProperty(t.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"addMode",{get:function(){return this.parent.addMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorValue",{get:function(){return this.state.getErrorFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.errorValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"warning",{get:function(){return this.warningValue},enumerable:!0,configurable:!0}),A([s.computed,_("design:type",String),_("design:paramtypes",[])],t.prototype,"path",null),A([s.computed,_("design:type",Boolean),_("design:paramtypes",[])],t.prototype,"addMode",null),A([s.computed,_("design:type",Object),_("design:paramtypes",[])],t.prototype,"errorValue",null),A([s.computed,_("design:type",Object),_("design:paramtypes",[])],t.prototype,"error",null),A([s.computed,_("design:type",Object),_("design:paramtypes",[])],t.prototype,"warningValue",null),A([s.computed,_("design:type",Object),_("design:paramtypes",[])],t.prototype,"warning",null),t}(E),C=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),q=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},T=function(e){function t(t,n,r,o){var i=e.call(this)||this;return i.state=t,i.definition=n,i.parent=r,i._addMode=!1,i.index=o,i.formAccessor=new K(t,n,i,!1),i}return C(t,e),t.prototype.clear=function(){return this.formAccessor.flatAccessors.forEach(function(e){e.clear()}),this.parent.removeIndex(this.index)},Object.defineProperty(t.prototype,"path",{get:function(){return this.parent.path+"/"+this.index},enumerable:!0,configurable:!0}),t.prototype.setIndex=function(e){this.index=e},t.prototype.setAddMode=function(){this._addMode=!0},Object.defineProperty(t.prototype,"addMode",{get:function(){return this._addMode||this.parent.addMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorValue",{get:function(){return this.state.getErrorFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.errorValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"warning",{get:function(){return this.warningValue},enumerable:!0,configurable:!0}),q([s.observable,D("design:type",Number)],t.prototype,"index",void 0),q([s.observable,D("design:type",Boolean)],t.prototype,"_addMode",void 0),q([s.computed,D("design:type",String),D("design:paramtypes",[])],t.prototype,"path",null),q([s.action,D("design:type",Function),D("design:paramtypes",[Number]),D("design:returntype",void 0)],t.prototype,"setIndex",null),q([s.action,D("design:type",Function),D("design:paramtypes",[]),D("design:returntype",void 0)],t.prototype,"setAddMode",null),q([s.computed,D("design:type",Boolean),D("design:paramtypes",[])],t.prototype,"addMode",null),q([s.computed,D("design:type",Object),D("design:paramtypes",[])],t.prototype,"errorValue",null),q([s.computed,D("design:type",Object),D("design:paramtypes",[])],t.prototype,"error",null),q([s.computed,D("design:type",Object),D("design:paramtypes",[])],t.prototype,"warningValue",null),q([s.computed,D("design:type",Object),D("design:paramtypes",[])],t.prototype,"warning",null),t}(E),I=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},W=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},N=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},z=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},G=function(){function e(e,t,n,r){this.state=e,this.repeatingForm=t,this.parent=n,this.repeatingFormIndexedAccessors=s.observable.map(),this.name=r}return e.prototype.clear=function(){},Object.defineProperty(e.prototype,"path",{get:function(){return this.parent.path+"/"+this.name},enumerable:!0,configurable:!0}),e.prototype.validate=function(){return N(this,void 0,void 0,function(){var e,t,n,r,o;return z(this,function(i){switch(i.label){case 0:for(e=[],t=0,n=this.accessors;t<n.length;t++)r=n[t],e.push(r.validate());return[4,Promise.all(e)];case 1:return(o=i.sent()).push(void 0===this.errorValue),[2,o.every(function(e){return e})]}})})},Object.defineProperty(e.prototype,"addMode",{get:function(){return this.parent.addMode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.accessors.every(function(e){return e.isValid})},enumerable:!0,configurable:!0}),e.prototype.initialize=function(){var e=this,t=0;this.state.getValue(this.path).forEach(function(){e.createFormIndexedAccessor(t),t++})},e.prototype.createFormIndexedAccessor=function(e){var t=new T(this.state,this.repeatingForm.definition,this,e);this.repeatingFormIndexedAccessors.set(e,t),t.initialize()},e.prototype.index=function(e){var t=this.repeatingFormIndexedAccessors.get(e);if(null==t)throw new Error(e+" is not a RepeatingFormIndexedAccessor");return t},Object.defineProperty(e.prototype,"disabled",{get:function(){return this.state.isRepeatingFormDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accessors",{get:function(){for(var e=[],t=0;t<this.length;t++)e.push(this.index(t));return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){var e=[];return this.accessors.forEach(function(t){e.push.apply(e,t.flatAccessors),e.push(t)}),e},enumerable:!0,configurable:!0}),e.prototype.accessBySteps=function(e){var t=e[0],n=e.slice(1),r=parseInt(t,10);if(isNaN(r))throw new Error("Expected index of repeating form");return this.index(r).accessBySteps(n)},e.prototype.insert=function(e,t){var n=this.path+"/"+e;Object(c.applyPatch)(this.state.node,[{op:"add",path:n,value:t}]),this.index(e).setAddMode()},e.prototype.push=function(e){var t=Object(c.resolvePath)(this.state.node,this.path).length,n=this.path+"/"+t;Object(c.applyPatch)(this.state.node,[{op:"add",path:n,value:e}]),this.index(t).setAddMode()},e.prototype.remove=function(e){var t=Object(c.resolvePath)(this.state.node,this.path).indexOf(e);if(-1===t)throw new Error("Cannot find node to remove.");Object(c.applyPatch)(this.state.node,[{op:"remove",path:this.path+"/"+t}])},e.prototype.removeIndex=function(e){var t=this.repeatingFormIndexedAccessors;if(t.delete(e)){var n=[],r=[];t.forEach(function(t,o){o<=e||(t.setIndex(o-1),n.push(o),r.push(t))}),this.executeRenumber(n,r)}},e.prototype.addIndex=function(e){var t=[],n=[];this.repeatingFormIndexedAccessors.forEach(function(r,o){o<e||(r.setIndex(o+1),t.push(o),n.push(r))}),this.executeRenumber(t,n),this.createFormIndexedAccessor(e)},e.prototype.executeRenumber=function(e,t){var n=this.repeatingFormIndexedAccessors;e.forEach(function(e){n.delete(e)}),t.forEach(function(e){n.set(e.index,e)})},Object.defineProperty(e.prototype,"length",{get:function(){return Object(c.resolvePath)(this.state.node,this.path).length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorValue",{get:function(){return this.state.getErrorFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this.errorValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warning",{get:function(){return this.warningValue},enumerable:!0,configurable:!0}),I([s.observable,W("design:type",Map)],e.prototype,"repeatingFormIndexedAccessors",void 0),I([s.computed,W("design:type",String),W("design:paramtypes",[])],e.prototype,"path",null),I([s.computed,W("design:type",Boolean),W("design:paramtypes",[])],e.prototype,"addMode",null),I([s.computed,W("design:type",Boolean),W("design:paramtypes",[])],e.prototype,"isValid",null),I([s.computed,W("design:type",Boolean),W("design:paramtypes",[])],e.prototype,"disabled",null),I([s.computed,W("design:type",Array),W("design:paramtypes",[])],e.prototype,"accessors",null),I([s.computed,W("design:type",Array),W("design:paramtypes",[])],e.prototype,"flatAccessors",null),I([s.computed,W("design:type",Object),W("design:paramtypes",[])],e.prototype,"errorValue",null),I([s.computed,W("design:type",Object),W("design:paramtypes",[])],e.prototype,"error",null),I([s.computed,W("design:type",Object),W("design:paramtypes",[])],e.prototype,"warningValue",null),I([s.computed,W("design:type",Object),W("design:paramtypes",[])],e.prototype,"warning",null),e}(),U=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},H=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},J=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},$=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},K=function(){function e(e,t,n,r,o){this.state=e,this.definition=t,this.parent=n,this.allowedKeys=o,this.fieldAccessors=s.observable.map(),this.repeatingFormAccessors=s.observable.map(),this.subFormAccessors=s.observable.map(),this.keys=null!=o?o:Object.keys(this.definition),this._addMode=r,this.initialize()}return e.prototype.validate=function(){return J(this,void 0,void 0,function(){var e,t;return $(this,function(n){switch(n.label){case 0:return e=this.accessors.map(function(e){return e.validate()}),[4,Promise.all(e)];case 1:return(t=n.sent()).push(void 0===this.errorValue),[2,t.every(function(e){return e})]}})})},e.prototype.clear=function(){},Object.defineProperty(e.prototype,"path",{get:function(){return null==this.parent?"":this.parent.path},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.accessors.every(function(e){return e.isValid})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accessors",{get:function(){var e=this,t=[];return this.keys.forEach(function(n){var r=e.definition[n];r instanceof se?t.push(e.field(n)):r instanceof ce?t.push(e.repeatingForm(n)):r instanceof ie&&t.push(e.subForm(n))}),t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flatAccessors",{get:function(){var e=[];return this.accessors.forEach(function(t){t instanceof O?e.push(t):t instanceof G?(e.push.apply(e,t.flatAccessors),e.push(t)):t instanceof B&&(e.push.apply(e,t.flatAccessors),e.push(t))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addMode",{get:function(){return!!this._addMode||null!=this.parent&&this.parent.addMode},enumerable:!0,configurable:!0}),e.prototype.access=function(e){if(this.keys.includes(e))try{return this.field(e)}catch(t){try{return this.repeatingForm(e)}catch(t){try{return this.subForm(e)}catch(e){return}}}},e.prototype.accessBySteps=function(e){if(0===e.length)return this;var t=e[0],n=e.slice(1),r=this.access(t);return 0===n.length?r:void 0===r?r:r.accessBySteps(n)},e.prototype.initialize=function(){var e=this;this.keys.forEach(function(t){var n=e.definition[t];n instanceof se?e.createField(t,n):n instanceof ce?e.createRepeatingForm(t,n):n instanceof ie&&e.createSubForm(t,n)})},e.prototype.createField=function(e,t){var n=new O(this.state,t,this,e);this.fieldAccessors.set(e,n)},e.prototype.field=function(e){var t=this.fieldAccessors.get(e);if(null==t)throw new Error(e+" is not a Field");return t},e.prototype.createRepeatingForm=function(e,t){var n=new G(this.state,t,this,e);this.repeatingFormAccessors.set(e,n),n.initialize()},e.prototype.repeatingForm=function(e){var t=this.repeatingFormAccessors.get(e);if(null==t)throw new Error(e+" is not a RepeatingForm");return t},e.prototype.createSubForm=function(e,t){var n=new B(this.state,t.definition,this,e);this.subFormAccessors.set(e,n),n.initialize()},e.prototype.subForm=function(e){var t=this.subFormAccessors.get(e);if(null==t)throw new Error(e+" is not a SubForm");return t},e.prototype.repeatingField=function(e){},Object.defineProperty(e.prototype,"errorValue",{get:function(){return this.state.getErrorFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this.errorValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warningValue",{get:function(){return this.state.getWarningFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"warning",{get:function(){return this.warningValue},enumerable:!0,configurable:!0}),U([s.observable,H("design:type",Boolean)],e.prototype,"_addMode",void 0),U([s.computed,H("design:type",String),H("design:paramtypes",[])],e.prototype,"path",null),U([s.computed,H("design:type",Boolean),H("design:paramtypes",[])],e.prototype,"isValid",null),U([s.computed,H("design:type",Array),H("design:paramtypes",[])],e.prototype,"accessors",null),U([s.computed,H("design:type",Array),H("design:paramtypes",[])],e.prototype,"flatAccessors",null),U([s.computed,H("design:type",Boolean),H("design:paramtypes",[])],e.prototype,"addMode",null),U([s.computed,H("design:type",Object),H("design:paramtypes",[])],e.prototype,"errorValue",null),U([s.computed,H("design:type",Object),H("design:paramtypes",[])],e.prototype,"error",null),U([s.computed,H("design:type",Object),H("design:paramtypes",[])],e.prototype,"warningValue",null),U([s.computed,H("design:type",Object),H("design:paramtypes",[])],e.prototype,"warning",null),e}(),L=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Q=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},X=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Y=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},Z=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},ee=function(e){function t(t,n,r){var o=e.call(this)||this;o.form=t,o.node=n,o.saveStatus="before",o.additionalErrorTree={},o.noRawUpdate=!1,Object(c.onPatch)(n,function(e){"remove"===e.op?o.removePath(e.path):"add"===e.op?o.addPath(e.path):"replace"===e.op&&o.replacePath(e.path)});var i=null!=r&&r.addMode||!1;if(o.formAccessor=new K(o,o.form.definition,null,i),o.formAccessor.initialize(),null==r)o.saveFunc=te,o.isDisabledFunc=function(){return!1},o.isHiddenFunc=function(){return!1},o.isReadOnlyFunc=function(){return!1},o.isRequiredFunc=function(){return!1},o.isRepeatingFormDisabledFunc=function(){return!1},o.getErrorFunc=function(){},o.getWarningFunc=function(){},o.extraValidationFunc=function(){return!1},o.validationBeforeSave="immediate",o.validationAfterSave="immediate",o.validationPauseDuration=0,o.focusFunc=null;else{o.saveFunc=r.save?r.save:te,o.isDisabledFunc=r.isDisabled?r.isDisabled:function(){return!1},o.isHiddenFunc=r.isHidden?r.isHidden:function(){return!1},o.isReadOnlyFunc=r.isReadOnly?r.isReadOnly:function(){return!1},o.isRequiredFunc=r.isRequired?r.isRequired:function(){return!1},o.isRepeatingFormDisabledFunc=r.isRepeatingFormDisabled?r.isRepeatingFormDisabled:function(){return!1},o.getErrorFunc=r.getError?r.getError:function(){},o.getWarningFunc=r.getWarning?r.getWarning:function(){},o.extraValidationFunc=r.extraValidation?r.extraValidation:function(){return!1};var a=r.validation||{};o.validationBeforeSave=a.beforeSave||"immediate",o.validationAfterSave=a.afterSave||"immediate",o.validationPauseDuration=a.pauseDuration||0,o.focusFunc=r.focus?r.focus:null}return o}return L(t,e),t.prototype.setSaveStatus=function(e){this.saveStatus=e},t.prototype.setValueWithoutRawUpdate=function(e,t){this.noRawUpdate=!0,Object(c.applyPatch)(this.node,[{op:"replace",path:e,value:t}]),this.noRawUpdate=!1},t.prototype.replacePath=function(e){if(!this.noRawUpdate){var t=this.accessByPath(e);void 0!==t&&t instanceof O&&t.setRawFromValue()}},t.prototype.removePath=function(e){var t;try{t=this.accessByPath(e)}catch(e){return}void 0!==t&&t instanceof T&&t.clear()},t.prototype.addPath=function(e){var t=l(e);if(0!==t.length){var n=parseInt(t[t.length-1],10);if(!isNaN(n)){var r=this.accessByPath(function(e){var t=e.join("/");return t.startsWith("/")?t:"/"+t}(t.slice(0,t.length-1)));void 0!==r&&r instanceof G&&r.addIndex(n)}}},t.prototype.save=function(){return Y(this,void 0,void 0,function(){var e,t;return Z(this,function(n){switch(n.label){case 0:return[4,this.validate()];case 1:return e=n.sent(),this.setSaveStatus("rightAfter"),e?[4,this.saveFunc(this.node)]:[2,!1];case 2:return null!=(t=n.sent())?(this.setErrors(t),[2,!1]):(this.clearErrors(),[2,!0])}})})},t.prototype.setErrors=function(e){var t=function(e){return JSON.parse(JSON.stringify(e))}(e);this.flatAccessors.map(function(n){var r=d(e,n.path);n instanceof O&&null!=r&&(n.setError(r),y(t,n.path))}),this.additionalErrorTree=t},t.prototype.clearErrors=function(){this.additionalErrorTree={},this.flatAccessors.map(function(e){e instanceof O&&e.clearError()})},t.prototype.getValue=function(e){return Object(c.resolvePath)(this.node,e)},t.prototype.getMstType=function(e){for(var t=l(e),n=this.form.model,r=0,o=t;r<o.length;r++){var i=o[r];f(i)?n=n.getChildType(i):n=n.getChildType(i)}return n},Object.defineProperty(t.prototype,"isValidating",{get:function(){return this.flatAccessors.some(function(e){return e instanceof O&&e.isValidating})},enumerable:!0,configurable:!0}),t.prototype.accessByPath=function(e){var t=l(e);return this.accessBySteps(t)},t.prototype.accessBySteps=function(e){return this.formAccessor.accessBySteps(e)},t.prototype.additionalError=function(e){var t=this.additionalErrorTree[e];if("string"==typeof t)return t},Object.defineProperty(t.prototype,"additionalErrors",{get:function(){var e=this,t=[];return Object.keys(this.additionalErrorTree).forEach(function(n){var r=e.additionalErrorTree[n];"string"==typeof r&&t.push(r)}),t.sort(),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isWarningFree",{get:function(){return void 0===this.formAccessor.warningValue&&!this.flatAccessors.some(function(e){return!!e&&void 0!==e.warningValue})},enumerable:!0,configurable:!0}),Q([s.observable,X("design:type",Object)],t.prototype,"additionalErrorTree",void 0),Q([s.observable,X("design:type",String)],t.prototype,"saveStatus",void 0),Q([s.action,X("design:type",Function),X("design:paramtypes",[String]),X("design:returntype",void 0)],t.prototype,"setSaveStatus",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[String,Object]),X("design:returntype",void 0)],t.prototype,"setValueWithoutRawUpdate",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[String]),X("design:returntype",void 0)],t.prototype,"replacePath",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[String]),X("design:returntype",void 0)],t.prototype,"removePath",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[String]),X("design:returntype",void 0)],t.prototype,"addPath",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[]),X("design:returntype",Promise)],t.prototype,"save",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[Object]),X("design:returntype",void 0)],t.prototype,"setErrors",null),Q([s.action,X("design:type",Function),X("design:paramtypes",[]),X("design:returntype",void 0)],t.prototype,"clearErrors",null),Q([s.computed,X("design:type",Boolean),X("design:paramtypes",[])],t.prototype,"isValidating",null),Q([s.computed,X("design:type",Array),X("design:paramtypes",[])],t.prototype,"additionalErrors",null),Q([s.computed,X("design:type",Boolean),X("design:paramtypes",[])],t.prototype,"isWarningFree",null),t}(E);function te(){return Y(this,void 0,void 0,function(){return Z(this,function(e){return console.warn("No mstform save function configured"),[2,null]})})}var ne=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},re=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},oe=function(){function e(e,t){this.model=e,this.definition=t}return Object.defineProperty(e.prototype,"FormStateType",{get:function(){throw new Error("For introspection")},enumerable:!0,configurable:!0}),e.prototype.state=function(e,t){return new ee(this,e,t)},e}(),ie=function(){return function(e){this.definition=e}}(),ae=function(){return function(e){this.message=e}}(),ue=function(){return function(e){this.value=e}}(),se=function(){function e(e,t){if(this.converter=e,this.options=t,t){if(this.rawValidators=t.rawValidators?t.rawValidators:[],this.validators=t.validators?t.validators:[],this.conversionError=t.conversionError||"Could not convert",this.requiredError=t.requiredError||"Required",this.required=t.required||!1,t.fromEvent){if(t.getRaw)throw new Error("Cannot have fromEvent and getRaw defined at same time");this.getRaw=function(e){return e.target.value}}else this.getRaw=t.getRaw||p;this.derivedFunc=t.derived,this.changeFunc=t.change,this.controlled=t.controlled||this.createDefaultControlled()}else this.rawValidators=[],this.validators=[],this.conversionError="Could not convert",this.requiredError="Required",this.required=!1,this.getRaw=p,this.controlled=this.createDefaultControlled()}return e.prototype.createDefaultControlled=function(){var e=this;return this.getRaw!==p?function(t){return{value:t.raw,onChange:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.setRaw(e.getRaw.apply(e,n))}}}:this.converter.defaultControlled},Object.defineProperty(e.prototype,"RawType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ValueType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),e.prototype.process=function(e,t){return ne(this,void 0,void 0,function(){var n,r,o,i,a,u;return re(this,function(s){switch(s.label){case 0:if(e=this.converter.preprocessRaw(e),!this.converter.neverRequired&&e===this.converter.emptyRaw&&t)return[2,new ae(this.requiredError)];n=0,r=this.rawValidators,s.label=1;case 1:return n<r.length?[4,(0,r[n])(e)]:[3,4];case 2:if("string"==typeof(u=s.sent())&&u)return[2,new ae(u)];s.label=3;case 3:return n++,[3,1];case 4:return[4,this.converter.convert(e)];case 5:if("ConversionError"===(o=s.sent()))return e===this.converter.emptyRaw?[2,new ae(this.requiredError)]:[2,new ae(this.conversionError)];i=0,a=this.validators,s.label=6;case 6:return i<a.length?[4,(0,a[i])(o.value)]:[3,9];case 7:if("string"==typeof(u=s.sent())&&u)return[2,new ae(u)];s.label=8;case 8:return i++,[3,6];case 9:return[2,new ue(o.value)]}})})},e.prototype.render=function(e){return this.converter.render(e)},e}(),ce=function(){return function(e){this.definition=e}}(),pe=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),le=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,u)}s((r=r.apply(e,t||[])).next())})},fe=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},de=new RegExp("^-?(0|[1-9]\\d*)(\\.\\d*)?$"),ye=new RegExp("^-?(0|[1-9]\\d*)$"),he=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultControlled=r.value,t}return pe(t,e),t.prototype.preprocessRaw=function(e){return e.trim()},t}(u),ge=new he({emptyRaw:"",convert:function(e){return e},render:function(e){return e}}),be=new he({emptyRaw:"",rawValidate:function(e){return e.startsWith(".")&&(e="0"+e),de.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),ve=new he({emptyRaw:"",rawValidate:function(e){return ye.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),me=new u({emptyRaw:!1,convert:function(e){return e},render:function(e){return e},defaultControlled:r.checked,neverRequired:!0}),we=function(){function e(e,t){this.maxWholeDigits=e,this.decimalPlaces=t,this.defaultControlled=r.value,this.neverRequired=!1,this.emptyRaw="";var n=new RegExp("^-?(0|[1-9]\\d{0,"+(e-1)+"})(\\.\\d{0,"+t+"})?$");this.converter=new he({emptyRaw:"",rawValidate:function(e){return e.startsWith(".")&&(e="0"+e),n.test(e)},convert:function(e){return e},render:function(e){return e}})}return e.prototype.preprocessRaw=function(e){return e.trim()},e.prototype.convert=function(e){return this.converter.convert(e)},e.prototype.render=function(e){return this.converter.render(e)},e.prototype.getRaw=function(e){return e},e}();var Oe=new u({emptyRaw:[],convert:function(e){return s.observable.array(e)},render:function(e){return e.slice()}});var je=function(){function e(e){this.converter=e,this.defaultControlled=r.value,this.neverRequired=!1,this.emptyRaw=""}return e.prototype.preprocessRaw=function(e){return e.trim()},e.prototype.convert=function(e){return le(this,void 0,void 0,function(){return fe(this,function(t){return""===e.trim()?[2,new a(null)]:[2,this.converter.convert(e)]})})},e.prototype.render=function(e){return null===e?"":this.converter.render(e)},e}(),Re=function(){function e(e){this.neverRequired=!1,this.emptyRaw=null,this.defaultControlled=r.object}return e.prototype.preprocessRaw=function(e){return e},e.prototype.convert=function(e){return le(this,void 0,void 0,function(){return fe(this,function(t){return null===e?[2,"ConversionError"]:[2,new a(e)]})})},e.prototype.render=function(e){return e},e}();var Pe={string:ge,number:be,integer:ve,decimal:function(e,t){return new we(e,t)},boolean:me,stringArray:Oe,maybe:function(e){return e instanceof he?new je(e):new u({emptyRaw:null,convert:p,render:p,defaultControlled:r.object})},model:function(e){return new Re(e)},object:new u({emptyRaw:null,convert:p,render:p})};n.d(t,"Form",function(){return oe}),n.d(t,"SubForm",function(){return ie}),n.d(t,"ValidationMessage",function(){return ae}),n.d(t,"ProcessValue",function(){return ue}),n.d(t,"Field",function(){return se}),n.d(t,"RepeatingForm",function(){return ce}),n.d(t,"ConversionValue",function(){return a}),n.d(t,"CONVERSION_ERROR",function(){return"ConversionError"}),n.d(t,"Converter",function(){return u}),n.d(t,"StringConverter",function(){return he}),n.d(t,"converters",function(){return Pe}),n.d(t,"FieldAccessor",function(){return O}),n.d(t,"FormAccessor",function(){return K}),n.d(t,"RepeatingFormAccessor",function(){return G}),n.d(t,"RepeatingFormIndexedAccessor",function(){return T}),n.d(t,"SubFormAccessor",function(){return B}),n.d(t,"currentValidationProps",function(){return h}),n.d(t,"setupValidationProps",function(){return g}),n.d(t,"controlled",function(){return r}),n.d(t,"FormState",function(){return ee})}])});
//# sourceMappingURL=mstform.js.map

@@ -8,4 +8,2 @@ import { FormDefinition } from "./form";

validate(): Promise<boolean>;
setError(error: string): void;
clearError(): void;
readonly error: string | undefined;

@@ -12,0 +10,0 @@ readonly isValid: boolean;

@@ -17,11 +17,7 @@ import { SubForm, Field, FormDefinition, RepeatingForm } from "./form";

subFormAccessors: Map<keyof M, SubFormAccessor<any, any>>;
_error: string | undefined;
_addMode: boolean;
constructor(state: FormState<M, D>, definition: any, parent: FormAccessor<any, any> | SubFormAccessor<any, any> | RepeatingFormAccessor<any, any> | RepeatingFormIndexedAccessor<any, any> | null, addMode: boolean, allowedKeys?: string[] | undefined);
validate(): Promise<boolean>;
setError(error: string): void;
clearError(): void;
clear(): void;
readonly path: string;
readonly error: string | undefined;
readonly isValid: boolean;

@@ -41,2 +37,6 @@ readonly accessors: Accessor[];

repeatingField(name: string): any;
readonly errorValue: string | undefined;
readonly error: string | undefined;
readonly warningValue: string | undefined;
readonly warning: string | undefined;
}

@@ -11,3 +11,2 @@ import { FormDefinition, RepeatingForm } from "./form";

name: string;
_error: string | undefined;
repeatingFormIndexedAccessors: Map<number, RepeatingFormIndexedAccessor<any, any>>;

@@ -17,4 +16,2 @@ constructor(state: FormState<any, any>, repeatingForm: RepeatingForm<M, D>, parent: FormAccessor<any, any>, name: string);

readonly path: string;
setError(error: string): void;
clearError(): void;
validate(): Promise<boolean>;

@@ -30,3 +27,2 @@ readonly addMode: boolean;

accessBySteps(steps: string[]): Accessor | undefined;
readonly error: string | undefined;
insert(index: number, node: any): void;

@@ -39,2 +35,6 @@ push(node: any): void;

readonly length: number;
readonly errorValue: string | undefined;
readonly error: string | undefined;
readonly warningValue: string | undefined;
readonly warning: string | undefined;
}

@@ -19,2 +19,6 @@ import { FormDefinition } from "./form";

readonly addMode: boolean;
readonly errorValue: string | undefined;
readonly error: string | undefined;
readonly warningValue: string | undefined;
readonly warning: string | undefined;
}

@@ -12,3 +12,3 @@ import { IType } from "mobx-state-tree";

export interface ErrorOrWarning {
(fieldAccessor: FieldAccessor<any, any, any>): string | undefined;
(accessor: Accessor): string | undefined;
}

@@ -15,0 +15,0 @@ export interface ExtraValidation {

@@ -13,4 +13,9 @@ import { FormDefinition } from "./form";

clear(): void;
validate(): Promise<boolean>;
readonly path: string;
readonly addMode: boolean;
readonly errorValue: string | undefined;
readonly error: string | undefined;
readonly warningValue: string | undefined;
readonly warning: string | undefined;
}
{
"name": "mstform",
"version": "0.20.0",
"version": "0.21.0",
"description": "mobx-state-tree powered forms",

@@ -5,0 +5,0 @@ "main": "dist/mstform.js",

@@ -612,3 +612,17 @@ # mstform README

Other accessors in mstform - `SubForm`, `RepeatingForm` and `Form` - also use
this error hook, allowing you to set errors on the complete form - or any accessor
within it. Indexed entries within repeating forms can also be set with an error.
If, for example, we want to raise an error when a `RepeatingForm` is empty, we
can raise an error on the repeating form accessor like this
```js
this.formState = form.state(o, {
getError: accessor => accessor instanceof RepeatingFormAccessor && accessor.length === 0
? "The repeating form must contain at least one form"
: undefined
})
```
## Controlling validation messages

@@ -709,3 +723,3 @@

mstform has a hook which allows you to include `warning` messages in the fields.
mstform has a hook which allows you to include `warning` messages in its accessors.
Warnings are similar to errors, but don't make the form invalid. The idea is

@@ -712,0 +726,0 @@ that you can show warnings for certain fields in your form as a notification to

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc