@egova/flagwind-core
Version:
flagwind core library.
10 lines • 53.8 kB
JavaScript
/*!
* flagwind-core v1.1.3
*
* Authors:
* jason <jasonsoop@gmail.com>
*
* Licensed under the MIT License.
* Copyright (C) 2010-2020 Flagwind Inc. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.flagwind={})}(this,function(exports){"use strict";var __extends=this&&this.__extends||(c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),c,__awaiter=this&&this.__awaiter||function(e,a,s,c){return new(s=s||Promise)(function(n,t){function r(e){try{o(c.next(e))}catch(e){t(e)}}function i(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,i)}o((c=c.apply(e,a||[])).next())})},__generator=this&&this.__generator||function(n,r){var i,o,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},__spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r},flagwind,Z,$,flagwind,xa,ya,za,flagwind,Ga,Ha,flagwind,Na,Pa,Oa,flagwind,Ua,Va,Wa,flagwind,Ab,Cb,Bb,flagwind,$b,_b,flagwind,dc,ec,flagwind,ic,jc,flagwind,tc,uc,flagwind,Kc,Lc,flagwind,Pc,Qc,flagwind,hd,id,flagwind,Gd,Hd,flagwind,Od,Pd,flagwind,Td,Ud,flagwind,Yd,Zd,flagwind,Ie,Je,flagwind,Te,Ue,flagwind,cf,df,flagwind,lf,mf,flagwind,Wf,Xf,flagwind,ag,bg,flagwind,lg,mg,flagwind,Sg,Tg,flagwind,ah,flagwind,fh,gh,flagwind,flagwind,wh,xh,flagwind,Vh,Wh,flagwind,Yh,Zh,$h,flagwind,mi,ni,flagwind,si,ti,flagwind,flagwind,hj,ij,jj,flagwind,kj,lj,flagwind,Cj,Ej,Dj,flagwind,Ij,Jj,flagwind,Oj,Qj,Pj,flagwind,Tj,Vj,Uj,flagwind,Yj,$j,Zj,flagwind,bk,ck,flagwind,nk,ok,flagwind,zk,Ak,flagwind,Hk,flagwind,Nk,Ok,flagwind,Xk,Yk,flagwind,ml,nl,flagwind,yl,zl,flagwind,fm,hm,gm,flagwind,rm,tm,sm,flagwind,Rm,Tm,Sm;function _(){}function Aa(e){e&&(this._applicationId=e)}function Ia(e,t){if(!e)throw new Ga.ArgumentException;this._type=e,this._data=t}function Qa(e,t){var n=Pa.call(this,e)||this;return n.context=t,n}function ab(e){this._source=e||this,this._events=new Ua.Map}function Db(e){var t=Cb.call(this)||this;if(t.OPENING="opening",t.OPENED="opened",t.DEACTIVATING="deactivating",t.DEACTIVATED="deactivated",t.ACTIVATING="activating",t.CLOSING="closing",t.CLOSED="closed",t.TITLE_CHANGED="title_changed",!e)throw new Ab.ArgumentException;return t._status=0,t._title=e.title,t._applicationContext=e,t}function ac(e,t){if(!e||!$b.RegexUtils.uri.test(e))throw new $b.ArgumentException;this._uri=e,this._scheme=RegExp.$1,this._action=RegExp.$2,this._extras=t||new $b.Map}function fc(e,t){if(!e||!t)throw new dc.ArgumentException;this._manager=e,this._scheme=t.scheme,this._action=t.action,this._uri=t.uri,this._extras=t.extras,this._aborted=!1}function kc(){var e=arguments;if(1===e.length){var t=e[0];if(!ic.RegexUtils.uri.test(t))throw new ic.ArgumentException;this._scheme=RegExp.$1,this.actions.add(RegExp.$2)}else{var n=e[0],r=e[1];if(!n||!ic.RegexUtils.scheme.test(n)||!r)throw new ic.ArgumentException;this._scheme=n;for(var i=0,o=r;i<o.length;i++){var a=o[i];this.actions.add(a)}}this._priority=0}function vc(e){this._eventProvider=new tc.EventProvider(this),this._receiverProvider=e||new tc.BroadcastReceiverProvider}function Mc(e,t){this._contract=e,this._receiver=t}function Rc(){this._entries=new Pc.Map}function jd(){this._keys=[],this._values=[]}function Qd(e){if(!e)throw new Od.ArgumentException("items");this._index=0,this._current=void 0,this._items=e}function Vd(e,t){this._key=e,this._value=t}function $d(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._values=[],(e=this._values).push.apply(e,t)}function Ke(e,t){void 0===e&&(e=""),void 0===t&&(t=!0),this.name=Ie.Type.isEmptyString(e)?Ie.StringUtils.trim(Ie.Type.getClassName(this),"Command").toLowerCase():e,this._enabled=t}function Ve(){this._items=new Te.Map}function ef(e,t,n,r,i){if(void 0===i&&(i=null),!n)throw new cf.ArgumentException;this._executor=e,this._expression=t,this._command=n,this._parameter=r,this._extendedProperties=i}function nf(e){this._commands=new lf.CommandCollection,this._parser=e||lf.CommandExpressionParser.instance}function Yf(e,t,n){if(!e||!t)throw new Wf.ArgumentException;this._executor=e,this._expression=t,this._parameter=n}function cg(e,t,n,r){for(var i=[],o=4;o<arguments.length;o++)i[o-4]=arguments[o];if(this._next=null,!t)throw new ag.ArgumentException("name");switch(n=ag.StringUtils.trim(n,"/"," ","\t","\r","\n"),this._anchor=e,this._name=t.trim(),e){case 3:this._path=n?"/"+n+"/":"/";break;case 1:this._path=n?"./"+n+"/":"./";break;case 2:this._path=n?"../"+n+"/":"../";break;default:this._path=n?n+"/":""}this._fullPath=this._path+this._name,this._options=new ag.CommandOptionCollection(r),this._arguments=i||new Array}function ng(){}function Ug(e){var t=this;this._items=new Sg.Map,e&&e.forEach(function(e){t._items.set(e.key,e.value)})}function hh(){}function yh(){}function Xh(){}function _h(){}function oi(){}function ui(e,t,n,r){this._level=e,this._source=t,this._message=n,this._data=r,this._timestamp=new Date}function mj(){}function Fj(){var e=null!==Ej&&Ej.apply(this,arguments)||this;return e._cancel=!1,e}function Kj(){this._providers=new Ij.Map}function Rj(e){return Qj.call(this,e)||this}function Wj(e){return Vj.call(this,e)||this}function _j(e){return $j.call(this,e)||this}function dk(){}function pk(e){if(!e)throw new nk.ArgumentException;this._text=e,this._position=0,this._length=e.length}function Bk(){}function Pk(){this._name=null,this._service=null,this._serviceType=null,this._contractTypes=null,this._serviceBuilder=null;var e=arguments;switch(e.length){case 1:case 2:Nk.Type.isFunction(e[0])?this._serviceType=e[0]:(this._service=e[0],this._serviceType=Nk.Type.getClassType(e[0])),this._contractTypes=e[1]||null;break;case 3:this._name=e[0],Nk.Type.isFunction(e[1])?this._serviceType=e[1]:(this._service=e[1],this._serviceType=Nk.Type.getClassType(e[1])),this._contractTypes=e[2]||null}}function Zk(e,t){e=e||new Xk.ServiceStorage(this),this._storage=e,this._builder=t}function ol(e){void 0===e&&(e=""),this._defaultName=e,this._providers=new ml.Map}function Al(e){if(!e)throw new yl.ArgumentException("provider");this._provider=e}function im(e){var t=hm.call(this,e)||this;return t._entries=new fm.Set,t._namedEntries=new fm.Map,t}function um(e){var t=tm.call(this)||this;return t.STATE_CHANGED="stateChanged",t._name=e,t._disabled=!1,t._canPauseAndContinue=!1,t._state=0,t}function Um(e,t,n,r){var i=Tm.call(this,e)||this;return i.actionName=t,i.state=n,i.error=r,i}Z=flagwind=flagwind||{},Object.defineProperty(_,"eventProvider",{get:function(){return this._eventProvider||(this._eventProvider=new Z.EventProvider(this)),this._eventProvider},enumerable:!0,configurable:!0}),Object.defineProperty(_,"isStarted",{get:function(){return this._isStarted},enumerable:!0,configurable:!0}),Object.defineProperty(_,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),_.start=function(t,e){var n=this;if(!t)throw new Z.ArgumentException("context");if(!this._isStarted){this.dispatchEvent(new Z.ApplicationEventArgs(this.STARTING,t));try{(this._context=t).serviceFactory.default.register("applicationContext",t),this.initializeGlobalModules(t);var r=t.getWorkbench(e);r&&(r.addListener(r.OPENED,function(e){n._isStarted=!0,n.dispatchEvent(new Z.ApplicationEventArgs(n.STARTED,t))}),r.addListener(r.CLOSED,function(e){n.exit()}),r.open(e))}catch(e){throw Z.Logger.error(this,e),e}}},_.exit=function(){var e=this._context;if(e){this._isStarted=!1;var t=new Z.CancelEventArgs(this.EXITING,this);this.dispatchEvent(t),t.cancel||(e.workbench&&e.workbench.close(),this.disposeGlobalModules(e),this._context=null)}},_.addListener=function(e,t,n,r){this.eventProvider.addListener(e,t,n,r)},_.removeListener=function(e,t,n){this.eventProvider.removeListener(e,t,n)},_.dispatchEvent=function(e){this.eventProvider.dispatchEvent(e)},_.initializeGlobalModules=function(n){n.modules.forEach(function(e,t){e&&e.initialize(n)})},_.disposeGlobalModules=function(e){e.modules.forEach(function(e,t){e&&e.dispose()})},_._isStarted=!1,_._context=null,_.STARTING="starting",_.STARTED="started",_.EXITING="exiting",$=_,Z.Application=$,xa=flagwind=flagwind||{},ya="__credential__",Object.defineProperty(Aa.prototype,"applicationId",{get:function(){return this._applicationId},set:function(e){if(!e)throw new xa.ArgumentException("value");if(this._applicationId)throw new xa.InvalidOperationException("The ApplicationId has specified already.");this._applicationId=e.trim()},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"title",{get:function(){return this._title},set:function(e){this._title=e||""},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"serviceFactory",{get:function(){return xa.ServiceProviderFactory.instance},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"modules",{get:function(){return this._modules||(this._modules=new xa.Set),this._modules},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"credential",{get:function(){return this._credential||(this._credential=xa.LocalStorage.get(ya)),this._credential},set:function(e){this._credential=e,xa.LocalStorage.set(ya,e)},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"states",{get:function(){return this._states||(this._states=new xa.Map),this._states},enumerable:!0,configurable:!0}),Object.defineProperty(Aa.prototype,"workbench",{get:function(){return this._workbench},enumerable:!0,configurable:!0}),Aa.prototype.getWorkbench=function(e){return this._workbench||(this._workbench=this.createWorkbench(e)),this._workbench},za=Aa,xa.ApplicationContextBase=za,Ga=flagwind=flagwind||{},Object.defineProperty(Ia.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(Ia.prototype,"source",{get:function(){return this._source},set:function(e){if(!e)throw new Ga.ArgumentException;this._source=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ia.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0}),Ha=Ia,Ga.EventArgs=Ha,Na=flagwind=flagwind||{},Pa=Na.EventArgs,__extends(Qa,Pa),Oa=Qa,Na.ApplicationEventArgs=Oa,Ua=flagwind=flagwind||{},Va=function(e,t,n,r){this.type=e,this.listener=t,this.scope=n,this.once=r},ab.prototype.addListener=function(e,t,n,r){if(void 0===n&&(n=this),void 0===r&&(r=!1),!e||!t)throw new Ua.ArgumentException;var i=this._events.get(e);i||(i=new Array,this._events.set(e,i));for(var o=0,a=i;o<a.length;o++){var s=a[o];if(s.listener===t&&s.scope===n)return}i.push(new Va(e,t,n,r))},ab.prototype.removeListener=function(e,t,n){if(void 0===n&&(n=this),!e||!t)throw new Ua.ArgumentException;var r=this._events.get(e);if(r){for(var i=0,o=r.length;i<o;i++){var a=r[i];if(a.listener===t&&a.scope===n){r.splice(i,1);break}}0===r.length&&this._events.delete(e)}},ab.prototype.hasListener=function(e){var t=this._events.get(e);return!!t&&0<t.length},ab.prototype.dispatchEvent=function(){var e,t=arguments;switch(t.length){case 1:t[0]instanceof Ua.EventArgs?e=t[0]:Ua.Type.isString(t[0])&&(e=new Ua.EventArgs(t[0]));break;case 2:e=new Ua.EventArgs(t[0],t[1])}e.source=this._source;var n=this._events.get(e.type);if(n&&0!==n.length){for(var r=new Array,i=0,o=n;i<o.length;i++)(a=o[i]).listener.call(a.scope,e),a.once&&r.push(a);for(;r.length;){var a=r.pop();this.removeListener(a.type,a.listener,a.scope)}}},Wa=ab,Ua.EventProvider=Wa,Ab=flagwind=flagwind||{},Cb=Ab.EventProvider,__extends(Db,Cb),Object.defineProperty(Db.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0}),Object.defineProperty(Db.prototype,"title",{get:function(){return this._title},set:function(e){this._title!==e&&(this._title=e||"",this.onTitleChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(Db.prototype,"applicationContext",{get:function(){return this._applicationContext},enumerable:!0,configurable:!0}),Db.prototype.open=function(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:if(0!==this._status)return[2];try{this.onOpening()}catch(e){throw this._status=0,e}e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.onOpen(n)];case 2:return e.sent(),[3,4];case 3:throw t=e.sent(),1===this._status&&(this._status=0),t;case 4:return 1===this._status&&this.onOpened(),[2]}})})},Db.prototype.close=function(){return __awaiter(this,void 0,void 0,function(){var t,n,r;return __generator(this,function(e){switch(e.label){case 0:if(6===(t=this._status)||0===t)return[2,!1];if(1===t)throw new Ab.InvalidOperationException;n=new Ab.CancelEventArgs(this.CLOSING);try{this.onClosing(n)}catch(e){throw this._status=t,e}if(!0===n.cancel)return this._status=t,[2,!1];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.onClose()];case 2:return e.sent(),[3,4];case 3:throw r=e.sent(),6===this._status&&(this._status=t),r;case 4:return 0!==this._status&&this.onClosed(),[2,!0]}})})},Db.prototype.deactivate=function(){var t=this._status;if(2===t){try{this.onDeactivateing()}catch(e){throw this._status=t,e}try{this.onDeactivate()}catch(e){throw 3===this._status&&(this._status=t),e}4!==this._status&&this.onDeactivated()}},Db.prototype.activate=function(){var t=this._status;if(4===t){try{this.onActivating()}catch(e){throw this._status=t,e}try{this.onActivate()}catch(e){throw 5===this._status&&(this._status=t),e}5===this._status&&this.onActivated()}},Db.prototype.onOpening=function(){this._status=1,this.dispatchEvent(this.OPENING)},Db.prototype.onOpen=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2]})})},Db.prototype.onOpened=function(){this._status=2,this.dispatchEvent(this.OPENED)},Db.prototype.onClosing=function(e){this._status=6,this.dispatchEvent(e)},Db.prototype.onClose=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2]})})},Db.prototype.onClosed=function(){this._status=0,this.dispatchEvent(this.CLOSED)},Db.prototype.onDeactivateing=function(){this._status=3,this.dispatchEvent(this.DEACTIVATING)},Db.prototype.onDeactivate=function(){},Db.prototype.onDeactivated=function(){this._status=4,this.dispatchEvent(this.DEACTIVATED)},Db.prototype.onActivating=function(){this._status=5,this.dispatchEvent(this.ACTIVATING)},Db.prototype.onActivate=function(){},Db.prototype.onActivated=function(){this._status=2},Db.prototype.onTitleChanged=function(){this.dispatchEvent(this.TITLE_CHANGED)},Bb=Db,Ab.WorkbenchBase=Bb,$b=flagwind=flagwind||{},Object.defineProperty(ac.prototype,"scheme",{get:function(){return this._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(ac.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0}),Object.defineProperty(ac.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(ac.prototype,"extras",{get:function(){return this._extras},enumerable:!0,configurable:!0}),_b=ac,$b.Broadcast=_b,dc=flagwind=flagwind||{},Object.defineProperty(fc.prototype,"manager",{get:function(){return this._manager},enumerable:!0,configurable:!0}),Object.defineProperty(fc.prototype,"scheme",{get:function(){return this._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(fc.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0}),Object.defineProperty(fc.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(fc.prototype,"extras",{get:function(){return this._extras},enumerable:!0,configurable:!0}),Object.defineProperty(fc.prototype,"aborted",{get:function(){return this._aborted},enumerable:!0,configurable:!0}),fc.prototype.abort=function(){this._aborted=!0},ec=fc,dc.BroadcastContext=ec,ic=flagwind=flagwind||{},Object.defineProperty(kc.prototype,"scheme",{get:function(){return this._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(kc.prototype,"priority",{get:function(){return this._priority},set:function(e){this._priority=e},enumerable:!0,configurable:!0}),Object.defineProperty(kc.prototype,"actions",{get:function(){return this._actions||(this._actions=new ic.Set),this._actions},enumerable:!0,configurable:!0}),jc=kc,ic.BroadcastContract=jc,tc=flagwind=flagwind||{},Object.defineProperty(vc.prototype,"eventProvider",{get:function(){return this._eventProvider},enumerable:!0,configurable:!0}),Object.defineProperty(vc.prototype,"receiverProvider",{get:function(){return this._receiverProvider},enumerable:!0,configurable:!0}),Object.defineProperty(vc,"instance",{get:function(){return this._instance||(this._instance=new vc),this._instance},enumerable:!0,configurable:!0}),vc.prototype.hasReceiver=function(e){return this.receiverProvider.has(e)},vc.prototype.register=function(e,t){this.eventProvider.hasListener(e.scheme)||this.eventProvider.addListener(e.scheme,this.onReceive,this),this.receiverProvider.register(e,t)},vc.prototype.unregister=function(e){this.receiverProvider.unregister(e)},vc.prototype.send=function(e){if(!e)throw new tc.ArgumentException;this.eventProvider.dispatchEvent(e.scheme,e)},vc.prototype.onReceive=function(e){for(var t=e.data,n=this.receiverProvider.resolve(t).getEnumerator(),r=this.createBroadcastContext(t);n.next();){var i=n.current;try{if(r.aborted)return;i.receive(r)}catch(e){tc.Logger.error(this,e)}}},vc.prototype.createBroadcastContext=function(e){return new tc.BroadcastContext(this,e)},uc=vc,tc.BroadcastManager=uc,Kc=flagwind=flagwind||{},Object.defineProperty(Mc.prototype,"priority",{get:function(){return this._contract.priority},enumerable:!0,configurable:!0}),Object.defineProperty(Mc.prototype,"contract",{get:function(){return this._contract},enumerable:!0,configurable:!0}),Object.defineProperty(Mc.prototype,"receiver",{get:function(){return this._receiver},enumerable:!0,configurable:!0}),Lc=Mc,Kc.BroadcastReceiverEntry=Lc,Pc=flagwind=flagwind||{},Rc.prototype.has=function(e){return this._entries.has(e)},Rc.prototype.register=function(r,i){var o=this;if(!r||!i)throw new Pc.ArgumentException;r.actions.forEach(function(e){var t=r.scheme.concat(e),n=o._entries.get(t);n||(n=new Pc.Set,o._entries.set(t,n)),n.add(new Pc.BroadcastReceiverEntry(r,i))})},Rc.prototype.unregister=function(n){var r=this;if(!n)throw new Pc.ArgumentException;n.actions.forEach(function(e){var t=n.scheme.concat(e);r._entries.has(t)&&r._entries.delete(t)})},Rc.prototype.resolve=function(e){if(this._entries.has(e.uri)){var t=this._entries.get(e.uri),n=new Pc.Set;return t.sort(function(e,t){return t.priority-e.priority}),t.forEach(function(e){return n.add(e.receiver)}),n}return new Pc.Set},Rc.prototype.clear=function(){this._entries.clear()},Qc=Rc,Pc.BroadcastReceiverProvider=Qc,hd=flagwind=flagwind||{},Object.defineProperty(jd.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),jd.prototype.set=function(e,t){var n=this._keys,r=n.indexOf(e);return-1===r&&(n[r=n.length]=e),this._values[r]=t,this},jd.prototype.get=function(e){var t=this._keys.indexOf(e);return-1!==t?this._values[t]:void 0},jd.prototype.has=function(e){return-1!==this._keys.indexOf(e)},jd.prototype.delete=function(e){var t=this._keys.indexOf(e);return-1!==t&&(this._keys.splice(t,1),this._values.splice(t,1),!0)},jd.prototype.clear=function(){this._keys.length=0,this._values.length=0},jd.prototype.getEnumerator=function(){var e=this.entries();return new hd.Enumerator(e)},jd.prototype.forEach=function(e,t){for(var n=this._keys,r=this._values,i=0,o=n.length;i<o;i++)e.call(t,new hd.KeyValuePair(n[i],r[i]),this)},jd.prototype.keys=function(){return this._keys.concat()},jd.prototype.values=function(){return this._values.concat()},jd.prototype.entries=function(){var n=new Array;return this.forEach(function(e,t){n.push(new hd.KeyValuePair(e.key,e.value))}),n},jd.prototype.toString=function(){var n=Object.create(null);return this.forEach(function(e,t){n[e.key]=e.value}),JSON.stringify(n)},id=jd,hd.Map=id,Gd=flagwind=flagwind||{},Hd=new Gd.Map,Gd.receivable=function(r,i){if(!r)throw new Gd.InvalidOperationException("The broadcast uri is empty.");return function(e){var t=Hd.get(e),n=new Gd.BroadcastContract(r);i&&(n.priority=i),t||(t=Gd.Activator.createInstance(e),Hd.set(e,t)),Gd.BroadcastManager.instance.register(n,t)}},Od=flagwind=flagwind||{},Object.defineProperty(Qd.prototype,"current",{get:function(){return this._current},enumerable:!0,configurable:!0}),Qd.prototype.next=function(){var e=this._items;return this._index<e.length&&(this._current=e[this._index++],!0)},Pd=Qd,Od.Enumerator=Pd,Td=flagwind=flagwind||{},Object.defineProperty(Vd.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Vd.prototype.toString=function(){return"["+(this._key||"")+", "+(this._value||"")+"]"},Ud=Vd,Td.KeyValuePair=Ud,Yd=flagwind=flagwind||{},Object.defineProperty($d.prototype,"size",{get:function(){return this._values.length},enumerable:!0,configurable:!0}),$d.prototype.add=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var i=r[n];this.has(i)||this._values.push(i)}return this},$d.prototype.get=function(e){return this._values[e]},$d.prototype.set=function(e,t){var n=this._values;0<=e&&e<n.length&&(this.has(t)||(n[e]=t))},$d.prototype.delete=function(e){var t=this._values,n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},$d.prototype.deleteAt=function(e){var t=this._values;0<=e&&e<t.length&&t.splice(e,1)},$d.prototype.clear=function(){this._values.length=0},$d.prototype.indexOf=function(e,t){return this._values.indexOf(e,t)},$d.prototype.has=function(e){return-1!==this._values.indexOf(e)},$d.prototype.getEnumerator=function(){return new Yd.Enumerator(this._values)},$d.prototype.forEach=function(){for(var e=this._values,t=arguments[0],n=arguments[1],r=2===t.length,i=0,o=e.length;i<o;i++)r?t.call(n,e[i],this):t.call(n,e[i],i,this)},$d.prototype.find=function(e,t){for(var n=this._values,r=0,i=n.length;r<i;r++)if(e.call(t,n[r],r,this))return n[r]},$d.prototype.sort=function(e){var t=this._values;this._values=t.sort(e)},$d.prototype.union=function(e){var t=e.values();return 0<t.length&&this.add.apply(this,t),this},$d.prototype.values=function(){return this._values.concat()},$d.prototype.toString=function(){return Array.prototype.toString.call(this._values)},Zd=$d,Yd.Set=Zd,Ie=flagwind=flagwind||{},Object.defineProperty(Ke.prototype,"name",{get:function(){return this._name},set:function(e){if(!e)throw new Ie.ArgumentException;if(-1!==e.indexOf(".")||-1!==e.indexOf("/"))throw new Ie.ArgumentException;this._name=e.trim()},enumerable:!0,configurable:!0}),Object.defineProperty(Ke.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Ke.prototype.canExecute=function(e){return this.enabled},Ke.prototype.execute=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.canExecute(t)?[4,this.onExecute(t)]:[2,null];case 1:return[2,e.sent()]}})})},Je=Ke,Ie.CommandBase=Je,Te=flagwind=flagwind||{},Object.defineProperty(Ve.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),Ve.prototype.add=function(e,t){if(this._items.has(e))throw new Te.ArgumentException("The command path '"+e+"' is existed.");this._items.set(e,t)},Ve.prototype.remove=function(e){return this._items.delete(e)},Ve.prototype.find=function(e){return this._items.get(e)||null},Ve.prototype.contains=function(e){return this._items.has(e)},Ve.prototype.getEnumerator=function(){return this._items.getEnumerator()},Ve.prototype.forEach=function(e,t){this._items.forEach(e,t)},Ue=Ve,Te.CommandCollection=Ue,cf=flagwind=flagwind||{},Object.defineProperty(ef.prototype,"executor",{get:function(){return this._executor},enumerable:!0,configurable:!0}),Object.defineProperty(ef.prototype,"expression",{get:function(){return this._expression},enumerable:!0,configurable:!0}),Object.defineProperty(ef.prototype,"command",{get:function(){return this._command},enumerable:!0,configurable:!0}),Object.defineProperty(ef.prototype,"parameter",{get:function(){return this._parameter},enumerable:!0,configurable:!0}),Object.defineProperty(ef.prototype,"hasExtendedProperties",{get:function(){return this._extendedProperties&&0<this._extendedProperties.size},enumerable:!0,configurable:!0}),Object.defineProperty(ef.prototype,"extendedProperties",{get:function(){return this._extendedProperties||(this._extendedProperties=new cf.Map),this._extendedProperties},enumerable:!0,configurable:!0}),df=ef,cf.CommandContext=df,lf=flagwind=flagwind||{},Object.defineProperty(nf,"default",{get:function(){return this._default||(this._default=new nf),this._default},set:function(e){if(!e)throw new lf.ArgumentException("value");this._default=e},enumerable:!0,configurable:!0}),nf.prototype.register=function(e,t){this._commands.add(e,t)},nf.prototype.remove=function(e){return this._commands.remove(e)},nf.prototype.find=function(e){return this._commands.find(e)},nf.prototype.execute=function(n,r){return void 0===r&&(r=null),__awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){if(!n)throw new lf.ArgumentException;t=null;try{if(!(t=this.createExecutorContext(n,r)))throw new lf.InvalidOperationException("Create executor context failed.")}catch(e){return lf.Logger.error(this,e),[2,null]}return[2,this.onExecute(t)]})})},nf.prototype.onExecute=function(c){return __awaiter(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return __generator(this,function(e){switch(e.label){case 0:for(t=new Array,n=c.expression;null!==n;){if(!(r=this.find(n.fullPath)))throw new lf.InvalidOperationException("The command path '"+n.fullPath+"' can not found.");t.push([n,r]),n=n.next}if(i=c.parameter,t.length<1)return[2,null];o=0,a=t.length,e.label=1;case 1:return o<a?(s=t[0],[4,this.executeCommand(c,s[0],s[1],i)]):[3,4];case 2:i=e.sent(),e.label=3;case 3:return o++,[3,1];case 4:return[2,i]}})})},nf.prototype.executeCommand=function(t,n,r,i){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:if(!t||!n)throw new lf.ArgumentException;return r?[4,r.execute(this.createCommandContext(n,r,i))]:[2,null];case 1:return[2,e.sent()]}})})},nf.prototype.createExecutorContext=function(e,t){var n=this.onParse(e);if(!n)throw new lf.InvalidOperationException("Invalid command expression text: "+e+".");return new lf.CommandExecutorContext(this,n,t)},nf.prototype.createCommandContext=function(e,t,n){return new lf.CommandContext(this,e,t,n)},nf.prototype.onParse=function(e){return this._parser.parse(e)},mf=nf,lf.CommandExecutor=mf,Wf=flagwind=flagwind||{},Object.defineProperty(Yf.prototype,"executor",{get:function(){return this._executor},enumerable:!0,configurable:!0}),Object.defineProperty(Yf.prototype,"expression",{get:function(){return this._expression},enumerable:!0,configurable:!0}),Object.defineProperty(Yf.prototype,"parameter",{get:function(){return this._parameter},enumerable:!0,configurable:!0}),Xf=Yf,Wf.CommandExecutorContext=Xf,ag=flagwind=flagwind||{},Object.defineProperty(cg.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"path",{get:function(){return this._path},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"fullPath",{get:function(){return this._fullPath},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"anchor",{get:function(){return this._anchor},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"arguments",{get:function(){return this._arguments},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"next",{get:function(){return this._next},set:function(e){this._next=e},enumerable:!0,configurable:!0}),cg.parse=function(e){return ag.CommandExpressionParser.instance.parse(e)},bg=cg,ag.CommandExpression=bg,lg=flagwind=flagwind||{},ng.prototype.parse=function(e){if(!e)return null;for(var t=null,n=null,r=new lg.StringReader(e);0<r.peek();)if(n=this.onParse(r),null===t)t=n;else{for(var i=t;null!==i.next;)i=i.next;i.next=n}return r.dispose(),t},ng.prototype.onParse=function(e){var t,n,r,i,o,a=new lg.Set,s=new lg.Map;for(n=(t=ng.parsePath(e))[0],r=t[1],i=t[2];null!==(o=ng.parsePair(e));)o.key?s.set(o.key,o.value):a.add(o.value);return new(lg.CommandExpression.bind.apply(lg.CommandExpression,__spreadArrays([void 0,n,r,i,s],a.values())))},ng.parsePath=function(e){for(var t=0,n=new lg.Set,r=0,i=0,o="",a="";0<(r=e.read());){var s=String.fromCharCode(r);if("."===s&&4===t&&(s="/"),"."===s)switch(t){case 0:i=t=1;break;case 1:i=t=2;break;default:throw new lg.InvalidOperationException("Invalid anchor of command path.")}else if("/"===s){if(3===t)throw new lg.InvalidOperationException("Duplicate '/' slash characters.");0===t?i=3:4===t&&(n.add(o),o=""),t=3}else{if(!lg.CharUtils.isLetterOrDigit(s)&&"_"!==s){if(lg.CharUtils.isWhiteSpace(s)){if(0===t)continue;break}throw new lg.InvalidOperationException("Contains '"+s+"' illegal character(s) in the command path.")}if(1===t||2===t)throw new lg.InvalidOperationException("Missing '/' slash character between dot and letter or digit.");o+=s,t=4}}if(3===t&&(n&&0<n.size||3!==i))throw new lg.InvalidOperationException("The command path can not at the end of '/' character.");if(n&&0<n.size)a=n.values().join(".");else if(!o){switch(i){case 3:o="/";break;case 1:o=".";break;case 2:o=".."}i=0}return[i,o,a]},ng.parsePair=function(e){for(var t,n="\0",r=!1,i="",o="",a=0;0<(t=e.read());){var s=String.fromCharCode(t);if("-"===s||"/"===s){if(1===a)throw new lg.InvalidOperationException("Duplicate '"+s+"' option indicator of command expression.");if(0===a&&"\0"===n){a=1;continue}}else if(":"===s||"="===s){if(i&&3===a&&"\0"===n&&!r){a=2;continue}}else if("|"===s){if("\0"===n)return i||o?new lg.KeyValuePair(i,o):null}else if(lg.CharUtils.isWhiteSpace(s)){if(1===a)throw new lg.InvalidOperationException("A white-space character at the back of the option indicator.");if(0===a)continue;if("\0"===n)return new lg.KeyValuePair(i,o)}else if(this.isQuote(s)&&!r){if("\0"!==n){n="\0";continue}if(3!==a){n=s;continue}}if(!(r="\\"===s&&!r)){switch(a){case 1:i+=s;break;case 0:case 2:o+=s;break;default:o?o+=s:i+=s}a=3}}return i||o?new lg.KeyValuePair(i,o):null},ng.isQuote=function(e){return'"'===e||"'"===e},ng.instance=new ng,mg=ng,lg.CommandExpressionParser=mg,Sg=flagwind=flagwind||{},Object.defineProperty(Ug.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"keys",{get:function(){return this._items.keys()},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"values",{get:function(){return this._items.values()},enumerable:!0,configurable:!0}),Ug.prototype.get=function(e){return this._items.get(e)},Ug.prototype.has=function(e){return this._items.has(e)},Ug.prototype.getEnumerator=function(){return this._items.getEnumerator()},Ug.prototype.forEach=function(e,t){this._items.forEach(e,t)},Tg=Ug,Sg.CommandOptionCollection=Tg,ah=flagwind=flagwind||{},ah.command=function(n){if(!n)throw new ah.InvalidOperationException("The command path is empty.");return function(e){if(!ah.Type.isAssignableFrom(ah.CommandBase,e))throw new ah.InvalidOperationException("The class '"+ah.Type.getQualifiedClassName(e)+"' is not a command type.");var t=ah.Activator.createInstance(e);ah.CommandExecutor.default.register(n,t)}},fh=flagwind=flagwind||{},hh.isChar=function(e){return fh.Type.isString(e)&&1===e.length},hh.isLatin=function(e){return e.charCodeAt(0)<=255},hh.isAscii=function(e){return e.charCodeAt(0)<=127},hh.isLetterOrDigit=function(e){return!!this.isChar(e)&&/^[0-9a-zA-Z]*$/g.test(e)},hh.isWhiteSpace=function(e){if(!this.isChar(e))return!1;var t=e.charCodeAt(0);return 32===t||9<=t&&t<=13||160===t||133===t},gh=hh,fh.CharUtils=gh,(flagwind||(flagwind={})).EnumEntry=function(e,t,n,r){this.name=e,this.value=t,this.alias=n||"",this.description=r||""},wh=flagwind=flagwind||{},yh.getEntry=function(t,e){if(!e)throw new wh.ArgumentException;var n=this.getEntries(e).filter(function(e){return e.value===t});return 1===n.length?n[0]:null},yh.getEntries=function(e){if(!e)throw new wh.ArgumentException;if(this._entryCache.has(e))return this._entryCache.get(e);for(var t=wh.Type.getMetadata(e)||{},n=new Array,r=0,i=this.getFields(e);r<i.length;r++){var o=i[r],a=o[0],s=o[1],c=t[a],u=c?c.alias:"",f=c?c.description:"";n.push(new wh.EnumEntry(a,s,u,f))}return 0<n.length&&this._entryCache.set(e,n),n},yh.getFields=function(t){if(!t)throw new wh.ArgumentException;return Object.keys(t).map(function(e){return[e,t[e]]}).filter(function(e){e[0];var t=e[1];return wh.Type.isNumber(t)})},yh._entryCache=new wh.Map,xh=yh,wh.EnumUtils=xh,Vh=flagwind=flagwind||{},Xh.uri=/^([a-zA-Z0-9\.]+:\/\/)(.+)$/,Xh.scheme=/^([a-zA-Z0-9\.]+:\/\/)$/,Wh=Xh,Vh.RegexUtils=Wh,Yh=flagwind=flagwind||{},Zh=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_h.trim=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,i=t;r<i.length;r++){var o=i[r];e=e.replace(new RegExp("^"+o+"+|"+o+"+$","g"),"")}return e.trim()},_h.isMobile=function(e){return/^1[34578]\d{9}$/.test(e)},_h.isPassword=function(e){return 6<=e.length&&e.length<=16},_h.generateRandom=function(e){for(var t="",n=0;n<e;n++){var r=Math.ceil(35*Math.random());t+=Zh[r]}return t},$h=_h,Yh.StringUtils=$h,mi=flagwind=flagwind||{},oi.prototype.handle=function(e){var t,n=mi.EnumUtils.getEntry(e.level,mi.LogLevel);switch(e.level){case mi.LogLevel.debug:t=console.log;break;case mi.LogLevel.warn:t=console.warn;break;case mi.LogLevel.error:t=console.error}t("[--------["+n.alias+"] "+e.timestamp.toLocaleString()+"--------"),t(e.message),e.data&&t(e.data),t(e.source),t("----------------------------------------------]")},ni=oi,mi.ConsoleLogHandler=ni,si=flagwind=flagwind||{},Object.defineProperty(ui.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0}),Object.defineProperty(ui.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),Object.defineProperty(ui.prototype,"message",{get:function(){return this._message},enumerable:!0,configurable:!0}),Object.defineProperty(ui.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(ui.prototype,"timestamp",{get:function(){return this._timestamp},enumerable:!0,configurable:!0}),ti=ui,si.LogEntry=ti,function(flagwind){var Type=function(){function Type(){}return Type.isArray=function(e){return"array"===this.getTypeString(e)},Type.isObject=function(e){return"object"===this.getTypeString(e)},Type.isString=function(e){return"string"==typeof e},Type.isDate=function(e){return"date"===this.getTypeString(e)},Type.isRegExp=function(e){return"regexp"===this.getTypeString(e)},Type.isFunction=function(e){return"function"==typeof e},Type.isBoolean=function(e){return"boolean"==typeof e},Type.isNumber=function(e){return"number"==typeof e},Type.isNull=function(e){return null===e},Type.isUndefined=function(e){return void 0===e},Type.isEmptyObject=function(e){return Type.isNull(e)||Type.isUndefined(e)},Type.isEmptyString=function(e){return Type.isEmptyObject(e)||""===e.trim()},Type.setMetadata=function(e,t){if(!e||!t)throw new Error;this._metadatas.set(e,t)},Type.getMetadata=function(e){return this._metadatas.get(e)||null},Type.getClassType=function(value){if(Type.isNull(value))return null;if(!Type.isUndefined(value)){if(Type.isBoolean(value))return Boolean;if(Type.isNumber(value))return Number;if(!Type.isString(value)){var prototype=value.prototype?value.prototype:Object.getPrototypeOf(value);return prototype.constructor}try{var ctor=eval(value);return Type.isFunction(ctor)?ctor:String}catch(e){return String}}},Type.getClassName=function(e){var t=this.getQualifiedClassName(e).split(".");return t[t.length-1]},Type.getQualifiedClassName=function(e){var t=typeof e;if(!e||"object"!=t&&!e.prototype)return t;var n=e.prototype?e.prototype:Object.getPrototypeOf(e);if(n.hasOwnProperty("__class__"))return n.__class__;var r=n.constructor.toString().trim(),i=r.indexOf("("),o=r.substring(9,i);return Object.defineProperty(n,"__class__",{value:o,enumerable:!1,writable:!0}),o},Type.getSuperclassName=function(e){var t=this.getQualifiedSuperclassName(e).split(".");return t[t.length-1]},Type.getQualifiedSuperclassName=function(e){if(!e||"object"!=typeof e&&!e.prototype)return null;var t=e.prototype?e.prototype:Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);if(!n)return null;var r=this.getQualifiedClassName(n.constructor);return r||null},Type.isAssignableFrom=function(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e===Object||"Object"===e)return!0;var n=t.prototype;if(n.hasOwnProperty("__types__")){var r=Type.isString(e)?e:Type.getQualifiedClassName(e);return-1!==n.__types__.indexOf(r)}var i=Object.getPrototypeOf(n).constructor;if(i===Object)return!1;if(Type.isString(e)){if(Type.getQualifiedClassName(i)===e)return!0}else if(i===e)return!0;return Type.isAssignableFrom(e,i)},Type.getTypeString=function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()},Type._metadatas=new flagwind.Map,Type}();flagwind.Type=Type}(flagwind=flagwind||{}),hj=flagwind=flagwind||{},(jj=ij=hj.LogLevel||(hj.LogLevel={}))[jj.debug=1]="debug",jj[jj.warn=2]="warn",jj[jj.error=3]="error",hj.Type.setMetadata(ij,{debug:{alias:"DEBUG",description:"\u8c03\u8bd5"},warn:{alias:"WARN",description:"\u8b66\u544a"},error:{alias:"ERROR",description:"\u9519\u8bef"}}),kj=flagwind=flagwind||{},Object.defineProperty(mj,"handlers",{get:function(){return this._handlers},enumerable:!0,configurable:!0}),mj.debug=function(e,t,n){this.write(kj.LogLevel.debug,e,t,n)},mj.warn=function(e,t,n){this.write(kj.LogLevel.warn,e,t,n)},mj.error=function(e,t,n){this.write(kj.LogLevel.error,e,t,n)},mj.write=function(e,t,n,r){var i=new kj.LogEntry(e,t,n,r);this._handlers.forEach(function(e){e.handle(i)})},mj._handlers=new kj.Set,lj=mj,kj.Logger=lj,Cj=flagwind=flagwind||{},Ej=Cj.EventArgs,__extends(Fj,Ej),Object.defineProperty(Fj.prototype,"cancel",{get:function(){return this._cancel},set:function(e){this._cancel=e},enumerable:!0,configurable:!0}),Dj=Fj,Cj.CancelEventArgs=Dj,Ij=flagwind=flagwind||{},Object.defineProperty(Kj.prototype,"providers",{get:function(){return this._providers},enumerable:!0,configurable:!0}),Object.defineProperty(Kj,"instance",{get:function(){return this._instance||(this._instance=new Kj),this._instance},enumerable:!0,configurable:!0}),Kj.prototype.getProvider=function(e){if(!e)throw new Ij.ArgumentException;var t=this._providers.get(e);return t||(t=this.createProvider(e),this._providers.set(e,t)),t},Kj.prototype.createProvider=function(e){return new Ij.EventProvider(e)},Jj=Kj,Ij.EventProviderFactory=Jj,Oj=flagwind=flagwind||{},Qj=Error,__extends(Rj,Qj),Pj=Rj,Oj.Exception=Pj,Tj=flagwind=flagwind||{},Vj=Tj.Exception,__extends(Wj,Vj),Uj=Wj,Tj.ArgumentException=Uj,Yj=flagwind=flagwind||{},$j=Yj.Exception,__extends(_j,$j),Zj=_j,Yj.InvalidOperationException=Zj,bk=flagwind=flagwind||{},Object.defineProperty(dk,"proxy",{get:function(){return!this._proxy&&window&&window.localStorage?window.localStorage:this._proxy},set:function(e){this._proxy=e},enumerable:!0,configurable:!0}),Object.defineProperty(dk,"size",{get:function(){return this.proxy.length},enumerable:!0,configurable:!0}),dk.set=function(e,t){if(!e)throw new bk.ArgumentException;var n=this.serialize(t);this.proxy.setItem(e,n)},dk.get=function(e){return this.deserialize(this.proxy.getItem(e))},dk.remove=function(e){if(!e)throw new bk.ArgumentException(e);this.proxy.removeItem(e)},dk.clear=function(){this.proxy.clear()},dk.serialize=function(e){return bk.Type.isUndefined(e)||bk.Type.isFunction(e)?e+"":JSON.stringify(e)},dk.deserialize=function(t){try{return JSON.parse(t)}catch(e){return t||void 0}},ck=dk,bk.LocalStorage=ck,nk=flagwind=flagwind||{},pk.prototype.peek=function(){return this._position===this._length?-1:this._text.charCodeAt(this._position)},pk.prototype.read=function(){if(this._position===this._length)return-1;var e=this._position;return this._position++,this._text.charCodeAt(e)},pk.prototype.readToEnd=function(){var e=0!==this._position?this._text.substring(this._position,this._length):this._text;return this._position=this._length,e},pk.prototype.readLine=function(){var e,t=this._text;for(e=this._position;e<this._length;++e){var n=t.charCodeAt(e);switch(String.fromCharCode(n)){case"\r":case"\n":var r=t.substring(this._position,e);return this._position=e+1,13===n&&this._position<this._length&&10===t.charCodeAt(this._position)&&this._position++,r;default:continue}}if(e<=this._position)return null;var i=t.substring(this._position,e);return this._position=e,i},pk.prototype.dispose=function(){this._text=null,this._position=0,this._length=0},ok=pk,nk.StringReader=ok,zk=flagwind=flagwind||{},Bk.createInstance=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,i=this._types;if(zk.Type.isString(e))if(e=e,i.has(e))r=i.get(e);else{if((r=zk.Type.getClassType(e))===String)throw new TypeError("Can not found the type '"+e+"'.");i.set(e,r)}else zk.Type.isFunction(e)&&(r=e);return new(r.bind.apply(r,__spreadArrays([void 0],t)))},Bk._types=new zk.Map,Ak=Bk,zk.Activator=Ak,Hk=flagwind=flagwind||{},Hk.injectable=function(n){return function(e){var t=Hk.ServiceProviderFactory.instance;(n?t.getProvider(n):t.default).register(e)}},Nk=flagwind=flagwind||{},Object.defineProperty(Pk.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"serviceType",{get:function(){if(!this._serviceType){var e=this._service;e&&(this._serviceType=Nk.Type.getClassType(e))}return this._serviceType},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"service",{get:function(){return this._service||(this._service=this.createService()),this._service},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"hasService",{get:function(){return!!this._service},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"hasContracts",{get:function(){return this._contractTypes&&0<this._contractTypes.length},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"contractTypes",{get:function(){return this._contractTypes},enumerable:!0,configurable:!0}),Object.defineProperty(Pk.prototype,"serviceBuilder",{get:function(){return this._serviceBuilder},set:function(e){this._serviceBuilder=e},enumerable:!0,configurable:!0}),Pk.prototype.toString=function(){var e=Nk.Type.getQualifiedClassName(this.serviceType);return Nk.Type.isEmptyString(this.name)?e:this.name+" ("+e+")"},Pk.prototype.createService=function(){var e=this._serviceBuilder;if(e){var t=e.build(this);return t&&(this._serviceType=Nk.Type.getClassType(t)),t}var n=this._serviceType;return n?Nk.Activator.createInstance(n):null},Ok=Pk,Nk.ServiceEntry=Ok,Xk=flagwind=flagwind||{},Object.defineProperty(Zk.prototype,"storage",{get:function(){return this._storage},enumerable:!0,configurable:!0}),Object.defineProperty(Zk.prototype,"builder",{get:function(){return this._builder},enumerable:!0,configurable:!0}),Zk.prototype.register=function(){var e,t=arguments;switch(t.length){case 1:case 2:e=Xk.Type.isString(t[0])?new Xk.ServiceEntry(t[0],t[1],null):new Xk.ServiceEntry(t[0],t[1]);break;case 3:e=new Xk.ServiceEntry(t[0],t[1],t[2])}if(!e)throw new Xk.ArgumentException("Can not register service, please check the arguments.");this._storage.add(e)},Zk.prototype.unregister=function(e){this._storage.remove(e)},Zk.prototype.resolve=function(){var e=this._storage.get(arguments[0]);return Xk.Type.isEmptyObject(e)?null:this.getService(e)},Zk.prototype.resolveAll=function(e){var t=this,n=new Xk.Set;return this._storage.getAll(e).forEach(function(e){n.add(t.getService(e))}),n},Zk.prototype.getService=function(e){if(!e)return null;var t=e.service;if(Xk.Type.isEmptyObject(t)){var n=this._builder;n&&(t=n.build(e))}return t||Xk.Activator.createInstance(e.serviceType)},Yk=Zk,Xk.ServiceProvider=Yk,ml=flagwind=flagwind||{},Object.defineProperty(ol,"instance",{get:function(){return this._instance||(this._instance=new ol),this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(ol.prototype,"default",{get:function(){var e=this.getProvider(this._defaultName);return e||(e=new ml.ServiceProvider,this.register(this._defaultName,e)),e},set:function(e){if(!e)throw new ml.ArgumentException;this.register(this._defaultName,e)},enumerable:!0,configurable:!0}),ol.prototype.register=function(e,t){if(ml.Type.isEmptyObject(e))throw new ml.ArgumentException("name");this._providers.set(e.trim(),t)},ol.prototype.unregister=function(e){if(ml.Type.isEmptyObject(e))throw new ml.ArgumentException;this._providers.delete(e.trim())},ol.prototype.getProvider=function(e){if(ml.Type.isEmptyObject(e))throw new ml.ArgumentException("name");return e=e.trim(),this._providers.has(e)?this._providers.get(e):null},ol.prototype.getEnumerator=function(){return this._providers.getEnumerator()},ol.prototype.forEach=function(e,t){this._providers.forEach(e,t)},nl=ol,ml.ServiceProviderFactory=nl,yl=flagwind=flagwind||{},Object.defineProperty(Al.prototype,"provider",{get:function(){return this._provider},enumerable:!0,configurable:!0}),Al.prototype.add=function(){var e,t=arguments;switch(t.length){case 1:e=t[0]instanceof yl.ServiceEntry?t[0]:new yl.ServiceEntry(t[0],null);break;case 2:e=yl.Type.isString(t[0])?new yl.ServiceEntry(t[0],t[1],null):new yl.ServiceEntry(t[0],t[1]);break;case 3:e=new yl.ServiceEntry(t[0],t[1],t[2])}if(!e)throw new yl.ArgumentException("Can not add service, please check the arguments.");return this.insert(e),e},Al.prototype.get=function(){var e=arguments,t=null;if(yl.Type.isString(e[0])){t=this.findByName(e[0],new yl.Set(this));var n=yl.ServiceProviderFactory.instance.default;!t&&n&&n.storage!==this&&(t=this.findByName(e[0],new yl.Set(n.storage))),t=t||this.findByType(e[0],!1)}else t=this.findByType(e[0],!1);return t},Al.prototype.getAll=function(e){return this.findByType(e,!0)},Al.prototype.findByName=function(e,t){if(!e||!t)return null;for(var n=0;n<t.size;n++)for(var r=t.get(n).getEnumerator();r.next();){var i=r.current;if(i){if(i.name===e)return i;if(i.serviceType&&yl.Type.isAssignableFrom(yl.ServiceProvider,i.serviceType)){var o=i.service;o&&!t.has(o.storage)&&t.add(o.storage)}}}return null},Al.prototype.findByType=function(e,t){var n=this.searchService(e,t,new yl.Set(this)),r=!yl.Type.isEmptyObject(n);r&&n instanceof yl.Set&&0===n.size&&(r=!1);var i=yl.ServiceProviderFactory.instance.default;return!r&&i&&i.storage!==this&&(n=this.searchService(e,t,new yl.Set(i.storage))),n},Al.prototype.searchService=function(e,t,n){if(!e||!n)return null;for(var r=new yl.Set,i=new yl.Set,o=0;o<n.size;o++){for(var a=n.get(o).getEnumerator();a.next();){var s=a.current;if(s&&s.serviceType){if(s.hasContracts)if(yl.Type.isFunction(e)&&-1!==s.contractTypes.indexOf(e)){if(!t)return s;i.add(s)}else for(var c=0,u=s.contractTypes;c<u.length;c++){var f=u[c];yl.Type.isAssignableFrom(e,f)&&r.add(s)}else if(yl.Type.isFunction(e)&&s.serviceType===e){if(!t)return s;i.add(s)}else yl.Type.isAssignableFrom(e,s.serviceType)&&r.add(s);if(!t){if(0<r.size)break;if(s.serviceType&&yl.Type.isAssignableFrom(yl.ServiceProvider,s.serviceType)){var l=s.service;l&&!n.has(l.storage)&&n.add(l.storage)}}}}if(t)return i.union(r);if(0<r.size)return r.get(0)}return null},zl=Al,yl.ServiceStorageBase=zl,fm=flagwind=flagwind||{},hm=fm.ServiceStorageBase,__extends(im,hm),Object.defineProperty(im.prototype,"size",{get:function(){return this._entries.size},enumerable:!0,configurable:!0}),im.prototype.clear=function(){this._entries.clear(),this._namedEntries.clear()},im.prototype.remove=function(e){if(!e)return null;var t=null;return this._namedEntries.has(e)&&(t=this._namedEntries.get(e),this._entries.delete(t),this._namedEntries.delete(e)),t},im.prototype.get=function(){var e=arguments;return fm.Type.isString(e[0])&&this._namedEntries.has(e[0])?this._namedEntries.get(e[0]):hm.prototype.get.call(this,e[0])},im.prototype.getEnumerator=function(){return this._entries.getEnumerator()},im.prototype.forEach=function(e,t){this._entries.forEach(e,t)},im.proto