-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
143 lines (143 loc) · 74 KB
/
script.js
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
(function(){var ma={"0.js":"basis.data","1.js":"basis.event","2.js":"basis.entity","3.js":"basis.data.dataset","4.js":"basis.utils.info","5.js":"basis.utils.benchmark","6.js":"basis.utils.highlight"},la={"0.css":"","0.js":function(h,x,g,E,F,C,I,Y){function u(c,a){return function(){c.apply(this,arguments);a.apply(this,arguments)}}function G(c){var a=T[c];if(!a)for(var w=[],b={},m=1,a=T[c]={actions:w,handler:b};c;){if(c&1){var d=M[m];w.push(d.action);for(var e in d.handler)b[e]=b[e]?u(b[e],d.handler[e]):
d.handler[e]}m<<=1;c>>=1}return a}function S(c,a){for(;a&&a!==c&&a!==a.delegate;)a=a.delegate;return a===c}function P(c,a,w){var b=c.delegate;b&&(c.root=b.root,c.target=b.target,c.data=b.data,c.state=b.state);if(c.root!==a){if(b=c.listen.root)a&&a!==c&&a.removeHandler(b,c),c.root&&c.root!==c&&c.root.addHandler(b,c);c.emit_rootChanged(a)}if(c.target!==w){if(b=c.listen.target)w&&w!==c&&w.removeHandler(b,c),c.target&&c.target!==c&&c.target.addHandler(b,c);c.emit_targetChanged(w)}for(c=c.delegates_;c;)c.delegate&&
P(c.delegate,a,w),c=c.next}function y(c,a){var w={},b;c&&c.length&&(b=w.inserted=c);a&&a.length&&(b=w.deleted=a);if(b)return w}function W(c,a){if(c&&c.itemCount){if(a&&a.itemCount){var w=[],b=[],m;for(m in c.items_){var d=c.items_[m];!1==d.basisObjectId in a.items_&&b.push(d)}for(m in a.items_)d=a.items_[m],!1==d.basisObjectId in c.items_&&w.push(d);return y(w,b)}if(c.itemCount)return{deleted:c.getItems()}}else if(a&&a.itemCount)return{inserted:a.getItems()}}function p(c,a,w,b){var m=c[b]||null,d=
null;"function"==typeof w&&(w=w.call(c,c));w instanceof ba&&(d=new V(c,a,w,da),w=w.dataset);w instanceof g.Token&&(w=$.from(w));w instanceof $&&(d=new V(c,a,w,fa),w=p(d,d.proxy,w.value,"adapter_"));!1==w instanceof U&&(w=null);b&&m!==d&&(m&&(m.source.removeHandler(m.handler,m),m.adapter_&&p(m,null,null,"adapter_")),d&&d.source.addHandler(d.handler,d),c[b]=d);return w}function k(c){return Array.isArray(c)?c.map(function(c){return{data:c}}):{data:c}}function e(c){c&&c.constructor===Object||(c={value:c});
return new J({data:c})}g.require("./1.js");h=this.path;E=g.Class;var r=g.cleaner,H=g.object.values;I=g.fn.$self;var s=g.event.Emitter;F=g.event.create;var B=g.event.events,A={},R=[],t={},v={priority:[],values:{},add:function(c,a){var w=c.toLowerCase();v[c]=w;t[w]=c;this.values[w]=c;a=a?this.priority.indexOf(a):-1;-1==a?this.priority.push(w):this.priority.splice(a,0,w)},getList:function(){return H(t)}};v.add("READY");v.add("DEPRECATED");v.add("UNDEFINED");v.add("ERROR");v.add("PROCESSING");var M={},
N=1,D={NONE:0,ALL:0,link:function(c,a,w){c+=a.basisObjectId;var b=w.subscribers_;b||(b=w.subscribers_={});b[c]||(b[c]=a,1==(w.subscriberCount+=1)&&w.emit_subscribersChanged(1))},unlink:function(c,a,b){c+=a.basisObjectId;(a=b.subscribers_)&&a[c]&&(delete a[c],0==(b.subscriberCount-=1)&&(b.emit_subscribersChanged(-1),b.subscribers_=null))},add:function(c,a,b){M[N]={handler:a,action:b};D[c]=N;D.ALL|=N;N<<=1},addProperty:function(c,a){var b={};b[a||c+"Changed"]=function(a,b){b&&D.unlink(c,a,b);a[c]&&
D.link(c,a,a[c])};this.add(c.toUpperCase(),b,function(a,b){b[c]&&a(c,b,b[c])})}},T={};D.addProperty("delegate");D.addProperty("target");D.addProperty("dataset");var O=E(s,{className:h+".AbstractData",state:v.UNDEFINED,emit_stateChanged:F("stateChanged","oldState"),active:!1,emit_activeChanged:F("activeChanged"),subscribeTo:D.NONE,subscriberCount:0,subscribers_:null,emit_subscribersChanged:F("subscribersChanged","delta"),syncEvents:E.oneFunctionProperty(function(){this.isSyncRequired()&&this.syncAction()},
{stateChanged:!0,subscribersChanged:!0}),syncAction:null,init:function(){s.prototype.init.call(this);this.active&&this.addHandler(G(this.subscribeTo).handler);var c=this.syncAction;c&&(this.syncAction=null,this.setSyncAction(c))},setState:function(c,a){var b=String(c);if(!t[b])throw 142;if(this.state!=b||this.state.data!=a){var d=this.state;this.state=Object(b);this.state.data=a;this.emit_stateChanged(d);return!0}return!1},deprecate:function(){this.state!=v.PROCESSING&&this.setState(v.DEPRECATED)},
setActive:function(c){c=!!c;if(this.active!=c){this.active=c;this.emit_activeChanged();if(c){c=G(this.subscribeTo);for(var a=0,b;b=c.actions[a];a++)b(D.link,this);this.addHandler(c.handler)}else{c=G(this.subscribeTo);for(a=0;b=c.actions[a++];)b(D.unlink,this);this.removeHandler(c.handler)}return!0}return!1},setSubscription:function(c){var a=this.subscribeTo,b=c&D.ALL;if(c=a^b){this.subscribeTo=b;if(this.active){var d=G(a),b=G(b);this.removeHandler(d.handler);this.addHandler(b.handler);for(d=1;c;)c&
1&&(b=M[d],a&d?b.action(D.unlink,this):b.action(D.link,this)),d<<=1,c>>=1}return!0}return!1},isSyncRequired:function(){return 0<this.subscriberCount&&(this.state==v.UNDEFINED||this.state==v.DEPRECATED)},setSyncAction:function(c){var a=this.syncAction;"function"!=typeof c&&(c=null);(this.syncAction=c)?(a||this.addHandler(this.syncEvents),this.isSyncRequired()&&this.syncAction()):a&&this.removeHandler(this.syncEvents)},destroy:function(){s.prototype.destroy.call(this);if(this.active)for(var c=G(this.subscribeTo),
a=0,b;b=c.actions[a];a++)b(D.unlink,this);this.state=v.UNDEFINED}}),a={},b={},d=function(c){this.set(this.fn(c))},m={destroy:function(c){this.value.unlink(c,this.fn)}},q={destroy:function(c){this.set(null)}},$=E(O,{className:h+".Value",emit_change:F("change","oldValue")&&function(c){B.change.call(this,c);for(var a=this;a=a.links_;)a.fn.call(a.context,this.value,c)},value:null,initValue:null,proxy:null,locked:!1,lockedValue_:null,links_:null,setNullOnEmitterDestroy:!0,bindingBridge:{attach:function(c,
a,b){c.link(b,a,!0)},detach:function(c,a,b){c.unlink(b,a)},get:function(c){return c.value}},init:function(){O.prototype.init.call(this);this.proxy&&(this.value=this.proxy(this.value));this.setNullOnEmitterDestroy&&this.value instanceof s&&this.value.addHandler(q,this);this.initValue=this.value},set:function(c){var a=this.value;c=this.proxy?this.proxy(c):c;var b=c!==a;b&&(this.setNullOnEmitterDestroy&&(a instanceof s&&a.removeHandler(q,this),c instanceof s&&c.addHandler(q,this)),this.value=c,this.locked||
this.emit_change(a));return b},reset:function(){this.set(this.initValue)},lock:function(){this.locked||(this.locked=!0,this.lockedValue_=this.value)},unlock:function(){if(this.locked){var c=this.lockedValue_;this.lockedValue_=null;this.locked=!1;this.value!==c&&this.emit_change(c)}},compute:function(c,b){b||(b=c,c=null);var w=this,d=g.event.createHandler(c,function(c){this.set(b(c,w.value))}),m=d.events.concat(String(b),this.basisObjectId).join("_"),e=a[m];if(!e){var q={};d.destroy=function(c){delete q[c.basisObjectId];
this.destroy()};this.addHandler({change:function(){for(var c in q){var a=q[c];a.token.set(b(a.object,this.value))}},destroy:function(){for(var c in q){var a=q[c];a.object.removeHandler(d,a.token);a.token.destroy()}w=q=null}});e=a[m]=function(c){var a=c.basisObjectId,L=q[a],f=b(c,w.value);L?L.token.set(f):(L=new g.Token(f),c.addHandler(d,L),L=q[a]={token:L,object:c});return L.token};e.deferred=function(){return function(c){return e(c).deferred()}}}return e},as:function(c,a){if(this.links_)for(var b=
this;b=b.links_;)if(b.context instanceof g.Token&&b.context.fn==String(c))return a?b.context.deferred():b.context;b=new g.Token;b.fn=c;this.link(b,d);return a?b.deferred():b},deferred:function(c){return this.as(c,!0)},link:function(c,a,d){if("function"!=typeof a){var e=String(a);(a=b[e])||(a=b[e]=function(c){this[e]=c})}this.links_={value:this,context:c,fn:a,links_:this.links_};c instanceof s&&c.addHandler(m,this.links_);d||a.call(c,this.value);return c},unlink:function(c,a){for(var b=this,d;d=b,
b=b.links_;)b.context!==c||a&&b.fn!==a||(b.fn=g.fn.$undef,d.links_=b.links_,b.context instanceof s&&b.context.removeHandler(m,b))},destroy:function(){O.prototype.destroy.call(this);this.setNullOnEmitterDestroy&&this.value instanceof s&&this.value.removeHandler(q,this);for(var c=this;c=c.links_;)c.context instanceof s&&c.context.removeHandler(m,c);this.links_=this.lockedValue_=this.value=this.initValue=this.proxy=null}}),n={};$.from=function(c,a,b){var d;if(!c)return null;if(c instanceof s){b||(b=
a,a=null);a=g.event.createHandler(a,function(c){this.set(b(c))});var m=a.events.concat(String(b),c.basisObjectId).join("_");d=n[m];d||(b=g.getter(b),d=n[m]=new $({value:b(c)}),a.destroy=function(c){delete n[m];this.destroy()},c.addHandler(a,d))}d||(m=c.basisObjectId,a=c.bindingBridge,m&&a&&(d=n[m],d||(d=n[m]=new $({value:a.get(c)}),a.attach(c,d.set,d))));if(!d)throw 143;return d};$.factory=function(c,a){return function(b){return $.from(b,c,a)}};var J=E(O,{className:h+".Object",subscribeTo:D.DELEGATE+
D.TARGET,data:null,emit_update:F("update","delta")&&function(c){var a=this.delegates_;for(B.update.call(this,c);a;)a.delegate&&a.delegate.emit_update(c),a=a.next},emit_stateChanged:function(c){var a=this.delegates_;for(O.prototype.emit_stateChanged.call(this,c);a;)a.delegate&&(a.delegate.state=this.state,a.delegate.emit_stateChanged(c)),a=a.next},delegate:null,delegates_:null,emit_delegateChanged:F("delegateChanged","oldDelegate"),target:null,emit_targetChanged:F("targetChanged","oldTarget"),root:null,
emit_rootChanged:F("rootChanged","oldRoot"),init:function(){this.root=this;O.prototype.init.call(this);var c=this.delegate;c?(this.target=this.delegate=null,this.data=c.data,this.state=c.state,this.setDelegate(c)):(this.data||(this.data={}),null!==this.target&&(this.target=this))},setDelegate:function(c){if(c&&c instanceof J){if(c.delegate&&S(this,c))return!1}else c=null;if(this.delegate!==c){var a=this.state,b=this.data,d=this.delegate,m=this.target,e=this.root,q={},g=!1,n=this.listen.delegate;if(d){n&&
d.removeHandler(n,this);for(var L=d.delegates_,f=d;L;){if(L.delegate===this){L.delegate=null;f===d?d.delegates_=L.next:f.next=L.next;break}f=L;L=L.next}}if(c){this.delegate=c;c.delegates_={delegate:this,next:c.delegates_};for(var l in c.data)!1===l in b&&(g=!0,q[l]=void 0);for(l in b)b[l]!==c.data[l]&&(g=!0,q[l]=b[l]);n&&c.addHandler(n,this)}else for(l in this.target=this.delegate=null,this.root=this,this.data={},b)this.data[l]=b[l];P(this,e,m);g&&this.emit_update(q);a===this.state||String(a)==this.state&&
a.data===this.state.data||this.emit_stateChanged(a);this.emit_delegateChanged(d);return!0}return!1},setState:function(c,a){return this.delegate?this.root.setState(c,a):O.prototype.setState.call(this,c,a)},update:function(c){if(this.delegate)return this.root.update(c);if(c){var a={},b=!1,d;for(d in c)this.data[d]!==c[d]&&(b=!0,a[d]=this.data[d],this.data[d]=c[d]);if(b)return this.emit_update(a),a}return!1},destroy:function(){O.prototype.destroy.call(this);var a=this.delegates_;for(this.delegates_=
null;a;)a.delegate.setDelegate(),a=a.next;this.delegate&&this.setDelegate();this.data=A;this.target=this.root=null}});C=E(J,{className:h+".Slot"});var ea={destroy:function(){delete this.map[this.itemId]}};I=E(null,{className:h+".KeyObjectMap",itemClass:J,keyGetter:I,map_:null,extendConstructor_:!0,init:function(){this.map_={};r.add(this)},resolve:function(a){return this.get(this.keyGetter(a),a)},create:function(a,b){var d={};a instanceof J?d.delegate=a:d.data={id:a,title:a};return new this.itemClass(d)},
get:function(a,b){var d=a instanceof J?a.basisObjectId:a,m=this.map_[d];!m&&b&&(m=this.map_[d]=this.create(a,b),m.addHandler(ea,{map:this.map_,itemId:d}));return m},destroy:function(){r.remove(this);for(var a=H(this.map_),b=0,d;d=a[b++];)d.destroy()}});var ba=E(J,{className:h+".DatasetWrapper",subscribeTo:J.prototype.subscribeTo+D.DATASET,listen:{dataset:{itemsChanged:function(a,b){this.itemCount=a.itemCount;this.emit_itemsChanged(b)},destroy:function(){this.setDataset()}}},dataset:null,datasetAdapter_:null,
emit_datasetChanged:F("datasetChanged","oldDataset"),emit_itemsChanged:F("itemsChanged","delta"),init:function(){J.prototype.init.call(this);var a=this.dataset;a&&(this.dataset=null,this.setDataset(a))},setDataset:function(a){a=p(this,this.setDataset,a,"datasetAdapter_");if(this.dataset!==a){var b=this.listen.dataset,d=this.dataset,m;b&&(d&&d.removeHandler(b,this),a&&a.addHandler(b,this));this.itemCount=a?a.itemCount:0;(m=W(d,a))&&this.emit_itemsChanged(m);this.dataset=a;this.emit_datasetChanged(d)}},
has:function(a){return this.dataset?this.dataset.has(a):null},getItems:function(){return this.dataset?this.dataset.getItems():[]},pick:function(){return this.dataset?this.dataset.pick():null},top:function(a){return this.dataset?this.dataset.top(a):[]},forEach:function(a){if(this.dataset)return this.dataset.forEach(a)},destroy:function(){(this.dataset||this.datasetAdapter_)&&this.setDataset();J.prototype.destroy.call(this)}}),U=E(O,{className:h+".AbstractDataset",itemCount:0,items_:null,members_:null,
cache_:null,emit_itemsChanged:F("itemsChanged","delta")&&function(a){var b,d=0,m=0,e;if(b=a.inserted)for(;e=b[d];)this.items_[e.basisObjectId]=e,d++;if(b=a.deleted)for(;e=b[m];)delete this.items_[e.basisObjectId],m++;this.itemCount+=d-m;this.cache_=d==this.itemCount?a.inserted:null;B.itemsChanged.call(this,a)},init:function(){O.prototype.init.call(this);this.members_={};this.items_={}},has:function(a){return!(!a||!this.items_[a.basisObjectId])},getItems:function(){this.cache_||(this.cache_=H(this.items_));
return this.cache_},pick:function(){for(var a in this.items_)return this.items_[a];return null},top:function(a){var b=[];if(a)for(var d in this.items_)if(b.push(this.items_[d])>=a)break;return b},forEach:function(a){for(var b=this.getItems(),d=0;d<b.length;d++)a(b[d])},clear:function(){},destroy:function(){this.clear();O.prototype.destroy.call(this);this.cache_=R;this.itemCount=0;this.items_=this.members_=null}}),X=E(U,{className:h+".Dataset",listen:{item:{destroy:function(a){this.remove([a])}}},
init:function(){U.prototype.init.call(this);var a=this.items;a&&(this.items=null,this.set(a))},add:function(a){var b=this.members_,d=this.listen.item,m=[],e;a&&!Array.isArray(a)&&(a=[a]);for(var q=0;q<a.length;q++){var n=a[q];if(n instanceof J){var g=n.basisObjectId;b[g]||(b[g]=n,d&&n.addHandler(d,this),m.push(n))}}m.length&&this.emit_itemsChanged(e={inserted:m});return e},remove:function(a){var b=this.members_,d=this.listen.item,m=[],e;a&&!Array.isArray(a)&&(a=[a]);for(var q=0;q<a.length;q++){var n=
a[q];if(n instanceof J){var g=n.basisObjectId;b[g]&&(d&&n.removeHandler(d,this),delete b[g],m.push(n))}}m.length&&this.emit_itemsChanged(e={deleted:m});return e},set:function(a){if(!this.itemCount)return this.add(a);if(!a||!a.length)return this.clear();for(var b=this.members_,d=this.listen.item,m={},e=[],q=[],n,g,k,L=0;L<a.length;L++)n=a[L],n instanceof J&&(g=n.basisObjectId,m[g]=n,b[g]||(b[g]=n,d&&n.addHandler(d,this),q.push(n)));for(g in b)m[g]||(n=b[g],d&&n.removeHandler(d,this),delete b[g],e.push(n));
(k=y(q,e))&&this.emit_itemsChanged(k);return k},sync:function(a){a=this.set(a)||{};var b=a.deleted;X.setAccumulateState(!0);if(b)for(var d=0,m;m=b[d];d++)m.destroy();X.setAccumulateState(!1);return a.inserted},clear:function(){var a=this.getItems(),b=this.listen.item,d;if(a.length){if(b)for(d=0;d<a.length;d++)a[d].removeHandler(b,this);this.emit_itemsChanged(d={deleted:a});this.members_={}}return d}}),V=function(a,b,d,m){this.context=a;this.fn=b;this.source=d;this.handler=m};V.prototype.adapter_=
null;V.prototype.proxy=function(){this.fn.call(this.context,this.source)};var da={datasetChanged:function(a){this.fn.call(this.context,a)},destroy:function(){this.fn.call(this.context,null)}},fa={change:function(a){this.fn.call(this.context,a)},destroy:function(){this.fn.call(this.context,null)}};X.setAccumulateState=function(){function a(){var b=k;k={};for(var c in b){var f=b[c];e.call(f.dataset,f)}}function b(a){var c=this.basisObjectId,f=a.inserted,l=a.deleted,z=k[c];if(f&&l)z&&(delete k[c],e.call(z.dataset,
z)),e.call(this,a);else{if(z){var Q=z[f?"inserted":"deleted"];if(Q){Q.push.apply(Q,f||l);return}e.call(z.dataset,z)}k[c]=a;a.dataset=this}}function d(){n=null;q&&(q=0,m.emit_itemsChanged=e,a())}var m=U.prototype,e=m.emit_itemsChanged,q=0,n,k={};return function(k){k?(0==q&&(m.emit_itemsChanged=b,n||(n=g.setImmediate(d))),q++):(q-=0<q,0==q&&(m.emit_itemsChanged=e,a()))}}();x.exports={STATE:v,SUBSCRIPTION:D,AbstractData:O,Value:$,Object:J,Slot:C,KeyObjectMap:I,AbstractDataset:U,Dataset:X,DatasetWrapper:ba,
DatasetAdapter:V,isConnected:S,getDatasetDelta:W,resolveDataset:p,wrapData:k,wrapObject:e,wrap:function(a,b){var d=b?e:k;return Array.isArray(a)?a.map(d):d(a)}}},"1.js":function(h,x,g,E,F,C,I,Y){function u(g){var h=S[g];h||(h=function(){for(var p=this,k,e;p=p.handler;){e=p.callbacks[g];if("function"==typeof e){if(!k){k=[this];for(var r=0;r<arguments.length;r++)k.push(arguments[r])}e.apply(p.context||this,k)}e=p.callbacks["*"];if("function"==typeof e){if(!k)for(k=[this],r=0;r<arguments.length;r++)k.push(arguments[r]);
e.call(p.context||this,{sender:this,type:g,args:k})}}},S[g]=h);return h}h=g.Class;var G={},S={},P=function(){};h=h(null,{className:this.path+".Emitter",extendConstructor_:!0,handler:null,emit_destroy:u("destroy"),listen:h.nestedExtendProperty(),init:function(){this.handler&&!this.handler.callbacks&&(this.handler={callbacks:this.handler,context:this,handler:null})},addHandler:function(g,h){this.handler={callbacks:g,context:h||this,handler:this.handler}},removeHandler:function(g,h){var p=this,k;for(h=
h||this;k=p,p=p.handler;)if(p.callbacks===g&&p.context===h){p.callbacks=G;k.handler=p.handler;break}},destroy:function(){this.destroy=P;this.emit_destroy();this.handler=null}});x.exports={create:u,createHandler:function(g,h){var p={events:[]};if(g){g=String(g).trim().split(/\s+|\s*,\s*/).sort();for(var p={events:g},k=0,e;e=g[k];k++)"destroy"!=e&&(p[e]=h)}return p},events:S,Emitter:h}},"2.js":function(h,x,g,E,F,C,I,Y){function u(a){ba[a]=ba[a]||0;return a+ba[a]++}function G(a,f){var l=X[a];if(l){for(var b=
0,c;c=l[b];b++)c[0][c[1]]=f;delete X[a]}U[a]=f}function S(a,f,l){if(U[a])return U[a];var b=X[a];b||(b=X[a]=[]);b.push([f,l]);return function(f,l){var b=U[a];if(b)return b(f,l)}}function P(){var a=N(arguments),f=a.pop(),l=a[0],b=a[1],c=a[2],d;if("function"!=typeof f)throw 145;switch(a.length){case 0:d=function(){return f()};break;case 1:d=function(a,b,z){return l in a?f(b[l]):z};break;case 2:d=function(a,c,d){return l in a||b in a?f(c[l],c[b]):d};break;case 3:d=function(a,d,K){return l in a||b in a||
c in a?f(d[l],d[b],d[c]):K};break;default:d=function(l,b,z){for(var c=!1,d=[],Q=0,K;K=a[Q];Q++)c=c||K in l,d.push(b[K]);return c?f.apply(null,d):z}}d.args=a;return d.calc=d}function y(){return P.apply(null,N(arguments).concat(function(){for(var a=[],f=arguments.length;0<f--;){if(null==arguments[f])return null;a.push(arguments[f])}return a.join("-")}))}function W(a,f){var l=["has"],b=[R],c=[],d;for(d in a)if(R.call(a,d)){var aa="v"+c.length,m="f"+c.length,e=a[d];l.push(aa,m);b.push(e,f[d]);c.push('"'+
d+'":has.call(data,"'+d+'")?'+m+'(data["'+d+'"],'+aa+"):"+aa+("function"==typeof e?"(data)":""))}c=c.sort().join(",");(d=ia[c])||(d=ia[c]=new Function(l,"return function(data){return {"+c+"};};"));return d.apply(null,b)}function p(a,f){if(!Array.isArray(a))return null;if(!Array.isArray(f)||a.length!=f.length)return a||null;for(var l=0;l<a.length;l++)if(a[l]!==f[l])return a;return f}function k(a,f,l){a.aliases[f]=f;l="string"==typeof l||Array.isArray(l)||"function"==typeof l&&l.calc!==l?{type:l}:g.object.slice(l);
if("type"in l){"string"==typeof l.type&&(l.type=S(l.type,a.fields,f));if(Array.isArray(l.type)){var b=l.type.slice();1==b.length?(l.type=g.fn.$const(b[0]),l.defValue=b[0]):(l.type=function(a,f){return-1!=b.indexOf(a)?a:f},l.defValue=-1!=b.indexOf(l.defValue)?l.defValue:b[0])}l.type===Array&&(l.type=p);"function"!=typeof l.type&&(l.type=M)}var c=l.type||M;-1!=[$,n,J,ea].indexOf(c)&&(l.id=!0);l.id&&(a.index||(a.index=new V(String)),a.idFields[f]=!0,a.idField||a.compositeKey?(a.idField=null,a.compositeKey=
y.apply(null,t(a.idFields))):a.idField=f);l.calc?(r(a,f,l.calc),a.fields[f]=ja):a.fields[f]=c;a.defaults[f]="defValue"in l?l.defValue:c();ca[f]||(ca[f]={destroy:function(){this.set(f,null)}})}function e(a,f,l){!1!=l in a.fields&&(f in a.aliases||(a.aliases[f]=l))}function r(a,f,l){a.calcs||(a.calcs=[]);var b=a.calcs,c=a.deps,d=l.args||[],aa={args:d,wrapper:l},m=a.calcs.length,e=0;if(d)for(var q=0,n;n=b[q];q++)-1!=d.indexOf(n.key)&&(e=q+1);if(f){aa.key=f;for(q=0;n=b[q];q++)if(-1!=n.args.indexOf(f)){m=
q;break}if(e>m)return;a.idField&&f==a.idField&&(a.compositeKey=l);c[f]=d.reduce(function(a,f){for(var l=c[f]||[f],b=0;b<l.length;b++)g.array.add(a,l[b]);return a},[]);for(var k in c)a=c[k].indexOf(f),-1!=a&&Array.prototype.splice.apply(c[k],[a,1].concat(c[f]))}else m=e;b.splice(Math.min(m,e),0,aa)}function H(a){return function(f){return f&&this.modified&&a in this.modified?this.modified[a]:this.data[a]}}function s(a){return function(f,l){return this.set(a,f,l)}}g.require("./1.js");g.require("./0.js");
g.require("./3.js");var B=this.path,A=g.Class,R=Object.prototype.hasOwnProperty,t=g.object.keys,v=g.object.extend,M=g.fn.$self,N=g.array.from,D=g.event.Emitter;h=g.event.create;var T=g.data.Object,O=g.data.Slot,a=g.data.Dataset;C=g.data.dataset.Subset;var b=g.data.dataset.Split,d={},m=[],q={string:!0,number:!0},$=function(a){return isNaN(a)?null:Number(a)},n=function(a){return isNaN(a)?null:Number(a)},J=function(a){return isNaN(a)?null:parseInt(a,10)},ea=function(a){return null==a?null:String(a)},
ba={},U={},X={},V=A(null,{className:B+".Index",items:null,fn:String,init:function(a){this.items={};"function"==typeof a&&(this.fn=a)},calcWrapper:function(a,f){var l=this.fn(a,f);if(l!==f&&R.call(this.items,l))throw 144;return l},get:function(a,f){var l=R.call(this.items,a)&&this.items[a];if(l&&(!f||l.entityType===f))return l},add:function(a,f){var l=R.call(this.items,a)&&this.items[a];if(f&&(!l||l===f))return this.items[a]=f,!0},remove:function(a,f){if(this.items[a]===f)return delete this.items[a],
!0},destroy:function(){this.items=null}});I=function(a,f){return function(l){return a.prototype[f].call(this,l&&l.map(this.wrapper))}};E=function(a,f){return function(){this.name||(this.name=u(f));a.prototype.init.call(this)}};F=function(b){return function(f){var l=g.object.slice(this.items_),b=[];if(f){a.setAccumulateState(!0);for(var c=0;c<f.length;c++){var d=this.wrapper(f[c]);d&&(l[d.basisObjectId]=!1)}a.setAccumulateState(!1)}for(var aa in this.items_)!1==aa in l&&b.push(this.items_[aa]);a.setAccumulateState(!0);
for(aa in l)l[aa]&&l[aa].destroy();a.setAccumulateState(!1);return b.length?b:null}};var da=A(a,{className:B+".EntitySet",name:null,wrapper:M,init:E(a,"EntitySet"),sync:F(a),set:I(a,"set"),add:I(a,"add"),remove:I(a,"remove"),destroy:function(){a.prototype.destroy.call(this);this.wrapper=null}}),fa=A(da,{className:B+".ReadOnlyEntitySet",set:g.fn.$false,add:g.fn.$false,remove:g.fn.$false,clear:g.fn.$false});C=A(C,{className:B+".EntityCollection",name:null,init:E(C,"EntityCollection"),sync:F(C)});E=
A(b,{className:B+".EntityGrouping",name:null,subsetClass:fa,init:E(b,"EntityGrouping"),sync:F(b),getSubset:function(a,f){var l=b.prototype.getSubset.call(this,a,f);l&&l.dataset&&(l.dataset.wrapper=this.wrapper);return l}});var c=function(b,f){if(this instanceof c){b||(b=M);if(!f||U[f])f=u("UntitledEntitySetType");var l=new ha({entitySetClass:{wrapper:b}}),d=l.entitySetClass,Q=function(f,b){return null!=f?(!1==b instanceof da&&(b=l.createEntitySet()),b.set(f instanceof a?f.getItems():N(f)),b):null};
"string"==typeof b&&(d.prototype.wrapper=S(b,d.prototype,"wrapper"));G(f,Q);v(Q,{type:l,typeName:f,toString:function(){return this.typeName+"()"},entitySetType:l,extend:function(){return d.extend.apply(d,arguments)},extendClass:function(){d.extend.apply(d,arguments);return Q},reader:function(a){if(Array.isArray(a)){var f=d.prototype.wrapper;return a.map(f.reader||f)}return a},extendReader:function(a){var f=Q.reader;Q.reader=function(l){Array.isArray(l)&&a(l);return f(l)}}});return Q}},ha=A(null,{className:B+
".EntitySetConstructor",entitySetClass:da,extendConstructor_:!0,createEntitySet:function(){return new this.entitySetClass}}),w=function(a){if(this instanceof w){var f;f=a.singleton?function(a){var f=l.get();f?a&&f.update(a):f=new b(a||{});return f}:function(a,f){if(null!=a){if(a===f||a.entityType===l)return a;var c,d=l.idField;if(q[typeof a]){if(!d)return;if(f=l.index.get(a,l))return f;c=a;a={};a[d]=c}else l.compositeKey?c=l.compositeKey(a,a):d&&(c=a[d]),null!=c&&(f=l.index.get(c,l));f&&f.entityType===
l?f.update(a):f=new b(a);return f}};var l=new Z(a||{},f),b=l.entityClass;G(l.name,f);v(f,{all:l.all,type:l,typeName:l.name,entityType:l,toString:function(){return this.typeName+"()"},reader:function(a){return l.reader(a)},get:function(a){return l.get(a)},getSlot:function(a,f){return l.getSlot(a,f)},extend:function(){return b.extend.apply(b,arguments)},extendClass:function(){return b.extend.apply(b,arguments)},extendReader:function(a){var l=f.reader;f.reader=function(f){f&&"object"==typeof f&&a(f);
return l(f)}}});return f}},ca={},ia={},ja=function(a,f){return f},Z=A(null,{className:B+".EntityType",wrapper:null,all:null,fields:null,idFields:null,defaults:null,aliases:null,slots:null,singleton:!1,index:null,entityClass:null,init:function(a,f){this.name=a.name;if(!this.name||U[this.name])this.name=u("UntitledEntityType");this.fields={};this.deps={};this.idFields={};this.defaults={};this.aliases={};this.slots={};var l=a.index;l&&l instanceof V&&(this.index=l);this.wrapper=f;if(!1=="all"in a||a.all||
a.singleton)this.all=new fa(g.object.complete({wrapper:f},a.all));if(this.singleton=!!a.singleton){var b;this.get=function(){return b};this.all.addHandler({itemsChanged:function(a,f){b=f.inserted?f.inserted[0]:null}},this)}for(var c in a.fields)k(this,c,a.fields[c]);for(c in a.aliases)e(this,c,a.aliases[c]);a.constrains&&a.constrains.forEach(function(a){r(this,null,a)},this);l={};for(c in this.defaults)l[c]=void 0;this.entityClass=ka(this,this.all,this.fields,this.slots);this.entityClass.extend({entityType:this,
type:f,typeName:this.name,state:a.state||this.entityClass.prototype.state,generateData:W(this.defaults,this.fields),initDelta:l});for(var d in this.fields)this.entityClass.prototype["get_"+d]=H(d),this.fields[d]!==ja&&(this.entityClass.prototype["set_"+d]=s(d));m.push(this)},reader:function(a){var f={};if(q[typeof a])return this.idField?a:null;if(!a||null==a)return null;for(var l in a){var b=this.aliases[l];if(b){var c=this.fields[b].reader;f[b]=c?c(a[l]):a[l]}}return f},get:function(a){a=this.getId(a);
if(null!=a)return this.index.get(a,this)},getId:function(a){if((this.idField||this.compositeKey)&&null!=a){if(q[typeof a])return a;if(a&&a.entityType===this)return a.__id__;a instanceof T&&(a=a.data);return this.compositeKey?this.compositeKey(a,a):a[this.idField]}},getSlot:function(a){var f=this.getId(a);if(null!=f){var b=R.call(this.slots,f)&&this.slots[f];b||(q[typeof a]&&(b={},this.idField&&!this.compositeKey&&(b[this.idField]=a),a=b),b=this.slots[f]=new O({delegate:this.get(f)||null,data:a}));
return b}}}),ga=A(T,{className:B+".BaseEntity",target:!0,setDelegate:function(){},modified:null,emit_rollbackUpdate:h("rollbackUpdate")}),ka=function(a,f,b,c){function m(f,b,l){var c=a.calcs,d=f.data,z=!1,Q=f.__id__,q;try{if(c)for(var n=0,g;g=c[n];n++){var k=g.key,J=d[k],h=g.wrapper(b,d,J);k&&h!==J&&(d[k]=h,b[k]=J,z=!0)}q=a.compositeKey?a.compositeKey(b,d,Q):a.idField&&a.idField in b?d[a.idField]:Q;q!==Q&&a.index.calcWrapper(q,Q)}catch(p){z=!1;q=Q;for(k in b)f.data[k]=b[k];if(l&&!f.modified)for(k in l){f.modified=
l;break}}q!==Q&&(f.__id__=q,e(f,Q,q));return z}function e(f,b,l){var d=a.index;null!=b&&(d.remove(b,f),R.call(c,b)&&c[b].setDelegate());null!=l&&(d.add(l,f),R.call(c,l)&&c[l].setDelegate(f))}return A(ga,{className:B+".Entity",extendConstructor_:!1,fieldHandlers_:null,init:function(a){this.delegate=null;this.data=this.generateData(a);ga.prototype.init.call(this);for(var b in this.data)(a=this.data[b])&&a!==this&&a instanceof D&&(a.addHandler(ca[b],this),this.fieldHandlers_||(this.fieldHandlers_={}),
this.fieldHandlers_[b]=!0);m(this,this.initDelta);f&&f.emit_itemsChanged({inserted:[this]})},toString:function(){return"[object "+this.constructor.className+"("+this.entityType.name+")]"},getId:function(){return this.__id__},get:function(a,f){return f&&this.modified&&a in this.modified?this.modified[a]:this.data[a]},set:function(f,c,d,z){var e=b[f];if(!e)return!1;var q,K=this.modified;e===p&&K&&f in K&&(c=p(c,K[f]));c=e(c,this.data[f]);e=this.data[f];if(c===e||c&&e&&c.constructor===Date&&e.constructor===
Date&&+c===+e)!d&&K&&f in K&&(q={rollback:{key:f,value:K[f]}},delete K[f],t(K).length||(this.modified=null));else a:{q={};if(!a.idFields[f])if(d)K||(this.modified=K={}),!1===f in K?(q.rollback={key:f,value:void 0},K[f]=e):K[f]===c&&(q.rollback={key:f,value:c},delete K[f],t(K).length||(this.modified=null));else if(K&&f in K)if(K[f]!==c){q.rollback={key:f,value:K[f]};K[f]=c;break a}else return!1;this.data[f]=c;this.fieldHandlers_&&this.fieldHandlers_[f]&&(e.removeHandler(ca[f],this),this.fieldHandlers_[f]=
!1);c&&c!==this&&c instanceof D&&(c.addHandler(ca[f],this),this.fieldHandlers_||(this.fieldHandlers_={}),this.fieldHandlers_[f]=!0);q.key=f;q.value=e;q.delta={};q.delta[f]=e}if(!z&&q){f=q.key;d=q.delta||{};var n;q.rollback&&(n={},n[q.rollback.key]=q.rollback.value);m(this,d,n)&&(f=!0);f&&(this.emit_update(d),q.delta=d);n&&this.emit_rollbackUpdate(n)}return q||!1},update:function(a,f){var b=!1,l={};if(a){var c,d={},z,q;for(q in a)if(z=this.set(q,a[q],f,!0))z.key&&(b=!0,l[z.key]=z.value),z.rollback&&
(c=!0,d[z.rollback.key]=z.rollback.value);m(this,l,d)&&(b=!0);b&&this.emit_update(l);c&&this.emit_rollbackUpdate(d)}return b?l:!1},generateData:function(){return{}},reset:function(){this.update(this.generateData({}))},clear:function(){var a={},f;for(f in this.data)a[f]=void 0;return this.update(a)},commit:function(a){var f=this.modified;this.modified=null;a&&this.update(a);f&&this.emit_rollbackUpdate(f)},rollback:function(f){var b=this.modified;b&&f&&(Array.isArray(f)||(f=[f]),b=g.object.slice(b,
f.reduce(function(f,b){return f.concat(a.deps[b]||b)},[])));this.update(b,!0)},destroy:function(){if(this.fieldHandlers_){for(var a in this.fieldHandlers_)this.fieldHandlers_[a]&&this.data[a].removeHandler(ca[a],this);this.fieldHandlers_=null}null!=this.__id__&&e(this,this.__id__,null);T.prototype.destroy.call(this);f&&f.emit_itemsChanged({deleted:[this]});this.data=d;this.modified=null}})};x.exports={isEntity:function(a){return a&&a instanceof ga},createType:function(a,f){var b=a||{};"string"==typeof a?
b={name:b,fields:f||{}}:f&&(b=g.object.merge(b,{fields:f}));return new w(b)},createSetType:function(a,f){return 1<arguments.length?new c(f,a):new c(a)},validate:function(){for(var a in X)g.dev.warn(B+": type `"+a+"` is not defined, but used by "+X[a].length+" type(s)")},getTypeByName:function(a){return U[a]},get:function(a,f){var b=U[a];if(b)return b.get(f)},NumericId:$,NumberId:n,IntId:J,StringId:ea,Index:V,CalculateField:P,calc:P,EntityType:w,Entity:ka,BaseEntity:ga,EntitySetType:c,EntitySet:da,
ReadOnlyEntitySet:fa,Collection:C,Grouping:E}},"3.js":function(h,x,g,E,F,C,I,Y){function u(a,b){var d={},m;a&&a.length&&(m=d.inserted=a);b&&b.length&&(m=d.deleted=b);if(m)return d}function G(a,b){return function m(b){if(!b)return null;if(b.__extend__)return b;"string"==typeof b||Array.isArray(b)||(b="object"==typeof b?g.object.keys(b):null);return W(g.event.createHandler(b,a),{__extend__:m})}(b)}function S(a,b,d,m){return new t(W({keyGetter:b,itemClass:d,create:function(a,b){var d=t.prototype.create.call(this,
a,b);d.setDataset(new m({ruleValue:a}));return d}},a))}function P(a,b){if(!a.length)return 0;var d=b.value,m=b.object.basisObjectId,e,g,n,k,h=0,p=a.length-1;do if(n=h+p>>1,k=a[n],e=k.value,d<e)p=n-1;else if(d>e)h=n+1;else if(g=k.object.basisObjectId,m<g)p=n-1;else if(m>g)h=n+1;else return n;while(h<=p);return n+(e==d?g<m:e<d)}function y(a,b){return+(a.value>b.value)||-(a.value<b.value)||a.object.basisObjectId-b.object.basisObjectId}g.require("./1.js");g.require("./0.js");C=this.path;I=g.Class;var W=
g.object.extend,p=g.object.values,k=g.getter,e=g.fn.$self,r=g.fn.$true,H=g.fn.$false,s=g.array.from,B=g.event.create,A=g.data.SUBSCRIPTION,R=g.data.Object,t=g.data.KeyObjectMap,v=g.data.AbstractDataset,M=g.data.Dataset;Y=g.data.DatasetWrapper;A.add("SOURCE",{sourceChanged:function(a,b){b&&A.unlink("source",a,b);a.source&&A.link("source",a,a.source)},sourcesChanged:function(a,b){var d;if(d=b.inserted)for(var m=0;d[m];m++)A.link("source",a,d[m]);if(d=b.deleted)for(m=0;d[m];m++)A.unlink("source",a,d[m])}},
function(a,b){for(var d=b.sources||(b.source?[b.source]:[]),m=0,e;e=d[m++];)a("source",b,e)});A.addProperty("minuend");A.addProperty("subtrahend");var N=I(v,{className:C+".Merge",subscribeTo:A.SOURCE,emit_sourcesChanged:B("sourcesChanged","delta"),sources:null,rule:function(a,b){return 0<a},listen:{source:{itemsChanged:function(a,b){var d=this.members_,m={},e,g;if(b.inserted)for(var n=0;e=b.inserted[n];n++)g=e.basisObjectId,d[g]?d[g].count++:d[g]={count:1,object:e},m[g]=d[g];if(b.deleted)for(n=0;e=
b.deleted[n];n++)g=e.basisObjectId,m[g]=d[g],d[g].count--;this.applyRule(m)},destroy:function(a){this.removeSource(a)}}},init:function(){v.prototype.init.call(this);var a=this.sources;this.sources=[];a&&a.forEach(this.addSource,this)},setRule:function(a){"function"!=typeof a&&(a=N.UNION);this.rule!==a&&(this.rule=a,this.applyRule())},applyRule:function(a){var b=this.members_,d=this.rule,m=this.sources.length,e=[],g=[],n,k;a||(a=b);for(var h in a)a=b[h],n=m&&a.count&&d(a.count,m),n!=!!this.items_[h]&&
(n?e:g).push(a.object),0==a.count&&delete b[h];(k=u(e,g))&&this.emit_itemsChanged(k);return k},addSource:function(a){if(a instanceof v&&g.array.add(this.sources,a)){this.listen.source&&a.addHandler(this.listen.source,this);var b=this.members_,d;for(d in a.items_)b[d]?b[d].count++:b[d]={count:1,object:a.items_[d]};this.applyRule();this.emit_sourcesChanged({inserted:[a]});return!0}},removeSource:function(a){if(g.array.remove(this.sources,a)){this.listen.source&&a.removeHandler(this.listen.source,this);
var b=this.members_,d;for(d in a.items_)b[d].count--;this.applyRule();this.emit_sourcesChanged({deleted:[a]});return!0}},setSources:function(a){for(var b=s(this.sources),d=0,m;m=a[d];d++)m instanceof v&&(g.array.remove(b,m)||this.addSource(m));b.forEach(this.removeSource,this)},clear:function(){s(this.sources).forEach(this.removeSource,this)},destroy:function(){v.prototype.destroy.call(this);this.sources=null}});N.UNION=N.prototype.rule;N.INTERSECTION=function(a,b){return a==b};N.DIFFERENCE=function(a,
b){return 1==a};N.MORE_THAN_ONE_INCLUDE=function(a,b){return 1==b||1<a};N.AT_LEAST_ONE_EXCLUDE=function(a,b){return 1==b||a<b};var D=function(a){return!this.has(a)};h=I(v,{className:C+".Subtract",subscribeTo:A.MINUEND+A.SUBTRAHEND,minuend:null,emit_minuendChanged:B("minuendChanged","oldMinuend"),subtrahend:null,emit_subtrahendChanged:B("subtrahendChanged","oldSubtrahend"),listen:{minuend:{itemsChanged:function(a,b){if(this.subtrahend){var d=u(b.inserted&&b.inserted.filter(D,this.subtrahend),b.deleted&&
b.deleted.filter(this.has,this));d&&this.emit_itemsChanged(d)}},destroy:function(){this.setOperands(null,this.subtrahend)}},subtrahend:{itemsChanged:function(a,b){if(this.minuend){var d=u(b.deleted&&b.deleted.filter(D,this),b.inserted&&b.inserted.filter(this.has,this));d&&this.emit_itemsChanged(d)}},destroy:function(){this.setOperands(this.minuend,null)}}},init:function(){v.prototype.init.call(this);var a=this.minuend,b=this.subtrahend;this.subtrahend=this.minuend=null;(a||b)&&this.setOperands(a,
b)},setOperands:function(a,b){var d,m=!1;!1==a instanceof v&&(a=null);!1==b instanceof v&&(b=null);var e=this.minuend,g=this.subtrahend;if(e!==a){m=!0;this.minuend=a;var n=this.listen.minuend;n&&(e&&e.removeHandler(n,this),a&&a.addHandler(n,this));this.emit_minuendChanged(e)}if(g!==b){m=!0;this.subtrahend=b;if(n=this.listen.subtrahend)g&&g.removeHandler(n,this),b&&b.addHandler(n,this);this.emit_subtrahendChanged(g)}if(!m)return!1;if(a&&b){var m=[],e=[],k;for(k in this.items_)a.items_[k]&&!b.items_[k]||
m.push(this.items_[k]);for(k in a.items_)this.items_[k]||b.items_[k]||e.push(a.items_[k]);(d=u(e,m))&&this.emit_itemsChanged(d)}else this.itemCount&&this.emit_itemsChanged(d={deleted:this.getItems()});return d},setMinuend:function(a){return this.setOperands(a,this.subtrahend)},setSubtrahend:function(a){return this.setOperands(this.minuend,a)},clear:function(){this.setOperands()}});var T=I(v,{className:C+".SourceDataset",subscribeTo:A.SOURCE,source:null,emit_sourceChanged:B("sourceChanged","oldSource"),
sourceAdapter_:null,sourceMap_:null,listen:{source:{destroy:function(){this.sourceAdapter_||this.setSource()}}},init:function(){this.sourceMap_={};v.prototype.init.call(this);var a=this.source;a&&(this.source=null,this.setSource(a))},setSource:function(a){a=g.data.resolveDataset(this,this.setSource,a,"sourceAdapter_");if(this.source!==a){var b=this.source,d=this.listen.source;this.source=a;if(d){var m=d.itemsChanged;b&&(b.removeHandler(d,this),m&&m.call(this,b,{deleted:b.getItems()}));a&&(a.addHandler(d,
this),m&&m.call(this,a,{inserted:a.getItems()}))}this.emit_sourceChanged(b)}},clear:function(){this.setSource()},destroy:function(){v.prototype.destroy.call(this);this.sourceMap_=null}}),O=I(T,{className:C+".MapFilter",map:e,filter:H,rule:k(r),ruleEvents:G(function(a){var b=this.map?this.map(a):object;if(!1==b instanceof R||this.filter(b))b=null;var d=this.sourceMap_[a.basisObjectId],m=d.member;if(m!==b){var e=this.members_,g,n,k;d.member=b;m&&(d=m.basisObjectId,this.removeMemberRef&&this.removeMemberRef(m,
a),0==--e[d]&&(delete e[d],k=[m]));b&&(m=b.basisObjectId,this.addMemberRef&&this.addMemberRef(b,a),e[m]?e[m]++:(e[m]=1,n=[b]));(g=u(n,k))&&this.emit_itemsChanged(g)}},"update"),addMemberRef:null,removeMemberRef:null,listen:{source:{itemsChanged:function(a,b){var d=this.sourceMap_,m=this.members_,e=[],g=[],n,k,h,p=this.ruleEvents;M.setAccumulateState(!0);if(b.inserted)for(var r=0;n=b.inserted[r];r++){h=this.map?this.map(n):n;if(!1==h instanceof R||this.filter(h))h=null;p&&n.addHandler(p,this);d[n.basisObjectId]=
{sourceObject:n,member:h};h&&(k=h.basisObjectId,m[k]?m[k]++:(m[k]=1,e.push(h)),this.addMemberRef&&this.addMemberRef(h,n))}if(b.deleted)for(r=0;n=b.deleted[r];r++)k=n.basisObjectId,h=d[k].member,p&&n.removeHandler(p,this),delete d[k],h&&(k=h.basisObjectId,0==--m[k]&&(delete m[k],g.push(h)),this.removeMemberRef&&this.removeMemberRef(h,n));M.setAccumulateState(!1);(b=u(e,g))&&this.emit_itemsChanged(b)}}},setMap:function(a){"function"!=typeof a&&(a=e);if(this.map!==a)return this.map=a,this.applyRule()},
setFilter:function(a){"function"!=typeof a&&(a=H);if(this.filter!==a)return this.filter=a,this.applyRule()},setRule:function(a){"function"!=typeof a&&(a=r);if(this.rule!==a)return this.rule=a,this.applyRule()},applyRule:function(){var a=this.sourceMap_,b=this.members_,d,e,g,k,n,h=[],p=[],r,s;for(s in a){n=a[s];k=n.sourceObject;d=n.member;e=this.map?this.map(k):k;if(!1==e instanceof R||this.filter(e))e=null;d!=e&&(n.member=e,d&&(g=d.basisObjectId,this.removeMemberRef&&this.removeMemberRef(d,k),b[g]--),
e&&(d=e.basisObjectId,this.addMemberRef&&this.addMemberRef(e,k),d in b?b[d]++:(b[d]=1,h.push(e))))}for(g in this.items_)0==b[g]&&(delete b[g],p.push(this.items_[g]));(r=u(h,p))&&this.emit_itemsChanged(r);return r}});E=I(O,{className:C+".Subset",filter:function(a){return!this.rule(a)}});F=I(O,{className:C+".Split",subsetClass:v,subsetWrapperClass:Y,keyMap:null,map:function(a){return this.keyMap.resolve(a)},setRule:function(a){"function"!=typeof a&&(a=r);if(this.rule!==a)return this.rule=a,this.keyMap.keyGetter=
a,this.applyRule()},addMemberRef:function(a,b){a.dataset.emit_itemsChanged({inserted:[b]})},removeMemberRef:function(a,b){a.dataset.emit_itemsChanged({deleted:[b]})},init:function(){this.keyMap&&!1!=this.keyMap instanceof t||(this.keyMap=S(this.keyMap,this.rule,this.subsetWrapperClass,this.subsetClass));O.prototype.init.call(this)},getSubset:function(a,b){return this.keyMap.get(a,b)},destroy:function(){O.prototype.destroy.call(this);this.keyMap.destroy();this.keyMap=null}});B=I(T,{className:C+".Slice",
rule:k(r),ruleEvents:G(function(a){var b=this.sourceMap_[a.basisObjectId];a=this.rule(a);var d=this.index_;if(a!==b.value){var e=P(d,b),g=d[e-1],k=d[e+1];b.value=a;if(g&&(g.value>a||g.value==a&&g.object.basisObjectId>b.object.basisObjectId)||k&&(k.value<a||k.value==a&&k.object.basisObjectId<b.object.basisObjectId))d.splice(e,1),d.splice(P(d,b),0,b),this.applyRule()}},"update"),index_:null,orderDesc:!1,offset:0,limit:10,listen:{source:{itemsChanged:function(a,b){var d=this.sourceMap_,e=this.index_,
g=this.ruleEvents,k=!1,n=!1,h,p=b.inserted,r=b.deleted;if(r){r.length>e.length-r.length&&(k=!0,n=r.length!=e.length,e.length=0);for(var s=0,t;t=r[s];s++)k||(h=d[t.basisObjectId],e.splice(P(e,h),1)),delete d[t.basisObjectId],g&&t.removeHandler(g,this);if(n)for(var v in d)h=d[v],e.splice(P(e,h),0,h)}if(p){n=!e.length;for(s=0;t=p[s];s++)h={object:t,value:this.rule(t)},d[t.basisObjectId]=h,n?e.push(h):e.splice(P(e,h),0,h),g&&t.addHandler(g,this);n&&e.sort(y)}this.applyRule()}}},emit_rangeChanged:B("rangeChanged",
"oldOffset","oldLimit"),init:function(){this.index_=[];T.prototype.init.call(this)},setRange:function(a,b){var d=this.offset,e=this.limit,g=!1;if(d!=a||e!=b)this.offset=a,this.limit=b,g=this.applyRule(),this.emit_rangeChanged(d,e);return g},setOffset:function(a){return this.setRange(a,this.limit)},setLimit:function(a){return this.setRange(this.offset,a)},setRule:function(a,b){a=k(a);this.orderDesc=!!b;if(this.rule!=a){for(var d=this.index_,e=0;e<d.length;e++)d[e].value=a(d[e].object);this.rule=a;
d.sort(y)}return this.applyRule()},applyRule:function(){var a=this.offset,b=a+this.limit;this.orderDesc&&(a=this.index_.length-b,b=a+this.limit);for(var d=g.object.slice(this.members_),a=this.index_.slice(Math.max(0,a),Math.max(0,b)),b=[],e,k=0,h;h=a[k];k++){var n=h.object.basisObjectId;d[n]?delete d[n]:(b.push(h.object),this.members_[n]=h.object)}for(n in d)delete this.members_[n];(e=u(b,p(d)))&&this.emit_itemsChanged(e);return e},destroy:function(){T.prototype.destroy.call(this);this.index_=null}});
C=I(T,{className:C+".Cloud",subsetClass:v,subsetWrapperClass:Y,rule:k(H),ruleEvents:G(function(a){var b=this.sourceMap_,d=this.members_,e=a.basisObjectId,g=b[e].list,b=b[e].list={},e=this.rule(a),k,n=[],h=[],p;if(Array.isArray(e))for(var r=0;r<e.length;r++)(p=this.keyMap.get(e[r],!0))&&!p.has(a)&&(s=p.basisObjectId,b[s]=p,g[s]||(p.dataset.emit_itemsChanged({inserted:[a]}),d[s]?d[s]++:(n.push(p),d[s]=1)));for(var s in g)b[s]||(p=g[s],p.dataset.emit_itemsChanged({deleted:[a]}),--d[s]||(delete d[s],
h.push(p)));(k=u(n,h))&&this.emit_itemsChanged(k)},"update"),keyMap:null,map:e,listen:{source:{itemsChanged:function(a,b){var d=this.sourceMap_,e=this.members_,g=this.ruleEvents,k,n,h,p=[],r=[];M.setAccumulateState(!0);if(k=b.inserted)for(var s=0,t;t=k[s];s++){var v=this.rule(t),P={object:t,list:{}};d[t.basisObjectId]=P;if(Array.isArray(v))for(var y=0,c={};y<v.length;y++)(n=this.keyMap.get(v[y],!0))&&!c[n.basisObjectId]&&(h=n.basisObjectId,c[h]=!0,P.list[h]=n,n.dataset.emit_itemsChanged({inserted:[t]}),
e[h]?e[h]++:(p.push(n),e[h]=1));g&&t.addHandler(g,this)}if(k=b.deleted)for(s=0;t=k[s];s++){n=t.basisObjectId;v=d[n].list;delete d[n];for(h in v)n=v[h],n.dataset.emit_itemsChanged({deleted:[t]}),--e[h]||(delete e[h],r.push(n));g&&t.removeHandler(g,this)}M.setAccumulateState(!1);(b=u(p,r))&&this.emit_itemsChanged(b)}}},init:function(){this.keyMap&&!1!=this.keyMap instanceof t||(this.keyMap=S(this.keyMap,this.rule,this.subsetWrapperClass,this.subsetClass));T.prototype.init.call(this)},getSubset:function(a,
b){return this.keyMap.get(a,b)},destroy:function(){T.prototype.destroy.call(this);this.keyMap.destroy();this.keyMap=null}});x.exports={createRuleEvents:G,Merge:N,Subtract:h,SourceDataset:T,MapFilter:O,Subset:E,Split:F,Slice:B,Cloud:C}},"4.js":function(h,x,g,E,F,C,I,Y){function u(g){if(0<g.basisGetterId_){var h="getter(";if("string"==typeof g.base)h+='"'+g.base.replace(/"/g,'\\"')+'"';else if(g.mod)h+=u(g.base);else return u(g.base);g.mod&&(h="string"==typeof g.mod?h+(', "'+g.mod.replace(/"/g,'\\"')+
'"'):h+(", "+u(g.mod)));return h+")"}return Function.prototype.toString.call(g)}function G(g){function h(k,r){2!=arguments.length&&(r=e);p!=r&&(u.push([k||"content",g.substring(p,r)]),p=r)}for(var y=g.split(""),u=[],p=0,k,e=0;e<y.length;e++){var r=y[e];switch(r){case "/":k=e+1;if("/"===y[k]){for(h();k<y.length&&"\n"!==y[k]&&"\r"!==y[k];)k++;h("comment",k);e=p-1;break}if("*"==y[k]){h();for(k+=1;k<y.length&&("*"!==y[k]||"/"!==y[k+1]);)k++;h("comment",k+2);e=p-1;break}break;case '"':case "'":h();for(k=
e;;)if(k++,"\\"==y[k])k++;else if(y[k]==r)break;h("string",k+1);e=p-1;break;case "(":case "{":h();p=e+1;u.push(["open",r]);break;case ")":case "}":h();p=e+1;u.push(["close",r]);break;default:if(/\s/.test(r)){h();for(k=e+1;k<y.length&&/\s/.test(y[k]);)k++;h("space",k);e=p-1}}}h();return u}x.exports={fn:function(g){var h=u(g);g=Function.prototype.toString.call(g);for(var y=G(g),W="anonymous",p=!1,k=!0,e=[],r;(r=y.shift())&&"{"!=r[1];)"content"==r[0]?(k=!0,p?e.push(r[1]):"function"!=r[1]&&(W=r[1])):
p||(p=k&&"("==r[1]);for(;(r=y.pop())&&"}"!=r[1];);for(p=0;p<y.length;p++)y[p]=y[p][1];e=e.join("").trim().replace(/\s*,\s*/g,", ");return{source:g,name:W,fullname:W+"("+e+")",args:e,body:y.join(""),getter:h!=g?h:!1}}}},"5.js":function(h,x,g,E,F,C,I,Y){var u="undefined"!==typeof performance?performance:Date,G="webkitNow"in u?"webkitNow":"now";x.exports={time:function(g){return arguments.length?parseInt(u[G]()-g):u[G]()},test:function(g,h){for(var y=this.time(),u=0;u<g;u++)h(u);return this.time(y)}}},
"6.js":function(h,x,g,E,F,C,I,Y){var u=g.number.lead,G=g.string.repeat,S={};h={add:function(g,h){S[g]=h}};h.add("text",g.array);h.add("js",function(){var g=RegExp("\\b(break|case|catch|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|super|switch|this|throw|true|try|typeof|var|while|with)\\b","g");return function(h){function u(e,k,s,t){r!=k&&p.push(h.substring(r,k).replace(g,'<span class="token-keyword">$1</span>'));r=s+1;e&&p.push('<span class="token-'+e+'">'+h.substring(k,
s+1)+"</span>"+(t||""))}for(var p=[],k=h.split(""),e,r=0,H,s=0;s<k.length;s++)if("'"==k[s]||'"'==k[s])for(H=k[s],e=s;++s<k.length;){"\\"==k[s]&&("\n"==k[s+1]?(u("string",e,s),e=++s+1):s+=2);if(k[s]==H){u("string",e,s);break}if("\n"==k[s])break}else if("/"==k[s])if(e=s,s++,"/"==k[s]){for(;++s<k.length&&"\n"!=k[s];);u("comment",e,s-1)}else if("*"==k[s])for(;++s<k.length;)if("*"==k[s]&&"/"==k[s+1]){u("comment",e,++s);break}else"\n"==k[s]&&(u("comment",e,s-1,"\n"),r=e=s+1);u(null,h.length);return p}}());
h.add("css",function(){var g=RegExp("(^|[^a-z0-9-])((?:-webkit-|-o-|-ms-|-moz-|-khtml-)?(?:transition|transition-delay|transition-duration|transition-property|transition-timing-function|transform|transform-origin|background-origin|background-clip|background-size|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-radius|border-top-right-radius|border-bottom-right-radius|border-bottom-left-radius|border-top-left-radius|box-decoration-break|box-shadow|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|columns|column-span|column-width)|(?:azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-collapse|border-color|border-spacing|border-style|border-top|border-right|border-bottom|border-left|border-top-color|border-right-color|border-bottom-color|border-left-color|border-top-style|border-right-style|border-bottom-style|border-left-style|border-top-width|border-right-width|border-bottom-width|border-left-width|border-width|border|bottom|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-right|margin-left|margin-top|margin-bottom|margin|max-height|max-width|min-height|min-width|orphans|outline-color|outline-style|outline-width|outline|overflow|padding-top|padding-right|padding-bottom|padding-left|padding|page-break-after|page-break-before|page-break-inside|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|table-layout|text-align|text-decoration|text-indent|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index))(s|:|$)",
"gi"),h=RegExp("\\b(left-side|far-left|left|center-left|center-right|center|far-right|right-side|right|behind|leftwards|rightwards|inherit|scroll|fixed|transparent|none|repeat-x|repeat-y|repeat|no-repeat|collapse|separate|auto|top|bottom|both|open-quote|close-quote|no-open-quote|no-close-quote|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|text|wait|help|ltr|rtl|inline|block|list-item|run-in|compact|marker|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|below|level|above|higher|lower|show|hide|caption|icon|menu|message-box|small-caption|status-bar|normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|italic|oblique|small-caps|bold|bolder|lighter|inside|outside|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|crop|cross|invert|visible|hidden|always|avoid|x-low|low|medium|high|x-high|static|relative|absolute|portrait|landscape|spell-out|once|digits|continuous|code|x-slow|slow|fast|x-fast|faster|slower|justify|underline|overline|line-through|blink|capitalize|uppercase|lowercase|embed|bidi-override|baseline|sub|super|text-top|middle|text-bottom|silent|x-soft|soft|loud|x-loud|pre|nowrap|serif|sans-serif|cursive|fantasy|monospace|empty|string|strict|loose|char|true|false|dotted|dashed|solid|double|groove|ridge|inset|outset|larger|smaller|xx-small|x-small|small|large|x-large|xx-large|all|newspaper|distribute|distribute-all-lines|distribute-center-last|inter-word|inter-ideograph|inter-cluster|kashida|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|keep-all|break-all|break-word|lr-tb|tb-rl|thin|thick|inline-block|w-resize|hand|distribute-letter|distribute-space|whitespace|ignore)\\b",
"g");return function(u){function p(e,p,r,s){if(H!=p){var t=u.substring(H,p);B&&(t=A?t.replace(h,'<span class="token-value">$1</span>'):t.replace(g,'$1<span class="token-key">$2</span>$3'));k.push(t)}H=r+1;e&&k.push('<span class="token-'+e+'">'+u.substring(p,r+1)+"</span>"+(s||""))}for(var k=[],e=u.split(""),r=0,H=0,s,B=!1,A=!1,x=!1,t=0;t<e.length;t++)if("'"==e[t]||'"'==e[t])for(s=e[t],r=t;++t<e.length;){if(e[t]==s){p("string",r,t);break}if("\n"==e[t])break;"\\"==e[t]&&"\n"==e[t+1]&&(p("string",r,
t),r=++t+1)}else if("/"==e[t]){if(r=t,t++,"*"==e[t])for(;++t<e.length;)if("*"==e[t]&&"/"==e[t+1]){p("comment",r,++t);break}else"\n"==e[t]&&(p("comment",r,t-1,"\n"),H=r=t+1)}else"{"==e[t]?(B=!0,x=A=!1,r=t+1,p("",r,t)):"("==e[t]?A&&(x=!0):")"==e[t]?A&&(x=!1):":"==e[t]?B&&!x&&(r=t+1,p("",r,t),A=!0):";"==e[t]?B&&!x&&(r=t+1,p("",r,t),A=!1):"}"==e[t]&&(A=B=!1);p(null,u.length);return k}}());x.exports={highlight:function(g,h,x){x||(x={});g=(S[h]||S.text)(function(e){e=e.trimRight().replace(/\r\n|\n\r|\r/g,
"\n");x.keepFormat||(e=e.replace(/^(?:\s*[\n]+)+?([ \t]*)/,"$1"));e=e.replace(/\n[ \t]+/g,function(e){return e.replace(/\t/g," ")}).replace(/\n[ \t]+\n/g,"\n\n");if(!x.keepFormat){for(var g=1E3,h=e.split(/\n+/),k=Number(null!=e.match(/^function/));k<h.length;k++){var p=h[k].match(/^\s*/);p[0].length<g&&(g=p[0].length);if(0==g)break}0<g&&(e=e.replace(RegExp("(^|\\n) {"+g+"}","g"),"$1"))}return e=e.replace(RegExp("(^|\\n)( +)","g"),function(e,g,h){return g+G(" ",h.length)})}(g||"").replace(/</g,"<")).join("").split("\n");
h=String(g.length).length;for(var p=[],k=x.noLineNumber?"":" hasLineNumber",e=0;e<g.length;e++)p.push('<div class="line '+(e%2?"odd":"even")+k+'"><span class="lineContent">'+(x.noLineNumber?"":'<input class="lineNumber" value="'+u(e+1,h)+'" type="none" unselectable="on" readonly="readonly" tabindex="-1" /><span class="over"></span>')+(g[e]+"\r\n")+"</span></div>");return p.join("")},useStyle:g.fn.runOnce(function(){g.resource("./0.css")().startUse()})}}};(function(h){function x(a,b){for(var c in b)a[c]=
b[c];return a}function g(a,b){for(var c in b)!1==c in a&&(a[c]=b[c]);return a}function E(a){var b=[],c;for(c in a)b.push(c);return b}function F(a,b){var c={};if(!b)return x(c,a);for(var d=0,e;e=b[d++];)e in a&&(c[e]=a[e]);return c}function C(){return p(arguments).reduce(x,{})}function I(a,b,c){var d=[],e;for(e in a)d.push(b.call(c,e,a[e]));return d}function Y(a){return a}function u(){}function G(a){var b=d[a.url];if(b)for(var c=0;c<b.length;c++)b[c](a.get(),a.url)}function S(a,b,c){try{return new Function(b,
c)}catch(d){B.error("Compilation error at "+a+("line"in d?":"+(d.line-1):"")+": "+d)}}function P(a){var b=a.split(".")[0],c=a.replace(/\./g,"/")+".js";!1==a in J&&(!1==b in ba&&(ba[b]=v.baseURI),b==a&&(ea[ba[b]+c]=b),J[a]=ba[b]+c);return J[a]}function y(a){a=a.split(".");var b;b=a[0];var c=n[b];c||(c=n[b]=new U(b),c.namespaces_={},c.namespaces_[b]=c,M.noConflict||(h[b]=c));for(var c=b=c,d=1,e;e=a[d];d++){if(!c[e]){var g=a.slice(0,d+1).join(".");c[e]=new U(g);b.namespaces_[g]=c[e]}c=c[e]}return n[a.join(".")]=
c}function W(a,b){if(M.extProto)for(var c in b)a.prototype[c]=function(a,f){return function(){var f=[this];Array.prototype.push.apply(f,arguments);return b[a].apply(b,f)}}(c,a.name||a.toString().match(/^\s*function\s*(\w*)\s*\(/)[1])}function p(a,b){if(null!=a){var c=a.length;if("undefined"==typeof c||"[object Function]"==r.call(a))return[a];b||(b=0);if(0<c-b){for(var d=[],e=0,g=b;g<c;)d[e++]=a[g++];return d}}return[]}function k(a,b,c){for(var d=[],e="function"==typeof b,g=0;g<a;g++)d[g]=e?b.call(c,
g,d):b;return d}var e=h.document,r=Object.prototype.toString,H=function(){function a(f){if(c.test(f)){var b=f.split("."),l=b[0],d=b[1],e=b[2];switch(b.length){case 1:f=function(a){return null!=a?a[l]:a};break;case 2:f=function(a){return null!=a?a[l][d]:a};break;case 3:f=function(a){return null!=a?a[l][d][e]:a};break;default:f=function(a){if(null!=a){a=a[l][d][e];for(var f=3,c;c=b[f];f++)a=a[c]}return a}}return f}return new Function("object","return object != null ? object."+f+" : object")}var b=1,
c=/^[a-z$_][a-z$_0-9]*(\.[a-z$_][a-z$_0-9]*)*$/i,d=[],e={},g={};return function(c,z){var h,k,m;if(!c||c===s)return s;"function"==typeof c?(m=c.basisGetterId_)?h=d[Math.abs(m)-1]:(h=function(a){return c(a)},h.base=c,h.__extend__=H,m=d.push(h),c.basisGetterId_=-m,h.basisGetterId_=m):(h=e[c])?m=h.basisGetterId_:(h=a(c),h.base=c,h.__extend__=H,m=d.push(h),h.basisGetterId_=m,e[c]=h);k=null!=z&&typeof z;if(!k)return h;var n=g[m],p;if("string"==k)p=k+z;else if("function"==k)p=z.basisModId_;else if("object"!=
k)return h;if(p&&n&&n[p])return n[p];"function"==typeof h.base&&(h=h.base);switch(k){case "string":k=function(a){return ha.format(z,h(a))};break;case "function":p||(p=k+b++,z.basisModId_=p);k=function(a){return z(h(a))};break;default:k=function(a){return z[h(a)]}}k.base=h.base||h;k.__extend__=H;p&&(n||(n={},g[m]=n),n[p]=k,k.mod=z,k.basisGetterId_=d.push(k));return k}}(),s=x(function(){},{__extend__:H}),B=function(){var a={log:u,info:u,warn:u,error:u};"undefined"!=typeof console&&I(a,function(b){a[b]=
"bind"in Function.prototype&&"function"==typeof console[b]?Function.prototype.bind.call(console[b],console):function(){Function.prototype.apply.call(console[b],console,arguments)}});return a}(),A=h.setImmediate||h.msSetImmediate,R=h.clearImmediate||h.msSetImmediate;A&&(A=A.bind(h));R&&(R=R.bind(h));A||function(){var a=function(){var a={},f=1;A=function(){a[++f]={fn:arguments[0],args:p(arguments,1)};b(f);return f};R=function(f){delete a[f]};return function(f){var b=a[f];if(b)try{"function"==typeof b.fn?
b.fn.apply(void 0,b.args):(h.execScript||function(a){h.eval.call(h,a)})(String(b.fn))}finally{delete a[f]}}}(),b=function(b){setTimeout(function(){a(b)},0)};if(h.process&&"function"==typeof process.nextTick)b=function(b){process.nextTick(function(){a(b)})};else if(h.MessageChannel)b=function(b){var c=new h.MessageChannel;c.port1.onmessage=function(){a(b)};c.port2.postMessage("")};else{var c=h.postMessage&&!h.importScripts;if(c){var d=h.onmessage;h.onmessage=function(){c=!1};h.postMessage("","*");
h.onmessage=d}if(c)d=function(b){b&&b.source==h&&(b=String(b.data).split("basisjs.setImmediate")[1])&&a(b)},h.addEventListener?h.addEventListener("message",d,!0):h.attachEvent("onmessage",d),b=function(a){h.postMessage("basisjs.setImmediate"+a,"*")};else if(e&&"onreadystatechange"in e.createElement("script"))var g=b,b=function na(c){"undefined"!=typeof Z&&(b=g,Z.head.ready(function(){b=function(b){var c=e.createElement("script");c.onreadystatechange=function(){a(b);c.onreadystatechange=null;Z.remove(c);
c=null};Z.head.add(c)}}));b===na?g(c):b(c)}}}();var t="object"==typeof process&&"[object process]"==r.call(process),v=function(){var a=/^([^\/]+:|\/)/,b=/^[a-zA-Z0-9\-]+:\/?/,c=/^(?:[a-zA-Z0-9\-]+:)?\/\/[^\/]+\/?/,d=/[\?#].*$/,e={},g="",h;t?(g=require("path").resolve(".").replace(/\\/g,"/"),h=g.replace(/^[^\/]*/,""),g=g.replace(/\/.*/,"")):(h=location.pathname.replace(/[^\/]+$/,""),g=location.protocol+"//"+location.host);return e={baseURI:h,origin:g,normalize:function(a){a=(a||"").replace(b,"/").replace(c,
"/").replace(d,"");for(var f=[],e=a.split("/"),g=0;g<e.length;g++)".."==e[g]?(1<f.length||f[0])&&f.pop():!e[g]&&g||"."==e[g]||f.push(e[g]);return f.join("/")||("/"===a[0]?"/":"")},dirname:function(a){a=e.normalize(a);return a.replace(/\/([^\/]*)$|^[^\/]+$/,"")||("/"==a[0]?"/":".")},extname:function(a){return(a=e.normalize(a).match(/[^\/](\.[^\/\.]*)$/))?a[1]:""},basename:function(a,b){var f=e.normalize(a).match(/[^\\\/]*$/),f=f?f[0]:"";b==e.extname(f)&&(f=f.substring(0,f.length-b.length));return f},
resolve:function(b,c){for(var d=p(arguments).reverse(),l=[],g=!1,z=0;!g&&z<d.length;z++)"string"==typeof d[z]&&(l.unshift(d[z]),g=a.test(d[z]));g||l.unshift("/"==h?"":h);return e.normalize(l.join("/"))},relative:function(a,b){"string"!=typeof b&&(b=a,a=h);a=e.normalize(a);b=e.normalize(b);if("/"==a[0]&&"/"!=b[0])return a;if("/"==b[0]&&"/"!=a[0])return b;for(var f=a.replace(/^\/$/,"").split(/\//),c=b.replace(/^\/$/,"").split(/\//),d=[],l=0;c[l]==f[l]&&"string"==typeof f[l];)l++;for(f=f.length-l;0<
f;f--)d.push("..");return d.concat(c.slice(l).filter(Boolean)).join("/")}}}(),M={path:{basis:""}},N=function(){function a(b){return"function"==typeof b&&!!b.basisClassId_}function b(a){for(var f=this;f&&f!==a;)f=f.superClass_;return f===a}function c(k,n){var q=g++;"function"!=typeof k&&(k=m);var r=function(){};r.prototype=k.prototype;for(var r=new r,q={basisClassId_:q,superClass_:k,extendConstructor_:!!k.extendConstructor_,isSubclassOf:b,subclass:function(){return c.apply(null,[u].concat(p(arguments)))},
extend:d,__extend__:function(b){return b&&b!==h&&("object"==typeof b||"function"==typeof b&&!a(b))?m.create.call(null,u,b):b},prototype:r},s=1,t;t=arguments[s];s++)q.extend(t);var u=q.extendConstructor_?function(a){this.basisObjectId=e.id++;var b,f;for(f in a)b=this[f],this[f]=b&&b.__extend__?b.__extend__(a[f]):a[f];this.init();this.postInit()}:function(){this.basisObjectId=e.id++;this.init.apply(this,arguments);this.postInit()};r.constructor=u;for(var v in r)r[v]===h&&(r[v]=u);x(u,q);return u}function d(b){var c=
this.prototype;"function"!=typeof b||a(b)||(b=b(this.superClass_.prototype));b.prototype&&(b=b.prototype);for(var l in b){var e=b[l],g=c[l];"className"==l||"extendConstructor_"==l?this[l]=e:c[l]=g&&g.__extend__?g.__extend__(e):e}k&&b[l="toString"]!==r&&(c[l]=b[l]);return this}var e={id:1},g=1,h={},k=function(){for(var a in{toString:1})return!1;return!0}(),m=x(c,{className:"basis.Class",extendConstructor_:!1,prototype:{basisObjectId:0,constructor:null,init:function(){},postInit:function(){},destroy:function(){for(var a in this)hasOwnProperty.call(this,
a)&&(this[a]=null);this.destroy=u}}}),n=function(a,b,f){return{__extend__:function(a){if(!a||a&&a.__extend__)return a;var f=function(){};f.prototype=this;f=new f;b(f,a);return f}}.__extend__(a||{})},q=function(a){return n(a,x,"extensibleProperty")};return x(m,{SELF:h,create:c,isClass:a,customExtendProperty:n,extensibleProperty:q,nestedExtendProperty:function(a){return n(a,function(a,b){for(var f in b){var c=a[f];a[f]=c&&c.__extend__?c.__extend__(b[f]):q(b[f])}},"nestedExtendProperty")},oneFunctionProperty:function(a,
b){var f=function(b){var c={__extend__:f};if(b){if(b.__extend__)return b;for(var d in b)b[d]&&(c[d]=a)}return c};return f(b||{})}})}(),D=N(null,{className:"basis.Token",value:null,handler:null,deferredToken:null,bindingBridge:{attach:function(a,b,c){a.attach(b,c)},detach:function(a,b,c){a.detach(b,c)},get:function(a){return a.get()}},init:function(a){this.value=a},get:function(){return this.value},set:function(a){this.value!==a&&(this.value=a,this.apply())},attach:function(a,b){this.handler={fn:a,
context:b,handler:this.handler}},detach:function(a,b){for(var c=this,d;d=c,c=c.handler;)if(c.fn===a&&c.context===b){c.fn=u;d.handler=c.handler;break}},apply:function(){for(var a=this.get(),b=this;b=b.handler;)b.fn.call(b.context,a)},deferred:function(){var a=this.deferredToken;a||(a=this.deferredToken=new O(this.value),this.attach(a.set,a));return a},destroy:function(){this.deferredToken&&(this.deferredToken.destroy(),this.deferredToken=null);this.value=this.handler=null;this.detach=this.attach=u}}),
T=function(){function a(){var f=b;b={};c=null;for(var d in f)f[d].apply()}var b={},c;return function(d){d.basisObjectId in b||(b[d.basisObjectId]=d,c||A(a))}}(),O=D.subclass({className:"basis.DeferredToken",set:function(a){this.value!==a&&(this.value=a,T(this))},deferred:function(){return this}}),a={},b={},d={};(function(){var a="undefined"!=typeof la?la:null;if(a){for(var c in a)b[v.resolve(c)]=a[c];la=null}})();var m=function(a,c){if(c||!b.hasOwnProperty(a)){var d="";if(t)try{d=require("fs").readFileSync(a,
"utf-8")}catch(e){}else{var g=new XMLHttpRequest;g.open("GET",a,!1);g.setRequestHeader("If-Modified-Since",(new Date(0)).toGMTString());g.setRequestHeader("X-Basis-Resource",1);g.send("");200<=g.status&&400>g.status&&(d=g.responseText)}b[a]=d}return b[a]},q=function(f){f=v.resolve(f);if(!a[f]){var c=q.extensions[v.extname(f)],d=!1,e=!1,g,h=function(){if(d)return g;var a=m(f);c?e||(e=!0,g=c(a,f)):g=a;d=!0;G(h);h.apply();return g};x(h,x(new D,{url:f,fetch:function(){return h()},toString:function(){return"[basis.resource "+
f+"]"},isResolved:function(){return d},update:function(a){a=String(a);d&&a==b[f]||(b[f]=a,c?e&&!c.permanent&&(g=c(a,f),G(h),h.apply()):(g=a,d=!0,G(h),h.apply()))},reload:function(){var a=b[f],c=m(f,!0);c!=a&&(d=!1,h.update(c))},get:function(a){return a?m(f):h()},ready:function(a,b){if(d&&(a.call(b,h()),c&&c.permanent))return;h.attach(a,b);return h}}));a[f]=h}return a[f]};x(q,{isResource:function(b){return b?a[b.url]===b:!1},isResolved:function(a){return(a=q.get(a))?a.isResolved():!1},exists:function(b){return a.hasOwnProperty(v.resolve(b))},
get:function(a){a=v.resolve(a);return q.exists(a)?q(a):null},getFiles:function(f){return E(f?b:a).map(v.relative)},extensions:{".js":x(function(a,b){var c=ea[b];if(!c){var d=!0,c=v.dirname(b)+"/"+v.basename(b,v.extname(b)),e;for(e in M.path){var h=M.path[e]+e+"/";if(b.substr(0,h.length)==h){d=!1;c=c.substr(M.path[e].length);break}}c=c.replace(/\./g,"_").replace(/^\//g,"").replace(/\//g,".");d&&(c="implicit."+c)}n[c]||(e=y(c),e.exports=$({path:e.path,exports:e.exports},b,a).exports,e.exports&&e.exports.constructor===
Object&&g(e,e.exports));return n[c].exports},{permanent:!0}),".css":function(a,b){var c=ka.resources[b];c?c.updateCssText(a):c=new ka(b);return c},".json":function(a,b){if("object"==typeof a)return a;var c;try{a=String(a),c=L.json.parse(a)}catch(d){}return c||null}}});var $=function(a,b,c){var d=v.dirname(b)+"/",e=c;a.exports||(a.exports={});"function"!=typeof e&&(e=S(b,"exports module basis global __filename __dirname resource require".split(" "),'"use strict";\n'+c));"function"==typeof e&&e.call(a.exports,
a.exports,a,L,h,b,d,function(a){return q(v.resolve(d,a))},function(a,b){return X(a,b||d)});return a},n={},J={},ea={},ba=F(M.path);(function(a){if(a="undefined"!=typeof ma?ma:null)for(var b in a){var c=v.resolve(b),d=a[b];ea[c]=d;J[d]=c}})();var U=N(null,{className:"basis.Namespace",init:function(a){this.name=a;this.exports={path:this.name}},toString:function(){return"[basis.namespace "+this.path+"]"},extend:function(a){x(this.exports,a);return g(this,a)}}),X=function(){if(t){var a=module.constructor.prototype;
return function(b,c){if(/[^a-z0-9_\.]/i.test(b)&&".js"!=v.extname(b))return b=v.resolve(c,b),require(b);var d=a._compile,e=y(b);a._compile=function(a,b){this.basis=L;a='var node_require = require;\nvar basis = module.basis;\nvar resource = function(filename){ return basis.resource(__dirname + "/" + filename) };\nvar require = function(filename, baseURI){ return basis.require(filename, baseURI || __dirname) };\n'+a;d.call(x(this,e),a,b)};var h=require(__dirname+"/"+b.replace(/\./g,"/"));(e.exports=
h)&&h.constructor===Object&&g(e,h);a._compile=d;return h}}return function(a,b){a=/[^a-z0-9_\.]/i.test(a)||".js"==v.extname(a)?v.resolve(b,a):P(a);return q(a).fetch()}}();g(Function.prototype,{bind:function(a){var b=this,c=p(arguments,1);return c.length?function(){return b.apply(a,c.concat.apply(c,arguments))}:function(){return b.apply(a,arguments)}}});g(Array,{isArray:function(a){return"[object Array]"===r.call(a)}});g(Array.prototype,{indexOf:function(a,b){b=parseInt(b,10)||0;if(0>b)return-1;for(;b<
this.length;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a,b){var c=this.length;b=parseInt(b,10);for(b=isNaN(b)||b>=c?c-1:(b+c)%c;0<=b;b--)if(this[b]===a)return b;return-1},forEach:function(a,b){for(var c=0,d=this.length;c<d;c++)c in this&&a.call(b,this[c],c,this)},every:function(a,b){for(var c=0,d=this.length;c<d;c++)if(c in this&&!a.call(b,this[c],c,this))return!1;return!0},some:function(a,b){for(var c=0,d=this.length;c<d;c++)if(c in this&&a.call(b,this[c],c,this))return!0;return!1},
filter:function(a,b){for(var c=[],d=0,e=this.length;d<e;d++)d in this&&a.call(b,this[d],d,this)&&c.push(this[d]);return c},map:function(a,b){for(var c=[],d=0,e=this.length;d<e;d++)d in this&&(c[d]=a.call(b,this[d],d,this));return c},reduce:function(a,b){var c=this.length,d=arguments.length;if(0==c&&1==d)throw 1;var e,g=0;1<d&&(e=b,g=1);for(d=0;d<c;d++)d in this&&(e=g++?a.call(null,e,this[d],d,this):this[d]);return e}});var V={flatten:function(a){return a.concat.apply([],a)},repeat:function(a,b){return V.flatten(k(parseInt(b,
10)||0,a))},search:function(a,b,c,d){a.lastSearchIndex=-1;c=H(c||Y);d=parseInt(d,10)||0;for(var e=a.length;d<e;d++)if(c(a[d])===b)return a[a.lastSearchIndex=d]},lastSearch:function(a,b,c,d){a.lastSearchIndex=-1;c=H(c||Y);var e=a.length;d=isNaN(d)||null==d?e:parseInt(d,10);for(e=d>e?e:d;0<e--;)if(c(a[e])===b)return a[a.lastSearchIndex=e]},add:function(a,b){return-1==a.indexOf(b)&&!!a.push(b)},remove:function(a,b){var c=a.indexOf(b);return-1!=c&&!!a.splice(c,1)},has:function(a,b){return-1!=a.indexOf(b)},
sortAsObject:function(a,b,c,d){b=H(b);d=d?-1:1;return a.map(function(a,c){return{i:c,v:b(a)}}).sort(c||function(a,b){return d*(a.v>b.v||-(a.v<b.v)||(a.i>b.i?1:-1))}).map(function(b){return a[b.i]},a)}};W(Array,V);if(![1,2].splice(1).length){var da=Array.prototype.splice;Array.prototype.splice=function(){var a=p(arguments);2>a.length&&(a[1]=this.length);return da.apply(this,a)}}var fa=/([\/\\\(\)\[\]\?\{\}\|\*\+\-\.\^\$])/g,c=/\{([a-z\d_]+)(?::([\.0])(\d+)|:(\?))?\}/gi;g(String,{toLowerCase:function(a){return String(a).toLowerCase()},
toUpperCase:function(a){return String(a).toUpperCase()},trim:function(a){return String(a).trim()},trimLeft:function(a){return String(a).trimLeft()},trimRight:function(a){return String(a).trimRight()}});g(String.prototype,{trimLeft:function(){return this.replace(/^\s+/,"")},trimRight:function(){return this.replace(/\s+$/,"")},trim:function(){return this.trimLeft().trimRight()}});var ha={toObject:function(a,b){try{return(new Function("return 0,"+a))()}catch(c){if(b)throw 2;}},repeat:function(a,b){return Array(parseInt(b,
10)+1||0).join(a)},qw:function(a){return(a=a.trim())?a.split(/\s+/):[]},forRegExp:function(a){return a.replace(fa,"\\$1")},format:function(a,b){var d=p(arguments,1);"object"==typeof b&&x(d,b);return a.replace(c,function(a,b,c,f,e){a=b in d?d[b]:e?"":a;return c&&!isNaN(a)?(a=Number(a),"."==c?a.toFixed(f):ia.lead(a,f)):a})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()},camelize:function(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})},dasherize:function(a){return a.replace(/[A-Z]/g,
function(a){return"-"+a.toLowerCase()})}};W(String,ha);if(11!="|||".split(/\|/).length+"|||".split(/(\|)/).length){var w=String.prototype.split;String.prototype.split=function(a,b){if(!a||!1==a instanceof RegExp||""==a.source)return w.apply(this,arguments);var c=[],d=0,e;for(a.global||(a=RegExp(a.source,/\/([mi]*)$/.exec(a)[1]+"g"));e=a.exec(this);)e[0]=this.substring(d,e.index),c.push.apply(c,e),d=a.lastIndex;c.push(this.substr(d));return c}}if("2"!="12".substr(-1)){var ca=String.prototype.substr;
String.prototype.substr=function(a,b){return ca.call(this,0>a?Math.max(0,this.length+a):a,b)}}var ia={fit:function(a,b,c){return!isNaN(b)&&a<b?Number(b):!isNaN(c)&&a>c?Number(c):a},lead:function(a,b,c){return String(a).replace(/\d+/,function(a){return 1<(b-=a.length-1)?Array(b).join(c||0)+a:a})},group:function(a,b,c){return String(a).replace(/\d+/,function(a){return a.replace(/\d/g,function(d,f){return!f+(a.length-f)%(b||3)?d:(c||" ")+d})})},format:function(a,b,c,d,e,g){a=a.toFixed(b);if(c||g)a=a.replace(/(\d+)(\.?)/,
function(a,b,d){return(c?L.number.group(Number(b),3,c):b)+(d?g||d:"")});d&&(a=a.replace(/^-?/,"$&"+(d||"")));return a+(e||"")}};W(Number,ia);g(Date,{now:function(){return Number(new Date)}});var ja=function(){function a(){if("complete"==e.readyState&&e.body&&!c++)for(;d;)d.callback.call(d.context),d=d.next}function b(){try{e.documentElement.doScroll("left"),a()}catch(c){setTimeout(b,1)}}var c=!e||"complete"==e.readyState&&!!e.body,d;if(!c)if(e.addEventListener)e.addEventListener("DOMContentLoaded",
a,!1),h.addEventListener("load",a,!1);else{e.attachEvent("onreadystatechange",a);h.attachEvent("onload",a);try{!h.frameElement&&e.documentElement.doScroll&&b()}catch(g){}}return function(a,b){c?a.call(b):d={callback:a,context:b,next:d}}}(),Z=function(){function a(b){if(e&&!h[b]&&(h[b]=e[b]||e.getElementsByTagName(b)[0],h[b])){var c=k[b];delete k[b];for(var d=0,f;f=c[d];d++)f[0].call(f[1],h[b])}return h[b]}function b(){var d=this[0],e=this[1],g=this[2];c(e);var h=a(d);h?(!0===g&&(g=h.firstChild),g&&
g.parentNode===h||(g=null),h.insertBefore(e,g)):k[d].push([b,[d,e,g]])}function c(a){for(var b in k){var d=V.search(k[b],a,function(a){return a[1]&&a[1][1]});d&&V.remove(k[b],d)}a&&a.parentNode&&1==a.parentNode.nodeType&&a.parentNode.removeChild(a)}function d(){g&&a("head")&&a("body")&&(g=clearInterval(g))}var g,h={},k={head:[],body:[]};!e||a("head")&&a("body")||(g=setInterval(d,5),ja(d));return{head:{ready:function(a,b){k.head?k.head.push([a,b]):a.call(b,h.head)},add:function(a,c){b.call(["head",
a,c])}},body:{ready:function(a,b){k.body?k.body.push([a,b]):a.call(b,h.body)},add:function(a,c){b.call(["body",a,c])}},remove:c}}(),ga=function(){function a(d){c.globalDestroy=!0;c.add=u;for(c.remove=u;d=b.pop();)if("function"==typeof d.destroy)try{d.destroy()}catch(f){}else for(var e in d)d[e]=null;b.length=0}var b=[];if("attachEvent"in h)h.attachEvent("onunload",a);else if("addEventListener"in h)h.addEventListener("unload",a,!1);else return{add:u,remove:u};var c={add:function(a){null!=a&&b.push(a)},
remove:function(a){V.remove(b,a)}};return c}(),ka=function(){function a(b){m.setAttribute("href",b);Z.head.add(m,!0)}function b(){m.setAttribute("href",location.href);Z.remove(m)}function c(){a(this.baseURI);this.element||(this.element=e.createElement("style"),h||(this.textNode=this.element.appendChild(e.createTextNode(""))));Z.head.add(this.element);this.syncCssText();b()}var d={},g=!0,h;try{h=!e.createElement("style").appendChild(e.createTextNode(""))}catch(k){h=!0}ga.add({destroy:function(){g=
!1;for(var a in d)d[a].destroy();d=null}});var m=e&&e.createElement("base"),n=N(null,{className:"basis.CssResource",inUse:0,url:"",baseURI:"",cssText:"",resource:null,element:null,textNode:null,init:function(a){this.url=v.resolve(a);this.baseURI=v.dirname(a)+"/";d[a]=this},updateCssText:function(c){this.cssText!=c&&(this.cssText=c,this.inUse&&this.element&&(a(this.baseURI),this.syncCssText(),b()))},syncCssText:function(){this.textNode?this.textNode.nodeValue=this.cssText:this.element.styleSheet.cssText=
this.cssText},startUse:function(){if(!this.inUse){if(!this.resource){var a=q(this.url);this.resource=a;this.cssText=a.get(!0)}Z.head.ready(c,this)}this.inUse+=1},stopUse:function(){this.inUse&&(this.inUse-=1,!this.inUse&&this.element&&Z.remove(this.element))},destroy:function(){this.element&&g&&Z.remove(this.element);this.cssText=this.resource=this.textNode=this.element=null}});n.resources=d;return n}(),L=y("basis").extend({version:"1.2.1",NODE_ENV:t,config:M,platformFeature:{},resolveNSFilename:P,
patch:function(a,b){a=/[^a-z0-9_\.]/i.test(a)||".js"==v.extname(a)?v.resolve(a):P(a);d[a]?d[a].push(b):d[a]=[b];var c=q.get(a);c&&c.isResolved()&&b(c.get(),c.url)},namespace:y,require:X,resource:q,asset:function(a){return a},setImmediate:A,clearImmediate:R,nextTick:function(){A.apply(null,arguments)},Class:N,Token:D,DeferredToken:O,getter:H,ready:ja,cleaner:ga,console:B,path:v,doc:Z,object:{extend:x,complete:g,keys:E,values:function(a){var b=[],c;for(c in a)b.push(a[c]);return b},slice:F,splice:function(a,
b){var c={};if(!b)return x(c,a);for(var d=0,e;e=b[d++];)e in a&&(c[e]=a[e],delete a[e]);return c},merge:C,iterate:I},fn:{$undefined:function(a){return void 0==a},$defined:function(a){return void 0!=a},$isNull:function(a){return null==a||void 0==a},$isNotNull:function(a){return null!=a&&void 0!=a},$isSame:function(a){return a===this},$isNotSame:function(a){return a!==this},$self:Y,$const:function(a){return function(){return a}},$false:function(){return!1},$true:function(){return!0},$null:function(){return null},
$undef:u,getter:H,nullGetter:s,wrapper:function(a){return function(b){var c={};c[a]=b;return c}},lazyInit:function(a,b){var c=0,d,e;return d=function(){c++||(d.inited=!0,d.data=e=a.apply(b||this,arguments));return e}},lazyInitAndRun:function(a,b,c){var d=0,e,g;return e=function(){d++||(e.inited=!0,e.data=g=a.call(c||this));b.apply(g,arguments);return g}},runOnce:function(a,b){var c=0;return function(){if(!c++)return a.apply(b||this,arguments)}}},array:x(p,C(V,{from:p,create:k})),string:C(ha,{isEmpty:function(a){return null==
a||""==String(a)},isNotEmpty:function(a){return null!=a&&""!=String(a)}}),number:ia,bool:{invert:function(a){return!a}},json:{parse:"undefined"!=typeof JSON?JSON.parse:function(a){return ha.toObject(a,!0)}}});y("basis.dev").extend(B);M.autoload&&X(M.autoload)})(this)}).call(this)