@kizahasi/util
Advanced tools
Comparing version 0.1.0-alpha.1 to 0.1.0-alpha.2
@@ -5,3 +5,3 @@ export { __, range } from './internal/collection'; | ||
export { KeyFactory, CustomDualKeyMap, ReadonlyCustomDualKeyMap, groupJoin as groupJoinCustomDualKeyMap, } from './internal/customDualKeyMap'; | ||
export { DualKey, DualKeyMap, ReadonlyDualKeyMap, DualKeyMapSource, dualKeyToString, toJsonString as dualKeyMapToJsonString, groupJoin as groupJoinDualKeyMap, groupJoin3 as groupJoin3DualKeyMap, groupJoin4 as groupJoin4DualKeyMap, } from './internal/dualKeyMap'; | ||
export { DualKey, DualKeyMap, ReadonlyDualKeyMap, DualKeyMapSource, dualKeyToString, toJsonString as dualKeyToJsonString, groupJoin as groupJoinDualKeyMap, groupJoin3 as groupJoin3DualKeyMap, groupJoin4 as groupJoin4DualKeyMap, } from './internal/dualKeyMap'; | ||
export { Expression, plain, expr1, analyze } from './internal/expression'; | ||
@@ -16,2 +16,3 @@ export { StrIndex5, strIndex5Array, isStrIndex5, StrIndex10, strIndex10Array, isStrIndex10, StrIndex20, strIndex20Array, isStrIndex20, StrIndex100, strIndex100Array, isStrIndex100, } from './internal/indexes'; | ||
export { CompositeKey, compositeKeyToString, stringToCompositeKey, toJsonString as stateMapToJsonString, equals as compositeKeyEquals, StateMap, ReadonlyStateMap, createStateMap, } from './internal/stateMap'; | ||
export { left, right, both } from './internal/types'; | ||
export { chooseDualKeyRecord, chooseRecord, dualKeyRecordFind, dualKeyRecordForEach, isRecordEmpty, mapToRecord, recordCompact, recordForEach, recordForEachAsync, recordToArray, recordToDualKeyMap, recordToMap, } from './internal/utils'; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@kizahasi/result"),t=require("io-ts");function r(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}function n(e){this.wrapped=e}function o(e){var t,r;function o(t,r){try{var i=e[t](r),u=i.value,c=u instanceof n;Promise.resolve(c?u.wrapped:u).then((function(e){c?o("return"===t?"return":"next",e):a(i.done?"return":"normal",e)}),(function(e){o("throw",e)}))}catch(e){a("throw",e)}}function a(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?o(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise((function(a,i){var u={key:e,arg:n,resolve:a,reject:i,next:null};r?r=r.next=u:(t=r=u,o(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}function a(e){return function(){return new o(e.apply(this,arguments))}}function i(e){return new n(e)}function u(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){u(a,n,o,i,c,"next",e)}function c(e){u(a,n,o,i,c,"throw",e)}i(void 0)}))}}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)};var d,y=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof p?t:p).prototype),a=new S(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=w(i,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function l(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(A([])));y&&y!==t&&r.call(y,o)&&(v=y);var x=l.prototype=p.prototype=Object.create(v);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var c=s(e[o],e,a);if("throw"!==c.type){var f=c.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(p).then((function(e){f.value=e,i(f)}),(function(e){return n("throw",e,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:j}}function j(){return{value:void 0,done:!0}}return h.prototype=x.constructor=l,l.constructor=h,h.displayName=u(l,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,i,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},g(m.prototype),m.prototype[a]=function(){return this},e.AsyncIterator=m,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new m(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(x),u(x,i,"Generator"),x[o]=function(){return this},x.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=A,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(d={exports:{}}),d.exports),x=function(e,t){var r=new Map,n=new Set(t);return e.forEach((function(e){var t=n.has(e);n.delete(e),r.set(e,t?"both":"left")})),n.forEach((function(e){r.set(e,"right")})),r},g=function(){function e(e){this.iterate=void 0,this.iterate=e}var t=e.prototype;return t.toAsync=function(e){function t(){return(t=a(y.mark((function t(){var r,n,o;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=v(e());case 1:if((n=r()).done){t.next=7;break}return o=n.value,t.next=5,o;case 5:t.next=1;break;case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return new m((function(){return t.apply(this,arguments)}))},t.compact=function(e){return this.flatMap((function(t,r){var n=e(t,r);return null==n?[]:[n]}))},t.compactAsync=function(e){return this.toAsync(this.iterate).compactAsync(e)},t.count=function(){for(var e=0,t=v(this.iterate());!t().done;)e++;return e},t.some=function(e){return void 0!==this.find(e)},t.filter=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a,i;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=10;break}if(!t(i=a.value,e)){r.next=7;break}return r.next=7,i;case 7:e++;case 8:r.next=2;break;case 10:case"end":return r.stop()}}),r)}return new e(o)},t.find=function(e){for(var t,r=0,n=v(this.iterate());!(t=n()).done;){var o=t.value;if(e(o,r))return{index:r,value:o};r++}},t.flatMap=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=8;break}return r.delegateYield(t(a.value,e),"t0",5);case 5:e++;case 6:r.next=2;break;case 8:case"end":return r.stop()}}),r)}return new e(o)},t.forEach=function(e){for(var t,r=v(this.iterate());!(t=r()).done;)e(t.value)},t.map=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a,i;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=9;break}return i=a.value,r.next=6,t(i,e);case 6:e++;case 7:r.next=2;break;case 9:case"end":return r.stop()}}),r)}return new e(o)},t.mapAsync=function(e){return this.toAsync(this.iterate).mapAsync(e)},t.pairwise=function(){var t=y.mark(n),r=this.iterate;function n(){var e,n,o,a,i;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=void 0,n=void 0,o=v(r());case 3:if((a=o()).done){t.next=15;break}if(i=a.value,void 0!==e){t.next=9;break}return n=e,e=i,t.abrupt("continue",13);case 9:return t.next=11,{prev:n,current:e,next:i};case 11:n=e,e=i;case 13:t.next=3;break;case 15:if(void 0===e){t.next=18;break}return t.next=18,{prev:n,current:e,next:void 0};case 18:case"end":return t.stop()}}),t)}return new e(n)},t.reduce=function(e,t){for(var r,n=t,o=0,a=v(this.iterate());!(r=a()).done;)n=e(n,r.value,o),o++;return n},t.reduceAsync=function(e,t){return this.toAsync(this.iterate).reduceAsync(e,t)},t.skipAndTake=function(t,r){var n=y.mark(a),o=this.iterate;function a(){var e,a,i,u;return y.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:e=0,a=v(o());case 2:if((i=a()).done){n.next=11;break}if(u=i.value,!(t<=e)){n.next=8;break}if(!(null==r||e<t+r)){n.next=8;break}return n.next=8,u;case 8:e++;case 9:n.next=2;break;case 11:case"end":return n.stop()}}),n)}return new e(a)},t.skip=function(e){return this.skipAndTake(e,void 0)},t.take=function(e){return this.skipAndTake(0,e)},t.toArray=function(){return[].concat(this.iterate())},t.toSet=function(){return new Set(this.iterate())},t.toMap=function(e){for(var t,r=new Map,n=v(this.iterate());!(t=n()).done;){var o=e(t.value);r.set(o.key,o.value)}return r},t.toMapAsync=function(e){return this.toAsync(this.iterate).toMapAsync(e)},e}(),m=function(){function e(e){this.iterateAsync=void 0,this.iterateAsync=e}var t=e.prototype;return t.compactAsync=function(t){var n=this.iterateAsync;function o(){return(o=a(y.mark((function e(){var o,a,u,c,s,f,p,h,l;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0,a=!0,u=!1,e.prev=3,s=r(n());case 5:return e.next=7,i(s.next());case 7:return a=(f=e.sent).done,e.next=11,i(f.value);case 11:if(p=e.sent,a){e.next=25;break}return h=p,e.next=16,i(t(h,o));case 16:if(null!=(l=e.sent)){e.next=19;break}return e.abrupt("continue",22);case 19:return e.next=21,l;case 21:o++;case 22:a=!0,e.next=5;break;case 25:e.next=31;break;case 27:e.prev=27,e.t0=e.catch(3),u=!0,c=e.t0;case 31:if(e.prev=31,e.prev=32,a||null==s.return){e.next=36;break}return e.next=36,i(s.return());case 36:if(e.prev=36,!u){e.next=39;break}throw c;case 39:return e.finish(36);case 40:return e.finish(31);case 41:case"end":return e.stop()}}),e,null,[[3,27,31,41],[32,,36,40]])})))).apply(this,arguments)}return new e((function(){return o.apply(this,arguments)}))},t.mapAsync=function(t){var n=this.iterateAsync;function o(){return(o=a(y.mark((function e(){var o,a,u,c,s,f,p,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0,a=!0,u=!1,e.prev=3,s=r(n());case 5:return e.next=7,i(s.next());case 7:return a=(f=e.sent).done,e.next=11,i(f.value);case 11:if(p=e.sent,a){e.next=20;break}return h=p,e.next=16,t(h,o);case 16:o++;case 17:a=!0,e.next=5;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(3),u=!0,c=e.t0;case 26:if(e.prev=26,e.prev=27,a||null==s.return){e.next=31;break}return e.next=31,i(s.return());case 31:if(e.prev=31,!u){e.next=34;break}throw c;case 34:return e.finish(31);case 35:return e.finish(26);case 36:case"end":return e.stop()}}),e,null,[[3,22,26,36],[27,,31,35]])})))).apply(this,arguments)}return new e((function(){return o.apply(this,arguments)}))},t.reduceAsync=function(){var e=c(y.mark((function e(t,n){var o,a,i,u,c,s,f,p,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=n,a=0,i=!0,u=!1,e.prev=4,s=r(this.iterateAsync());case 6:return e.next=8,s.next();case 8:return i=(f=e.sent).done,e.next=12,f.value;case 12:if(p=e.sent,i){e.next=22;break}return h=p,e.next=17,t(o,h,a);case 17:o=e.sent,a++;case 19:i=!0,e.next=6;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(4),u=!0,c=e.t0;case 28:if(e.prev=28,e.prev=29,i||null==s.return){e.next=33;break}return e.next=33,s.return();case 33:if(e.prev=33,!u){e.next=36;break}throw c;case 36:return e.finish(33);case 37:return e.finish(28);case 38:return e.abrupt("return",o);case 39:case"end":return e.stop()}}),e,this,[[4,24,28,38],[29,,33,37]])})));return function(t,r){return e.apply(this,arguments)}}(),t.toArrayAsync=function(){var e=c(y.mark((function e(){var t,n,o,a,i,u,c;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,o=!1,e.prev=3,i=r(this.iterateAsync());case 5:return e.next=7,i.next();case 7:return n=(u=e.sent).done,e.next=11,u.value;case 11:if(c=e.sent,n){e.next=18;break}t.push(c);case 15:n=!0,e.next=5;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(3),o=!0,a=e.t0;case 24:if(e.prev=24,e.prev=25,n||null==i.return){e.next=29;break}return e.next=29,i.return();case 29:if(e.prev=29,!o){e.next=32;break}throw a;case 32:return e.finish(29);case 33:return e.finish(24);case 34:return e.abrupt("return",t);case 35:case"end":return e.stop()}}),e,this,[[3,20,24,34],[25,,29,33]])})));return function(){return e.apply(this,arguments)}}(),t.toMapAsync=function(){var e=c(y.mark((function e(t){var n,o,a,i,u,c,s,f,p;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Map,o=!0,a=!1,e.prev=3,u=r(this.iterateAsync());case 5:return e.next=7,u.next();case 7:return o=(c=e.sent).done,e.next=11,c.value;case 11:if(s=e.sent,o){e.next=23;break}return f=s,e.next=16,t(f);case 16:n.set((p=e.sent).key,p.value);case 20:o=!0,e.next=5;break;case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(3),a=!0,i=e.t0;case 29:if(e.prev=29,e.prev=30,o||null==u.return){e.next=34;break}return e.next=34,u.return();case 34:if(e.prev=34,!a){e.next=37;break}throw i;case 37:return e.finish(34);case 38:return e.finish(29);case 39:return e.abrupt("return",n);case 40:case"end":return e.stop()}}),e,this,[[3,25,29,39],[30,,34,38]])})));return function(t){return e.apply(this,arguments)}}(),e}(),w=function(e){function t(t){var r;return(r=e.call(this,(function(){return t.values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.count=function(){return this.source.length},r.elementAt=function(e){if(!Number.isInteger(e))throw"not integer";if(e<this.source.length)return this.source[e];throw"index out of range"},r.elementAtOrDefault=function(e,t){if(!Number.isInteger(e))throw"not integer";return e<this.source.length?this.source[e]:t},r.elementAtOrUndefined=function(e){return this.elementAtOrDefault(e,void 0)},r.findOrUndefinedAsync=function(){var e=c(y.mark((function e(t){var r,n,o;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=v(this.source);case 1:if((n=r()).done){e.next=9;break}return o=n.value,e.next=5,t(o);case 5:if(!e.sent){e.next=7;break}return e.abrupt("return",o);case 7:e.next=1;break;case 9:return e.abrupt("return",void 0);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.first=function(){if(0===this.source.length)throw"array is empty.";return this.source[0]},r.firstOrDefault=function(e){return 0===this.source.length?e:this.source[0]},r.last=function(){if(0===this.source.length)throw"array is empty.";return this.source[this.source.length-1]},r.lastOrDefault=function(e){return 0===this.source.length?e:this.source[this.source.length-1]},r.single=function(){if(1!==this.source.length)throw"array.length !== 1";return this.source[0]},f(t,[{key:"value",get:function(){return this.source}}]),t}(g),b=function(e){function t(t){var r;return(r=e.call(this,(function(){return t.values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.count=function(){return this.source.size},r.groupJoin=function(e){return x(this.source,e instanceof t?e.source:e)},r.equal=function(e){for(var t,r=v(this.groupJoin(e));!(t=r()).done;)if("both"!==t.value[1])return!1;return!0},r.single=function(){if(1!==this.source.size)throw"array.size !== 1";return[].concat(this.source)[0]},f(t,[{key:"value",get:function(){return this.source}}]),t}(g),k=function(e){function t(t){var r;return(r=e.call(this,(function(){return[].concat(t).values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.mapToArray=function(e){var t=[];return this.source.forEach((function(r,n){t.push(e({key:n,value:r}))})),t},r.forAll=function(e){for(var t,r=v(this.source);!(t=r()).done;){var n=t.value;if(!e({key:n[0],value:n[1]}))return!1}return!0},t}(g);function S(e){return e instanceof w||e instanceof k||e instanceof b||e instanceof g?e:"get"in e?new k(e):"size"in e?new b(e):"length"in e?new w(e):new g((function(){return e[Symbol.iterator]()}))}var A,j=function(e){if(0===e.length)return"root value";var t=e[0];return S(e).skip(1).forEach((function(e){t=t+"/"+e})),t},E=function(){function e(e,t){if(this.jsonObject=void 0,this.currentPath=void 0,this.jsonObject=e,this.currentPath=t,null==e)throw new Error("jsonObject == null")}e.init=function(t){return new e(t,[])};var t=e.prototype;return t.tryGet=function(t){if("object"==typeof this.jsonObject){var r=this.jsonObject[t];return null==r?r:new e(r,[].concat(this.currentPath,[t]))}},t.get=function(e){var t=this.tryGet(e);if(null==t)throw new Error(j([].concat(this.currentPath,[e]))+" is not object.");return t},t.valueAsString=function(){if("string"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be string.")},t.valueAsNullableString=function(){if(null===this.jsonObject||"string"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be string or null.")},t.valueAsBoolean=function(){if("boolean"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be true or false.")},e}();A=Symbol.iterator;var M,_=function(){function e(t){this._core=void 0,this._core=null==t?new Map:e.mapMap(t,(function(e){return e}))}e.mapMap=function(e,t){for(var r,n=new Map,o=v(e);!(r=o()).done;){var a=r.value,i=a[0],u=a[1];if(0!==u.size){for(var c,s=new Map,f=v(u);!(c=f()).done;){var p=c.value,h=p[0];s.set(h,t(p[1],{first:i,second:h}))}n.set(i,s)}}return n},e.create=function(t,r){var n=new e;return n._core=e.mapMap(t instanceof e?t._core:t,r),n},e.ofRecord=function(t){var r=new e;for(var n in t){var o=t[n];if(void 0!==o)for(var a in o){var i=o[a];void 0!==i&&r.set({first:n,second:a},i)}}return r};var t=e.prototype;return t.map=function(t){return e.create(this,t)},t.clone=function(){return e.create(this,(function(e){return e}))},t.get=function(e){var t=e.second,r=this._core.get(e.first);if(void 0!==r)return r.get(t)},t.getByFirst=function(e){return this._core.get(e)},t.set=function(e,t){var r=e.first,n=e.second,o=this._core.get(r);return void 0===o&&(o=new Map,this._core.set(r,o)),o.set(n,t),this},t.delete=function(e){var t=e.first,r=e.second,n=this._core.get(t);if(void 0===n)return!1;var o=n.delete(r);return 0===n.size&&this._core.delete(t),o},t.has=function(e){return void 0!==this.get(e)},t[A]=y.mark((function e(){var t,r,n,o,a,i,u,c,s;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=v(this._core);case 1:if((r=t()).done){e.next=12;break}o=(n=r.value)[0],a=v(n[1]);case 4:if((i=a()).done){e.next=10;break}return c=(u=i.value)[0],s=u[1],e.next=8,[{first:o,second:c},s];case 8:e.next=4;break;case 10:e.next=1;break;case 12:case"end":return e.stop()}}),e,this)})),t.toArray=function(){return[].concat(this)},t.toMap=function(){return e.mapMap(this._core,(function(e){return e}))},t.toStringRecord=function(e,t){var r={};return this._core.forEach((function(n,o){var a={};n.forEach((function(e,r){a[t(r)]=e})),r[e(o)]=a})),r},t.forEach=function(e){for(var t,r=v(this);!(t=r()).done;){var n=t.value;e(n[1],n[0])}},t.reduce=function(e,t){var r=t;return this.forEach((function(t,n){return r=e(r,t,n)})),r},t.toJSON=function(e){return JSON.stringify([].concat(this._core).map((function(t){return[t[0],[].concat(t[1]).map((function(t){var r=t[1];return[t[0],void 0===e?r:e(r)]}))]})))},f(e,[{key:"size",get:function(){return this.toArray().length}},{key:"isEmpty",get:function(){return 0===this.size}}]),e}(),K=function(e,t){var r=new _,n=t.clone();return e.forEach((function(e,t){var o=n.get(t);n.delete(t),r.set(t,void 0!==o?{type:"both",left:e,right:o}:{type:"left",left:e})})),n.forEach((function(e,t){r.set(t,{type:"right",right:e})})),r},O=function(e,t,r){return K(e,K(t,r)).map((function(e){switch(e.type){case"left":return[e.left,void 0,void 0];case"right":case"both":var t=function(){if("both"===e.type)return e.left}();switch(e.right.type){case"left":return[t,e.right.left,void 0];case"right":return[t,void 0,e.right.right];case"both":return[t,e.right.left,e.right.right]}}}))};M=Symbol.iterator;var I,N,R,T=function(){function e(e){this.params=void 0,this._dualKeyMap=void 0,this.params=e,this._dualKeyMap=e.sourceMap instanceof _?e.sourceMap.clone():new _(e.sourceMap)}var t=e.prototype;return t.wrap=function(t){var r=new e(p({},this.params,{sourceMap:void 0}));return r._dualKeyMap=t,r},t.createKey=function(e){return this.params.createKey(e)},t.createDualKey=function(e){return this.params.createDualKey(e)},t.map=function(t){var r=new e(p({},this.params,{sourceMap:void 0}));return r._dualKeyMap=this._dualKeyMap.map(t),r},t.clone=function(){var t=new e(p({},this.params,{sourceMap:void 0}));return t._dualKeyMap=this._dualKeyMap.clone(),t},t.get=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.get(t)},t.getByFirst=function(e){return this._dualKeyMap.getByFirst(e)},t.set=function(e,t){var r=this.params.createDualKey(e);return this._dualKeyMap.set(r,t),this},t.delete=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.delete(t)},t.has=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.has(t)},t[M]=y.mark((function e(){var t,r,n,o,a;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=v(this._dualKeyMap);case 1:if((r=t()).done){e.next=7;break}return o=(n=r.value)[0],a=n[1],e.next=5,[this.params.createKey(o),a];case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e,this)})),t.toArray=function(){return[].concat(this)},t.forEach=function(e){for(var t,r=v(this);!(t=r()).done;){var n=t.value;e(n[1],n[0])}},t.reduce=function(e,t){var r=t;return this.forEach((function(t,n){return r=e(r,t,n)})),r},t.toJSON=function(){return this._dualKeyMap.toJSON()},f(e,[{key:"dualKeyMap",get:function(){return this._dualKeyMap}},{key:"size",get:function(){return this.toArray().length}},{key:"isEmpty",get:function(){return 0===this.size}}]),e}(),P="expr1",B=["1","2","3","4","5"],L=new Set(B),D=["1","2","3","4","5","6","7","8","9","10"],C=new Set(D),q=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"],J=new Set(q),F=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100"],z=new Set(F);R=exports.PublicChannelKey||(exports.PublicChannelKey={}),(N=R.Without$System||(R.Without$System={})).publicChannelKeys=[].concat(D,["$free"]),N.isPublicChannelKey=function(e){return void 0!==N.publicChannelKeys.find((function(t){return t===e}))},(I=R.With$System||(R.With$System={})).publicChannelKeys=[].concat(D,["$free","$system"]),I.isPublicChannelKey=function(e){return void 0!==I.publicChannelKeys.find((function(t){return t===e}))};var U=function(){function e(t){var r;this.major=void 0,this.minor=void 0,this.patch=void 0,this.prerelease=void 0,e.requireToBeNonNegativeInteger(t.major,"major"),e.requireToBeNonNegativeInteger(t.minor,"minor"),e.requireToBeNonNegativeInteger(t.patch,"patch"),null!=t.prerelease&&e.requireToBePositiveInteger(t.prerelease.version,"prerelease version"),this.major=t.major,this.minor=t.minor,this.patch=t.patch,this.prerelease=null!=(r=t.prerelease)?r:null}return e.requireToBePositiveInteger=function(e,t){if(!Number.isInteger(e))throw new Error("Semver error: "+t+' must be integer. Actual value is "'+e+'"');if(e<=0)throw new Error("Semver error: "+t+' must be positive. Actual value is "'+e+'"')},e.requireToBeNonNegativeInteger=function(e,t){if(!Number.isInteger(e))throw new Error("Semver error: "+t+' must be integer. Actual value is "'+e+'"');if(e<0)throw new Error("Semver error: "+t+' must not be negative. Actual value is "'+e+'"')},e.prototype.toString=function(){return null==this.prerelease?this.major+"."+this.minor+"."+this.patch:this.major+"."+this.minor+"."+this.patch+"-"+this.prerelease.type+"."+this.prerelease.version},e.compareNumbers=function(e,t,r){switch(t){case"=":return e===r;case"<":return e<r;case"<=":return e<=r;case">":return e>r;case">=":return e>=r}},e.prereleaseTypeToNumber=function(e){if(null==e)return 0;switch(e){case"rc":return-1;case"beta":return-2;case"alpha":return-3}},e.compareCore=function(t,r,n){var o,a,i,u,c,s;if(t.major!==n.major)return e.compareNumbers(t.major,r,n.major);if(t.minor!==n.minor)return e.compareNumbers(t.minor,r,n.minor);if(t.patch!==n.patch)return e.compareNumbers(t.patch,r,n.patch);var f=e.prereleaseTypeToNumber(null==(o=t.prerelease)?void 0:o.type),p=e.prereleaseTypeToNumber(null==(a=n.prerelease)?void 0:a.type);return f!==p?e.compareNumbers(f,r,p):e.compareNumbers(null!=(i=null==(u=t.prerelease)?void 0:u.version)?i:-1,r,null!=(c=null==(s=n.prerelease)?void 0:s.version)?c:-1)},e.compare=function(t,r,n){switch(r){case"=":case"<":case">":return e.compareCore(t,r,n);case"<=":return!e.compareCore(t,">",n);case">=":return!e.compareCore(t,"<",n)}},e.check=function(e){var t,r,n=e.api,o=e.web;return n.major===o.major?n.minor<o.minor?"apiServerRequiresUpdate":"alpha"===(null==(t=n.prerelease)?void 0:t.type)||"alpha"===(null==(r=o.prerelease)?void 0:r.type)?"alpha":"ok":n.major>o.major?"webServerRequiresUpdate":n.major<o.major?"apiServerRequiresUpdate":"ok"},e}(),$={createDualKey:function(e){return{first:e.createdBy,second:e.id}},createKey:function(e){return{createdBy:e.first,id:e.second}}},G=function(e,t){var r={};for(var n in e){var o=e[n];if(void 0!==o){var a=t(o);void 0!==a&&(r[n]=a)}}return r},Q=function(){var e=c(y.mark((function e(t,r){var n,o;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=y.keys(t);case 1:if((e.t1=e.t0()).done){e.next=10;break}if(void 0!==(o=t[n=e.t1.value])){e.next=6;break}return e.abrupt("continue",1);case 6:return e.next=8,r(o,n);case 8:e.next=1;break;case 10:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();exports.$free="$free",exports.$system="$system",exports.CustomDualKeyMap=T,exports.DualKeyMap=_,exports.JsonObject=E,exports.SemVer=U,exports.__=S,exports.alpha="alpha",exports.analyze=function(t){var r=function(t){for(var r=/[a-zA-Z0-9_-]/,n=[],o={type:"plain",text:""},a=t.split(""),i=0;i<a.length;i++){var u=a[i];if(void 0===u)throw new Error("this should not happen. charArray out of range.");switch(o.type){case"plain":switch(u){case"\\":var c=a[i+1];if(null==c)return e.Result.error({message:"末尾を \\ にすることはできません。",index:i});i++,o=p({},o,{text:o.text+c});continue;case"{":var s=a[i+1];if(null!=o&&n.push(o),"{"===s){i++,o={type:"expr2",path:[],reading:{type:"Begin"}};continue}o={type:P,path:[],reading:{type:"Begin"}};continue;case"}":return e.Result.error({message:"} に対応する { が見つかりません。",index:i});default:o=p({},o,{text:o.text+u});continue}case P:case"expr2":if("}"===u)switch(o.reading.type){case"Begin":return e.Result.error({message:"プロパティを空にすることはできません。",index:i});case"Bare":case"EndOfProp":if(o.type===P){n.push({type:P,path:"Bare"===o.reading.type?[].concat(o.path,[o.reading.text]):o.path}),o={type:"plain",text:""};continue}if("}"!==a[i+1])return e.Result.error({message:"{{ を } で閉じることはできません。",index:i});continue}switch(o.reading.type){case"Begin":switch(u){case" ":continue;case"'":o=p({},o,{reading:{type:"InSingleQuote",text:""}});continue;case'"':o=p({},o,{reading:{type:"InDoubleQuote",text:""}});continue;default:if(!r.test(u))return e.Result.error({message:u+" はこの場所で使うことはできません。",index:i});o=p({},o,{reading:{type:"Bare",text:u}});continue}case"EndOfProp":switch(u){case" ":continue;case".":o=p({},o,{reading:{type:"Begin"}});continue;default:return e.Result.error({message:u+" はこの場所で使うことはできません。",index:i})}case"Bare":switch(u){case" ":o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;case".":o={type:o.type,path:[].concat(o.path,[o.reading.text]),reading:{type:"Begin"}};continue;default:if(!r.test(u))return e.Result.error({message:u+" は ' か \" で囲む必要があります。",index:i});o=p({},o,{reading:{type:"Bare",text:o.reading.text+u}});continue}case"InDoubleQuote":switch(u){case'"':o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;case"\\":var f=a[i+1];switch(f){case'"':o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+'"'}}),i++;continue;case"\\":o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+"\\"}}),i++;continue;case void 0:return e.Result.error({message:"エスケープ文字の次に文字がありません。",index:i});default:return e.Result.error({message:"\\"+f+" は無効なエスケープシーケンスです。",index:i})}default:o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+u}});continue}case"InSingleQuote":switch(u){case"'":o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;default:o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+u}});continue}}}}switch(o.type){case"plain":return e.Result.ok([].concat(n,[o]));case P:return e.Result.error({index:i+1,message:"} に対応する { がありません。"});case"expr2":return e.Result.error({index:i+1,message:"}} に対応する {{ がありません。"})}}(t);if(r.isError)return e.Result.error(r.error.index+": "+r.error.message);for(var n,o=[],a=v(r.value);!(n=a()).done;){var i=n.value;switch(i.type){case"expr2":return e.Result.error("{{と}}で囲む構文は将来のために予約されているため、現在は使用することはできません。");case P:o.push({type:P,path:i.path});continue;default:""!==i.text&&o.push({type:"plain",text:i.text});continue}}return e.Result.ok(o)},exports.anonymous="anonymous",exports.apiServerRequiresUpdate="apiServerRequiresUpdate",exports.authToken="authToken",exports.beta="beta",exports.chooseDualKeyRecord=function(e,t){var r={};for(var n in e){var o=e[n];void 0!==o&&(r[n]=G(o,t))}return r},exports.chooseRecord=G,exports.compositeKeyEquals=function(e,t){return e.createdBy===t.createdBy&&e.id===t.id},exports.compositeKeyToString=function(e){return e.id+"@"+e.createdBy},exports.createFirebaseConfig=function(e){var t=E.init(e);return{apiKey:t.get("apiKey").valueAsString(),authDomain:t.get("authDomain").valueAsString(),databaseURL:t.get("databaseURL").valueAsString(),projectId:t.get("projectId").valueAsString(),storageBucket:t.get("storageBucket").valueAsString(),messagingSenderId:t.get("messagingSenderId").valueAsString(),appId:t.get("appId").valueAsString(),measurementId:t.get("measurementId").valueAsString()}},exports.createStateMap=function(e){return new T(p({},$,{sourceMap:e}))},exports.dualKeyMapToJsonString=function(e){return"{ first: "+e.first+", second: "+e.second+" }"},exports.dualKeyRecordFind=function(e,t){var r=e[t.first];if(void 0!==r)return r[t.second]},exports.dualKeyRecordForEach=function(e,t){for(var r in e){var n=e[r];if(void 0!==n)for(var o in n){var a=n[o];void 0!==a&&t(a,{first:r,second:o})}}},exports.dualKeyToString=function(e){return e.first+"@"+e.second},exports.expr1=P,exports.groupJoin3DualKeyMap=O,exports.groupJoin4DualKeyMap=function(e,t,r,n){return K(O(e,t,r),n).map((function(e){switch(e.type){case"left":return[].concat(e.left,[void 0]);case"right":return[void 0,void 0,void 0,e.right];case"both":return[].concat(e.left,[e.right])}}))},exports.groupJoinCustomDualKeyMap=function(e,t){var r=K(e.dualKeyMap,t.dualKeyMap);return new T(p({},e,{sourceMap:r}))},exports.groupJoinDualKeyMap=K,exports.groupJoinMap=function(e,t){var r=new Map,n=new Map(t);return e.forEach((function(e,t){var o=n.get(t);n.delete(t),r.set(t,void 0!==o?{type:"both",left:e,right:o}:{type:"left",left:e})})),n.forEach((function(e,t){r.set(t,{type:"right",right:e})})),r},exports.groupJoinSet=x,exports.isRecordEmpty=function(e){for(var t in e)if(void 0!==e[t])return!1;return!0},exports.isStrIndex10=function(e){return C.has(e)},exports.isStrIndex100=function(e){return z.has(e)},exports.isStrIndex20=function(e){return J.has(e)},exports.isStrIndex5=function(e){return L.has(e)},exports.mapToRecord=function(e){var t={};return e.forEach((function(e,r){t[r]=e})),t},exports.maybe=function(e){return t.union([e,t.null,t.undefined])},exports.ok="ok",exports.plain="plain",exports.range=function(e,t){var r=y.mark(n);function n(){var n;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=0;case 1:if(!(n<t)){r.next=7;break}return r.next=4,e+n;case 4:n++,r.next=1;break;case 7:case"end":return r.stop()}}),r)}return new g(n)},exports.rc="rc",exports.recordCompact=function(e,t){var r={};for(var n in e){var o=e[n];if(void 0!==o){var a=t(o,n);void 0!==a&&(r[n]=a)}}return r},exports.recordForEach=function(e,t){for(var r in e){var n=e[r];void 0!==n&&t(n,r)}},exports.recordForEachAsync=Q,exports.recordToArray=function(e){var t=[];for(var r in e){var n=e[r];void 0!==n&&t.push({key:r,value:n})}return t},exports.recordToDualKeyMap=function(e){var t=new _;for(var r in e){var n=e[r];if(void 0!==n)for(var o in n){var a=n[o];void 0!==a&&t.set({first:r,second:o},a)}}return t},exports.recordToMap=function(e){var t=new Map;for(var r in e){var n=e[r];void 0!==n&&t.set(r,n)}return t},exports.stateMapToJsonString=function(e){return"{ id: "+e.id+", createdBy: "+e.createdBy+" }"},exports.strIndex100Array=F,exports.strIndex10Array=D,exports.strIndex20Array=q,exports.strIndex5Array=B,exports.stringToCompositeKey=function(e){var t=e.split("@");return 2!==t.length?null:{id:t[0],createdBy:t[1]}},exports.webServerRequiresUpdate="webServerRequiresUpdate"; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@kizahasi/result"),t=require("io-ts");function r(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}function n(e){this.wrapped=e}function o(e){var t,r;function o(t,r){try{var i=e[t](r),u=i.value,s=u instanceof n;Promise.resolve(s?u.wrapped:u).then((function(e){s?o("return"===t?"return":"next",e):a(i.done?"return":"normal",e)}),(function(e){o("throw",e)}))}catch(e){a("throw",e)}}function a(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?o(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise((function(a,i){var u={key:e,arg:n,resolve:a,reject:i,next:null};r?r=r.next=u:(t=r=u,o(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}function a(e){return function(){return new o(e.apply(this,arguments))}}function i(e){return new n(e)}function u(e,t,r,n,o,a,i){try{var u=e[a](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){u(a,n,o,i,s,"next",e)}function s(e){u(a,n,o,i,s,"throw",e)}i(void 0)}))}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),e}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)};var d,y=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=Object.create((t&&t.prototype instanceof p?t:p).prototype),a=new S(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=w(i,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,a),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f={};function p(){}function h(){}function l(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(A([])));y&&y!==t&&r.call(y,o)&&(v=y);var x=l.prototype=p.prototype=Object.create(v);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var s=c(e[o],e,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(p).then((function(e){f.value=e,i(f)}),(function(e){return n("throw",e,i,u)}))}u(s.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:j}}function j(){return{value:void 0,done:!0}}return h.prototype=x.constructor=l,l.constructor=h,h.displayName=u(l,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,i,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},g(m.prototype),m.prototype[a]=function(){return this},e.AsyncIterator=m,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new m(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(x),u(x,i,"Generator"),x[o]=function(){return this},x.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=A,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(d={exports:{}}),d.exports),x=function(e,t){var r=new Map,n=new Set(t);return e.forEach((function(e){var t=n.has(e);n.delete(e),r.set(e,t?"both":"left")})),n.forEach((function(e){r.set(e,"right")})),r},g=function(){function e(e){this.iterate=void 0,this.iterate=e}var t=e.prototype;return t.toAsync=function(e){function t(){return(t=a(y.mark((function t(){var r,n,o;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=v(e());case 1:if((n=r()).done){t.next=7;break}return o=n.value,t.next=5,o;case 5:t.next=1;break;case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return new m((function(){return t.apply(this,arguments)}))},t.compact=function(e){return this.flatMap((function(t,r){var n=e(t,r);return null==n?[]:[n]}))},t.compactAsync=function(e){return this.toAsync(this.iterate).compactAsync(e)},t.count=function(){for(var e=0,t=v(this.iterate());!t().done;)e++;return e},t.some=function(e){return void 0!==this.find(e)},t.filter=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a,i;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=10;break}if(!t(i=a.value,e)){r.next=7;break}return r.next=7,i;case 7:e++;case 8:r.next=2;break;case 10:case"end":return r.stop()}}),r)}return new e(o)},t.find=function(e){for(var t,r=0,n=v(this.iterate());!(t=n()).done;){var o=t.value;if(e(o,r))return{index:r,value:o};r++}},t.flatMap=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=8;break}return r.delegateYield(t(a.value,e),"t0",5);case 5:e++;case 6:r.next=2;break;case 8:case"end":return r.stop()}}),r)}return new e(o)},t.forEach=function(e){for(var t,r=v(this.iterate());!(t=r()).done;)e(t.value)},t.map=function(t){var r=y.mark(o),n=this.iterate;function o(){var e,o,a,i;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=0,o=v(n());case 2:if((a=o()).done){r.next=9;break}return i=a.value,r.next=6,t(i,e);case 6:e++;case 7:r.next=2;break;case 9:case"end":return r.stop()}}),r)}return new e(o)},t.mapAsync=function(e){return this.toAsync(this.iterate).mapAsync(e)},t.pairwise=function(){var t=y.mark(n),r=this.iterate;function n(){var e,n,o,a,i;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=void 0,n=void 0,o=v(r());case 3:if((a=o()).done){t.next=15;break}if(i=a.value,void 0!==e){t.next=9;break}return n=e,e=i,t.abrupt("continue",13);case 9:return t.next=11,{prev:n,current:e,next:i};case 11:n=e,e=i;case 13:t.next=3;break;case 15:if(void 0===e){t.next=18;break}return t.next=18,{prev:n,current:e,next:void 0};case 18:case"end":return t.stop()}}),t)}return new e(n)},t.reduce=function(e,t){for(var r,n=t,o=0,a=v(this.iterate());!(r=a()).done;)n=e(n,r.value,o),o++;return n},t.reduceAsync=function(e,t){return this.toAsync(this.iterate).reduceAsync(e,t)},t.skipAndTake=function(t,r){var n=y.mark(a),o=this.iterate;function a(){var e,a,i,u;return y.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:e=0,a=v(o());case 2:if((i=a()).done){n.next=11;break}if(u=i.value,!(t<=e)){n.next=8;break}if(!(null==r||e<t+r)){n.next=8;break}return n.next=8,u;case 8:e++;case 9:n.next=2;break;case 11:case"end":return n.stop()}}),n)}return new e(a)},t.skip=function(e){return this.skipAndTake(e,void 0)},t.take=function(e){return this.skipAndTake(0,e)},t.toArray=function(){return[].concat(this.iterate())},t.toSet=function(){return new Set(this.iterate())},t.toMap=function(e){for(var t,r=new Map,n=v(this.iterate());!(t=n()).done;){var o=e(t.value);r.set(o.key,o.value)}return r},t.toMapAsync=function(e){return this.toAsync(this.iterate).toMapAsync(e)},e}(),m=function(){function e(e){this.iterateAsync=void 0,this.iterateAsync=e}var t=e.prototype;return t.compactAsync=function(t){var n=this.iterateAsync;function o(){return(o=a(y.mark((function e(){var o,a,u,s,c,f,p,h,l;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0,a=!0,u=!1,e.prev=3,c=r(n());case 5:return e.next=7,i(c.next());case 7:return a=(f=e.sent).done,e.next=11,i(f.value);case 11:if(p=e.sent,a){e.next=25;break}return h=p,e.next=16,i(t(h,o));case 16:if(null!=(l=e.sent)){e.next=19;break}return e.abrupt("continue",22);case 19:return e.next=21,l;case 21:o++;case 22:a=!0,e.next=5;break;case 25:e.next=31;break;case 27:e.prev=27,e.t0=e.catch(3),u=!0,s=e.t0;case 31:if(e.prev=31,e.prev=32,a||null==c.return){e.next=36;break}return e.next=36,i(c.return());case 36:if(e.prev=36,!u){e.next=39;break}throw s;case 39:return e.finish(36);case 40:return e.finish(31);case 41:case"end":return e.stop()}}),e,null,[[3,27,31,41],[32,,36,40]])})))).apply(this,arguments)}return new e((function(){return o.apply(this,arguments)}))},t.mapAsync=function(t){var n=this.iterateAsync;function o(){return(o=a(y.mark((function e(){var o,a,u,s,c,f,p,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0,a=!0,u=!1,e.prev=3,c=r(n());case 5:return e.next=7,i(c.next());case 7:return a=(f=e.sent).done,e.next=11,i(f.value);case 11:if(p=e.sent,a){e.next=20;break}return h=p,e.next=16,t(h,o);case 16:o++;case 17:a=!0,e.next=5;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(3),u=!0,s=e.t0;case 26:if(e.prev=26,e.prev=27,a||null==c.return){e.next=31;break}return e.next=31,i(c.return());case 31:if(e.prev=31,!u){e.next=34;break}throw s;case 34:return e.finish(31);case 35:return e.finish(26);case 36:case"end":return e.stop()}}),e,null,[[3,22,26,36],[27,,31,35]])})))).apply(this,arguments)}return new e((function(){return o.apply(this,arguments)}))},t.reduceAsync=function(){var e=s(y.mark((function e(t,n){var o,a,i,u,s,c,f,p,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=n,a=0,i=!0,u=!1,e.prev=4,c=r(this.iterateAsync());case 6:return e.next=8,c.next();case 8:return i=(f=e.sent).done,e.next=12,f.value;case 12:if(p=e.sent,i){e.next=22;break}return h=p,e.next=17,t(o,h,a);case 17:o=e.sent,a++;case 19:i=!0,e.next=6;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(4),u=!0,s=e.t0;case 28:if(e.prev=28,e.prev=29,i||null==c.return){e.next=33;break}return e.next=33,c.return();case 33:if(e.prev=33,!u){e.next=36;break}throw s;case 36:return e.finish(33);case 37:return e.finish(28);case 38:return e.abrupt("return",o);case 39:case"end":return e.stop()}}),e,this,[[4,24,28,38],[29,,33,37]])})));return function(t,r){return e.apply(this,arguments)}}(),t.toArrayAsync=function(){var e=s(y.mark((function e(){var t,n,o,a,i,u,s;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=!0,o=!1,e.prev=3,i=r(this.iterateAsync());case 5:return e.next=7,i.next();case 7:return n=(u=e.sent).done,e.next=11,u.value;case 11:if(s=e.sent,n){e.next=18;break}t.push(s);case 15:n=!0,e.next=5;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(3),o=!0,a=e.t0;case 24:if(e.prev=24,e.prev=25,n||null==i.return){e.next=29;break}return e.next=29,i.return();case 29:if(e.prev=29,!o){e.next=32;break}throw a;case 32:return e.finish(29);case 33:return e.finish(24);case 34:return e.abrupt("return",t);case 35:case"end":return e.stop()}}),e,this,[[3,20,24,34],[25,,29,33]])})));return function(){return e.apply(this,arguments)}}(),t.toMapAsync=function(){var e=s(y.mark((function e(t){var n,o,a,i,u,s,c,f,p;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Map,o=!0,a=!1,e.prev=3,u=r(this.iterateAsync());case 5:return e.next=7,u.next();case 7:return o=(s=e.sent).done,e.next=11,s.value;case 11:if(c=e.sent,o){e.next=23;break}return f=c,e.next=16,t(f);case 16:n.set((p=e.sent).key,p.value);case 20:o=!0,e.next=5;break;case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(3),a=!0,i=e.t0;case 29:if(e.prev=29,e.prev=30,o||null==u.return){e.next=34;break}return e.next=34,u.return();case 34:if(e.prev=34,!a){e.next=37;break}throw i;case 37:return e.finish(34);case 38:return e.finish(29);case 39:return e.abrupt("return",n);case 40:case"end":return e.stop()}}),e,this,[[3,25,29,39],[30,,34,38]])})));return function(t){return e.apply(this,arguments)}}(),e}(),w=function(e){function t(t){var r;return(r=e.call(this,(function(){return t.values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.count=function(){return this.source.length},r.elementAt=function(e){if(!Number.isInteger(e))throw"not integer";if(e<this.source.length)return this.source[e];throw"index out of range"},r.elementAtOrDefault=function(e,t){if(!Number.isInteger(e))throw"not integer";return e<this.source.length?this.source[e]:t},r.elementAtOrUndefined=function(e){return this.elementAtOrDefault(e,void 0)},r.findOrUndefinedAsync=function(){var e=s(y.mark((function e(t){var r,n,o;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=v(this.source);case 1:if((n=r()).done){e.next=9;break}return o=n.value,e.next=5,t(o);case 5:if(!e.sent){e.next=7;break}return e.abrupt("return",o);case 7:e.next=1;break;case 9:return e.abrupt("return",void 0);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.first=function(){if(0===this.source.length)throw"array is empty.";return this.source[0]},r.firstOrDefault=function(e){return 0===this.source.length?e:this.source[0]},r.last=function(){if(0===this.source.length)throw"array is empty.";return this.source[this.source.length-1]},r.lastOrDefault=function(e){return 0===this.source.length?e:this.source[this.source.length-1]},r.single=function(){if(1!==this.source.length)throw"array.length !== 1";return this.source[0]},f(t,[{key:"value",get:function(){return this.source}}]),t}(g),b=function(e){function t(t){var r;return(r=e.call(this,(function(){return t.values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.count=function(){return this.source.size},r.groupJoin=function(e){return x(this.source,e instanceof t?e.source:e)},r.equal=function(e){for(var t,r=v(this.groupJoin(e));!(t=r()).done;)if("both"!==t.value[1])return!1;return!0},r.single=function(){if(1!==this.source.size)throw"array.size !== 1";return[].concat(this.source)[0]},f(t,[{key:"value",get:function(){return this.source}}]),t}(g),k=function(e){function t(t){var r;return(r=e.call(this,(function(){return[].concat(t).values()}))||this).source=void 0,r.source=t,r}h(t,e);var r=t.prototype;return r.mapToArray=function(e){var t=[];return this.source.forEach((function(r,n){t.push(e({key:n,value:r}))})),t},r.forAll=function(e){for(var t,r=v(this.source);!(t=r()).done;){var n=t.value;if(!e({key:n[0],value:n[1]}))return!1}return!0},t}(g);function S(e){return e instanceof w||e instanceof k||e instanceof b||e instanceof g?e:"get"in e?new k(e):"size"in e?new b(e):"length"in e?new w(e):new g((function(){return e[Symbol.iterator]()}))}var A,j=function(e){if(0===e.length)return"root value";var t=e[0];return S(e).skip(1).forEach((function(e){t=t+"/"+e})),t},E=function(){function e(e,t){if(this.jsonObject=void 0,this.currentPath=void 0,this.jsonObject=e,this.currentPath=t,null==e)throw new Error("jsonObject == null")}e.init=function(t){return new e(t,[])};var t=e.prototype;return t.tryGet=function(t){if("object"==typeof this.jsonObject){var r=this.jsonObject[t];return null==r?r:new e(r,[].concat(this.currentPath,[t]))}},t.get=function(e){var t=this.tryGet(e);if(null==t)throw new Error(j([].concat(this.currentPath,[e]))+" is not object.");return t},t.valueAsString=function(){if("string"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be string.")},t.valueAsNullableString=function(){if(null===this.jsonObject||"string"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be string or null.")},t.valueAsBoolean=function(){if("boolean"==typeof this.jsonObject)return this.jsonObject;throw new Error(j(this.currentPath)+" must be true or false.")},e}();A=Symbol.iterator;var M,_=function(){function e(t){this._core=void 0,this._core=null==t?new Map:e.mapMap(t,(function(e){return e}))}e.mapMap=function(e,t){for(var r,n=new Map,o=v(e);!(r=o()).done;){var a=r.value,i=a[0],u=a[1];if(0!==u.size){for(var s,c=new Map,f=v(u);!(s=f()).done;){var p=s.value,h=p[0];c.set(h,t(p[1],{first:i,second:h}))}n.set(i,c)}}return n},e.create=function(t,r){var n=new e;return n._core=e.mapMap(t instanceof e?t._core:t,r),n},e.ofRecord=function(t){var r=new e;for(var n in t){var o=t[n];if(void 0!==o)for(var a in o){var i=o[a];void 0!==i&&r.set({first:n,second:a},i)}}return r};var t=e.prototype;return t.map=function(t){return e.create(this,t)},t.clone=function(){return e.create(this,(function(e){return e}))},t.get=function(e){var t=e.second,r=this._core.get(e.first);if(void 0!==r)return r.get(t)},t.getByFirst=function(e){return this._core.get(e)},t.set=function(e,t){var r=e.first,n=e.second,o=this._core.get(r);return void 0===o&&(o=new Map,this._core.set(r,o)),o.set(n,t),this},t.delete=function(e){var t=e.first,r=e.second,n=this._core.get(t);if(void 0===n)return!1;var o=n.delete(r);return 0===n.size&&this._core.delete(t),o},t.has=function(e){return void 0!==this.get(e)},t[A]=y.mark((function e(){var t,r,n,o,a,i,u,s,c;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=v(this._core);case 1:if((r=t()).done){e.next=12;break}o=(n=r.value)[0],a=v(n[1]);case 4:if((i=a()).done){e.next=10;break}return s=(u=i.value)[0],c=u[1],e.next=8,[{first:o,second:s},c];case 8:e.next=4;break;case 10:e.next=1;break;case 12:case"end":return e.stop()}}),e,this)})),t.toArray=function(){return[].concat(this)},t.toMap=function(){return e.mapMap(this._core,(function(e){return e}))},t.toStringRecord=function(e,t){var r={};return this._core.forEach((function(n,o){var a={};n.forEach((function(e,r){a[t(r)]=e})),r[e(o)]=a})),r},t.forEach=function(e){for(var t,r=v(this);!(t=r()).done;){var n=t.value;e(n[1],n[0])}},t.reduce=function(e,t){var r=t;return this.forEach((function(t,n){return r=e(r,t,n)})),r},t.toJSON=function(e){return JSON.stringify([].concat(this._core).map((function(t){return[t[0],[].concat(t[1]).map((function(t){var r=t[1];return[t[0],void 0===e?r:e(r)]}))]})))},f(e,[{key:"size",get:function(){return this.toArray().length}},{key:"isEmpty",get:function(){return 0===this.size}}]),e}(),K=function(e,t){var r=new _,n=t.clone();return e.forEach((function(e,t){var o=n.get(t);n.delete(t),r.set(t,void 0!==o?{type:"both",left:e,right:o}:{type:"left",left:e})})),n.forEach((function(e,t){r.set(t,{type:"right",right:e})})),r},O=function(e,t,r){return K(e,K(t,r)).map((function(e){switch(e.type){case"left":return[e.left,void 0,void 0];case"right":case"both":var t=function(){if("both"===e.type)return e.left}();switch(e.right.type){case"left":return[t,e.right.left,void 0];case"right":return[t,void 0,e.right.right];case"both":return[t,e.right.left,e.right.right]}}}))};M=Symbol.iterator;var I,N,R,T=function(){function e(e){this.params=void 0,this._dualKeyMap=void 0,this.params=e,this._dualKeyMap=e.sourceMap instanceof _?e.sourceMap.clone():new _(e.sourceMap)}var t=e.prototype;return t.wrap=function(t){var r=new e(p({},this.params,{sourceMap:void 0}));return r._dualKeyMap=t,r},t.createKey=function(e){return this.params.createKey(e)},t.createDualKey=function(e){return this.params.createDualKey(e)},t.map=function(t){var r=new e(p({},this.params,{sourceMap:void 0}));return r._dualKeyMap=this._dualKeyMap.map(t),r},t.clone=function(){var t=new e(p({},this.params,{sourceMap:void 0}));return t._dualKeyMap=this._dualKeyMap.clone(),t},t.get=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.get(t)},t.getByFirst=function(e){return this._dualKeyMap.getByFirst(e)},t.set=function(e,t){var r=this.params.createDualKey(e);return this._dualKeyMap.set(r,t),this},t.delete=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.delete(t)},t.has=function(e){var t=this.params.createDualKey(e);return this._dualKeyMap.has(t)},t[M]=y.mark((function e(){var t,r,n,o,a;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=v(this._dualKeyMap);case 1:if((r=t()).done){e.next=7;break}return o=(n=r.value)[0],a=n[1],e.next=5,[this.params.createKey(o),a];case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e,this)})),t.toArray=function(){return[].concat(this)},t.forEach=function(e){for(var t,r=v(this);!(t=r()).done;){var n=t.value;e(n[1],n[0])}},t.reduce=function(e,t){var r=t;return this.forEach((function(t,n){return r=e(r,t,n)})),r},t.toJSON=function(){return this._dualKeyMap.toJSON()},f(e,[{key:"dualKeyMap",get:function(){return this._dualKeyMap}},{key:"size",get:function(){return this.toArray().length}},{key:"isEmpty",get:function(){return 0===this.size}}]),e}(),P="expr1",B=["1","2","3","4","5"],L=new Set(B),D=["1","2","3","4","5","6","7","8","9","10"],C=new Set(D),q=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"],J=new Set(q),F=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100"],z=new Set(F);R=exports.PublicChannelKey||(exports.PublicChannelKey={}),(N=R.Without$System||(R.Without$System={})).publicChannelKeys=[].concat(D,["$free"]),N.isPublicChannelKey=function(e){return void 0!==N.publicChannelKeys.find((function(t){return t===e}))},(I=R.With$System||(R.With$System={})).publicChannelKeys=[].concat(D,["$free","$system"]),I.isPublicChannelKey=function(e){return void 0!==I.publicChannelKeys.find((function(t){return t===e}))};var U=function(){function e(t){var r;this.major=void 0,this.minor=void 0,this.patch=void 0,this.prerelease=void 0,e.requireToBeNonNegativeInteger(t.major,"major"),e.requireToBeNonNegativeInteger(t.minor,"minor"),e.requireToBeNonNegativeInteger(t.patch,"patch"),null!=t.prerelease&&e.requireToBePositiveInteger(t.prerelease.version,"prerelease version"),this.major=t.major,this.minor=t.minor,this.patch=t.patch,this.prerelease=null!=(r=t.prerelease)?r:null}return e.requireToBePositiveInteger=function(e,t){if(!Number.isInteger(e))throw new Error("Semver error: "+t+' must be integer. Actual value is "'+e+'"');if(e<=0)throw new Error("Semver error: "+t+' must be positive. Actual value is "'+e+'"')},e.requireToBeNonNegativeInteger=function(e,t){if(!Number.isInteger(e))throw new Error("Semver error: "+t+' must be integer. Actual value is "'+e+'"');if(e<0)throw new Error("Semver error: "+t+' must not be negative. Actual value is "'+e+'"')},e.prototype.toString=function(){return null==this.prerelease?this.major+"."+this.minor+"."+this.patch:this.major+"."+this.minor+"."+this.patch+"-"+this.prerelease.type+"."+this.prerelease.version},e.compareNumbers=function(e,t,r){switch(t){case"=":return e===r;case"<":return e<r;case"<=":return e<=r;case">":return e>r;case">=":return e>=r}},e.prereleaseTypeToNumber=function(e){if(null==e)return 0;switch(e){case"rc":return-1;case"beta":return-2;case"alpha":return-3}},e.compareCore=function(t,r,n){var o,a,i,u,s,c;if(t.major!==n.major)return e.compareNumbers(t.major,r,n.major);if(t.minor!==n.minor)return e.compareNumbers(t.minor,r,n.minor);if(t.patch!==n.patch)return e.compareNumbers(t.patch,r,n.patch);var f=e.prereleaseTypeToNumber(null==(o=t.prerelease)?void 0:o.type),p=e.prereleaseTypeToNumber(null==(a=n.prerelease)?void 0:a.type);return f!==p?e.compareNumbers(f,r,p):e.compareNumbers(null!=(i=null==(u=t.prerelease)?void 0:u.version)?i:-1,r,null!=(s=null==(c=n.prerelease)?void 0:c.version)?s:-1)},e.compare=function(t,r,n){switch(r){case"=":case"<":case">":return e.compareCore(t,r,n);case"<=":return!e.compareCore(t,">",n);case">=":return!e.compareCore(t,"<",n)}},e.check=function(e){var t,r,n=e.api,o=e.web;return n.major===o.major?n.minor<o.minor?"apiServerRequiresUpdate":"alpha"===(null==(t=n.prerelease)?void 0:t.type)||"alpha"===(null==(r=o.prerelease)?void 0:r.type)?"alpha":"ok":n.major>o.major?"webServerRequiresUpdate":n.major<o.major?"apiServerRequiresUpdate":"ok"},e}(),$={createDualKey:function(e){return{first:e.createdBy,second:e.id}},createKey:function(e){return{createdBy:e.first,id:e.second}}},G=function(e,t){var r={};for(var n in e){var o=e[n];if(void 0!==o){var a=t(o);void 0!==a&&(r[n]=a)}}return r},Q=function(){var e=s(y.mark((function e(t,r){var n,o;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=y.keys(t);case 1:if((e.t1=e.t0()).done){e.next=10;break}if(void 0!==(o=t[n=e.t1.value])){e.next=6;break}return e.abrupt("continue",1);case 6:return e.next=8,r(o,n);case 8:e.next=1;break;case 10:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();exports.$free="$free",exports.$system="$system",exports.CustomDualKeyMap=T,exports.DualKeyMap=_,exports.JsonObject=E,exports.SemVer=U,exports.__=S,exports.alpha="alpha",exports.analyze=function(t){var r=function(t){for(var r=/[a-zA-Z0-9_-]/,n=[],o={type:"plain",text:""},a=t.split(""),i=0;i<a.length;i++){var u=a[i];if(void 0===u)throw new Error("this should not happen. charArray out of range.");switch(o.type){case"plain":switch(u){case"\\":var s=a[i+1];if(null==s)return e.Result.error({message:"末尾を \\ にすることはできません。",index:i});i++,o=p({},o,{text:o.text+s});continue;case"{":var c=a[i+1];if(null!=o&&n.push(o),"{"===c){i++,o={type:"expr2",path:[],reading:{type:"Begin"}};continue}o={type:P,path:[],reading:{type:"Begin"}};continue;case"}":return e.Result.error({message:"} に対応する { が見つかりません。",index:i});default:o=p({},o,{text:o.text+u});continue}case P:case"expr2":if("}"===u)switch(o.reading.type){case"Begin":return e.Result.error({message:"プロパティを空にすることはできません。",index:i});case"Bare":case"EndOfProp":if(o.type===P){n.push({type:P,path:"Bare"===o.reading.type?[].concat(o.path,[o.reading.text]):o.path}),o={type:"plain",text:""};continue}if("}"!==a[i+1])return e.Result.error({message:"{{ を } で閉じることはできません。",index:i});continue}switch(o.reading.type){case"Begin":switch(u){case" ":continue;case"'":o=p({},o,{reading:{type:"InSingleQuote",text:""}});continue;case'"':o=p({},o,{reading:{type:"InDoubleQuote",text:""}});continue;default:if(!r.test(u))return e.Result.error({message:u+" はこの場所で使うことはできません。",index:i});o=p({},o,{reading:{type:"Bare",text:u}});continue}case"EndOfProp":switch(u){case" ":continue;case".":o=p({},o,{reading:{type:"Begin"}});continue;default:return e.Result.error({message:u+" はこの場所で使うことはできません。",index:i})}case"Bare":switch(u){case" ":o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;case".":o={type:o.type,path:[].concat(o.path,[o.reading.text]),reading:{type:"Begin"}};continue;default:if(!r.test(u))return e.Result.error({message:u+" は ' か \" で囲む必要があります。",index:i});o=p({},o,{reading:{type:"Bare",text:o.reading.text+u}});continue}case"InDoubleQuote":switch(u){case'"':o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;case"\\":var f=a[i+1];switch(f){case'"':o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+'"'}}),i++;continue;case"\\":o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+"\\"}}),i++;continue;case void 0:return e.Result.error({message:"エスケープ文字の次に文字がありません。",index:i});default:return e.Result.error({message:"\\"+f+" は無効なエスケープシーケンスです。",index:i})}default:o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+u}});continue}case"InSingleQuote":switch(u){case"'":o=p({},o,{path:[].concat(o.path,[o.reading.text]),reading:{type:"EndOfProp"}});continue;default:o=p({},o,{reading:{type:o.reading.type,text:o.reading.text+u}});continue}}}}switch(o.type){case"plain":return e.Result.ok([].concat(n,[o]));case P:return e.Result.error({index:i+1,message:"} に対応する { がありません。"});case"expr2":return e.Result.error({index:i+1,message:"}} に対応する {{ がありません。"})}}(t);if(r.isError)return e.Result.error(r.error.index+": "+r.error.message);for(var n,o=[],a=v(r.value);!(n=a()).done;){var i=n.value;switch(i.type){case"expr2":return e.Result.error("{{と}}で囲む構文は将来のために予約されているため、現在は使用することはできません。");case P:o.push({type:P,path:i.path});continue;default:""!==i.text&&o.push({type:"plain",text:i.text});continue}}return e.Result.ok(o)},exports.anonymous="anonymous",exports.apiServerRequiresUpdate="apiServerRequiresUpdate",exports.authToken="authToken",exports.beta="beta",exports.both="both",exports.chooseDualKeyRecord=function(e,t){var r={};for(var n in e){var o=e[n];void 0!==o&&(r[n]=G(o,t))}return r},exports.chooseRecord=G,exports.compositeKeyEquals=function(e,t){return e.createdBy===t.createdBy&&e.id===t.id},exports.compositeKeyToString=function(e){return e.id+"@"+e.createdBy},exports.createFirebaseConfig=function(e){var t=E.init(e);return{apiKey:t.get("apiKey").valueAsString(),authDomain:t.get("authDomain").valueAsString(),databaseURL:t.get("databaseURL").valueAsString(),projectId:t.get("projectId").valueAsString(),storageBucket:t.get("storageBucket").valueAsString(),messagingSenderId:t.get("messagingSenderId").valueAsString(),appId:t.get("appId").valueAsString(),measurementId:t.get("measurementId").valueAsString()}},exports.createStateMap=function(e){return new T(p({},$,{sourceMap:e}))},exports.dualKeyRecordFind=function(e,t){var r=e[t.first];if(void 0!==r)return r[t.second]},exports.dualKeyRecordForEach=function(e,t){for(var r in e){var n=e[r];if(void 0!==n)for(var o in n){var a=n[o];void 0!==a&&t(a,{first:r,second:o})}}},exports.dualKeyToJsonString=function(e){return"{ first: "+e.first+", second: "+e.second+" }"},exports.dualKeyToString=function(e){return e.first+"@"+e.second},exports.expr1=P,exports.groupJoin3DualKeyMap=O,exports.groupJoin4DualKeyMap=function(e,t,r,n){return K(O(e,t,r),n).map((function(e){switch(e.type){case"left":return[].concat(e.left,[void 0]);case"right":return[void 0,void 0,void 0,e.right];case"both":return[].concat(e.left,[e.right])}}))},exports.groupJoinCustomDualKeyMap=function(e,t){var r=K(e.dualKeyMap,t.dualKeyMap);return new T(p({},e,{sourceMap:r}))},exports.groupJoinDualKeyMap=K,exports.groupJoinMap=function(e,t){var r=new Map,n=new Map(t);return e.forEach((function(e,t){var o=n.get(t);n.delete(t),r.set(t,void 0!==o?{type:"both",left:e,right:o}:{type:"left",left:e})})),n.forEach((function(e,t){r.set(t,{type:"right",right:e})})),r},exports.groupJoinSet=x,exports.isRecordEmpty=function(e){for(var t in e)if(void 0!==e[t])return!1;return!0},exports.isStrIndex10=function(e){return C.has(e)},exports.isStrIndex100=function(e){return z.has(e)},exports.isStrIndex20=function(e){return J.has(e)},exports.isStrIndex5=function(e){return L.has(e)},exports.left="left",exports.mapToRecord=function(e){var t={};return e.forEach((function(e,r){t[r]=e})),t},exports.maybe=function(e){return t.union([e,t.null,t.undefined])},exports.ok="ok",exports.plain="plain",exports.range=function(e,t){var r=y.mark(n);function n(){var n;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=0;case 1:if(!(n<t)){r.next=7;break}return r.next=4,e+n;case 4:n++,r.next=1;break;case 7:case"end":return r.stop()}}),r)}return new g(n)},exports.rc="rc",exports.recordCompact=function(e,t){var r={};for(var n in e){var o=e[n];if(void 0!==o){var a=t(o,n);void 0!==a&&(r[n]=a)}}return r},exports.recordForEach=function(e,t){for(var r in e){var n=e[r];void 0!==n&&t(n,r)}},exports.recordForEachAsync=Q,exports.recordToArray=function(e){var t=[];for(var r in e){var n=e[r];void 0!==n&&t.push({key:r,value:n})}return t},exports.recordToDualKeyMap=function(e){var t=new _;for(var r in e){var n=e[r];if(void 0!==n)for(var o in n){var a=n[o];void 0!==a&&t.set({first:r,second:o},a)}}return t},exports.recordToMap=function(e){var t=new Map;for(var r in e){var n=e[r];void 0!==n&&t.set(r,n)}return t},exports.right="right",exports.stateMapToJsonString=function(e){return"{ id: "+e.id+", createdBy: "+e.createdBy+" }"},exports.strIndex100Array=F,exports.strIndex10Array=D,exports.strIndex20Array=q,exports.strIndex5Array=B,exports.stringToCompositeKey=function(e){var t=e.split("@");return 2!==t.length?null:{id:t[0],createdBy:t[1]}},exports.webServerRequiresUpdate="webServerRequiresUpdate"; | ||
//# sourceMappingURL=util.cjs.production.min.js.map |
{ | ||
"version": "0.1.0-alpha.1", | ||
"version": "0.1.0-alpha.2", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -16,3 +16,3 @@ export { __, range } from './internal/collection'; | ||
dualKeyToString, | ||
toJsonString as dualKeyMapToJsonString, | ||
toJsonString as dualKeyToJsonString, | ||
groupJoin as groupJoinDualKeyMap, | ||
@@ -63,2 +63,3 @@ groupJoin3 as groupJoin3DualKeyMap, | ||
} from './internal/stateMap'; | ||
export { left, right, both } from './internal/types'; | ||
export { | ||
@@ -65,0 +66,0 @@ chooseDualKeyRecord, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
840411
9107