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.17.0 to 0.17.1

5

CHANGES.md

@@ -0,1 +1,6 @@

# 0.17.1
- When a field is `neverRequired` then we want the 'required' property
to be false, no matter what.
# 0.17.0

@@ -2,0 +7,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.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 b(e){h=e}var g=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 this._error},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,"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.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")},g([u.observable,v("design:type",Object)],e.prototype,"_raw",void 0),g([u.observable,v("design:type",Object)],e.prototype,"_error",void 0),g([u.observable,v("design:type",Boolean)],e.prototype,"_isValidating",void 0),g([u.observable,v("design:type",Boolean)],e.prototype,"_addMode",void 0),g([u.computed,v("design:type",String),v("design:paramtypes",[])],e.prototype,"path",null),g([u.action,v("design:type",Function),v("design:paramtypes",[Function]),v("design:returntype",void 0)],e.prototype,"setDisposer",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"node",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"addMode",null),g([u.computed,v("design:type","function"==typeof(t="undefined"!=typeof R&&R)&&t||Object),v("design:paramtypes",[])],e.prototype,"raw",null),g([u.computed,v("design:type","function"==typeof(r="undefined"!=typeof V&&V)&&r||Object),v("design:paramtypes",[])],e.prototype,"value",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"errorValue",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"canShowValidationMessages",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"error",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValidating",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"disabled",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"hidden",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"readOnly",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"required",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValid",null),g([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),g([u.action,v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",void 0)],e.prototype,"setError",null),g([u.action,v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"clearError",null),g([u.action,v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",void 0)],e.prototype,"setValidating",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"inputProps",null),g([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},P=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},F=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 F(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,P("design:type",Function),P("design:paramtypes",[String]),P("design:returntype",void 0)],e.prototype,"setError",null),j([u.action,P("design:type",Function),P("design:paramtypes",[]),P("design:returntype",void 0)],e.prototype,"clearError",null),j([u.computed,P("design:type",Object),P("design:paramtypes",[])],e.prototype,"error",null),j([u.computed,P("design:type",Boolean),P("design:paramtypes",[])],e.prototype,"isValid",null),j([u.computed,P("design:type",Array),P("design:paramtypes",[])],e.prototype,"accessors",null),j([u.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 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())})},N=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])}}},z=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 N(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}])},e.prototype.push=function(e){var t=Object(c.resolvePath)(this.state.node,this.path),r=this.path+"/"+t.length;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:e}])},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}(),U=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},G=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=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 W(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 z?(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 z(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){},U([u.observable,G("design:type",Object)],e.prototype,"_error",void 0),U([u.observable,G("design:type",Boolean)],e.prototype,"_addMode",void 0),U([u.action,G("design:type",Function),G("design:paramtypes",[String]),G("design:returntype",void 0)],e.prototype,"setError",null),U([u.action,G("design:type",Function),G("design:paramtypes",[]),G("design:returntype",void 0)],e.prototype,"clearError",null),U([u.computed,G("design:type",String),G("design:paramtypes",[])],e.prototype,"path",null),U([u.computed,G("design:type",Object),G("design:paramtypes",[])],e.prototype,"error",null),U([u.computed,G("design:type",Boolean),G("design:paramtypes",[])],e.prototype,"isValid",null),U([u.computed,G("design:type",Array),G("design:paramtypes",[])],e.prototype,"accessors",null),U([u.computed,G("design:type",Array),G("design:paramtypes",[])],e.prototype,"flatAccessors",null),U([u.computed,G("design:type",Boolean),G("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.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.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)));if(void 0!==n&&n instanceof z){n.addIndex(r);var o=this.accessByPath(e);void 0!==o&&o instanceof q&&o.setAddMode()}}}},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}),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),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(!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}(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()}}),be=new de({emptyRaw:"",rawValidate:function(e){return fe.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),ge=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.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.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}(),Oe=function(){function e(e){this.neverRequired=!1,this.emptyRaw=null,this.defaultControlled=n.object}return 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 Re={string:ye,number:he,integer:be,decimal:function(e,t){return new ve(e,t)},boolean:ge,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 Oe(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 Re}),r.d(t,"FieldAccessor",function(){return O}),r.d(t,"FormAccessor",function(){return J}),r.d(t,"RepeatingFormAccessor",function(){return z}),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 b}),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 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.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 b(e){h=e}var g=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 this._error},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,"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")},g([u.observable,v("design:type",Object)],e.prototype,"_raw",void 0),g([u.observable,v("design:type",Object)],e.prototype,"_error",void 0),g([u.observable,v("design:type",Boolean)],e.prototype,"_isValidating",void 0),g([u.observable,v("design:type",Boolean)],e.prototype,"_addMode",void 0),g([u.computed,v("design:type",String),v("design:paramtypes",[])],e.prototype,"path",null),g([u.action,v("design:type",Function),v("design:paramtypes",[Function]),v("design:returntype",void 0)],e.prototype,"setDisposer",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"node",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"addMode",null),g([u.computed,v("design:type","function"==typeof(t="undefined"!=typeof R&&R)&&t||Object),v("design:paramtypes",[])],e.prototype,"raw",null),g([u.computed,v("design:type","function"==typeof(r="undefined"!=typeof V&&V)&&r||Object),v("design:paramtypes",[])],e.prototype,"value",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"errorValue",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"canShowValidationMessages",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"error",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValidating",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"disabled",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"hidden",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"readOnly",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"required",null),g([u.computed,v("design:type",Boolean),v("design:paramtypes",[])],e.prototype,"isValid",null),g([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),g([u.action,v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",void 0)],e.prototype,"setError",null),g([u.action,v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"clearError",null),g([u.action,v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",void 0)],e.prototype,"setValidating",null),g([u.computed,v("design:type",Object),v("design:paramtypes",[])],e.prototype,"inputProps",null),g([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},P=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},F=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 F(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,P("design:type",Function),P("design:paramtypes",[String]),P("design:returntype",void 0)],e.prototype,"setError",null),j([u.action,P("design:type",Function),P("design:paramtypes",[]),P("design:returntype",void 0)],e.prototype,"clearError",null),j([u.computed,P("design:type",Object),P("design:paramtypes",[])],e.prototype,"error",null),j([u.computed,P("design:type",Boolean),P("design:paramtypes",[])],e.prototype,"isValid",null),j([u.computed,P("design:type",Array),P("design:paramtypes",[])],e.prototype,"accessors",null),j([u.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 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())})},N=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])}}},z=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 N(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}])},e.prototype.push=function(e){var t=Object(c.resolvePath)(this.state.node,this.path),r=this.path+"/"+t.length;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:e}])},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}(),U=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},G=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},W=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 W(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 z?(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 z(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){},U([u.observable,G("design:type",Object)],e.prototype,"_error",void 0),U([u.observable,G("design:type",Boolean)],e.prototype,"_addMode",void 0),U([u.action,G("design:type",Function),G("design:paramtypes",[String]),G("design:returntype",void 0)],e.prototype,"setError",null),U([u.action,G("design:type",Function),G("design:paramtypes",[]),G("design:returntype",void 0)],e.prototype,"clearError",null),U([u.computed,G("design:type",String),G("design:paramtypes",[])],e.prototype,"path",null),U([u.computed,G("design:type",Object),G("design:paramtypes",[])],e.prototype,"error",null),U([u.computed,G("design:type",Boolean),G("design:paramtypes",[])],e.prototype,"isValid",null),U([u.computed,G("design:type",Array),G("design:paramtypes",[])],e.prototype,"accessors",null),U([u.computed,G("design:type",Array),G("design:paramtypes",[])],e.prototype,"flatAccessors",null),U([u.computed,G("design:type",Boolean),G("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.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.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)));if(void 0!==n&&n instanceof z){n.addIndex(r);var o=this.accessByPath(e);void 0!==o&&o instanceof q&&o.setAddMode()}}}},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}),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),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(!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}(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()}}),be=new de({emptyRaw:"",rawValidate:function(e){return fe.test(e)},convert:function(e){return+e},render:function(e){return e.toString()}}),ge=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.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.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}(),Oe=function(){function e(e){this.neverRequired=!1,this.emptyRaw=null,this.defaultControlled=n.object}return 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 Re={string:ye,number:he,integer:be,decimal:function(e,t){return new ve(e,t)},boolean:ge,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 Oe(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 Re}),r.d(t,"FieldAccessor",function(){return O}),r.d(t,"FormAccessor",function(){return J}),r.d(t,"RepeatingFormAccessor",function(){return z}),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 b}),r.d(t,"controlled",function(){return n}),r.d(t,"FormState",function(){return Y})}])});
//# sourceMappingURL=mstform.js.map
{
"name": "mstform",
"version": "0.17.0",
"version": "0.17.1",
"description": "mobx-state-tree powered forms",

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

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