-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdfstore_min.js
900 lines (895 loc) · 438 KB
/
rdfstore_min.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
/*
BSD 3-Clause License
Copyright (c) 2011-2015 Digital Bazaar, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the Digital Bazaar, Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
!function(Cc){if("object"==typeof exports)module.exports=Cc();else if("function"==typeof define&&define.amd)define(Cc);else{var z;"undefined"!=typeof window?z=window:"undefined"!=typeof global?z=global:"undefined"!=typeof self&&(z=self);z.rdfstore=Cc()}}(function(){return function z(B,C,v){function h(a,b){if(!C[a]){if(!B[a]){var k="function"==typeof require&&require;if(!b&&k)return k(a,!0);if(c)return c(a,!0);throw Error("Cannot find module '"+a+"'");}k=C[a]={exports:{}};B[a][0].call(k.exports,function(b){var d=
B[a][1][b];return h(d?d:b)},k,k.exports,z,B,C,v)}return C[a].exports}for(var c="function"==typeof require&&require,b=0;b<v.length;b++)h(v[b]);return h}({1:[function(z,B,C){(function(v,h){(function(){function c(d){return"function"===typeof d}function b(){var a=v.nextTick,b=v.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);Array.isArray(b)&&"0"===b[1]&&"10"===b[2]&&(a=setImmediate);return function(){a(d)}}function a(){return function(){ya(d)}}function f(){var a=0,b=new sa(d),c=document.createTextNode("");
b.observe(c,{characterData:!0});return function(){c.data=a=++a%2}}function k(){var a=new MessageChannel;a.port1.onmessage=d;return function(){a.port2.postMessage(0)}}function r(){return function(){setTimeout(d,1)}}function d(){for(var d=0;d<C;d+=2)(0,ba[d])(ba[d+1]),ba[d]=void 0,ba[d+1]=void 0;C=0}function l(){try{var d=z("vertx");ya=d.runOnLoop||d.runOnContext;return a()}catch(b){return r()}}function m(){}function u(d,a,b,c){try{d.call(a,b,c)}catch(f){return f}}function n(d,a,b){I(function(d){var c=
!1,f=u(b,a,function(b){c||(c=!0,a!==b?E(d,b):M(d,b))},function(a){c||(c=!0,F(d,a))},"Settle: "+(d._label||" unknown promise"));!c&&f&&(c=!0,F(d,f))},d)}function x(d,a){1===a._state?M(d,a._result):2===a._state?F(d,a._result):H(a,void 0,function(a){E(d,a)},function(a){F(d,a)})}function E(d,a){if(d===a)F(d,new TypeError("You cannot resolve a promise with itself"));else if("function"===typeof a||"object"===typeof a&&null!==a)if(a.constructor===d.constructor)x(d,a);else{var b;try{b=a.then}catch(f){da.error=
f,b=da}b===da?F(d,da.error):void 0===b?M(d,a):c(b)?n(d,a,b):M(d,a)}else M(d,a)}function y(d){d._onerror&&d._onerror(d._result);A(d)}function M(d,a){void 0===d._state&&(d._result=a,d._state=1,0!==d._subscribers.length&&I(A,d))}function F(d,a){void 0===d._state&&(d._state=2,d._result=a,I(y,d))}function H(d,a,b,c){var f=d._subscribers,r=f.length;d._onerror=null;f[r]=a;f[r+1]=b;f[r+2]=c;0===r&&d._state&&I(A,d)}function A(d){var a=d._subscribers,b=d._state;if(0!==a.length){for(var c,f,r=d._result,k=0;k<
a.length;k+=3)c=a[k],f=a[k+b],c?P(b,c,f,r):f(r);d._subscribers.length=0}}function D(){this.error=null}function P(d,a,b,f){var r=c(b),k,h,l,n;if(r){try{k=b(f)}catch(I){za.error=I,k=za}k===za?(n=!0,h=k.error,k=null):l=!0;if(a===k){F(a,new TypeError("A promises callback cannot return that same promise."));return}}else k=f,l=!0;void 0===a._state&&(r&&l?E(a,k):n?F(a,h):1===d?M(a,k):2===d&&F(a,k))}function N(d,a){try{a(function(a){E(d,a)},function(a){F(d,a)})}catch(b){F(d,b)}}function W(d,a){this._instanceConstructor=
d;this.promise=new d(m);this._validateInput(a)?(this._input=a,this._remaining=this.length=a.length,this._init(),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&M(this.promise,this._result))):F(this.promise,this._validationError())}function O(d){this._id=fa++;this._result=this._state=void 0;this._subscribers=[];if(m!==d){if(!c(d))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
if(!(this instanceof O))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");N(this,d)}}var J=Array.isArray?Array.isArray:function(d){return"[object Array]"===Object.prototype.toString.call(d)},C=0,ya,L,I=function(a,b){ba[C]=a;ba[C+1]=b;C+=2;2===C&&(L?L(d):ga())},G="undefined"!==typeof window?window:void 0,V=G||{},sa=V.MutationObserver||V.WebKitMutationObserver,V="undefined"!==typeof v&&"[object process]"==={}.toString.call(v),
X="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel,ba=Array(1E3),ga;ga=V?b():sa?f():X?k():void 0===G&&"function"===typeof z?l():r();var da=new D,za=new D;W.prototype._validateInput=function(d){return J(d)};W.prototype._validationError=function(){return Error("Array Methods must be provided an Array")};W.prototype._init=function(){this._result=Array(this.length)};W.prototype._enumerate=function(){for(var d=this.length,a=this.promise,b=
this._input,f=0;void 0===a._state&&f<d;f++)this._eachEntry(b[f],f)};W.prototype._eachEntry=function(d,a){var b=this._instanceConstructor;"object"===typeof d&&null!==d?d.constructor===b&&void 0!==d._state?(d._onerror=null,this._settledAt(d._state,a,d._result)):this._willSettleAt(b.resolve(d),a):(this._remaining--,this._result[a]=d)};W.prototype._settledAt=function(d,a,b){var f=this.promise;void 0===f._state&&(this._remaining--,2===d?F(f,b):this._result[a]=b);0===this._remaining&&M(f,this._result)};
W.prototype._willSettleAt=function(d,a){var b=this;H(d,void 0,function(d){b._settledAt(1,a,d)},function(d){b._settledAt(2,a,d)})};var fa=0;O.all=function(d){return(new W(this,d)).promise};O.race=function(d){function a(d){E(f,d)}function b(d){F(f,d)}var f=new this(m);if(!J(d))return F(f,new TypeError("You must pass an array to race.")),f;for(var c=d.length,r=0;void 0===f._state&&r<c;r++)H(this.resolve(d[r]),void 0,a,b);return f};O.resolve=function(d){if(d&&"object"===typeof d&&d.constructor===this)return d;
var a=new this(m);E(a,d);return a};O.reject=function(d){var a=new this(m);F(a,d);return a};O._setScheduler=function(d){L=d};O._setAsap=function(d){I=d};O._asap=I;O.prototype={constructor:O,then:function(d,a){var b=this._state;if(1===b&&!d||2===b&&!a)return this;var f=new this.constructor(m),c=this._result;if(b){var r=arguments[b-1];I(function(){P(b,f,r,c)})}else H(this,f,d,a);return f},"catch":function(d){return this.then(null,d)}};G=function(){var d;if("undefined"!==typeof h)d=h;else if("undefined"!==
typeof self)d=self;else try{d=Function("return this")()}catch(a){throw Error("polyfill failed because global object is unavailable in this environment");}var b=d.Promise;if(!b||"[object Promise]"!==Object.prototype.toString.call(b.resolve())||b.cast)d.Promise=O};V={Promise:O,polyfill:G};"undefined"!==typeof B&&B.exports?B.exports=V:"undefined"!==typeof this&&(this.ES6Promise=V);G()}).call(this)}).call(this,z("qC859L"),"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{qC859L:24}],
2:[function(z,B,C){},{}],3:[function(z,B,C){(function(v,h,c){(function(){var b="undefined"!==typeof v&&v.versions&&v.versions.node,a=!b&&("undefined"!==typeof window||"undefined"!==typeof self);a&&"undefined"===typeof h&&("undefined"!==typeof window?h=window:"undefined"!==typeof self?h=self:"undefined"!==typeof $&&(h=$));var f=function(f){function d(){}function k(d,a){if(I(a))for(var f=0;f<a.length;++f)a[f]=k(d,a[f]);else if(da(a))a["@list"]=k(d,a["@list"]);else if(L(a)){za(a)&&(a["@id"]=d.getId(a["@id"]));
for(var f=Object.keys(a).sort(),b=0;b<f.length;++b){var c=f[b];"@id"!==c&&(a[c]=k(d,a[c]))}}return a}function m(d,a,b){if(null===b||void 0===b)return null;var c=J(d,a,{vocab:!0});if("@id"===c)return J(d,b,{base:!0});if("@type"===c)return J(d,b,{vocab:!0,base:!0});var k=f.getContextValue(d,a,"@type");if("@id"===k||"@graph"===c&&G(b))return{"@id":J(d,b,{base:!0})};if("@vocab"===k)return{"@id":J(d,b,{vocab:!0,base:!0})};if(B(c))return b;c={};null!==k?c["@type"]=k:G(b)&&(d=f.getContextValue(d,a,"@language"),
null!==d&&(c["@language"]=d));-1===["boolean","number","string"].indexOf(typeof b)&&(b=b.toString());c["@value"]=b;return c}function u(d){var a={};if(ga(d)){a.type="literal";var f=d["@value"],b=d["@type"]||null;"boolean"===typeof f||"[object Boolean]"===Object.prototype.toString.call(f)?(a.value=f.toString(),a.datatype=b||"http://www.w3.org/2001/XMLSchema#boolean"):sa(f)||"http://www.w3.org/2001/XMLSchema#double"===b?(sa(f)||(f=parseFloat(f)),a.value=f.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),
a.datatype=b||"http://www.w3.org/2001/XMLSchema#double"):V(f)?(a.value=f.toFixed(0),a.datatype=b||"http://www.w3.org/2001/XMLSchema#integer"):"@language"in d?(a.value=f,a.datatype=b||Aa,a.language=d["@language"]):(a.value=f,a.datatype=b||ua)}else d=L(d)?d["@id"]:d,a.type=0===d.indexOf("_:")?"blank node":"IRI",a.value=d;return"IRI"!==a.type||fa(a.value)?a:null}function n(d,a,b,c,k,h){if(I(d))for(var l=0;l<d.length;++l)n(d[l],a,b,c,void 0,h);else if(L(d))if(ga(d)){if("@type"in d){var m=d["@type"];0===
m.indexOf("_:")&&(d["@type"]=c.getId(m))}h&&h.push(d)}else{if("@type"in d)for(var y=d["@type"],l=0;l<y.length;++l)m=y[l],0===m.indexOf("_:")&&c.getId(m);X(k)&&(k=za(d)?c.getId(d["@id"]):d["@id"]);h&&h.push({"@id":k});h=a[b];l=h[k]=h[k]||{};l["@id"]=k;m=Object.keys(d).sort();for(y=0;y<m.length;++y){var A=m[y];if("@id"!==A)if("@reverse"===A){var A={"@id":k},F=d["@reverse"],u;for(u in F)for(var G=F[u],x=0;x<G.length;++x){var D=G[x],H=D["@id"];za(D)&&(H=c.getId(H));n(D,a,b,c,H);f.addValue(h[H],u,A,{propertyIsArray:!0,
allowDuplicate:!1})}}else if("@graph"===A)k in a||(a[k]={}),n(d[A],a,"@merged"===b?b:k,c);else if("@type"!==A&&B(A)){if("@index"===A&&A in l&&(d[A]!==l[A]||d[A]["@id"]!==l[A]["@id"]))throw new K("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:l});l[A]=d[A]}else if(F=d[A],0===A.indexOf("_:")&&(A=c.getId(A)),0===F.length)f.addValue(l,A,[],{propertyIsArray:!0});else for(G=0;G<F.length;++G)x=F[G],"@type"===A&&(x=0===x.indexOf("_:")?
c.getId(x):x),D=x,H=!1,!L(D)||"@value"in D||"@set"in D||"@list"in D||(H=1<Object.keys(D).length||!("@id"in D)),H||ba(x)?(D=za(x)?c.getId(x["@id"]):x["@id"],f.addValue(l,A,{"@id":D},{propertyIsArray:!0,allowDuplicate:!1}),n(x,a,b,c,D)):(da(x)?(D=[],n(x["@list"],a,b,c,k,D),x={"@list":D}):n(x,a,b,c,k),f.addValue(l,A,x,{propertyIsArray:!0,allowDuplicate:!1}))}}else h&&h.push(d)}function x(d){for(var a=d["@default"],f=Object.keys(d).sort(),b=0;b<f.length;++b){var c=f[b];if("@default"!==c){var k=d[c],h=
a[c];h?"@graph"in h||(h["@graph"]=[]):a[c]=h={"@id":c,"@graph":[]};for(var c=h["@graph"],h=Object.keys(k).sort(),r=0;r<h.length;++r){var l=k[h[r]];ba(l)||c.push(l)}}}return a}function E(d,a,f,b,c){var k=f;if(!I(k)||1!==k.length||!L(k[0]))throw new K("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:k});f=f[0];for(var k=d.options,h={embed:M(f,k,"embed"),explicit:M(f,k,"explicit"),requireAll:M(f,k,"requireAll")},r=f,l={},n=0;n<a.length;++n){var m=a[n],G=
d.subjects[m];F(G,r,h)&&(l[m]=G)}a=Object.keys(l).sort();for(r=0;r<a.length;++r)if(G=a[r],m=l[G],"@link"===h.embed&&G in d.link)A(b,c,d.link[G]);else{null===c&&(d.uniqueEmbeds={});n={};n["@id"]=G;d.link[G]=n;var u;if(!(u="@never"===h.embed))a:{u=d.subjectStack;for(var x=u.length-1;0<=x;--x)if(u[x]["@id"]===m["@id"]){u=!0;break a}u=!1}if(u)A(b,c,n);else{"@last"===h.embed&&(G in d.uniqueEmbeds&&H(d,G),d.uniqueEmbeds[G]={parent:b,property:c});d.subjectStack.push(m);G=Object.keys(m).sort();for(u=0;u<
G.length;u++)if(x=G[u],B(x))n[x]=ea(m[x]);else if(!h.explicit||x in f)for(var D=m[x],v=0;v<D.length;++v){var P=D[v];if(da(P)){var V={"@list":[]};A(n,x,V);var N=P["@list"],z;for(z in N)if(P=N[z],ba(P)){var O=x in f?f[x][0]["@list"]:y(h);E(d,[P["@id"]],O,V,"@list")}else A(V,"@list",ea(P))}else ba(P)?(O=x in f?f[x]:y(h),E(d,[P["@id"]],O,n,x)):A(n,x,ea(P))}G=Object.keys(f).sort();for(u=0;u<G.length;++u)x=G[u],B(x)||(m=f[x][0],M(m,k,"omitDefault")||x in n||(D="@null","@default"in m&&(D=ea(m["@default"])),
I(D)||(D=[D]),n[x]=[{"@preserve":D}]));A(b,c,n);d.subjectStack.pop()}}}function y(d){var a={},f;for(f in d)void 0!==d[f]&&(a["@"+f]=[d[f]]);return[a]}function M(d,a,f){var b="@"+f;d=b in d?d[b][0]:a[f];"embed"===f&&(!0===d?d="@last":!1===d?d="@never":"@always"!==d&&"@never"!==d&&"@link"!==d&&(d="@last"));return d}function F(d,a,b){if("@type"in a&&(1!==a["@type"].length||!L(a["@type"][0]))){a=a["@type"];for(b=0;b<a.length;++b)if(f.hasValue(d,"@type",a[b]))return!0;return!1}var c=!0,k=!1,h;for(h in a){if(B(h)){if("@id"!==
h&&"@type"!==h)continue;c=!1;if("@id"===h&&G(a[h])){if(d[h]!==a[h])return!1;k=!0;continue}}c=!1;if(h in d){if(I(a[h])&&0===a[h].length&&void 0!==d[h])return!1;k=!0}else{var l=I(a[h])&&L(a[h][0])&&"@default"in a[h][0];if(b.requireAll&&!l)return!1}}return c||k}function H(d,a){var b=d.uniqueEmbeds,c=b[a],k=c.parent,h=c.property,c={"@id":a};if(I(k))for(h=0;h<k.length;++h){if(f.compareValues(k[h],c)){k[h]=c;break}}else{var l=I(k[h]);f.removeValue(k,h,c,{propertyIsArray:l});f.addValue(k,h,c,{propertyIsArray:l})}var n=
function(d){for(var a=Object.keys(b),f=0;f<a.length;++f){var c=a[f];c in b&&L(b[c].parent)&&b[c].parent["@id"]===d&&(delete b[c],n(c))}};n(a)}function A(d,a,b){L(d)?f.addValue(d,a,b,{propertyIsArray:!0}):d.push(b)}function D(d,a,b){if(I(a)){for(var c=[],k=0;k<a.length;++k){var h=D(d,a[k],b);null!==h&&c.push(h)}a=c}else if(L(a)){if("@preserve"in a)return"@null"===a["@preserve"]?null:a["@preserve"];if(ga(a))return a;if(da(a))return a["@list"]=D(d,a["@list"],b),a;h=N(d,"@id");if(h in a)if(h=a[h],h in
b.link)if(k=b.link[h].indexOf(a),-1===k)b.link[h].push(a);else return b.link[h][k];else b.link[h]=[a];for(c in a)h=D(d,a[c],b),k=f.getContextValue(d,c,"@container"),b.compactArrays&&I(h)&&1===h.length&&null===k&&(h=h[0]),a[c]=h}return a}function P(d,a){return d.length<a.length?-1:a.length<d.length?1:d===a?0:d<a?-1:1}function N(d,a,b,c,k){if(null===a)return a;X(b)&&(b=null);X(k)&&(k=!1);c=c||{};var h=d.getInverse();if(B(a))return a in h?h[a]["@none"]["@type"]["@none"]:a;if(c.vocab&&a in h){var l=d["@language"]||
"@none",h=[];L(b)&&"@index"in b&&h.push("@index");var n="@language",m="@null";if(k)n="@type",m="@reverse",h.push("@set");else if(da(b)){"@index"in b||h.push("@list");var I=b["@list"],m=0===I.length?l:null,l=null;for(k=0;k<I.length;++k){var A=I[k],y="@none",x="@none";ga(A)?"@language"in A?y=A["@language"]:"@type"in A?x=A["@type"]:y="@null":x="@id";null===m?m=y:y!==m&&ga(A)&&(m="@none");null===l?l=x:x!==l&&(l="@none");if("@none"===m&&"@none"===l)break}m=m||"@none";l=l||"@none";"@none"!==l&&(n="@type",
m=l)}else ga(b)?"@language"in b&&!("@index"in b)?(h.push("@language"),m=b["@language"]):"@type"in b&&(n="@type",m=b["@type"]):(n="@type",m="@id"),h.push("@set");h.push("@none");a:{I=b;k=n;null===m&&(m="@null");n=[];"@id"!==m&&"@reverse"!==m||!ba(I)?n.push(m):("@reverse"===m&&n.push("@reverse"),m=N(d,I["@id"],null,{vocab:!0}),m in d.mappings&&d.mappings[m]&&d.mappings[m]["@id"]===I["@id"]?n.push.apply(n,["@vocab","@id"]):n.push.apply(n,["@id","@vocab"]));n.push("@none");I=d.inverse[a];for(m=0;m<h.length;++m)if(l=
h[m],l in I)for(l=I[l][k],A=0;A<n.length;++A)if(y=n[A],y in l){h=l[y];break a}h=null}if(null!==h)return h}if(c.vocab&&"@vocab"in d&&(h=d["@vocab"],0===a.indexOf(h)&&a!==h&&(h=a.substr(h.length),!(h in d.mappings))))return h;h=null;k=0;n=[];I=d.fastCurieMap;for(m=a.length-1;k<m&&a[k]in I;++k)I=I[a[k]],""in I&&n.push(I[""][0]);for(k=n.length-1;0<=k;--k)for(I=n[k],m=I.terms,l=0;l<m.length;++l)A=m[l]+":"+a.substr(I.iri.length),A in d.mappings&&(null!==b||d.mappings[A]["@id"]!==a)||!(null===h||0>P(A,h))||
(h=A);if(null!==h)return h;if(!c.vocab&&(d=d["@base"],null!==d&&(G(d)&&(d=f.url.parse(d||"")),b="",""!==d.href?b+=(d.protocol||"")+"//"+(d.authority||""):a.indexOf("//")&&(b+="//"),0===a.indexOf(b)))){a=f.url.parse(a.substr(b.length));d=d.normalizedPath.split("/");b=a.normalizedPath.split("/");for(c=a.fragment||a.query?0:1;0<d.length&&b.length>c&&d[0]===b[0];)d.shift(),b.shift();c="";if(0<d.length)for(d.pop(),h=0;h<d.length;++h)c+="../";c+=b.join("/");null!==a.query&&(c+="?"+a.query);null!==a.fragment&&
(c+="#"+a.fragment);""===c&&(c="./");a=c}return a}function W(d,a,b){if(ga(b)){var c=f.getContextValue(d,a,"@type"),k=f.getContextValue(d,a,"@language"),h=f.getContextValue(d,a,"@container"),h="@index"in b&&"@index"!==h;if(!h&&(b["@type"]===c||b["@language"]===k))return b["@value"];var c=Object.keys(b).length,c=1===c||2===c&&"@index"in b&&!h,k="@language"in d,l=G(b["@value"]);a=d.mappings[a]&&null===d.mappings[a]["@language"];if(c&&(!k||!l||a))return b["@value"];a={};h&&(a[N(d,"@index")]=b["@index"]);
"@type"in b?a[N(d,"@type")]=N(d,b["@type"],null,{vocab:!0}):"@language"in b&&(a[N(d,"@language")]=b["@language"]);a[N(d,"@value")]=b["@value"];return a}h=J(d,a,{vocab:!0});c=f.getContextValue(d,a,"@type");b=N(d,b["@id"],null,{vocab:"@vocab"===c});if("@id"===c||"@vocab"===c||"@graph"===h)return b;a={};a[N(d,"@id")]=b;return a}function O(d,a,f,b){if(f in b){if(b[f])return;throw new K("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:a,term:f});}b[f]=
!1;if(B(f))throw new K("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:a,term:f});if(""===f)throw new K("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:a});d.mappings[f]&&delete d.mappings[f];var c=a[f];if(null===c||L(c)&&null===c["@id"])d.mappings[f]=null,b[f]=!0;else{G(c)&&(c={"@id":c});if(!L(c))throw new K("Invalid JSON-LD syntax; @context property values must be strings or objects.",
"jsonld.SyntaxError",{code:"invalid term definition",context:a});var k=d.mappings[f]={};k.reverse=!1;if("@reverse"in c){if("@id"in c)throw new K("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:a});var h=c["@reverse"];if(!G(h))throw new K("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:a});h=J(d,h,{vocab:!0,base:!1},a,b);if(!fa(h))throw new K("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.",
"jsonld.SyntaxError",{code:"invalid IRI mapping",context:a});k["@id"]=h;k.reverse=!0}else if("@id"in c){h=c["@id"];if(!G(h))throw new K("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:a});if(h!==f){h=J(d,h,{vocab:!0,base:!1},a,b);if(!fa(h)&&!B(h))throw new K("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",
context:a});k["@id"]=h}}var r=f.indexOf(":");k._termHasColon=-1!==r;if(!("@id"in k))if(k._termHasColon)h=f.substr(0,r),h in a&&O(d,a,h,b),d.mappings[h]?(r=f.substr(r+1),k["@id"]=d.mappings[h]["@id"]+r):k["@id"]=f;else{if(!("@vocab"in d))throw new K("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:a,term:f});k["@id"]=d["@vocab"]+f}b[f]=!0;if("@type"in c){f=c["@type"];if(!G(f))throw new K("Invalid JSON-LD syntax; an @context @type values must be a string.",
"jsonld.SyntaxError",{code:"invalid type mapping",context:a});if("@id"!==f&&"@vocab"!==f){f=J(d,f,{vocab:!0,base:!1},a,b);if(!fa(f))throw new K("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:a});if(0===f.indexOf("_:"))throw new K("Invalid JSON-LD syntax; an @context @type values must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:a});}k["@type"]=f}if("@container"in
c){d=c["@container"];if("@list"!==d&&"@set"!==d&&"@index"!==d&&"@language"!==d)throw new K("Invalid JSON-LD syntax; @context @container value must be one of the following: @list, @set, @index, or @language.","jsonld.SyntaxError",{code:"invalid container mapping",context:a});if(k.reverse&&"@index"!==d&&"@set"!==d&&null!==d)throw new K("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:a});
k["@container"]=d}if("@language"in c&&!("@type"in c)){c=c["@language"];if(null!==c&&!G(c))throw new K("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:a});null!==c&&(c=c.toLowerCase());k["@language"]=c}h=k["@id"];if("@context"===h||"@preserve"===h)throw new K("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:a});}}function J(d,a,b,c,
k){if(null===a||B(a))return a;a=String(a);c&&a in c&&!0!==k[a]&&O(d,c,a,k);b=b||{};if(b.vocab){var h=d.mappings[a];if(null===h)return null;if(h)return h["@id"]}h=a.indexOf(":");if(-1!==h){b=a.substr(0,h);var l=a.substr(h+1);if("_"===b||0===l.indexOf("//"))return a;c&&b in c&&O(d,c,b,k);return(h=d.mappings[b])?h["@id"]+l:a}if(b.vocab&&"@vocab"in d)return d["@vocab"]+a;b.base&&(a=f.prependBase(d["@base"],a));return a}function C(d){function a(d,f,b){var c=d[f];d=d[f]={};for(var k,h=0;h<c.length;++h)k=
c[h].iri,k=b>=k.length?"":k[b],k in d?d[k].push(c[h]):d[k]=[c[h]];for(f in d)""!==f&&a(d,f,b+1)}return{"@base":f.url.parse(d.base||""),mappings:{},inverse:null,getInverse:function(){if(this.inverse)return this.inverse;for(var d=this.inverse={},f=this.fastCurieMap={},b={},c=this["@language"]||"@none",k=this.mappings,h=Object.keys(k).sort(P),r=0;r<h.length;++r){var l=h[r],n=k[l];if(null!==n){var m=n["@container"]||"@none",A=n["@id"];I(A)||(A=[A]);for(var y=0;y<A.length;++y){var x=A[y],G=d[x],u=B(x);
G?u||n._termHasColon||b[x].push(l):(d[x]=G={},u||n._termHasColon||(b[x]=[l],u={iri:x,terms:b[x]},x[0]in f?f[x[0]].push(u):f[x[0]]=[u]));G[m]||(G[m]={"@language":{},"@type":{}});G=G[m];n.reverse?(G=G["@type"],"@reverse"in G||(G["@reverse"]=l)):"@type"in n?(G=G["@type"],x=n["@type"],x in G||(G[x]=l)):"@language"in n?(G=G["@language"],x=n["@language"]||"@null",x in G||(G[x]=l)):(x=G["@language"],c in x||(x[c]=l),x=G["@type"],"@none"in x||(x["@none"]=l),G=G["@language"],"@none"in G||(G["@none"]=l))}}}for(var F in f)a(f,
F,1);return d},clone:function(){var d={};d["@base"]=this["@base"];d.mappings=ea(this.mappings);d.clone=this.clone;d.inverse=null;d.getInverse=this.getInverse;"@language"in this&&(d["@language"]=this["@language"]);"@vocab"in this&&(d["@vocab"]=this["@vocab"]);return d}}}function B(d){if(!G(d))return!1;switch(d){case "@base":case "@context":case "@container":case "@default":case "@embed":case "@explicit":case "@graph":case "@id":case "@index":case "@language":case "@list":case "@omitDefault":case "@preserve":case "@requireAll":case "@reverse":case "@set":case "@type":case "@value":case "@vocab":return!0}return!1}
function L(d){return"[object Object]"===Object.prototype.toString.call(d)}function I(d){return Array.isArray(d)}function G(d){return"string"===typeof d||"[object String]"===Object.prototype.toString.call(d)}function V(d){return"number"===typeof d||"[object Number]"===Object.prototype.toString.call(d)}function sa(d){return V(d)&&-1!==String(d).indexOf(".")}function X(d){return"undefined"===typeof d}function ba(d){return L(d)&&1===Object.keys(d).length&&"@id"in d}function ga(d){return L(d)&&"@value"in
d}function da(d){return L(d)&&"@list"in d}function za(d){var a=!1;L(d)&&(a="@id"in d?0===d["@id"].indexOf("_:"):0===Object.keys(d).length||!("@value"in d||"@set"in d||"@list"in d));return a}function fa(d){return G(d)&&-1!==d.indexOf(":")}function ea(d){if(d&&"object"===typeof d){var a;if(I(d)){a=[];for(var f=0;f<d.length;++f)a[f]=ea(d[f])}else if(L(d))for(f in a={},d)a[f]=ea(d[f]);else a=d.toString();return a}return d}function Na(d,a,b,c){var k=Object.keys(a).length;if(I(d)){for(var h=0;h<d.length;++h)Na(d[h],
a,b,c);return k<Object.keys(a).length}if(L(d)){for(var l in d)if("@context"!==l)Na(d[l],a,b,c);else{var n=d[l];if(I(n))for(var m=n.length,h=0;h<m;++h){var A=n[h];G(A)&&(A=f.prependBase(c,A),b?(A=a[A],I(A)?(Array.prototype.splice.apply(n,[h,1].concat(A)),h+=A.length-1,m=n.length):n[h]=A):A in a||(a[A]=!1))}else G(n)&&(n=f.prependBase(c,n),b?d[l]=a[n]:n in a||(a[n]=!1))}return k<Object.keys(a).length}return!1}function Oa(d,a,f){var b=null,c=function(d,a,f,k,h){if(Object.keys(a).length>ib)return b=new K("Maximum number of @context URLs exceeded.",
"jsonld.ContextUrlError",{code:"loading remote context failed",max:ib}),h(b);var r={};if(Na(d,r,!1,k)){var l=[],n;for(n in r)!1===r[n]&&l.push(n);var m=l.length;for(n=0;n<l.length;++n)(function(l){if(l in a)return b=new K("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:l}),h(b);var n=ea(a);n[l]=!0;var A=function(a,A){if(!b){var y=A?A.document:null;if(!a&&G(y))try{y=JSON.parse(y)}catch(x){a=x}a?a=new K("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.",
"jsonld.InvalidUrl",{code:"loading remote context failed",url:l,cause:a}):L(y)||(a=new K("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:l,cause:a}));if(a)return b=a,h(b);y="@context"in y?{"@context":y["@context"]}:{"@context":{}};A.contextUrl&&(I(y["@context"])||(y["@context"]=[y["@context"]]),y["@context"].push(A.contextUrl));c(y,n,f,l,function(a,f){if(a)return h(a);r[l]=f["@context"];
--m;0===m&&(Na(d,r,!0,k),h(null,d))})}},y=f(l,A);y&&"then"in y&&y.then(A.bind(null,null),A)})(l[n])}else Na(d,r,!0,k),h(null,d)};c(d,{},a.documentLoader,a.base,f)}function db(d){var a=/^[ \t]*(?:#.*)?$/,f=/^[ \t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+)))[ \t]+(?:<([^:]+:[^>]*)>)[ \t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+))|(?:"([^"\\]*(?:\\.[^"\\]*)*)"(?:(?:\^\^(?:<([^:]+:[^>]*)>))|(?:@([a-z]+(?:-[a-z0-9]+)*)))?))[ \t]*(?:\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-z0-9]+)))[ \t]*\.))[ \t]*(?:#.*)?$/,
b={};d=d.split(/(?:\r\n)|(?:\n)|(?:\r)/g);for(var c=0,k=0;k<d.length;++k){var h=d[k];c++;if(!a.test(h)){var r=h.match(f);if(null===r)throw new K("Error while parsing N-Quads; invalid quad.","jsonld.ParseError",{line:c});h={};X(r[1])?h.subject={type:"blank node",value:r[2]}:h.subject={type:"IRI",value:r[1]};h.predicate={type:"IRI",value:r[3]};if(X(r[4]))if(X(r[5])){h.object={type:"literal"};X(r[7])?X(r[8])?h.object.datatype=ua:(h.object.datatype=Aa,h.object.language=r[8]):h.object.datatype=r[7];var l=
r[6].replace(/\\"/g,'"').replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\\\/g,"\\");h.object.value=l}else h.object={type:"blank node",value:r[5]};else h.object={type:"IRI",value:r[4]};l="@default";X(r[9])?X(r[10])||(l=r[10]):l=r[9];if(l in b){for(var r=!0,l=b[l],n=0;r&&n<l.length;++n){var m;a:{m=l[n];for(var I=["subject","predicate","object"],A=0;A<I.length;++A){var y=I[A];if(m[y].type!==h[y].type||m[y].value!==h[y].value){m=!1;break a}}m=m.object.language!==h.object.language||
m.object.datatype!==h.object.datatype?!1:!0}m&&(r=!1)}r&&l.push(h)}else b[l]=[h]}}return b}function eb(d,a){var f=d.subject,b=d.predicate,c=d.object,k=a||null;"name"in d&&d.name&&(k=d.name.value);var h="",h="IRI"===f.type?h+("<"+f.value+">"):h+f.value,h=h+" ",h="IRI"===b.type?h+("<"+b.value+">"):h+b.value,h=h+" ";"IRI"===c.type?h+="<"+c.value+">":"blank node"===c.type?h+=c.value:(f=c.value.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,'\\"'),h+=
'"'+f+'"',c.datatype===Aa?c.language&&(h+="@"+c.language):c.datatype!==ua&&(h+="^^<"+c.datatype+">"));null!==k&&void 0!==k&&(h=0!==k.indexOf("_:")?h+(" <"+k+">"):h+(" "+k));return h+" .\n"}function ca(d){this.prefix=d;this.counter=0;this.existing={}}function zb(d,a){var f="";0===d.indexOf("/")&&(f="/");for(var b=d.split("/"),c=[];0<b.length;)"."===b[0]||""===b[0]&&1<b.length?b.shift():".."===b[0]?(b.shift(),a||0<c.length&&".."!==c[c.length-1]?c.pop():c.push("..")):c.push(b.shift());return f+c.join("/")}
f.compact=function(d,a,b,c){if(2>arguments.length)return f.nextTick(function(){c(new TypeError("Could not compact, too few arguments."))});"function"===typeof b&&(c=b,b={});b=b||{};if(null===a)return f.nextTick(function(){c(new K("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"}))});if(null===d)return f.nextTick(function(){c(null,null)});"base"in b||(b.base="string"===typeof d?d:"");"compactArrays"in b||(b.compactArrays=!0);"graph"in b||(b.graph=!1);"skipExpansion"in
b||(b.skipExpansion=!1);"documentLoader"in b||(b.documentLoader=f.loadDocument);"link"in b||(b.link=!1);b.link&&(b.skipExpansion=!0);(function(d,a,b){if(a.skipExpansion)return f.nextTick(function(){b(null,d)});f.expand(d,a,b)})(d,b,function(d,k){if(d)return c(new K("Could not expand input before compaction.","jsonld.CompactError",{cause:d}));var h=C(b);f.processContext(h,a,b,function(d,f){if(d)return c(new K("Could not process context before compaction.","jsonld.CompactError",{cause:d}));var h;try{h=
(new Y).compact(f,null,k,b)}catch(r){return c(r)}var l=b;l.compactArrays&&!l.graph&&I(h)?1===h.length?h=h[0]:0===h.length&&(h={}):l.graph&&L(h)&&(h=[h]);L(a)&&"@context"in a&&(a=a["@context"]);a=ea(a);I(a)||(a=[a]);l=a;a=[];for(var n=0;n<l.length;++n)(!L(l[n])||0<Object.keys(l[n]).length)&&a.push(l[n]);l=0<a.length;1===a.length&&(a=a[0]);if(I(h)){var m=N(f,"@graph"),n=h;h={};l&&(h["@context"]=a);h[m]=n}else if(L(h)&&l)for(m in n=h,h={"@context":a},n)h[m]=n[m];c(null,h,f)})})};f.expand=function(d,
a,b){function c(d){"base"in a||(a.base=d.documentUrl||"");d={document:ea(d.document),remoteContext:{"@context":d.contextUrl}};if("expandContext"in a){var f=ea(a.expandContext);d.expandContext="object"===typeof f&&"@context"in f?f:{"@context":f}}Oa(d,a,function(d,f){if(d)return b(d);var c;try{var k=new Y,h=C(a),r=f.document,l=f.remoteContext["@context"];f.expandContext&&(h=k.processContext(h,f.expandContext["@context"],a));l&&(h=k.processContext(h,l,a));c=k.expand(h,null,r,a,!1);L(c)&&"@graph"in c&&
1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]);I(c)||(c=[c])}catch(n){return b(n)}b(null,c)})}if(1>arguments.length)return f.nextTick(function(){b(new TypeError("Could not expand, too few arguments."))});"function"===typeof a&&(b=a,a={});a=a||{};"documentLoader"in a||(a.documentLoader=f.loadDocument);"keepFreeFloatingNodes"in a||(a.keepFreeFloatingNodes=!1);f.nextTick(function(){if("string"===typeof d){var f=function(d,a){if(d)return b(d);try{if(!a.document)throw new K("No remote document found at the given URL.",
"jsonld.NullRemoteDocument");"string"===typeof a.document&&(a.document=JSON.parse(a.document))}catch(f){return b(new K("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:f,remoteDoc:a}))}c(a)},k=a.documentLoader(d,f);k&&"then"in k&&k.then(f.bind(null,null),f)}else c({contextUrl:null,documentUrl:null,document:d})})};f.flatten=function(d,a,b,c){if(1>arguments.length)return f.nextTick(function(){c(new TypeError("Could not flatten, too few arguments."))});
"function"===typeof b?(c=b,b={}):"function"===typeof a&&(c=a,a=null,b={});b=b||{};"base"in b||(b.base="string"===typeof d?d:"");"documentLoader"in b||(b.documentLoader=f.loadDocument);f.expand(d,b,function(d,k){if(d)return c(new K("Could not expand input before flattening.","jsonld.FlattenError",{cause:d}));var h;try{h=(new Y).flatten(k)}catch(l){return c(l)}if(null===a)return c(null,h);b.graph=!0;b.skipExpansion=!0;f.compact(h,a,b,function(d,a){if(d)return c(new K("Could not compact flattened output.",
"jsonld.FlattenError",{cause:d}));c(null,a)})})};f.frame=function(d,a,b,c){function k(a){var h=a.document,l;h?(l=h["@context"],a.contextUrl?(l?I(l)?l.push(a.contextUrl):l=[l,a.contextUrl]:l=a.contextUrl,h["@context"]=l):l=l||{}):l={};f.expand(d,b,function(d,a){if(d)return c(new K("Could not expand input before framing.","jsonld.FrameError",{cause:d}));var k=ea(b);k.isFrame=!0;k.keepFreeFloatingNodes=!0;f.expand(h,k,function(d,b){if(d)return c(new K("Could not expand frame before framing.","jsonld.FrameError",
{cause:d}));var h;try{h=(new Y).frame(a,b,k)}catch(n){return c(n)}k.graph=!0;k.skipExpansion=!0;k.link={};f.compact(h,l,k,function(d,a,f){if(d)return c(new K("Could not compact framed output.","jsonld.FrameError",{cause:d}));d=N(f,"@graph");k.link={};a[d]=D(f,a[d],k);c(null,a)})})})}if(2>arguments.length)return f.nextTick(function(){c(new TypeError("Could not frame, too few arguments."))});"function"===typeof b&&(c=b,b={});b=b||{};"base"in b||(b.base="string"===typeof d?d:"");"documentLoader"in b||
(b.documentLoader=f.loadDocument);"embed"in b||(b.embed="@last");b.explicit=b.explicit||!1;"requireAll"in b||(b.requireAll=!0);b.omitDefault=b.omitDefault||!1;f.nextTick(function(){if("string"===typeof a){var d=function(d,a){if(d)return c(d);try{if(!a.document)throw new K("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"===typeof a.document&&(a.document=JSON.parse(a.document))}catch(f){return c(new K("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.",
"jsonld.LoadDocumentError",{code:"loading document failed",cause:f,remoteDoc:a}))}k(a)},f=b.documentLoader(a,d);f&&"then"in f&&f.then(d.bind(null,null),d)}else k({contextUrl:null,documentUrl:null,document:a})})};f.link=function(d,a,b,c){var k={};a&&(k["@context"]=a);k["@embed"]="@link";f.frame(d,k,b,c)};f.objectify=function(d,a,b,c){"function"===typeof b&&(c=b,b={});b=b||{};"base"in b||(b.base="string"===typeof d?d:"");"documentLoader"in b||(b.documentLoader=f.loadDocument);f.expand(d,b,function(d,
k){if(d)return c(new K("Could not expand input before linking.","jsonld.LinkError",{cause:d}));var h;try{h=(new Y).flatten(k)}catch(l){return c(l)}b.graph=!0;b.skipExpansion=!0;f.compact(h,a,b,function(d,a,b){if(d)return c(new K("Could not compact flattened output before linking.","jsonld.LinkError",{cause:d}));d=N(b,"@graph");var k=a[d][0],h=function(d){if(L(d)||I(d)){if(L(d)){if(h.visited[d["@id"]])return;h.visited[d["@id"]]=!0}for(var a in d){var c=d[a],l="@id"===f.getContextValue(b,a,"@type");
if(I(c)||L(c)||l)if(G(c)&&l)d[a]=c=k[c],h(c);else if(I(c))for(var n=0;n<c.length;++n)G(c[n])&&l?c[n]=k[c[n]]:L(c[n])&&"@id"in c[n]&&(c[n]=k[c[n]["@id"]]),h(c[n]);else L(c)&&(d[a]=c=k[c["@id"]],h(c))}}};h.visited={};h(k);a.of_type={};for(var l in k)if("@type"in k[l]){d=k[l]["@type"];I(d)||(d=[d]);for(var n=0;n<d.length;++n)d[n]in a.of_type||(a.of_type[d[n]]=[]),a.of_type[d[n]].push(k[l])}c(null,a)})})};f.normalize=function(d,a,b){if(1>arguments.length)return f.nextTick(function(){b(new TypeError("Could not normalize, too few arguments."))});
"function"===typeof a&&(b=a,a={});a=a||{};"algorithm"in a||(a.algorithm="URGNA2012");"base"in a||(a.base="string"===typeof d?d:"");"documentLoader"in a||(a.documentLoader=f.loadDocument);if("inputFormat"in a){if("application/nquads"!==a.inputFormat)return b(new K("Unknown normalization input format.","jsonld.NormalizeError"));var c=db(d);(new Y).normalize(c,a,b)}else c=ea(a),delete c.format,c.produceGeneralizedRdf=!1,f.toRDF(d,c,function(d,f){if(d)return b(new K("Could not convert input to RDF dataset before normalization.",
"jsonld.NormalizeError",{cause:d}));(new Y).normalize(f,a,b)})};f.fromRDF=function(d,a,b){if(1>arguments.length)return f.nextTick(function(){b(new TypeError("Could not convert from RDF, too few arguments."))});"function"===typeof a&&(b=a,a={});a=a||{};"useRdfType"in a||(a.useRdfType=!1);"useNativeTypes"in a||(a.useNativeTypes=!1);"format"in a||!G(d)||"format"in a||(a.format="application/nquads");f.nextTick(function(){function f(d,a,b){(new Y).fromRDF(d,a,b)}var c;if(a.format){if(c=a.rdfParser||ab[a.format],
!c)return b(new K("Unknown input format.","jsonld.UnknownFormat",{format:a.format}))}else c=function(){return d};var k=!1;try{d=c(d,function(d,c){k=!0;if(d)return b(d);f(c,a,b)})}catch(h){if(!k)return b(h);throw h;}if(d){if("then"in d)return d.then(function(d){f(d,a,b)},b);f(d,a,b)}})};f.toRDF=function(d,a,b){if(1>arguments.length)return f.nextTick(function(){b(new TypeError("Could not convert to RDF, too few arguments."))});"function"===typeof a&&(b=a,a={});a=a||{};"base"in a||(a.base="string"===
typeof d?d:"");"documentLoader"in a||(a.documentLoader=f.loadDocument);f.expand(d,a,function(d,f){if(d)return b(new K("Could not expand input before serialization to RDF.","jsonld.RdfError",{cause:d}));var c;try{if(c=Y.prototype.toRDF(f,a),a.format){if("application/nquads"===a.format){var k=b,h,r=[],l;for(l in c)for(var n=c[l],m=0;m<n.length;++m){var I=n[m];"@default"===l&&(l=null);r.push(eb(I,l))}h=r.sort().join("");return k(null,h)}throw new K("Unknown output format.","jsonld.UnknownFormat",{format:a.format});
}}catch(A){return b(A)}b(null,c)})};f.createNodeMap=function(d,a,b){if(1>arguments.length)return f.nextTick(function(){b(new TypeError("Could not create node map, too few arguments."))});"function"===typeof a&&(b=a,a={});a=a||{};"base"in a||(a.base="string"===typeof d?d:"");"documentLoader"in a||(a.documentLoader=f.loadDocument);f.expand(d,a,function(d,f){if(d)return b(new K("Could not expand input before creating node map.","jsonld.CreateNodeMapError",{cause:d}));var c;try{c=(new Y).createNodeMap(f,
a)}catch(k){return b(k)}b(null,c)})};f.merge=function(d,a,b,c){function k(d,a){if(!m){if(d)return m=d,c(new K("Could not expand input before flattening.","jsonld.FlattenError",{cause:d}));l.push(a);0===--A&&h(l)}}function h(d){var k=!0;"mergeNodes"in b&&(k=b.mergeNodes);var l=b.namer||b.issuer||new ca("_:b"),m={"@default":{}},I;try{for(var A=0;A<d.length;++A){var y=d[A],y=f.relabelBlankNodes(y,{issuer:new ca("_:b"+A+"-")}),G=k||0===A?m:{"@default":{}};n(y,G,"@default",l);if(G!==m)for(var u in G){var F=
G[u];if(u in m){var D=m[u],H;for(H in F)H in D||(D[H]=F[H])}else m[u]=F}}I=x(m)}catch(E){return c(E)}d=[];k=Object.keys(I).sort();for(l=0;l<k.length;++l)m=I[k[l]],ba(m)||d.push(m);if(null===a)return c(null,d);b.graph=!0;b.skipExpansion=!0;f.compact(d,a,b,function(d,a){if(d)return c(new K("Could not compact merged output.","jsonld.MergeError",{cause:d}));c(null,a)})}if(1>arguments.length)return f.nextTick(function(){c(new TypeError("Could not merge, too few arguments."))});if(!I(d))return f.nextTick(function(){c(new TypeError('Could not merge, "docs" must be an array.'))});
"function"===typeof b?(c=b,b={}):"function"===typeof a&&(c=a,a=null,b={});b=b||{};for(var l=[],m=null,A=d.length,y=0;y<d.length;++y){var G={},u;for(u in b)G[u]=b[u];f.expand(d[y],G,k)}};f.relabelBlankNodes=function(d,a){a=a||{};var b=a.namer||a.issuer||new ca("_:b");return k(b,d)};f.prependBase=function(d,a){var b;var c=d;if(null===c)b=a;else if(-1!==a.indexOf(":"))b=a;else{G(c)&&(c=f.url.parse(c||""));b=f.url.parse(a);var k=c.protocol||"",h,l;null!==b.authority?(h=b.authority,l=b.path,c=b.query):
(h=c.authority,""===b.path?(l=c.path,c=null!==b.query?b.query:c.query):(0===b.path.indexOf("/")?l=b.path:(l=c.path,""!==b.path&&(l=l.substr(0,l.lastIndexOf("/")+1),0<l.length&&"/"!==l.substr(-1)&&(l+="/"),l+=b.path)),c=b.query));l=zb(l,!!h);null!==h&&(k+="//"+h);k+=l;null!==c&&(k+="?"+c);null!==b.fragment&&(k+="#"+b.fragment);""===k&&(k="./");b=k}return b};f.documentLoader=function(d,a){var c=new K("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",
{code:"loading document failed"});return b?a(c,{contextUrl:null,documentUrl:d,document:null}):f.promisify(function(d){d(c)})};f.loadDocument=function(d,a){var b=f.documentLoader(d,a);b&&"then"in b&&b.then(a.bind(null,null),a)};f.promises=function(d){d=d||{};var a=Array.prototype.slice,b=f.promisify,c=d.api||{},k=d.version||"jsonld.js";"string"===typeof d.api&&(d.version||(k=d.api),c={});c.expand=function(d){if(1>arguments.length)throw new TypeError("Could not expand, too few arguments.");return b.apply(null,
[f.expand].concat(a.call(arguments)))};c.compact=function(d,c){if(2>arguments.length)throw new TypeError("Could not compact, too few arguments.");return b.apply(null,[function(d,a,b,c){"function"===typeof b&&(c=b,b={});b=b||{};f.compact(d,a,b,function(d,a){c(d,a)})}].concat(a.call(arguments)))};c.flatten=function(d){if(1>arguments.length)throw new TypeError("Could not flatten, too few arguments.");return b.apply(null,[f.flatten].concat(a.call(arguments)))};c.frame=function(d,c){if(2>arguments.length)throw new TypeError("Could not frame, too few arguments.");
return b.apply(null,[f.frame].concat(a.call(arguments)))};c.fromRDF=function(d){if(1>arguments.length)throw new TypeError("Could not convert from RDF, too few arguments.");return b.apply(null,[f.fromRDF].concat(a.call(arguments)))};c.toRDF=function(d){if(1>arguments.length)throw new TypeError("Could not convert to RDF, too few arguments.");return b.apply(null,[f.toRDF].concat(a.call(arguments)))};c.normalize=function(d){if(1>arguments.length)throw new TypeError("Could not normalize, too few arguments.");
return b.apply(null,[f.normalize].concat(a.call(arguments)))};"jsonld.js"===k&&(c.link=function(d,c){if(2>arguments.length)throw new TypeError("Could not link, too few arguments.");return b.apply(null,[f.link].concat(a.call(arguments)))},c.objectify=function(d){return b.apply(null,[f.objectify].concat(a.call(arguments)))},c.createNodeMap=function(d){return b.apply(null,[f.createNodeMap].concat(a.call(arguments)))},c.merge=function(d){return b.apply(null,[f.merge].concat(a.call(arguments)))});try{f.Promise=
h.Promise||z("es6-promise").Promise}catch(l){d=function(){throw Error("Unable to find a Promise implementation.");};for(var n in c)c[n]=d}return c};f.promisify=function(d){if(!f.Promise)try{f.Promise=h.Promise||z("es6-promise").Promise}catch(a){throw Error("Unable to find a Promise implementation.");}var b=Array.prototype.slice.call(arguments,1);return new f.Promise(function(a,f){d.apply(null,b.concat(function(d,b){d?f(d):a(b)}))})};f.promises({api:f.promises});d.prototype=f.promises({version:"json-ld-1.0"});
d.prototype.toString=function(){return this instanceof d?"[object JsonLdProcessor]":"[object JsonLdProcessorPrototype]"};f.JsonLdProcessor=d;var ja=!!Object.defineProperty;if(ja)try{Object.defineProperty({},"x",{})}catch(Hb){ja=!1}ja&&(Object.defineProperty(d,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(d.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:d}));a&&"undefined"===typeof h.JsonLdProcessor&&(ja?Object.defineProperty(h,"JsonLdProcessor",{writable:!0,
enumerable:!1,configurable:!0,value:d}):h.JsonLdProcessor=d);var $a="function"===typeof setImmediate&&setImmediate,ja=$a?function(d){$a(d)}:function(d){setTimeout(d,0)};f.nextTick="object"===typeof v&&"function"===typeof v.nextTick?v.nextTick:ja;f.setImmediate=$a?ja:f.nextTick;f.parseLinkHeader=function(d){var a={};d=d.match(/(?:<[^>]*?>|"[^"]*?"|[^,])+/g);for(var b=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,f=0;f<d.length;++f){var c=d[f].match(b);if(c){for(var k={target:c[1]},h=c[2],r=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g;c=
r.exec(h);)k[c[1]]=void 0===c[2]?c[3]:c[2];c=k.rel||"";I(a[c])?a[c].push(k):a[c]=c in a?[a[c],k]:k}}return a};f.RequestQueue=function(){this._requests={}};f.RequestQueue.prototype.wrapLoader=function(d){this._loader=d;this._usePromise=1===d.length;return this.add.bind(this)};f.RequestQueue.prototype.add=function(d,a){var b=this;if(!a&&!b._usePromise)throw Error("callback must be specified.");if(b._usePromise)return new f.Promise(function(a,f){var c=b._requests[d];c||(c=b._requests[d]=b._loader(d).then(function(a){delete b._requests[d];
return a}).catch(function(a){delete b._requests[d];throw a;}));c.then(function(d){a(d)}).catch(function(d){f(d)})});d in b._requests?b._requests[d].push(a):(b._requests[d]=[a],b._loader(d,function(a,f){var c=b._requests[d];delete b._requests[d];for(var k=0;k<c.length;++k)c[k](a,f)}))};f.DocumentCache=function(d){this.order=[];this.cache={};this.size=d||50;this.expires=3E4};f.DocumentCache.prototype.get=function(d){if(d in this.cache){var a=this.cache[d];if(a.expires>=+new Date)return a.ctx;delete this.cache[d];
this.order.splice(this.order.indexOf(d),1)}return null};f.DocumentCache.prototype.set=function(d,a){this.order.length===this.size&&delete this.cache[this.order.shift()];this.order.push(d);this.cache[d]={ctx:a,expires:+new Date+this.expires}};f.ActiveContextCache=function(d){this.order=[];this.cache={};this.size=d||100};f.ActiveContextCache.prototype.get=function(d,a){var b=JSON.stringify(d),f=JSON.stringify(a);return(b=this.cache[b])&&f in b?b[f]:null};f.ActiveContextCache.prototype.set=function(d,
a,b){if(this.order.length===this.size){var f=this.order.shift();delete this.cache[f.activeCtx][f.localCtx]}d=JSON.stringify(d);a=JSON.stringify(a);this.order.push({activeCtx:d,localCtx:a});d in this.cache||(this.cache[d]={});this.cache[d][a]=ea(b)};f.cache={activeCtx:new f.ActiveContextCache};f.documentLoaders={};f.documentLoaders.jquery=function(d,a){function b(c,k){if(0!==c.indexOf("http:")&&0!==c.indexOf("https:"))return k(new K('URL could not be dereferenced; only "http" and "https" URLs are supported.',
"jsonld.InvalidUrl",{code:"loading document failed",url:c}),{contextUrl:null,documentUrl:c,document:null});if(a.secure&&0!==c.indexOf("https"))return k(new K('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:c}),{contextUrl:null,documentUrl:c,document:null});d.ajax({url:c,accepts:{json:"application/ld+json, application/json"},headers:{Accept:"application/ld+json, application/json"},dataType:"json",
crossDomain:!0,success:function(d,a,b){d={contextUrl:null,documentUrl:c,document:d};a=b.getResponseHeader("Content-Type");if((b=b.getResponseHeader("Link"))&&"application/ld+json"!==a){b=f.parseLinkHeader(b)[kb];if(I(b))return k(new K("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:c}),d);b&&(d.contextUrl=b.target)}k(null,d)},error:function(d,a,b){k(new K("URL could not be dereferenced, an error occurred.",
"jsonld.LoadDocumentError",{code:"loading document failed",url:c,cause:b}),{contextUrl:null,documentUrl:c,document:null})}})}a=a||{};var c=new f.RequestQueue;return("usePromise"in a?a.usePromise:"undefined"!==typeof Promise)?c.wrapLoader(function(d){return f.promisify(b,d)}):c.wrapLoader(b)};f.documentLoaders.node=function(d){function a(l,n,m){if(0!==l.indexOf("http:")&&0!==l.indexOf("https:"))return m(new K('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",
{code:"loading document failed",url:l}),{contextUrl:null,documentUrl:l,document:null});if(d.secure&&0!==l.indexOf("https"))return m(new K('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:l}),{contextUrl:null,documentUrl:l,document:null});var A=null;if(null!==A)return m(null,A);var y={Accept:"application/ld+json, application/json"},x;for(x in d.headers)y[x]=d.headers[x];k({url:l,headers:y,strictSSL:b,
followRedirect:!1},function(d,b,k){A={contextUrl:null,documentUrl:l,document:k||null};if(d)return m(new K("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:l,cause:d}),A);k=h.STATUS_CODES[b.statusCode];if(400<=b.statusCode)return m(new K("URL could not be dereferenced: "+k,"jsonld.InvalidUrl",{code:"loading document failed",url:l,httpStatusCode:b.statusCode}),A);if(b.headers.link&&"application/ld+json"!==b.headers["content-type"]){k=
f.parseLinkHeader(b.headers.link)[kb];if(I(k))return m(new K("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:l}),A);k&&(A.contextUrl=k.target)}if(300<=b.statusCode&&400>b.statusCode&&b.headers.location){if(n.length===c)return m(new K("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:l,httpStatusCode:b.statusCode,redirects:n}),
A);if(-1!==n.indexOf(l))return m(new K("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:l,httpStatusCode:b.statusCode,redirects:n}),A);n.push(l);return a(b.headers.location,n,m)}n.push(l);m(d,A)})}d=d||{};var b="strictSSL"in d?d.strictSSL:!0,c="maxRedirects"in d?d.maxRedirects:-1,k="request"in d?d.request:z("request"),h=z("http"),l=new f.RequestQueue;if(d.usePromise)return l.wrapLoader(function(d){return f.promisify(a,
d,[])});var n=d.headers||{};if("Accept"in n||"accept"in n)throw new RangeError('Accept header may not be specified as an option; only "application/ld+json, application/json" is supported.');return l.wrapLoader(function(d,b){a(d,[],b)})};f.documentLoaders.xhr=function(d){function a(c,k){if(0!==c.indexOf("http:")&&0!==c.indexOf("https:"))return k(new K('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:c}),{contextUrl:null,
documentUrl:c,document:null});if(d.secure&&0!==c.indexOf("https"))return k(new K('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:c}),{contextUrl:null,documentUrl:c,document:null});var h=new (d.xhr||XMLHttpRequest);h.onload=function(){if(400<=h.status)return k(new K("URL could not be dereferenced: "+h.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:c,httpStatusCode:h.status}),
{contextUrl:null,documentUrl:c,document:null});var d={contextUrl:null,documentUrl:c,document:h.response},a=h.getResponseHeader("Content-Type"),l;b.test(h.getAllResponseHeaders())&&(l=h.getResponseHeader("Link"));if(l&&"application/ld+json"!==a){l=f.parseLinkHeader(l)[kb];if(I(l))return k(new K("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:c}),d);l&&(d.contextUrl=l.target)}k(null,d)};h.onerror=function(){k(new K("URL could not be dereferenced, an error occurred.",
"jsonld.LoadDocumentError",{code:"loading document failed",url:c}),{contextUrl:null,documentUrl:c,document:null})};h.open("GET",c,!0);h.setRequestHeader("Accept","application/ld+json, application/json");h.send()}d=d||{};var b=/(^|(\r\n))link:/i,c=new f.RequestQueue;return("usePromise"in d?d.usePromise:"undefined"!==typeof Promise)?c.wrapLoader(function(d){return f.promisify(a,d)}):c.wrapLoader(a)};f.useDocumentLoader=function(d){if(!(d in f.documentLoaders))throw new K('Unknown document loader type: "'+
d+'"',"jsonld.UnknownDocumentLoader",{type:d});f.documentLoader=f.documentLoaders[d].apply(f,Array.prototype.slice.call(arguments,1))};f.processContext=function(d,a){var b={},c=2;3<arguments.length&&(b=arguments[2]||{},c+=1);var k=arguments[c];"base"in b||(b.base="");"documentLoader"in b||(b.documentLoader=f.loadDocument);if(null===a)return k(null,C(b));a=ea(a);L(a)&&"@context"in a||(a={"@context":a});Oa(a,b,function(a,f){if(a)return k(a);try{f=(new Y).processContext(d,f,b)}catch(c){return k(c)}k(null,
f)})};f.hasProperty=function(d,a){var b=!1;a in d&&(b=d[a],b=!I(b)||0<b.length);return b};f.hasValue=function(d,a,b){var c=!1;if(f.hasProperty(d,a))if(d=d[a],a=da(d),I(d)||a)for(a&&(d=d["@list"]),a=0;a<d.length;++a){if(f.compareValues(b,d[a])){c=!0;break}}else I(b)||(c=f.compareValues(b,d));return c};f.addValue=function(d,a,b,c){c=c||{};"propertyIsArray"in c||(c.propertyIsArray=!1);"allowDuplicate"in c||(c.allowDuplicate=!0);if(I(b)){0!==b.length||!c.propertyIsArray||a in d||(d[a]=[]);for(var k=0;k<
b.length;++k)f.addValue(d,a,b[k],c)}else a in d?(k=!c.allowDuplicate&&f.hasValue(d,a,b),I(d[a])||k&&!c.propertyIsArray||(d[a]=[d[a]]),k||d[a].push(b)):d[a]=c.propertyIsArray?[b]:b};f.getValues=function(d,a){var b=d[a]||[];I(b)||(b=[b]);return b};f.removeProperty=function(d,a){delete d[a]};f.removeValue=function(d,a,b,c){c=c||{};"propertyIsArray"in c||(c.propertyIsArray=!1);var k=f.getValues(d,a).filter(function(d){return!f.compareValues(d,b)});0===k.length?f.removeProperty(d,a):d[a]=1!==k.length||
c.propertyIsArray?k:k[0]};f.compareValues=function(d,a){return d===a||ga(d)&&ga(a)&&d["@value"]===a["@value"]&&d["@type"]===a["@type"]&&d["@language"]===a["@language"]&&d["@index"]===a["@index"]?!0:L(d)&&"@id"in d&&L(a)&&"@id"in a?d["@id"]===a["@id"]:!1};f.getContextValue=function(d,a,b){var c=null;if(null===a)return c;"@language"===b&&b in d&&(c=d[b]);d.mappings[a]&&(d=d.mappings[a],X(b)?c=d:b in d&&(c=d[b]));return c};var ab={};f.registerRDFParser=function(d,a){ab[d]=a};f.unregisterRDFParser=function(d){delete ab[d]};
if(b){if("undefined"===typeof Pa)var Pa=null;if("undefined"===typeof lb)var lb={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}}var ua="http://www.w3.org/2001/XMLSchema#string",Aa="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",kb="http://www.w3.org/ns/json-ld#context",ib=10,K=function(d,a,c){b?(Error.call(this),
Error.captureStackTrace(this,this.constructor)):"undefined"!==typeof Error&&(this.stack=Error().stack);this.name=a||"jsonld.Error";this.message=d||"An unspecified JSON-LD error occurred.";this.details=c||{}};b?z("util").inherits(K,Error):"undefined"!==typeof Error&&(K.prototype=Error());var Y=function(){};Y.prototype.compact=function(d,a,b,c){if(I(b)){for(var k=[],h=0;h<b.length;++h){var l=this.compact(d,a,b[h],c);null!==l&&k.push(l)}if(c.compactArrays&&1===k.length){var n=f.getContextValue(d,a,"@container");
null===n&&(k=k[0])}return k}if(L(b)){if(c.link&&"@id"in b&&b["@id"]in c.link)for(k=c.link[b["@id"]],h=0;h<k.length;++h)if(k[h].expanded===b)return k[h].compacted;if(ga(b)||ba(b))return k=W(d,a,b),c.link&&ba(b)&&(b["@id"]in c.link||(c.link[b["@id"]]=[]),c.link[b["@id"]].push({expanded:b,compacted:k})),k;h="@reverse"===a;k={};c.link&&"@id"in b&&(b["@id"]in c.link||(c.link[b["@id"]]=[]),c.link[b["@id"]].push({expanded:b,compacted:k}));for(var m=Object.keys(b).sort(),A=0;A<m.length;++A){var y=m[A],x=
b[y];if("@id"===y||"@type"===y){var u;if(G(x))u=N(d,x,null,{vocab:"@type"===y});else{u=[];for(var F=0;F<x.length;++F)u.push(N(d,x[F],null,{vocab:!0}))}y=N(d,y);n=I(u)&&0===x.length;f.addValue(k,y,u,{propertyIsArray:n})}else if("@reverse"===y){u=this.compact(d,"@reverse",x,c);for(l in u)d.mappings[l]&&d.mappings[l].reverse&&(x=u[l],n=f.getContextValue(d,l,"@container"),f.addValue(k,l,x,{propertyIsArray:"@set"===n||!c.compactArrays}),delete u[l]);0<Object.keys(u).length&&(y=N(d,y),f.addValue(k,y,u))}else if("@index"===
y)n=f.getContextValue(d,a,"@container"),"@index"!==n&&(y=N(d,y),f.addValue(k,y,x));else if("@graph"!==y&&"@list"!==y&&B(y))y=N(d,y),f.addValue(k,y,x);else for(0===x.length&&(u=N(d,y,x,{vocab:!0},h),f.addValue(k,u,x,{propertyIsArray:!0})),F=0;F<x.length;++F){var D=x[F];u=N(d,y,D,{vocab:!0},h);var n=f.getContextValue(d,u,"@container"),H=da(D),E=null;H&&(E=D["@list"]);E=this.compact(d,u,H?E:D,c);if(H)if(I(E)||(E=[E]),"@list"!==n)H={},H[N(d,"@list")]=E,E=H,"@index"in D&&(E[N(d,"@index")]=D["@index"]);
else if(u in k)throw new K('JSON-LD compact error; property has a "@list" @container rule but there is more than a single @list that matches the compacted term in the document. Compaction might mix unwanted items into the list.',"jsonld.SyntaxError",{code:"compaction to list of lists"});if("@language"===n||"@index"===n){var M;u in k?M=k[u]:k[u]=M={};"@language"===n&&ga(E)&&(E=E["@value"]);f.addValue(M,D[n],E)}else n=!c.compactArrays||"@set"===n||"@list"===n||I(E)&&0===E.length||"@list"===y||"@graph"===
y,f.addValue(k,u,E,{propertyIsArray:n})}}return k}return b};Y.prototype.expand=function(d,a,b,c,k){if(null===b||void 0===b)return null;if(!I(b)&&!L(b))return k||null!==a&&"@graph"!==J(d,a,{vocab:!0})?m(d,a,b):null;if(I(b)){var h=[],l=f.getContextValue(d,a,"@container");k=k||"@list"===l;for(var n=0;n<b.length;++n){var A=this.expand(d,a,b[n],c);if(k&&(I(A)||da(A)))throw new K("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"});null!==A&&(I(A)?h=h.concat(A):
h.push(A))}return h}"@context"in b&&(d=this.processContext(d,b["@context"],c));for(var n=J(d,a,{vocab:!0}),h={},A=Object.keys(b).sort(),y=0;y<A.length;++y){var x=A[y],u=b[x];if("@context"!==x){var F=J(d,x,{vocab:!0});if(null!==F&&(fa(F)||B(F))){if(B(F)){if("@reverse"===n)throw new K("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:u});if(F in h)throw new K("Invalid JSON-LD syntax; colliding keywords detected.",
"jsonld.SyntaxError",{code:"colliding keywords",keyword:F});}if("@id"===F&&!G(u)){if(!c.isFrame)throw new K('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:u});if(!L(u))throw new K('Invalid JSON-LD syntax; "@id" value must be a string or an object.',"jsonld.SyntaxError",{code:"invalid @id value",value:u});}if("@type"===F){var l=u,D=void 0;(D=G(l))||(D=L(l)&&0===Object.keys(l).length);if(!D){D=!1;if(I(l))for(var D=!0,H=0;H<l.length;++H)if(!G(l[H])){D=
!1;break}if(!D)throw new K('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:l});}}if("@graph"===F&&!L(u)&&!I(u))throw new K('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:u});if("@value"===F&&(L(u)||I(u)))throw new K('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",
value:u});if("@language"===F){if(null===u)continue;if(!G(u))throw new K('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:u});u=u.toLowerCase()}if("@index"===F&&!G(u))throw new K('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:u});if("@reverse"===F){if(!L(u))throw new K('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",
value:u});u=this.expand(d,"@reverse",u,c);if("@reverse"in u)for(var E in u["@reverse"])f.addValue(h,E,u["@reverse"][E],{propertyIsArray:!0});x=h["@reverse"]||null;for(E in u)if("@reverse"!==E)for(null===x&&(x=h["@reverse"]={}),f.addValue(x,E,[],{propertyIsArray:!0}),F=u[E],l=0;l<F.length;++l){D=F[l];if(ga(D)||da(D))throw new K('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:u});f.addValue(x,E,D,{propertyIsArray:!0})}}else{l=
f.getContextValue(d,x,"@container");if("@language"===l&&L(u)){for(var D=[],H=Object.keys(u).sort(),M=0;M<H.length;++M){var v=H[M],P=u[v];I(P)||(P=[P]);for(var V=0;V<P.length;++V){var N=P[V];if(null!==N){if(!G(N))throw new K("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:u});D.push({"@value":N,"@language":v.toLowerCase()})}}}u=D}else if("@index"===l&&L(u)){D=x;H=[];M=Object.keys(u).sort();for(v=0;v<M.length;++v)for(P=
M[v],V=u[P],I(V)||(V=[V]),V=this.expand(d,D,V,c,!1),N=0;N<V.length;++N){var z=V[N];"@index"in z||(z["@index"]=P);H.push(z)}u=H}else if((D="@list"===F)||"@set"===F){if(H=a,D&&"@graph"===n&&(H=null),u=this.expand(d,H,u,c,D),D&&da(u))throw new K("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"});}else u=this.expand(d,x,u,c,!1);if(null!==u||"@value"===F)if("@list"===F||da(u)||"@list"!==l||(u=I(u)?u:[u],u={"@list":u}),d.mappings[x]&&d.mappings[x].reverse)for(x=
h["@reverse"]=h["@reverse"]||{},I(u)||(u=[u]),l=0;l<u.length;++l){D=u[l];if(ga(D)||da(D))throw new K('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:u});f.addValue(x,F,D,{propertyIsArray:!0})}else x=-1===["@index","@id","@type","@value","@language"].indexOf(F),f.addValue(h,F,u,{propertyIsArray:x})}}}}A=Object.keys(h);d=A.length;if("@value"in h){if("@type"in h&&"@language"in h)throw new K('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',
"jsonld.SyntaxError",{code:"invalid value object",element:h});b=d-1;"@type"in h&&--b;"@index"in h&&--b;"@language"in h&&--b;if(0!==b)throw new K('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:h});if(null===h["@value"])h=null;else{if("@language"in h&&!G(h["@value"]))throw new K("Invalid JSON-LD syntax; only strings may be language-tagged.",
"jsonld.SyntaxError",{code:"invalid language-tagged value",element:h});if("@type"in h&&(!fa(h["@type"])||0===h["@type"].indexOf("_:")))throw new K('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:h});}}else if("@type"in h&&!I(h["@type"]))h["@type"]=[h["@type"]];else if("@set"in h||"@list"in h){if(1<d&&!(2===d&&"@index"in h))throw new K('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',
"jsonld.SyntaxError",{code:"invalid set or list object",element:h});"@set"in h&&(h=h["@set"],A=Object.keys(h),d=A.length)}else 1===d&&"@language"in h&&(h=null);!L(h)||c.keepFreeFloatingNodes||k||null!==a&&"@graph"!==n||!(0===d||"@value"in h||"@list"in h||1===d&&"@id"in h)||(h=null);return h};Y.prototype.createNodeMap=function(d,a){a=a||{};var b=a.namer||a.issuer||new ca("_:b"),c={"@default":{}};n(d,c,"@default",b);return x(c)};Y.prototype.flatten=function(d){d=this.createNodeMap(d);for(var a=[],b=
Object.keys(d).sort(),c=0;c<b.length;++c){var f=d[b[c]];ba(f)||a.push(f)}return a};Y.prototype.frame=function(d,a,b){b={options:b,graphs:{"@default":{},"@merged":{}},subjectStack:[],link:{}};var c=new ca("_:b");n(d,b.graphs,"@merged",c);b.subjects=b.graphs["@merged"];d=[];E(b,Object.keys(b.subjects).sort(),a,d,null);return d};Y.prototype.normalize=function(d,a,b){if("URDNA2015"===a.algorithm)return(new Qa(a)).main(d,b);if("URGNA2012"===a.algorithm)return(new Db(a)).main(d,b);b(Error("Invalid RDF Dataset Normalization algorithm: "+
a.algorithm))};Y.prototype.fromRDF=function(d,a,b){var c={},k={"@default":c},h={},l;for(l in d){var n=d[l];l in k||(k[l]={});"@default"===l||l in c||(c[l]={"@id":l});for(var m=k[l],A=0;A<n.length;++A){var y=n[A],u=y.subject.value,x=y.predicate.value,y=y.object;u in m||(m[u]={"@id":u});var u=m[u],F="IRI"===y.type||"blank node"===y.type;!F||y.value in m||(m[y.value]={"@id":y.value});if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===x&&!a.useRdfType&&F)f.addValue(u,"@type",y.value,{propertyIsArray:!0});
else{var G;var D=y,H=a.useNativeTypes;"IRI"===D.type||"blank node"===D.type?G={"@id":D.value}:(G={"@value":D.value},D.language?G["@language"]=D.language:((D=D.datatype)||(D=ua),H?("http://www.w3.org/2001/XMLSchema#boolean"===D?"true"===G["@value"]?G["@value"]=!0:"false"===G["@value"]&&(G["@value"]=!1):(H=G["@value"],!isNaN(parseFloat(H))&&isFinite(H)&&("http://www.w3.org/2001/XMLSchema#integer"===D?(H=parseInt(G["@value"],10),H.toFixed(0)===G["@value"]&&(G["@value"]=H)):"http://www.w3.org/2001/XMLSchema#double"===
D&&(G["@value"]=parseFloat(G["@value"])))),-1===["http://www.w3.org/2001/XMLSchema#boolean","http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#double",ua].indexOf(D)&&(G["@type"]=D)):D!==ua&&(G["@type"]=D)));f.addValue(u,x,G,{propertyIsArray:!0});F&&("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"===y.value?(y=m[y.value],"usages"in y||(y.usages=[]),y.usages.push({node:u,property:x,value:G})):h[y.value]=y.value in h?!1:{node:u,property:x,value:G})}}}for(l in k)if(a=k[l],
"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"in a){n=a["http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"];for(d=0;d<n.usages.length;++d){y=n.usages[d];u=y.node;A=y.property;y=y.value;x=[];m=[];for(F=Object.keys(u).length;"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"===A&&L(h[u["@id"]])&&I(u["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"])&&1===u["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"].length&&I(u["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"])&&1===u["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"].length&&
(3===F||4===F&&I(u["@type"])&&1===u["@type"].length&&"http://www.w3.org/1999/02/22-rdf-syntax-ns#List"===u["@type"][0])&&(x.push(u["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"][0]),m.push(u["@id"]),y=h[u["@id"]],u=y.node,A=y.property,y=y.value,F=Object.keys(u).length,0===u["@id"].indexOf("_:")););if("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"===A){if("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"===u["@id"])continue;y=a[y["@id"]]["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"][0];
x.pop();m.pop()}delete y["@id"];y["@list"]=x.reverse();for(u=0;u<m.length;++u)delete a[m[u]]}delete n.usages}h=[];l=Object.keys(c).sort();for(d=0;d<l.length;++d){a=l[d];u=c[a];if(a in k)for(n=u["@graph"]=[],a=k[a],m=Object.keys(a).sort(),A=0;A<m.length;++A)x=a[m[A]],ba(x)||n.push(x);ba(u)||h.push(u)}b(null,h)};Y.prototype.toRDF=function(d,a){var b=new ca("_:b"),c={"@default":{}};n(d,c,"@default",b);for(var f={},k=Object.keys(c).sort(),h=0;h<k.length;++h){var l=k[h];if("@default"===l||fa(l)){for(var r=
l,l=c[l],m=b,y=a,A=[],I=Object.keys(l).sort(),x=0;x<I.length;++x)for(var G=I[x],F=l[G],D=Object.keys(F).sort(),H=0;H<D.length;++H){var E=D[H],M=F[E];if("@type"===E)E="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";else if(B(E))continue;for(var v=0;v<M.length;++v){var P=M[v],V={};V.type=0===G.indexOf("_:")?"blank node":"IRI";V.value=G;if(fa(G)){var N={};N.type=0===E.indexOf("_:")?"blank node":"IRI";N.value=E;if(fa(E)&&("blank node"!==N.type||y.produceGeneralizedRdf))if(da(P)){for(var P=P["@list"],
L=m,z=A,O={type:"IRI",value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first"},J={type:"IRI",value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"},t=0;t<P.length;++t){var W=P[t],sa={type:"blank node",value:L.getId()};z.push({subject:V,predicate:N,object:sa});V=sa;N=O;(W=u(W))&&z.push({subject:V,predicate:N,object:W});N=J}z.push({subject:V,predicate:N,object:{type:"IRI",value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}})}else(P=u(P))&&A.push({subject:V,predicate:N,object:P})}}}f[r]=A}}return f};
Y.prototype.processContext=function(d,a,b){L(a)&&"@context"in a&&I(a["@context"])&&(a=a["@context"]);a=I(a)?a:[a];if(0===a.length)return d.clone();for(var c=d,k=0;k<a.length;++k){var h=a[k];if(null===h)c=d=C(b);else{L(h)&&"@context"in h&&(h=h["@context"]);if(!L(h))throw new K("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:h});if(f.cache.activeCtx&&(d=f.cache.activeCtx.get(d,h))){c=d;continue}d=c;var c=c.clone(),l={};if("@base"in h){var n=
h["@base"];if(null===n)n=null;else{if(!G(n))throw new K('Invalid JSON-LD syntax; the value of "@base" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:h});if(""!==n&&!fa(n))throw new K('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI or the empty string.',"jsonld.SyntaxError",{code:"invalid base IRI",context:h});}null!==n&&(n=f.url.parse(n||""));c["@base"]=n;l["@base"]=!0}if("@vocab"in h){n=h["@vocab"];if(null===n)delete c["@vocab"];
else if(G(n))if(fa(n))c["@vocab"]=n;else throw new K('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:h});else throw new K('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:h});l["@vocab"]=!0}if("@language"in h){n=h["@language"];if(null===n)delete c["@language"];else if(G(n))c["@language"]=n.toLowerCase();
else throw new K('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:h});l["@language"]=!0}for(var m in h)O(c,h,m,l);f.cache.activeCtx&&f.cache.activeCtx.set(d,h,c)}}return c};var Qa=function(){var d={subject:"s",object:"o",name:"g"},a=function(d){d=d||{};this.name="URDNA2015";this.options=d;this.blankNodeInfo={};this.hashToBlankNodes={};this.canonicalIssuer=new ca("_:c14n");this.quads=[];this.schedule=
{};this.schedule.MAX_DEPTH="maxCallStackDepth"in d?d.maxCallStackDepth:500;this.schedule.MAX_TOTAL_DEPTH="maxTotalCallStackDepth"in d?d.maxCallStackDepth:4294967295;this.schedule.depth=0;this.schedule.totalDepth=0;this.schedule.timeSlice="timeSlice"in d?d.timeSlice:10};a.prototype.doWork=function(d,a){var b=this.schedule;if(b.totalDepth>=b.MAX_TOTAL_DEPTH)return a(Error("Maximum total call stack depth exceeded; normalization aborting."));(function gb(){if(b.depth===b.MAX_DEPTH)return b.depth=0,b.running=
!1,f.nextTick(gb);var c=(new Date).getTime();b.running||(b.start=(new Date).getTime(),b.deadline=b.start+b.timeSlice);if(c<b.deadline)return b.running=!0,b.depth++,b.totalDepth++,d(function(d,c){b.depth--;b.totalDepth--;a(d,c)});b.depth=0;b.running=!1;f.setImmediate(gb)})()};a.prototype.forEach=function(d,a,b){var c=this,f,k=0,h;if(I(d))h=d.length,f=function(){if(k===h)return!1;f.value=d[k++];f.key=k;return!0};else{var l=Object.keys(d);h=l.length;f=function(){if(k===h)return!1;f.key=l[k++];f.value=
d[f.key];return!0}}(function hb(d,k){if(d)return b(d);if(f())return c.doWork(function(){a(f.value,f.key,hb)});b()})()};a.prototype.waterfall=function(d,a){var b=this;b.forEach(d,function(d,a,c){b.doWork(d,c)},a)};a.prototype.whilst=function(d,a,b){var c=this;(function Ab(f){if(f)return b(f);if(!d())return b();c.doWork(a,Ab)})()};a.prototype.main=function(d,a){var b=this;b.schedule.start=(new Date).getTime();var c;if(b.options.format&&"application/nquads"!==b.options.format)return a(new K("Unknown output format.",
"jsonld.UnknownFormat",{format:b.options.format}));var f={};b.waterfall([function(a){b.forEach(d,function(d,a,c){"@default"===a&&(a=null);b.forEach(d,function(d,c,k){null!==a&&(0===a.indexOf("_:")?d.name={type:"blank node",value:a}:d.name={type:"IRI",value:a});b.quads.push(d);b.forEachComponent(d,function(a){"blank node"===a.type&&(a=a.value,a in b.blankNodeInfo?b.blankNodeInfo[a].quads.push(d):(f[a]=!0,b.blankNodeInfo[a]={quads:[d]}))});k()},c)},a)},function(d){var a=!0;b.whilst(function(){return a},
function(d){a=!1;b.hashToBlankNodes={};b.waterfall([function(d){b.forEach(f,function(d,a,c){b.hashFirstDegreeQuads(a,function(d,f){if(d)return c(d);f in b.hashToBlankNodes?b.hashToBlankNodes[f].push(a):b.hashToBlankNodes[f]=[a];c()})},d)},function(d){var c=Object.keys(b.hashToBlankNodes).sort();b.forEach(c,function(d,c,k){c=b.hashToBlankNodes[d];if(1<c.length)return k();c=c[0];b.canonicalIssuer.getId(c);delete f[c];delete b.hashToBlankNodes[d];a=!0;k()},d)}],d)},d)},function(d){var a=Object.keys(b.hashToBlankNodes).sort();
b.forEach(a,function(d,a,c){var f=[],k=b.hashToBlankNodes[d];b.waterfall([function(d){b.forEach(k,function(d,a,c){if(b.canonicalIssuer.hasId(d))return c();a=new ca("_:b");a.getId(d);b.hashNDegreeQuads(d,a,function(d,a){if(d)return c(d);f.push(a);c()})},d)},function(d){f.sort(function(d,a){return d.hash<a.hash?-1:d.hash>a.hash?1:0});b.forEach(f,function(d,a,c){for(var f in d.issuer.existing)b.canonicalIssuer.getId(f);c()},d)}],c)},d)},function(d){var a=[];b.waterfall([function(d){b.forEach(b.quads,
function(d,c,f){b.forEachComponent(d,function(d){"blank node"===d.type&&0!==d.value.indexOf(b.canonicalIssuer.prefix)&&(d.value=b.canonicalIssuer.getId(d.value))});a.push(eb(d));f()},d)},function(d){a.sort();if("application/nquads"===b.options.format)return c=a.join(""),d();c=db(a.join(""));d()}],d)}],function(d){a(d,c)})};a.prototype.hashFirstDegreeQuads=function(d,a){var b=this,c=b.blankNodeInfo[d];if("hash"in c)return a(null,c.hash);var f=[];b.forEach(c.quads,function(a,c,k){var h={predicate:a.predicate};
b.forEachComponent(a,function(a,c){h[c]=b.modifyFirstDegreeComponent(d,a,c)});f.push(eb(h));k()},function(d){if(d)return a(d);f.sort();c.hash=ma.hashNQuads(b.name,f);a(null,c.hash)})};a.prototype.modifyFirstDegreeComponent=function(d,a){if("blank node"!==a.type)return a;a=ea(a);a.value=a.value===d?"_:a":"_:z";return a};a.prototype.hashRelatedBlankNode=function(d,a,b,c,f){var k=this,h;k.waterfall([function(a){if(k.canonicalIssuer.hasId(d))return h=k.canonicalIssuer.getId(d),a();if(b.hasId(d))return h=
b.getId(d),a();k.hashFirstDegreeQuads(d,function(d,b){if(d)return a(d);h=b;a()})}],function(d){if(d)return f(d);d=new ma(k.name);d.update(c);"g"!==c&&d.update(k.getRelatedPredicate(a));d.update(h);return f(null,d.digest())})};a.prototype.getRelatedPredicate=function(d){return"<"+d.predicate.value+">"};a.prototype.hashNDegreeQuads=function(d,a,b){var c=this,f,k=new ma(c.name);c.waterfall([function(b){c.createHashToRelated(d,a,function(d,a){if(d)return b(d);f=a;b()})},function(d){var b=Object.keys(f).sort();
c.forEach(b,function(d,b,h){k.update(d);var l="",r,n=new mb(f[d]);c.whilst(function(){return n.hasNext()},function(d){var b=n.next(),f=a.clone(),k="",h=[];c.waterfall([function(a){c.forEach(b,function(a,b,r){c.canonicalIssuer.hasId(a)?k+=c.canonicalIssuer.getId(a):(f.hasId(a)||h.push(a),k+=f.getId(a));if(0!==l.length&&k.length>=l.length&&k>l)return d();r()},a)},function(a){c.forEach(h,function(a,b,h){c.hashNDegreeQuads(a,f,function(b,c){if(b)return h(b);k+=f.getId(a);k+="<"+c.hash+">";f=c.issuer;
if(0!==l.length&&k.length>=l.length&&k>l)return d();h()})},a)},function(d){if(0===l.length||k<l)l=k,r=f;d()}],d)},function(d){if(d)return h(d);k.update(l);a=r;h()})},d)}],function(d){b(d,{hash:k.digest(),issuer:a})})};a.prototype.createHashToRelated=function(a,b,c){var f=this,k={};f.forEach(f.blankNodeInfo[a].quads,function(c,h,l){f.forEach(c,function(h,l,r){if("predicate"===l||"blank node"!==h.type||h.value===a)return r();var n=h.value;f.hashRelatedBlankNode(n,c,b,d[l],function(d,a){if(d)return r(d);
a in k?k[a].push(n):k[a]=[n];r()})},l)},function(d){c(d,k)})};a.prototype.forEachComponent=function(d,a){for(var b in d)"predicate"!==b&&a(d[b],b,d)};return a}(),Db=function(){var d=function(d){Qa.call(this,d);this.name="URGNA2012"};d.prototype=new Qa;d.prototype.modifyFirstDegreeComponent=function(d,a,b){if("blank node"!==a.type)return a;a=ea(a);a.value="name"===b?"_:g":a.value===d?"_:a":"_:z";return a};d.prototype.getRelatedPredicate=function(d){return d.predicate.value};d.prototype.createHashToRelated=
function(d,a,b){var c=this,f={};c.forEach(c.blankNodeInfo[d].quads,function(b,k,h){var l;if("blank node"===b.subject.type&&b.subject.value!==d)l=b.subject.value,k="p";else if("blank node"===b.object.type&&b.object.value!==d)l=b.object.value,k="r";else return h();c.hashRelatedBlankNode(l,b,a,k,function(d,a){a in f?f[a].push(l):f[a]=[l];h()})},function(d){b(d,f)})};return d}();Object.keys||(Object.keys=function(d){if(d!==Object(d))throw new TypeError("Object.keys called on non-object");var a=[],b;for(b in d)Object.prototype.hasOwnProperty.call(d,
b)&&a.push(b);return a});f.registerRDFParser("application/nquads",db);f.registerRDFParser("rdfa-api",function(d){for(var a={"@default":[]},b=d.getSubjects(),c=0;c<b.length;++c){var f=b[c];if(null!==f){var k=d.getSubjectTriples(f);if(null!==k){var k=k.predicates,h;for(h in k)for(var l=k[h].objects,r=0;r<l.length;++r){var n=l[r],m={};0===f.indexOf("_:")?m.subject={type:"blank node",value:f}:m.subject={type:"IRI",value:f};0===h.indexOf("_:")?m.predicate={type:"blank node",value:h}:m.predicate={type:"IRI",
value:h};var y=n.value;if("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"===n.type){Pa||(Pa=z("xmldom").XMLSerializer);for(var A=new Pa,y="",I=0;I<n.value.length;I++)n.value[I].nodeType===lb.ELEMENT_NODE?y+=A.serializeToString(n.value[I]):n.value[I].nodeType===lb.TEXT_NODE&&(y+=n.value[I].nodeValue)}m.object={};"http://www.w3.org/1999/02/22-rdf-syntax-ns#object"===n.type?0===n.value.indexOf("_:")?m.object.type="blank node":m.object.type="IRI":(m.object.type="literal","http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral"===
n.type?n.language?(m.object.datatype=Aa,m.object.language=n.language):m.object.datatype=ua:m.object.datatype=n.type);m.object.value=y;a["@default"].push(m)}}}}return a});f.IdentifierIssuer=ca;f.UniqueNamer=ca;ca.prototype.clone=function(){var d=new ca(this.prefix);d.counter=this.counter;d.existing=ea(this.existing);return d};ca.prototype.getId=function(d){if(d&&d in this.existing)return this.existing[d];var a=this.prefix+this.counter;this.counter+=1;d&&(this.existing[d]=a);return a};ca.prototype.getName=
ca.prototype.getName;ca.prototype.hasId=function(d){return d in this.existing};ca.prototype.isNamed=ca.prototype.hasId;var mb=function(d){this.list=d.sort();this.done=!1;this.left={};for(var a=0;a<d.length;++a)this.left[d[a]]=!0};mb.prototype.hasNext=function(){return!this.done};mb.prototype.next=function(){for(var d=this.list.slice(),a=null,b=0,c=this.list.length,f=0;f<c;++f){var k=this.list[f],h=this.left[k];(null===a||k>a)&&(h&&0<f&&k>this.list[f-1]||!h&&f<c-1&&k>this.list[f+1])&&(a=k,b=f)}if(null===
a)this.done=!0;else for(f=this.left[a]?b-1:b+1,this.list[b]=this.list[f],this.list[f]=a,f=0;f<c;++f)this.list[f]>a&&(this.left[this.list[f]]=!this.left[this.list[f]]);return d};var ma=function(d){if(!(this instanceof ma))return new ma(d);if(-1===["URDNA2015","URGNA2012"].indexOf(d))throw Error("Invalid RDF Dataset Normalization algorithm: "+d);ma._init.call(this,d)};ma.hashNQuads=function(d,a){for(var b=new ma(d),c=0;c<a.length;++c)b.update(a[c]);return b.digest()};(function(d){if(d){var a=z("crypto");
ma._init=function(d){this.md=a.createHash("URDNA2015"===d?"sha256":"sha1")};ma.prototype.update=function(d){return this.md.update(d,"utf8")};ma.prototype.digest=function(){return this.md.digest("hex")}}else{ma._init=function(d){d="URDNA2015"===d?new f.Algorithm:new c.Algorithm;this.md=new b(d)};ma.prototype.update=function(d){return this.md.update(d)};ma.prototype.digest=function(){return this.md.digest().toHex()};var b=function(d){if(!(this instanceof b))return new b(d);this._algorithm=d;if(!b._padding||
b._padding.length<this._algorithm.blockSize){b._padding=String.fromCharCode(128);d=String.fromCharCode(0);for(var a=64;0<a;)a&1&&(b._padding+=d),a>>>=1,0<a&&(d+=d)}this.start()};b.prototype.start=function(){this.messageLength=0;this.fullMessageLength=[];for(var d=this._algorithm.messageLengthSize/4,a=0;a<d;++a)this.fullMessageLength.push(0);this._input=new b.ByteBuffer;this.state=this._algorithm.start();return this};b.prototype.update=function(d){d=new b.ByteBuffer(unescape(encodeURIComponent(d)));
this.messageLength+=d.length();for(var a=d.length(),a=[a/4294967296>>>0,a>>>0],c=this.fullMessageLength.length-1;0<=c;--c)this.fullMessageLength[c]+=a[1],a[1]=a[0]+(this.fullMessageLength[c]/4294967296>>>0),this.fullMessageLength[c]>>>=0,a[0]=a[1]/4294967296>>>0;for(this._input.putBytes(d.bytes());this._input.length()>=this._algorithm.blockSize;)this.state=this._algorithm.digest(this.state,this._input);(2048<this._input.read||0===this._input.length())&&this._input.compact();return this};b.prototype.digest=
function(){var d=new b.ByteBuffer;d.putBytes(this._input.bytes());d.putBytes(b._padding.substr(0,this._algorithm.blockSize-(this.fullMessageLength[this.fullMessageLength.length-1]+this._algorithm.messageLengthSize&this._algorithm.blockSize-1)));for(var a=new b.ByteBuffer,c=0;c<this.fullMessageLength.length;++c)a.putInt32(this.fullMessageLength[c]<<3|this.fullMessageLength[c+1]>>>28);this._algorithm.writeMessageLength(d,a);d=this._algorithm.digest(this.state.copy(),d);a=new b.ByteBuffer;d.write(a);
return a};b.ByteBuffer=function(d){this.data="string"===typeof d?d:"";this.read=0};b.ByteBuffer.prototype.putInt32=function(d){this.data+=String.fromCharCode(d>>24&255)+String.fromCharCode(d>>16&255)+String.fromCharCode(d>>8&255)+String.fromCharCode(d&255)};b.ByteBuffer.prototype.getInt32=function(){var d=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);this.read+=4;return d};b.ByteBuffer.prototype.putBytes=
function(d){this.data+=d};b.ByteBuffer.prototype.bytes=function(){return this.data.slice(this.read)};b.ByteBuffer.prototype.length=function(){return this.data.length-this.read};b.ByteBuffer.prototype.compact=function(){this.data=this.data.slice(this.read);this.read=0};b.ByteBuffer.prototype.toHex=function(){for(var d="",a=this.read;a<this.data.length;++a){var b=this.data.charCodeAt(a);16>b&&(d+="0");d+=b.toString(16)}return d};var c={_w:null,Algorithm:function(){this.name="sha1";this.blockSize=64;
this.digestLength=20;this.messageLengthSize=8}};c.Algorithm.prototype.start=function(){c._w||(c._w=Array(80));return c._createState()};c.Algorithm.prototype.writeMessageLength=function(d,a){d.putBytes(a.bytes())};c.Algorithm.prototype.digest=function(d,a){for(var b,f,k,h,l,r,n,m,y=a.length(),A=c._w;64<=y;){f=d.h0;k=d.h1;h=d.h2;l=d.h3;r=d.h4;for(m=0;16>m;++m)b=a.getInt32(),A[m]=b,n=l^k&(h^l),b=(f<<5|f>>>27)+n+r+1518500249+b,r=l,l=h,h=k<<30|k>>>2,k=f,f=b;for(;20>m;++m)b=A[m-3]^A[m-8]^A[m-14]^A[m-16],
b=b<<1|b>>>31,A[m]=b,n=l^k&(h^l),b=(f<<5|f>>>27)+n+r+1518500249+b,r=l,l=h,h=k<<30|k>>>2,k=f,f=b;for(;32>m;++m)b=A[m-3]^A[m-8]^A[m-14]^A[m-16],b=b<<1|b>>>31,A[m]=b,n=k^h^l,b=(f<<5|f>>>27)+n+r+1859775393+b,r=l,l=h,h=k<<30|k>>>2,k=f,f=b;for(;40>m;++m)b=A[m-6]^A[m-16]^A[m-28]^A[m-32],b=b<<2|b>>>30,A[m]=b,n=k^h^l,b=(f<<5|f>>>27)+n+r+1859775393+b,r=l,l=h,h=k<<30|k>>>2,k=f,f=b;for(;60>m;++m)b=A[m-6]^A[m-16]^A[m-28]^A[m-32],b=b<<2|b>>>30,A[m]=b,n=k&h|l&(k^h),b=(f<<5|f>>>27)+n+r+2400959708+b,r=l,l=h,h=k<<
30|k>>>2,k=f,f=b;for(;80>m;++m)b=A[m-6]^A[m-16]^A[m-28]^A[m-32],b=b<<2|b>>>30,A[m]=b,n=k^h^l,b=(f<<5|f>>>27)+n+r+3395469782+b,r=l,l=h,h=k<<30|k>>>2,k=f,f=b;d.h0=d.h0+f|0;d.h1=d.h1+k|0;d.h2=d.h2+h|0;d.h3=d.h3+l|0;d.h4=d.h4+r|0;y-=64}return d};c._createState=function(){var d={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520,copy:function(){var a=c._createState();a.h0=d.h0;a.h1=d.h1;a.h2=d.h2;a.h3=d.h3;a.h4=d.h4;return a},write:function(a){a.putInt32(d.h0);a.putInt32(d.h1);a.putInt32(d.h2);
a.putInt32(d.h3);a.putInt32(d.h4)}};return d};var f={_k:null,_w:null,Algorithm:function(){this.name="sha256";this.blockSize=64;this.digestLength=32;this.messageLengthSize=8}};f.Algorithm.prototype.start=function(){f._k||f._init();return f._createState()};f.Algorithm.prototype.writeMessageLength=function(d,a){d.putBytes(a.bytes())};f.Algorithm.prototype.digest=function(d,a){for(var b,c,k,h,l,r,n,m,A,y,I,u,x,G=a.length(),F=f._k,D=f._w;64<=G;){for(l=0;16>l;++l)D[l]=a.getInt32();for(;64>l;++l)b=D[l-2],
b=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,c=D[l-15],c=(c>>>7|c<<25)^(c>>>18|c<<14)^c>>>3,D[l]=b+D[l-7]+c+D[l-16]|0;r=d.h0;n=d.h1;m=d.h2;A=d.h3;y=d.h4;I=d.h5;u=d.h6;x=d.h7;for(l=0;64>l;++l)b=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),k=u^y&(I^u),c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),h=r&n|m&(r^n),b=x+b+k+F[l]+D[l],c+=h,x=u,u=I,I=y,y=A+b|0,A=m,m=n,n=r,r=b+c|0;d.h0=d.h0+r|0;d.h1=d.h1+n|0;d.h2=d.h2+m|0;d.h3=d.h3+A|0;d.h4=d.h4+y|0;d.h5=d.h5+I|0;d.h6=d.h6+u|0;d.h7=d.h7+x|0;G-=64}return d};f._createState=
function(){var d={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225,copy:function(){var a=f._createState();a.h0=d.h0;a.h1=d.h1;a.h2=d.h2;a.h3=d.h3;a.h4=d.h4;a.h5=d.h5;a.h6=d.h6;a.h7=d.h7;return a},write:function(a){a.putInt32(d.h0);a.putInt32(d.h1);a.putInt32(d.h2);a.putInt32(d.h3);a.putInt32(d.h4);a.putInt32(d.h5);a.putInt32(d.h6);a.putInt32(d.h7)}};return d};f._init=function(){f._k=[1116352408,1899447441,3049323471,3921009573,961987163,
1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,
958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];f._w=Array(64)}}})(b);f.url={};f.url.parsers={simple:{keys:"href scheme authority path query fragment".split(" "),regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:"href protocol scheme authority auth user password hostname port path directory file query fragment".split(" "),regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}};
f.url.parse=function(d,a){for(var b={},c=f.url.parsers[a||"full"],k=c.regex.exec(d),h=c.keys.length;h--;)b[c.keys[h]]=void 0===k[h]?null:k[h];b.normalizedPath=zb(b.path,!!b.authority);return b};b?f.useDocumentLoader("node"):"undefined"!==typeof XMLHttpRequest&&f.useDocumentLoader("xhr");b&&(f.use=function(d){switch(d){case "request":f.request=z("jsonld-request");break;default:throw new K("Unknown extension.","jsonld.UnknownExtension",{extension:d});}},ja={exports:{},filename:c},z("pkginfo")(ja,"version"),
f.version=ja.exports.version);return f},k=function(){return f(function(){return k()})};f(k);"function"===typeof z&&"undefined"!==typeof B&&B.exports&&(B.exports=k);a&&("undefined"===typeof jsonld?jsonld=jsonldjs=k:jsonldjs=k);return k})()}).call(this,z("qC859L"),"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},"/..\\..\\jsonld\\js")},{crypto:2,"es6-promise":1,http:2,"jsonld-request":2,pkginfo:2,qC859L:24,request:2,util:2,xmldom:2}],4:[function(z,B,C){var v=z;z=function(){};C=B.exports=
{Lexer:z("./lib/N3Lexer"),Parser:z("./lib/N3Parser"),Writer:z("./lib/N3Writer"),Store:z("./lib/N3Store"),StreamParser:z("./lib/N3StreamParser"),StreamWriter:z("./lib/N3StreamWriter"),Util:z("./lib/N3Util")};Object.keys(C).forEach(function(h){Object.defineProperty(C,h,{configurable:!0,enumerable:!0,get:function(){delete C[h];return C[h]=v("./lib/N3"+h)}})})},{"./lib/N3Lexer":5,"./lib/N3Parser":6,"./lib/N3Store":7,"./lib/N3StreamParser":8,"./lib/N3StreamWriter":9,"./lib/N3Util":10,"./lib/N3Writer":11}],
5:[function(z,B,C){function v(a){if(!(this instanceof v))return new v(a);if(a&&a.lineMode){this._tripleQuotedString=this._number=this._boolean=/$0^/;var b=this;this._tokenize=this.tokenize;this.tokenize=function(d,a){this._tokenize(d,function(d,c){!d&&/^(?:IRI|prefixed|literal|langcode|type|\.|eof)$/.test(c.type)?a&&a(d,c):a&&a(d||b._syntaxError(c.type,a=null))})}}}var h=String.fromCharCode,c="function"===typeof setImmediate?setImmediate:function(a){setTimeout(a,0)},b=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\[uU]|\\(.)/g,
a={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},f=/[\x00-\x20<>\\"\{\}\|\^\`]/;v.prototype={_iri:/^<((?:[^>\\]|\\[uU])+)>/,_unescapedIri:/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>/,_unescapedString:/^"[^"\\]+"(?=[^"\\])/,_singleQuotedString:/^"[^"\\]*(?:\\.[^"\\]*)*"(?=[^"\\])|^'[^'\\]*(?:\\.[^'\\]*)*'(?=[^'\\])/,_tripleQuotedString:/^""("[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*")""|^''('[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*')''/,
_langcode:/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,_prefix:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,_prefixed:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=\.?[,;\s#()\[\]\{\}"'<])/,
_blank:/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=\.?[,;:\s#()\[\]\{\}"'<])/,_number:/^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d*\.?\d+)(?=[.,;:\s#()\[\]\{\}"'<])/,_boolean:/^(?:true|false)(?=[.,;:\s#()\[\]\{\}"'<])/,
_keyword:/^@[a-z]+(?=[\s#<:])/,_sparqlKeyword:/^(?:PREFIX|BASE|GRAPH)(?=[\s#<:])/i,_shortPredicates:/^a(?=\s+|<)/,_newline:/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,_whitespace:/^[ \t]+/,_endOfFile:/^(?:#[^\n\r]*)?$/,_tokenizeToEnd:function(a,b){function d(d){a(d._syntaxError(/^\S*/.exec(c)[0]))}for(var c=this._input;;){for(var h;h=this._newline.exec(c);)c=c.substr(h[0].length,c.length),this._line++;if(h=this._whitespace.exec(c))c=c.substr(h[0].length,c.length);if(this._endOfFile.test(c))return b&&
a(c=null,{line:this._line,type:"eof",value:"",prefix:""}),this._input=c;h=this._line;var u="",n="",x="",E=c[0],y=null,M=0,F=!1;switch(E){case "^":if(1===c.length)break;else if("^"!==c[1])return d(this);this._prevTokenType="^";c=c.substr(2);if("<"!==c[0]){F=!0;break}case "<":if(y=this._unescapedIri.exec(c))u="IRI",n=y[1];else if(y=this._iri.exec(c)){n=this._unescape(y[1]);if(null===n||f.test(n))return d(this);u="IRI"}break;case "_":if((y=this._blank.exec(c))||b&&(y=this._blank.exec(c+" ")))u="prefixed",
x="_",n=y[1];break;case '"':case "'":if(y=this._unescapedString.exec(c))u="literal",n=y[0];else if(y=this._singleQuotedString.exec(c)){n=this._unescape(y[0]);if(null===n)return d(this);u="literal";n=n.replace(/^'|'$/g,'"')}else if(y=this._tripleQuotedString.exec(c)){n=y[1]||y[2];this._line+=n.split(/\r\n|\r|\n/).length-1;n=this._unescape(n);if(null===n)return d(this);u="literal";n=n.replace(/^'|'$/g,'"')}break;case "@":if("literal"===this._prevTokenType&&(y=this._langcode.exec(c)))u="langcode",n=
y[1];else if(y=this._keyword.exec(c))u=y[0];break;case ".":if(1===c.length?b:"0">c[1]||"9"<c[1]){u=".";M=1;break}case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":case "+":case "-":if(y=this._number.exec(c))u="literal",n='"'+y[0]+'"^^http://www.w3.org/2001/XMLSchema#'+(y[1]?"double":/^[+\-]?\d+$/.test(y[0])?"integer":"decimal");break;case "B":case "b":case "p":case "P":case "G":case "g":(y=this._sparqlKeyword.exec(c))?u=y[0].toUpperCase():F=!0;break;case "f":case "t":(y=
this._boolean.exec(c))?(u="literal",n='"'+y[0]+'"^^http://www.w3.org/2001/XMLSchema#boolean'):F=!0;break;case "a":(y=this._shortPredicates.exec(c))?(u="abbreviation",n="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):F=!0;break;case ",":case ";":case "[":case "]":case "(":case ")":case "{":case "}":M=1;u=E;break;default:F=!0}if(F)if(("@prefix"===this._prevTokenType||"PREFIX"===this._prevTokenType)&&(y=this._prefix.exec(c)))u="prefix",n=y[1]||"";else if((y=this._prefixed.exec(c))||b&&(y=this._prefixed.exec(c+
" ")))u="prefixed",x=y[1]||"",n=this._unescape(y[2]);"^"===this._prevTokenType&&(u="IRI"===u||"prefixed"===u?"type":"");if(!u)return b||!/^'''|^"""/.test(c)&&/\n|\r/.test(c)?d(this):this._input=c;a(null,{line:h,type:u,value:n,prefix:x});this._prevTokenType=u;c=c.substr(M||y[0].length,c.length)}},_unescape:function(c){try{return c.replace(b,function(b,d,c,f){if(d){b=parseInt(d,16);if(isNaN(b))throw Error();return h(b)}if(c){b=parseInt(c,16);if(isNaN(b))throw Error();return 65535>=b?h(b):h(55296+(b-=
65536)/1024,56320+(b&1023))}b=a[f];if(!b)throw Error();return b})}catch(f){return null}},_syntaxError:function(a){this._input=null;return Error('Syntax error: unexpected "'+a+'" on line '+this._line+".")},tokenize:function(a,b){function d(d){null!==h._input&&(h._input+=d,h._tokenizeToEnd(b,!1))}function f(){null!==h._input&&h._tokenizeToEnd(b,!0)}var h=this;this._line=1;"string"===typeof a?(this._input=a,c(function(){h._tokenizeToEnd(b,!0)})):(this._input="",a&&"function"!==typeof a?("function"===
typeof a.setEncoding&&a.setEncoding("utf8"),a.on("data",d),a.on("end",f)):(this.addChunk=d,this.end=f,b||(b=a)))}};B.exports=v},{}],6:[function(z,B,C){function v(d){if(!(this instanceof v))return new v(d);this._tripleStack=[];this._graph=null;d=d||{};this._setBase(d.documentIRI);var a="string"===typeof d.format&&d.format.match(/\w*$/)[0].toLowerCase(),b="turtle"===a,f="trig"===a,k=/triple/.test(a),a=/quad/.test(a),a=k||a;(this._supportsNamedGraphs=!b)||(this._readPredicateOrNamedGraph=this._readPredicate);
this._supportsQuads=!(b||f||k);a&&(this._base="",this._resolveIRI=function(d){this._error("Disallowed relative IRI",d);return this._callback=h,this._subject=null});this._blankNodePrefix="string"!==typeof d.blankNodePrefix?"":"_:"+d.blankNodePrefix.replace(/^_:/,"");this._lexer=d.lexer||new c({lineMode:a})}function h(){}var c=z("./N3Lexer"),b=/^[a-z][a-z0-9+.-]*:/i,a=/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i,f=/(?:^|\/)\.\.?(?:$|[\/#?])/,k=0,r=0;v._resetBlankNodeIds=function(){k=r=0};v.prototype=
{_setBase:function(d){if(!d)d=null;else if(0<=d.indexOf("#"))throw Error("Invalid base IRI "+d);if(this._base=d)this._basePath=d.replace(/[^\/?]*(?:\?.*)?$/,""),d=d.match(a),this._baseRoot=d[0],this._baseScheme=d[1]},_readInTopContext:function(d){switch(d.type){case "eof":if(null!==this._graph)return this._error("Unclosed graph",d);delete this._prefixes._;return this._callback(null,null,this._prefixes);case "@prefix":return this._sparqlStyle=!1,this._readPrefix;case "PREFIX":return this._sparqlStyle=
!0,this._readPrefix;case "@base":return this._sparqlStyle=!1,this._readBaseIRI;case "BASE":return this._sparqlStyle=!0,this._readBaseIRI;case "{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case "GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(d)}},_readSubject:function(d){this._predicate=null;switch(d.type){case "IRI":null===this._base||b.test(d.value)?this._subject=d.value:this._subject=this._resolveIRI(d);
break;case "prefixed":var a=this._prefixes[d.prefix];if(void 0===a)return this._error('Undefined prefix "'+d.prefix+':"',d);this._subject=a+d.value;break;case "[":return this._subject="_:b"+r++,this._tripleStack.push({subject:this._subject,predicate:null,object:null,type:"blank"}),this._readBlankNodeHead;case "(":return this._tripleStack.push({subject:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",predicate:null,object:null,type:"list"}),this._subject=null,this._readListItem;case "}":return this._readPunctuation(d);
default:return this._error("Expected subject but got "+d.type,d)}return this._readPredicateOrNamedGraph},_readPredicate:function(d){var a=d.type;switch(a){case "IRI":case "abbreviation":null===this._base||b.test(d.value)?this._predicate=d.value:this._predicate=this._resolveIRI(d);break;case "prefixed":if("_"===d.prefix)return this._error("Disallowed blank node as predicate",d);a=this._prefixes[d.prefix];if(void 0===a)return this._error('Undefined prefix "'+d.prefix+':"',d);this._predicate=a+d.value;
break;case ".":case "]":case "}":if(null===this._predicate)return this._error("Unexpected "+a,d);this._subject=null;return"]"===a?this._readBlankNodeTail(d):this._readPunctuation(d);case ";":return this._readPredicate;default:return this._error('Expected predicate to follow "'+this._subject+'"',d)}return this._readObject},_readObject:function(d){switch(d.type){case "IRI":null===this._base||b.test(d.value)?this._object=d.value:this._object=this._resolveIRI(d);break;case "prefixed":var a=this._prefixes[d.prefix];
if(void 0===a)return this._error('Undefined prefix "'+d.prefix+':"',d);this._object=a+d.value;break;case "literal":return this._object=d.value,this._readDataTypeOrLang;case "[":return d="_:b"+r++,this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:d,type:"blank"}),this._subject=d,this._readBlankNodeHead;case "(":return this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",type:"list"}),this._subject=
null,this._readListItem;default:return this._error('Expected object to follow "'+this._predicate+'"',d)}return this._getTripleEndReader()},_readPredicateOrNamedGraph:function(d){return"{"===d.type?this._readGraph(d):this._readPredicate(d)},_readGraph:function(d){if("{"!==d.type)return this._error("Expected graph but got "+d.type,d);this._graph=this._subject;this._subject=null;return this._readSubject},_readBlankNodeHead:function(d){if("]"===d.type)return this._subject=null,this._readBlankNodeTail(d);
this._predicate=null;return this._readPredicate(d)},_readBlankNodeTail:function(d){if("]"!==d.type)return this._readBlankNodePunctuation(d);null!==this._subject&&this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});d=this._tripleStack.pop();this._subject=d.subject;return null!==d.object?(this._predicate=d.predicate,this._object=d.object,this._getTripleEndReader()):null!==this._predicate?this._readPredicate:this._readPredicateOrNamedGraph},
_readDataTypeOrLang:function(d){switch(d.type){case "type":if(""===d.prefix)d=null===this._base||b.test(d.value)?d.value:this._resolveIRI(d);else{var a=this._prefixes[d.prefix];if(void 0===a)return this._error('Undefined prefix "'+d.prefix+':"',d);d=a+d.value}this._object+="^^"+d;return this._getTripleEndReader();case "langcode":return this._object+="@"+d.value.toLowerCase(),this._getTripleEndReader();default:return this._getTripleEndReader().call(this,d)}},_readListItem:function(d){var a=null,c=
null,f=this._subject,k=this._tripleStack,h=k[k.length-1],E=this._readListItem;switch(d.type){case "IRI":a=null===this._base||b.test(d.value)?d.value:this._resolveIRI(d);break;case "prefixed":a=this._prefixes[d.prefix];if(void 0===a)return this._error('Undefined prefix "'+d.prefix+':"',d);a+=d.value;break;case "literal":a=d.value;E=this._readDataTypeOrLang;break;case "[":c="_:b"+r++;a="_:b"+r++;k.push({subject:c,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",object:a,type:"blank"});this._subject=
a;E=this._readBlankNodeHead;break;case "(":c="_:b"+r++;k.push({subject:c,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",object:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",type:"list"});this._subject=null;E=this._readListItem;break;case ")":k.pop();0!==k.length&&"list"===k[k.length-1].type&&this._callback(null,{subject:h.subject,predicate:h.predicate,object:h.object,graph:this._graph||""});this._subject=h.subject;if(null===h.predicate){if(E=this._readPredicate,"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"===
h.subject)return E}else if(this._predicate=h.predicate,this._object=h.object,E=this._getTripleEndReader(),"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"===h.object)return E;c="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";break;default:return this._error('Expected list item instead of "'+d.type+'"',d)}null===c&&(this._subject=c="_:b"+r++);null===f?"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"===h.object?h.object=c:h.subject=c:this._callback(null,{subject:f,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",
object:c,graph:this._graph||""});null!==a&&this._callback(null,{subject:c,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",object:a,graph:this._graph||""});return E},_readPunctuation:function(d){var a=this._subject,c=this._graph;switch(d.type){case "}":if(null===this._graph)return this._error("Unexpected graph closing",d);this._graph=null;case ".":this._subject=null;d=this._readInTopContext;break;case ";":d=this._readPredicate;break;case ",":d=this._readObject;break;case "IRI":if(this._supportsQuads&&
null===this._graph){c=null===this._base||b.test(d.value)?d.value:this._resolveIRI(d);a=this._subject;d=this._readQuadPunctuation;break}case "prefixed":if(this._supportsQuads&&null===this._graph){c=this._prefixes[d.prefix];if(void 0===c)return this._error('Undefined prefix "'+d.prefix+':"',d);c+=d.value;d=this._readQuadPunctuation;break}default:return this._error('Expected punctuation to follow "'+this._object+'"',d)}null!==a&&this._callback(null,{subject:a,predicate:this._predicate,object:this._object,
graph:c||""});return d},_readBlankNodePunctuation:function(d){switch(d.type){case ";":d=this._readPredicate;break;case ",":d=this._readObject;break;default:return this._error('Expected punctuation to follow "'+this._object+'"',d)}this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});return d},_readQuadPunctuation:function(d){return"."!==d.type?this._error("Expected dot to follow quad",d):this._readInTopContext},_readPrefix:function(d){if("prefix"!==
d.type)return this._error("Expected prefix to follow @prefix",d);this._prefix=d.value;return this._readPrefixIRI},_readPrefixIRI:function(d){if("IRI"!==d.type)return this._error('Expected IRI to follow prefix "'+this._prefix+':"',d);d=null===this._base||b.test(d.value)?d.value:this._resolveIRI(d);this._prefixes[this._prefix]=d;this._prefixCallback(this._prefix,d);return this._readDeclarationPunctuation},_readBaseIRI:function(d){if("IRI"!==d.type)return this._error("Expected IRI to follow base declaration",
d);try{this._setBase(null===this._base||b.test(d.value)?d.value:this._resolveIRI(d))}catch(a){this._error(a.message,d)}return this._readDeclarationPunctuation},_readNamedGraphLabel:function(d){switch(d.type){case "IRI":case "prefixed":return this._readSubject(d),this._readGraph;case "[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",d)}},_readNamedGraphBlankLabel:function(d){if("]"!==d.type)return this._error("Invalid graph label",d);this._subject="_:b"+r++;
return this._readGraph},_readDeclarationPunctuation:function(d){return this._sparqlStyle?this._readInTopContext(d):"."!==d.type?this._error("Expected declaration to end with a dot",d):this._readInTopContext},_getTripleEndReader:function(){var d=this._tripleStack;if(0===d.length)return this._readPunctuation;switch(d[d.length-1].type){case "blank":return this._readBlankNodeTail;case "list":return this._readListItem}},_error:function(d,a){this._callback(Error(d+" at line "+a.line+"."))},_resolveIRI:function(d){d=
d.value;switch(d[0]){case void 0:return this._base;case "#":return this._base+d;case "?":return this._base.replace(/(?:\?.*)?$/,d);case "/":return("/"===d[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(d);default:return this._removeDotSegments(this._basePath+d)}},_removeDotSegments:function(d){if(!f.test(d))return d;for(var a="",b=d.length,c=-1,k=-1,h=0,r="/";c<b;){switch(r){case ":":if(0>k&&"/"===d[++c]&&"/"===d[++c])for(;(k=c+1)<b&&"/"!==d[k];)c=k;break;case "?":case "#":c=b;break;
case "/":if("."===d[c+1])switch(r=d[++c+1],r){case "/":a+=d.substring(h,c-1);h=c+1;break;case void 0:case "?":case "#":return a+d.substring(h,c)+d.substr(c+1);case ".":if(r=d[++c+1],void 0===r||"/"===r||"?"===r||"#"===r){a+=d.substring(h,c-2);(h=a.lastIndexOf("/"))>=k&&(a=a.substr(0,h));if("/"!==r)return a+"/"+d.substr(c+1);h=c+1}}}r=d[++c]}return a+d.substring(h)},parse:function(d,a,b){this._readCallback=this._readInTopContext;this._prefixes=Object.create(null);this._prefixes._=this._blankNodePrefix||
"_:b"+k++ +"_";"function"===typeof d&&(b=a,a=d,d=null);this._callback=a||h;this._prefixCallback=b||h;var c=this;this._lexer.tokenize(d,function(d,a){null!==d?(c._callback(d),c._callback=h):void 0!==c._readCallback&&(c._readCallback=c._readCallback(a))});d||(this.addChunk=this._lexer.addChunk,this.end=this._lexer.end)}};B.exports=v},{"./N3Lexer":5}],7:[function(z,B,C){function v(c,b){if(!(this instanceof v))return new v(c,b);this._size=0;this._graphs=Object.create(null);this._id=0;this._ids=Object.create(null);
this._ids["><"]=0;this._entities=Object.create(null);this._blankNodeIndex=0;b||!c||c[0]||(b=c,c=null);b=b||{};this._prefixes=Object.create(null);b.prefixes&&this.addPrefixes(b.prefixes);this.defaultGraph=b.defaultGraph||"http://example.org/#defaultGraph";c&&this.addTriples(c)}var h=z("./N3Util").expandPrefixedName;v.prototype={get size(){var c=this._size;if(null!==c)return c;var b=this._graphs,a,f,k;for(k in b)for(var h in a=b[k].subjects)for(var d in f=a[h])c+=Object.keys(f[d]).length;return this._size=
c},_addToIndex:function(c,b,a,f){c=c[b]||(c[b]={});a=c[a]||(c[a]={});(c=f in a)||(a[f]=null);return!c},_removeFromIndex:function(c,b,a,f){var k=c[b],h=k[a],d;delete h[f];for(d in h)return;delete k[a];for(d in k)return;delete c[b]},_findInIndex:function(c,b,a,f,k,h,d,l){var m=[],u,n,x=1< !b+!a+!f?Object.keys(this._ids):this._entities;b&&((u=c,c={})[b]=u[b]);for(var E in c){var y=x[E];if(b=c[E]){a&&((u=b,b={})[a]=u[a]);for(var M in b){var F=x[M];if(n=b[M]){n=f?f in n?[f]:[]:Object.keys(n);for(var H=
n.length-1;0<=H;H--){var A={subject:"",predicate:"",object:"",graph:l};A[k]=y;A[h]=F;A[d]=x[n[H]];m.push(A)}}}}}return m},_countInIndex:function(c,b,a,f){var k=0,h,d;b&&((h=c,c={})[b]=h[b]);for(var l in c)if(b=c[l]){a&&((h=b,b={})[a]=h[a]);for(var m in b)if(d=b[m])f?f in d&&k++:k+=Object.keys(d).length}return k},addTriple:function(c,b,a,f){b||(f=c.graph,a=c.object,b=c.predicate,c=c.subject);f=f||this.defaultGraph;var k=this._graphs[f];k||(k=this._graphs[f]={subjects:{},predicates:{},objects:{}},Object.freeze(k));
f=this._ids;var h=this._entities;c=f[c]||(f[h[++this._id]=c]=this._id);b=f[b]||(f[h[++this._id]=b]=this._id);a=f[a]||(f[h[++this._id]=a]=this._id);f=this._addToIndex(k.subjects,c,b,a);this._addToIndex(k.predicates,b,a,c);this._addToIndex(k.objects,a,c,b);this._size=null;return f},addTriples:function(c){for(var b=c.length-1;0<=b;b--)this.addTriple(c[b])},addPrefix:function(c,b){this._prefixes[c]=b},addPrefixes:function(c){for(var b in c)this.addPrefix(b,c[b])},removeTriple:function(c,b,a,f){b||(f=
c.graph,a=c.object,b=c.predicate,c=c.subject);f=f||this.defaultGraph;var k,h=this._ids,d=this._graphs;if(!((c=h[c])&&(b=h[b])&&(a=h[a])&&(k=d[f])))return!1;var l,m;if(!((l=k.subjects[c])&&(m=l[b])&&a in m))return!1;this._removeFromIndex(k.subjects,c,b,a);this._removeFromIndex(k.predicates,b,a,c);this._removeFromIndex(k.objects,a,c,b);null!==this._size&&this._size--;for(c in k.subjects)return!0;delete d[f];return!0},removeTriples:function(c){for(var b=c.length-1;0<=b;b--)this.removeTriple(c[b])},find:function(c,
b,a,f){var k=this._prefixes;return this.findByIRI(h(c,k),h(b,k),h(a,k),h(f,k))},findByIRI:function(c,b,a,f){var k=[],h={},d=this._ids,l,m,u;f?h[f]=this._graphs[f]:h=this._graphs;for(var n in h)if(f=h[n]){if(c&&!(l=d[c])||b&&!(m=d[b])||a&&!(u=d[a]))return k;l?u?k.push(this._findInIndex(f.objects,u,l,m,"object","subject","predicate",n)):k.push(this._findInIndex(f.subjects,l,m,null,"subject","predicate","object",n)):m?k.push(this._findInIndex(f.predicates,m,u,null,"predicate","object","subject",n)):
u?k.push(this._findInIndex(f.objects,u,null,null,"object","subject","predicate",n)):k.push(this._findInIndex(f.subjects,null,null,null,"subject","predicate","object",n))}return 1===k.length?k[0]:k.concat.apply([],k)},count:function(c,b,a,f){var k=this._prefixes;return this.countByIRI(h(c,k),h(b,k),h(a,k),h(f,k))},countByIRI:function(c,b,a,f){f=f||this.defaultGraph;f=this._graphs[f];var k=this._ids;return!f||c&&!(c=k[c])||b&&!(b=k[b])||a&&!(a=k[a])?0:c?a?this._countInIndex(f.objects,a,c,b):this._countInIndex(f.subjects,
c,b,a):b?this._countInIndex(f.predicates,b,a,c):this._countInIndex(f.objects,a,c,b)},createBlankNode:function(c){var b,a;if(c)for(b=c="_:"+c,a=1;this._ids[b];)b=c+a++;else{do b="_:b"+this._blankNodeIndex++;while(this._ids[b])}this._ids[b]=++this._id;return b}};B.exports=v},{"./N3Util":10}],8:[function(z,B,C){function v(b){if(!(this instanceof v))return new v(b);h.call(this,{decodeStrings:!0});this._readableState.objectMode=!0;var a=this,f=new c(b);f.parse(function(b,c){c&&a.push(c)||b&&a.emit("error",
b)},this.emit.bind(this,"prefix"));this._transform=function(a,b,d){f.addChunk(a);d()};this._flush=function(a){f.end();a()}}var h=z("stream").Transform;C=z("util");var c=z("./N3Parser.js");C.inherits(v,h);B.exports=v},{"./N3Parser.js":6,stream:30,util:38}],9:[function(z,B,C){function v(b){if(!(this instanceof v))return new v(b);h.call(this,{encoding:"utf8"});this._writableState.objectMode=!0;var a=this,f=new c({write:function(b,c,d){a.push(b);d&&d()},end:function(b){a.push(null);b&&b()}},b);this._transform=
function(a,b,d){f.addTriple(a,d)};this._flush=function(a){f.end(a)}}var h=z("stream").Transform;C=z("util");var c=z("./N3Writer.js");C.inherits(v,h);B.exports=v},{"./N3Writer.js":11,stream:30,util:38}],10:[function(z,B,C){function v(b,a){for(var f in c)a?b.prototype[f]=h(c[f]):b[f]=c[f];return b}function h(b){return function(a){return b(this,a)}}var c={isIRI:function(b){if(!b)return b;b=b[0];return'"'!==b&&"_"!==b},isLiteral:function(b){return b&&'"'===b[0]},isBlank:function(b){return b&&"_:"===b.substr(0,
2)},getLiteralValue:function(b){var a=/^"([^]*)"/.exec(b);if(!a)throw Error(b+" is not a literal");return a[1]},getLiteralType:function(b){var a=/^"[^]*"(?:\^\^([^"]+)|(@)[^@"]+)?$/.exec(b);if(!a)throw Error(b+" is not a literal");return a[1]||(a[2]?"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString":"http://www.w3.org/2001/XMLSchema#string")},getLiteralLanguage:function(b){var a=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(b);if(!a)throw Error(b+" is not a literal");return a[1]?a[1].toLowerCase():
""},isPrefixedName:function(b){return b&&/^[^:\/"']*:[^:\/"']+$/.test(b)},expandPrefixedName:function(b,a){var c=/(?:^|"\^\^)([^:\/#"'\^_]*):[^\/]*$/.exec(b),h,r,d;c&&(h=c[1],r=a[h],d=c.index);return void 0===r?b:0===d?r+b.substr(h.length+1):b.substr(0,d+3)+r+b.substr(d+h.length+4)},createIRI:function(b){return b&&'"'===b[0]?c.getLiteralValue(b):b},createLiteral:function(b,a){if(!a)switch(typeof b){case "boolean":a="http://www.w3.org/2001/XMLSchema#boolean";break;case "number":if(isFinite(b)){a=0===
b%1?"http://www.w3.org/2001/XMLSchema#integer":"http://www.w3.org/2001/XMLSchema#decimal";break}default:return'"'+b+'"'}return'"'+b+(/^[a-z]+(-[a-z0-9]+)*$/i.test(a)?'"@'+a.toLowerCase():'"^^'+a)},prefix:function(b){return c.prefixes({"":b})("")},prefixes:function(b){function a(a,d){if(d||!(a in c)){var b=Object.create(null);d=d||"";c[a]=function(a){return b[a]||(b[a]=d+a)}}return c[a]}var c=Object.create(null),h;for(h in b)a(h,b[h]);return a}};B.exports=v(v)},{}],11:[function(z,B,C){function v(a,
b){if(!(this instanceof v))return new v(a,b);a&&"function"!==typeof a.write&&(b=a,a=null);b=b||{};if(a)this._outputStream=a,this._endStream=void 0===b.end?!0:!!b.end;else{var d="";this._outputStream={write:function(a,b,c){d+=a;c&&c()},end:function(a){a&&a(null,d)}};this._endStream=!0}this._subject=null;/triple|quad/i.test(b.format)?this._writeTriple=this._writeTripleLine:(this._graph="",this._prefixIRIs=Object.create(null),b.prefixes&&this.addPrefixes(b.prefixes))}function h(a){var b=f[a];void 0===
b&&(1===a.length?(b=a.charCodeAt(0).toString(16),b="\\u0000".substr(0,6-b.length)+b):(b=(1024*(a.charCodeAt(0)-55296)+a.charCodeAt(1)+9216).toString(16),b="\\U00000000".substr(0,10-b.length)+b));return b}var c=/^"([^]*)"(?:\^\^(.+)|@([\-a-z]+))?$/i,b=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,a=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,f={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};v.prototype={_write:function(a,b){this._outputStream.write(a,
"utf8",b)},_writeTriple:function(a,b,d,c,f){try{this._graph!==c&&(this._write((null===this._subject?"":this._graph?"\n}\n":".\n")+(c?this._encodeIriOrBlankNode(c)+" {\n":"")),this._subject=null,this._graph="["!==c[0]?c:"]"),this._subject===a?this._predicate===b?this._write(", "+this._encodeObject(d),f):this._write(";\n "+this._encodePredicate(this._predicate=b)+" "+this._encodeObject(d),f):this._write((null===this._subject?"":".\n")+this._encodeSubject(this._subject=a)+" "+this._encodePredicate(this._predicate=
b)+" "+this._encodeObject(d),f)}catch(h){f&&f(h)}},_writeTripleLine:function(a,b,d,c,f){delete this._prefixMatch;try{this._write(this._encodeIriOrBlankNode(a)+" "+this._encodeIriOrBlankNode(b)+" "+this._encodeObject(d)+(c?" "+this._encodeIriOrBlankNode(c)+".\n":".\n"),f)}catch(h){f&&f(h)}},_encodeIriOrBlankNode:function(c){var f=c[0];if("["===f||"("===f||"_"===f&&":"===c[1])return c;b.test(c)&&(c=c.replace(a,h));return(f=this._prefixRegex.exec(c))?f[1]?this._prefixIRIs[f[1]]+f[2]:c:"<"+c+">"},_encodeLiteral:function(c,
f,d){b.test(c)&&(c=c.replace(a,h));return d?'"'+c+'"@'+d:f?'"'+c+'"^^'+this._encodeIriOrBlankNode(f):'"'+c+'"'},_encodeSubject:function(a){if('"'===a[0])throw Error("A literal as subject is not allowed: "+a);"["===a[0]&&(this._subject="]");return this._encodeIriOrBlankNode(a)},_encodePredicate:function(a){if('"'===a[0])throw Error("A literal as predicate is not allowed: "+a);return"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===a?"a":this._encodeIriOrBlankNode(a)},_encodeObject:function(a){if('"'!==
a[0])return this._encodeIriOrBlankNode(a);var b=c.exec(a);if(!b)throw Error("Invalid literal: "+a);return this._encodeLiteral(b[1],b[2],b[3])},_blockedWrite:function(){throw Error("Cannot write because the writer has been closed.");},addTriple:function(a,b,d,c,f){void 0===d?this._writeTriple(a.subject,a.predicate,a.object,a.graph||"",b):"string"!==typeof c?this._writeTriple(a,b,d,"",c):this._writeTriple(a,b,d,c,f)},addTriples:function(a){for(var b=0;b<a.length;b++)this.addTriple(a[b])},addPrefix:function(a,
b,d){var c={};c[a]=b;this.addPrefixes(c,d)},addPrefixes:function(a,b){var d=this._prefixIRIs,c=!1,f;for(f in a){var h=a[f];/[#\/]$/.test(h)&&d[h]!==(f+=":")&&(c=!0,d[h]=f,null!==this._subject&&(this._write(this._graph?"\n}\n":".\n"),this._subject=null,this._graph=""),this._write("@prefix "+f+" <"+h+">.\n"))}if(c){var h=f="",n;for(n in d)f+=f?"|"+n:n,h+=(h?"|":"")+d[n];f=f.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^(?:"+h+")[^/]*$|^("+f+")([a-zA-Z][\\-_a-zA-Z0-9]*)$")}this._write(c?
"\n":"",b)},blank:function(a,b){var d=a,c,f;void 0===a?d=[]:"string"===typeof a?d=[{predicate:a,object:b}]:"length"in a||(d=[a]);switch(f=d.length){case 0:return"[]";case 1:if(c=d[0],"["!==c.object[0])return"[ "+this._encodePredicate(c.predicate)+" "+this._encodeObject(c.object)+" ]";default:for(var h="[",n=0;n<f;n++)c=d[n],c.predicate===a?h+=", "+this._encodeObject(c.object):(h+=(n?";\n ":"\n ")+this._encodePredicate(c.predicate)+" "+this._encodeObject(c.object),a=c.predicate);return h+"\n]"}},
list:function(a){for(var b=a&&a.length||0,d=Array(b),c=0;c<b;c++)d[c]=this._encodeObject(a[c]);return"("+d.join(" ")+")"},_prefixRegex:/$0^/,end:function(a){null!==this._subject&&(this._write(this._graph?"\n}\n":".\n"),this._subject=null);this._write=this._blockedWrite;var b=a&&function(d,c){b=null;a(d,c)};if(this._endStream)try{return this._outputStream.end(b)}catch(d){}b&&b()}};B.exports=v},{}],12:[function(z,B,C){(function(){function v(c){this.message=c}var h="undefined"!=typeof C?C:this;v.prototype=
Error();v.prototype.name="InvalidCharacterError";h.btoa||(h.btoa=function(c){for(var b,a,f=0,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="";c.charAt(f|0)||(h="=",f%1);r+=h.charAt(63&b>>8-f%1*8)){a=c.charCodeAt(f+=.75);if(255<a)throw new v("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");b=b<<8|a}return r});h.atob||(h.atob=function(c){c=c.replace(/=+$/,"");if(1==c.length%4)throw new v("'atob' failed: The string to be decoded is not correctly encoded.");
for(var b=0,a,f,h=0,r="";f=c.charAt(h++);~f&&(a=b%4?64*a+f:f,b++%4)?r+=String.fromCharCode(255&a>>(-2*b&6)):0)f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f);return r})})()},{}],13:[function(z,B,C){(function(v){function h(b){b=b.charCodeAt(0);if(43===b||45===b)return 62;if(47===b||95===b)return 63;if(48>b)return-1;if(58>b)return b-48+52;if(91>b)return b-65;if(123>b)return b-97+26}var c="undefined"!==typeof Uint8Array?Uint8Array:Array;v.toByteArray=function(b){function a(d){l[m++]=
d}var f,k,r,d,l;if(0<b.length%4)throw Error("Invalid string. Length must be a multiple of 4");f=b.length;d="="===b.charAt(f-2)?2:"="===b.charAt(f-1)?1:0;l=new c(3*b.length/4-d);k=0<d?b.length-4:b.length;var m=0;for(f=0;f<k;f+=4)r=h(b.charAt(f))<<18|h(b.charAt(f+1))<<12|h(b.charAt(f+2))<<6|h(b.charAt(f+3)),a((r&16711680)>>16),a((r&65280)>>8),a(r&255);2===d?(r=h(b.charAt(f))<<2|h(b.charAt(f+1))>>4,a(r&255)):1===d&&(r=h(b.charAt(f))<<10|h(b.charAt(f+1))<<4|h(b.charAt(f+2))>>2,a(r>>8&255),a(r&255));return l};
v.fromByteArray=function(b){var a,c=b.length%3,h="",r,d;a=0;for(d=b.length-c;a<d;a+=3)r=(b[a]<<16)+(b[a+1]<<8)+b[a+2],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>18&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>12&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r&63),h+=r;switch(c){case 1:r=b[b.length-1];h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>
2);h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<4&63);h+="==";break;case 2:r=(b[b.length-2]<<8)+b[b.length-1],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>10),h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>4&63),h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<2&63),h+="="}return h}})("undefined"===typeof C?this.base64js={}:C)},{}],14:[function(z,B,C){function v(d,
a,b){if(!(this instanceof v))return new v(d,a,b);var c=typeof d;if("base64"===a&&"string"===c)for(d=d.trim?d.trim():d.replace(/^\s+|\s+$/g,"");0!==d.length%4;)d+="=";var f;if("number"===c)f=y(d);else if("string"===c)f=v.byteLength(d,a);else if("object"===c)f=y(d.length);else throw Error("First argument needs to be a number, array or string.");var h;v._useTypedArrays?h=v._augment(new Uint8Array(f)):(h=this,h.length=f,h._isBuffer=!0);if(v._useTypedArrays&&"number"===typeof d.byteLength)h._set(d);else{var k=
d;if(M(k)||v.isBuffer(k)||k&&"object"===typeof k&&"number"===typeof k.length)for(a=0;a<f;a++)v.isBuffer(d)?h[a]=d.readUInt8(a):h[a]=d[a];else if("string"===c)h.write(d,0,a);else if("number"===c&&!v._useTypedArrays&&!b)for(a=0;a<f;a++)h[a]=0}return h}function h(d,a,b){var c="";for(b=Math.min(d.length,b);a<b;a++)c+=String.fromCharCode(d[a]);return c}function c(d,a,b,c){c||(J("boolean"===typeof b,"missing or invalid endian"),J(void 0!==a&&null!==a,"missing offset"),J(a+1<d.length,"Trying to read beyond buffer length"));
c=d.length;if(!(a>=c))return b?(b=d[a],a+1<c&&(b|=d[a+1]<<8)):(b=d[a]<<8,a+1<c&&(b|=d[a+1])),b}function b(d,a,b,c){c||(J("boolean"===typeof b,"missing or invalid endian"),J(void 0!==a&&null!==a,"missing offset"),J(a+3<d.length,"Trying to read beyond buffer length"));c=d.length;if(!(a>=c)){var f;b?(a+2<c&&(f=d[a+2]<<16),a+1<c&&(f|=d[a+1]<<8),f|=d[a],a+3<c&&(f+=d[a+3]<<24>>>0)):(a+1<c&&(f=d[a+1]<<16),a+2<c&&(f|=d[a+2]<<8),a+3<c&&(f|=d[a+3]),f+=d[a]<<24>>>0);return f}}function a(d,a,b,f){f||(J("boolean"===
typeof b,"missing or invalid endian"),J(void 0!==a&&null!==a,"missing offset"),J(a+1<d.length,"Trying to read beyond buffer length"));if(!(a>=d.length))return d=c(d,a,b,!0),d&32768?-1*(65535-d+1):d}function f(d,a,c,f){f||(J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==a&&null!==a,"missing offset"),J(a+3<d.length,"Trying to read beyond buffer length"));if(!(a>=d.length))return d=b(d,a,c,!0),d&2147483648?-1*(4294967295-d+1):d}function k(d,a,b,c){c||(J("boolean"===typeof b,"missing or invalid endian"),
J(a+3<d.length,"Trying to read beyond buffer length"));return ya.read(d,a,b,23,4)}function r(d,a,b,c){c||(J("boolean"===typeof b,"missing or invalid endian"),J(a+7<d.length,"Trying to read beyond buffer length"));return ya.read(d,a,b,52,8)}function d(d,a,b,c,f){f||(J(void 0!==a&&null!==a,"missing value"),J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==b&&null!==b,"missing offset"),J(b+1<d.length,"trying to write beyond buffer length"),N(a,65535));var h=d.length;if(!(b>=h))for(f=0,h=
Math.min(h-b,2);f<h;f++)d[b+f]=(a&255<<8*(c?f:1-f))>>>8*(c?f:1-f)}function l(d,a,b,c,f){f||(J(void 0!==a&&null!==a,"missing value"),J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==b&&null!==b,"missing offset"),J(b+3<d.length,"trying to write beyond buffer length"),N(a,4294967295));var h=d.length;if(!(b>=h))for(f=0,h=Math.min(h-b,4);f<h;f++)d[b+f]=a>>>8*(c?f:3-f)&255}function m(a,b,c,f,h){h||(J(void 0!==b&&null!==b,"missing value"),J("boolean"===typeof f,"missing or invalid endian"),
J(void 0!==c&&null!==c,"missing offset"),J(c+1<a.length,"Trying to write beyond buffer length"),W(b,32767,-32768));c>=a.length||(0<=b?d(a,b,c,f,h):d(a,65535+b+1,c,f,h))}function u(d,a,b,c,f){f||(J(void 0!==a&&null!==a,"missing value"),J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==b&&null!==b,"missing offset"),J(b+3<d.length,"Trying to write beyond buffer length"),W(a,2147483647,-2147483648));b>=d.length||(0<=a?l(d,a,b,c,f):l(d,4294967295+a+1,b,c,f))}function n(d,a,b,c,f){f||(J(void 0!==
a&&null!==a,"missing value"),J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==b&&null!==b,"missing offset"),J(b+3<d.length,"Trying to write beyond buffer length"),O(a,3.4028234663852886E38,-3.4028234663852886E38));b>=d.length||ya.write(d,a,b,c,23,4)}function x(d,a,b,c,f){f||(J(void 0!==a&&null!==a,"missing value"),J("boolean"===typeof c,"missing or invalid endian"),J(void 0!==b&&null!==b,"missing offset"),J(b+7<d.length,"Trying to write beyond buffer length"),O(a,1.7976931348623157E308,
-1.7976931348623157E308));b>=d.length||ya.write(d,a,b,c,52,8)}function E(d,a,b){if("number"!==typeof d)return b;d=~~d;if(d>=a)return a;if(0<=d)return d;d+=a;return 0<=d?d:0}function y(d){d=~~Math.ceil(+d);return 0>d?0:d}function M(d){return(Array.isArray||function(d){return"[object Array]"===Object.prototype.toString.call(d)})(d)}function F(d){return 16>d?"0"+d.toString(16):d.toString(16)}function H(d){for(var a=[],b=0;b<d.length;b++){var c=d.charCodeAt(b);if(127>=c)a.push(d.charCodeAt(b));else{var f=
b;55296<=c&&57343>=c&&b++;c=encodeURIComponent(d.slice(f,b+1)).substr(1).split("%");for(f=0;f<c.length;f++)a.push(parseInt(c[f],16))}}return a}function A(d){for(var a=[],b=0;b<d.length;b++)a.push(d.charCodeAt(b)&255);return a}function D(d,a,b,c){for(var f=0;f<c&&!(f+b>=a.length||f>=d.length);f++)a[f+b]=d[f];return f}function P(d){try{return decodeURIComponent(d)}catch(a){return String.fromCharCode(65533)}}function N(d,a){J("number"===typeof d,"cannot write a non-number as a number");J(0<=d,"specified a negative value for writing an unsigned value");
J(d<=a,"value is larger than maximum value for type");J(Math.floor(d)===d,"value has a fractional component")}function W(d,a,b){J("number"===typeof d,"cannot write a non-number as a number");J(d<=a,"value larger than maximum allowed value");J(d>=b,"value smaller than minimum allowed value");J(Math.floor(d)===d,"value has a fractional component")}function O(d,a,b){J("number"===typeof d,"cannot write a non-number as a number");J(d<=a,"value larger than maximum allowed value");J(d>=b,"value smaller than minimum allowed value")}
function J(d,a){if(!d)throw Error(a||"Failed assertion");}var ta=z("base64-js"),ya=z("ieee754");C.Buffer=v;C.SlowBuffer=v;C.INSPECT_MAX_BYTES=50;v.poolSize=8192;v._useTypedArrays=function(){try{var d=new ArrayBuffer(0),a=new Uint8Array(d);a.foo=function(){return 42};return 42===a.foo()&&"function"===typeof a.subarray}catch(b){return!1}}();v.isEncoding=function(d){switch(String(d).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "raw":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;
default:return!1}};v.isBuffer=function(d){return!(null===d||void 0===d||!d._isBuffer)};v.byteLength=function(d,a){var b;d+="";switch(a||"utf8"){case "hex":b=d.length/2;break;case "utf8":case "utf-8":b=H(d).length;break;case "ascii":case "binary":case "raw":b=d.length;break;case "base64":b=ta.toByteArray(d).length;break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=2*d.length;break;default:throw Error("Unknown encoding");}return b};v.concat=function(d,a){J(M(d),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.");
if(0===d.length)return new v(0);if(1===d.length)return d[0];var b;if("number"!==typeof a)for(b=a=0;b<d.length;b++)a+=d[b].length;var c=new v(a),f=0;for(b=0;b<d.length;b++){var h=d[b];h.copy(c,f);f+=h.length}return c};v.prototype.write=function(d,a,b,c){if(isFinite(a))isFinite(b)||(c=b,b=void 0);else{var f=c;c=a;a=b;b=f}a=Number(a)||0;f=this.length-a;b?(b=Number(b),b>f&&(b=f)):b=f;c=String(c||"utf8").toLowerCase();switch(c){case "hex":a=Number(a)||0;c=this.length-a;b?(b=Number(b),b>c&&(b=c)):b=c;c=
d.length;J(0===c%2,"Invalid hex string");b>c/2&&(b=c/2);for(c=0;c<b;c++)f=parseInt(d.substr(2*c,2),16),J(!isNaN(f),"Invalid hex string"),this[a+c]=f;v._charsWritten=2*c;d=c;break;case "utf8":case "utf-8":d=v._charsWritten=D(H(d),this,a,b);break;case "ascii":d=v._charsWritten=D(A(d),this,a,b);break;case "binary":d=v._charsWritten=D(A(d),this,a,b);break;case "base64":d=v._charsWritten=D(ta.toByteArray(d),this,a,b);break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":for(var h,f=[],k=0;k<d.length;k++)h=
d.charCodeAt(k),c=h>>8,h%=256,f.push(h),f.push(c);d=v._charsWritten=D(f,this,a,b);break;default:throw Error("Unknown encoding");}return d};v.prototype.toString=function(d,a,b){d=String(d||"utf8").toLowerCase();a=Number(a)||0;b=void 0!==b?Number(b):b=this.length;if(b===a)return"";switch(d){case "hex":d=this.length;if(!a||0>a)a=0;if(!b||0>b||b>d)b=d;for(d="";a<b;a++)d+=F(this[a]);b=d;break;case "utf8":case "utf-8":var c=d="";for(b=Math.min(this.length,b);a<b;a++)127>=this[a]?(d+=P(c)+String.fromCharCode(this[a]),
c=""):c+="%"+this[a].toString(16);b=d+P(c);break;case "ascii":b=h(this,a,b);break;case "binary":b=h(this,a,b);break;case "base64":b=0===a&&b===this.length?ta.fromByteArray(this):ta.fromByteArray(this.slice(a,b));break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(a,b);a="";for(d=0;d<b.length;d+=2)a+=String.fromCharCode(b[d]+256*b[d+1]);b=a;break;default:throw Error("Unknown encoding");}return b};v.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||
this,0)}};v.prototype.copy=function(d,a,b,c){b||(b=0);c||0===c||(c=this.length);a||(a=0);if(c!==b&&0!==d.length&&0!==this.length)if(J(c>=b,"sourceEnd < sourceStart"),J(0<=a&&a<d.length,"targetStart out of bounds"),J(0<=b&&b<this.length,"sourceStart out of bounds"),J(0<=c&&c<=this.length,"sourceEnd out of bounds"),c>this.length&&(c=this.length),d.length-a<c-b&&(c=d.length-a+b),c-=b,100>c||!v._useTypedArrays)for(var f=0;f<c;f++)d[f+a]=this[f+b];else d._set(this.subarray(b,b+c),a)};v.prototype.slice=
function(d,a){var b=this.length;d=E(d,b,0);a=E(a,b,b);if(v._useTypedArrays)return v._augment(this.subarray(d,a));for(var b=a-d,c=new v(b,void 0,!0),f=0;f<b;f++)c[f]=this[f+d];return c};v.prototype.get=function(d){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(d)};v.prototype.set=function(d,a){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(d,a)};v.prototype.readUInt8=function(d,a){a||(J(void 0!==d&&null!==
d,"missing offset"),J(d<this.length,"Trying to read beyond buffer length"));if(!(d>=this.length))return this[d]};v.prototype.readUInt16LE=function(d,a){return c(this,d,!0,a)};v.prototype.readUInt16BE=function(d,a){return c(this,d,!1,a)};v.prototype.readUInt32LE=function(d,a){return b(this,d,!0,a)};v.prototype.readUInt32BE=function(d,a){return b(this,d,!1,a)};v.prototype.readInt8=function(d,a){a||(J(void 0!==d&&null!==d,"missing offset"),J(d<this.length,"Trying to read beyond buffer length"));if(!(d>=
this.length))return this[d]&128?-1*(255-this[d]+1):this[d]};v.prototype.readInt16LE=function(d,b){return a(this,d,!0,b)};v.prototype.readInt16BE=function(d,b){return a(this,d,!1,b)};v.prototype.readInt32LE=function(d,a){return f(this,d,!0,a)};v.prototype.readInt32BE=function(d,a){return f(this,d,!1,a)};v.prototype.readFloatLE=function(d,a){return k(this,d,!0,a)};v.prototype.readFloatBE=function(d,a){return k(this,d,!1,a)};v.prototype.readDoubleLE=function(d,a){return r(this,d,!0,a)};v.prototype.readDoubleBE=
function(d,a){return r(this,d,!1,a)};v.prototype.writeUInt8=function(d,a,b){b||(J(void 0!==d&&null!==d,"missing value"),J(void 0!==a&&null!==a,"missing offset"),J(a<this.length,"trying to write beyond buffer length"),N(d,255));a>=this.length||(this[a]=d)};v.prototype.writeUInt16LE=function(a,b,c){d(this,a,b,!0,c)};v.prototype.writeUInt16BE=function(a,b,c){d(this,a,b,!1,c)};v.prototype.writeUInt32LE=function(d,a,b){l(this,d,a,!0,b)};v.prototype.writeUInt32BE=function(d,a,b){l(this,d,a,!1,b)};v.prototype.writeInt8=
function(d,a,b){b||(J(void 0!==d&&null!==d,"missing value"),J(void 0!==a&&null!==a,"missing offset"),J(a<this.length,"Trying to write beyond buffer length"),W(d,127,-128));a>=this.length||(0<=d?this.writeUInt8(d,a,b):this.writeUInt8(255+d+1,a,b))};v.prototype.writeInt16LE=function(d,a,b){m(this,d,a,!0,b)};v.prototype.writeInt16BE=function(d,a,b){m(this,d,a,!1,b)};v.prototype.writeInt32LE=function(d,a,b){u(this,d,a,!0,b)};v.prototype.writeInt32BE=function(d,a,b){u(this,d,a,!1,b)};v.prototype.writeFloatLE=
function(d,a,b){n(this,d,a,!0,b)};v.prototype.writeFloatBE=function(d,a,b){n(this,d,a,!1,b)};v.prototype.writeDoubleLE=function(d,a,b){x(this,d,a,!0,b)};v.prototype.writeDoubleBE=function(d,a,b){x(this,d,a,!1,b)};v.prototype.fill=function(d,a,b){d||(d=0);a||(a=0);b||(b=this.length);"string"===typeof d&&(d=d.charCodeAt(0));J("number"===typeof d&&!isNaN(d),"value is not a number");J(b>=a,"end < start");if(b!==a&&0!==this.length)for(J(0<=a&&a<this.length,"start out of bounds"),J(0<=b&&b<=this.length,
"end out of bounds");a<b;a++)this[a]=d};v.prototype.inspect=function(){for(var d=[],a=this.length,b=0;b<a;b++)if(d[b]=F(this[b]),b===C.INSPECT_MAX_BYTES){d[b+1]="...";break}return"<Buffer "+d.join(" ")+">"};v.prototype.toArrayBuffer=function(){if("undefined"!==typeof Uint8Array){if(v._useTypedArrays)return(new v(this)).buffer;for(var d=new Uint8Array(this.length),a=0,b=d.length;a<b;a+=1)d[a]=this[a];return d.buffer}throw Error("Buffer.toArrayBuffer not supported in this browser");};var L=v.prototype;
v._augment=function(d){d._isBuffer=!0;d._get=d.get;d._set=d.set;d.get=L.get;d.set=L.set;d.write=L.write;d.toString=L.toString;d.toLocaleString=L.toString;d.toJSON=L.toJSON;d.copy=L.copy;d.slice=L.slice;d.readUInt8=L.readUInt8;d.readUInt16LE=L.readUInt16LE;d.readUInt16BE=L.readUInt16BE;d.readUInt32LE=L.readUInt32LE;d.readUInt32BE=L.readUInt32BE;d.readInt8=L.readInt8;d.readInt16LE=L.readInt16LE;d.readInt16BE=L.readInt16BE;d.readInt32LE=L.readInt32LE;d.readInt32BE=L.readInt32BE;d.readFloatLE=L.readFloatLE;
d.readFloatBE=L.readFloatBE;d.readDoubleLE=L.readDoubleLE;d.readDoubleBE=L.readDoubleBE;d.writeUInt8=L.writeUInt8;d.writeUInt16LE=L.writeUInt16LE;d.writeUInt16BE=L.writeUInt16BE;d.writeUInt32LE=L.writeUInt32LE;d.writeUInt32BE=L.writeUInt32BE;d.writeInt8=L.writeInt8;d.writeInt16LE=L.writeInt16LE;d.writeInt16BE=L.writeInt16BE;d.writeInt32LE=L.writeInt32LE;d.writeInt32BE=L.writeInt32BE;d.writeFloatLE=L.writeFloatLE;d.writeFloatBE=L.writeFloatBE;d.writeDoubleLE=L.writeDoubleLE;d.writeDoubleBE=L.writeDoubleBE;
d.fill=L.fill;d.inspect=L.inspect;d.toArrayBuffer=L.toArrayBuffer;return d}},{"base64-js":13,ieee754:22}],15:[function(z,B,C){function v(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}function h(b){return"function"===typeof b}function c(b){return"object"===typeof b&&null!==b}B.exports=v;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._maxListeners=void 0;v.defaultMaxListeners=10;v.prototype.setMaxListeners=function(b){if("number"!==typeof b||0>b||isNaN(b))throw TypeError("n must be a positive number");
this._maxListeners=b;return this};v.prototype.emit=function(b){var a,f,k,r;this._events||(this._events={});if("error"===b&&(!this._events.error||c(this._events.error)&&!this._events.error.length)){a=arguments[1];if(a instanceof Error)throw a;throw TypeError('Uncaught, unspecified "error" event.');}f=this._events[b];if(void 0===f)return!1;if(h(f))switch(arguments.length){case 1:f.call(this);break;case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:a=arguments.length;
k=Array(a-1);for(r=1;r<a;r++)k[r-1]=arguments[r];f.apply(this,k)}else if(c(f)){a=arguments.length;k=Array(a-1);for(r=1;r<a;r++)k[r-1]=arguments[r];f=f.slice();a=f.length;for(r=0;r<a;r++)f[r].apply(this,k)}return!0};v.prototype.addListener=function(b,a){var f;if(!h(a))throw TypeError("listener must be a function");this._events||(this._events={});this._events.newListener&&this.emit("newListener",b,h(a.listener)?a.listener:a);this._events[b]?c(this._events[b])?this._events[b].push(a):this._events[b]=
[this._events[b],a]:this._events[b]=a;c(this._events[b])&&!this._events[b].warned&&(f=void 0!==this._maxListeners?this._maxListeners:v.defaultMaxListeners)&&0<f&&this._events[b].length>f&&(this._events[b].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[b].length),"function"===typeof console.trace&&console.trace());return this};v.prototype.on=v.prototype.addListener;v.prototype.once=
function(b,a){function c(){this.removeListener(b,c);k||(k=!0,a.apply(this,arguments))}if(!h(a))throw TypeError("listener must be a function");var k=!1;c.listener=a;this.on(b,c);return this};v.prototype.removeListener=function(b,a){var f,k,r;if(!h(a))throw TypeError("listener must be a function");if(!this._events||!this._events[b])return this;f=this._events[b];r=f.length;k=-1;if(f===a||h(f.listener)&&f.listener===a)delete this._events[b],this._events.removeListener&&this.emit("removeListener",b,a);
else if(c(f)){for(;0<r--;)if(f[r]===a||f[r].listener&&f[r].listener===a){k=r;break}if(0>k)return this;1===f.length?(f.length=0,delete this._events[b]):f.splice(k,1);this._events.removeListener&&this.emit("removeListener",b,a)}return this};v.prototype.removeAllListeners=function(b){var a;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[b]&&delete this._events[b],this;if(0===arguments.length){for(a in this._events)"removeListener"!==
a&&this.removeAllListeners(a);this.removeAllListeners("removeListener");this._events={};return this}a=this._events[b];if(h(a))this.removeListener(b,a);else for(;a.length;)this.removeListener(b,a[a.length-1]);delete this._events[b];return this};v.prototype.listeners=function(b){return this._events&&this._events[b]?h(this._events[b])?[this._events[b]]:this._events[b].slice():[]};v.listenerCount=function(b,a){return b._events&&b._events[a]?h(b._events[a])?1:b._events[a].length:0}},{}],16:[function(z,
B,C){},{}],17:[function(z,B,C){function v(a){return a.toString(this.encoding)}function h(a){this.charLength=(a=this.charReceived=a.length%2)?2:0;return a}function c(a){this.charLength=(a=this.charReceived=a.length%3)?3:0;return a}var b=z("buffer").Buffer;z=C.StringDecoder=function(a){this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,"");if(a&&!b.isEncoding(a))throw Error("Unknown encoding: "+a);switch(this.encoding){case "utf8":this.surrogateSize=3;break;case "ucs2":case "utf16le":this.surrogateSize=
2;this.detectIncompleteChar=h;break;case "base64":this.surrogateSize=3;this.detectIncompleteChar=c;break;default:this.write=v;return}this.charBuffer=new b(6);this.charLength=this.charReceived=0};z.prototype.write=function(a){for(var b="",c=0;this.charLength;){var h=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;a.copy(this.charBuffer,this.charReceived,c,h);this.charReceived+=h-c;c=h;if(this.charReceived<this.charLength)return"";var b=this.charBuffer.slice(0,
this.charLength).toString(this.encoding),d=b.charCodeAt(b.length-1);if(55296<=d&&56319>=d)this.charLength+=this.surrogateSize,b="";else{this.charReceived=this.charLength=0;if(h==a.length)return b;a=a.slice(h,a.length);break}}d=this.detectIncompleteChar(a);c=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-d,c),this.charReceived=d,c-=d);b+=a.toString(this.encoding,0,c);c=b.length-1;d=b.charCodeAt(c);return 55296<=d&&56319>=d?(a=this.surrogateSize,this.charLength+=a,this.charReceived+=a,
this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(b.charAt(b.length-1),this.encoding),b.substring(0,c)):b};z.prototype.detectIncompleteChar=function(a){for(var b=3<=a.length?3:a.length;0<b;b--){var c=a[a.length-b];if(1==b&&6==c>>5){this.charLength=2;break}if(2>=b&&14==c>>4){this.charLength=3;break}if(3>=b&&30==c>>3){this.charLength=4;break}}return b};z.prototype.end=function(a){var b="";a&&a.length&&(b=this.write(a));this.charReceived&&(a=this.encoding,b+=this.charBuffer.slice(0,this.charReceived).toString(a));
return b}},{buffer:14}],18:[function(z,B,C){var v=B.exports;z("events");var h=z("./lib/request"),c=z("url");v.request=function(a,f){"string"===typeof a&&(a=c.parse(a));a||(a={});a.host||a.port||(a.port=parseInt(window.location.port,10));!a.host&&a.hostname&&(a.host=a.hostname);a.scheme||(a.scheme=window.location.protocol.split(":")[0]);a.host||(a.host=window.location.hostname||window.location.host);/:/.test(a.host)&&(a.port||(a.port=a.host.split(":")[1]),a.host=a.host.split(":")[0]);a.port||(a.port=
"https"==a.scheme?443:80);var k=new h(new b,a);if(f)k.on("response",f);return k};v.get=function(a,b){a.method="GET";var c=v.request(a,b);c.end();return c};v.Agent=function(){};v.Agent.defaultMaxSockets=4;var b=function(){if("undefined"===typeof window)throw Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject)for(var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],b=0;b<a.length;b++)try{var c=new window.ActiveXObject(a[b]);
return function(){if(c){var h=c;c=null;return h}return new window.ActiveXObject(a[b])}}catch(h){}throw Error("ajax not supported in this browser");}();v.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",
400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",
425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{"./lib/request":19,events:15,url:36}],19:[function(z,B,C){C=z("stream");
var v=z("./response"),h=z("Base64");z=z("inherits");var c=B.exports=function(a,c){var r=this;r.writable=!0;r.xhr=a;r.body=[];r.uri=(c.scheme||"http")+"://"+c.host+(c.port?":"+c.port:"")+(c.path||"/");"undefined"===typeof c.withCredentials&&(c.withCredentials=!0);try{a.withCredentials=c.withCredentials}catch(n){}a.open(c.method||"GET",r.uri,!0);r._headers={};if(c.headers)for(var d=b(c.headers),l=0;l<d.length;l++){var m=d[l];r.isSafeRequestHeader(m)&&r.setHeader(m,c.headers[m])}c.auth&&this.setHeader("Authorization",
"Basic "+h.btoa(c.auth));var u=new v;u.on("close",function(){r.emit("close")});u.on("ready",function(){r.emit("response",u)});a.onreadystatechange=function(){a.__aborted||u.handle(a)}};z(c,C);c.prototype.setHeader=function(a,b){this._headers[a.toLowerCase()]=b};c.prototype.getHeader=function(a){return this._headers[a.toLowerCase()]};c.prototype.removeHeader=function(a){delete this._headers[a.toLowerCase()]};c.prototype.write=function(a){this.body.push(a)};c.prototype.destroy=function(a){this.xhr.__aborted=
!0;this.xhr.abort();this.emit("close")};c.prototype.end=function(c){void 0!==c&&this.body.push(c);var h=b(this._headers);for(c=0;c<h.length;c++){var r=h[c],d=this._headers[r];if(a(d))for(var l=0;l<d.length;l++)this.xhr.setRequestHeader(r,d[l]);else this.xhr.setRequestHeader(r,d)}if(0===this.body.length)this.xhr.send("");else if("string"===typeof this.body[0])this.xhr.send(this.body.join(""));else{if(a(this.body[0]))for(h=[],c=0;c<this.body.length;c++)h.push.apply(h,this.body[c]);else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){for(c=
l=0;c<this.body.length;c++)l+=this.body[c].length;h=new this.body[0].constructor(l);for(c=r=0;c<this.body.length;c++)for(d=this.body[c],l=0;l<d.length;l++)h[r++]=d[l]}else for(h="",c=0;c<this.body.length;c++)h+=this.body[c].toString();this.xhr.send(h)}};c.unsafeHeaders="accept-charset accept-encoding access-control-request-headers access-control-request-method connection content-length cookie cookie2 content-transfer-encoding date expect host keep-alive origin referer te trailer transfer-encoding upgrade user-agent via".split(" ");
c.prototype.isSafeRequestHeader=function(a){if(!a)return!1;var b;a:if(b=c.unsafeHeaders,a=a.toLowerCase(),b.indexOf)b=b.indexOf(a);else{for(var h=0;h<b.length;h++)if(b[h]===a){b=h;break a}b=-1}return-1===b};var b=Object.keys||function(a){var b=[],c;for(c in a)b.push(c);return b},a=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{"./response":20,Base64:12,inherits:23,stream:30}],20:[function(z,B,C){function v(a){a=a.getAllResponseHeaders().split(/\r?\n/);for(var c=
{},h=0;h<a.length;h++){var r=a[h];if(""!==r){var d=r.match(/^([^:]+):\s*(.*)/);d?(r=d[1].toLowerCase(),d=d[2],void 0!==c[r]?b(c[r])?c[r].push(d):c[r]=[c[r],d]:c[r]=d):c[r]=!0}}return c}C=z("stream");z=z("util");B=B.exports=function(a){this.offset=0;this.readable=!0};z.inherits(B,C);var h=!0,c=!0;B.prototype.getResponse=function(a){var b=String(a.responseType).toLowerCase();return"blob"===b?a.responseBlob||a.response:"arraybuffer"===b?a.response:a.responseText};B.prototype.getHeader=function(a){return this.headers[a.toLowerCase()]};
B.prototype.handle=function(a){if(2===a.readyState&&c){try{this.statusCode=a.status,this.headers=v(a)}catch(b){c=!1}c&&this.emit("ready")}else if(h&&3===a.readyState){try{this.statusCode||(this.statusCode=a.status,this.headers=v(a),this.emit("ready"))}catch(b){}try{this._emitData(a)}catch(b){h=!1}}else 4===a.readyState&&(this.statusCode||(this.statusCode=a.status,this.emit("ready")),this._emitData(a),a.error?this.emit("error",this.getResponse(a)):this.emit("end"),this.emit("close"))};B.prototype._emitData=
function(a){a=this.getResponse(a);a.toString().match(/ArrayBuffer/)?(this.emit("data",new Uint8Array(a,this.offset)),this.offset=a.byteLength):a.length>this.offset&&(this.emit("data",a.slice(this.offset)),this.offset=a.length)};var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{stream:30,util:38}],21:[function(z,B,C){var v=z("http");z=B.exports;for(var h in v)v.hasOwnProperty(h)&&(z[h]=v[h]);z.request=function(c,b){c||(c={});c.scheme="https";c.protocol=
"https:";return v.request.call(this,c,b)}},{http:18}],22:[function(z,B,C){C.read=function(v,h,c,b,a){var f;f=8*a-b-1;var k=(1<<f)-1,r=k>>1,d=-7;a=c?a-1:0;var l=c?-1:1,m=v[h+a];a+=l;c=m&(1<<-d)-1;m>>=-d;for(d+=f;0<d;c=256*c+v[h+a],a+=l,d-=8);f=c&(1<<-d)-1;c>>=-d;for(d+=b;0<d;f=256*f+v[h+a],a+=l,d-=8);if(0===c)c=1-r;else{if(c===k)return f?NaN:Infinity*(m?-1:1);f+=Math.pow(2,b);c-=r}return(m?-1:1)*f*Math.pow(2,c-b)};C.write=function(v,h,c,b,a,f){var k,r=8*f-a-1,d=(1<<r)-1,l=d>>1,m=23===a?Math.pow(2,
-24)-Math.pow(2,-77):0;f=b?0:f-1;var u=b?1:-1,n=0>h||0===h&&0>1/h?1:0;h=Math.abs(h);isNaN(h)||Infinity===h?(h=isNaN(h)?1:0,b=d):(b=Math.floor(Math.log(h)/Math.LN2),1>h*(k=Math.pow(2,-b))&&(b--,k*=2),h=1<=b+l?h+m/k:h+m*Math.pow(2,1-l),2<=h*k&&(b++,k/=2),b+l>=d?(h=0,b=d):1<=b+l?(h=(h*k-1)*Math.pow(2,a),b+=l):(h=h*Math.pow(2,l-1)*Math.pow(2,a),b=0));for(;8<=a;v[c+f]=h&255,f+=u,h/=256,a-=8);b=b<<a|h;for(r+=a;0<r;v[c+f]=b&255,f+=u,b/=256,r-=8);v[c+f-u]|=128*n}},{}],23:[function(z,B,C){B.exports="function"===
typeof Object.create?function(v,h){v.super_=h;v.prototype=Object.create(h.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}})}:function(v,h){v.super_=h;var c=function(){};c.prototype=h.prototype;v.prototype=new c;v.prototype.constructor=v}},{}],24:[function(z,B,C){function v(){}z=B.exports={};z.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(c){return window.setImmediate(c)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var h=
[];window.addEventListener("message",function(c){var b=c.source;b!==window&&null!==b||"process-tick"!==c.data||(c.stopPropagation(),0<h.length&&h.shift()())},!0);return function(c){h.push(c);window.postMessage("process-tick","*")}}return function(c){setTimeout(c,0)}}();z.title="browser";z.browser=!0;z.env={};z.argv=[];z.on=v;z.addListener=v;z.once=v;z.off=v;z.removeListener=v;z.removeAllListeners=v;z.emit=v;z.binding=function(h){throw Error("process.binding is not supported");};z.cwd=function(){return"/"};
z.chdir=function(h){throw Error("process.chdir is not supported");}},{}],25:[function(z,B,C){(function(v){(function(h){function c(d){throw RangeError(F[d]);}function b(d,a){for(var b=d.length;b--;)d[b]=a(d[b]);return d}function a(d,a){return b(d.split(M),a).join(".")}function f(d){for(var a=[],b=0,c=d.length,f,h;b<c;)f=d.charCodeAt(b++),55296<=f&&56319>=f&&b<c?(h=d.charCodeAt(b++),56320==(h&64512)?a.push(((f&1023)<<10)+(h&1023)+65536):(a.push(f),b--)):a.push(f);return a}function k(d){return b(d,function(d){var a=
"";65535<d&&(d-=65536,a+=A(d>>>10&1023|55296),d=56320|d&1023);return a+=A(d)}).join("")}function r(d,a){return d+22+75*(26>d)-((0!=a)<<5)}function d(d,a,b){var c=0;d=b?H(d/700):d>>1;for(d+=H(d/a);455<d;c+=36)d=H(d/35);return H(c+36*d/(d+38))}function l(a){var b=[],f=a.length,h,l=0,r=128,n=72,m,A,y,u,x;m=a.lastIndexOf("-");0>m&&(m=0);for(A=0;A<m;++A)128<=a.charCodeAt(A)&&c("not-basic"),b.push(a.charCodeAt(A));for(m=0<m?m+1:0;m<f;){A=l;h=1;for(y=36;;y+=36){m>=f&&c("invalid-input");u=a.charCodeAt(m++);
u=10>u-48?u-22:26>u-65?u-65:26>u-97?u-97:36;(36<=u||u>H((2147483647-l)/h))&&c("overflow");l+=u*h;x=y<=n?1:y>=n+26?26:y-n;if(u<x)break;u=36-x;h>H(2147483647/u)&&c("overflow");h*=u}h=b.length+1;n=d(l-A,h,0==A);H(l/h)>2147483647-r&&c("overflow");r+=H(l/h);l%=h;b.splice(l++,0,r)}return k(b)}function m(a){var b,h,k,l,n,m,y,u,x,F=[],D,E,M;a=f(a);D=a.length;b=128;h=0;n=72;for(m=0;m<D;++m)x=a[m],128>x&&F.push(A(x));for((k=l=F.length)&&F.push("-");k<D;){y=2147483647;for(m=0;m<D;++m)x=a[m],x>=b&&x<y&&(y=x);
E=k+1;y-b>H((2147483647-h)/E)&&c("overflow");h+=(y-b)*E;b=y;for(m=0;m<D;++m)if(x=a[m],x<b&&2147483647<++h&&c("overflow"),x==b){u=h;for(y=36;;y+=36){x=y<=n?1:y>=n+26?26:y-n;if(u<x)break;M=u-x;u=36-x;F.push(A(r(x+M%u,0)));u=H(M/u)}F.push(A(r(u,0)));n=d(h,E,k==l);h=0;++k}++h;++b}return F.join("")}var u="object"==typeof C&&C,n="object"==typeof B&&B&&B.exports==u&&B,x="object"==typeof v&&v;if(x.global===x||x.window===x)h=x;var E=/^xn--/,y=/[^ -~]/,M=/\x2E|\u3002|\uFF0E|\uFF61/g,F={overflow:"Overflow: input needs wider integers to process",
"not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},H=Math.floor,A=String.fromCharCode,D,x={version:"1.2.4",ucs2:{decode:f,encode:k},decode:l,encode:m,toASCII:function(d){return a(d,function(d){return y.test(d)?"xn--"+m(d):d})},toUnicode:function(d){return a(d,function(d){return E.test(d)?l(d.slice(4).toLowerCase()):d})}};if(u&&!u.nodeType)if(n)n.exports=x;else for(D in x)x.hasOwnProperty(D)&&(u[D]=x[D]);else h.punycode=x})(this)}).call(this,"undefined"!==
typeof self?self:"undefined"!==typeof window?window:{})},{}],26:[function(z,B,C){B.exports=function(h,c,b,a){b=b||"=";var f={};if("string"!==typeof h||0===h.length)return f;var k=/\+/g;h=h.split(c||"&");c=1E3;a&&"number"===typeof a.maxKeys&&(c=a.maxKeys);a=h.length;0<c&&a>c&&(a=c);for(c=0;c<a;++c){var r=h[c].replace(k,"%20"),d=r.indexOf(b),l;0<=d?(l=r.substr(0,d),r=r.substr(d+1)):(l=r,r="");l=decodeURIComponent(l);r=decodeURIComponent(r);Object.prototype.hasOwnProperty.call(f,l)?v(f[l])?f[l].push(r):
f[l]=[f[l],r]:f[l]=r}return f};var v=Array.isArray||function(h){return"[object Array]"===Object.prototype.toString.call(h)}},{}],27:[function(z,B,C){function v(a,b){if(a.map)return a.map(b);for(var c=[],h=0;h<a.length;h++)c.push(b(a[h],h));return c}var h=function(a){switch(typeof a){case "string":return a;case "boolean":return a?"true":"false";case "number":return isFinite(a)?a:"";default:return""}};B.exports=function(a,f,k,r){f=f||"&";k=k||"=";null===a&&(a=void 0);return"object"===typeof a?v(b(a),
function(d){var b=encodeURIComponent(h(d))+k;return c(a[d])?a[d].map(function(d){return b+encodeURIComponent(h(d))}).join(f):b+encodeURIComponent(h(a[d]))}).join(f):r?encodeURIComponent(h(r))+k+encodeURIComponent(h(a)):""};var c=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},b=Object.keys||function(a){var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}},{}],28:[function(z,B,C){C.decode=C.parse=z("./decode");C.encode=C.stringify=
z("./encode")},{"./decode":26,"./encode":27}],29:[function(z,B,C){function v(c){if(!(this instanceof v))return new v(c);b.call(this,c);a.call(this,c);c&&!1===c.readable&&(this.readable=!1);c&&!1===c.writable&&(this.writable=!1);this.allowHalfOpen=!0;c&&!1===c.allowHalfOpen&&(this.allowHalfOpen=!1);this.once("end",h)}function h(){if(!this.allowHalfOpen&&!this._writableState.ended){var a=this;c(function(){a.end()})}}B.exports=v;B=z("inherits");var c=z("process/browser.js").nextTick,b=z("./readable.js"),
a=z("./writable.js");B(v,b);v.prototype.write=a.prototype.write;v.prototype.end=a.prototype.end;v.prototype._write=a.prototype._write},{"./readable.js":33,"./writable.js":35,inherits:23,"process/browser.js":31}],30:[function(z,B,C){function v(){h.call(this)}B.exports=v;var h=z("events").EventEmitter;z("inherits")(v,h);v.Readable=z("./readable.js");v.Writable=z("./writable.js");v.Duplex=z("./duplex.js");v.Transform=z("./transform.js");v.PassThrough=z("./passthrough.js");v.Stream=v;v.prototype.pipe=
function(c,b){function a(d){c.writable&&!1===c.write(d)&&m.pause&&m.pause()}function f(){m.readable&&m.resume&&m.resume()}function k(){u||(u=!0,c.end())}function r(){u||(u=!0,"function"===typeof c.destroy&&c.destroy())}function d(d){l();if(0===h.listenerCount(this,"error"))throw d;}function l(){m.removeListener("data",a);c.removeListener("drain",f);m.removeListener("end",k);m.removeListener("close",r);m.removeListener("error",d);c.removeListener("error",d);m.removeListener("end",l);m.removeListener("close",
l);c.removeListener("close",l)}var m=this;m.on("data",a);c.on("drain",f);c._isStdio||b&&!1===b.end||(m.on("end",k),m.on("close",r));var u=!1;m.on("error",d);c.on("error",d);m.on("end",l);m.on("close",l);c.on("close",l);c.emit("pipe",m);return c}},{"./duplex.js":29,"./passthrough.js":32,"./readable.js":33,"./transform.js":34,"./writable.js":35,events:15,inherits:23}],31:[function(z,B,C){z=B.exports={};z.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(h){return window.setImmediate(h)};
if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var v=[];window.addEventListener("message",function(h){var c=h.source;c!==window&&null!==c||"process-tick"!==h.data||(h.stopPropagation(),0<v.length&&v.shift()())},!0);return function(h){v.push(h);window.postMessage("process-tick","*")}}return function(h){setTimeout(h,0)}}();z.title="browser";z.browser=!0;z.env={};z.argv=[];z.binding=function(v){throw Error("process.binding is not supported");};z.cwd=function(){return"/"};
z.chdir=function(v){throw Error("process.chdir is not supported");}},{}],32:[function(z,B,C){function v(c){if(!(this instanceof v))return new v(c);h.call(this,c)}B.exports=v;var h=z("./transform.js");z("inherits")(v,h);v.prototype._transform=function(c,b,a){a(null,c)}},{"./transform.js":34,inherits:23}],33:[function(z,B,C){(function(v){function h(d,a){d=d||{};var b=d.highWaterMark;this.highWaterMark=b||0===b?b:16384;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;
this.pipesCount=0;this.calledRead=this.reading=this.endEmitted=this.ended=this.flowing=!1;this.sync=!0;this.readableListening=this.emittedReadable=this.needReadable=!1;this.objectMode=!!d.objectMode;this.defaultEncoding=d.defaultEncoding||"utf8";this.ranOut=!1;this.awaitDrain=0;this.readingMore=!1;this.encoding=this.decoder=null;d.encoding&&(H||(H=z("string_decoder").StringDecoder),this.decoder=new H(d.encoding),this.encoding=d.encoding)}function c(d){if(!(this instanceof c))return new c(d);this._readableState=
new h(d,this);this.readable=!0;y.call(this)}function b(d,a,b,c,h){var l;l=b;var r=null;M.isBuffer(l)||"string"===typeof l||null===l||void 0===l||a.objectMode||r||(r=new TypeError("Invalid non-string/buffer chunk"));(l=r)?d.emit("error",l):null===b||void 0===b?(a.reading=!1,a.ended||(a.decoder&&!a.ended&&(b=a.decoder.end())&&b.length&&(a.buffer.push(b),a.length+=a.objectMode?1:b.length),a.ended=!0,0<a.length?f(d):n(d))):a.objectMode||b&&0<b.length?a.ended&&!h?(b=Error("stream.push() after EOF"),d.emit("error",
b)):a.endEmitted&&h?(b=Error("stream.unshift() after end event"),d.emit("error",b)):(!a.decoder||h||c||(b=a.decoder.write(b)),a.length+=a.objectMode?1:b.length,h?a.buffer.unshift(b):(a.reading=!1,a.buffer.push(b)),a.needReadable&&f(d),k(d,a)):h||(a.reading=!1);return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function a(d,a){if(0===a.length&&a.ended)return 0;if(a.objectMode)return 0===d?0:1;if(isNaN(d)||null===d)return a.flowing&&a.buffer.length?a.buffer[0].length:a.length;
if(0>=d)return 0;if(d>a.highWaterMark){var b=d;if(8388608<=b)b=8388608;else{b--;for(var c=1;32>c;c<<=1)b|=b>>c;b++}a.highWaterMark=b}if(d>a.length){if(a.ended)return a.length;a.needReadable=!0;return 0}return d}function f(d){var a=d._readableState;a.needReadable=!1;a.emittedReadable||(a.emittedReadable=!0,a.sync?F(function(){d.emit("readable")}):d.emit("readable"))}function k(d,a){a.readingMore||(a.readingMore=!0,F(function(){for(var b=a.length;!a.reading&&!a.flowing&&!a.ended&&a.length<a.highWaterMark&&
(d.read(0),b!==a.length);)b=a.length;a.readingMore=!1}))}function r(a){return function(){var b=a._readableState;b.awaitDrain--;0===b.awaitDrain&&d(a)}}function d(d){function a(d,f,h){!1===d.write(c)&&b.awaitDrain++}var b=d._readableState,c;for(b.awaitDrain=0;b.pipesCount&&null!==(c=d.read());)if(1===b.pipesCount?a(b.pipes,0,null):x(b.pipes,a),d.emit("data",c),0<b.awaitDrain)return;0===b.pipesCount?(b.flowing=!1,0<E.listenerCount(d,"data")&&m(d)):b.ranOut=!0}function l(){this._readableState.ranOut&&
(this._readableState.ranOut=!1,d(this))}function m(d,a){if(d._readableState.flowing)throw Error("Cannot switch to old mode now.");var b=a||!1,c=!1;d.readable=!0;d.pipe=y.prototype.pipe;d.on=d.addListener=y.prototype.on;d.on("readable",function(){c=!0;for(var a;!b&&null!==(a=d.read());)d.emit("data",a);null===a&&(c=!1,d._readableState.needReadable=!0)});d.pause=function(){b=!0;this.emit("pause")};d.resume=function(){b=!1;c?F(function(){d.emit("readable")}):this.read(0);this.emit("resume")};d.emit("readable")}
function u(d,a){var b=a.buffer,c=a.length,f=!!a.decoder,h=!!a.objectMode;if(0===b.length)return null;if(0===c)c=null;else if(h)c=b.shift();else if(!d||d>=c)c=f?b.join(""):M.concat(b,c),b.length=0;else if(d<b[0].length)h=b[0],c=h.slice(0,d),b[0]=h.slice(d);else if(d===b[0].length)c=b.shift();else for(var c=f?"":new M(d),k=0,l=0,r=b.length;l<r&&k<d;l++){var h=b[0],n=Math.min(d-k,h.length);f?c+=h.slice(0,n):h.copy(c,k,0,n);n<h.length?b[0]=h.slice(n):b.shift();k+=n}return c}function n(d){var a=d._readableState;
if(0<a.length)throw Error("endReadable called on non-empty stream");!a.endEmitted&&a.calledRead&&(a.ended=!0,F(function(){a.endEmitted||0!==a.length||(a.endEmitted=!0,d.readable=!1,d.emit("end"))}))}function x(d,a){for(var b=0,c=d.length;b<c;b++)a(d[b],b)}B.exports=c;c.ReadableState=h;var E=z("events").EventEmitter,y=z("./index.js"),M=z("buffer").Buffer,F=z("process/browser.js").nextTick,H;z("inherits")(c,y);c.prototype.push=function(d,a){var c=this._readableState;"string"!==typeof d||c.objectMode||
(a=a||c.defaultEncoding,a!==c.encoding&&(d=new M(d,a),a=""));return b(this,c,d,a,!1)};c.prototype.unshift=function(d){return b(this,this._readableState,d,"",!0)};c.prototype.setEncoding=function(d){H||(H=z("string_decoder").StringDecoder);this._readableState.decoder=new H(d);this._readableState.encoding=d};c.prototype.read=function(d){var b=this._readableState;b.calledRead=!0;var c=d;if("number"!==typeof d||0<d)b.emittedReadable=!1;if(0===d&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return f(this),
null;d=a(d,b);if(0===d&&b.ended)return 0===b.length&&n(this),null;var h=b.needReadable;b.length-d<=b.highWaterMark&&(h=!0);if(b.ended||b.reading)h=!1;h&&(b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1);h&&!b.reading&&(d=a(c,b));c=0<d?u(d,b):null;null===c&&(b.needReadable=!0,d=0);b.length-=d;0!==b.length||b.ended||(b.needReadable=!0);b.ended&&!b.endEmitted&&0===b.length&&n(this);return c};c.prototype._read=function(d){this.emit("error",Error("not implemented"))};
c.prototype.pipe=function(a,b){function c(d){d===y&&h()}function f(){a.end()}function h(){a.removeListener("close",n);a.removeListener("finish",m);a.removeListener("drain",H);a.removeListener("error",k);a.removeListener("unpipe",c);y.removeListener("end",f);y.removeListener("end",h);a._writableState&&!a._writableState.needDrain||H()}function k(d){y.unpipe(a);0===M&&0===E.listenerCount(a,"error")&&a.emit("error",d)}function n(){a.removeListener("finish",m);y.unpipe(a)}function m(){a.removeListener("close",
n);y.unpipe(a)}var y=this,u=this._readableState;switch(u.pipesCount){case 0:u.pipes=a;break;case 1:u.pipes=[u.pipes,a];break;default:u.pipes.push(a)}u.pipesCount+=1;var x=b&&!1===b.end||a===v.stdout||a===v.stderr?h:f;if(u.endEmitted)F(x);else y.once("end",x);a.on("unpipe",c);var H=r(y);a.on("drain",H);var M=E.listenerCount(a,"error");a.once("error",k);a.once("close",n);a.once("finish",m);a.emit("pipe",y);u.flowing||(this.on("readable",l),u.flowing=!0,F(function(){d(y)}));return a};c.prototype.unpipe=
function(d){var a=this._readableState;if(0===a.pipesCount)return this;if(1===a.pipesCount){if(d&&d!==a.pipes)return this;d||(d=a.pipes);a.pipes=null;a.pipesCount=0;this.removeListener("readable",l);a.flowing=!1;d&&d.emit("unpipe",this);return this}if(!d){d=a.pipes;var b=a.pipesCount;a.pipes=null;a.pipesCount=0;this.removeListener("readable",l);a.flowing=!1;for(var c=0;c<b;c++)d[c].emit("unpipe",this);return this}a:{for(var c=a.pipes,b=0,f=c.length;b<f;b++)if(c[b]===d){c=b;break a}c=-1}if(-1===c)return this;
a.pipes.splice(c,1);--a.pipesCount;1===a.pipesCount&&(a.pipes=a.pipes[0]);d.emit("unpipe",this);return this};c.prototype.on=function(d,a){var b=y.prototype.on.call(this,d,a);"data"!==d||this._readableState.flowing||m(this);if("readable"===d&&this.readable){var c=this._readableState;c.readableListening||(c.readableListening=!0,c.emittedReadable=!1,c.needReadable=!0,c.reading?c.length&&f(this,c):this.read(0))}return b};c.prototype.addListener=c.prototype.on;c.prototype.resume=function(){m(this);this.read(0);
this.emit("resume")};c.prototype.pause=function(){m(this,!0);this.emit("pause")};c.prototype.wrap=function(d){var a=this._readableState,b=!1,c=this;d.on("end",function(){if(a.decoder&&!a.ended){var d=a.decoder.end();d&&d.length&&c.push(d)}c.push(null)});d.on("data",function(f){a.decoder&&(f=a.decoder.write(f));f&&(a.objectMode||f.length)&&!c.push(f)&&(b=!0,d.pause())});for(var f in d)"function"===typeof d[f]&&"undefined"===typeof this[f]&&(this[f]=function(a){return function(){return d[a].apply(d,
arguments)}}(f));x(["error","close","destroy","pause","resume"],function(a){d.on(a,function(d){return c.emit.apply(c,a,d)})});c._read=function(a){b&&(b=!1,d.resume())};return c};c._fromList=u}).call(this,z("qC859L"))},{"./index.js":30,buffer:14,events:15,inherits:23,"process/browser.js":31,qC859L:24,string_decoder:17}],34:[function(z,B,C){function v(a,b){this.afterTransform=function(a,c){var d;d=b._transformState;d.transforming=!1;var h=d.writecb;h?(d.writechunk=null,d.writecb=null,null!==c&&void 0!==
c&&b.push(c),h&&h(a),d=b._readableState,d.reading=!1,(d.needReadable||d.length<d.highWaterMark)&&b._read(d.highWaterMark),d=void 0):d=b.emit("error",Error("no writecb in Transform class"));return d};this.transforming=this.needTransform=!1;this.writechunk=this.writecb=null}function h(a){if(!(this instanceof h))return new h(a);b.call(this,a);this._transformState=new v(a,this);var f=this;this._readableState.needReadable=!0;this._readableState.sync=!1;this.once("finish",function(){"function"===typeof this._flush?
this._flush(function(a){c(f,a)}):c(f)})}function c(a,b){if(b)return a.emit("error",b);var c=a._transformState;if(a._writableState.length)throw Error("calling transform done when ws.length != 0");if(c.transforming)throw Error("calling transform done when still transforming");return a.push(null)}B.exports=h;var b=z("./duplex.js");z("inherits")(h,b);h.prototype.push=function(a,c){this._transformState.needTransform=!1;return b.prototype.push.call(this,a,c)};h.prototype._transform=function(a,b,c){throw Error("not implemented");
};h.prototype._write=function(a,b,c){var h=this._transformState;h.writecb=c;h.writechunk=a;h.writeencoding=b;h.transforming||(a=this._readableState,(h.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark))};h.prototype._read=function(a){a=this._transformState;a.writechunk&&a.writecb&&!a.transforming?(a.transforming=!0,this._transform(a.writechunk,a.writeencoding,a.afterTransform)):a.needTransform=!0}},{"./duplex.js":29,inherits:23}],35:[function(z,B,C){function v(d,
a,b){this.chunk=d;this.encoding=a;this.callback=b}function h(a,b){a=a||{};var c=a.highWaterMark;this.highWaterMark=c||0===c?c:16384;this.objectMode=!!a.objectMode;this.highWaterMark=~~this.highWaterMark;this.finished=this.ended=this.ending=this.needDrain=!1;this.decodeStrings=!1!==a.decodeStrings;this.defaultEncoding=a.defaultEncoding||"utf8";this.length=0;this.writing=!1;this.sync=!0;this.bufferProcessing=!1;this.onwrite=function(a){d(b,a)};this.writecb=null;this.writelen=0;this.buffer=[]}function c(d){if(!(this instanceof
c||this instanceof E.Duplex))return new c(d);this._writableState=new h(d,this);this.writable=!0;E.call(this)}function b(d,a,b){var c=Error("write after end");d.emit("error",c);y(function(){b(c)})}function a(d,a,b,c){var f=!0;if(!M.isBuffer(b)&&"string"!==typeof b&&null!==b&&void 0!==b&&!a.objectMode){var h=new TypeError("Invalid non-string/buffer chunk");d.emit("error",h);y(function(){c(h)});f=!1}return f}function f(d,a,b,c,f){a.objectMode||!1===a.decodeStrings||"string"!==typeof b||(b=new M(b,c));
var h=a.objectMode?1:b.length;a.length+=h;var k=a.length<a.highWaterMark;a.needDrain=!k;a.writing?a.buffer.push(new v(b,c,f)):(a.writelen=h,a.writecb=f,a.writing=!0,a.sync=!0,d._write(b,c,a.onwrite),a.sync=!1);return k}function k(d,a,b,c,f){b?y(function(){f(c)}):f(c);d.emit("error",c)}function r(d){d.writing=!1;d.writecb=null;d.length-=d.writelen;d.writelen=0}function d(d,a){var b=d._writableState,c=b.sync,f=b.writecb;r(b);if(a)k(d,b,c,a,f);else{var h=b.ending&&0===b.length&&!b.finished&&!b.writing;
h||b.bufferProcessing||!b.buffer.length||m(d,b);c?y(function(){l(d,b,h,f)}):l(d,b,h,f)}}function l(d,a,b,c){!b&&0===a.length&&a.needDrain&&(a.needDrain=!1,d.emit("drain"));c();b&&u(d,a)}function m(d,a){a.bufferProcessing=!0;for(var b=0;b<a.buffer.length;b++){var c=a.buffer[b],f=c.chunk,h=d,k=a,l=f,n=c.encoding,c=c.callback;k.writelen=a.objectMode?1:f.length;k.writecb=c;k.writing=!0;k.sync=!0;h._write(l,n,k.onwrite);k.sync=!1;if(a.writing){b++;break}}a.bufferProcessing=!1;b<a.buffer.length?a.buffer=
a.buffer.slice(b):a.buffer.length=0}function u(d,a){var b=a.ending&&0===a.length&&!a.finished&&!a.writing;b&&(a.finished=!0,d.emit("finish"));return b}B.exports=c;c.WritableState=h;var n="undefined"!==typeof Uint8Array?function(d){return d instanceof Uint8Array}:function(d){return d&&d.constructor&&"Uint8Array"===d.constructor.name},x="undefined"!==typeof ArrayBuffer?function(d){return d instanceof ArrayBuffer}:function(d){return d&&d.constructor&&"ArrayBuffer"===d.constructor.name};B=z("inherits");
var E=z("./index.js"),y=z("process/browser.js").nextTick,M=z("buffer").Buffer;B(c,E);c.prototype.pipe=function(){this.emit("error",Error("Cannot pipe. Not readable."))};c.prototype.write=function(d,c,h){var k=this._writableState,l=!1;"function"===typeof c&&(h=c,c=null);!M.isBuffer(d)&&n(d)&&(d=new M(d));x(d)&&"undefined"!==typeof Uint8Array&&(d=new M(new Uint8Array(d)));M.isBuffer(d)?c="buffer":c||(c=k.defaultEncoding);"function"!==typeof h&&(h=function(){});k.ended?b(this,k,h):a(this,k,d,h)&&(l=
f(this,k,d,c,h));return l};c.prototype._write=function(d,a,b){b(Error("not implemented"))};c.prototype.end=function(d,a,b){var c=this._writableState;"function"===typeof d?(b=d,a=d=null):"function"===typeof a&&(b=a,a=null);"undefined"!==typeof d&&null!==d&&this.write(d,a);if(!c.ending&&!c.finished){d=b;c.ending=!0;u(this,c);if(d)if(c.finished)y(d);else this.once("finish",d);c.ended=!0}}},{"./index.js":30,buffer:14,inherits:23,"process/browser.js":31}],36:[function(z,B,C){function v(){this.href=this.path=
this.pathname=this.query=this.search=this.hash=this.hostname=this.port=this.host=this.auth=this.slashes=this.protocol=null}function h(d,a,b){if(d&&c(d)&&d instanceof v)return d;var f=new v;f.parse(d,a,b);return f}function c(d){return"object"===typeof d&&null!==d}var b=z("punycode");C.parse=h;C.resolve=function(d,a){return h(d,!1,!0).resolve(a)};C.resolveObject=function(d,a){return d?h(d,!1,!0).resolveObject(a):a};C.format=function(d){"string"===typeof d&&(d=h(d));return d instanceof v?d.format():
v.prototype.format.call(d)};C.Url=v;var a=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/;B="{}|\\^`".split("").concat('<>"` \r\n\t'.split(""));var k=["'"].concat(B),r=["%","/","?",";","#"].concat(k),d=["/","?","#"],l=/^[a-z0-9A-Z_-]{0,63}$/,m=/^([a-z0-9A-Z_-]{0,63})(.*)$/,u={javascript:!0,"javascript:":!0},n={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},E=z("querystring");v.prototype.parse=function(c,f,h){if("string"!==typeof c)throw new TypeError("Parameter 'url' must be a string, not "+
typeof c);c=c.trim();var v=a.exec(c);if(v){var v=v[0],A=v.toLowerCase();this.protocol=A;c=c.substr(v.length)}if(h||v||c.match(/^\/\/[^@\/]+@[^@\/]+/)){var D="//"===c.substr(0,2);!D||v&&n[v]||(c=c.substr(2),this.slashes=!0)}if(!n[v]&&(D||v&&!x[v])){D=-1;for(h=0;h<d.length;h++)v=c.indexOf(d[h]),-1!==v&&(-1===D||v<D)&&(D=v);D=-1===D?c.lastIndexOf("@"):c.lastIndexOf("@",D);-1!==D&&(h=c.slice(0,D),c=c.slice(D+1),this.auth=decodeURIComponent(h));D=-1;for(h=0;h<r.length;h++)v=c.indexOf(r[h]),-1!==v&&(-1===
D||v<D)&&(D=v);-1===D&&(D=c.length);this.host=c.slice(0,D);c=c.slice(D);this.parseHost();this.hostname=this.hostname||"";D="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!D){var z=this.hostname.split(/\./);h=0;for(v=z.length;h<v;h++){var N=z[h];if(N&&!N.match(l)){for(var C="",O=0,J=N.length;O<J;O++)C=127<N.charCodeAt(O)?C+"x":C+N[O];if(!C.match(l)){v=z.slice(0,h);h=z.slice(h+1);if(N=N.match(m))v.push(N[1]),h.unshift(N[2]);h.length&&(c="/"+h.join(".")+c);this.hostname=v.join(".");
break}}}}this.hostname=255<this.hostname.length?"":this.hostname.toLowerCase();if(!D){N=this.hostname.split(".");z=[];for(h=0;h<N.length;++h)v=N[h],z.push(v.match(/[^A-Za-z0-9_-]/)?"xn--"+b.encode(v):v);this.hostname=z.join(".")}h=this.port?":"+this.port:"";this.host=(this.hostname||"")+h;this.href+=this.host;D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==c[0]&&(c="/"+c))}if(!u[A])for(h=0,v=k.length;h<v;h++)D=k[h],N=encodeURIComponent(D),N===D&&(N=escape(D)),c=c.split(D).join(N);
h=c.indexOf("#");-1!==h&&(this.hash=c.substr(h),c=c.slice(0,h));h=c.indexOf("?");-1!==h?(this.search=c.substr(h),this.query=c.substr(h+1),f&&(this.query=E.parse(this.query)),c=c.slice(0,h)):f&&(this.search="",this.query={});c&&(this.pathname=c);x[A]&&this.hostname&&!this.pathname&&(this.pathname="/");if(this.pathname||this.search)h=this.pathname||"",v=this.search||"",this.path=h+v;this.href=this.format();return this};v.prototype.format=function(){var d=this.auth||"";d&&(d=encodeURIComponent(d),d=
d.replace(/%3A/i,":"),d+="@");var a=this.protocol||"",b=this.pathname||"",f=this.hash||"",h=!1,k="";this.host?h=d+this.host:this.hostname&&(h=d+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(h+=":"+this.port));this.query&&c(this.query)&&Object.keys(this.query).length&&(k=E.stringify(this.query));d=this.search||k&&"?"+k||"";a&&":"!==a.substr(-1)&&(a+=":");this.slashes||(!a||x[a])&&!1!==h?(h="//"+(h||""),b&&"/"!==b.charAt(0)&&(b="/"+b)):h||(h="");f&&"#"!==f.charAt(0)&&
(f="#"+f);d&&"?"!==d.charAt(0)&&(d="?"+d);b=b.replace(/[?#]/g,function(d){return encodeURIComponent(d)});d=d.replace("#","%23");return a+h+b+d+f};v.prototype.resolve=function(d){return this.resolveObject(h(d,!1,!0)).format()};v.prototype.resolveObject=function(d){if("string"===typeof d){var a=new v;a.parse(d,!1,!0);d=a}var b=new v;Object.keys(this).forEach(function(d){b[d]=this[d]},this);b.hash=d.hash;if(""===d.href)return b.href=b.format(),b;if(d.slashes&&!d.protocol)return Object.keys(d).forEach(function(a){"protocol"!==
a&&(b[a]=d[a])}),x[b.protocol]&&b.hostname&&!b.pathname&&(b.path=b.pathname="/"),b.href=b.format(),b;if(d.protocol&&d.protocol!==b.protocol){if(!x[d.protocol])return Object.keys(d).forEach(function(a){b[a]=d[a]}),b.href=b.format(),b;b.protocol=d.protocol;if(d.host||n[d.protocol])b.pathname=d.pathname;else{for(var c=(d.pathname||"").split("/");c.length&&!(d.host=c.shift()););d.host||(d.host="");d.hostname||(d.hostname="");""!==c[0]&&c.unshift("");2>c.length&&c.unshift("");b.pathname=c.join("/")}b.search=
d.search;b.query=d.query;b.host=d.host||"";b.auth=d.auth;b.hostname=d.hostname||d.host;b.port=d.port;if(b.pathname||b.search)b.path=(b.pathname||"")+(b.search||"");b.slashes=b.slashes||d.slashes;b.href=b.format();return b}var a=b.pathname&&"/"===b.pathname.charAt(0),f=d.host||d.pathname&&"/"===d.pathname.charAt(0),h=a=f||a||b.host&&d.pathname,k=b.pathname&&b.pathname.split("/")||[],c=d.pathname&&d.pathname.split("/")||[],l=b.protocol&&!x[b.protocol];l&&(b.hostname="",b.port=null,b.host&&(""===k[0]?
k[0]=b.host:k.unshift(b.host)),b.host="",d.protocol&&(d.hostname=null,d.port=null,d.host&&(""===c[0]?c[0]=d.host:c.unshift(d.host)),d.host=null),a=a&&(""===c[0]||""===k[0]));if(f)b.host=d.host||""===d.host?d.host:b.host,b.hostname=d.hostname||""===d.hostname?d.hostname:b.hostname,b.search=d.search,b.query=d.query,k=c;else if(c.length)k||(k=[]),k.pop(),k=k.concat(c),b.search=d.search,b.query=d.query;else if(null!=d.search){l&&(b.hostname=b.host=k.shift(),l=b.host&&0<b.host.indexOf("@")?b.host.split("@"):
!1)&&(b.auth=l.shift(),b.host=b.hostname=l.shift());b.search=d.search;b.query=d.query;if(null!==b.pathname||null!==b.search)b.path=(b.pathname?b.pathname:"")+(b.search?b.search:"");b.href=b.format();return b}if(!k.length)return b.pathname=null,b.path=b.search?"/"+b.search:null,b.href=b.format(),b;for(var f=k.slice(-1)[0],c=(b.host||d.host)&&("."===f||".."===f)||""===f,r=0,m=k.length;0<=m;m--)f=k[m],"."==f?k.splice(m,1):".."===f?(k.splice(m,1),r++):r&&(k.splice(m,1),r--);if(!a&&!h)for(;r--;r)k.unshift("..");
!a||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift("");c&&"/"!==k.join("/").substr(-1)&&k.push("");h=""===k[0]||k[0]&&"/"===k[0].charAt(0);l&&(b.hostname=b.host=h?"":k.length?k.shift():"",l=b.host&&0<b.host.indexOf("@")?b.host.split("@"):!1)&&(b.auth=l.shift(),b.host=b.hostname=l.shift());(a=a||b.host&&k.length)&&!h&&k.unshift("");k.length?b.pathname=k.join("/"):(b.pathname=null,b.path=null);if(null!==b.pathname||null!==b.search)b.path=(b.pathname?b.pathname:"")+(b.search?b.search:"");b.auth=d.auth||
b.auth;b.slashes=b.slashes||d.slashes;b.href=b.format();return b};v.prototype.parseHost=function(){var d=this.host,a=f.exec(d);a&&(a=a[0],":"!==a&&(this.port=a.substr(1)),d=d.substr(0,d.length-a.length));d&&(this.hostname=d)}},{punycode:25,querystring:28}],37:[function(z,B,C){B.exports=function(v){return v&&"object"===typeof v&&"function"===typeof v.copy&&"function"===typeof v.fill&&"function"===typeof v.readUInt8}},{}],38:[function(z,B,C){(function(v,h){function c(d,c){var f={seen:[],stylize:a};
3<=arguments.length&&(f.depth=arguments[2]);4<=arguments.length&&(f.colors=arguments[3]);x(c)?f.showHidden=c:c&&C._extend(f,c);M(f.showHidden)&&(f.showHidden=!1);M(f.depth)&&(f.depth=2);M(f.colors)&&(f.colors=!1);M(f.customInspect)&&(f.customInspect=!0);f.colors&&(f.stylize=b);return k(f,d,f.depth)}function b(d,a){var b=c.styles[a];return b?"\u001b["+c.colors[b][0]+"m"+d+"\u001b["+c.colors[b][1]+"m":d}function a(d,a){return d}function f(d){var a={};d.forEach(function(d,b){a[d]=!0});return a}function k(a,
b,c){if(a.customInspect&&b&&P(b.inspect)&&b.inspect!==C.inspect&&(!b.constructor||b.constructor.prototype!==b)){var h=b.inspect(c,a);y(h)||(h=k(a,h,c));return h}if(h=r(a,b))return h;var x=Object.keys(b),v=f(x);a.showHidden&&(x=Object.getOwnPropertyNames(b));if(D(b)&&(0<=x.indexOf("message")||0<=x.indexOf("description")))return d(b);if(0===x.length){if(P(b))return a.stylize("[Function"+(b.name?": "+b.name:"")+"]","special");if(F(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(A(b))return a.stylize(Date.prototype.toString.call(b),
"date");if(D(b))return d(b)}var h="",E=!1,M=["{","}"];n(b)&&(E=!0,M=["[","]"]);P(b)&&(h=" [Function"+(b.name?": "+b.name:"")+"]");F(b)&&(h=" "+RegExp.prototype.toString.call(b));A(b)&&(h=" "+Date.prototype.toUTCString.call(b));D(b)&&(h=" "+d(b));if(0===x.length&&(!E||0==b.length))return M[0]+h+M[1];if(0>c)return F(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);x=E?l(a,b,c,v,x):x.map(function(d){return m(a,b,c,v,d,E)});a.seen.pop();return u(x,
h,M)}function r(d,a){if(M(a))return d.stylize("undefined","undefined");if(y(a)){var b="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return d.stylize(b,"string")}if(E(a))return d.stylize(""+a,"number");if(x(a))return d.stylize(""+a,"boolean");if(null===a)return d.stylize("null","null")}function d(d){return"["+Error.prototype.toString.call(d)+"]"}function l(d,a,b,c,f){for(var h=[],k=0,l=a.length;k<l;++k)Object.prototype.hasOwnProperty.call(a,String(k))?h.push(m(d,
a,b,c,String(k),!0)):h.push("");f.forEach(function(f){f.match(/^\d+$/)||h.push(m(d,a,b,c,f,!0))});return h}function m(d,a,b,c,f,h){var l,r;a=Object.getOwnPropertyDescriptor(a,f)||{value:a[f]};a.get?r=a.set?d.stylize("[Getter/Setter]","special"):d.stylize("[Getter]","special"):a.set&&(r=d.stylize("[Setter]","special"));Object.prototype.hasOwnProperty.call(c,f)||(l="["+f+"]");r||(0>d.seen.indexOf(a.value)?(r=null===b?k(d,a.value,null):k(d,a.value,b-1),-1<r.indexOf("\n")&&(r=h?r.split("\n").map(function(d){return" "+
d}).join("\n").substr(2):"\n"+r.split("\n").map(function(d){return" "+d}).join("\n"))):r=d.stylize("[Circular]","special"));if(M(l)){if(h&&f.match(/^\d+$/))return r;l=JSON.stringify(""+f);l.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(l=l.substr(1,l.length-2),l=d.stylize(l,"name")):(l=l.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),l=d.stylize(l,"string"))}return l+": "+r}function u(d,a,b){var c=0;return 60<d.reduce(function(d,a){c++;0<=a.indexOf("\n")&&c++;return d+a.replace(/\u001b\[\d\d?m/g,
"").length+1},0)?b[0]+(""===a?"":a+"\n ")+" "+d.join(",\n ")+" "+b[1]:b[0]+a+" "+d.join(", ")+" "+b[1]}function n(d){return Array.isArray(d)}function x(d){return"boolean"===typeof d}function E(d){return"number"===typeof d}function y(d){return"string"===typeof d}function M(d){return void 0===d}function F(d){return H(d)&&"[object RegExp]"===Object.prototype.toString.call(d)}function H(d){return"object"===typeof d&&null!==d}function A(d){return H(d)&&"[object Date]"===Object.prototype.toString.call(d)}
function D(d){return H(d)&&("[object Error]"===Object.prototype.toString.call(d)||d instanceof Error)}function P(d){return"function"===typeof d}function N(d){return 10>d?"0"+d.toString(10):d.toString(10)}function B(){var d=new Date,a=[N(d.getHours()),N(d.getMinutes()),N(d.getSeconds())].join(":");return[d.getDate(),ya[d.getMonth()],a].join(" ")}var O=/%[sdj%]/g;C.format=function(d){if(!y(d)){for(var a=[],b=0;b<arguments.length;b++)a.push(c(arguments[b]));return a.join(" ")}for(var b=1,f=arguments,
h=f.length,a=String(d).replace(O,function(d){if("%%"===d)return"%";if(b>=h)return d;switch(d){case "%s":return String(f[b++]);case "%d":return Number(f[b++]);case "%j":try{return JSON.stringify(f[b++])}catch(a){return"[Circular]"}default:return d}}),k=f[b];b<h;k=f[++b])a=null!==k&&H(k)?a+(" "+c(k)):a+(" "+k);return a};C.deprecate=function(d,a){if(M(h.process))return function(){return C.deprecate(d,a).apply(this,arguments)};if(!0===v.noDeprecation)return d;var b=!1;return function(){if(!b){if(v.throwDeprecation)throw Error(a);
v.traceDeprecation?console.trace(a):console.error(a);b=!0}return d.apply(this,arguments)}};var J={},ta;C.debuglog=function(d){M(ta)&&(ta=v.env.NODE_DEBUG||"");d=d.toUpperCase();if(!J[d])if((new RegExp("\\b"+d+"\\b","i")).test(ta)){var a=v.pid;J[d]=function(){var b=C.format.apply(C,arguments);console.error("%s %d: %s",d,a,b)}}else J[d]=function(){};return J[d]};C.inspect=c;c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,
39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};c.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};C.isArray=n;C.isBoolean=x;C.isNull=function(d){return null===d};C.isNullOrUndefined=function(d){return null==d};C.isNumber=E;C.isString=y;C.isSymbol=function(d){return"symbol"===typeof d};C.isUndefined=M;C.isRegExp=F;C.isObject=H;C.isDate=A;C.isError=D;C.isFunction=P;C.isPrimitive=function(d){return null===
d||"boolean"===typeof d||"number"===typeof d||"string"===typeof d||"symbol"===typeof d||"undefined"===typeof d};C.isBuffer=z("./support/isBuffer");var ya="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");C.log=function(){console.log("%s - %s",B(),C.format.apply(C,arguments))};C.inherits=z("inherits");C._extend=function(d,a){if(!a||!H(a))return d;for(var b=Object.keys(a),c=b.length;c--;)d[b[c]]=a[b[c]];return d}}).call(this,z("qC859L"),"undefined"!==typeof self?self:"undefined"!==typeof window?
window:{})},{"./support/isBuffer":37,inherits:23,qC859L:24}],39:[function(z,B,C){function v(a,b){this.name="NonSupportedSparqlFeatureError";this.feature=a;this.message=b||"SPARQL feature "+a+" non supported"}function h(a){this.name=ParserError;this.message=a||"Error parsing SPARQL query"}var c=z("./parser"),b=z("./utils");v.prototype=Error();v.constructor=v;h.prototype=Error();h.constructor=h;AbstractQueryTree=function(){};AbstractQueryTree.prototype.parseQueryString=function(a){return c.parse(a)};
AbstractQueryTree.prototype.parseExecutableUnit=function(a){if("select"===a.kind||"ask"===a.kind||"modify"===a.kind||"construct"===a.kind)return this.parseSelect(a);if("insertdata"===a.kind||"deletedata"===a.kind)return this.parseInsertData(a);if("load"===a.kind||"clear"===a.kind||"drop"===a.kind||"create"===a.kind)return a;throw Error("unknown executable unit: "+a.kind);};AbstractQueryTree.prototype.parseSelect=function(a){if(null==a)return console.log("error parsing query"),null;a.pattern=this.build(a.pattern,
{freshCounter:0});return a};AbstractQueryTree.prototype.parseInsertData=function(a){return null==a?(console.log("error parsing query"),null):a};AbstractQueryTree.prototype.build=function(a,b){if("groupgraphpattern"===a.token)return this._buildGroupGraphPattern(a,b);if("basicgraphpattern"===a.token){var c={kind:"BGP",value:a.triplesContext};return c=AbstractQueryTree.translatePathExpressionsInBGP(c,b)}if("graphunionpattern"===a.token){var c=this.build(a.value[0],b),r=this.build(a.value[1],b);return{kind:"UNION",
value:[c,r]}}if("graphgraphpattern"===a.token)return{kind:"GRAPH",value:this.build(a.value,b),graph:a.graph};if(null!=a.token)throw new v(a.token,"Non implemented SPARQL graph pattern: '"+a.token+"'");throw new h("Error parsing graph pattern: '"+JSON.stringify(a)+"'");};AbstractQueryTree.translatePathExpressionsInBGP=function(a,c){var h,r=[],d,l;for(l=0;l<a.value.length;l++)if(a.value[l].predicate&&"path"===a.value[l].predicate.token){h=a.value[l];d=a.value.slice(l+1);var m=AbstractQueryTree.translatePathExpression(h,
c);h=null;if("BGP"===m.kind)r=r.concat(m.value);else{if("ZERO_OR_MORE_PATH"===m.kind||"ONE_OR_MORE_PATH"===m.kind){l=0<r.length?{kind:"JOIN",lvalue:{kind:"BGP",value:r},rvalue:m}:m;if("ZERO_OR_MORE_PATH"===m.kind)if("var"===m.y.token&&0===m.y.value.indexOf("fresh:")&&"var"===m.x.token&&0===m.x.value.indexOf("fresh:"))for(var u=0;u<a.value.length;u++)a.value[u].object&&"var"===a.value[u].object.token&&a.value[u].object.value===m.x.value&&(h=b.clone(a.value[u],!0),h.object=m.y);else if("var"===m.y.token&&
0===m.y.value.indexOf("fresh:"))for(u=0;u<a.value.length;u++)a.value[u].subject&&"var"===a.value[u].subject.token&&a.value[u].subject.value===m.y.value&&(h=b.clone(a.value[u],!0),h.subject=m.x);return 0<d.length?(m=AbstractQueryTree.translatePathExpressionsInBGP({kind:"BGP",value:d},c),null!=h?(r=r.concat([h]).concat(d),{kind:"UNION",value:[{kind:"JOIN",lvalue:l,rvalue:m},{kind:"BGP",value:r}]}):{kind:"JOIN",lvalue:l,rvalue:m}):l}return m}}else r.push(a.value[l]);a.value=r;return a};AbstractQueryTree.translatePathExpression=
function(a,c){if("element"===a.predicate.kind){if("+"===a.predicate.modifier){a.predicate.modifier=null;var h=AbstractQueryTree.translatePathExpression(a,c);return{kind:"ONE_OR_MORE_PATH",path:h,x:a.subject,y:a.object}}if("*"===a.predicate.modifier)return a.predicate.modifier=null,h=AbstractQueryTree.translatePathExpression(a,c),{kind:"ZERO_OR_MORE_PATH",path:h,x:a.subject,y:a.object};a.predicate=a.predicate.value;return{kind:"BGP",value:[a]}}if("sequence"===a.predicate.kind){for(var h=a.subject,
r=a.object,d=a.graph,l,m,u=[],n=0;n<a.predicate.value.length;n++)n!=a.predicate.value.length-1?(l={token:"var",value:"fresh:"+c.freshCounter},c.freshCounter++):l=r,m={subject:h,predicate:a.predicate.value[n],object:l},null!=d&&(m.graph=b.clone(d,!0)),u.push(m),n!=a.predicate.value.length-1&&(h=b.clone(l,!0));return AbstractQueryTree.translatePathExpressionsInBGP({kind:"BGP",value:u},c)}throw new v("Non supported path expression "+a.predicate.kind);};AbstractQueryTree.prototype._buildGroupGraphPattern=
function(a,b){for(var c=a.filters||[],h=a.binds||[],d={kind:"EMPTY_PATTERN"},l=0;l<a.patterns.length;l++){var m=a.patterns[l];"optionalgraphpattern"===m.token?(m=this.build(m.value,b),d="FILTER"===m.kind?{kind:"LEFT_JOIN",lvalue:d,rvalue:m.value,filter:m.filter}:{kind:"LEFT_JOIN",lvalue:d,rvalue:m,filter:!0}):(m=this.build(m,b),d="EMPTY_PATTERN"==d.kind?m:{kind:"JOIN",lvalue:d,rvalue:m})}d.binds=h;if(0!=c.length){if("EMPTY_PATTERN"===d.kind||"LEFT_JOIN"===d.kind&&!0===d.filter||"LEFT_JOIN"===d.kind||
"JOIN"===d.kind||"UNION"===d.kind||"GRAPH"===d.kind||"BGP"===d.kind)return{kind:"FILTER",filter:c,value:d};throw Error("Unknow kind of algebra expression: "+d.kind);}return d};AbstractQueryTree.prototype.collectBasicTriples=function(a,b){null==b&&(b=[]);if("select"===a.kind)b=this.collectBasicTriples(a.pattern,b);else if("BGP"===a.kind)b=b.concat(a.value);else if("ZERO_OR_MORE_PATH"===a.kind)b=this.collectBasicTriples(a.path);else if("UNION"===a.kind)b=this.collectBasicTriples(a.value[0],b),b=this.collectBasicTriples(a.value[1],
b);else if("GRAPH"===a.kind)b=this.collectBasicTriples(a.value,b);else if("LEFT_JOIN"===a.kind||"JOIN"===a.kind)b=this.collectBasicTriples(a.lvalue,b),b=this.collectBasicTriples(a.rvalue,b);else if("FILTER"===a.kind)b=this.collectBasicTriples(a.value,b);else if("construct"===a.kind)b=this.collectBasicTriples(a.pattern,b);else if("EMPTY_PATTERN"!==a.kind)throw"Unknown pattern: "+a.kind;return b};AbstractQueryTree.prototype.bind=function(a,b){null!=a.graph&&a.graph.token&&"var"===a.graph.token&&null!=
b[a.graph.value]&&(a.graph=b[a.graph.value]);if(null!=a.filter){for(var c=[],h=0;h<a.filter.length;h++)a.filter[h].value=this._bindFilter(a.filter[h].value,b),c.push(a.filter[h]);a.filter=c}if("select"===a.kind)a.pattern=this.bind(a.pattern,b);else if("BGP"===a.kind)a.value=this._bindTripleContext(a.value,b);else if("ZERO_OR_MORE_PATH"===a.kind)a.path=this._bindTripleContext(a.path,b),a.x&&"var"===a.x.token&&null!=b[a.x.value]&&(a.x=b[a.x.value]),a.y&&"var"===a.y.token&&null!=b[a.y.value]&&(a.y=b[a.y.value]);
else if("UNION"===a.kind)a.value[0]=this.bind(a.value[0],b),a.value[1]=this.bind(a.value[1],b);else if("GRAPH"===a.kind)a.value=this.bind(a.value,b);else if("LEFT_JOIN"===a.kind||"JOIN"===a.kind)a.lvalue=this.bind(a.lvalue,b),a.rvalue=this.bind(a.rvalue,b);else if("FILTER"===a.kind){var d=this;a.value=this.bind(a.value,b);a.filter=a.filter.map(function(a){return{token:"filter",value:d._bindFilter(a.value,b)}})}else if("EMPTY_PATTERN"!==a.kind)throw"Unknown pattern: "+a.kind;return a};AbstractQueryTree.prototype._bindTripleContext=
function(a,b){for(var c=0;c<a.length;c++){delete a[c].graph;delete a[c].variables;for(var h in a[c]){var d=a[c][h];"var"===d.token&&null!=b[d.value]&&(a[c][h]=b[d.value])}}return a};AbstractQueryTree.prototype._bindFilter=function(a,b){if(null!=a.expressionType){var c=a.expressionType;if("relationalexpression"==c)a.op1=this._bindFilter(a.op1,b),a.op2=this._bindFilter(a.op2,b);else if("conditionalor"==c||"conditionaland"==c)for(c=0;c<a.operands.length;c++)a.operands[c]=this._bindFilter(a.operands[c],
b);else if("additiveexpression"==c)for(a.summand=this._bindFilter(a.summand,b),c=0;c<a.summands.length;c++)a.summands[c].expression=this._bindFilter(a.summands[c].expression,b);else if("builtincall"==c)for(c=0;c<a.args.length;c++)a.args[c]=this._bindFilter(a.args[c],b);else if("multiplicativeexpression"==c)for(a.factor=this._bindFilter(a.factor,b),c=0;c<a.factors.length;c++)a.factors[c].expression=this._bindFilter(a.factors[c].expression,b);else if("unaryexpression"==c)a.expression=this._bindFilter(a.expression,
b);else if("irireforfunction"==c)for(c=0;c<a.factors.args;c++)a.args[c]=this._bindFilter(a.args[c],b);else"atomic"==c&&"var"==a.primaryexpression&&null!=b[a.value.value]&&(c=b[a.value.value],a.primaryexpression="uri"===c.token?"iri":"literal",a.value=c)}return a};AbstractQueryTree.prototype.replace=function(a,c,h,r){null!=a.graph&&a.graph.token&&a.graph.token===c.token&&a.graph.value==c.value&&(a.graph=b.clone(h,!0));if(null!=a.filter){for(var d=[],l=0;l<a.filter.length;l++)a.filter[l].value=this._replaceFilter(a.filter[l].value,
c,h,r),d.push(a.filter[l]);a.filter=d}if("select"===a.kind)a.pattern=this.replace(a.pattern,c,h,r);else if("BGP"===a.kind)a.value=this._replaceTripleContext(a.value,c,h,r);else if("ZERO_OR_MORE_PATH"===a.kind)a.path=this._replaceTripleContext(a.path,c,h,r),a.x&&a.x.token===c.token&&a.value===c.value&&(a.x=b.clone(h,!0)),a.y&&a.y.token===c.token&&a.value===c.value&&(a.y=b.clone(h,!0));else if("UNION"===a.kind)a.value[0]=this.replace(a.value[0],c,h,r),a.value[1]=this.replace(a.value[1],c,h,r);else if("GRAPH"===
a.kind)a.value=this.replace(a.value,c,h);else if("LEFT_JOIN"===a.kind||"JOIN"===a.kind)a.lvalue=this.replace(a.lvalue,c,h,r),a.rvalue=this.replace(a.rvalue,c,h,r);else if("FILTER"===a.kind)a.value=this._replaceFilter(a.value,c,h,r);else if("EMPTY_PATTERN"!==a.kind)throw"Unknown pattern: "+a.kind;return a};AbstractQueryTree.prototype._replaceTripleContext=function(a,c,h,r){for(var d=0;d<a.length;d++)for(var l in a[d]){var m=a[d][l];"var"===m.token&&"var"===c.token&&m.value===c.value?a[d][l]=h:"blank"===
m.token&&"blank"===c.token&&m.value===c.value?a[d][l]=h:"literal"!==m.token&&"uri"!==m.token||"literal"!==c.token&&"uri"!==c.token||m.token!==c.token||b.lexicalFormTerm(m,r)[m.token]!==b.lexicalFormTerm(c,r)[m.token]||(a[d][l]=h)}return a};AbstractQueryTree.prototype._replaceFilter=function(a,b,c,h){if(null!=a.expressionType){var d=a.expressionType;if("relationalexpression"==d)a.op1=this._replaceFilter(a.op1,b,c,h),a.op2=this._replaceFilter(a.op2,b,c,h);else if("conditionalor"==d||"conditionaland"==
d)for(d=0;d<a.operands.length;d++)a.operands[d]=this._replaceFilter(a.operands[d],b,c,h);else if("additiveexpression"==d)for(a.summand=this._replaceFilter(a.summand,b,c,h),d=0;d<a.summands.length;d++)a.summands[d].expression=this._replaceFilter(a.summands[d].expression,b,c,h);else if("builtincall"==d)for(d=0;d<a.args.length;d++)a.args[d]=this._replaceFilter(a.args[d],b,c,h);else if("multiplicativeexpression"==d)for(a.factor=this._replaceFilter(a.factor,b,c,h),d=0;d<a.factors.length;d++)a.factors[d].expression=
this._replaceFilter(a.factors[d].expression,b,c,h);else if("unaryexpression"==d)a.expression=this._replaceFilter(a.expression,b,c,h);else if("irireforfunction"==d)for(d=0;d<a.factors.args;d++)a.args[d]=this._replaceFilter(a.args[d],b,c,h);else"atomic"==d&&(h=null,a.primaryexpression==b.token&&a.value==b.value?h=c.value:"iri"==a.primaryexpression&&"uri"==b.token&&a.value==b.value&&(h=c.value),null!=h&&(a.primaryexpression="uri"===c.token?"iri":c.token,a.value=h))}return a};AbstractQueryTree.prototype.treeWithUnion=
function(a){if(null==a||null==a.kind)return!1;if("select"===a.kind)return this.treeWithUnion(a.pattern);if("BGP"===a.kind)return this.treeWithUnion(a.value);if("ZERO_OR_MORE_PATH"===a.kind)return!1;if("UNION"===a.kind)if(null!=a.value[0].value&&null!=a.value[0].value.variables&&null!=a.value[1].value&&null!=a.value[1].value.variables){if(a.value[0].variables.join("/")===a.values[1].variables.join("/"))return this.treeWithUnion(a.value[0])?!0:this.treeWithUnion(a.value[1])}else return!0;else{if("GRAPH"===
a.kind||"LEFT_JOIN"!==a.kind&&"JOIN"!==a.kind)return!1;if(this.treeWithUnion(a.lvalue))return!0;this.treeWithUnion(a.rvalue)}};B.exports={AbstractQueryTree:AbstractQueryTree,NonSupportedSparqlFeatureError:v,SparqlParserError:h}},{"./parser":46,"./utils":57}],40:[function(z,B,C){var v=z("./utils"),h=v.nextTick,c=function(a,b){if(0!=arguments.length){this.order=a;this.root=this._allocateNode();this.root.isLeaf=!0;this.root.level=0;var c=this;this._diskWrite(this.root,function(a){c.root=a;c._updateRootNode(c.root,
function(d){c.comparator=function(d,a){return d<a?-1:d>a?1:0};c.merger=null;null!=b&&b(c)})})}};c.prototype._allocateNode=function(){return new b};c.prototype._diskWrite=function(a,b){h(function(){b(a)})};c.prototype._diskRead=function(a,b){h(function(){b(a)})};c.prototype._diskDelete=function(a,b){h(function(){b()})};c.prototype._updateRootNode=function(a,b){b(a)};c.prototype.search=function(a,b,c){this.__search(this,a,this.root,b,c)};c.prototype.__search=function(a,b,c,h,d){for(var l=0;l<c.numberActives&&
1===a.comparator(b,c.keys[l].key);)l++;l<c.numberActives&&0===a.comparator(c.keys[l].key,b)?null!=d&&1==d?h(!0):h(c.keys[l].data):!0===c.isLeaf?h(null):a._diskRead(c.children[l],function(c){a.__search(a,b,c,h,d)})};c.prototype.walk=function(a,b){this.__walk(this,this.root,a,b)};c.prototype.__walk=function(a,b,c,h){var d=b.numberActives,l=0;if(b.isLeaf){for(l=0;l<b.numberActives;l++)c(b.keys[l]);return h()}v.whilst(function(){return l<d},function(d){a._diskRead(b.children[l],function(h){a.__walk(a,
h,c,function(){a._diskRead(b.keys[l],function(a){c(a);l++;d()})})})},function(){a._diskRead(b.children[d],function(d){a.__walk(a,d,c,function(){h()})})})};c.prototype.walkNodes=function(a){this.__walkNodes(this,root,a,function(){})};c.prototype.__walkNodes=function(a,b,c,h){if(b.isLeaf)return c(b),h();c(b);var d=b.numberActives,l=0;v.whilst(function(){return l<d},function(d){a._diskRead(b.children[l],function(b){a.__walkNodes(a,b,c,function(){l++;d()})})},function(){a._diskRead(b.children[d],function(d){a.__walkNodes(a,
d,c,function(){})})})};c.prototype._splitChild=function(a,b,c,h){var d=this._allocateNode();d.isLeaf=c.isLeaf;d.level=c.level;d.numberActives=this.order-1;var l=c.keys[this.order-1];c.keys[this.order-1]=null;for(var m=0;m<this.order-1;m++)d.keys[m]=c.keys[m+this.order],c.keys[m+this.order]=null,c.isLeaf||(d.children[m]=c.children[m+this.order],c.children[m+this.order]=null);c.isLeaf||(d.children[m]=c.children[m+this.order],c.children[m+this.order]=null);c.numberActives=this.order-1;for(m=a.numberActives+
1;m>b+1;m--)a.children[m]=a.children[m-1];a.children[b+1]=d;for(m=a.numberActives;m>b;m--)a.keys[m]=a.keys[m-1];a.keys[b]=l;a.numberActives++;var u=this;this._diskWrite(d,function(d){u._diskWrite(a,function(a){a.children[b+1]=d;u._diskWrite(c,function(d){return h(a)})})})};c.prototype.insert=function(a,b,c){if(this.root.numberActives===2*this.order-1){var h=this._allocateNode();h.isLeaf=!1;h.level=this.root.level+1;h.numberActives=0;h.children[0]=this.root;var d=this;this._splitChild(h,0,this.root,
function(l){h=l;d.root=h;d._updateRootNode(h,function(h){d._insertNonFull(h,a,b,c)})})}else this._insertNonFull(this.root,a,b,c)};c.prototype._insertNonFull=function(a,b,c,h){this.__insertNonFull(this,a,a.numberActives-1,b,c,h)};c.prototype.__insertNonFull=function(a,b,c,h,d,l){if(b.isLeaf){for(;0<=c&&-1===a.comparator(h,b.keys[c].key);)b.keys[c+1]=b.keys[c],c--;0<=c&&0===a.comparator(h,b.keys[c].key)?b.keys[c]={key:h,data:d}:(b.keys[c+1]={key:h,data:d},b.numberActives++);a._diskWrite(b,function(d){return l(d)})}else{for(;0<=
c&&-1===a.comparator(h,b.keys[c].key);)c--;c++;a._diskRead(b.children[c],function(m){m.numberActives===2*a.order-1?a._splitChild(b,c,m,function(){1===a.comparator(h,b.keys[c].key)&&c++;a._diskRead(b.children[c],function(b){c=b.numberActives-1;a.__insertNonFull(a,b,c,h,d,l)})}):a._diskRead(b.children[c],function(b){c=b.numberActives-1;a.__insertNonFull(a,b,c,h,d,l)})})}};c.prototype.delete=function(a,b){c.prototype.__deleteSearchNode(this,a,this.root,b)};c.prototype.__deleteSearchNode=function(a,b,
c,h){var d=0;if(0===c.numberActives)return h(!1);for(;d<c.numberActives&&1===a.comparator(b,c.keys[d].key);)d++;var l=d;if(d<c.numberActives&&0===a.comparator(b,c.keys[d].key))return a.__deleteNodeFound(a,l,b,c,h);if(!0===c.isLeaf)return h(!1);a._diskRead(c.children[d],function(m){if(null===m)return h(!1);var u=!1,n=!1,x=null,E=null;l===c.numberActives?(n=!0,E=c.children[l-1],x=c.children[l-1]):0===l?(u=!0,x=c.children[1],E=c.children[1]):(E=c.children[l-1],x=c.children[l+1]);a._diskRead(E,function(l){a._diskRead(x,
function(x){!0===n&&(x=null);!0===u&&(l=null);m.numberActives===a.order-1&&null!=c?null!=x&&x.numberActives>a.order-1?a._moveKey(c,d,-1,function(d){a.__deleteSearchNode(a,b,m,h)}):null!=l&&l.numberActives>a.order-1?a._moveKey(c,d,1,function(d){a.__deleteSearchNode(a,b,m,h)}):null!=l&&l.numberActives===a.order-1?a._mergeSiblings(c,d,-1,function(d){a.__deleteSearchNode(a,b,d,h)}):null!=x&&x.numberActives===a.order-1&&a._mergeSiblings(c,d,1,function(d){a.__deleteSearchNode(a,b,d,h)}):a.__deleteSearchNode(a,
b,m,h)})})})};c.prototype.__deleteNodeFound=function(a,b,c,h,d){if(h.isLeaf&&h.numberActives>a.order-1||h.isLeaf&&h===a.root)return a._deleteKeyFromNode(h,b,function(){d(!0)}),!0;!1===h.isLeaf&&a._diskRead(h.children[b],function(l){l.numberActives>a.order-1?a._getMaxKeyPos(a,l,function(m){c=m.node.keys[m.index];h.keys[b]=c;a._diskWrite(h,function(b){b=l;c=c.key;a.__deleteSearchNode(a,c,b,d)})}):a._diskRead(h.children[b+1],function(m){m.numberActives>a.order-1?a._getMinKeyPos(a,m,function(l){c=l.node.keys[l.index];
h.keys[b]=c;a._diskWrite(h,function(b){b=m;c=c.key;a.__deleteSearchNode(a,c,b,d)})}):l.numberActives===a.order-1&&m.numberActives===a.order-1&&a._mergeNodes(l,h.keys[b],m,function(l){h.children[b]=l;b++;for(var n=b;n<h.numberActives;n++)h.children[n]=h.children[n+1],h.keys[n-1]=h.keys[n];h.children[n]=null;h.keys[n-1]=null;h.numberActives--;0===h.numberActives&&a.root===h&&(a.root=l);a._diskWrite(h,function(b){a.__deleteSearchNode(a,c,l,d)})})})});h.isLeaf&&h.numberActives>a.order-1&&a._deleteKeyFromNode(h,
b,function(b){a.__deleteSearchNode(a,c,b,d)})};c.prototype._moveKey=function(a,b,c,h){1===c&&b--;var d=this;d._diskRead(a.children[b],function(l){d._diskRead(a.children[b+1],function(m){if(-1==c){l.keys[l.numberActives]=a.keys[b];l.children[l.numberActives+1]=m.children[0];m.children[0]=null;l.numberActives++;a.keys[b]=m.keys[0];for(var u=1;u<m.numberActives;u++)m.keys[u-1]=m.keys[u],m.children[u-1]=m.children[u];m.children[m.numberActives-1]=m.children[m.numberActives];m.numberActives--}else{m.children[m.numberActives+
1]=m.children[m.numberActives];for(u=m.numberActives;0<u;u--)m.children[u]=m.children[u-1],m.keys[u]=m.keys[u-1];m.keys[0]=null;m.children[0]=null;m.children[0]=l.children[l.numberActives];m.keys[0]=a.keys[b];m.numberActives++;l.children[l.numberActives]=null;a.keys[b]=l.keys[l.numberActives-1];l.keys[l.numberActives-1]=null;l.numberActives--}d._diskWrite(l,function(b){d._diskWrite(m,function(b){d._diskWrite(a,function(d){return h(d)})})})})})};c.prototype._mergeSiblings=function(a,b,c,h){var d,l,
m;b===a.numberActives?(b--,c=a.children[a.numberActives-1],m=a.children[a.numberActives]):(c=a.children[b],m=a.children[b+1]);var u=this;u._diskRead(c,function(c){u._diskRead(m,function(k){var m=u._allocateNode();m.isLeaf=c.isLeaf;m.level=c.level;for(l=0;l<u.order-1;l++)m.keys[l]=c.keys[l],m.children[l]=c.children[l];m.keys[u.order-1]=a.keys[b];m.children[u.order-1]=c.children[u.order-1];for(l=0;l<u.order-1;l++)m.keys[l+u.order]=k.keys[l],m.children[l+u.order]=k.children[l];m.children[2*u.order-1]=
k.children[u.order-1];a.children[b]=m;for(l=b;l<a.numberActives;l++)a.keys[l]=a.keys[l+1],a.children[l+1]=a.children[l+2];m.numberActives=c.numberActives+k.numberActives+1;a.numberActives--;for(d=a.numberActives;d<2*u.order-1;d++)a.keys[d]=null;0===a.numberActives&&u.root===a&&(u.root=m,m.isLeaf=m.level?!1:!0);u._diskWrite(m,function(d){u._diskWrite(a,function(a){u._diskDelete(c,function(){u._diskDelete(k,function(){if(u.root===d)u._updateRootNode(u.root,function(){return h(d)});else return h(d)})})})})})})};
c.prototype._deleteKeyFromNode=function(a,b,c){var h=2*this.order-1;a.numberActives<h&&(h=a.numberActives);if(!1===a.isLeaf)return!1;for(;b<h-1;b++)a.keys[b]=a.keys[b+1];a.keys.pop();a.numberActives--;this._diskWrite(a,function(d){return c(d)})};c.prototype._mergeNodes=function(a,b,c,h){var d,l;d=this._allocateNode();d.isLeaf=!0;for(l=0;l<a.numberActives;l++)d.keys[l]=a.keys[l],d.children[l]=a.children[l];d.children[a.numberActives]=a.children[a.numberActives];d.keys[a.numberActives]=b;for(l=0;l<
c.numberActives;l++)d.keys[l+a.numberActives+1]=c.keys[l],d.children[l+a.numberActives+1]=c.children[l];d.children[2*this.order-1]=c.children[c.numberActives];d.numberActives=a.numberActives+c.numberActives+1;d.isLeaf=a.isLeaf;d.level=a.level;var m=this;this._diskWrite(d,function(d){m._diskDelete(a,function(){m._diskDelete(c,function(){return h(d)})})})};c.prototype.audit=function(a){var b=[],c=[],h=this,d=function(d){for(var l=0;l<c.length;l++)if(0===h.comparator(c[l],d)){var n=" !!! duplicated key "+
d;!0===a&&console.log(n);b.push(n)}},l=null,h=this;this.walkNodes(function(m){!0===a&&(console.log("--- Node at "+m.level+" level"),console.log(" - leaf? "+m.isLeaf),console.log(" - num actives? "+m.numberActives),console.log(" - keys: "));for(var u=m.numberActives;u<m.keys.length;u++)null!=m.keys[u]&&!0===a&&(console.log(" * warning : redundant key data"),b.push(" * warning : redundant key data"));for(u=m.numberActives+1;u<m.children.length;u++)null!=m.children[u]&&!0===a&&(console.log(" * warning : redundant children data"),
b.push(" * warning : redundant key data"));if(!1===m.isLeaf)for(u=0;u<m.numberActives;u++){var n=this._diskRead(m.children[u]).keys[this._diskRead(m.children[u]).numberActives-1].key,x=this._diskRead(m.children[u+1]).keys[0].key;!0===a&&console.log(" "+m.keys[u].key+"("+n+","+x+")");if(-1===h.comparator(m.keys[u].key,n)){var v=" !!! value max left "+n+" > key "+m.keys[u].key;!0===a&&console.log(v);b.push(v)}1===h.comparator(m.keys[u].key,x)&&(v=" !!! value min right "+x+" < key "+m.keys[u].key,
!0===a&&console.log(v),b.push(v));d(m.keys[u].key);c.push(m.keys[u].key)}else for(null===l?l=m.level:l!=m.level&&(v=" !!! Leaf node with wrong level value",!0===a&&console.log(v),b.push(v)),u=0;u<m.numberActives;u++)!0===a&&console.log(" "+m.keys[u].key),d(m.keys[u].key),c.push(m.keys[u].key);m!=h.root&&(m.numberActives>2*h.order-1&&(!0===a&&(v=" !!!! MAX num keys restriction violated "),console.log(v),b.push(v)),m.numberActives<h.order-1&&(!0===a&&(v=" !!!! MIN num keys restriction violated "),console.log(v),
b.push(v)))});return b};c.prototype._getMaxKeyPos=function(a,b,c){var h={};if(null===b)return c(null);if(!0===b.isLeaf)return h.node=b,h.index=b.numberActives-1,c(h);h.node=b;h.index=b.numberActives-1;a._diskRead(b.children[b.numberActives],function(d){return a._getMaxKeyPos(a,d,c)})};c.prototype._getMinKeyPos=function(a,b,c){var h={};null===b&&c(null);if(!0===b.isLeaf)return h.node=b,h.index=0,c(h);h.node=b;h.index=0;a._diskRead(b.children[0],function(d){return a._getMinKeyPos(a,d,c)})};var b=function(){this.numberActives=
0;this.isLeaf=null;this.keys=[];this.children=[];this.level=0};B.exports={Tree:c,Node:b}},{"./utils":57}],41:[function(z,B,C){var v=z("./query_engine").QueryEngine,h=z("./quad_backend").QuadBackend,c=z("./persistent_quad_backend").PersistentQuadBackend,b=z("./lexicon").Lexicon,a=z("./persistent_lexicon").PersistentLexicon,f=z("./rdf_model"),k=z("./utils");Store=function(f,d){var k=null,m=null;if(0==arguments.length)m={};else if(1==arguments.length)m={},k=f;else if(1<arguments.length)m=f,k=d;else throw"An optional argument map and a callback must be provided";
null==m.treeOrder&&(m.treeOrder=15);var u=b,n=h;!0===m.persistent&&(u=a,n=c);this.functionMap={};var x=this;this.customFns={};new u(function(d){var a=function(){new n(m,function(a){var b=function(){m.backend=a;m.lexicon=d;x.engine=new v(m);k(null,x)};m.overwrite?a.clear(b):b()})};!0===m.overwrite?d.clear(a):a()},m.name)};Store.prototype.rdf=f.rdf;Store.prototype.rdf.api=f;Store.prototype.registerCustomFunction=function(a,d){this.customFns[a]=d;this.engine.setCustomFunctions(this.customFns)};Store.prototype.execute=
function(){if(3===arguments.length)this.executeWithEnvironment(arguments[0],arguments[1],arguments[2]);else if(4===arguments.length)this.executeWithEnvironment(arguments[0],arguments[1],arguments[2],arguments[3]);else{var a,d;1===arguments.length?(a=arguments[0],d=function(){}):2===arguments.length&&(a=arguments[0],d=arguments[1]);this.engine.execute(a,d)}};Store.prototype.executeWithEnvironment=function(){var a,d,b;if(3===arguments.length){a=arguments[0];var c=function(){};d=arguments[1];b=arguments[2]}else 4===
arguments.length&&(a=arguments[0],c=arguments[3],d=arguments[1],b=arguments[2]);d=k.map(d,function(d){return{token:"uri",value:d}});b=k.map(b,function(d){return{token:"uri",value:d}});this.engine.execute(a,c,d,b)};Store.prototype.graph=function(){var a=null,d=null;if(1===arguments.length)d=arguments[0]||function(){},a=this.engine.lexicon.defaultGraphUri;else if(2===arguments.length)d=arguments[1]||function(){},a=arguments[0];else throw"An optional graph URI and a callback function must be provided";
null!=this.rdf.resolve(a)&&(a=this.rdf.resolve(a));this.engine.execute("CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <"+a+"> { ?s ?p ?o } }",d)};Store.prototype.node=function(){var a=null,d=null,b=null;if(2===arguments.length)b=arguments[0],d=arguments[1]||function(){},a=this.engine.lexicon.defaultGraphUri;else if(3===arguments.length)b=arguments[0],a=arguments[1],d=arguments[2]||function(){};else throw"An optional graph URI, node URI and a callback function must be provided";null!=this.rdf.resolve(a)&&(a=
this.rdf.resolve(a));null!=this.rdf.resolve(b)&&(b=this.rdf.resolve(b));this.engine.execute("CONSTRUCT { <"+b+"> ?p ?o } WHERE { GRAPH <"+a+"> { <"+b+"> ?p ?o } }",d)};Store.prototype.startObservingNode=function(){var a,d,b;2===arguments.length?(a=arguments[0],b=arguments[1],this.engine.callbacksBackend.observeNode(a,b,function(){})):3===arguments.length&&(a=arguments[0],d=arguments[1],b=arguments[2],this.engine.callbacksBackend.observeNode(a,d,b,function(){}))};Store.prototype.stopObservingNode=
function(a){this.engine.callbacksBackend.stopObservingNode(a)};Store.prototype.startObservingQuery=function(a,d,b){null!=b?this.engine.callbacksBackend.observeQuery(a,d,b):this.engine.callbacksBackend.observeQuery(a,d,function(){})};Store.prototype.stopObservingQuery=function(a){this.engine.callbacksBackend.stopObservingQuery(a)};Store.prototype.subscribe=function(a,d,b,c,h){var n=this,x=function(d,a){var b=[],c={blanks:{},outCache:{}},l=[];k.each(a,function(d){var a=f.buildRDFResource(d.subject,
l,n.engine,c),h=f.buildRDFResource(d.predicate,l,n.engine,c);d=f.buildRDFResource(d.object,l,n.engine,c);null!=a&&null!=h&&null!=d&&(d=new f.Triple(a,h,d),b.push(d))});h(d,b)};this.functionMap[h]=x;this.engine.callbacksBackend.subscribe(a,d,b,c,x,function(){})};Store.prototype.unsubscribe=function(a){this.engine.callbacksBackend.unsubscribe(this.functionMap[a]);delete this.functionMap[a]};Store.prototype.setPrefix=function(a,d){this.rdf.setPrefix(a,d)};Store.prototype.setDefaultPrefix=function(a){this.rdf.setDefaultPrefix(a)};
Store.prototype.insert=function(){var a,d,b;if(1===arguments.length)d=arguments[0],b=function(){};else if(2===arguments.length)d=arguments[0],b=arguments[1]||function(){};else if(3===arguments.length)d=arguments[0],a=this.rdf.createNamedNode(arguments[1]),b=arguments[2]||function(){};else throw"The triples to insert, an optional graph and callback must be provided";var c="",h=this;d.forEach(function(d){c=c+h._nodeToQuery(d.subject)+h._nodeToQuery(d.predicate)+h._nodeToQuery(d.object)+"."});c=null!=
a?"INSERT DATA { GRAPH "+this._nodeToQuery(a)+" { "+c+" } }":"INSERT DATA { "+c+" }";this.engine.execute(c,b)};Store.prototype._nodeToQuery=function(a){if("NamedNode"===a.interfaceName){var d=this.rdf.resolve(a.valueOf());return null!=d?"<"+d+">":"<"+a.valueOf()+">"}return a.toString()};Store.prototype.delete=function(){var a,d,b;if(1===arguments.length)d=arguments[0],b=function(){};else if(2===arguments.length)d=arguments[0],b=arguments[1]||function(){};else if(3===arguments.length)d=arguments[0],
a=this.rdf.createNamedNode(arguments[1]),b=arguments[2]||function(){};else throw"The triples to delete, an optional graph and callback must be provided";var c="",h=this;d.forEach(function(d){c=c+h._nodeToQuery(d.subject)+h._nodeToQuery(d.predicate)+h._nodeToQuery(d.object)+"."});c=null!=a?"DELETE DATA { GRAPH "+this._nodeToQuery(a)+" { "+c+" } }":"DELETE DATA { "+c+" }";this.engine.execute(c,b)};Store.prototype.clear=function(){var a,d;if(0===arguments.length)a=this.rdf.createNamedNode(this.engine.lexicon.defaultGraphUri),
d=function(){};else if(1===arguments.length)a=this.rdf.createNamedNode(this.engine.lexicon.defaultGraphUri),d=arguments[0]||function(){};else if(2===arguments.length)a=this.rdf.createNamedNode(arguments[0]),d=arguments[1]||function(){};else throw"The optional graph and a callback must be provided";a="CLEAR GRAPH "+this._nodeToQuery(a);this.engine.execute(a,d)};Store.prototype.setBatchLoadEvents=function(a){this.engine.eventsOnBatchLoad=a};Store.prototype.registerDefaultNamespace=function(a,d){this.rdf.prefixes.set(a,
d);this.engine.registerDefaultNamespace(a,d)};Store.prototype.registerDefaultProfileNamespaces=function(){var a=this.rdf.prefixes.values(),d;for(d in a)this.registerDefaultNamespace(d,a[d])};Store.prototype.load=function(){var a,d,b,c,h={};if(3===arguments.length)b=this.rdf.createNamedNode(this.engine.lexicon.defaultGraphUri),a=arguments[0],d=arguments[1],c=arguments[2]||function(){};else if(4===arguments.length)a=arguments[0],d=arguments[1],h=arguments[2],"string"===typeof h?(b=this.rdf.createNamedNode(h),
h={}):(b=this.rdf.createNamedNode(h.graph||this.engine.lexicon.defaultGraphUri),delete h.graph),c=arguments[3]||function(){};else if(2===arguments.length)throw"The mediaType of the parser, the data a callback and an optional graph must be provided";if("remote"===a)d=this.rdf.createNamedNode(d),this.engine.execute("LOAD <"+d.valueOf()+"> INTO GRAPH <"+b.valueOf()+">",c);else{var f=this,k=this.engine.rdfLoader.parsers[a];if(!k)return c(Error("Cannot find parser for the provided media type:"+a));a=[k,
{token:"uri",value:b.valueOf()},d,h,function(d,a){d?c(d,a):f.engine.batchLoad(a,function(d){null!=d?c(null,d):c(Error("Erro batch-loading triples."))})}];d&&"string"===typeof d&&0===d.indexOf("file://")?this.engine.rdfLoader.loadFromFile.apply(null,a):this.engine.rdfLoader.tryToParse.apply(null,a)}};Store.prototype.registerParser=function(a,d){this.engine.rdfLoader.registerParser(a,d)};Store.prototype.registeredGraphs=function(a){this.engine.lexicon.registeredGraphs(!0,function(d){d=k.map(d,function(d){return new f.NamedNode(d)});
a(null,d)})};Store.prototype.getNetworkTransport=function(){return NetworkTransport};Store.prototype.setNetworkTransport=function(a){NetworkTransport=a};Store.prototype.close=function(a){null==a&&(a=function(){});this.engine.close?this.engine.close(a):a()};Store.VERSION="0.9.17";Store.yieldFrequency=function(a){k.yieldFrequency(a)};B.exports.Store=Store;B.exports.create=function(){return 1==arguments.length?new Store(arguments[0]):2==arguments.length?new Store(arguments[0],arguments[1]):new Store};
B.exports.connect=function(){(1==arguments.length?arguments[0]:2==arguments.length?arguments[1]:arguments[2])(Error("Store#connect is not supported in the 0.9.X series of the library"))}},{"./lexicon":44,"./persistent_lexicon":47,"./persistent_quad_backend":48,"./quad_backend":49,"./query_engine":51,"./rdf_model":55,"./utils":57}],42:[function(z,B,C){var v=z("./utils"),h=z("./utils");z("./quad_index");var c=z("./quad_index").Pattern,b=z("./rdf_model"),a=z("./abstract_query_tree").AbstractQueryTree;
Callbacks={ANYTHING:{token:"var",value:"_"},added:"added",deleted:"deleted",eventsFlushed:"eventsFlushed",CallbacksBackend:function(b){this.aqt=new a;this.engine=b;this.indexMap={};this.observersMap={};this.queriesIndexMap={};this.emptyNotificationsMap={};this.queriesList=[];this.pendingQueries=[];this.matchedQueries=[];this.updateInProgress=null;this.indices="SPOG GP OGS POG GSP OS".split(" ");this.componentOrders={SPOG:["subject","predicate","object","graph"],GP:["graph","predicate","subject","object"],
OGS:["object","graph","subject","predicate"],POG:["predicate","object","graph","subject"],GSP:["graph","subject","predicate","object"],OS:["object","subject","predicate","graph"]};this.callbackCounter=0;this.callbacksMap={};this.callbacksInverseMap={};this.queryCounter=0;this.queriesMap={};this.queriesCallbacksMap={};this.queriesInverseMap={};for(b=0;b<this.indices.length;b++){var c=this.indices[b];this.indexMap[c]={};this.queriesIndexMap[c]={}}}};Callbacks.CallbacksBackend.prototype.startGraphModification=
function(){!0!==this.ongoingModification&&(this.pendingQueries=[].concat(this.queriesList),this.matchedQueries=[],null==this.updateInProgress&&(this.updateInProgress={},this.updateInProgress[Callbacks.added]=[],this.updateInProgress[Callbacks.deleted]=[]))};Callbacks.CallbacksBackend.prototype.nextGraphModification=function(a,b){this.updateInProgress[a].push(b)};Callbacks.CallbacksBackend.prototype.endGraphModification=function(a){if(!0!==this.ongoingModification){var b=this;if(null!=this.updateInProgress){var c=
b.updateInProgress;b.updateInProgress=null;this.sendNotification(Callbacks.deleted,c[Callbacks.deleted],function(){b.sendNotification(Callbacks.added,c[Callbacks.added],function(){b.sendEmptyNotification(Callbacks.eventsFlushed,null,function(){b.dispatchQueries(function(){a(!0)})})})})}else a(!0)}else a(!0)};Callbacks.CallbacksBackend.prototype.cancelGraphModification=function(){!0!==this.ongoingModification&&(this.updateInProgress=null)};Callbacks.CallbacksBackend.prototype.sendNotification=function(a,
b,c){for(var d={},h=0;h<b.length;h++){var m=b[h],u;for(u in this.indexMap){var n=this.indexMap[u],x=this.componentOrders[u];this._searchCallbacksInIndex(n,x,a,m,d);0!=this.pendingQueries.length&&(n=this.queriesIndexMap[u],this._searchQueriesInIndex(n,x,m))}}this.dispatchNotifications(d);null!=c&&c(!0)};Callbacks.CallbacksBackend.prototype.sendEmptyNotification=function(a,b,c){for(var d=this.emptyNotificationsMap[a]||[],h=0;h<d.length;h++)d[h](a,b);c()};Callbacks.CallbacksBackend.prototype.dispatchNotifications=
function(a){for(var b in a){var c=this.callbacksMap[b],d=a[b][Callbacks.deleted];if(null!=d)try{c(Callbacks.deleted,d)}catch(h){}for(var l in a[b])if(l!=Callbacks.deleted)try{c(l,a[b][l])}catch(h){}}};Callbacks.CallbacksBackend.prototype._searchCallbacksInIndex=function(a,b,c,d,h){var m=d[1];d=d[0];for(var u=0;u<b.length+1;u++){for(var n=a._||[],x=[],v=0;v<n.length;v++){var y=n[v];null!=this.callbacksMap[y]&&(h[y]=h[y]||{},h[y][c]=h[y][c]||[],h[y][c].push(d),x.push(y))}a._=x;n=b[u];if(null!=a[""+
m[n]])a=a[""+m[n]];else break}};Callbacks.CallbacksBackend.prototype.subscribeEmpty=function(a,b){var c=this.emptyNotificationsMap[a]||[];c.push(b);this.emptyNotificationsMap[a]=c};Callbacks.CallbacksBackend.prototype.unsubscribeEmpty=function(a,b){var c=this.emptyNotificationsMap[a];null!=c&&(c=v.reject(c,function(d){return d===b}));this.emptyNotificationsMap[a]=c};Callbacks.CallbacksBackend.prototype.subscribe=function(a,b,h,d,l,m){a=this._tokenizeComponents(a,b,h,d);b={blanks:{},outCache:{}};this.engine.registerNsInEnvironment(null,
b);var u=this;this.engine.normalizeQuad(a,b,!0,function(d){for(var a=new c(d),b=u._indexForPattern(a),a=u.componentOrders[b],b=u.indexMap[b],h=0;h<a.length;h++){var f=d[a[h]];if("_"===f){null==b._&&(b._=[]);u.callbackCounter++;b._.push(u.callbackCounter);u.callbacksMap[u.callbackCounter]=l;u.callbacksInverseMap[l]=u.callbackCounter;break}else h===a.length-1?(b[f]=b[f]||{_:[]},u.callbackCounter++,b[f]._.push(u.callbackCounter),u.callbacksMap[u.callbackCounter]=l,u.callbacksInverseMap[l]=u.callbackCounter):
(b[f]=b[f]||{},b=b[f])}null!=m&&m(!0)})};Callbacks.CallbacksBackend.prototype.unsubscribe=function(a){var b=this.callbacksInverseMap[a];null!=b&&(delete this.callbacksInverseMap[a],delete this.callbacksMap[b])};Callbacks.CallbacksBackend.prototype._tokenizeComponents=function(a,b,c,d){var h={};null==a?h.subject=Callbacks.ANYTHING:0==a.indexOf("_:")?h.subject={token:"blank",value:a}:h.subject={token:"uri",value:a};h.predicate=null==b?Callbacks.ANYTHING:{token:"uri",value:b};h.object=null==c?Callbacks.ANYTHING:
{token:"uri",value:c};h.graph=null==d?Callbacks.ANYTHING:{token:"uri",value:d};return h};Callbacks.CallbacksBackend.prototype._indexForPattern=function(a){a=a.indexKey;for(var b=this.indices,c=0;c<b.length;c++)for(var d=b[c],h=this.componentOrders[d],m=0;m<h.length&&!1!==v.include(a,h[m]);m++)if(m==a.length-1)return d;return"SPOG"};Callbacks.CallbacksBackend.prototype.observeNode=function(){var a,c,h,d;4===arguments.length?(a=arguments[0],c=arguments[1],h=arguments[2],d=arguments[3]):(a=arguments[0],
c=this.engine.lexicon.defaultGraphUri,h=arguments[1],d=arguments[2]);c="CONSTRUCT { <"+a+"> ?p ?o } WHERE { GRAPH <"+c+"> { <"+a+"> ?p ?o } }";var l=this,m={blanks:{},outCache:{}};this.engine.registerNsInEnvironment(null,m);var u=[];this.engine.execute(c,function(c,k){if(c)d&&d(!1);else{var v=!1,y=function(d,a){if("eventsFlushed"===d&&v){v=!1;try{h(k)}catch(c){}}else if("eventsFlushed"!==d){v=!0;for(var f=0;f<a.length;f++){var n=a[f],y=b.buildRDFResource(n.subject,u,l.engine,m),z=b.buildRDFResource(n.predicate,
u,l.engine,m),n=b.buildRDFResource(n.object,u,l.engine,m);null!=y&&null!=z&&null!=n&&(n=new b.Triple(y,z,n),d===Callbacks.added?k.add(n):d===Callbacks.deleted&&k.remove(n))}}};l.observersMap[h]=y;l.subscribeEmpty(Callbacks.eventsFlushed,y);l.subscribe(a,null,null,null,y,function(){try{h(k)}catch(a){}d&&d(!0)})}})};Callbacks.CallbacksBackend.prototype.stopObservingNode=function(a){return(a=this.observersMap[a])?(this.unsubscribe(a),this.unsubscribeEmpty(Callbacks.eventsFlushed,a),!0):!1};Callbacks.CallbacksBackend.prototype.observeQuery=
function(a,b,r){var d=this.aqt.parseQueryString(a),d=this.aqt.parseSelect(d.units[0]),d=this.aqt.collectBasicTriples(d),l=this,m={blanks:{},outCache:{}};this.engine.registerNsInEnvironment(null,m);var u=this.queryCounter;this.queryCounter++;this.queriesMap[u]=a;this.queriesInverseMap[a]=u;this.queriesList.push(u);this.queriesCallbacksMap[u]=b;h.eachSeries(d,function(d,a){null==d.graph&&(d.graph=l.engine.lexicon.defaultGraphUriTerm);l.engine.normalizeQuad(d,m,!0,function(d){for(var b=new c(d),h=l._indexForPattern(b),
b=l.componentOrders[h],h=l.queriesIndexMap[h],f=0;f<b.length;f++){var k=d[b[f]];if("string"===typeof k){null==h._&&(h._=[]);h._.push(u);break}else f===b.length-1?(h[k]=h[k]||{_:[]},h[k]._.push(u)):(h[k]=h[k]||{},h=h[k])}a()})},function(){l.engine.execute(a,function(d,a){d?console.log("ERROR in query callback "+a):b(a)});null!=r&&r()})};Callbacks.CallbacksBackend.prototype.stopObservingQuery=function(a){var b=this.queriesInverseMap[a];null!=b&&(delete this.queriesInverseMap[a],delete this.queriesMap[b],
this.queriesList=v.reject(this.queriesList,function(a){return a===b}))};Callbacks.CallbacksBackend.prototype._searchQueriesInIndex=function(a,b,c){var d=c[1];c=c[0];for(c=0;c<b.length+1;c++){for(var h=a._||[],m=[],u=0;u<h.length;u++){var n=h[u];v.include(this.pendingQueries,n)&&(v.remove(this.pendingQueries,function(d){return d===n}),this.matchedQueries.push(n));null!=this.queriesMap[n]&&m.push(n)}a._=m;h=b[c];if(null!=a[""+d[h]])a=a[""+d[h]];else break}};Callbacks.CallbacksBackend.prototype.dispatchQueries=
function(a){var b=this,c,d,l={};h.eachSeries(this.matchedQueries,function(a,h){null==l[a]?(l[a]=!0,c=b.queriesMap[a],d=b.queriesCallbacksMap[a],b.engine.execute(c,function(a,b){if(!a)try{d(b)}catch(c){}h()})):h()},function(){a()})};Callbacks.CallbacksBackend.added=Callbacks.added;Callbacks.CallbacksBackend.deleted=Callbacks.deleted;Callbacks.CallbacksBackend.eventsFlushed=Callbacks.eventsFlushed;B.exports=Callbacks},{"./abstract_query_tree":39,"./quad_index":50,"./rdf_model":55,"./utils":57}],43:[function(z,
B,C){var v=z("jsonld"),h=function(c,b,a){var h=null;v.normalize(c,{},function(c,r){if(c)a(c);else{var d=function(d){if("blank node"===d.type)return{blank:d.value};if("IRI"===d.type)return{token:"uri",value:d.value};if("literal"===d.type)return null!=d.language?{literal:'"'+d.value+'"@'+d.language}:null!==d.datatype?{literal:'"'+d.value+'"^^<'+d.datatype+">"}:{literal:'"'+d.value+'"'}};h=[];var l=function(a,c,k){h.push({subject:d(a),predicate:d(c),object:d(k),graph:b})},m;for(m in r)for(var u=r[m],
n=0;n<u.length;n++){var x=u[n];l(x.subject,x.predicate,x.object)}a(null,h)}})};C.JSONLDParser={};z=C.JSONLDParser;z.parser={async:!0,parse:function(c,b,a,f){try{"string"===typeof c&&(c=JSON.parse(c)),h(c,b,f)}catch(k){f(k)}}};B.exports={JSONLDParser:z}},{jsonld:3}],44:[function(z,B,C){var v=z("./utils"),h=z("./btree").Tree;Lexicon=function(c){var b=this;this.defaultGraphOid=0;this.defaultGraphUri="https://github.com/antoniogarrote/rdfstore-js#default_graph";this.defaultGraphUriTerm={token:"uri",prefix:null,
suffix:null,value:this.defaultGraphUri};this.oidCounter=1;v.seq(function(a){new h(2,function(c){b.uris=c;a()})},function(a){new h(2,function(c){b.literals=c;a()})},function(a){new h(2,function(c){b.knownGraphs=c;a()})},function(a){new h(2,function(c){b.oidUris=c;a()})},function(a){new h(2,function(c){b.oidLiterals=c;a()})},function(a){new h(2,function(c){b.oidBlanks=c;a()})})(function(){null!=c&&c(b)})};Lexicon.prototype.registerGraph=function(c,b,a){c!=this.defaultGraphOid?this.knownGraphs.insert(c,
b,function(){a()}):a()};Lexicon.prototype.registeredGraphs=function(c,b){var a=[];this.knownGraphs.walk(function(b){!0===c?a.push(b.data):a.push(b.key)},function(){b(a)})};Lexicon.prototype.registerUri=function(c,b){var a=this;c===this.defaultGraphUri?b(this.defaultGraphOid):this.uris.search(c,function(h){if(null==h){var k=a.oidCounter,r="u"+k;a.oidCounter++;v.seq(function(d){a.uris.insert(c,[k,0],function(){d()})},function(d){a.oidUris.insert(r,c,function(){d()})})(function(){b(k)})}else k=h[0],
h[1]+=1,b(k)})};Lexicon.prototype.resolveUri=function(c,b){c===this.defaultGraphUri?b(this.defaultGraphOid):this.uris.search(c,function(a){null!=a?b(a[0]):b(-1)})};Lexicon.prototype.resolveUriCost=function(c,b){c===this.defaultGraphUri?b(0):this.uris.search(c,function(a){null!=a?b(a[1]):b(-1)})};Lexicon.prototype.registerBlank=function(c){var b=this.oidCounter;this.oidCounter++;var a=""+b;this.oidBlanks.insert(a,a,function(){c(b)})};Lexicon.prototype.resolveBlank=function(c,b){var a=this;this.oidBlanks.search(c,
function(c){null!=c?b(c):(c=a.oidCounter,this.oidCounter++,b(""+c))})};Lexicon.prototype.resolveBlankCost=function(c,b){b(0)};Lexicon.prototype.registerLiteral=function(c,b){var a=this;this.literals.search(c,function(h){if(null==h){var k=a.oidCounter,r="l"+k;a.oidCounter++;v.seq(function(d){a.literals.insert(c,[k,0],function(){d()})},function(d){a.oidLiterals.insert(r,c,function(){d()})})(function(){b(k)})}else k=h[0],h[1]+=1,b(k)})};Lexicon.prototype.resolveLiteral=function(c,b){this.literals.search(c,
function(a){null!=a?b(a[0]):b(-1)})};Lexicon.prototype.resolveLiteralCost=function(c,b){this.literals.search(c,function(a){null!=a?b(a[1]):b(-1)})};Lexicon.prototype.parseLiteral=function(c){var b=c.lastIndexOf("@");if(-1!=b&&'"'===c[b-1]&&null!=c.substring(b,c.length).match(/^@[a-zA-Z\-]+$/g)){var a=c.substring(1,b-1);c=c.substring(b+1,c.length);return{token:"literal",value:a,lang:c}}b=c.lastIndexOf("^^");if(-1!=b&&'"'===c[b-1]&&"<"===c[b+2]&&">"===c[c.length-1])return a=c.substring(1,b-1),c=c.substring(b+
3,c.length-1),{token:"literal",value:a,type:c};a=c.substring(1,c.length-1);return{token:"literal",value:a}};Lexicon.prototype.parseUri=function(c){return{token:"uri",value:c}};Lexicon.prototype.retrieve=function(c,b){var a=this;c===this.defaultGraphOid?b({token:"uri",value:this.defaultGraphUri,prefix:null,suffix:null,defaultGraph:!0}):v.seq(function(b,h){a.oidUris.search("u"+c,function(b){null!=b?h(null,a.parseUri(b)):h(null,null)})},function(b,h){null==b?a.oidLiterals.search("l"+c,function(b){null!=
b?h(null,a.parseLiteral(b)):h(null,null)}):h(null,b)},function(b,h){null==b?a.oidBlanks.search(""+c,function(a){null!=a?h(null,{token:"blank",value:"_:"+c}):h(null,null)}):h(null,b)})(null,function(a,c){b(c)})};Lexicon.prototype.clear=function(c){var b=this;this.defaultGraphOid=0;this.defaultGraphUri="https://github.com/antoniogarrote/rdfstore-js#default_graph";this.defaultGraphUriTerm={token:"uri",prefix:null,suffix:null,value:this.defaultGraphUri};this.oidCounter=1;v.seq(function(a){new h(2,function(c){b.uris=
c;a()})},function(a){new h(2,function(c){b.literals=c;a()})},function(a){new h(2,function(c){b.knownGraphs=c;a()})},function(a){new h(2,function(c){b.oidUris=c;a()})},function(a){new h(2,function(c){b.oidLiterals=c;a()})},function(a){new h(2,function(c){b.oidBlanks=c;a()})})(function(){null!=c&&c()})};Lexicon.prototype.unregister=function(c,b,a){var h=this;v.seq(function(a){h._unregisterTerm(c.subject.token,b.subject,a)},function(a){h._unregisterTerm(c.predicate.token,b.predicate,a)},function(a){h._unregisterTerm(c.object.token,
b.object,a)},function(a){null!=c.graph?h._unregisterTerm(c.graph.token,b.graph,a):a()})(function(){a(!0)})};Lexicon.prototype._unregisterTerm=function(c,b,a){var h=this;if("uri"===c)if(b!=this.defaultGraphOid){var k="u"+b;h.oidUris.search(k,function(c){h.uris.search(c,function(d){var l=d[1];""+d[0]===""+b?0===l?v.seq(function(d){h.oidUris.delete(k,function(){d()})},function(d){h.uris.delete(c,function(){d()})},function(d){h.knownGraphs.delete(b,function(){d()})})(function(){a()}):h.uris.insert(c,
[b,l-1],function(){a()}):a()})})}else a();else"literal"===c?(this.oidCounter++,k="l"+b,h.oidLiterals.search(k,function(c){h.literals.search(c,function(d){var l=d[1];""+d[0]===""+b?0===l?v.seq(function(d){h.oidLiterals.delete(k,function(){d()})},function(d){h.literals.delete(c,function(){d()})})(function(){a()}):h.literals.insert(c,[b,l-1],function(){a()}):a()})})):"blank"===c?h.oidBlanks.delete(""+b,function(){a()}):a()};B.exports={Lexicon:Lexicon}},{"./btree":40,"./utils":57}],45:[function(z,B,C){if(!z("./utils").isWorker()){var v=
z("http"),h=z("https"),c=z("url");NetworkTransport={load:function(b,a,f,k){var r=null==k?3:k;b=c.parse(b,!0,!0);k={host:b.host,hostname:b.hostname,method:"GET",path:b.path,headers:{host:b.hostname,Accept:a}};var d=null;"http:"===b.protocol?(k.port=b.port||80,d=v):"https:"===b.protocol&&(k.port=b.port||443,d=h);b=d.request(k,function(d){var b=d.headers,c="";"2"==(""+d.statusCode)[0]?(d.on("end",function(){f(null,{headers:b,data:c})}),d.on("data",function(d){c+=d})):"3"==(""+d.statusCode)[0]?0==r?f(Error("Too many redirections")):
(d=b.Location||b.location,null!=d?NetworkTransport.load(d,a,f,r-1):f(Error("Redirection without location header"))):f(Error("HTTP error: "+d.statusCode))});b.on("error",f);b.end()}};B.exports={NetworkTransport:NetworkTransport}}},{"./utils":57,http:18,https:21,url:36}],46:[function(z,B,C){B.exports=function(){function v(h,c,b,a){this.message=h;this.expected=c;this.found=b;this.location=a;this.name="SyntaxError";"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,v)}(function(h,
c){function b(){this.constructor=h}b.prototype=c.prototype;h.prototype=new b})(v,Error);v.buildMessage=function(h,c){function b(a){return a.charCodeAt(0).toString(16).toUpperCase()}function a(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+b(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+b(d)})}function f(a){return a.replace(/\\/g,"\\\\").replace(/\]/g,
"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+b(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+b(d)})}var k={literal:function(b){return'"'+a(b.text)+'"'},"class":function(a){var d="",b;for(b=0;b<a.parts.length;b++)d+=a.parts[b]instanceof Array?f(a.parts[b][0])+"-"+f(a.parts[b][1]):f(a.parts[b]);return"["+(a.inverted?"^":"")+d+"]"},any:function(a){return"any character"},
end:function(a){return"end of input"},other:function(a){return a.description}};return"Expected "+function(a){var d=Array(a.length),b;for(b=0;b<a.length;b++){var c=b,h;h=a[b];h=k[h.type](h);d[c]=h}d.sort();if(0<d.length){for(a=b=1;b<d.length;b++)d[b-1]!==d[b]&&(d[a]=d[b],a++);d.length=a}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}(h)+" but "+(c?'"'+a(c)+'"':"end of input")+" found."};return{SyntaxError:v,parse:function(h,
c){function b(d,e){return{type:"literal",text:d,ignoreCase:e}}function a(d,e,a){return{type:"class",parts:d,inverted:e,ignoreCase:a}}function f(d){return{type:"other",description:d}}function k(d){var e=Nb[d],a;if(!e){for(a=d-1;!Nb[a];)a--;e=Nb[a];for(e={line:e.line,column:e.column};a<d;)10===h.charCodeAt(a)?(e.line++,e.column=1):e.column++,a++;Nb[d]=e}return e}function r(d,e){var a=k(d),b=k(e);return{start:{offset:d,line:a.line,column:a.column},end:{offset:e,line:b.line,column:b.column}}}function d(d){g<
Ea||(g>Ea&&(Ea=g,Kc=[]),Kc.push(d))}function l(){var a;q++;var b,c;q++;a=g;b=m();if(b!==e){var w,f,k,l,r,u;q++;w=g;f=n();if(f!==e){k=[];for(c=t();c!==e;)k.push(c),c=t();if(k!==e){c=[];for(l=x();l!==e;)c.push(l),l=x();if(c!==e){l=[];for(k=t();k!==e;)l.push(k),k=t();if(l!==e)if(k=y(),k!==e){r=[];for(l=t();l!==e;)r.push(l),l=t();if(r!==e)if(l=M(),l!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();if(r!==e){var v,A,E,H,D,z,F;q++;r=g;h.substr(g,8)===qd?(u=qd,g+=8):(u=e,0===q&&d(Pg));if(u!==e){v=[];for(A=ka();A!==
e;)v.push(A),A=ka();if(v!==e)if(123===h.charCodeAt(g)?(A=Ba,g++):(A=e,0===q&&d(Ca)),A!==e){E=[];H=g;40===h.charCodeAt(g)?(D=R,g++):(D=e,0===q&&d(S));if(D!==e){z=[];F=N();if(F!==e)for(;F!==e;)z.push(F),F=N();else z=e;z!==e?(41===h.charCodeAt(g)?(F=T,g++):(F=e,0===q&&d(U)),F!==e?H=D=[D,z,F]:(g=H,H=e)):(g=H,H=e)}else g=H,H=e;for(H===e&&(H=Ia());H!==e;){E.push(H);H=g;40===h.charCodeAt(g)?(D=R,g++):(D=e,0===q&&d(S));if(D!==e){z=[];F=N();if(F!==e)for(;F!==e;)z.push(F),F=N();else z=e;z!==e?(41===h.charCodeAt(g)?
(F=T,g++):(F=e,0===q&&d(U)),F!==e?H=D=[D,z,F]:(g=H,H=e)):(g=H,H=e)}else g=H,H=e;H===e&&(H=Ia())}E!==e?(125===h.charCodeAt(g)?(H=va,g++):(H=e,0===q&&d(wa)),H!==e?r=u=[u,v,A,E,H]:(g=r,r=e)):(g=r,r=e)}else g=r,r=e;else g=r,r=e}else g=r,r=e;r===e&&(r=null);q--;r===e&&0===q&&d(Qg);if(r!==e){w=f;f={named:[],implicit:[]};for(r=0;r<c.length;r++)u=c[r],"default"===u.kind?f.implicit.push(u.graph):f.named.push(u.graph);0===f.named.length&&0===f.implicit.length&&f.implicit.push({token:"uri",prefix:null,suffix:null,
value:"https://github.com/antoniogarrote/rdfstore-js#default_graph"});c={kind:"select",token:"executableunit"};c.dataset=f;c.projection=w.vars;c.modifier=w.modifier;c.pattern=k;null!=l&&null!=l.limit&&(c.limit=l.limit);null!=l&&null!=l.offset&&(c.offset=l.offset);null!=l&&null!=l.order&&""!=l.order&&(c.order=l.order);null!=l&&null!=l.group&&(c.group=l.group);w=c}else g=w,w=e}else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e}else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d(Rg);
c=w;if(c===e){q++;c=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,9)===Ob?(l=Ob,g+=9):(l=e,0===q&&d(rd)),l===e&&(h.substr(g,9)===Pb?(l=Pb,g+=9):(l=e,0===q&&d(sd))),l!==e){k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e){q++;k=g;123===h.charCodeAt(g)?(l=Ba,g++):(l=e,0===q&&d(Ca));if(l!==e){w=[];for(l=t();l!==e;)w.push(l),l=t();if(w!==e)if(l=db(),l===e&&(l=null),l!==e){w=[];for(f=t();f!==e;)w.push(f),f=t();w!==e?(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e?k=l:(g=k,k=e)):
(g=k,k=e)}else g=k,k=e;else g=k,k=e}else g=k,k=e;q--;k===e&&0===q&&d(Sg);l=k;if(l!==e){k=[];for(w=t();w!==e;)k.push(w),w=t();if(k!==e){w=[];for(k=x();k!==e;)w.push(k),k=x();if(w!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e)if(f=y(),f!==e){r=[];for(k=t();k!==e;)r.push(k),k=t();if(r!==e)if(k=M(),k!==e){c=l;l=w;w=f;f={named:[],implicit:[]};for(r=0;r<l.length;r++)u=l[r],"default"===u.kind?f.implicit.push(u.graph):f.named.push(u.graph);0===f.named.length&&0===f.implicit.length&&f.implicit.push({token:"uri",
prefix:null,suffix:null,value:"https://github.com/antoniogarrote/rdfstore-js#default_graph"});l={kind:"construct",token:"executableunit"};l.dataset=f;l.template=c;l.pattern=w;null!=k&&null!=k.limit&&(l.limit=k.limit);null!=k&&null!=k.offset&&(l.offset=k.offset);null!=k&&null!=k.order&&""!=k.order&&(l.order=k.order);c=l}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e;else g=c,c=e;if(c===e){c=g;k=[];for(l=t();l!==e;)k.push(l),l=t();
if(k!==e)if(h.substr(g,9)===Ob?(l=Ob,g+=9):(l=e,0===q&&d(rd)),l===e&&(h.substr(g,9)===Pb?(l=Pb,g+=9):(l=e,0===q&&d(sd))),l!==e){k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e){l=[];for(k=x();k!==e;)l.push(k),k=x();if(l!==e){k=[];for(w=t();w!==e;)k.push(w),w=t();if(k!==e)if(h.substr(g,5)===Sa?(w=Sa,g+=5):(w=e,0===q&&d(Qb)),w===e&&(h.substr(g,5)===Ta?(w=Ta,g+=5):(w=e,0===q&&d(Rb))),w!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e)if(123===h.charCodeAt(g)?(f=Ba,g++):(f=e,0===q&&d(Ca)),f!==e){r=
[];for(k=t();k!==e;)r.push(k),k=t();if(r!==e)if(k=sa(),k===e&&(k=null),k!==e){w=[];for(f=t();f!==e;)w.push(f),f=t();if(w!==e)if(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e){f=[];for(w=t();w!==e;)f.push(w),w=t();if(f!==e)if(w=M(),w!==e){c=l;l=w;w={named:[],implicit:[]};for(f=0;f<c.length;f++)r=c[f],"default"===r.kind?w.implicit.push(r.graph):w.named.push(r.graph);0===w.named.length&&0===w.implicit.length&&w.implicit.push({token:"uri",prefix:null,suffix:null,value:"https://github.com/antoniogarrote/rdfstore-js#default_graph"});
c={kind:"construct",token:"executableunit"};c.dataset=w;c.template=k;c.pattern={token:"basicgraphpattern",triplesContext:k.triplesContext};null!=l&&null!=l.limit&&(c.limit=l.limit);null!=l&&null!=l.offset&&(c.offset=l.offset);null!=l&&null!=l.order&&""!=l.order&&(c.order=l.order)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e;else g=c,c=e}q--;c===e&&0===q&&d(Tg);if(c===e){q++;
c=g;h.substr(g,8)===td?(k=td,g+=8):(k=e,0===q&&d(Ug));if(k!==e){l=[];w=fb();if(w!==e)for(;w!==e;)l.push(w),w=fb();else l=e;l===e&&(42===h.charCodeAt(g)?(l=Ja,g++):(l=e,0===q&&d(Ka)));if(l!==e){w=[];for(f=x();f!==e;)w.push(f),f=x();w!==e?(f=y(),f===e&&(f=null),f!==e?(r=M(),r!==e?c=k=[k,l,w,f,r]:(g=c,c=e)):(g=c,c=e)):(g=c,c=e)}else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(Vg);if(c===e){q++;c=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,3)===ud?(l=ud,g+=3):(l=e,0===q&&d(Wg)),l===e&&
(h.substr(g,3)===vd?(l=vd,g+=3):(l=e,0===q&&d(Xg))),l!==e){l=[];for(k=t();k!==e;)l.push(k),k=t();if(l!==e){k=[];for(w=x();w!==e;)k.push(w),w=x();if(k!==e){w=[];for(l=t();l!==e;)w.push(l),l=t();if(w!==e)if(l=y(),l!==e){c=k;k=l;l={named:[],implicit:[]};for(w=0;w<c.length;w++)f=c[w],"implicit"===f.kind?l.implicit.push(f.graph):l.named.push(f.graph);0===l.named.length&&0===l.implicit.length&&l.implicit.push({token:"uri",prefix:null,suffix:null,value:"https://github.com/antoniogarrote/rdfstore-js#default_graph"});
c={kind:"ask",token:"executableunit"};c.dataset=l;c.pattern=k}else g=c,c=e;else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e;else g=c,c=e;q--;c===e&&0===q&&d(Yg)}}}c!==e?(q++,k=g,h.substr(g,6)===Sb?(l=Sb,g+=6):(l=e,0===q&&d(wd)),l===e&&(h.substr(g,6)===Tb?(l=Tb,g+=6):(l=e,0===q&&d(xd))),l!==e?(w=za(),w!==e?k=l=[l,w]:(g=k,k=e)):(g=k,k=e),k===e&&(k=null),k!==e&&(k=null!=k?k[1]:null),q--,k===e&&0===q&&d(Zg),k!==e?a=b={token:"query",kind:"query",prologue:b,units:[c],inlineData:k}:(g=a,a=e)):(g=a,a=
e)}else g=a,a=e;q--;a===e&&0===q&&d($g);q--;a===e&&0===q&&d(ah);a===e&&(q++,a=C(),q--,a===e&&0===q&&d(bh));return a}function m(){var a,b,c,w;q++;a=g;q++;b=g;w=[];for(c=t();c!==e;)w.push(c),c=t();if(w!==e)if(h.substr(g,4)===yd?(c=yd,g+=4):(c=e,0===q&&d(ch)),c===e&&(h.substr(g,4)===zd?(c=zd,g+=4):(c=e,0===q&&d(dh))),c!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?(w=Mb(),w!==e?(b={token:"base"},b.value=w):(g=b,b=e)):(g=b,b=e)}else g=b,b=e;else g=b,b=e;q--;b===e&&0===q&&d(eh);b===e&&(b=null);if(b!==
e){c=[];for(w=t();w!==e;)c.push(w),w=t();if(c!==e){w=[];for(c=u();c!==e;)w.push(c),c=u();w!==e?a=b={token:"prologue",base:b,prefixes:w}:(g=a,a=e)}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(fh);return a}function u(){var a,b,c,w;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,6)===Ad?(c=Ad,g+=6):(c=e,0===q&&d(gh)),c===e&&(h.substr(g,6)===Bd?(c=Bd,g+=6):(c=e,0===q&&d(hh))),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=Gc(),b!==e){w=[];for(c=t();c!==e;)w.push(c),c=
t();w!==e?(c=Mb(),c!==e?(a={token:"prefix"},a.prefix=b,a.local=c):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(ih);return a}function n(){var a,b,c,w,f,k,l,n,m,r,x,u,y,v,A,E;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,6)===Cd?(c=Cd,g+=6):(c=e,0===q&&d(jh)),c===e&&(h.substr(g,6)===Dd?(c=Dd,g+=6):(c=e,0===q&&d(kh))),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(h.substr(g,8)===na?(b=na,g+=8):(b=e,0===q&&d(Ua)),b===e&&
(h.substr(g,8)===oa?(b=oa,g+=8):(b=e,0===q&&d(Va))),b===e&&(h.substr(g,7)===Ed?(b=Ed,g+=7):(b=e,0===q&&d(lh)),b===e&&(h.substr(g,7)===Fd?(b=Fd,g+=7):(b=e,0===q&&d(mh)))),b===e&&(b=null),b!==e){w=[];for(c=t();c!==e;)w.push(c),c=t();if(w!==e){c=[];w=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(k=ka(),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?w=f=[f,k,l]:(g=w,w=e)}else g=w,w=e;else g=w,w=e;if(w===e){w=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(40===h.charCodeAt(g)?(k=R,g++):
(k=e,0===q&&d(S)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(n=Q(),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(h.substr(g,2)===Wa?(r=Wa,g+=2):(r=e,0===q&&d(Ub)),r===e&&(h.substr(g,2)===Xa?(r=Xa,g+=2):(r=e,0===q&&d(Vb))),r!==e){x=[];for(u=t();u!==e;)x.push(u),u=t();if(x!==e)if(u=ka(),u!==e){y=[];for(v=t();v!==e;)y.push(v),v=t();if(y!==e)if(41===h.charCodeAt(g)?(v=T,g++):(v=e,0===q&&d(U)),v!==e){A=[];for(E=t();E!==e;)A.push(E),E=t();A!==e?w=f=[f,k,l,n,m,r,x,u,y,v,A]:(g=w,
w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}if(w!==e)for(;w!==e;){c.push(w);w=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(k=ka(),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?w=f=[f,k,l]:(g=w,w=e)}else g=w,w=e;else g=w,w=e;if(w===e){w=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(n=Q(),
n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(h.substr(g,2)===Wa?(r=Wa,g+=2):(r=e,0===q&&d(Ub)),r===e&&(h.substr(g,2)===Xa?(r=Xa,g+=2):(r=e,0===q&&d(Vb))),r!==e){x=[];for(u=t();u!==e;)x.push(u),u=t();if(x!==e)if(u=ka(),u!==e){y=[];for(v=t();v!==e;)y.push(v),v=t();if(y!==e)if(41===h.charCodeAt(g)?(v=T,g++):(v=e,0===q&&d(U)),v!==e){A=[];for(E=t();E!==e;)A.push(E),E=t();A!==e?w=f=[f,k,l,n,m,r,x,u,y,v,A]:(g=w,w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=
e}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}}else c=e;if(c===e){c=g;w=[];for(f=t();f!==e;)w.push(f),f=t();if(w!==e)if(42===h.charCodeAt(g)?(f=Ja,g++):(f=e,0===q&&d(Ka)),f!==e){k=[];for(l=t();l!==e;)k.push(l),l=t();k!==e?c=w=[w,f,k]:(g=c,c=e)}else g=c,c=e;else g=c,c=e}if(c!==e){a=b;b=c;c=[];if(3===b.length&&"*"===b[1])b={vars:[{token:"variable",kind:"*"}],modifier:Gd(a)};else{for(w=0;w<b.length;w++)f=b[w],3===f.length?c.push({token:"variable",kind:"var",value:f[1]}):c.push({token:"variable",
kind:"aliased",expression:f[3],alias:f[7]});b={vars:c,modifier:Gd(a)}}a=b}else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(nh);return a}function x(){var a,b,c,w;q++;a=g;h.substr(g,4)===Hd?(b=Hd,g+=4):(b=e,0===q&&d(oh));b===e&&(h.substr(g,4)===Id?(b=Id,g+=4):(b=e,0===q&&d(ph)));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){q++;b=g;c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?(w=E(),w!==e?b=c={graph:w,kind:"default",token:"graphClause"}:(g=
b,b=e)):(g=b,b=e);q--;b===e&&0===q&&d(qh);if(b===e){q++;b=g;h.substr(g,5)===nb?(c=nb,g+=5):(c=e,0===q&&d(Lc));c===e&&(h.substr(g,5)===ob?(c=ob,g+=5):(c=e,0===q&&d(Mc)));if(c!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?(w=E(),w!==e?b=c={graph:w,kind:"named",token:"graphCluase"}:(g=b,b=e)):(g=b,b=e)}else g=b,b=e;q--;b===e&&0===q&&d(rh)}if(b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?a=b:(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(sh);return a}function E(){var a;q++;
a=la();q--;a===e&&0===q&&d(th);return a}function y(){var a,b,c,w;q++;a=g;h.substr(g,5)===Sa?(b=Sa,g+=5):(b=e,0===q&&d(Qb));b===e&&(h.substr(g,5)===Ta?(b=Ta,g+=5):(b=e,0===q&&d(Rb)));b===e&&(b=null);if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=X(),b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?a=b:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(uh);return a}function M(){var a,b,c,w;q++;a=g;q++;b=g;h.substr(g,5)===Jd?(c=Jd,g+=5):(c=e,0===q&&d(vh));c===e&&(h.substr(g,
5)===Kd?(c=Kd,g+=5):(c=e,0===q&&d(wh)));if(c!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();if(c!==e)if(h.substr(g,2)===Wb?(w=Wb,g+=2):(w=e,0===q&&d(Ld)),w===e&&(h.substr(g,2)===Xb?(w=Xb,g+=2):(w=e,0===q&&d(Md))),w!==e){w=[];for(c=t();c!==e;)w.push(c),c=t();if(w!==e){c=[];w=z();if(w!==e)for(;w!==e;)c.push(w),w=z();else c=e;c!==e?b=c:(g=b,b=e)}else g=b,b=e}else g=b,b=e;else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(xh);b===e&&(b=null);if(b!==e){var f,k;q++;c=g;h.substr(g,6)===Nd?(w=Nd,g+=6):(w=e,0===q&&
d(yh));if(w!==e){f=[];k=H();if(k!==e)for(;k!==e;)f.push(k),k=H();else f=e;f!==e?c=w=[w,f]:(g=c,c=e)}else g=c,c=e;q--;c===e&&0===q&&d(zh);c===e&&(c=null);if(c!==e){q++;c=g;h.substr(g,5)===Od?(w=Od,g+=5):(w=e,0===q&&d(Ah));w===e&&(h.substr(g,5)===Pd?(w=Pd,g+=5):(w=e,0===q&&d(Bh)));if(w!==e){w=[];for(f=t();f!==e;)w.push(f),f=t();if(w!==e)if(h.substr(g,2)===Wb?(f=Wb,g+=2):(f=e,0===q&&d(Ld)),f===e&&(h.substr(g,2)===Xb?(f=Xb,g+=2):(f=e,0===q&&d(Md))),f!==e){f=[];for(w=t();w!==e;)f.push(w),w=t();if(f!==
e){w=[];f=A();if(f!==e)for(;f!==e;)w.push(f),f=A();else w=e;if(w!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();f!==e?c=w:(g=c,c=e)}else g=c,c=e}else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(Ch);c===e&&(c=null);if(c!==e){q++;w=g;f=D();f!==e?(k=P(),k===e&&(k=null),k!==e?w=f=[f,k]:(g=w,w=e)):(g=w,w=e);w===e&&(w=g,f=P(),f!==e?(k=D(),k===e&&(k=null),k!==e?w=f=[f,k]:(g=w,w=e)):(g=w,w=e));if(w!==e){f={};for(k=0;k<w.length;k++){var l=w[k];null!=l&&null!=l.limit?f.limit=l.limit:null!=
l&&null!=l.offset&&(f.offset=l.offset)}w=f}q--;w===e&&0===q&&d(Dh);w===e&&(w=null);w!==e?(a=b,b=w,w={},null!=b&&(null!=b.limit&&(w.limit=b.limit),null!=b.offset&&(w.offset=b.offset)),null!=a&&(w.group=a),w.order=c,a=w):(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Eh);return a}function z(){var a,b,c,w,f,k;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=Fc(),c!==e){w=[];for(b=t();b!==e;)w.push(b),b=t();w!==e?a=c:(g=a,a=e)}else g=a,a=e;else g=a,a=e;if(a===e){a=g;b=
[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=ea(),c!==e){w=[];for(b=t();b!==e;)w.push(b),b=t();w!==e?a=c:(g=a,a=e)}else g=a,a=e;else g=a,a=e;if(a===e){a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(40===h.charCodeAt(g)?(c=R,g++):(c=e,0===q&&d(S)),c!==e){w=[];for(b=t();b!==e;)w.push(b),b=t();if(w!==e)if(b=Q(),b!==e){w=[];for(c=t();c!==e;)w.push(c),c=t();if(w!==e){c=g;h.substr(g,2)===Wa?(f=Wa,g+=2):(f=e,0===q&&d(Ub));f===e&&(h.substr(g,2)===Xa?(f=Xa,g+=2):(f=e,0===q&&d(Vb)));if(f!==e){k=
[];for(w=t();w!==e;)k.push(w),w=t();k!==e?(w=ka(),w!==e?c=f=[f,k,w]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;c===e&&(c=null);if(c!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){w=[];for(f=t();f!==e;)w.push(f),f=t();w!==e?(b=0!=c.length?{token:"aliased_expression",expression:b,alias:c[2]}:b,a=b):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;if(a===e){a=g;b=[];for(c=t();c!==e;)b.push(c),
c=t();if(b!==e)if(c=ka(),c!==e){w=[];for(b=t();b!==e;)w.push(b),b=t();w!==e?a=c:(g=a,a=e)}else g=a,a=e;else g=a,a=e}}}q--;a===e&&0===q&&d(Fh);return a}function H(){var a;q++;a=da();q--;a===e&&0===q&&d(Gh);return a}function A(){var a,b,c,w,f;q++;a=g;h.substr(g,3)===Qd?(b=Qd,g+=3):(b=e,0===q&&d(Hh));b===e&&(h.substr(g,3)===Rd?(b=Rd,g+=3):(b=e,0===q&&d(Ih)),b===e&&(h.substr(g,4)===Sd?(b=Sd,g+=4):(b=e,0===q&&d(Jh)),b===e&&(h.substr(g,4)===Td?(b=Td,g+=4):(b=e,0===q&&d(Kh)))));if(b!==e){c=[];for(w=t();w!==
e;)c.push(w),w=t();if(c!==e)if(w=Ec(),w!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(a=w,a=b={direction:b.toUpperCase(),expression:a}):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e)if(a=g,b=da(),b===e&&(b=ka()),b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?("var"===b.token&&(b={token:"expression",expressionType:"atomic",primaryexpression:"var",value:b}),a=b={direction:"ASC",expression:b}):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Lh);return a}function D(){var a,b,c,w;q++;a=
g;h.substr(g,5)===Ud?(b=Ud,g+=5):(b=e,0===q&&d(Mh));b===e&&(h.substr(g,5)===Vd?(b=Vd,g+=5):(b=e,0===q&&d(Nh)));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=jb(),b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?a=b={limit:parseInt(b.value)}:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Oh);return a}function P(){var a,b,c,w;q++;a=g;h.substr(g,6)===Wd?(b=Wd,g+=6):(b=e,0===q&&d(Ph));b===e&&(h.substr(g,6)===Xd?(b=Xd,g+=6):(b=e,0===q&&d(Qh)));if(b!==e){c=[];for(b=
t();b!==e;)c.push(b),b=t();if(c!==e)if(b=jb(),b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();c!==e?a=b={offset:parseInt(b.value)}:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Rh);return a}function N(){var a;q++;a=la();a===e&&(a=Jb(),a===e&&(a=Kb(),a===e&&(a=Lb(),a===e&&(h.substr(g,5)===Yb?(a=Yb,g+=5):(a=e,0===q&&d(Yd))))));q--;a===e&&0===q&&d(Sh);return a}function C(){var a,b,c,w,f,k,l,n;q++;a=g;b=m();if(b!==e){c=[];for(w=t();w!==e;)c.push(w),w=t();if(c!==e){q++;q++;c=g;h.substr(g,
4)===Zd?(w=Zd,g+=4):(w=e,0===q&&d(Th));w===e&&(h.substr(g,4)===$d?(w=$d,g+=4):(w=e,0===q&&d(Uh)));if(w!==e){f=[];for(w=t();w!==e;)f.push(w),w=t();if(f!==e)if(w=la(),w!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e){f=g;h.substr(g,4)===ae?(k=ae,g+=4):(k=e,0===q&&d(Vh));k===e&&(h.substr(g,4)===be?(k=be,g+=4):(k=e,0===q&&d(Wh)));if(k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=ta(),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;f===e&&(f=null);f!==e?(c=f,f={kind:"load",token:"executableunit"},
f.sourceGraph=w,null!=c&&(f.destinyGraph=c[2]),c=f):(g=c,c=e)}else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(Xh);w=c;if(w===e){q++;w=g;h.substr(g,5)===ce?(c=ce,g+=5):(c=e,0===q&&d(Yh));c===e&&(h.substr(g,5)===de?(c=de,g+=5):(c=e,0===q&&d(Zh)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,6)===pb?(f=pb,g+=6):(f=e,0===q&&d(Nc)),f===e&&(h.substr(g,6)===qb?(f=qb,g+=6):(f=e,0===q&&d(Oc))),f===e&&(f=null),f!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();f!==
e?(c=ya(),c!==e?(w={kind:"clear",token:"executableunit"},w.destinyGraph=c):(g=w,w=e)):(g=w,w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d($h);if(w===e){q++;w=g;h.substr(g,4)===ee?(c=ee,g+=4):(c=e,0===q&&d(ai));c===e&&(h.substr(g,4)===fe?(c=fe,g+=4):(c=e,0===q&&d(bi)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,6)===pb?(f=pb,g+=6):(f=e,0===q&&d(Nc)),f===e&&(h.substr(g,6)===qb?(f=qb,g+=6):(f=e,0===q&&d(Oc))),f===e&&(f=null),f!==e){f=[];for(c=t();c!==e;)f.push(c),
c=t();f!==e?(c=ya(),c!==e?(w={kind:"drop",token:"executableunit"},w.destinyGraph=c):(g=w,w=e)):(g=w,w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d(ci);if(w===e){q++;w=g;h.substr(g,6)===ge?(c=ge,g+=6):(c=e,0===q&&d(di));c===e&&(h.substr(g,6)===he?(c=he,g+=6):(c=e,0===q&&d(ei)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,6)===pb?(f=pb,g+=6):(f=e,0===q&&d(Nc)),f===e&&(h.substr(g,6)===qb?(f=qb,g+=6):(f=e,0===q&&d(Oc))),f===e&&(f=null),f!==e){f=[];for(c=t();c!==
e;)f.push(c),c=t();f!==e?(c=ta(),c!==e?(w={kind:"create",token:"executableunit"},w.destinyGraph=c):(g=w,w=e)):(g=w,w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d(fi);if(w===e){q++;w=g;h.substr(g,6)===Zb?(c=Zb,g+=6):(c=e,0===q&&d(ie));c===e&&(h.substr(g,6)===$b?(c=$b,g+=6):(c=e,0===q&&d(je)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,4)===ac?(f=ac,g+=4):(f=e,0===q&&d(ke)),f===e&&(h.substr(g,4)===bc?(f=bc,g+=4):(f=e,0===q&&d(le))),f!==e){f=[];for(c=t();c!==
e;)f.push(c),c=t();f!==e?(c=I(),c!==e?(w={kind:"insertdata",token:"executableunit"},w.quads=c):(g=w,w=e)):(g=w,w=e)}else g=w,w=e;else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d(gi);if(w===e){q++;w=g;h.substr(g,6)===rb?(c=rb,g+=6):(c=e,0===q&&d(Pc));c===e&&(h.substr(g,6)===sb?(c=sb,g+=6):(c=e,0===q&&d(Qc)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(h.substr(g,4)===ac?(f=ac,g+=4):(f=e,0===q&&d(ke)),f===e&&(h.substr(g,4)===bc?(f=bc,g+=4):(f=e,0===q&&d(le))),f!==e?(c=I(),c!==e?(w={kind:"deletedata",
token:"executableunit"},w.quads=c):(g=w,w=e)):(g=w,w=e)):(g=w,w=e)}else g=w,w=e;q--;w===e&&0===q&&d(hi);if(w===e){q++;w=g;h.substr(g,6)===rb?(c=rb,g+=6):(c=e,0===q&&d(Pc));c===e&&(h.substr(g,6)===sb?(c=sb,g+=6):(c=e,0===q&&d(Qc)));if(c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,5)===Sa?(f=Sa,g+=5):(f=e,0===q&&d(Qb)),f===e&&(h.substr(g,5)===Ta?(f=Ta,g+=5):(f=e,0===q&&d(Rb))),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(f=X(),f!==e){w={kind:"modify"};w.pattern=f;w.with=
null;w.using=null;c=[];f=f.patterns[0];f=null==f.triplesContext&&null!=f.patterns?f.patterns[0].triplesContext:f.triplesContext;for(k=0;k<f.length;k++)l={},n=f[k],l.subject=n.subject,l.predicate=n.predicate,l.object=n.object,l.graph=n.graph,c.push(l);w.delete=c}else g=w,w=e;else g=w,w=e}else g=w,w=e;else g=w,w=e}else g=w,w=e;q--;w===e&&0===q&&d(ii);if(w===e){var r;q++;f=c=g;h.substr(g,4)===me?(k=me,g+=4):(k=e,0===q&&d(ji));k===e&&(h.substr(g,4)===ne?(k=ne,g+=4):(k=e,0===q&&d(ki)));if(k!==e){w=[];
for(l=t();l!==e;)w.push(l),l=t();w!==e?(l=la(),l!==e?f=k=[k,w,l]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;f===e&&(f=null);if(f!==e){k=[];for(w=t();w!==e;)k.push(w),w=t();if(k!==e){w=g;q++;k=g;h.substr(g,6)===rb?(l=rb,g+=6):(l=e,0===q&&d(Pc));l===e&&(h.substr(g,6)===sb?(l=sb,g+=6):(l=e,0===q&&d(Qc)));l!==e?(l=L(),l!==e?k=l:(g=k,k=e)):(g=k,k=e);q--;k===e&&0===q&&d(li);l=k;if(l!==e){k=[];for(n=t();n!==e;)k.push(n),n=t();k!==e?(n=B(),n===e&&(n=null),n!==e?w=l=[l,k,n]:(g=w,w=e)):(g=w,w=e)}else g=w,w=e;w===e&&
(w=B());if(w!==e){l=[];for(k=t();k!==e;)l.push(k),k=t();if(l!==e){k=[];for(n=J();n!==e;)k.push(n),n=J();if(k!==e){n=[];for(l=t();l!==e;)n.push(l),l=t();if(n!==e)if(h.substr(g,5)===Sa?(l=Sa,g+=5):(l=e,0===q&&d(Qb)),l===e&&(h.substr(g,5)===Ta?(l=Ta,g+=5):(l=e,0===q&&d(Rb))),l!==e){n=[];for(l=t();l!==e;)n.push(l),l=t();if(n!==e)if(l=X(),l!==e){n=[];for(r=t();r!==e;)n.push(r),r=t();n!==e?(c=f,f=k,k={kind:"modify"},k.with=""!=c&&null!=c?c[2]:null,3!==w.length||""!==w[2]&&null!=w[2]?3===w.length&&null!=
w[0].length&&null!=w[1].length&&null!=w[2].length?(k.delete=w[0],k.insert=w[2]):(k.insert=w,k.delete=null):(k.delete=w[0],k.insert=null),""!=f&&(k.using=f),k.pattern=l,c=k):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(mi);w=c}}}}}}}q--;w===e&&0===q&&d(ni);if(w!==e){c=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(59===h.charCodeAt(g)?(k=La,g++):(k=e,0===q&&d(Ma)),k!==e){l=[];for(n=t();n!==e;)l.push(n),
n=t();l!==e?(n=C(),n===e&&(n=null),n!==e?c=f=[f,k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;else g=c,c=e;c===e&&(c=null);c!==e?(a=c,c={token:"query",kind:"update"},c.prologue=b,b=[w],null!=a&&null!=a.length&&null!=a[3]&&null!=a[3].units&&(b=b.concat(a[3].units)),c.units=b,a=c):(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(oi);return a}function B(){var a,b;q++;a=g;h.substr(g,6)===Zb?(b=Zb,g+=6):(b=e,0===q&&d(ie));b===e&&(h.substr(g,6)===$b?(b=$b,g+=6):(b=e,0===q&&d(je)));b!==e?
(b=L(),b!==e?a=b:(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(pi);return a}function J(){var a,b,c,f,k;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,5)===oe?(c=oe,g+=5):(c=e,0===q&&d(qi)),c===e&&(h.substr(g,5)===pe?(c=pe,g+=5):(c=e,0===q&&d(ri))),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){b=la();if(b===e)if(b=g,h.substr(g,5)===nb?(c=nb,g+=5):(c=e,0===q&&d(Lc)),c===e&&(h.substr(g,5)===ob?(c=ob,g+=5):(c=e,0===q&&d(Mc))),c!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();f!==
e?(k=la(),k!==e?b=c=[c,f,k]:(g=b,b=e)):(g=b,b=e)}else g=b,b=e;b!==e?(b=null!=b.length?{kind:"named",uri:b[2]}:{kind:"default",uri:b},a=b):(g=a,a=e)}else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(si);return a}function ta(){var a,b,c;q++;a=g;h.substr(g,5)===tb?(b=tb,g+=5):(b=e,0===q&&d(Rc));b===e&&(h.substr(g,5)===ub?(b=ub,g+=5):(b=e,0===q&&d(Sc)));if(b!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(c=la(),c!==e?a=c:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(ti);return a}function ya(){var a;
q++;a=ta();a===e&&(h.substr(g,7)===qe?(a=qe,g+=7):(a=e,0===q&&d(ui)),a===e&&(h.substr(g,7)===re?(a=re,g+=7):(a=e,0===q&&d(vi))),a!==e&&(a="default"),a===e&&(h.substr(g,5)===nb?(a=nb,g+=5):(a=e,0===q&&d(Lc)),a===e&&(h.substr(g,5)===ob?(a=ob,g+=5):(a=e,0===q&&d(Mc))),a!==e&&(a="named"),a===e&&(h.substr(g,3)===se?(a=se,g+=3):(a=e,0===q&&d(wi)),a===e&&(h.substr(g,3)===te?(a=te,g+=3):(a=e,0===q&&d(xi))),a!==e&&(a="all"))));q--;a===e&&0===q&&d(yi);return a}function L(){var a,b,c,f;q++;a=g;b=[];for(c=t();c!==
e;)b.push(c),c=t();if(b!==e)if(123===h.charCodeAt(g)?(c=Ba,g++):(c=e,0===q&&d(Ca)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=G(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?a=b=b.quadsContext:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(zi);return a}function I(){var a,b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),
c=t();if(b!==e)if(123===h.charCodeAt(g)?(c=Ba,g++):(c=e,0===q&&d(Ca)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=G(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?a=b=b.quadsContext:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Ai);return a}function G(){var a,b,c,f,k,l,n;q++;a=g;b=sa();b===e&&(b=null);if(b!==
e){c=[];f=g;k=V();k!==e?(46===h.charCodeAt(g)?(l=pa,g++):(l=e,0===q&&d(qa)),l===e&&(l=null),l!==e?(n=sa(),n===e&&(n=null),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)):(g=f,f=e);for(;f!==e;)c.push(f),f=g,k=V(),k!==e?(46===h.charCodeAt(g)?(l=pa,g++):(l=e,0===q&&d(qa)),l===e&&(l=null),l!==e?(n=sa(),n===e&&(n=null),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)):(g=f,f=e);if(c!==e){a=b;b=[];if(null!=a&&null!=a.triplesContext)for(f=0;f<a.triplesContext.length;f++)k=a.triplesContext[f],k.graph=null,b.push(k);if(c&&
0<c.length&&0<c[0].length&&(b=b.concat(c[0][0].quadsContext),null!=c[0][2]&&null!=c[0][2].triplesContext))for(f=0;f<c[0][2].triplesContext.length;f++)k=c[0][2].triplesContext[f],k.graph=null,b.push(k);a=b={token:"quads",quadsContext:b}}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Bi);return a}function V(){var a,b,c,f,k;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,5)===tb?(c=tb,g+=5):(c=e,0===q&&d(Rc)),c===e&&(h.substr(g,5)===ub?(c=ub,g+=5):(c=e,0===q&&d(Sc))),c!==e){c=[];
for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=fb(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(123===h.charCodeAt(g)?(f=Ba,g++):(f=e,0===q&&d(Ca)),f!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e)if(c=sa(),c===e&&(c=null),c!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(125===h.charCodeAt(g)?(k=va,g++):(k=e,0===q&&d(wa)),k!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e){a=b;b=c;c=[];if(null!=b)for(f=0;f<b.triplesContext.length;f++)k=b.triplesContext[f],k.graph=a,c.push(k);
a=b={token:"quadsnottriples",quadsContext:c}}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Ci);return a}function sa(){var a,b,c,f,k,l,n;q++;a=g;b=eb();if(b!==e){c=g;f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(46===h.charCodeAt(g)?(k=pa,g++):(k=e,0===q&&d(qa)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=sa(),n===e&&(n=null),n!==e?c=f=[f,k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=
c,c=e;else g=c,c=e;c===e&&(c=null);c!==e?(a=b.triplesContext,null!=c&&"object"===typeof c&&null!=c.length&&null!=c[3]&&null!=c[3].triplesContext&&(a=a.concat(c[3].triplesContext)),a=b={token:"triplestemplate",triplesContext:a}):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Di);return a}function X(){var a,b,c,f;q++;a=g;123===h.charCodeAt(g)?(b=Ba,g++):(b=e,0===q&&d(Ca));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){var k;q++;f=g;k=n();k!==e?(b=y(),b!==e?(c=M(),c!==e?(f=k,k={kind:"select",
token:"subselect"},k.projection=f.vars,k.modifier=f.modifier,k.pattern=b,null!=c&&null!=c.limit&&(k.limit=c.limit),null!=c&&null!=c.offset&&(k.offset=c.offset),null!=c&&null!=c.order&&""!=c.order&&(k.order=c.order),null!=c&&null!=c.group&&(k.group=c.group),f=k):(g=f,f=e)):(g=f,f=e)):(g=f,f=e);q--;f===e&&0===q&&d(Ei);b=f;if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e?a=b:(g=a,a=e)):(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;if(a===
e)if(a=g,123===h.charCodeAt(g)?(b=Ba,g++):(b=e,0===q&&d(Ca)),b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){var l,m,r,u,x;q++;c=g;b=ba();b===e&&(b=null);if(b!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e){f=[];k=g;l=ga();if(l!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(46===h.charCodeAt(g)?(r=pa,g++):(r=e,0===q&&d(qa)),r===e&&(r=null),r!==e){u=[];for(x=t();x!==e;)u.push(x),x=t();u!==e?(x=ba(),x===e&&(x=null),x!==e?k=l=[l,m,r,u,x]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;else g=k,
k=e}else g=k,k=e;for(;k!==e;)if(f.push(k),k=g,l=ga(),l!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(46===h.charCodeAt(g)?(r=pa,g++):(r=e,0===q&&d(qa)),r===e&&(r=null),r!==e){u=[];for(x=t();x!==e;)u.push(x),x=t();u!==e?(x=ba(),x===e&&(x=null),x!==e?k=l=[l,m,r,u,x]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;else g=k,k=e}else g=k,k=e;if(f!==e){k=f;c=[];null!=b&&b!=[]&&c.push(b);for(b=0;b<k.length;b++)for(f=0;f<k[b].length;f++)null!=k[b][f]&&null!=k[b][f].token&&c.push(k[b][f]);k=[];l=[];m=[];r=[];for(b=
0;b<c.length;b++)if("triplespattern"!==c[b].token&&"filter"!==c[b].token&&"bind"!==c[b].token){if(0!=l.length||0!=m.length){u=[];for(f=0;f<l.length;f++)u=u.concat(l[f].triplesContext);0<u.length&&k.push({token:"basicgraphpattern",triplesContext:u});l=[]}k.push(c[b])}else"triplespattern"===c[b].token?l.push(c[b]):"bind"===c[b].token?r.push(c[b]):m.push(c[b]);if(0!=l.length||0!=m.length){u=[];for(f=0;f<l.length;f++)u=u.concat(l[f].triplesContext);0<u.length&&k.push({token:"basicgraphpattern",triplesContext:u})}c=
b={token:"groupgraphpattern",patterns:k,filters:m,binds:r}}else g=c,c=e}else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(Fi);b=c;if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e?a=b:(g=a,a=e)):(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Gi);return a}function ba(){var a,b,c,f,k,l;q++;a=g;q++;c=g;f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Ib(),b!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e)if(f=lb(),
f!==e){c=b;b=f.triplesContext;if(f.pairs)for(k=0;k<f.pairs.length;k++){l=f.pairs[k];var n=null;null!=l[1].length&&(l[1]=l[1][0]);c.token&&"triplesnodecollection"===c.token?(n={subject:c.chainSubject[0],predicate:l[0],object:l[1]},"path"===n.predicate.token&&"element"===n.predicate.kind&&(n.predicate=n.predicate.value),b.push(n),b=b.concat(c.triplesContext)):(n={subject:c,predicate:l[0],object:l[1]},"path"===n.predicate.token&&"element"===n.predicate.kind&&(n.predicate=n.predicate.value),b.push(n))}f=
{token:"triplessamesubject"};f.triplesContext=b;f.chainSubject=c;c=f}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e;if(c===e){c=g;f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=mb(),b!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e){q++;var m,r,u,x,y,v,A,E;q++;l=g;n=ua();n===e&&(n=Aa());if(n!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(k=zb(),k!==e){f=[];m=g;r=[];for(u=t();u!==e;)r.push(u),u=t();if(r!==e)if(59===h.charCodeAt(g)?(u=La,g++):(u=e,0===q&&d(Ma)),u!==e){x=[];for(y=
t();y!==e;)x.push(y),y=t();if(x!==e){y=g;v=ua();v===e&&(v=Aa());if(v!==e){A=[];for(E=t();E!==e;)A.push(E),E=t();A!==e?(E=ja(),E!==e?y=v=[v,A,E]:(g=y,y=e)):(g=y,y=e)}else g=y,y=e;y===e&&(y=null);y!==e?m=r=[r,u,x,y]:(g=m,m=e)}else g=m,m=e}else g=m,m=e;else g=m,m=e;for(;m!==e;){f.push(m);m=g;r=[];for(u=t();u!==e;)r.push(u),u=t();if(r!==e)if(59===h.charCodeAt(g)?(u=La,g++):(u=e,0===q&&d(Ma)),u!==e){x=[];for(y=t();y!==e;)x.push(y),y=t();if(x!==e){y=g;v=ua();v===e&&(v=Aa());if(v!==e){A=[];for(E=t();E!==
e;)A.push(E),E=t();A!==e?(E=ja(),E!==e?y=v=[v,A,E]:(g=y,y=e)):(g=y,y=e)}else g=y,y=e;y===e&&(y=null);y!==e?m=r=[r,u,x,y]:(g=m,m=e)}else g=m,m=e}else g=m,m=e;else g=m,m=e}if(f!==e){r=n;u=k;k={token:"propertylist"};l=[];n=[];for(m=0;m<u.length;m++)null!=u[m].triplesContext?(l=l.concat(u[m].triplesContext),"triplesnodecollection"===u[m].token&&null!=u[m].chainSubject.length?n.push([r,u[m].chainSubject[0]]):n.push([r,u[m].chainSubject])):n.push([r,u[m]]);for(m=0;m<f.length;m++)for(u=f[m][3],r=u[0],u=
u[2]||[],x=0;x<u.length;x++)null!=u[x].triplesContext?(l=l.concat(u[x].triplesContext),n.push([r,u[x].chainSubject])):n.push([r,u[x]]);k.pairs=n;k.triplesContext=l;l=k}else g=l,l=e}else g=l,l=e;else g=l,l=e}else g=l,l=e;q--;l===e&&0===q&&d(Hi);f=l;f===e&&(f=null);q--;f===e&&0===q&&d(Ii);if(f!==e){c=b;k=f;b=c.triplesContext;f=c.chainSubject;if(null!=k&&null!=k.pairs)for(l=0;l<k.pairs.length;l++)if(n=k.pairs[l],null!=n[1].length&&(n[1]=n[1][0]),"triplesnodecollection"===c.token)for(m=0;m<f.length;m++)r=
f[m],null!=r.triplesContext?(u={subject:r.chainSubject,predicate:n[0],object:n[1]},b.concat(r.triplesContext)):(u={subject:f[m],predicate:n[0],object:n[1]},b.push(u));else u={subject:f,predicate:n[0],object:n[1]},b.push(u);c={token:"triplessamesubject"};c.triplesContext=b;c.chainSubject=f}else g=c,c=e}else g=c,c=e}else g=c,c=e;else g=c,c=e}q--;c===e&&0===q&&d(Ji);b=c;if(b!==e){c=g;f=[];for(k=t();k!==e;)f.push(k),k=t();f!==e?(46===h.charCodeAt(g)?(k=pa,g++):(k=e,0===q&&d(qa)),k!==e?(l=ba(),l===e&&
(l=null),l!==e?c=f=[f,k,l]:(g=c,c=e)):(g=c,c=e)):(g=c,c=e);c===e&&(c=null);c!==e?(a=b.triplesContext,null!=c&&"object"===typeof c&&null!=c&&null!=c.length&&null!=c[2]&&null!=c[2].triplesContext&&(a=a.concat(c[2].triplesContext)),a=b={token:"triplespattern",triplesContext:a}):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Ki);return a}function ga(){var a;q++;var b,c,f,k,l,n,m;q++;b=g;c=X();if(c!==e){a=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,5)===cc?(l=cc,g+=5):(l=e,0===q&&d(ue)),
l===e&&(h.substr(g,5)===dc?(l=dc,g+=5):(l=e,0===q&&d(ve))),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=X(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;for(;f!==e;){a.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,5)===cc?(l=cc,g+=5):(l=e,0===q&&d(ue)),l===e&&(h.substr(g,5)===dc?(l=dc,g+=5):(l=e,0===q&&d(ve))),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=X(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e}if(a!==
e){if(0!==a.length){b={token:"graphunionpattern",value:[c]};for(c=0;c<a.length;c++)c==a.length-1?b.value.push(a[c][3]):(b.value.push(a[c][3]),b={token:"graphunionpattern",value:[b]});c=b}b=c}else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(Li);a=b;if(a===e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,8)===we?(c=we,g+=8):(c=e,0===q&&d(Mi)),c===e&&(h.substr(g,8)===xe?(c=xe,g+=8):(c=e,0===q&&d(Ni))),c!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(c=X(),c!==e?a=b={token:"optionalgraphpattern",
value:c}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Oi);if(a===e){q++;a=g;h.substr(g,5)===ye?(b=ye,g+=5):(b=e,0===q&&d(Pi));b===e&&(h.substr(g,5)===ze?(b=ze,g+=5):(b=e,0===q&&d(Qi)));if(b!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(c=X(),c!==e?a=b={token:"minusgraphpattern",status:"todo",value:c}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Ri);if(a===e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,5)===tb?(c=tb,g+=5):(c=e,0===q&&d(Rc)),
c===e&&(h.substr(g,5)===ub?(c=ub,g+=5):(c=e,0===q&&d(Sc))),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=fb(),b!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e)if(c=X(),c!==e){a=b;b=c;for(c=0;c<b.patterns.length;c++)for(f=b.patterns[c],k=0;k<f.triplesContext.length;k++)f.triplesContext[k].graph=a;b.token="groupgraphpattern";a=b}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Si);if(a===e&&(q++,a=g,h.substr(g,7)===Ae?(b=Ae,g+=7):(b=
e,0===q&&d(Ti)),b!==e?(b=fb(),b!==e?(c=X(),c!==e?a=b={token:"servicegraphpattern",status:"todo",value:[b,c]}:(g=a,a=e)):(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(Ui),a===e)){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,6)===Be?(c=Be,g+=6):(c=e,0===q&&d(Vi)),c===e&&(h.substr(g,6)===Ce?(c=Ce,g+=6):(c=e,0===q&&d(Wi))),c!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(c=da(),c!==e?a=b={token:"filter",value:c}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Xi);
if(a===e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,4)===De?(c=De,g+=4):(c=e,0===q&&d(Yi)),c===e&&(h.substr(g,4)===Ee?(c=Ee,g+=4):(c=e,0===q&&d(Zi))),c!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(40===h.charCodeAt(g)?(c=R,g++):(c=e,0===q&&d(S)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=Q(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(h.substr(g,2)===Xa?(f=Xa,g+=2):(f=e,0===q&&d(Vb)),f===e&&(h.substr(g,2)===Wa?(f=Wa,g+=2):(f=e,0===
q&&d(Ub))),f!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e)if(c=ka(),c!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();f!==e?(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e?a=b={token:"bind",expression:b,as:c}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d($i);if(a===e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(h.substr(g,6)===Sb?(c=Sb,g+=6):(c=e,0===
q&&d(wd)),c===e&&(h.substr(g,6)===Tb?(c=Tb,g+=6):(c=e,0===q&&d(xd))),c!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(c=za(),c!==e?a=c:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(aj)}}}}}}q--;a===e&&0===q&&d(bj);return a}function da(){var a;q++;a=Ec();a===e&&(a=Fc(),a===e&&(a=ea()));q--;a===e&&0===q&&d(cj);return a}function za(){var a;q++;var b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=ka(),c!==e){b=[];for(f=t();f!==e;)b.push(f),f=t();if(b!==e)if(123===
h.charCodeAt(g)?(f=Ba,g++):(f=e,0===q&&d(Ca)),f!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e){b=[];for(f=fa();f!==e;)b.push(f),f=fa();b!==e?(125===h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e?a=b={token:"inlineData",values:[{"var":c,value:b}]}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(dj);if(a===e){var k,l,n,m,r,u,x;q++;a=g;c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){f=Ia();if(f===e)if(f=g,40===h.charCodeAt(g)?(k=R,
g++):(k=e,0===q&&d(S)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e){n=[];for(c=ka();c!==e;)n.push(c),c=ka();if(n!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();c!==e?(41===h.charCodeAt(g)?(b=T,g++):(b=e,0===q&&d(U)),b!==e?f=k=[k,l,n,c,b]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e}else g=f,f=e}else g=f,f=e;if(f!==e){k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(123===h.charCodeAt(g)?(l=Ba,g++):(l=e,0===q&&d(Ca)),l!==e){n=[];for(c=t();c!==e;)n.push(c),c=t();if(n!==e){c=[];b=g;f=[];for(k=t();k!==e;)f.push(k),
k=t();if(f!==e)if(40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e){n=[];for(m=fa();m!==e;)n.push(m),m=fa();if(n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(41===h.charCodeAt(g)?(r=T,g++):(r=e,0===q&&d(U)),r!==e){u=[];for(x=t();x!==e;)u.push(x),x=t();u!==e?b=f=[f,k,l,n,m,r,u]:(g=b,b=e)}else g=b,b=e;else g=b,b=e}else g=b,b=e}else g=b,b=e}else g=b,b=e;else g=b,b=e;for(b===e&&(b=Ia());b!==e;){c.push(b);b=g;f=[];for(k=t();k!==e;)f.push(k),
k=t();if(f!==e)if(40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e){n=[];for(m=fa();m!==e;)n.push(m),m=fa();if(n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e)if(41===h.charCodeAt(g)?(r=T,g++):(r=e,0===q&&d(U)),r!==e){u=[];for(x=t();x!==e;)u.push(x),x=t();u!==e?b=f=[f,k,l,n,m,r,u]:(g=b,b=e)}else g=b,b=e;else g=b,b=e}else g=b,b=e}else g=b,b=e}else g=b,b=e;else g=b,b=e;b===e&&(b=Ia())}if(c!==e){b=[];for(f=t();f!==e;)b.push(f),f=t();b!==e?(125===
h.charCodeAt(g)?(f=va,g++):(f=e,0===q&&d(wa)),f!==e?a=c={token:"inlineData",values:[],todo:!0}:(g=a,a=e)):(g=a,a=e)}else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(ej)}q--;a===e&&0===q&&d(fj);return a}function fa(){var a,b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=Mb(),c===e&&(c=Jb(),c===e&&(c=Kb(),c===e&&(c=Lb(),c===e&&(h.substr(g,5)===Yb?(c=Yb,g+=5):(c=e,0===q&&d(Yd)))))),c!==e){b=[];for(f=t();f!==e;)b.push(f),f=t();b!==e?a=
c:(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(gj);return a}function ea(){var a,b,c,f;q++;a=g;b=la();if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(f=Na(),f!==e?(a={token:"expression",expressionType:"irireforfunction"},a.iriref=b,a.args=f.value):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(hj);return a}function Na(){var a,b,c,f,k,l,n,m;q++;b=Ia();b!==e&&(b={token:"args",value:[]});a=b;if(a===e)if(a=g,40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){c=[];for(b=t();b!==
e;)c.push(b),b=t();if(c!==e)if(h.substr(g,8)===na?(b=na,g+=8):(b=e,0===q&&d(Ua)),b===e&&(h.substr(g,8)===oa?(b=oa,g+=8):(b=e,0===q&&d(Va))),b===e&&(b=null),b!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e)if(c=Q(),c!==e){k=[];for(f=t();f!==e;)k.push(f),f=t();if(k!==e){f=[];k=g;44===h.charCodeAt(g)?(l=ha,g++):(l=e,0===q&&d(ia));if(l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Q(),m!==e?k=l=[l,n,m]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;for(;k!==e;)if(f.push(k),k=g,44===h.charCodeAt(g)?(l=ha,
g++):(l=e,0===q&&d(ia)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Q(),m!==e?k=l=[l,n,m]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){a=b;b=c;c=[];for(k=0;k<f.length;k++)c.push(f[k][2]);f={token:"args"};f.value=[b].concat(c);null!=a&&"DISTINCT"===a.toUpperCase()?f.distinct=!0:f.distinct=!1;a=f}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(ij);return a}function Oa(){var a,
b,c,f,k,l,n;q++;b=Ia();b!==e&&(b={token:"args",value:[]});a=b;if(a===e)if(a=g,40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=la(),b===e&&(b=Q()),b!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e){c=[];f=g;44===h.charCodeAt(g)?(k=ha,g++):(k=e,0===q&&d(ia));if(k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=la(),n===e&&(n=Q()),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;for(;f!==e;)if(c.push(f),f=g,44===h.charCodeAt(g)?(k=
ha,g++):(k=e,0===q&&d(ia)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=la(),n===e&&(n=Q()),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;if(c!==e)if(41===h.charCodeAt(g)?(f=T,g++):(f=e,0===q&&d(U)),f!==e){a=b;b=[];for(f=0;f<c.length;f++)b.push(c[f][2]);c={token:"args"};c.value=[a].concat(b);a=c}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(jj);return a}function db(){var a,b,c,f,k,l,n;q++;a=g;b=eb();if(b!==e){c=g;f=[];for(k=t();k!==
e;)f.push(k),k=t();if(f!==e)if(46===h.charCodeAt(g)?(k=pa,g++):(k=e,0===q&&d(qa)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=db(),n===e&&(n=null),n!==e?c=f=[f,k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;else g=c,c=e;c===e&&(c=null);c!==e?(a=b.triplesContext,null!=c&&"object"===typeof c&&null!=c.length&&null!=c[3]&&null!=c[3].triplesContext&&(a=a.concat(c[3].triplesContext)),a=b={token:"triplestemplate",triplesContext:a}):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(kj);return a}function eb(){var a,
b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=Ib(),c!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=ca(),b!==e){a=b.triplesContext;if(b.pairs)for(f=0;f<b.pairs.length;f++){var h=b.pairs[f],k=null;null!=h[1].length&&(h[1]=h[1][0]);c.token&&"triplesnodecollection"===c.token?(k={subject:c.chainSubject[0],predicate:h[0],object:h[1]},a.push(k),a=a.concat(c.triplesContext)):(k={subject:c,predicate:h[0],object:h[1]},a.push(k))}b={token:"triplessamesubject"};b.triplesContext=
a;b.chainSubject=c;a=b}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;if(a===e){a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=ma(),c!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(q++,b=ca(),b===e&&(b=null),q--,b===e&&0===q&&d(lj),b!==e){f=b;a=c.triplesContext;b=c.chainSubject;if(f.pairs)for(h=0;h<f.pairs.length;h++)if(k=f.pairs[h],null!=k[1].length&&(k[1]=k[1][0]),"triplesnodecollection"===c.token)for(var l=0;l<b.length;l++){var n=b[l];if(null!=n.triplesContext){var m={subject:n.chainSubject,
predicate:k[0],object:k[1]};a.concat(n.triplesContext)}else m={subject:b[l],predicate:k[0],object:k[1]},a.push(m)}else m={subject:b,predicate:k[0],object:k[1]},a.push(m);c={token:"triplessamesubject"};c.triplesContext=a;c.chainSubject=b;a=c}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}q--;a===e&&0===q&&d(mj);return a}function ca(){var a,b,c,f,k,l,n,m,r,u,x,y;q++;a=g;b=Pa();if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(f=ja(),f!==e){c=[];k=g;l=[];for(n=t();n!==e;)l.push(n),n=t();
if(l!==e)if(59===h.charCodeAt(g)?(n=La,g++):(n=e,0===q&&d(Ma)),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();if(m!==e){r=g;u=Pa();if(u!==e){x=[];for(y=t();y!==e;)x.push(y),y=t();x!==e?(y=ja(),y!==e?r=u=[u,x,y]:(g=r,r=e)):(g=r,r=e)}else g=r,r=e;r===e&&(r=null);r!==e?k=l=[l,n,m,r]:(g=k,k=e)}else g=k,k=e}else g=k,k=e;else g=k,k=e;for(;k!==e;){c.push(k);k=g;l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(59===h.charCodeAt(g)?(n=La,g++):(n=e,0===q&&d(Ma)),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();
if(m!==e){r=g;u=Pa();if(u!==e){x=[];for(y=t();y!==e;)x.push(y),y=t();x!==e?(y=ja(),y!==e?r=u=[u,x,y]:(g=r,r=e)):(g=r,r=e)}else g=r,r=e;r===e&&(r=null);r!==e?k=l=[l,n,m,r]:(g=k,k=e)}else g=k,k=e}else g=k,k=e;else g=k,k=e}if(c!==e){l=b;n=f;f={token:"propertylist"};a=[];b=[];for(k=0;k<n.length;k++)null!=n[k].triplesContext?(a=a.concat(n[k].triplesContext),"triplesnodecollection"===n[k].token&&null!=n[k].chainSubject.length?b.push([l,n[k].chainSubject[0]]):b.push([l,n[k].chainSubject])):b.push([l,n[k]]);
for(k=0;k<c.length;k++)for(n=c[k][3],l=n[0],n=n[2]||[],m=0;m<n.length;m++)null!=n[m].triplesContext?(a=a.concat(n[m].triplesContext),b.push([l,n[m].chainSubject])):b.push([l,n[m]]);f.pairs=b;f.triplesContext=a;a=f}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(nj);return a}function zb(){var a,b,c,f,k,l,n;q++;a=g;b=$a();if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){f=[];c=g;44===h.charCodeAt(g)?(k=ha,g++):(k=e,0===q&&d(ia));if(k!==e){l=[];for(n=t();n!==e;)l.push(n),
n=t();l!==e?(n=$a(),n!==e?c=k=[k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;for(;c!==e;)if(f.push(c),c=g,44===h.charCodeAt(g)?(k=ha,g++):(k=e,0===q&&d(ia)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=$a(),n!==e?c=k=[k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;if(f!==e){a=f;f=[];f.push(b);for(b=0;b<a.length;b++)for(c=0;c<a[b].length;c++)"object"==typeof a[b][c]&&null!=a[b][c].token&&f.push(a[b][c]);a=f}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(oj);return a}function ja(){var a,b,
c,f,k,l,n;q++;a=g;b=ab();if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){f=[];c=g;44===h.charCodeAt(g)?(k=ha,g++):(k=e,0===q&&d(ia));if(k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=ab(),n!==e?c=k=[k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;for(;c!==e;)if(f.push(c),c=g,44===h.charCodeAt(g)?(k=ha,g++):(k=e,0===q&&d(ia)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(n=ab(),n!==e?c=k=[k,l,n]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;if(f!==e){a=f;f=[];f.push(b);for(b=0;b<a.length;b++)for(c=
0;c<a[b].length;c++)"object"==typeof a[b][c]&&null!=a[b][c].token&&f.push(a[b][c]);a=f}else g=a,a=e}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(pj);return a}function $a(){var a;q++;a=Hb();q--;a===e&&0===q&&d(qj);return a}function ab(){var a;q++;a=Dc();q--;a===e&&0===q&&d(rj);return a}function Pa(){var a;q++;a=fb();a===e&&(97===h.charCodeAt(g)?(a=ec,g++):(a=e,0===q&&d(fc)),a!==e&&(a=Fe()));q--;a===e&&0===q&&d(sj);return a}function lb(){var a,b,c,f,k,l,n,m,r,u,x;q++;a=g;b=ua();b===e&&(b=Aa());if(b!==
e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(f=zb(),f!==e){c=[];k=g;l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(59===h.charCodeAt(g)?(n=La,g++):(n=e,0===q&&d(Ma)),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();m!==e?(r=g,u=ua(),u===e&&(u=Aa()),u!==e?(x=ja(),x!==e?r=u=[u,x]:(g=r,r=e)):(g=r,r=e),r===e&&(r=null),r!==e?k=l=[l,n,m,r]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;else g=k,k=e;for(;k!==e;){c.push(k);k=g;l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(59===h.charCodeAt(g)?(n=La,g++):(n=
e,0===q&&d(Ma)),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();m!==e?(r=g,u=ua(),u===e&&(u=Aa()),u!==e?(x=ja(),x!==e?r=u=[u,x]:(g=r,r=e)):(g=r,r=e),r===e&&(r=null),r!==e?k=l=[l,n,m,r]:(g=k,k=e)):(g=k,k=e)}else g=k,k=e;else g=k,k=e}if(c!==e){l=b;n=f;f={token:"propertylist"};a=[];b=[];for(k=0;k<n.length;k++)null!=n[k].triplesContext?(a=a.concat(n[k].triplesContext),"triplesnodecollection"===n[k].token&&null!=n[k].chainSubject.length?b.push([l,n[k].chainSubject[0]]):b.push([l,n[k].chainSubject])):b.push([l,
n[k]]);for(k=0;k<c.length;k++)for(n=c[k][3],l=n[0],n=n[1]||[],m=0;m<n.length;m++)null!=n[m].triplesContext?(a=a.concat(n[m].triplesContext),b.push([l,n[m].chainSubject])):b.push([l,n[m]]);f.pairs=b;f.triplesContext=a;a=f}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(tj);return a}function ua(){var a;q++;a=kb();q--;a===e&&0===q&&d(uj);return a}function Aa(){var a;q++;a=ka();q--;a===e&&0===q&&d(vj);return a}function kb(){var a;q++;var b,c,f,k,l;q++;b=g;c=ib();if(c!==e){a=[];
f=g;124===h.charCodeAt(g)?(k=gc,g++):(k=e,0===q&&d(hc));k!==e?(l=ib(),l!==e?f=k=[k,l]:(g=f,f=e)):(g=f,f=e);for(;f!==e;)a.push(f),f=g,124===h.charCodeAt(g)?(k=gc,g++):(k=e,0===q&&d(hc)),k!==e?(l=ib(),l!==e?f=k=[k,l]:(g=f,f=e)):(g=f,f=e);if(a!==e){if(null!=a&&0!==a.length){b=[];for(c=0;c<a.length;c++)b.push(a[1]);a={token:"path",kind:"alternative"};a.value=b;c=a}b=c}else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(wj);a=b;q--;a===e&&0===q&&d(xj);return a}function ib(){var a,b,c,f,k,l;q++;a=g;b=Y();if(b!==
e){c=[];f=g;47===h.charCodeAt(g)?(k=bb,g++):(k=e,0===q&&d(cb));k!==e?(l=Y(),l!==e?f=k=[k,l]:(g=f,f=e)):(g=f,f=e);for(;f!==e;)c.push(f),f=g,47===h.charCodeAt(g)?(k=bb,g++):(k=e,0===q&&d(cb)),k!==e?(l=Y(),l!==e?f=k=[k,l]:(g=f,f=e)):(g=f,f=e);if(c!==e){if(null!=c&&0!==c.length){a=[b];for(b=0;b<c.length;b++)a.push(c[b][1]);c={token:"path",kind:"sequence"};c.value=a;b=c}a=b}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(yj);return a}function K(){var a,b,c;q++;a=g;var f;q++;b=la();if(b===e&&(97===h.charCodeAt(g)?
(c=ec,g++):(c=e,0===q&&d(fc)),c!==e&&(c=Fe()),b=c,b===e)){b=g;33===h.charCodeAt(g)?(c=Tc,g++):(c=e,0===q&&d(Uc));if(c!==e){var k,l,n,t,m,r,u;f=Qa();if(f===e)if(f=g,40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S)),k!==e){l=g;n=Qa();if(n!==e){t=[];m=g;124===h.charCodeAt(g)?(r=gc,g++):(r=e,0===q&&d(hc));r!==e?(u=Qa(),u!==e?m=r=[r,u]:(g=m,m=e)):(g=m,m=e);for(;m!==e;)t.push(m),m=g,124===h.charCodeAt(g)?(r=gc,g++):(r=e,0===q&&d(hc)),r!==e?(u=Qa(),u!==e?m=r=[r,u]:(g=m,m=e)):(g=m,m=e);t!==e?l=n=[n,t]:(g=
l,l=e)}else g=l,l=e;l===e&&(l=null);l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?f=k=[k,l,n]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;f!==e?b=c=[c,f]:(g=b,b=e)}else g=b,b=e;b===e&&(b=g,40===h.charCodeAt(g)?(c=R,g++):(c=e,0===q&&d(S)),c!==e?(f=kb(),f!==e?(41===h.charCodeAt(g)?(c=T,g++):(c=e,0===q&&d(U)),c!==e?b=f:(g=b,b=e)):(g=b,b=e)):(g=b,b=e))}q--;b===e&&0===q&&d(zj);if(b!==e)if(q++,42===h.charCodeAt(g)?(c=Ja,g++):(c=e,0===q&&d(Ka)),c===e&&(63===h.charCodeAt(g)?(c=Vc,g++):(c=e,0===q&&d(Wc)),
c===e&&(43===h.charCodeAt(g)?(c=Ya,g++):(c=e,0===q&&d(Za)),c===e&&(c=g,123===h.charCodeAt(g)?(f=Ba,g++):(f=e,0===q&&d(Ca)),f!==e?(k=g,l=Db(),l!==e?(n=g,44===h.charCodeAt(g)?(t=ha,g++):(t=e,0===q&&d(ia)),t!==e?(125===h.charCodeAt(g)?(m=va,g++):(m=e,0===q&&d(wa)),m===e&&(m=g,r=Db(),r!==e?(125===h.charCodeAt(g)?(u=va,g++):(u=e,0===q&&d(wa)),u!==e?m=r=[r,u]:(g=m,m=e)):(g=m,m=e)),m!==e?n=t=[t,m]:(g=n,n=e)):(g=n,n=e),n===e&&(125===h.charCodeAt(g)?(n=va,g++):(n=e,0===q&&d(wa))),n!==e?k=l=[l,n]:(g=k,k=e)):
(g=k,k=e),k===e&&(k=g,44===h.charCodeAt(g)?(l=ha,g++):(l=e,0===q&&d(ia)),l!==e?(n=Db(),n!==e?(125===h.charCodeAt(g)?(t=va,g++):(t=e,0===q&&d(wa)),t!==e?k=l=[l,n,t]:(g=k,k=e)):(g=k,k=e)):(g=k,k=e)),k!==e?c=f=[f,k]:(g=c,c=e)):(g=c,c=e)))),q--,c===e&&0===q&&d(Aj),c===e&&(c=null),c!==e){a=b;b=c;if(a.token&&"path"!=a.token&&""==b)b=a;else if(a.token&&a.token!=x&&""!=b){var x={token:"path",kind:"element"};x.value=a;x.modifier=b;b=x}else a.modifier=b,b=a;a=b}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Bj);
return a}function Y(){var a,b;q++;a=K();a===e&&(a=g,94===h.charCodeAt(g)?(b=Ge,g++):(b=e,0===q&&d(He)),b!==e?(b=K(),b!==e?(a={token:"path",kind:"inversePath"},a.value=b):(g=a,a=e)):(g=a,a=e));q--;a===e&&0===q&&d(Cj);return a}function Qa(){var a,b,c;q++;a=la();a===e&&(97===h.charCodeAt(g)?(a=ec,g++):(a=e,0===q&&d(fc)),a===e&&(a=g,94===h.charCodeAt(g)?(b=Ge,g++):(b=e,0===q&&d(He)),b!==e?(c=la(),c===e&&(97===h.charCodeAt(g)?(c=ec,g++):(c=e,0===q&&d(fc))),c!==e?a=b=[b,c]:(g=a,a=e)):(g=a,a=e)));q--;a===
e&&0===q&&d(Dj);return a}function Db(){var a;q++;a=jb();q--;a===e&&0===q&&d(Ej);return a}function mb(){var a;q++;var b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(40===h.charCodeAt(g)?(c=R,g++):(c=e,0===q&&d(S)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){b=[];c=Hb();if(c!==e)for(;c!==e;)b.push(c),c=Hb();else b=e;if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(41===h.charCodeAt(g)?(f=T,g++):(f=e,0===q&&d(U)),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==
e?a=b:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Fj);if(a!==e){b=[];c=[];var k=null;for(f=0;f<a.length;f++)ra++,k=null,null==a[f].chainSubject&&null==a[f].triplesContext?k=a[f]:(k=a[f].chainSubject,b=b.concat(a[f].triplesContext)),k={subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first"},object:k},0==f&&c.push(k.subject),b.push(k),k=f===a.length-
1?{subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"},object:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}}:{subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"},object:{token:"blank",value:"_:"+(ra+1)}},b.push(k);a={token:"triplesnodecollection",triplesContext:b,chainSubject:c}}if(a===
e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(91===h.charCodeAt(g)?(c=Xc,g++):(c=e,0===q&&d(Yc)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=lb(),b!==e)if(93===h.charCodeAt(g)?(c=Zc,g++):(c=e,0===q&&d($c)),c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){a=b;ra++;b={token:"blank",value:"_:"+ra};c=[];for(f=0;f<a.pairs.length;f++){var k=a.pairs[f],l={};l.subject=b;l.predicate=k[0];null!=k[1].length&&(k[1]=k[1][0]);l.object=k[1];c.push(l)}a=b={token:"triplesnode",
kind:"blanknodepropertylist",triplesContext:a.triplesContext.concat(c),chainSubject:b}}else g=a,a=e}else g=a,a=e;else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Gj)}q--;a===e&&0===q&&d(Hj);return a}function ma(){var a;q++;var b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(40===h.charCodeAt(g)?(c=R,g++):(c=e,0===q&&d(S)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e){b=[];c=Dc();if(c!==e)for(;c!==e;)b.push(c),c=Dc();else b=e;if(b!==e){c=[];for(f=t();f!==
e;)c.push(f),f=t();if(c!==e)if(41===h.charCodeAt(g)?(f=T,g++):(f=e,0===q&&d(U)),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?a=b:(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Ij);if(a!==e){b=[];c=[];var k=null;for(f=0;f<a.length;f++)ra++,k=null,null==a[f].chainSubject&&null==a[f].triplesContext?k=a[f]:(k=a[f].chainSubject,b=b.concat(k.triplesContext)),k={subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,
value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first"},object:k},0==f&&c.push(k.subject),b.push(k),k=f===a.length-1?{subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"},object:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}}:{subject:{token:"blank",value:"_:"+ra},predicate:{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"},
object:{token:"blank",value:"_:"+(ra+1)}},b.push(k);a={token:"triplesnodecollection",triplesContext:b,chainSubject:c}}if(a===e){q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(91===h.charCodeAt(g)?(c=Xc,g++):(c=e,0===q&&d(Yc)),c!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();if(c!==e)if(b=ca(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(93===h.charCodeAt(g)?(f=Zc,g++):(f=e,0===q&&d($c)),f!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){a=b;ra++;b={token:"blank",value:"_:"+
ra};c=[];for(f=0;f<a.pairs.length;f++){var k=a.pairs[f],l={};l.subject=b;l.predicate=k[0];null!=k[1].length&&(k[1]=k[1][0]);l.object=k[1];c.push(l)}a=b={token:"triplesnode",kind:"blanknodepropertylist",triplesContext:a.triplesContext.concat(c),chainSubject:b}}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Jj)}q--;a===e&&0===q&&d(Kj);return a}function Hb(){var a,b,c,f,h;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=Ib(),
c!==e){f=[];for(h=t();h!==e;)f.push(h),h=t();f!==e?a=b=[b,c,f]:(g=a,a=e)}else g=a,a=e;else g=a,a=e;if(a===e){a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=mb(),c!==e){f=[];for(h=t();h!==e;)f.push(h),h=t();f!==e?a=b=[b,c,f]:(g=a,a=e)}else g=a,a=e;else g=a,a=e}a!==e&&(a=a[1]);q--;a===e&&0===q&&d(Lj);return a}function Dc(){var a,b,c,f,h;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=Ib(),c!==e){f=[];for(h=t();h!==e;)f.push(h),h=t();f!==e?a=b=[b,c,f]:(g=a,a=e)}else g=a,a=e;else g=
a,a=e;if(a===e){a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(c=ma(),c!==e){f=[];for(h=t();h!==e;)f.push(h),h=t();f!==e?a=b=[b,c,f]:(g=a,a=e)}else g=a,a=e;else g=a,a=e}a!==e&&(a=a[1]);q--;a===e&&0===q&&d(Mj);return a}function Ib(){var a;q++;a=ka();if(a===e){q++;a=la();if(a===e&&(a=Jb(),a===e&&(a=Kb(),a===e&&(a=Lb(),a===e)))){q++;var b;q++;a=g;h.substr(g,2)===Ie?(b=Ie,g+=2):(b=e,0===q&&d(Nj));b!==e?(b=Je(),b!==e?a=b:(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(Oj);a!==e&&(a={token:"blank",value:a});
if(a===e){var c,f;q++;a=g;91===h.charCodeAt(g)?(b=Xc,g++):(b=e,0===q&&d(Yc));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(93===h.charCodeAt(g)?(f=Zc,g++):(f=e,0===q&&d($c)),f!==e?a=b=[b,c,f]:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Pj);a!==e&&(ra++,a={token:"blank",value:"_:"+ra})}q--;a===e&&0===q&&d(Qj);a===e&&(a=Ia())}q--;a===e&&0===q&&d(Rj)}q--;a===e&&0===q&&d(Sj);return a}function fb(){var a;q++;a=ka();a===e&&(a=la());q--;a===e&&0===q&&d(Tj);return a}function ka(){var a,
b,c,f;q++;a=g;b=[];for(c=t();c!==e;)b.push(c),c=t();if(b!==e)if(q++,c=g,63===h.charCodeAt(g)?(b=Vc,g++):(b=e,0===q&&d(Wc)),b!==e?(b=Ke(),b!==e?c=b:(g=c,c=e)):(g=c,c=e),q--,c===e&&0===q&&d(Uj),c===e&&(q++,c=g,36===h.charCodeAt(g)?(b=Le,g++):(b=e,0===q&&d(Me)),b!==e?(b=Ke(),b!==e?c=b:(g=c,c=e)):(g=c,c=e),q--,c===e&&0===q&&d(Vj)),c!==e){b=[];for(f=t();f!==e;)b.push(f),f=t();b!==e?(a={token:"var"},a.value=c):(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Wj);return a}function Q(){var a;q++;var b,
c,f,k,l,n,m;q++;b=g;c=gb();if(c!==e){a=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===ic?(l=ic,g+=2):(l=e,0===q&&d(Ne)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=gb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;for(;f!==e;){a.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===ic?(l=ic,g+=2):(l=e,0===q&&d(Ne)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=gb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=
f,f=e;else g=f,f=e}if(a!==e){if(0!==a.length){b={token:"expression",expressionType:"conditionalor"};c=[c];for(f=0;f<a.length;f++)c.push(a[f][3]);b.operands=c;c=b}b=c}else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(Xj);a=b;q--;a===e&&0===q&&d(Yj);return a}function gb(){var a,b,c,f,k,l,n,m;q++;a=g;b=Ab();if(b!==e){c=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===jc?(l=jc,g+=2):(l=e,0===q&&d(Oe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Ab(),m!==e?f=k=[k,l,n,m]:(g=
f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;for(;f!==e;){c.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===jc?(l=jc,g+=2):(l=e,0===q&&d(Oe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Ab(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e}if(c!==e){if(0!==c.length){a={token:"expression",expressionType:"conditionaland"};b=[b];for(f=0;f<c.length;f++)b.push(c[f][3]);a.operands=b;b=a}a=b}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(Zj);return a}
function Ab(){var a;q++;var b,c,f,k,l,n,m,r,u,x,y,v;q++;b=g;c=xa();if(c!==e){a=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(61===h.charCodeAt(g)?(l=kc,g++):(l=e,0===q&&d(lc)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===mc?(l=mc,g+=2):(l=e,0===q&&d(Pe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,
n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(60===h.charCodeAt(g)?(l=ad,g++):(l=e,0===q&&d(bd)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(62===h.charCodeAt(g)?(l=cd,g++):(l=e,0===q&&d(dd)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=
f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===nc?(l=nc,g+=2):(l=e,0===q&&d(Qe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===oc?(l=oc,g+=2):(l=e,0===q&&d(Re)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=
f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(73===h.charCodeAt(g)?(l=pc,g++):(l=e,0===q&&d(qc)),l===e&&(105===h.charCodeAt(g)?(l=rc,g++):(l=e,0===q&&d(sc))),l!==e)if(78===h.charCodeAt(g)?(n=vb,g++):(n=e,0===q&&d(wb)),n===e&&(110===h.charCodeAt(g)?(n=xb,g++):(n=e,0===q&&d(yb))),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();m!==e?(r=Oa(),r!==e?f=k=[k,l,n,m,r]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==
e)if(78===h.charCodeAt(g)?(l=vb,g++):(l=e,0===q&&d(wb)),l===e&&(110===h.charCodeAt(g)?(l=xb,g++):(l=e,0===q&&d(yb))),l!==e)if(79===h.charCodeAt(g)?(n=Se,g++):(n=e,0===q&&d(Te)),n===e&&(111===h.charCodeAt(g)?(n=Ue,g++):(n=e,0===q&&d(Ve))),n!==e)if(84===h.charCodeAt(g)?(m=We,g++):(m=e,0===q&&d(Xe)),m===e&&(116===h.charCodeAt(g)?(m=Ye,g++):(m=e,0===q&&d(Ze))),m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();if(r!==e)if(73===h.charCodeAt(g)?(u=pc,g++):(u=e,0===q&&d(qc)),u===e&&(105===h.charCodeAt(g)?(u=rc,
g++):(u=e,0===q&&d(sc))),u!==e)if(78===h.charCodeAt(g)?(x=vb,g++):(x=e,0===q&&d(wb)),x===e&&(110===h.charCodeAt(g)?(x=xb,g++):(x=e,0===q&&d(yb))),x!==e){y=[];for(v=t();v!==e;)y.push(v),v=t();y!==e?(v=Oa(),v!==e?f=k=[k,l,n,m,r,u,x,y,v]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;else g=f,f=e}else g=f,f=e;else g=f,f=e;else g=f,f=e;else g=f,f=e}}}}}}}for(;f!==e;){a.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(61===h.charCodeAt(g)?(l=kc,g++):(l=e,0===q&&d(lc)),l!==e){n=[];for(m=t();m!==
e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===mc?(l=mc,g+=2):(l=e,0===q&&d(Pe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(60===h.charCodeAt(g)?(l=ad,g++):(l=e,0===q&&d(bd)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==
e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(62===h.charCodeAt(g)?(l=cd,g++):(l=e,0===q&&d(dd)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===nc?(l=nc,g+=2):(l=e,0===q&&d(Qe)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=
[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(h.substr(g,2)===oc?(l=oc,g+=2):(l=e,0===q&&d(Re)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=xa(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(73===h.charCodeAt(g)?(l=pc,g++):(l=e,0===q&&d(qc)),l===e&&(105===h.charCodeAt(g)?(l=rc,g++):(l=e,0===q&&d(sc))),l!==e)if(78===h.charCodeAt(g)?
(n=vb,g++):(n=e,0===q&&d(wb)),n===e&&(110===h.charCodeAt(g)?(n=xb,g++):(n=e,0===q&&d(yb))),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=t();m!==e?(r=Oa(),r!==e?f=k=[k,l,n,m,r]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(78===h.charCodeAt(g)?(l=vb,g++):(l=e,0===q&&d(wb)),l===e&&(110===h.charCodeAt(g)?(l=xb,g++):(l=e,0===q&&d(yb))),l!==e)if(79===h.charCodeAt(g)?(n=Se,g++):(n=e,0===q&&d(Te)),n===e&&(111===h.charCodeAt(g)?(n=
Ue,g++):(n=e,0===q&&d(Ve))),n!==e)if(84===h.charCodeAt(g)?(m=We,g++):(m=e,0===q&&d(Xe)),m===e&&(116===h.charCodeAt(g)?(m=Ye,g++):(m=e,0===q&&d(Ze))),m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();if(r!==e)if(73===h.charCodeAt(g)?(u=pc,g++):(u=e,0===q&&d(qc)),u===e&&(105===h.charCodeAt(g)?(u=rc,g++):(u=e,0===q&&d(sc))),u!==e)if(78===h.charCodeAt(g)?(x=vb,g++):(x=e,0===q&&d(wb)),x===e&&(110===h.charCodeAt(g)?(x=xb,g++):(x=e,0===q&&d(yb))),x!==e){y=[];for(v=t();v!==e;)y.push(v),v=t();y!==e?(v=Oa(),v!==
e?f=k=[k,l,n,m,r,u,x,y,v]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;else g=f,f=e}else g=f,f=e;else g=f,f=e;else g=f,f=e;else g=f,f=e}}}}}}}}if(a!==e){b=c;if(0===a.length)c=b;else if("i"===a[0][1]||"I"===a[0][1]||"n"===a[0][1]||"N"===a[0][1]){c={};"i"===a[0][1]||"I"===a[0][1]?(f="=",c.expressionType="conditionalor"):(f="!=",c.expressionType="conditionaland");k=[];for(l=0;l<a[0].length;l++)if("args"===a[0][l].token){k=a[0][l].value;break}c.token="expression";c.operands=[];for(a=0;a<k.length;a++)l=
{token:"expression",expressionType:"relationalexpression"},l.operator=f,l.op1=b,l.op2=k[a],c.operands.push(l)}else c={expressionType:"relationalexpression"},c.operator=a[0][1],c.op1=b,c.op2=a[0][3],c.token="expression";b=c}else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(ak);a=b;q--;a===e&&0===q&&d(bk);return a}function xa(){var a;q++;var b,c,f,k,l,n,m,r,u;q++;b=g;c=Bb();if(c!==e){a=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(43===h.charCodeAt(g)?(l=Ya,g++):(l=e,0===q&&d(Za)),l!==e){n=[];
for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Bb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(45===h.charCodeAt(g)?(l=Fa,g++):(l=e,0===q&&d(Ga)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Bb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e)if(f=g,k=Cb(),k===e&&(k=Cb()),k!==e){l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();if(n!==e)if(42===h.charCodeAt(g)?(m=Ja,g++):(m=e,0===q&&d(Ka)),
m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();r!==e?(u=Ha(),u!==e?l=n=[n,m,r,u]:(g=l,l=e)):(g=l,l=e)}else g=l,l=e;else g=l,l=e;if(l===e){l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();if(n!==e)if(47===h.charCodeAt(g)?(m=bb,g++):(m=e,0===q&&d(cb)),m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();r!==e?(u=Ha(),u!==e?l=n=[n,m,r,u]:(g=l,l=e)):(g=l,l=e)}else g=l,l=e;else g=l,l=e}l===e&&(l=null);l!==e?f=k=[k,l]:(g=f,f=e)}else g=f,f=e}for(;f!==e;){a.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(43===
h.charCodeAt(g)?(l=Ya,g++):(l=e,0===q&&d(Za)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Bb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(45===h.charCodeAt(g)?(l=Fa,g++):(l=e,0===q&&d(Ga)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Bb(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e)if(f=g,k=Cb(),k===e&&(k=Cb()),k!==e){l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();
if(n!==e)if(42===h.charCodeAt(g)?(m=Ja,g++):(m=e,0===q&&d(Ka)),m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();r!==e?(u=Ha(),u!==e?l=n=[n,m,r,u]:(g=l,l=e)):(g=l,l=e)}else g=l,l=e;else g=l,l=e;if(l===e){l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();if(n!==e)if(47===h.charCodeAt(g)?(m=bb,g++):(m=e,0===q&&d(cb)),m!==e){r=[];for(u=t();u!==e;)r.push(u),u=t();r!==e?(u=Ha(),u!==e?l=n=[n,m,r,u]:(g=l,l=e)):(g=l,l=e)}else g=l,l=e;else g=l,l=e}l===e&&(l=null);l!==e?f=k=[k,l]:(g=f,f=e)}else g=f,f=e}}if(a!==e){if(0!==
a.length){b={token:"expression",expressionType:"additiveexpression"};b.summand=c;b.summands=[];for(c=0;c<a.length;c++)k=a[c],f={},4==k.length&&"string"===typeof k[1]?(f.operator=k[1],f.expression=k[3]):(k={},l=f[0],n=f[1][1],m=f[1][3],n=null,0>l.value?(f.operator="-",l.value=-l.value):f.operator="+",k.token="expression",k.expressionType="multiplicativeexpression",k.operator=l,k.factors=[{operator:n,expression:m}],f.expression=k),b.summands.push(f);c=b}b=c}else g=b,b=e}else g=b,b=e;q--;b===e&&0===
q&&d(ck);a=b;q--;a===e&&0===q&&d(dk);return a}function Bb(){var a,b,c,f,k,l,n,m;q++;a=g;b=Ha();if(b!==e){c=[];f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(42===h.charCodeAt(g)?(l=Ja,g++):(l=e,0===q&&d(Ka)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Ha(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(47===h.charCodeAt(g)?(l=bb,g++):(l=e,0===q&&d(cb)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();
n!==e?(m=Ha(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e}for(;f!==e;){c.push(f);f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(42===h.charCodeAt(g)?(l=Ja,g++):(l=e,0===q&&d(Ka)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Ha(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e;if(f===e){f=g;k=[];for(l=t();l!==e;)k.push(l),l=t();if(k!==e)if(47===h.charCodeAt(g)?(l=bb,g++):(l=e,0===q&&d(cb)),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?
(m=Ha(),m!==e?f=k=[k,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e}}if(c!==e){if(0!==c.length){a={token:"expression",expressionType:"multiplicativeexpression"};a.factor=b;a.factors=[];for(b=0;b<c.length;b++)f=c[b],k={},k.operator=f[1],k.expression=f[3],a.factors.push(k);b=a}a=b}else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(ek);return a}function Ha(){var a,b,c;q++;a=g;33===h.charCodeAt(g)?(b=Tc,g++):(b=e,0===q&&d(Uc));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();c!==e?(b=hb(),b!==e?(a={token:"expression",
expressionType:"unaryexpression",unaryexpression:"!"},a.expression=b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;if(a===e){a=g;43===h.charCodeAt(g)?(b=Ya,g++):(b=e,0===q&&d(Za));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();c!==e?(b=hb(),b!==e?(a={token:"expression",expressionType:"unaryexpression",unaryexpression:"+"},a.expression=b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;if(a===e){a=g;45===h.charCodeAt(g)?(b=Fa,g++):(b=e,0===q&&d(Ga));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),b=t();c!==e?(b=hb(),b!==e?(a={token:"expression",
expressionType:"unaryexpression",unaryexpression:"-"},a.expression=b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;a===e&&(a=hb())}}q--;a===e&&0===q&&d(fk);return a}function hb(){var a;q++;a=Ec();if(a===e&&(a=Fc(),a===e)){var b,c,f;q++;b=g;a=la();if(a!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(f=Na(),f===e&&(f=null),f!==e?(b=f,c={token:"expression",expressionType:"irireforfunction"},c.iriref=a,c.args=null!=b?b.value:b,b=c):(g=b,b=e)):(g=b,b=e)}else g=b,b=e;q--;b===e&&0===q&&d(gk);a=b;if(a===e&&(a=Jb(),
a!==e&&(b={token:"expression",expressionType:"atomic",primaryexpression:"rdfliteral"},b.value=a,a=b),a===e&&(a=Kb(),a!==e&&(b={token:"expression",expressionType:"atomic",primaryexpression:"numericliteral"},b.value=a,a=b),a===e&&(a=Lb(),a!==e&&(b={token:"expression",expressionType:"atomic",primaryexpression:"booleanliteral"},b.value=a,a=b),a===e)))){var k,l,n,m,r,u,x,y,v;q++;c=g;h.substr(g,5)===$e?(a=$e,g+=5):(a=e,0===q&&d(hk));a===e&&(h.substr(g,5)===af?(a=af,g+=5):(a=e,0===q&&d(ik)));if(a!==e){a=
[];for(b=t();b!==e;)a.push(b),b=t();if(a!==e)if(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(42===h.charCodeAt(g)?(b=Ja,g++):(b=e,0===q&&d(Ka)),b===e&&(b=Q()),b!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&
d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",aggregateType:"count"},c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;if(c===e){c=g;h.substr(g,12)===bf?(a=bf,g+=12):(a=e,0===q&&d(jk));a===e&&(h.substr(g,12)===cf?(a=cf,g+=12):(a=e,0===q&&d(kk)));if(a!==e){a=[];for(b=t();b!==e;)a.push(b),b=t();if(a!==e)if(40===
h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Q(),b!==e){f=g;59===h.charCodeAt(g)?(k=La,g++):(k=e,0===q&&d(Ma));if(k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(h.substr(g,9)===df?(n=df,g+=9):(n=e,0===q&&d(lk)),n!==e){m=[];for(r=t();r!==e;)m.push(r),r=
t();if(m!==e)if(61===h.charCodeAt(g)?(r=kc,g++):(r=e,0===q&&d(lc)),r!==e){u=[];for(x=t();x!==e;)u.push(x),x=t();if(u!==e)if(x=od(),x!==e){y=[];for(v=t();v!==e;)y.push(v),v=t();y!==e?f=k=[k,l,n,m,r,u,x,y]:(g=f,f=e)}else g=f,f=e;else g=f,f=e}else g=f,f=e;else g=f,f=e}else g=f,f=e;else g=f,f=e}else g=f,f=e;f===e&&(f=null);if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",aggregateType:"group_concat"},
c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b,c.separator=f):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;if(c===e){c=g;h.substr(g,3)===ef?(a=ef,g+=3):(a=e,0===q&&d(mk));a===e&&(h.substr(g,3)===ff?(a=ff,g+=3):(a=e,0===q&&d(nk)));if(a!==e){a=[];for(b=t();b!==e;)a.push(b),b=t();if(a!==e)if(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===
na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Q(),b!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",aggregateType:"sum"},c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=
e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;if(c===e){c=g;h.substr(g,3)===gf?(a=gf,g+=3):(a=e,0===q&&d(ok));a===e&&(h.substr(g,3)===hf?(a=hf,g+=3):(a=e,0===q&&d(pk)));if(a!==e){a=[];for(b=t();b!==e;)a.push(b),b=t();if(a!==e)if(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=
[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Q(),b!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",aggregateType:"min"},c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;if(c===e){c=g;h.substr(g,3)===jf?(a=jf,
g+=3):(a=e,0===q&&d(qk));a===e&&(h.substr(g,3)===kf?(a=kf,g+=3):(a=e,0===q&&d(rk)));if(a!==e){a=[];for(b=t();b!==e;)a.push(b),b=t();if(a!==e)if(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Q(),b!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?
(k=T,g++):(k=e,0===q&&d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",aggregateType:"max"},c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;if(c===e)if(c=g,h.substr(g,3)===lf?(a=lf,g+=3):(a=e,0===q&&d(sk)),a===e&&(h.substr(g,3)===mf?(a=mf,g+=3):(a=e,0===q&&d(tk))),a!==e){a=[];for(b=t();b!==e;)a.push(b),b=t();
if(a!==e)if(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b!==e){b=[];for(a=t();a!==e;)b.push(a),a=t();if(b!==e)if(h.substr(g,8)===na?(a=na,g+=8):(a=e,0===q&&d(Ua)),a===e&&(h.substr(g,8)===oa?(a=oa,g+=8):(a=e,0===q&&d(Va))),a===e&&(a=null),a!==e){f=[];for(b=t();b!==e;)f.push(b),b=t();if(f!==e)if(b=Q(),b!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(41===h.charCodeAt(g)?(k=T,g++):(k=e,0===q&&d(U)),k!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(c={token:"expression",expressionType:"aggregate",
aggregateType:"avg"},c.distinct=""!=a&&null!=a?"DISTINCT":a,c.expression=b):(g=c,c=e)}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e;else g=c,c=e}else g=c,c=e}}}}q--;c===e&&0===q&&d(uk);a=c;a===e&&(a=ka(),a!==e&&(b={token:"expression",expressionType:"atomic",primaryexpression:"var"},b.value=a,a=b))}}q--;a===e&&0===q&&d(vk);return a}function Ec(){var a,b,c,f;q++;a=g;40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S));if(b!==e){c=[];for(b=t();b!==e;)c.push(b),
b=t();if(c!==e)if(b=Q(),b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(41===h.charCodeAt(g)?(f=T,g++):(f=e,0===q&&d(U)),f!==e?a=b:(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;q--;a===e&&0===q&&d(wk);return a}function Fc(){var a,b,c,f,k,l,n,m;q++;a=g;h.substr(g,3)===nf?(b=nf,g+=3):(b=e,0===q&&d(xk));b===e&&(h.substr(g,3)===of?(b=of,g+=3):(b=e,0===q&&d(yk)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=
t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"str"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,4)===pf?(b=pf,g+=4):(b=e,0===q&&d(zk));b===e&&(h.substr(g,4)===qf?(b=qf,g+=4):(b=e,0===q&&d(Ak)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===
h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"lang"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,11)===rf?(b=rf,g+=11):(b=e,0===q&&d(Bk));b===e&&(h.substr(g,11)===sf?(b=sf,g+=11):(b=e,0===q&&
d(Ck)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(44===h.charCodeAt(g)?(n=ha,g++):(n=e,0===q&&d(ia)),n!==e){m=[];for(f=t();f!==e;)m.push(f),f=t();if(m!==e)if(f=Q(),f!==e){c=[];for(n=t();n!==e;)c.push(n),n=t();c!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",
builtincall:"langmatches"},a.args=[b,f]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,8)===tf?(b=tf,g+=8):(b=e,0===q&&d(Dk));b===e&&(h.substr(g,8)===uf?(b=uf,g+=8):(b=e,0===q&&d(Ek)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),
n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"datatype"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,5)===vf?(b=vf,g+=5):(b=e,0===q&&d(Fk));b===e&&(h.substr(g,5)===wf?(b=wf,g+=5):(b=e,0===q&&d(Gk)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),
b=t();if(k!==e)if(b=ka(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"bound"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,3)===xf?(b=xf,g+=3):(b=e,0===q&&d(Hk));b===e&&(h.substr(g,3)===yf?(b=yf,g+=3):(b=e,0===q&&d(Ik)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?
(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"iri"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,3)===zf?(b=zf,g+=3):(b=e,0===q&&d(Jk));b===e&&(h.substr(g,3)===Af?(b=Af,g+=3):(b=e,0===q&&d(Kk)));if(b!==e){c=
[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"uri"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,5)===Bf?(b=Bf,g+=5):(b=e,0===q&&d(Lk));b===
e&&(h.substr(g,5)===Cf?(b=Cf,g+=5):(b=e,0===q&&d(Mk)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e){f=g;40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S));if(k!==e){b=[];for(l=t();l!==e;)b.push(l),l=t();if(b!==e)if(l=Q(),l!==e){n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(41===h.charCodeAt(g)?(m=T,g++):(m=e,0===q&&d(U)),m!==e?f=k=[k,b,l,n,m]:(g=f,f=e)):(g=f,f=e)}else g=f,f=e;else g=f,f=e}else g=f,f=e;f===e&&(f=Ia());f!==e?(b=f,a={token:"expression",expressionType:"builtincall",builtincall:"bnode"},
a.args=5===b.length?[b[2]]:null):(g=a,a=e)}else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,8)===Df?(b=Df,g+=8):(b=e,0===q&&d(Nk));b===e&&(h.substr(g,8)===Ef?(b=Ef,g+=8):(b=e,0===q&&d(Ok)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();c!==e?(f=Oa(),f!==e?(b={token:"expression",expressionType:"builtincall",builtincall:"coalesce"},b.args=f,a=b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;if(a===e){a=g;h.substr(g,2)===Ff?(b=Ff,g+=2):(b=e,0===q&&d(Pk));b===e&&(h.substr(g,2)===Gf?(b=Gf,g+=2):(b=e,0===q&&d(Qk)));
if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(44===h.charCodeAt(g)?(n=ha,g++):(n=e,0===q&&d(ia)),n!==e){m=[];for(f=t();f!==e;)m.push(f),f=t();if(m!==e)if(f=Q(),f!==e){c=[];for(n=t();n!==e;)c.push(n),n=t();if(c!==e)if(44===h.charCodeAt(g)?(n=ha,g++):(n=e,0===q&&d(ia)),n!==e){n=[];for(c=t();c!==e;)n.push(c),c=t();if(n!==
e)if(c=Q(),c!==e){n=[];for(l=t();l!==e;)n.push(l),l=t();n!==e?(41===h.charCodeAt(g)?(l=T,g++):(l=e,0===q&&d(U)),l!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"if"},a.args=[b,f,c]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,9)===Hf?(b=Hf,g+=9):(b=e,0===q&&d(Rk));b===e&&(h.substr(g,9)===If?(b=If,g+=9):(b=e,
0===q&&d(Sk)),b===e&&(h.substr(g,9)===Jf?(b=Jf,g+=9):(b=e,0===q&&d(Tk))));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"isliteral"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;
else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,7)===Kf?(b=Kf,g+=7):(b=e,0===q&&d(Uk));b===e&&(h.substr(g,7)===Lf?(b=Lf,g+=7):(b=e,0===q&&d(Vk)),b===e&&(h.substr(g,7)===Mf?(b=Mf,g+=7):(b=e,0===q&&d(Wk))));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",
expressionType:"builtincall",builtincall:"isblank"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,8)===Nf?(b=Nf,g+=8):(b=e,0===q&&d(Xk));b===e&&(h.substr(g,8)===Of?(b=Of,g+=8):(b=e,0===q&&d(Yk)));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(44===
h.charCodeAt(g)?(n=ha,g++):(n=e,0===q&&d(ia)),n!==e){m=[];for(f=t();f!==e;)m.push(f),f=t();if(m!==e)if(f=Q(),f!==e){c=[];for(n=t();n!==e;)c.push(n),n=t();c!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"sameterm"},a.args=[b,f]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,5)===Pf?(b=Pf,g+=5):(b=e,0===q&&
d(Zk));b===e&&(h.substr(g,5)===Qf?(b=Qf,g+=5):(b=e,0===q&&d($k)),b===e&&(h.substr(g,5)===Rf?(b=Rf,g+=5):(b=e,0===q&&d(al)),b===e&&(h.substr(g,5)===Sf?(b=Sf,g+=5):(b=e,0===q&&d(bl)),b===e&&(h.substr(g,5)===Tf?(b=Tf,g+=5):(b=e,0===q&&d(cl)),b===e&&(h.substr(g,5)===Uf?(b=Uf,g+=5):(b=e,0===q&&d(dl)))))));if(b!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){k=[];for(b=t();b!==e;)k.push(b),b=t();if(k!==e)if(b=Q(),b!==e){l=[];for(n=t();n!==e;)l.push(n),
n=t();l!==e?(41===h.charCodeAt(g)?(n=T,g++):(n=e,0===q&&d(U)),n!==e?(a={token:"expression",expressionType:"builtincall",builtincall:"isuri"},a.args=[b]):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e;if(a===e){a=g;h.substr(g,7)===Vf?(b=Vf,g+=7):(b=e,0===q&&d(el));b===e&&(h.substr(g,7)===Wf?(b=Wf,g+=7):(b=e,0===q&&d(fl)));if(b!==e){c=[];Xf.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(Yf));if(f!==e)for(;f!==e;)c.push(f),Xf.test(h.charAt(g))?(f=h.charAt(g),
g++):(f=e,0===q&&d(Yf));else c=e;if(c!==e){f=[];for(k=t();k!==e;)f.push(k),k=t();if(f!==e)if(40===h.charCodeAt(g)?(k=R,g++):(k=e,0===q&&d(S)),k!==e){b=[];l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Q(),m!==e?(44===h.charCodeAt(g)?(f=ha,g++):(f=e,0===q&&d(ia)),f!==e?l=n=[n,m,f]:(g=l,l=e)):(g=l,l=e)):(g=l,l=e);for(;l!==e;){b.push(l);l=g;n=[];for(m=t();m!==e;)n.push(m),m=t();n!==e?(m=Q(),m!==e?(44===h.charCodeAt(g)?(f=ha,g++):(f=e,0===q&&d(ia)),f!==e?l=n=[n,m,f]:(g=l,l=e)):(g=l,l=e)):(g=l,l=e)}if(b!==
e){l=[];for(n=t();n!==e;)l.push(n),n=t();if(l!==e)if(n=Q(),n!==e){m=[];for(f=t();f!==e;)m.push(f),f=t();if(m!==e)if(41===h.charCodeAt(g)?(f=T,g++):(f=e,0===q&&d(U)),f!==e){a=n;f={token:"expression",expressionType:"custom"};f.name=c.join("");c=[];for(n=0;n<b.length;n++)c.push(b[n][1]);c.push(a);f.args=c;a=f}else g=a,a=e;else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e;else g=a,a=e}else g=a,a=e}else g=a,a=e;if(a===e){q++;b=g;h.substr(g,5)===Zf?(a=Zf,g+=5):(a=e,0===q&&d(gl));a===e&&(h.substr(g,
5)===$f?(a=$f,g+=5):(a=e,0===q&&d(hl)));if(a!==e){a=[];for(f=t();f!==e;)a.push(f),f=t();if(a!==e)if(40===h.charCodeAt(g)?(f=R,g++):(f=e,0===q&&d(S)),f!==e){f=[];for(a=t();a!==e;)f.push(a),a=t();if(f!==e)if(a=Q(),a!==e){f=[];for(c=t();c!==e;)f.push(c),c=t();if(f!==e)if(44===h.charCodeAt(g)?(c=ha,g++):(c=e,0===q&&d(ia)),c!==e){c=[];for(f=t();f!==e;)c.push(f),f=t();if(c!==e)if(f=Q(),f!==e){n=[];for(c=t();c!==e;)n.push(c),c=t();if(n!==e){c=g;44===h.charCodeAt(g)?(n=ha,g++):(n=e,0===q&&d(ia));if(n!==e){l=
[];for(m=t();m!==e;)l.push(m),m=t();l!==e?(m=Q(),m!==e?c=n=[n,l,m]:(g=c,c=e)):(g=c,c=e)}else g=c,c=e;c===e&&(c=null);if(c!==e){n=[];for(l=t();l!==e;)n.push(l),l=t();n!==e?(41===h.charCodeAt(g)?(l=T,g++):(l=e,0===q&&d(U)),l!==e?(b=c,c={token:"expression",expressionType:"regex"},c.text=a,c.pattern=f,null!=b&&(c.flags=b[2]),b=c):(g=b,b=e)):(g=b,b=e)}else g=b,b=e}else g=b,b=e}else g=b,b=e;else g=b,b=e}else g=b,b=e;else g=b,b=e}else g=b,b=e;else g=b,b=e}else g=b,b=e;else g=b,b=e}else g=b,b=e;q--;b===e&&
0===q&&d(il);a=b;if(a===e){q++;b=g;h.substr(g,6)===tc?(a=tc,g+=6):(a=e,0===q&&d(ag));a===e&&(h.substr(g,6)===uc?(a=uc,g+=6):(a=e,0===q&&d(bg)));if(a!==e){f=[];for(a=t();a!==e;)f.push(a),a=t();f!==e?(a=X(),a!==e?(b={token:"expression",expressionType:"builtincall",builtincall:"exists"},b.args=[a]):(g=b,b=e)):(g=b,b=e)}else g=b,b=e;q--;b===e&&0===q&&d(jl);a=b;if(a===e){q++;b=g;h.substr(g,3)===cg?(a=cg,g+=3):(a=e,0===q&&d(kl));a===e&&(h.substr(g,3)===dg?(a=dg,g+=3):(a=e,0===q&&d(ll)));if(a!==e){a=[];
for(f=t();f!==e;)a.push(f),f=t();if(a!==e)if(h.substr(g,6)===tc?(f=tc,g+=6):(f=e,0===q&&d(ag)),f===e&&(h.substr(g,6)===uc?(f=uc,g+=6):(f=e,0===q&&d(bg))),f!==e){f=[];for(a=t();a!==e;)f.push(a),a=t();f!==e?(a=X(),a!==e?(b={token:"expression",expressionType:"builtincall",builtincall:"notexists"},b.args=[a]):(g=b,b=e)):(g=b,b=e)}else g=b,b=e;else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(ml);a=b}}}}}}}}}}}}}}}}}q--;a===e&&0===q&&d(nl);return a}function Jb(){var a,b,c,f,k;q++;a=g;b=od();if(b!==e){var l,
n,m,t;q++;c=g;64===h.charCodeAt(g)?(f=eg,g++):(f=e,0===q&&d(fg));if(f!==e){k=[];gg.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(hg));if(f!==e)for(;f!==e;)k.push(f),gg.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(hg));else k=e;if(k!==e){f=[];l=g;45===h.charCodeAt(g)?(n=Fa,g++):(n=e,0===q&&d(Ga));if(n!==e){m=[];vc.test(h.charAt(g))?(t=h.charAt(g),g++):(t=e,0===q&&d(wc));if(t!==e)for(;t!==e;)m.push(t),vc.test(h.charAt(g))?(t=h.charAt(g),g++):(t=e,0===q&&d(wc));else m=e;m!==e?l=n=[n,m]:
(g=l,l=e)}else g=l,l=e;for(;l!==e;)if(f.push(l),l=g,45===h.charCodeAt(g)?(n=Fa,g++):(n=e,0===q&&d(Ga)),n!==e){m=[];vc.test(h.charAt(g))?(t=h.charAt(g),g++):(t=e,0===q&&d(wc));if(t!==e)for(;t!==e;)m.push(t),vc.test(h.charAt(g))?(t=h.charAt(g),g++):(t=e,0===q&&d(wc));else m=e;m!==e?l=n=[n,m]:(g=l,l=e)}else g=l,l=e;f!==e?(c=k,c=f=0===f.length?("@"+c.join("")).toLowerCase():("@"+c.join("")+"-"+f[0][1].join("")).toLowerCase()):(g=c,c=e)}else g=c,c=e}else g=c,c=e;q--;c===e&&0===q&&d(ol);c===e&&(c=g,h.substr(g,
2)===ig?(f=ig,g+=2):(f=e,0===q&&d(pl)),f!==e?(k=la(),k!==e?c=f=[f,k]:(g=c,c=e)):(g=c,c=e));c===e&&(c=null);c!==e?(a=b,b=c,"string"===typeof b&&0<b.length?b={token:"literal",value:a.value,lang:b.slice(1),type:null}:null!=b&&"object"===typeof b?(b.shift(),b={token:"literal",value:a.value,lang:null,type:b[0]}):b={token:"literal",value:a.value,lang:null,type:null},a=b):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(ql);return a}function Kb(){var a;q++;q++;a=Ic();a===e&&(a=Hc(),a===e&&(a=jb()));q--;a===e&&
0===q&&d(rl);if(a===e){q++;var b;q++;a=g;43===h.charCodeAt(g)?(b=Ya,g++):(b=e,0===q&&d(Za));b!==e?(b=Ic(),b!==e?a=b=jg(b):(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(sl);a===e&&(q++,a=g,43===h.charCodeAt(g)?(b=Ya,g++):(b=e,0===q&&d(Za)),b!==e?(b=Hc(),b!==e?a=b=jg(b):(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(tl),a===e&&(q++,a=g,43===h.charCodeAt(g)?(b=Ya,g++):(b=e,0===q&&d(Za)),b!==e?(b=jb(),b!==e?(b.value="+"+b.value,a=b):(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(ul)));q--;a===e&&0===q&&d(vl);a===e&&(a=
Cb())}q--;a===e&&0===q&&d(wl);return a}function Cb(){var a;q++;var b;q++;a=g;45===h.charCodeAt(g)?(b=Fa,g++):(b=e,0===q&&d(Ga));b!==e?(b=Ic(),b!==e?a=b=ed(b):(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(xl);a===e&&(q++,a=g,45===h.charCodeAt(g)?(b=Fa,g++):(b=e,0===q&&d(Ga)),b!==e?(b=Hc(),b!==e?a=b=ed(b):(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(yl),a===e&&(q++,a=g,45===h.charCodeAt(g)?(b=Fa,g++):(b=e,0===q&&d(Ga)),b!==e?(b=jb(),b!==e?a=b=ed(b):(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(zl)));q--;a===e&&0===
q&&d(Al);return a}function Lb(){var a;q++;h.substr(g,4)===kg?(a=kg,g+=4):(a=e,0===q&&d(Bl));a===e&&(h.substr(g,4)===lg?(a=lg,g+=4):(a=e,0===q&&d(Cl)));a!==e&&(a={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#boolean",value:!0});a===e&&(h.substr(g,5)===mg?(a=mg,g+=5):(a=e,0===q&&d(Dl)),a===e&&(h.substr(g,5)===ng?(a=ng,g+=5):(a=e,0===q&&d(El))),a!==e&&(a={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#boolean",value:!1}));q--;a===e&&0===q&&d(Fl);return a}function od(){var a;
q++;var b,c;q++;a=g;h.substr(g,3)===xc?(b=xc,g+=3):(b=e,0===q&&d(og));if(b!==e){b=[];pg.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(qg));for(c===e&&(c=Ra());c!==e;)b.push(c),pg.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(qg)),c===e&&(c=Ra());b!==e?(h.substr(g,3)===xc?(c=xc,g+=3):(c=e,0===q&&d(og)),c!==e?a=b=Da(b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Gl);a!==e&&(a=yc(a));if(a===e){q++;a=g;h.substr(g,3)===zc?(b=zc,g+=3):(b=e,0===q&&d(rg));if(b!==e){b=[];sg.test(h.charAt(g))?
(c=h.charAt(g),g++):(c=e,0===q&&d(tg));for(c===e&&(c=Ra());c!==e;)b.push(c),sg.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(tg)),c===e&&(c=Ra());b!==e?(h.substr(g,3)===zc?(c=zc,g+=3):(c=e,0===q&&d(rg)),c!==e?a=b=Da(b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Hl);a!==e&&(a=yc(a));if(a===e){q++;a=g;39===h.charCodeAt(g)?(b=fd,g++):(b=e,0===q&&d(gd));if(b!==e){b=[];ug.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(vg));for(c===e&&(c=Ra());c!==e;)b.push(c),ug.test(h.charAt(g))?
(c=h.charAt(g),g++):(c=e,0===q&&d(vg)),c===e&&(c=Ra());b!==e?(39===h.charCodeAt(g)?(c=fd,g++):(c=e,0===q&&d(gd)),c!==e?a=b=Da(b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Il);a!==e&&(a=yc(a));if(a===e){q++;a=g;34===h.charCodeAt(g)?(b=wg,g++):(b=e,0===q&&d(xg));if(b!==e){b=[];yg.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(zg));for(c===e&&(c=Ra());c!==e;)b.push(c),yg.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(zg)),c===e&&(c=Ra());b!==e?(34===h.charCodeAt(g)?(c=wg,g++):(c=
e,0===q&&d(xg)),c!==e?a=b=Da(b):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Jl);a!==e&&(a=yc(a))}}}q--;a===e&&0===q&&d(Kl);return a}function la(){var a;q++;a=Mb();a!==e&&(a={token:"uri",prefix:null,suffix:null,value:a});if(a===e){q++;var b,c;q++;a=g;b=Gc();b!==e?(c=Je(),c!==e?a=b=[b,c]:(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(Ll);a!==e&&(a={token:"uri",prefix:a[0],suffix:a[1],value:null});a===e&&(a=Gc(),a!==e&&(a={token:"uri",prefix:a,suffix:"",value:null}));q--;a===e&&0===q&&d(Ml)}q--;
a===e&&0===q&&d(Nl);return a}function Mb(){var a,b,c;q++;a=g;60===h.charCodeAt(g)?(b=ad,g++):(b=e,0===q&&d(bd));if(b!==e){b=[];Ag.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(Bg));for(;c!==e;)b.push(c),Ag.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(Bg));b!==e?(62===h.charCodeAt(g)?(c=cd,g++):(c=e,0===q&&d(dd)),c!==e?a=b=b.join(""):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Ol);return a}function Gc(){var a,b,c;q++;a=g;var f,k;q++;b=g;c=pd();if(c!==e){f=[];k=Ac();k===e&&(46===
h.charCodeAt(g)?(k=pa,g++):(k=e,0===q&&d(qa)));for(;k!==e;)f.push(k),k=Ac(),k===e&&(46===h.charCodeAt(g)?(k=pa,g++):(k=e,0===q&&d(qa)));if(f!==e){if("."==f[f.length-1])throw Error("Wrong PN_PREFIX, cannot finish with '.'");b=c+=f.join("")}else g=b,b=e}else g=b,b=e;q--;b===e&&0===q&&d(Pl);b===e&&(b=null);b!==e?(58===h.charCodeAt(g)?(c=Fb,g++):(c=e,0===q&&d(Gb)),c!==e?a=b:(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(Ql);return a}function jb(){var a,b;q++;a=[];Z.test(h.charAt(g))?(b=h.charAt(g),g++):(b=
e,0===q&&d(aa));if(b!==e)for(;b!==e;)a.push(b),Z.test(h.charAt(g))?(b=h.charAt(g),g++):(b=e,0===q&&d(aa));else a=e;a!==e&&(b={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#integer"},b.value=Da(a),a=b);q--;a===e&&0===q&&d(Rl);return a}function Hc(){var a,b,c,f,k;q++;a=g;b=[];Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));if(c!==e)for(;c!==e;)b.push(c),Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));else b=e;if(b!==e)if(46===h.charCodeAt(g)?(c=pa,g++):(c=e,
0===q&&d(qa)),c!==e){f=[];Z.test(h.charAt(g))?(k=h.charAt(g),g++):(k=e,0===q&&d(aa));for(;k!==e;)f.push(k),Z.test(h.charAt(g))?(k=h.charAt(g),g++):(k=e,0===q&&d(aa));f!==e?(a={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#decimal"},a.value=Da([b,c,f])):(g=a,a=e)}else g=a,a=e;else g=a,a=e;if(a===e)if(a=g,46===h.charCodeAt(g)?(b=pa,g++):(b=e,0===q&&d(qa)),b!==e){c=[];Z.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(aa));if(f!==e)for(;f!==e;)c.push(f),Z.test(h.charAt(g))?(f=h.charAt(g),
g++):(f=e,0===q&&d(aa));else c=e;c!==e?(f={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#decimal"},f.value=Da([b,c]),a=f):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Sl);return a}function Ic(){var a,b,c,f,k;q++;a=g;b=[];Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));if(c!==e)for(;c!==e;)b.push(c),Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));else b=e;if(b!==e)if(46===h.charCodeAt(g)?(c=pa,g++):(c=e,0===q&&d(qa)),c!==e){f=[];Z.test(h.charAt(g))?(k=h.charAt(g),
g++):(k=e,0===q&&d(aa));for(;k!==e;)f.push(k),Z.test(h.charAt(g))?(k=h.charAt(g),g++):(k=e,0===q&&d(aa));f!==e?(k=Jc(),k!==e?(a={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#double"},a.value=Da([b,c,f,k])):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;else g=a,a=e;if(a===e){a=g;46===h.charCodeAt(g)?(b=pa,g++):(b=e,0===q&&d(qa));if(b!==e){c=[];Z.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(aa));if(f!==e)for(;f!==e;)c.push(f),Z.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(aa));
else c=e;c!==e?(f=Jc(),f!==e?(k={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#double"},k.value=Da([b,c,f]),a=k):(g=a,a=e)):(g=a,a=e)}else g=a,a=e;if(a===e){a=g;b=[];Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));if(c!==e)for(;c!==e;)b.push(c),Z.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(aa));else b=e;b!==e?(c=Jc(),c!==e?(f={token:"literal",lang:null,type:"http://www.w3.org/2001/XMLSchema#double"},f.value=Da([b,c]),a=f):(g=a,a=e)):(g=a,a=e)}}q--;a===e&&0===
q&&d(Tl);return a}function Jc(){var a,b,c,f,k;q++;a=g;Ul.test(h.charAt(g))?(b=h.charAt(g),g++):(b=e,0===q&&d(Vl));if(b!==e)if(Wl.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d(Xl)),c===e&&(c=null),c!==e){f=[];Z.test(h.charAt(g))?(k=h.charAt(g),g++):(k=e,0===q&&d(aa));if(k!==e)for(;k!==e;)f.push(k),Z.test(h.charAt(g))?(k=h.charAt(g),g++):(k=e,0===q&&d(aa));else f=e;f!==e?a=b=Da([b,c,f]):(g=a,a=e)}else g=a,a=e;else g=a,a=e;q--;a===e&&0===q&&d(Yl);return a}function Ra(){var a,b,c;q++;a=g;92===h.charCodeAt(g)?
(b=Cg,g++):(b=e,0===q&&d(Dg));b!==e?(Zl.test(h.charAt(g))?(c=h.charAt(g),g++):(c=e,0===q&&d($l)),c!==e?a=b=[b,c]:(g=a,a=e)):(g=a,a=e);q--;a===e&&0===q&&d(am);return a}function Ia(){var a,b,c;q++;a=g;40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S));if(b!==e){b=[];for(c=t();c!==e;)b.push(c),c=t();b!==e?(41===h.charCodeAt(g)?(c=T,g++):(c=e,0===q&&d(U)),c!==e?a=b={token:"triplesnodecollection",triplesContext:[],chainSubject:[{token:"uri",value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}]}:(g=a,
a=e)):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(bm);return a}function t(){var a;q++;cm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(dm));if(a===e&&(em.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(fm)),a===e&&(gm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(hm)),a===e&&(im.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(jm)),a===e)))){var b,c,f;q++;a=g;35===h.charCodeAt(g)?(b=Eg,g++):(b=e,0===q&&d(Fg));if(b!==e){c=[];Gg.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(Hg));
for(;f!==e;)c.push(f),Gg.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(Hg));c!==e?a=b=[b,c]:(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(km)}q--;a===e&&0===q&&d(lm);return a}function pd(){var a;q++;mm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(nm));a===e&&(om.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(pm)),a===e&&(qm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(rm)),a===e&&(sm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(tm)),a===e&&(um.test(h.charAt(g))?(a=h.charAt(g),
g++):(a=e,0===q&&d(vm)),a===e&&(wm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(xm)),a===e&&(ym.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(zm)),a===e&&(Am.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Bm)),a===e&&(Cm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Dm)),a===e&&(Em.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Fm)),a===e&&(Gm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Hm)),a===e&&(Im.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Jm)),a===
e&&(Km.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Lm)),a===e&&(Mm.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(Nm)))))))))))))));q--;a===e&&0===q&&d(Om);return a}function Eb(){var a;q++;a=pd();a===e&&(95===h.charCodeAt(g)?(a=Ig,g++):(a=e,0===q&&d(Jg)));q--;a===e&&0===q&&d(Pm);return a}function Ke(){var a,b,c,f;q++;a=g;b=Eb();b===e&&(Z.test(h.charAt(g))?(b=h.charAt(g),g++):(b=e,0===q&&d(aa)));if(b!==e){c=[];f=Eb();f===e&&(Z.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(aa)),f===
e&&(hd.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(id)),f===e&&(jd.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(kd)),f===e&&(ld.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(md))))));for(;f!==e;)c.push(f),f=Eb(),f===e&&(Z.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(aa)),f===e&&(hd.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(id)),f===e&&(jd.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(kd)),f===e&&(ld.test(h.charAt(g))?(f=h.charAt(g),g++):(f=e,0===q&&d(md))))));
c!==e?a=b+=c.join(""):(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Qm);return a}function Ac(){var a;q++;a=Eb();a===e&&(45===h.charCodeAt(g)?(a=Fa,g++):(a=e,0===q&&d(Ga)),a===e&&(Z.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(aa)),a===e&&(hd.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(id)),a===e&&(jd.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(kd)),a===e&&(ld.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(md)))))));q--;a===e&&0===q&&d(Rm);return a}function Je(){var a,b,c,
f;q++;a=g;b=Eb();b===e&&(Z.test(h.charAt(g))?(b=h.charAt(g),g++):(b=e,0===q&&d(aa)),b===e&&(58===h.charCodeAt(g)?(b=Fb,g++):(b=e,0===q&&d(Gb)),b===e&&(b=nd())));if(b!==e){c=[];f=Ac();f===e&&(46===h.charCodeAt(g)?(f=pa,g++):(f=e,0===q&&d(qa)),f===e&&(58===h.charCodeAt(g)?(f=Fb,g++):(f=e,0===q&&d(Gb)),f===e&&(f=nd())));for(;f!==e;)c.push(f),f=Ac(),f===e&&(46===h.charCodeAt(g)?(f=pa,g++):(f=e,0===q&&d(qa)),f===e&&(58===h.charCodeAt(g)?(f=Fb,g++):(f=e,0===q&&d(Gb)),f===e&&(f=nd())));c!==e?a=b+=(c||[]).join(""):
(g=a,a=e)}else g=a,a=e;q--;a===e&&0===q&&d(Sm);return a}function nd(){var a;q++;var b,c,f;q++;a=g;37===h.charCodeAt(g)?(b=Kg,g++):(b=e,0===q&&d(Lg));b!==e?(c=Mg(),c!==e?(f=Mg(),f!==e?a=b=[b,c,f]:(g=a,a=e)):(g=a,a=e)):(g=a,a=e);a!==e&&(a=a.join(""));q--;a===e&&0===q&&d(Tm);a===e&&(q++,a=g,92===h.charCodeAt(g)?(b=Cg,g++):(b=e,0===q&&d(Dg)),b!==e?(95===h.charCodeAt(g)?(b=Ig,g++):(b=e,0===q&&d(Jg)),b===e&&(126===h.charCodeAt(g)?(b=Um,g++):(b=e,0===q&&d(Vm)),b===e&&(46===h.charCodeAt(g)?(b=pa,g++):(b=
e,0===q&&d(qa)),b===e&&(45===h.charCodeAt(g)?(b=Fa,g++):(b=e,0===q&&d(Ga)),b===e&&(33===h.charCodeAt(g)?(b=Tc,g++):(b=e,0===q&&d(Uc)),b===e&&(36===h.charCodeAt(g)?(b=Le,g++):(b=e,0===q&&d(Me)),b===e&&(38===h.charCodeAt(g)?(b=Wm,g++):(b=e,0===q&&d(Xm)),b===e&&(39===h.charCodeAt(g)?(b=fd,g++):(b=e,0===q&&d(gd)),b===e&&(40===h.charCodeAt(g)?(b=R,g++):(b=e,0===q&&d(S)),b===e&&(41===h.charCodeAt(g)?(b=T,g++):(b=e,0===q&&d(U)),b===e&&(42===h.charCodeAt(g)?(b=Ja,g++):(b=e,0===q&&d(Ka)),b===e&&(43===h.charCodeAt(g)?
(b=Ya,g++):(b=e,0===q&&d(Za)),b===e&&(44===h.charCodeAt(g)?(b=ha,g++):(b=e,0===q&&d(ia)),b===e&&(59===h.charCodeAt(g)?(b=La,g++):(b=e,0===q&&d(Ma)),b===e&&(58===h.charCodeAt(g)?(b=Fb,g++):(b=e,0===q&&d(Gb)),b===e&&(61===h.charCodeAt(g)?(b=kc,g++):(b=e,0===q&&d(lc)),b===e&&(47===h.charCodeAt(g)?(b=bb,g++):(b=e,0===q&&d(cb)),b===e&&(63===h.charCodeAt(g)?(b=Vc,g++):(b=e,0===q&&d(Wc)),b===e&&(35===h.charCodeAt(g)?(b=Eg,g++):(b=e,0===q&&d(Fg)),b===e&&(64===h.charCodeAt(g)?(b=eg,g++):(b=e,0===q&&d(fg)),
b===e&&(37===h.charCodeAt(g)?(b=Kg,g++):(b=e,0===q&&d(Lg)))))))))))))))))))))),b!==e?a="\\"+b:(g=a,a=e)):(g=a,a=e),q--,a===e&&0===q&&d(Ym));q--;a===e&&0===q&&d(Zm);return a}function Mg(){var a;q++;Z.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(aa));a===e&&($m.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(an)),a===e&&(bn.test(h.charAt(g))?(a=h.charAt(g),g++):(a=e,0===q&&d(cn))));q--;a===e&&0===q&&d(dn);return a}c=void 0!==c?c:{};var e={},Ng={DOCUMENT:l},Og=l,ah=f("[1] QueryUnit"),$g=f("[2] Query"),
fh=f("[3] Prologue"),eh=f("[4] BaseDecl"),yd="BASE",ch=b("BASE",!1),zd="base",dh=b("base",!1),ih=f("[5] PrefixDecl"),Ad="PREFIX",gh=b("PREFIX",!1),Bd="prefix",hh=b("prefix",!1),Rg=f("[6] SelectQuery"),Ei=f("[7] SubSelect"),nh=f("[8] SelectClause"),Cd="SELECT",jh=b("SELECT",!1),Dd="select",kh=b("select",!1),na="DISTINCT",Ua=b("DISTINCT",!1),oa="distinct",Va=b("distinct",!1),Ed="REDUCED",lh=b("REDUCED",!1),Fd="reduced",mh=b("reduced",!1),R="(",S=b("(",!1),Wa="AS",Ub=b("AS",!1),Xa="as",Vb=b("as",!1),
T=")",U=b(")",!1),Ja="*",Ka=b("*",!1),Tg=f("[9] ConstructQuery"),Ob="CONSTRUCT",rd=b("CONSTRUCT",!1),Pb="construct",sd=b("construct",!1),Sa="WHERE",Qb=b("WHERE",!1),Ta="where",Rb=b("where",!1),Ba="{",Ca=b("{",!1),va="}",wa=b("}",!1),Vg=f("[10] DescribeQuery"),td="DESCRIBE",Ug=b("DESCRIBE",!1),Yg=f("[11] AskQuery"),ud="ASK",Wg=b("ASK",!1),vd="ask",Xg=b("ask",!1),sh=f("[12] DatasetClause"),Hd="FROM",oh=b("FROM",!1),Id="from",ph=b("from",!1),qh=f("[13] DefaultGraphClause"),rh=f("[14] NamedGraphClause"),
nb="NAMED",Lc=b("NAMED",!1),ob="named",Mc=b("named",!1),th=f("[15] SourceSelector"),uh=f("[16] WhereClause"),Eh=f("[17] SolutionModifier"),xh=f("[18] GroupClause"),Jd="GROUP",vh=b("GROUP",!1),Kd="group",wh=b("group",!1),Wb="BY",Ld=b("BY",!1),Xb="by",Md=b("by",!1),Fh=f("[19] GroupCondition"),zh=f("[20] HavingClause"),Nd="HAVING",yh=b("HAVING",!1),Gh=f("[21] HavingCondition"),Ch=f("[22] OrderClause"),Od="ORDER",Ah=b("ORDER",!1),Pd="order",Bh=b("order",!1),Lh=f("[23] OrderCondition"),Qd="ASC",Hh=b("ASC",
!1),Rd="asc",Ih=b("asc",!1),Sd="DESC",Jh=b("DESC",!1),Td="desc",Kh=b("desc",!1),Dh=f("[24] LimitOffsetClauses"),Oh=f("[25] LimitClause"),Ud="LIMIT",Mh=b("LIMIT",!1),Vd="limit",Nh=b("limit",!1),Rh=f("[26] OffsetClause"),Wd="OFFSET",Ph=b("OFFSET",!1),Xd="offset",Qh=b("offset",!1),Qg=f("[27] BindingsClause"),qd="BINDINGS",Pg=b("BINDINGS",!1),Sh=f("[28] BindingValue"),Yb="UNDEF",Yd=b("UNDEF",!1),Zg=f("[28]\tValuesClause\t ::=\t( 'VALUES' DataBlock )?"),Sb="VALUES",wd=b("VALUES",!1),Tb="values",xd=b("values",
!1),bh=f("[29] UpdateUnit"),oi=f("[30] Update"),La=";",Ma=b(";",!1),ni=f("[31] Update1"),Xh=f("[32] Load"),Zd="LOAD",Th=b("LOAD",!1),$d="load",Uh=b("load",!1),ae="INTO",Vh=b("INTO",!1),be="into",Wh=b("into",!1),$h=f("[33] Clear"),ce="CLEAR",Yh=b("CLEAR",!1),de="clear",Zh=b("clear",!1),pb="SILENT",Nc=b("SILENT",!1),qb="silent",Oc=b("silent",!1),ci=f("[34] Drop"),ee="DROP",ai=b("DROP",!1),fe="drop",bi=b("drop",!1),fi=f("[35] Create"),ge="CREATE",di=b("CREATE",!1),he="create",ei=b("create",!1),gi=f("[36] InsertData"),
Zb="INSERT",ie=b("INSERT",!1),$b="insert",je=b("insert",!1),ac="DATA",ke=b("DATA",!1),bc="data",le=b("data",!1),hi=f("[37] DeleteData"),rb="DELETE",Pc=b("DELETE",!1),sb="delete",Qc=b("delete",!1),ii=f("[38] DeleteWhere"),mi=f("[39] Modify"),me="WITH",ji=b("WITH",!1),ne="with",ki=b("with",!1),li=f("[40] DeleteClause"),pi=f("[41] InsertClause"),si=f("[42] UsingClause"),oe="USING",qi=b("USING",!1),pe="using",ri=b("using",!1),ti=f("[43] GraphRef"),tb="GRAPH",Rc=b("GRAPH",!1),ub="graph",Sc=b("graph",!1),
yi=f("[44] GraphRefAll"),qe="DEFAULT",ui=b("DEFAULT",!1),re="default",vi=b("default",!1),se="ALL",wi=b("ALL",!1),te="all",xi=b("all",!1),zi=f("[45] QuadPattern"),Ai=f("[46] QuadData"),Bi=f("[47] Quads"),pa=".",qa=b(".",!1),Ci=f("[48] QuadsNotTriples"),Di=f("[49] TriplesTemplate"),Gi=f("[50] GroupGraphPattern"),Fi=f("[51] GroupGraphPatternSub"),Ki=f("[54] TriplesBlock"),bj=f("[53] GraphPatternNotTriples"),Oi=f("[54] OptionalGraphPattern"),we="OPTIONAL",Mi=b("OPTIONAL",!1),xe="optional",Ni=b("optional",
!1),Si=f("[55] GraphGraphPattern"),Ui=f("[56] ServiceGraphPattern"),Ae="SERVICE",Ti=b("SERVICE",!1),Ri=f("[57] MinusGraphPattern"),ye="MINUS",Pi=b("MINUS",!1),ze="minus",Qi=b("minus",!1),Li=f("[58] GroupOrUnionGraphPattern"),cc="UNION",ue=b("UNION",!1),dc="union",ve=b("union",!1),Xi=f("[59] Filter"),Be="FILTER",Vi=b("FILTER",!1),Ce="filter",Wi=b("filter",!1),$i=f("[60] Bind"),De="BIND",Yi=b("BIND",!1),Ee="bind",Zi=b("bind",!1),cj=f("[60] Constraint"),aj=f("[61] InlineData"),fj=f("[62] DataBlock"),
dj=f("[63] InlineDataOneVar"),ej=f("[64] InlineDataFull"),gj=f("[65] DataBlockValue"),hj=f("[61] FunctionCall"),ij=f("[62] ArgList"),ha=",",ia=b(",",!1),jj=f("[63] ExpressionList"),Sg=f("[64] ConstructTemplate"),kj=f("[65] ConstructTriples"),mj=f("[66] TriplesSameSubject"),Hi=f("[83] PropertyListPathNotEmpty"),nj=f("[67] PropertyListNotEmpty"),lj=f("[68] PropertyList"),oj=f("[86] ObjectListPath"),pj=f("[69] ObjectList"),qj=f("[87] ObjectPath"),rj=f("[70] Object"),sj=f("[71] Verb"),ec="a",fc=b("a",
!1),Fe=function(){return{token:"uri",prefix:null,suffix:null,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}},Ji=f("[72] TriplesSameSubjectPath"),tj=f("[73] PropertyListNotEmptyPath"),Ii=f("[74] PropertyListPath"),uj=f("[75]"),vj=f("[76] VerbSimple"),xj=f("[77] Path"),wj=f("[78] PathAlternative"),gc="|",hc=b("|",!1),yj=f("[79] PathSequence"),bb="/",cb=b("/",!1),Bj=f("[88] PathElt"),Cj=f("[81] PathEltOrInverse"),Ge="^",He=b("^",!1),Aj=f("[82] PathMod"),Vc="?",Wc=b("?",!1),Ya="+",Za=b("+",
!1),zj=f("[83] PathPrimary"),Tc="!",Uc=b("!",!1),Dj=f("[85] PathOneInPropertySet"),Ej=f("[86] Integer"),Hj=f("[100] TriplesNodePath"),Kj=f("[87] TriplesNode"),Gj=f("[101] BlankNodePropertyListPath"),Xc="[",Yc=b("[",!1),Zc="]",$c=b("]",!1),Jj=f("[88] BlankNodePropertyList"),Fj=f("[103] CollectionPath"),Ij=f("[89] Collection"),Lj=f("[105] GraphNodePath"),Mj=f("[90] GraphNode"),Sj=f("[91] VarOrTerm"),Tj=f("[92] VarOrIRIref"),Wj=f("[93] Var"),Rj=f("[94] GraphTerm"),Yj=f("[95] Expression"),Xj=f("[96] ConditionalOrExpression"),
ic="||",Ne=b("||",!1),Zj=f("[97] ConditionalAndExpression"),jc="&&",Oe=b("&&",!1),bk=f("[98] ValueLogical"),ak=f("[99] RelationalExpression"),kc="=",lc=b("=",!1),mc="!=",Pe=b("!=",!1),ad="<",bd=b("<",!1),cd=">",dd=b(">",!1),nc="<=",Qe=b("<=",!1),oc=">=",Re=b(">=",!1),pc="I",qc=b("I",!1),rc="i",sc=b("i",!1),vb="N",wb=b("N",!1),xb="n",yb=b("n",!1),Se="O",Te=b("O",!1),Ue="o",Ve=b("o",!1),We="T",Xe=b("T",!1),Ye="t",Ze=b("t",!1),dk=f("[100] NumericExpression"),ck=f("[101] AdditiveExpression"),Fa="-",Ga=
b("-",!1),ek=f("[102] MultiplicativeExpression"),fk=f("[103] UnaryExpression"),vk=f("[104] PrimaryExpression"),wk=f("[105] BrackettedExpression"),nl=f("[106] BuiltInCall"),nf="STR",xk=b("STR",!1),of="str",yk=b("str",!1),pf="LANG",zk=b("LANG",!1),qf="lang",Ak=b("lang",!1),rf="LANGMATCHES",Bk=b("LANGMATCHES",!1),sf="langmatches",Ck=b("langmatches",!1),tf="DATATYPE",Dk=b("DATATYPE",!1),uf="datatype",Ek=b("datatype",!1),vf="BOUND",Fk=b("BOUND",!1),wf="bound",Gk=b("bound",!1),xf="IRI",Hk=b("IRI",!1),yf=
"iri",Ik=b("iri",!1),zf="URI",Jk=b("URI",!1),Af="uri",Kk=b("uri",!1),Bf="BNODE",Lk=b("BNODE",!1),Cf="bnode",Mk=b("bnode",!1),Df="COALESCE",Nk=b("COALESCE",!1),Ef="coalesce",Ok=b("coalesce",!1),Ff="IF",Pk=b("IF",!1),Gf="if",Qk=b("if",!1),Hf="ISLITERAL",Rk=b("ISLITERAL",!1),If="isliteral",Sk=b("isliteral",!1),Jf="isLITERAL",Tk=b("isLITERAL",!1),Kf="ISBLANK",Uk=b("ISBLANK",!1),Lf="isblank",Vk=b("isblank",!1),Mf="isBLANK",Wk=b("isBLANK",!1),Nf="SAMETERM",Xk=b("SAMETERM",!1),Of="sameterm",Yk=b("sameterm",
!1),Pf="ISURI",Zk=b("ISURI",!1),Qf="isuri",$k=b("isuri",!1),Rf="isURI",al=b("isURI",!1),Sf="ISIRI",bl=b("ISIRI",!1),Tf="isiri",cl=b("isiri",!1),Uf="isIRI",dl=b("isIRI",!1),Vf="custom:",el=b("custom:",!1),Wf="CUSTOM:",fl=b("CUSTOM:",!1),Xf=/^[a-zA-Z0-9_]/,Yf=a([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),il=f("[107] RegexExpression"),Zf="REGEX",gl=b("REGEX",!1),$f="regex",hl=b("regex",!1),jl=f("[108] ExistsFunc"),tc="EXISTS",ag=b("EXISTS",!1),uc="exists",bg=b("exists",!1),ml=f("[109] NotExistsFunc"),
cg="NOT",kl=b("NOT",!1),dg="not",ll=b("not",!1),uk=f("[110] Aggregate"),$e="COUNT",hk=b("COUNT",!1),af="count",ik=b("count",!1),bf="GROUP_CONCAT",jk=b("GROUP_CONCAT",!1),cf="group_concat",kk=b("group_concat",!1),df="SEPARATOR",lk=b("SEPARATOR",!1),ef="SUM",mk=b("SUM",!1),ff="sum",nk=b("sum",!1),gf="MIN",ok=b("MIN",!1),hf="min",pk=b("min",!1),jf="MAX",qk=b("MAX",!1),kf="max",rk=b("max",!1),lf="AVG",sk=b("AVG",!1),mf="avg",tk=b("avg",!1),gk=f("[117] IRIrefOrFunction"),ql=f("[112] RDFLiteral"),ig="^^",
pl=b("^^",!1),wl=f("[113] NumericLiteral"),rl=f("[114] NumericLiteralUnsigned"),vl=f("[115] NumericLiteralPositive"),Al=f("[116] NumericLiteralNegative"),Fl=f("[117] BooleanLiteral"),kg="TRUE",Bl=b("TRUE",!1),lg="true",Cl=b("true",!1),mg="FALSE",Dl=b("FALSE",!1),ng="false",El=b("false",!1),Kl=f("[118] String"),yc=function(a){return{token:"string",value:a}},Nl=f("[119] IRIref"),Ml=f("[120] PrefixedName"),Qj=f("[121] BlankNode"),Ol=f("[122] IRI_REF"),Ag=/^[^<>"{}|\^`\\]/,Bg=a('<>"{}|^`\\'.split(""),
!0,!1),Ql=f("[123] PNAME_NS"),Fb=":",Gb=b(":",!1),Ll=f("[124] PNAME_LN"),Oj=f("[125] BLANK_NODE_LABEL"),Ie="_:",Nj=b("_:",!1),Uj=f("[126] VAR1"),Vj=f("[127] VAR2"),Le="$",Me=b("$",!1),ol=f("[128] LANGTAG"),eg="@",fg=b("@",!1),gg=/^[a-zA-Z]/,hg=a([["a","z"],["A","Z"]],!1,!1),vc=/^[a-zA-Z0-9]/,wc=a([["a","z"],["A","Z"],["0","9"]],!1,!1),Rl=f("[129] INTEGER"),Z=/^[0-9]/,aa=a([["0","9"]],!1,!1),Sl=f("[130] DECIMAL"),Tl=f("[131] DOUBLE"),ul=f("[132] INTEGER_POSITIVE"),tl=f("[133] DECIMAL_POSITIVE"),jg=
function(a){a.value="+"+a.value;return a},sl=f("[134] DOUBLE_POSITIVE"),zl=f("[135] INTEGER_NEGATIVE"),ed=function(a){a.value="-"+a.value;return a},yl=f("[136] DECIMAL_NEGATIVE"),xl=f("[137] DOUBLE_NEGATIVE"),Yl=f("[138] EXPONENT"),Ul=/^[eE]/,Vl=a(["e","E"],!1,!1),Wl=/^[+\-]/,Xl=a(["+","-"],!1,!1),Il=f("[139] STRING_LITERAL1"),fd="'",gd=b("'",!1),ug=/^[^'\\\n\r]/,vg=a(["'","\\","\n","\r"],!0,!1),Jl=f("[140] STRING_LITERAL2"),wg='"',xg=b('"',!1),yg=/^[^"\\\n\r]/,zg=a(['"',"\\","\n","\r"],!0,!1),Gl=
f("[141] STRING_LITERAL_LONG1"),xc="'''",og=b("'''",!1),pg=/^[^'\\]/,qg=a(["'","\\"],!0,!1),Hl=f("[142] STRING_LITERAL_LONG2"),zc='"""',rg=b('"""',!1),sg=/^[^"\\]/,tg=a(['"',"\\"],!0,!1),am=f("[143] ECHAR"),Cg="\\",Dg=b("\\",!1),Zl=/^[tbnrf"']/,$l=a("tbnrf\"'".split(""),!1,!1),bm=f("[144] NIL"),lm=f("[145] WS"),cm=/^[ ]/,dm=a([" "],!1,!1),em=/^[\t]/,fm=a(["\t"],!1,!1),gm=/^[\r]/,hm=a(["\r"],!1,!1),im=/^[\n]/,jm=a(["\n"],!1,!1),km=f(" COMMENT"),Eg="#",Fg=b("#",!1),Gg=/^[^\n\r]/,Hg=a(["\n","\r"],!0,
!1),Pj=f("[146] ANON"),Om=f("[147] PN_CHARS_BASE"),mm=/^[A-Z]/,nm=a([["A","Z"]],!1,!1),om=/^[a-z]/,pm=a([["a","z"]],!1,!1),qm=/^[\xC0-\xD6]/,rm=a([["\u00c0","\u00d6"]],!1,!1),sm=/^[\xD8-\xF6]/,tm=a([["\u00d8","\u00f6"]],!1,!1),um=/^[\xF8-\u02FF]/,vm=a([["\u00f8","\u02ff"]],!1,!1),wm=/^[\u0370-\u037D]/,xm=a([["\u0370","\u037d"]],!1,!1),ym=/^[\u037F-\u1FFF]/,zm=a([["\u037f","\u1fff"]],!1,!1),Am=/^[\u200C-\u200D]/,Bm=a([["\u200c","\u200d"]],!1,!1),Cm=/^[\u2070-\u218F]/,Dm=a([["\u2070","\u218f"]],!1,
!1),Em=/^[\u2C00-\u2FEF]/,Fm=a([["\u2c00","\u2fef"]],!1,!1),Gm=/^[\u3001-\uD7FF]/,Hm=a([["\u3001","\ud7ff"]],!1,!1),Im=/^[\uF900-\uFDCF]/,Jm=a([["\uf900","\ufdcf"]],!1,!1),Km=/^[\uFDF0-\uFFFD]/,Lm=a([["\ufdf0","\ufffd"]],!1,!1),Mm=/^[\u1000-\uEFFF]/,Nm=a([["\u1000","\uefff"]],!1,!1),Pm=f("[148] PN_CHARS_U"),Ig="_",Jg=b("_",!1),Qm=f("[149] VARNAME"),hd=/^[\xB7]/,id=a(["\u00b7"],!1,!1),jd=/^[\u0300-\u036F]/,kd=a([["\u0300","\u036f"]],!1,!1),ld=/^[\u203F-\u2040]/,md=a([["\u203f","\u2040"]],!1,!1),Rm=
f("[150] PN_CHARS"),Pl=f("[151] PN_PREFIX"),Sm=f("[152] PN_LOCAL"),Zm=f("[170] PLX"),Tm=f("[171] PERCENT"),Kg="%",Lg=b("%",!1),dn=f("[172] HEX"),$m=/^[A-F]/,an=a([["A","F"]],!1,!1),bn=/^[a-f]/,cn=a([["a","f"]],!1,!1),Ym=f("[173] PN_LOCAL_ESC"),Um="~",Vm=b("~",!1),Wm="&",Xm=b("&",!1),g=0,Nb=[{line:1,column:1}],Ea=0,Kc=[],q=0,Bc;if("startRule"in c){if(!(c.startRule in Ng))throw Error("Can't start parsing from rule \""+c.startRule+'".');Og=Ng[c.startRule]}var Da=function(a){for(var b="",c=0;c<a.length;c++)b=
"string"===typeof a[c]?b+a[c]:b+a[c].join("");return b},ra=0,Gd=function(a){var b="";if(null==a)return null;for(var c=0;c<a.length;c++)b+=a[c];return b.toUpperCase()};Bc=Og();if(Bc!==e&&g===h.length)return Bc;Bc!==e&&g<h.length&&d({type:"end"});throw function(a,b,c){return new v(v.buildMessage(a,b),a,b,c)}(Kc,Ea<h.length?h.charAt(Ea):null,Ea<h.length?r(Ea,Ea+1):r(Ea,Ea));}}}()},{}],47:[function(z,B,C){z("./btree");var v=z("./utils"),h=z("./lexicon").Lexicon;PersistentLexicon=function(c,b){var a=this;
v.registerIndexedDB(a);this.defaultGraphOid=0;this.defaultGraphUri="https://github.com/antoniogarrote/rdfstore-js#default_graph";this.defaultGraphUriTerm={token:"uri",prefix:null,suffix:null,value:this.defaultGraphUri};this.oidCounter=1;a.dbName=b||"rdfstorejs";var f=a.indexedDB.open(this.dbName+"_lexicon",1);f.onerror=function(a){c(null,Error("Error opening IndexedDB: "+a.target.errorCode))};f.onsuccess=function(b){a.db=b.target.result;c(a)};f.onupgradeneeded=function(b){a.db=b.target.result;a.db.createObjectStore("knownGraphs",
{keyPath:"oid"}).createIndex("uriToken","uriToken",{unique:!0});a.db.createObjectStore("components",{keyPath:"id",autoIncrement:!0}).createIndex("value","value",{unique:!0})}};PersistentLexicon.prototype.registerGraph=function(c,b,a){if(c!=this.defaultGraphOid){var f=this.db.transaction(["knownGraphs"],"readwrite");f.onerror=function(b){a(null,Error(b.target.statusCode))};var h=f.objectStore("knownGraphs");h.get(b).onsuccess=function(f){f.target.result?a(!0):h.add({oid:c,uriToken:b}).onsuccess=function(b){a(!0)}}}else a()};
PersistentLexicon.prototype.registeredGraphs=function(c,b){var a=[],f=this.db.transaction(["knownGraphs"],"readwrite").objectStore("knownGraphs").openCursor();f.onsuccess=function(f){(f=f.target.result)?(!0===c?a.push(f.value.uriToken):a.push(f.value.oid),f.continue()):b(a)};f.onerror=function(a){b(null,Error("Error retrieving data from the cursor: "+a.target.errorCode))}};PersistentLexicon.prototype.registerUri=function(c,b){if(c===this.defaultGraphUri)b(this.defaultGraphOid);else{var a=this.db.transaction(["components"],
"readwrite").objectStore("components"),f=a.index("value").get("_u:"+c);f.onsuccess=function(f){if(f=f.target.result){f.counter++;var h=f.id;f=a.put(f);f.onsuccess=function(a){b(h)};f.onerror=function(a){b(null,Error("Error updating the URI data"+a.target.errorCode))}}else f=a.add({value:"_u:"+c,counter:0,uri:!0}),f.onsuccess=function(a){b(a.target.result)},f.onerror=function(a){b(null,Error("Error inserting the URI data"+a.target.errorCode))}};f.onerror=function(a){b(null,Error("Error retrieving the URI data"+
a.target.errorCode))}}};PersistentLexicon.prototype.resolveUri=function(c,b){if(c===this.defaultGraphUri)b(this.defaultGraphOid);else{var a=this.db.transaction(["components"]).objectStore("components").index("value").get("_u:"+c);a.onsuccess=function(a){null!=a.target.result?b(a.target.result.id):b(-1)};a.onerror=function(a){b(null,Error("Error retrieving uri data "+a.target.errorCode))}}};PersistentLexicon.prototype.resolveUriCost=function(c,b){if(c===this.defaultGraphUri)b(0);else{var a=that.db.transaction(["components"]).objectStore("components").index("value").get("_u:"+
c);a.onsuccess=function(a){null!=a.target.result?b(a.target.result.cost):b(-1)};a.onerror=function(a){b(null,Error("Error retrieving uri data "+a.target.errorCode))}}};PersistentLexicon.prototype.registerBlank=function(c){var b=guid(),b=this.db.transaction(["components"],"readwrite").objectStore("components").add({value:"_b:"+b,counter:0,label:!0});b.onsuccess=function(a){c(a.target.result)};b.onerror=function(a){c(null,Error("Error inserting the URI data"+a.target.errorCode))}};PersistentLexicon.prototype.resolveBlankCost=
function(c,b){b(0)};PersistentLexicon.prototype.registerLiteral=function(c,b){var a=this.db.transaction(["components"],"readwrite").objectStore("components"),f=a.index("value").get("_l:"+c);f.onsuccess=function(f){if(f=f.target.result){f.counter++;var h=f.id;f=a.put(f);f.onsuccess=function(a){b(h)};f.onerror=function(a){b(null,Error("Error updating the literal data"+a.target.errorCode))}}else f=a.add({value:"_l:"+c,counter:0,literal:!0}),f.onsuccess=function(a){b(a.target.result)},f.onerror=function(a){b(null,
Error("Error inserting the literal data"+a.target.errorCode))}};f.onerror=function(a){b(null,Error("Error retrieving the literal data"+a.target.errorCode))}};PersistentLexicon.prototype.resolveLiteral=function(c,b){var a=that.db.transaction(["components"]).objectStore("components").index("value").get("_l:"+c);a.onsuccess=function(a){null!=a.target.result?b(a.target.result.id):b(-1)};a.onerror=function(a){b(null,Error("Error retrieving literal data "+a.target.errorCode))}};PersistentLexicon.prototype.resolveLiteralCost=
function(c,b){var a=that.db.transaction(["components"]).objectStore("components").index("components").get(c);a.onsuccess=function(a){null!=a.target.result?b(a.target.result.cost):b(-1)};a.onerror=function(a){b(null,Error("Error retrieving literal data "+a.target.errorCode))}};PersistentLexicon.prototype.parseLiteral=function(c){return h.prototype.parseLiteral(c)};PersistentLexicon.prototype.parseUri=function(c){return h.prototype.parseUri(c)};PersistentLexicon.prototype.retrieve=function(c,b){var a=
this,f;c===this.defaultGraphOid?b({token:"uri",value:this.defaultGraphUri,prefix:null,suffix:null,defaultGraph:!0}):(f=a.db.transaction(["components"]),f=f.objectStore("components").get(c),f.onsuccess=function(c){null!=c.target.result?null!=c.target.result.label?b({token:"blank",value:"_:"+c.target.result.id}):null!=c.target.result.uri?b(a.parseUri(c.target.result.value.slice(3,c.target.result.value.length))):null!=c.target.result.literal?b(a.parseLiteral(c.target.result.value.slice(3,c.target.result.value.length))):
(console.log(c.target.result),b(null,Error("Unknown type of component "+c.target.result))):b(null,null)},f.onerror=function(a){b(null,Error("Error searching in blanks data "+a.target.errorCode))})};PersistentLexicon.prototype.clear=function(c){this.defaultGraphOid=0;this.defaultGraphUri="https://github.com/antoniogarrote/rdfstore-js#default_graph";this.defaultGraphUriTerm={token:"uri",prefix:null,suffix:null,value:this.defaultGraphUri};var b,a=function(){null!=c&&c()};b=this.db.transaction(["components"],
"readwrite").objectStore("components").clear();b.onsuccess=a;b.onerror=a};PersistentLexicon.prototype.unregister=function(c,b,a){var f=this;v.seq(function(a){f._unregisterTerm(c.subject.token,b.subject,a)},function(a){f._unregisterTerm(c.predicate.token,b.predicate,a)},function(a){f._unregisterTerm(c.object.token,b.object,a)},function(a){null!=c.graph?f._unregisterTerm(c.graph.token,b.graph,a):a()})(function(){a(!0)})};PersistentLexicon.prototype._unregisterTerm=function(c,b,a){var f=this.db.transaction(["components",
"knownGraphs"],"readwrite");"uri"===c?b!=this.defaultGraphOid?(c=f.objectStore("components").delete(b),c.onsuccess=function(){f.objectStore("knownGraphs").delete(b).onsuccess=function(){a()}}()):a():(c=f.objectStore("components").delete(b),c.onsuccess=function(){a()})};B.exports={PersistentLexicon:PersistentLexicon}},{"./btree":40,"./lexicon":44,"./utils":57}],48:[function(z,B,C){var v=z("./utils");PersistentQuadBackend=function(h,c){var b=this;if(0!==arguments){v.registerIndexedDB(b);this.indexMap=
{};this.indices="S P O G SP SO SG PO PG OG SPO SPG SOG POG SPOG".split(" ");this.componentOrders={S:["subject","predicate","object","graph"],P:["predicate","subject","object","graph"],O:["object","subject","predicate","graph"],G:["graph","subject","predicate","object"],SP:["subject","predicate","object","graph"],SO:["subject","object","predicate","graph"],SG:["subject","graph","predicate","object"],PO:["predicate","object","subject","graph"],PG:["predicate","graph","subject","object"],OG:["object",
"graph","subject","predicate"],SPO:["subject","predicate","object","graph"],SPG:["subject","predicate","graph","object"],SOG:["subject","object","graph","predicate"],POG:["predicate","object","graph","subject"],SPOG:["subject","predicate","object","graph"]};this.componentOrdersMap={};for(var a in this.componentOrders){var f=this.componentOrders[a].slice(0,a.length).sort().join(".");this.componentOrdersMap[f]=a}b.dbName=h.name||"rdfstorejs";a=b.indexedDB.open(this.dbName+"_db",1);a.onerror=function(a){c(null,
Error("Error opening IndexedDB: "+a.target.errorCode))};a.onsuccess=function(a){b.db=a.target.result;c(b)};a.onupgradeneeded=function(a){var c=a.target.result.createObjectStore(b.dbName,{keyPath:"SPOG"});v.each(b.indices,function(a){"SPOG"!==a&&c.createIndex(a,a,{unique:!1})})}}};PersistentQuadBackend.prototype.index=function(h,c){var b=this;v.each(this.indices,function(a){h[a]=b._genMinIndexKey(h,a)});var a=b.db.transaction([b.dbName],"readwrite");a.oncomplete=function(a){};a.onerror=function(a){c(null,
Error(a.target.statusCode))};a.objectStore(b.dbName).add(h).onsuccess=function(a){c(!0)}};PersistentQuadBackend.prototype.range=function(h,c){var b=this.db.transaction([this.dbName]).objectStore(this.dbName),a=this._indexForPattern(h),f=this._genMinIndexKey(h,a),k=this._genMaxIndexKey(h,a),f=this.IDBKeyRange.bound(f,k,!1,!1),r=[];("SPOG"===a?b:b.index(a)).openCursor(f).onsuccess=function(a){(a=a.target.result)?(r.push(a.value),a.continue()):c(r)}};PersistentQuadBackend.prototype.search=function(h,
c){var b=this.db.transaction([this.dbName]).objectStore(this.dbName),a=this._genMinIndexKey(h,"SPOG"),b=b.get(a);b.onerror=function(a){c(null,Error(a.target.statusCode))};b.onsuccess=function(a){c(null!=a.target.result)}};PersistentQuadBackend.prototype.delete=function(h,c){var b=this._genMinIndexKey(h,"SPOG"),b=this.db.transaction([this.dbName],"readwrite").objectStore(this.dbName).delete(b);b.onsuccess=function(){c(!0)};b.onerror=function(a){c(null,Error(a.target.statusCode))}};PersistentQuadBackend.prototype._genMinIndexKey=
function(h,c){return v.map(this.componentOrders[c],function(b){return"string"===typeof h[b]||null==h[b]?"0":h[b]}).join(".")};PersistentQuadBackend.prototype._genMaxIndexKey=function(h,c){for(var b=this.componentOrders[c],a=[],f=0;f<b.length;f++){var k=h[b[f]];a[f]="string"===typeof k?"z":k}return v.map(a,function(a){return""+a}).join(".")};PersistentQuadBackend.prototype._indexForPattern=function(h){h=h.indexKey.sort().join(".");var c=this.componentOrdersMap[h];if(null==c)throw Error("Error, cannot find index for indexKey "+
h);return c};PersistentQuadBackend.prototype.clear=function(h){var c;c=this.db.transaction([this.dbName],"readwrite").objectStore(this.dbName).clear();c.onsuccess=function(){h()};c.onerror=function(){h()}};B.exports.PersistentQuadBackend=PersistentQuadBackend},{"./utils":57}],49:[function(z,B,C){var v=z("./quad_index").QuadIndex,h=z("./utils");QuadBackend=function(c,b){this.indexMap={};this.treeOrder=c.treeOrder;this.indices=c.index||QuadBackend.allIndices;this.componentOrders=QuadBackend.componentOrders;
var a=this;h.eachSeries(this.indices,function(b,c){new v({order:a.treeOrder,componentOrder:a.componentOrders[b]},function(h){a.indexMap[b]=h;c()})},function(){b(a)})};QuadBackend.allIndices="SPOG GP OGS POG GSP OS".split(" ");QuadBackend.componentOrders={SPOG:["subject","predicate","object","graph"],GP:["graph","predicate","subject","object"],OGS:["object","graph","subject","predicate"],POG:["predicate","object","graph","subject"],GSP:["graph","subject","predicate","object"],OS:["object","subject",
"predicate","graph"]};QuadBackend.prototype._indexForPattern=function(c){c=c.indexKey;for(var b=0;b<QuadBackend.allIndices.length;b++)for(var a=QuadBackend.allIndices[b],f=QuadBackend.componentOrders[a],k=0;k<f.length&&!1!==h.include(c,f[k]);k++)if(k==c.length-1)return a;return"SPOG"};QuadBackend.prototype.index=function(c,b){var a=this;h.eachSeries(this.indices,function(b,h){a.indexMap[b].insert(c,function(){h()})},function(){b(!0)})};QuadBackend.prototype.range=function(c,b){var a=this._indexForPattern(c),
a=this.indexMap[a];null!=a&&a.range(c,function(a){b(a)})};QuadBackend.prototype.search=function(c,b){var a=this.indexMap.SPOG;null!=a&&a.search(c,function(a){b(null!=a)})};QuadBackend.prototype.delete=function(c,b){var a=this;h.eachSeries(this.indices,function(b,h){a.indexMap[b].delete(c,function(){h()})},function(){b(!0)})};QuadBackend.prototype.clear=function(c){var b=this;h.eachSeries(this.indices,function(a,c){new v({order:b.treeOrder,componentOrder:b.componentOrders[a]},function(h){b.indexMap[a]=
h;c()})},function(){c(!0)})};B.exports.QuadBackend=QuadBackend},{"./quad_index":50,"./utils":57}],50:[function(z,B,C){var v=z("./btree").Tree,h=z("./utils"),c=z("./utils");NodeKey=function(b,a){this.subject=b.subject;this.predicate=b.predicate;this.object=b.object;this.graph=b.graph;this.order=a};NodeKey.prototype.comparator=function(b){for(var a=0;a<this.order.length;a++){var c=this.order[a];if(null==b[c])break;else{if(this[c]<b[c])return-1;if(this[c]>b[c])return 1}}return 0};Pattern=function(b){this.subject=
b.subject;this.predicate=b.predicate;this.object=b.object;this.graph=b.graph;this.indexKey=[];this.keyComponents={};var a=[],c=[],k=this;h.forEach(["subject","predicate","object","graph"],function(b){"string"===typeof k[b]?(c.push(b),k.keyComponents[b]=null):(a.push(b),k.keyComponents[b]=k[b],k.indexKey.push(b))});this.order=a.concat(c);this.key=new NodeKey(this.keyComponents,this.order)};QuadIndex=function(b,a){0!=arguments&&(this.componentOrder=b.componentOrder,v.call(this,b.order,function(b){b.comparator=
function(a,c){for(var d=0;d<b.componentOrder.length;d++){var h=b.componentOrder[d],m=a[h],h=c[h];if(m<h)return-1;if(m>h)return 1}return 0};b.rangeComparator=function(a,c){for(var d=0;d<b.componentOrder.length;d++){var h=b.componentOrder[d];if(null==c[h]||null==a[h])break;else{if(a[h]<c[h])return-1;if(a[h]>c[h])return 1}}return 0};a(b)}))};QuadIndex.prototype=h.create(v.prototype,{constructor:v});QuadIndex.prototype.insert=function(b,a){v.prototype.insert.call(this,b,null,function(b){a(b)})};QuadIndex.prototype.search=
function(b,a){v.prototype.search.call(this,b,function(b){a(b)},!0)};QuadIndex.prototype.range=function(b,a){this._rangeTraverse(this,this.root,b,a)};QuadIndex.prototype._rangeTraverse=function(b,a,f,h){var r=f.key,d=[],l=[a];c.whilst(function(){return 0<l.length},function(a){for(var f=l.shift(),h=0;h<f.numberActives&&-1===b.rangeComparator(f.keys[h].key,r);)h++;if(!0===f.isLeaf){for(var k=h;k<f.numberActives&&0===b.rangeComparator(f.keys[k].key,r);)d.push(f.keys[k].key),k++;a()}else b._diskRead(f.children[h],
function(k){l.push(k);var x=h;c.whilst(function(){return x<f.numberActives&&0===b.rangeComparator(f.keys[x].key,r)},function(a){d.push(f.keys[x].key);x++;b._diskRead(f.children[x],function(b){l.push(b);a()})},function(){a()})})},function(){h(d)})};B.exports={QuadIndex:QuadIndex,Pattern:Pattern,NodeKey:NodeKey}},{"./btree":40,"./utils":57}],51:[function(z,B,C){function v(a,b,c){this.name="BindExpressionError";this.bind=b;this.error=c;this.message=a}var h=z("./abstract_query_tree").AbstractQueryTree,
c=z("./abstract_query_tree").NonSupportedSparqlFeatureError,b=z("./utils"),a=z("./quad_index"),f=z("./query_plan").QueryPlan,k=z("./query_filters").QueryFilters,r=z("./rdf_model"),d=z("./rdf_loader").RDFLoader,l=z("./graph_callbacks").CallbacksBackend,m=z("./utils"),u=z("./utils");v.prototype=Error();v.constructor=v;QueryEngine=function(a){0!=arguments.length&&(this.backend=a.backend,this.lexicon=a.lexicon,this.eventsOnBatchLoad=a.eventsOnBatchLoad||!1,this.defaultPrefixes={},this.abstractQueryTree=
new h,this.rdfLoader=new d(a.communication),this.callbacksBackend=new l(this),this.customFns=a.customFns||{})};QueryEngine.prototype.setCustomFunctions=function(a){this.customFns=a};QueryEngine.prototype.registerNsInEnvironment=function(a,b){var c=[];null!=a&&null!=a.prefixes&&(c=a.prefixes);var d={},f;for(f in this.defaultPrefixes)d[f]=this.defaultPrefixes[f];for(f=0;f<c.length;f++){var h=c[f];"prefix"===h.token&&(d[h.prefix]=h.local)}b.namespaces=d;b.base=null!=a&&a.base&&"object"===typeof a.base?
a.base.value:null};QueryEngine.prototype.applyModifier=function(a,b){if("DISTINCT"==a){for(var c={},d=[],f=0;f<b.length;f++){var h=b[f],k="",l;for(l in h){var m=h[l];null==m?k=k+l+"null":"literal"==m.token?(null!=m.value&&(k+=m.value),null!=m.lang&&(k+=m.lang),null!=m.type&&(k+=m.type)):k=m.value?k+l+m.value:k+l+m}null==c[k]&&(d.push(h),c[k]=!0)}return d}return b};QueryEngine.prototype.applyLimitOffset=function(a,b,c){if(null==b&&null==a)return c;null==a&&(a=0);b=null==b?c.length:a+b;return c.slice(a,
b)};QueryEngine.prototype.applySingleOrderBy=function(a,b,c,d,f){var h=[],l=this;m.eachSeries(a,function(a,f){k.collect(a.expression,[b],c,d,l,function(a){h.push(a[0].value);f()})},function(){f({binding:b,value:h})})};QueryEngine.prototype.applyOrderBy=function(a,b,c,d,f){var h=this,k=[];null!=a&&0<a.length?m.eachSeries(b,function(b,f){h.applySingleOrderBy(a,b,c,d,function(a){k.push(a);f()})},function(){k.sort(function(b,c){return h.compareFilteredBindings(b,c,a,d)});for(var b=[],c=0;c<k.length;c++)b.push(k[c].binding);
f(b)}):f(b)};QueryEngine.prototype.compareFilteredBindings=function(a,b,c,d){for(var f=0;;){if(f==a.value.length)return 0;var h=c[f].direction;if(null==a.value[f]&&null==b.value[f])f++;else{if(null==a.value[f])a={value:!1};else if(null==b.value[f])a={value:!0};else if("blank"===a.value[f].token&&"blank"===b.value[f].token){f++;continue}else if("blank"===a.value[f].token)a={value:!1};else if("blank"===b.value[f].token)a={value:!0};else if("uri"===a.value[f].token&&"uri"===b.value[f].token)if(1==k.runEqualityFunction(a.value[f],
b.value[f],[],this,d).value){f++;continue}else a=k.runTotalGtFunction(a.value[f],b.value[f],[]);else if("uri"===a.value[f].token)a={value:!1};else if("uri"===b.value[f].token)a={value:!0};else if("literal"===a.value[f].token&&"literal"===b.value[f].token&&null==a.value[f].type&&null==b.value[f].type)if(1==k.runEqualityFunction(a.value[f],b.value[f],[],this,d).value){f++;continue}else a=k.runTotalGtFunction(a.value[f],b.value[f],[]);else if("literal"===a.value[f].token&&null==a.value[f].type)a={value:!1};
else if("literal"===b.value[f].token&&null==b.value[f].type)a={value:!0};else if(1==k.runEqualityFunction(a.value[f],b.value[f],[],this,d).value){f++;continue}else a=k.runTotalGtFunction(a.value[f],b.value[f],[]);return 1==a.value?"ASC"===h?1:-1:"ASC"===h?-1:1}}};QueryEngine.prototype.removeDefaultGraphBindings=function(a,b){for(var c=[],d={},f=0;f<b.named.length;f++)d[b.named[f].oid]=!0;for(f=0;f<b.implicit.length;f++)null==d[b.implicit[f].oid]&&c.push(b.implicit[f].oid);c=[];for(f=0;f<a.length;f++){var h=
a[f],k=!1,l;for(l in h){for(var m=0;m<d.length;m++)if(h[l]===d[m]){k=!0;break}if(k)break}k||c.push(h)}return c};QueryEngine.prototype.aggregateBindings=function(a,b,c,d,f){this.copyDenormalizedBindings(b,d.outCache,function(b){for(var h={},l=0;l<a.length;l++){var m=k.runAggregator(a[l],b,this,c,d);a[l].alias?h[a[l].alias.value]=m:h[a[l].value.value]=m}f(h)})};QueryEngine.prototype.projectBindings=function(a,b,c){if("*"===a[0].kind)return b;for(var d=[],f=0;f<b.length;f++){for(var h=b[f],l={},m=!0,
r=0;r<a.length;r++)if("variable"==a[r].token&&"aliased"!=a[r].kind)l[a[r].value.value]=h[a[r].value.value];else if("variable"==a[r].token&&"aliased"==a[r].kind){var u=k.runFilter(a[r].expression,h,this,c,{blanks:{},outCache:{}});if(k.isEbvError(u)){m=!1;break}else l[a[r].alias.value]=u}!0===m&&d.push(l)}return d};QueryEngine.prototype.resolveNsInEnvironment=function(a,b){return b.namespaces[a]};QueryEngine.prototype.normalizeTerm=function(a,c,d,f){if("uri"===a.token)a=b.lexicalFormBaseUri(a,c),null==
a?f(null):d?this.lexicon.registerUri(a,f):this.lexicon.resolveUri(a,f);else if("literal"===a.token)a=b.lexicalFormLiteral(a,c),d?this.lexicon.registerLiteral(a,f):this.lexicon.resolveLiteral(a,f);else if("blank"===a.token){var h=a.value;a=c.blanks[h];null!=a?f(a):d?this.lexicon.registerBlank(function(a){c.blanks[h]=a;f(a)}):this.lexicon.resolveBlank(function(a){c.blanks[h]=a;f(a)})}else"var"===a.token?f(a.value):f(null)};QueryEngine.prototype.normalizeDatasets=function(a,b,c){var d=this;m.eachSeries(a,
function(a,c){a.value===d.lexicon.defaultGraphUri?(a.oid=d.lexicon.defaultGraphOid,c()):d.normalizeTerm(a,b,!1,function(b){null!=b&&(a.oid=b);c()})},function(){c(!0)})};QueryEngine.prototype.normalizeQuad=function(a,c,d,f){var h=null,k=null,l=null,r=null,u=this,v=!1;m.seq(function(f){if(null==a.graph||a.graph.value===u.lexicon.defaultGraphUri)r=0,f();else{var h=b.lexicalFormBaseUri(a.graph,c);u.normalizeTerm(a.graph,c,d,function(b){null!=b?(r=b,!0===d&&"var"!=a.graph.token?u.lexicon.registerGraph(b,
h,function(){f()}):f()):(v=!0,f())})}},function(b){!1===v?u.normalizeTerm(a.subject,c,d,function(a){null!=a?h=a:v=!0;b()}):b()},function(b){!1===v?u.normalizeTerm(a.predicate,c,d,function(a){null!=a?k=a:v=!0;b()}):b()},function(b){!1===v?u.normalizeTerm(a.object,c,d,function(a){null!=a?l=a:v=!0;b()}):b()})(function(){!0===v?f(null):f({subject:h,predicate:k,object:l,graph:r})})};QueryEngine.prototype.denormalizeBindingsList=function(a,b,c){var d=this,f=[];m.eachSeries(a,function(a,c){d.denormalizeBindings(a,
b,function(a){f.push(a);c()})},function(){c(f)})};QueryEngine.prototype.copyDenormalizedBindings=function(a,b,c){var d=this,f=[];m.eachSeries(a,function(a,c){var h={},k=u.keys(a);m.eachSeries(k,function(c,f){var k=a[c];if(null==k)h[c]=null,f();else if("object"===typeof k)h[c]=k,f();else{var l=b[k];null!=l?(h[c]=l,f()):d.lexicon.retrieve(k,function(a){b[k]=a;h[c]=a;f()})}},function(){f.push(h);c()})},function(){c(f)})};QueryEngine.prototype.denormalizeBindings=function(a,b,c){var d=u.keys(a),f=b.outCache,
h=this;m.eachSeries(d,function(c,d){var k=a[c];null==k?(a[c]=null,d()):"object"===typeof k?d():null!=f[k]?(a[c]=f[k],d()):h.lexicon.retrieve(k,function(f){a[c]=f;"blank"===f.token&&(b.blanks[f.value]=k);d()})},function(){c(a)})};QueryEngine.prototype.execute=function(a,c,d,f){a=b.normalizeUnicodeLiterals(a);a=this.abstractQueryTree.parseQueryString(a);if(null==a)c(!1,"Error parsing query string");else if("query"===a.token&&"update"==a.kind){this.callbacksBackend.startGraphModification();var h=this;
this.executeUpdate(a,function(a,b){h.lexicon.updateAfterWrite&&h.lexicon.updateAfterWrite();a?(h.callbacksBackend.cancelGraphModification(),c(a,b)):h.callbacksBackend.endGraphModification(function(){c(a,b)})})}else"query"===a.token&&"query"==a.kind&&this.executeQuery(a,c,d,f)};QueryEngine.prototype.executeQuery=function(a,b,c,d){var f=a.units,h=this,k={blanks:{},outCache:{}};this.registerNsInEnvironment(a.prologue,k);var l=h.abstractQueryTree.parseExecutableUnit(f[0]);"select"===l.kind?this.executeSelect(l,
k,c,d,function(a,c){null==a?"object"===typeof c&&!0===c.denorm?b(null,c.bindings):h.denormalizeBindingsList(c,k,function(a){b(null,a)}):b(a)}):"ask"===l.kind?(l.projection=[{token:"variable",kind:"*"}],this.executeSelect(l,k,c,d,function(a,c){null==a?0<c.length?b(null,!0):b(null,!1):b(a)})):"construct"===l.kind&&(l.projection=[{token:"variable",kind:"*"}],h=this,this.executeSelect(l,k,c,d,function(a,c){null==a?h.denormalizeBindingsList(c,k,function(a){if(null!=a){var c=new r.Graph;null==l.template&&
(l.template={triplesContext:l.pattern});for(var d=1,f=[],n=0;n<a.length;n++){for(var m=a[n],u=0;u<f.length;u++)delete f[u].valuetmp;for(u=0;u<l.template.triplesContext.length;u++){for(var v=["subject","predicate","object"],y=l.template.triplesContext[u],E=0;E<v.length;E++){var z=v[E];if("blank"===y[z].token&&(!y[z].valuetmp||null==y[z].valuetmp)){var D="_:b"+d;d++;y[z].valuetmp=D;f.push(y[z])}}v=r.buildRDFResource(y.subject,m,h,k);E=r.buildRDFResource(y.predicate,m,h,k);y=r.buildRDFResource(y.object,
m,h,k);null!=v&&null!=E&&null!=y&&(E=new r.Triple(v,E,y),c.add(E))}}b(null,c)}else b(Error("Error denormalizing bindings."))}):b(a)}))};QueryEngine.prototype.executeSelect=function(a,b,c,d,f){if("select"===a.kind||"ask"===a.kind||"construct"===a.kind||"modify"===a.kind){var h=a.projection,k=a.dataset,l=a.modifier,r=a.limit,u=a.offset,v=a.order,z=this;if(null!=c||null!=d)k.implicit=c||[],k.named=d||[];null!=k.implicit&&0===k.implicit.length&&null!=k.named&&0===k.named.length&&k.implicit.push(this.lexicon.defaultGraphUriTerm);
z.normalizeDatasets(k.implicit.concat(k.named),b,function(){try{z.executeSelectUnit(h,k,a.pattern,b,function(c){if(null!=c){if(null!=a.group&&""===a.group){for(var d=!1,y=0;y<a.projection.length;y++)if(null!=a.projection[y].expression&&"aggregate"===a.projection[y].expression.expressionType){d=!0;break}!0===d&&(a.group="singleGroup")}a.group&&""!=a.group?z.checkGroupSemantics(a.group,h)?z.groupSolution(c,a.group,k,b,function(a){var c=[];m.eachSeries(a,function(a,d){z.aggregateBindings(h,a,k,b,function(a){c.push(a);
d()})},function(){f(null,{bindings:c,denorm:!0})})}):f(Error("Incompatible Group and Projection variables")):z.applyOrderBy(v,c,k,b,function(a){a=z.projectBindings(h,a,k);a=z.applyModifier(l,a);a=z.applyLimitOffset(u,r,a);a=z.removeDefaultGraphBindings(a,k);f(null,a)})}else f(Error("Error executing SELECT query."))})}catch(c){f(c)}})}else f(Error("Cannot execute "+a.kind+" query as a select query"))};QueryEngine.prototype.groupSolution=function(a,b,c,d,f){var h=[],l=[],r=!1,u=this;"singleGroup"===
b?f([a]):m.eachSeries(a,function(a,f){var n=!0;m.eachSeries(b,function(b,f){var l=null;if("var"===b.token)l=b.value,0==r&&h.push(l),f();else if("aliased_expression"===b.token){l=b.alias.value;0==r&&h.push(l);if("var"===b.expression.primaryexpression)a[b.alias.value]=a[b.expression.value.value];else{var m=u.copyDenormalizedBindings([a],d.outCache),m=k.runFilter(b.expression,m[0],u,c,d);k.isEbvError(m)?n=!1:(null!=m.value&&(m.value=""+m.value),a[b.alias.value]=m)}f()}else u.copyDenormalizedBindings([a],
d.outCache,function(c){c=k.runFilter(b,c[0],u,d);k.isEbvError(c)?n=!1:(a["groupCondition"+env._i]=c,l="groupCondition"+env._i,0==r&&h.push(l));f()})},function(){0==r&&(r=!0);!0===n&&l.push(a);f()})},function(){for(var a={},b=0;b<l.length;b++){for(var c=l[b],d="",k=0;k<h.length;k++)var n=c[h[k]],d="object"===typeof n?d+n.value:d+n;null==a[d]?a[d]=[c]:a[d].push(c)}var b=[],m;for(m in a)b.push(a[m]);f(b)})};QueryEngine.prototype.executeSelectUnit=function(a,b,d,f,h){if("BGP"===d.kind)this.executeAndBGP(a,
b,d,f,h);else if("UNION"===d.kind)this.executeUNION(a,b,d.value,f,h);else if("JOIN"===d.kind)this.executeJOIN(a,b,d,f,h);else if("LEFT_JOIN"===d.kind)this.executeLEFT_JOIN(a,b,d,f,h);else if("FILTER"===d.kind){var l=this;this.executeSelectUnit(a,b,d.value,f,function(a){null!=a?k.checkFilters(d,a,!1,b,f,l,h):h([])})}else if("EMPTY_PATTERN"===d.kind)h([]);else throw new c(d.kind);};QueryEngine.prototype.executeUNION=function(a,b,c,d,h){var l=c[0],r=c[1],u=null,z,C;if(2!=c.length)throw"SPARQL algebra UNION with more than two components";
var B=this;m.seq(function(c){try{B.executeSelectUnit(a,b,l,d,function(a){z=a;c()})}catch(f){u=f,c()}},function(c){if(null==u)try{B.executeSelectUnit(a,b,r,d,function(a){C=a;c()})}catch(f){u=f,c()}else c()})(function(){if(null!=u)h(u);else{var a=f.unionBindings(z,C);B.runBinds(c.binds,a,b,d,function(a,f){if(null!=a)throw new v("Error processing bind expressions",c.binds,a);k.checkFilters(c,f,!1,b,d,B,h)})}})};QueryEngine.prototype.executeAndBGP=function(a,b,c,d,h){var l=this;f.executeAndBGPsDPSize(c.value,
b,this,d,function(a){null!=a?l.runBinds(c.binds,a,b,d,function(a,f){if(null!=a)throw new v("Error processing bind expressions",c.binds,a);k.checkFilters(c,f,!1,b,d,l,h)}):h(null)})};QueryEngine.prototype.executeLEFT_JOIN=function(a,b,c,d,h){var l=c.lvalue,r=c.rvalue;if("EMPTY_PATTERN"===l.kind)this.executeSelectUnit(a,b,r,d,h);else{var u=null,z=null,C=null,B=this,W,O;m.seq(function(c){try{B.executeSelectUnit(a,b,l,d,function(a){u=a;c()})}catch(f){C=f,c()}},function(c){if(null!=C)c();else try{B.executeSelectUnit(a,
b,r,d,function(a){z=a;c()})}catch(f){C=f,c()}})(function(){if(null!=C)h(C);else{var a=f.leftOuterJoinBindings(u,z);B.runBinds(c.binds,a,b,d,function(f,l){if(null!=f)throw new v("Error processing bind expressions",c.binds,f);k.checkFilters(c,a,!0,b,d,B,function(a){if(1<u.length&&1<z.length){var b=[],c={},d;for(d in u[0])c[d]=!0;for(d in z[0])1!=c[d]&&b.push(d);W=[];O={};for(c=0;c<a.length;c++)if(!0===a[c].__nullify__){for(var f=0;f<b.length;f++)a[c].bindings[b[f]]=null;var f=[],k=[];for(d in a[c].bindings)null!=
a[c].bindings[d]&&(f.push(d+a[c].bindings[d]),f.sort(),k.push(f.join("")));if(null==O[f.join("")]){for(f=0;f<k.length;f++)O[k[f]]=!0;W.push(a[c].bindings)}}else for(d in W.push(a[c]),f=[],a[c])f.push(d+a[c][d]),f.sort(),O[f.join("")]=!0;h(W)}else h(a)})})}})}};QueryEngine.prototype.executeJOIN=function(a,b,c,d,h){var l=c.lvalue,r=c.rvalue,u=null,z=null,C=null,B=this;m.seq(function(c){try{B.executeSelectUnit(a,b,l,d,function(a){u=a;c()})}catch(f){C=f,c()}},function(c){if(null!=C)c();else try{B.executeSelectUnit(a,
b,r,d,function(a){z=a;c()})}catch(f){C=f,c()}})(function(){var a=null;if(null!=C)h(C);else if(0===u.length||0===z.length)h([]);else{var a={},n=[],m;for(m in u[0])a[m]=!1;for(m in z[0])!1===a[m]&&n.push(m);a=0==n.length?f.joinBindings(u,z):B.abstractQueryTree.treeWithUnion(l)||B.abstractQueryTree.treeWithUnion(r)?f.joinBindings(u,z):f.joinBindings2(n,u,z);B.runBinds(c.binds,a,b,d,function(a,f){if(null!=a)throw new v("Error processing bind expressions",c.binds,a);k.checkFilters(c,f,!1,b,d,B,h)})}})};
QueryEngine.prototype.rangeQuery=function(b,c,d){var f=this;f.normalizeQuad(b,c,!1,function(b){null!=b?f.backend.range(new a.Pattern(b),function(a){null==a||0==a.length?d([]):d(a)}):d(null)})};QueryEngine.prototype.executeUpdate=function(a,c){var d=a.units,f=this,h={blanks:{},outCache:{}};this.registerNsInEnvironment(a.prologue,h);for(var k=0;k<d.length;k++){var l=f.abstractQueryTree.parseExecutableUnit(d[k]);if("insertdata"===l.kind){var r=null;m.eachSeries(l.quads,function(a,b){null===r?f._executeQuadInsert(a,
h,function(a){null!=a&&(r=a);b()}):b()},function(){null===r?c(null,!0):c(r)})}else if("deletedata"===l.kind)r=null,m.eachSeries(l.quads,function(a,b){null===r?f._executeQuadDelete(a,h,function(a){null!=a&&(r=a);b()}):b()},function(){null===r?c(null,!0):c(r)});else if("modify"===l.kind)this._executeModifyQuery(l,h,c);else if("create"===l.kind)c(!0);else if("load"===l.kind){var u={uri:b.lexicalFormBaseUri(l.sourceGraph,h)};null!=l.destinyGraph&&(u={uri:b.lexicalFormBaseUri(l.destinyGraph,h)});f=this;
this.rdfLoader.load(l.sourceGraph.value,u,function(a,b){a?c(Error("error batch loading quads")):f.batchLoad(b,function(a){null!==a?c(null,a):c(Error("Error batch loading quads"))})})}else if("drop"===l.kind)this._executeClearGraph(l.destinyGraph,h,c);else if("clear"===l.kind)this._executeClearGraph(l.destinyGraph,h,c);else throw Error("not supported execution unit");}};QueryEngine.prototype.batchLoad=function(b,c){var d=0,f={},h=this;this.eventsOnBatchLoad&&this.callbacksBackend.startGraphModification();
var k=function(a,b,c,d){var k;if(a[b].uri||"uri"===a[b].token){var l=a[b].uri||a[b].value;h.lexicon.registerUri(l,function(f){var k=function(){null!=a[b].uri&&(a[b]={token:"uri",value:a[b].uri},delete a[b].uri);c[b]=f;d()};"graph"===b?h.lexicon.registerGraph(f,l,function(){k()}):k()})}else a[b].literal||"literal"===a[b].token?h.lexicon.registerLiteral(a[b].literal||a[b].value,function(f){null!=a[b].literal&&(a[b]=h.lexicon.parseLiteral(a[b].literal),delete a[b].literal);c[b]=f;d()}):(k=f[a[b].blank||
a[b].value],null==k?h.lexicon.registerBlank(function(h){f[a[b].blank||a[b].value]=h;null==a[b].token&&(a[b].token="blank",a[b].value=a[b].blank,delete a[b].blank);c[b]=h;d()}):(null==a[b].token&&(a[b].token="blank",a[b].value=a[b].blank,delete a[b].blank),c[b]=k,d()))};m.eachSeries(b,function(b,c){var f={};m.eachSeries(["subject","predicate","object","graph"],function(a,c){k(b,a,f,c)},function(){var k=b;b=f;var n=new a.NodeKey(b);h.backend.search(n,function(a){a?c():h.backend.index(n,function(a){a&&
(h.eventsOnBatchLoad&&h.callbacksBackend.nextGraphModification(l.added,[k,b]),d+=1);c()})})})},function(){null!=h.lexicon.updateAfterWrite&&h.lexicon.updateAfterWrite();var a=function(){c(d)};h.eventsOnBatchLoad?h.callbacksBackend.endGraphModification(a()):a()})};QueryEngine.prototype._executeModifyQuery=function(a,b,c){var d=this,f=!0,h=Error("Error executing modify query"),k=null,l=["subject","predicate","object","graph"];a.insert=null==a.insert?[]:a.insert;a.delete=null==a.delete?[]:a.delete;m.seq(function(c){var l=
[],m=[];null!=a.with&&l.push(a.with);if(null!=a.using)for(var m=[],r=0;r<a.using.length;r++){var u=a.using[r];"named"===u.kind?m.push(u.uri):l.push(u.uri)}a.dataset={};a.projection=[{token:"variable",kind:"*"}];d.executeSelect(a,b,l,m,function(a,l){if(a)return h=a,f=!1,c();d.denormalizeBindingsList(l,b,function(a){null!=a?k=a:(h=Error("Error denormalizing bindings list"),f=!1);c()})})},function(c){var h=a.with;if(f){for(var r=[],u=0;u<a.delete.length;u++)for(var v=a.delete[u],z=0;z<k.length;z++){for(var E=
{},F=k[z],C=0;C<l.length;C++){var B=l[C];"graph"==B&&null==v[B]?E.graph=h:E[B]="var"===v[B].token?F[v[B].value]:v[B]}r.push(E)}m.eachSeries(r,function(a,c){d._executeQuadDelete(a,b,function(){c()})},function(){c()})}else c()},function(c){var h=a.with;if(f){for(var r=[],u=0;u<a.insert.length;u++)for(var v=a.insert[u],z=0;z<k.length;z++){for(var E={},F=k[z],C=0;C<l.length;C++){var B=l[C];"graph"==B&&null==v[B]?E.graph=h:E[B]="var"===v[B].token?F[v[B].value]:v[B]}r.push(E)}m.eachSeries(r,function(a,
c){d._executeQuadInsert(a,b,function(){c()})},function(){c()})}else c()})(function(){f?c(null):c(h)})};QueryEngine.prototype._executeQuadInsert=function(b,c,d){var f=this,h,k=!1,r=null;m.seq(function(a){f.normalizeQuad(b,c,!0,function(b){null!=b?h=b:(k=!0,r="Error normalizing quad.");a()})},function(c){if(!1===k){var d=new a.NodeKey(h);f.backend.search(d,function(a){!0===a?c():f.backend.index(d,function(){f.callbacksBackend.nextGraphModification(l.added,[b,h]);c()})})}else c()})(function(){k?d(Error(r)):
d(null,!0)})};QueryEngine.prototype._executeQuadDelete=function(b,c,d){var f=this,h,k=!1,r,u;m.seq(function(a){f.normalizeQuad(b,c,!0,function(b){null!=b?h=b:(k=!0,r="Error normalizing quad.");a()})},function(b){!1===k?(u=new a.NodeKey(h),f.backend.delete(u,function(){b()})):b()},function(a){!1===k?f.lexicon.unregister(b,u,function(){f.callbacksBackend.nextGraphModification(l.deleted,[b,h]);a()}):a()})(function(){k?d(Error(r)):d(null,!0)})};QueryEngine.prototype._executeClearGraph=function(a,c,d){var f=
this;"default"===a?this.execute("DELETE { ?s ?p ?o } WHERE { ?s ?p ?o }",d):"named"===a?f.lexicon.registeredGraphs(!0,function(a){if(null!=a){var b=!1;m.eachSeries(a,function(a,c){b?c():f.execute("DELETE { GRAPH <"+a+"> { ?s ?p ?o } } WHERE { GRAPH <"+a+"> { ?s ?p ?o } }",function(d,h){d?(b=d,c()):f.lexicon.resolveUri(a,function(d){-1!=d?f.lexicon.knownGraphs.delete(d,function(){c()}):(b="Cannot find graph "+a+" to clear it",c())})})},function(){d(!b)})}else d(!1,"Error deleting named graphs")}):
"all"===a?(f=this,this.execute("CLEAR DEFAULT",function(a,b){a?d(!1,b):f.execute("CLEAR NAMED",d)})):"uri"==a.token?(a=b.lexicalFormBaseUri(a,c),null!=a?(this.callbacksBackend.ongoingModification=!0,this.execute("DELETE { GRAPH <"+a+"> { ?s ?p ?o } } WHERE { GRAPH <"+a+"> { ?s ?p ?o } }",function(a){f.callbacksBackend.ongoingModification=!1;d(a)})):d(!1,"wrong graph URI")):d(!1,"wrong graph URI")};QueryEngine.prototype.checkGroupSemantics=function(a,b){if("singleGroup"===a)return!0;for(var c={},d=
0;d<a.length;d++){var f=a[d];"var"===f.token?c[f.value]=!0:"aliased_expression"===f.token&&(c[f.alias.value]=!0)}for(d=0;d<b.length;d++)if(f=b[d],"var"===f.kind){if(null==c[f.value.value])return!1}else if("aliased"===f.kind&&f.expression&&"var"===f.expression.primaryexpression&&null==c[f.expression.value.value])return!1;return!0};QueryEngine.prototype.runBinds=function(a,b,c,d,f){var h=this;null!=a&&0<a.length?h.copyDenormalizedBindings(b,d.outCache,function(l){for(var m=0;m<b.length;m++)for(var r=
0;r<a.length;r++){var u=a[r],v=k.runFilter(u.expression,l[m],h,c,d);k.isEbvError(v)?f(v):b[m][u.as.value]=v}f(null,b)}):f(null,b)};QueryEngine.prototype.computeCosts=function(a,b,c){for(var d=0;d<a.length;d++)a[d]._cost=this.quadCost(a[d],b);c(a)};QueryEngine.prototype.quadCost=function(a,b){return 1};QueryEngine.prototype.registerDefaultNamespace=function(a,b){this.defaultPrefixes[a]=b};B.exports={QueryEngine:QueryEngine}},{"./abstract_query_tree":39,"./graph_callbacks":42,"./quad_index":50,"./query_filters":52,
"./query_plan":53,"./rdf_loader":54,"./rdf_model":55,"./utils":57}],52:[function(z,B,C){var v=z("./utils"),h=z("./utils");QueryFilters={checkFilters:function(c,b,a,f,k,r,d){var l=[];c.filter&&"function"!==typeof c.filter&&(l=c.filter);var m=[];if(null==l||0===l.length||null!=c.length)return d(b);QueryFilters.preprocessExistentialFilters(l,b,r,f,k,function(c){h.eachSeries(c,function(c,d){QueryFilters.run(c.value,b,a,f,k,r,function(a){for(var c=[],f=0;f<a.length;f++){var h=a[f];null!=h.__nullify__?
m.push(h):c.push(h)}b=c;d()})},function(){d(b.concat(m))})})},preprocessExistentialFilters:function(c,b,a,f,k,r){var d=[];h.eachSeries(c,function(c,m){if("builtincall"!==c.value.expressionType||"exists"!==c.value.builtincall&&"notexists"!==c.value.builtincall)if("conditionalor"===c.value.expressionType||"conditionaland"===c.value.expressionType){var r=v.map(c.value.operands,function(a){return{value:a}});QueryFilters.preprocessExistentialFilters(r,b,a,f,k,function(a){c.value.operands=a.map(function(a){return a.value});
d.push(c);m()})}else"multiplicativeexpression"===c.value.expressionType?(r=v.map(c.value.factors,function(a){return{value:a}}),QueryFilters.preprocessExistentialFilters(r,b,a,f,k,function(a){c.value.factors=a.map(function(a){return a.value});d.push(c);m()})):"additiveexpression"===c.value.expressionType?(r=v.map(c.value.summands,function(a){return{value:a}}),QueryFilters.preprocessExistentialFilters(r,b,a,f,k,function(a){c.value.summands=a.map(function(a){return a.value});d.push(c);m()})):"relationalexpression"===
c.value.expressionType?(r=[{value:c.value.op1},{value:c.value.op2}],QueryFilters.preprocessExistentialFilters(r,b,a,f,k,function(a){c.value.op1=a[0].value;c.value.op2=a[1].value;d.push(c);m()})):"irireforfunction"===c.value.expressionType||"custom"===c.value.expressionType?null!=c.value.args?(r=v.map(c.value.args,function(a){return{value:a}}),QueryFilters.preprocessExistentialFilters(r,b,a,f,k,function(a){c.value.args=a.map(function(a){return a.value});d.push(c);m()})):(d.push(c),m()):(d.push(c),
m());else{var n=c.value.builtincall,x=c.value.args,z={};a.copyDenormalizedBindings(b,k.outCache,function(b){h.eachSeries(b,function(b,c){var d=v.clone(x[0],!0),d=a.abstractQueryTree.parseSelect({pattern:d},b),d=a.abstractQueryTree.bind(d.pattern,b);a.executeSelectUnit([{kind:"*"}],f,d,k,function(a){var d=null,d="exists"===n?QueryFilters.ebvBoolean(0!==a.length):QueryFilters.ebvBoolean(0===a.length);a=[];for(var f in b)a.push(JSON.stringify(b[f]));a=a.sort().join("");z[a]=d;c()})},function(){c.value.origArgs=
c.value.args;c.value.args=z;d.push(c);m()})})}},function(){r(d)})},boundVars:function(c){if(null!=c.expressionType){var b=c.expressionType;if("relationalexpression"==b)return b=c.op2,QueryFilters.boundVars(c.op1)+QueryFilters.boundVars(b);if("conditionalor"==b||"conditionaland"==b){for(var a=[],b=0;b<c.operands;b++)a=a.concat(QueryFilters.boundVars(c.operands[b]));return a}if("builtincall"==b){if(null==c.args)return[];a=[];for(b=0;b<c.args.length;b++)a=a.concat(QueryFilters.boundVars(c.args[b]));
return a}if("multiplicativeexpression"==b){a=QueryFilters.boundVars(c.factor);for(b=0;b<c.factors.length;b++)a=a.concat(QueryFilters.boundVars(c.factors[b].expression));return a}if("additiveexpression"==b){a=QueryFilters.boundVars(c.summand);for(b=0;b<c.summands.length;b++)a=a.concat(QueryFilters.boundVars(c.summands[b].expression));return a}if("regex"==b)return a=QueryFilters.boundVars(c.expression1),a.concat(QueryFilters.boundVars(c.expression2));if("unaryexpression"==b)return QueryFilters.boundVars(c.expression);
if("atomic"==b)return"var"==c.primaryexpression?[c.value]:[]}else throw"Cannot find bound expressions in a no expression token";},run:function(c,b,a,f,h,r,d){r.copyDenormalizedBindings(b,h.outCache,function(l){for(var m=[],u=0;u<b.length;u++){var n=QueryFilters.runFilter(c,l[u],r,f,h),n=QueryFilters.ebv(n);QueryFilters.isEbvError(n)?a&&(n={__nullify__:!0,bindings:b[u]},m.push(n)):!0===n?m.push(b[u]):a&&(n={__nullify__:!0,bindings:b[u]},m.push(n))}d(m)})},collect:function(c,b,a,f,h,r){h.copyDenormalizedBindings(b,
f.outCache,function(d){for(var l=[],m=0;m<d.length;m++){var u=QueryFilters.runFilter(c,d[m],h,a,f);l.push({binding:b[m],value:u})}return r(l)})},runDistinct:function(c,b){},runAggregator:function(c,b,a,f,h){if(null==b||0===b.length)return QueryFilters.ebvError();if("variable"===c.token&&"var"==c.kind)return b[0][c.value.value];if("variable"===c.token&&"aliased"===c.kind){if("atomic"===c.expression.expressionType&&"var"===c.expression.primaryexpression)return b[0][c.expression.value.value];if("aggregate"===
c.expression.expressionType){if("max"===c.expression.aggregateType){for(var r=null,d=0;d<b.length;d++){var l=b[d],l=QueryFilters.runFilter(c.expression.expression,l,a,f,h);QueryFilters.isEbvError(l)||(null===r?r=l:!0===QueryFilters.runLtFunction(r,l).value&&(r=l))}return null===r?QueryFilters.ebvError():r}if("min"===c.expression.aggregateType){r=null;for(d=0;d<b.length;d++)l=b[d],l=QueryFilters.runFilter(c.expression.expression,l,a,f,h),QueryFilters.isEbvError(l)||(null===r?r=l:!0===QueryFilters.runGtFunction(r,
l).value&&(r=l));return null===r?QueryFilters.ebvError():r}if("count"===c.expression.aggregateType){var r={},m=0;if("*"===c.expression.expression)if(null!=c.expression.distinct&&""!=c.expression.distinct)for(d=0;d<b.length;d++){var l=b[d],u=v.hashTerm(l);null==r[u]&&(r[u]=!0,m++)}else m=b.length;else for(d=0;d<b.length;d++)l=b[d],l=QueryFilters.runFilter(c.expression.expression,l,a,f,h),QueryFilters.isEbvError(l)||(null!=c.expression.distinct&&""!=c.expression.distinct?(u=v.hashTerm(l),null==r[u]&&
(r[u]=!0,m++)):m++);return{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:""+m}}if("avg"===c.expression.aggregateType){for(var r={},n={token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:"0"},d=m=0;d<b.length;d++)l=b[d],l=QueryFilters.runFilter(c.expression.expression,l,a,f,h),QueryFilters.isEbvError(l)||(null!=c.expression.distinct&&""!=c.expression.distinct?(u=v.hashTerm(l),null==r[u]&&(r[u]=!0,QueryFilters.isNumeric(l)&&(n=QueryFilters.runSumFunction(n,
l),m++))):QueryFilters.isNumeric(l)&&(n=QueryFilters.runSumFunction(n,l),m++));c=QueryFilters.runDivFunction(n,{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:""+m});c.value=""+c.value;return c}if("sum"===c.expression.aggregateType){r={};n={token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:"0"};for(d=0;d<b.length;d++)l=b[d],l=QueryFilters.runFilter(c.expression.expression,l,a,f,h),QueryFilters.isEbvError(l)||(null!=c.expression.distinct&&""!=c.expression.distinct?
(u=v.hashTerm(l),null==r[u]&&(r[u]=!0,QueryFilters.isNumeric(l)&&(n=QueryFilters.runSumFunction(n,l)))):QueryFilters.isNumeric(l)&&(n=QueryFilters.runSumFunction(n,l)));n.value=""+n.value;return n}return l=QueryFilters.runFilter(aggregate.expression,b[0],f,{blanks:{},outCache:{}})}}},runFilter:function(c,b,a,f,h){if(null!=c.expressionType){var r=c.expressionType;if("relationalexpression"==r){var r=QueryFilters.runFilter(c.op1,b,a,f,h),d=QueryFilters.runFilter(c.op2,b,a,f,h);return QueryFilters.runRelationalFilter(c,
r,d,b,a,f,h)}if("conditionalor"==r)return QueryFilters.runOrFunction(c,b,a,f,h);if("conditionaland"==r)return QueryFilters.runAndFunction(c,b,a,f,h);if("additiveexpression"==r)return QueryFilters.runAddition(c.summand,c.summands,b,a,f,h);if("builtincall"==r)return QueryFilters.runBuiltInCall(c.builtincall,c.args,b,a,f,h);if("multiplicativeexpression"==r)return QueryFilters.runMultiplication(c.factor,c.factors,b,a,f,h);if("unaryexpression"==r)return QueryFilters.runUnaryExpression(c.unaryexpression,
c.expression,b,a,f,h);if("irireforfunction"==r)return QueryFilters.runIriRefOrFunction(c.iriref,c.args,b,a,f,h);if("regex"==r)return QueryFilters.runRegex(c.text,c.pattern,c.flags,b,a,f,h);if("custom"==r)return QueryFilters.runBuiltInCall(c.name,c.args,b,a,f,h);if("atomic"==r){if("var"==c.primaryexpression)return b[c.value.value];"object"==typeof c.value&&null!=c.value.type&&"object"==typeof c.value.type&&(c.value.type=v.lexicalFormBaseUri(c.value.type,h));return c.value}throw"Unknown filter expression type";
}throw"Cannot find bound expressions in a no expression token";},isRDFTerm:function(c){return null==c?!1:c.token&&"literal"==c.token||c.token&&"uri"==c.token||c.token&&"blank"==c.token?!0:!1},RDFTermEquality:function(c,b,a,f){return"literal"===c.token&&"literal"===b.token?c.lang==b.lang&&c.type==b.type&&c.value==b.value?!0:null!=c.type&&null!=b.type?QueryFilters.ebvError():QueryFilters.isSimpleLiteral(c)&&null!=b.type?QueryFilters.ebvError():QueryFilters.isSimpleLiteral(b)&&null!=c.type?QueryFilters.ebvError():
!1:"uri"===c.token&&"uri"===b.token?v.lexicalFormBaseUri(c,f)==v.lexicalFormBaseUri(b,f):"blank"===c.token&&"blank"===b.token?c.value==b.value:!1},isInteger:function(c){return null==c?!1:"literal"===c.token?"http://www.w3.org/2001/XMLSchema#integer"==c.type||"http://www.w3.org/2001/XMLSchema#decimal"==c.type||"http://www.w3.org/2001/XMLSchema#double"==c.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==c.type||"http://www.w3.org/2001/XMLSchema#negativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#long"==
c.type||"http://www.w3.org/2001/XMLSchema#int"==c.type||"http://www.w3.org/2001/XMLSchema#short"==c.type||"http://www.w3.org/2001/XMLSchema#byte"==c.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==c.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==c.type?
!0:!1:!1},isFloat:function(c){return null==c?!1:"literal"===c.token?"http://www.w3.org/2001/XMLSchema#float"==c.type?!0:!1:!1},isDecimal:function(c){return null==c?!1:"literal"===c.token?"http://www.w3.org/2001/XMLSchema#decimal"==c.type?!0:!1:!1},isDouble:function(c){return null==c?!1:"literal"===c.token?"http://www.w3.org/2001/XMLSchema#double"==c.type?!0:!1:!1},isNumeric:function(c){return null==c?!1:"literal"===c.token?"http://www.w3.org/2001/XMLSchema#integer"==c.type||"http://www.w3.org/2001/XMLSchema#decimal"==
c.type||"http://www.w3.org/2001/XMLSchema#float"==c.type||"http://www.w3.org/2001/XMLSchema#double"==c.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==c.type||"http://www.w3.org/2001/XMLSchema#negativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#long"==c.type||"http://www.w3.org/2001/XMLSchema#int"==c.type||"http://www.w3.org/2001/XMLSchema#short"==c.type||"http://www.w3.org/2001/XMLSchema#byte"==c.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==
c.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==c.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==c.type?!0:!1:!1},isSimpleLiteral:function(c){return c&&"literal"==c.token?null==c.type&&null==c.lang?!0:!1:!1},isXsdType:function(c,b){return b&&"literal"==b.token?b.type=="http://www.w3.org/2001/XMLSchema#"+c:!1},ebv:function(c){if(null==c||QueryFilters.isEbvError(c))return QueryFilters.ebvError();
if(c.token&&"literal"===c.token){if("http://www.w3.org/2001/XMLSchema#integer"==c.type||"http://www.w3.org/2001/XMLSchema#decimal"==c.type||"http://www.w3.org/2001/XMLSchema#double"==c.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==c.type||"http://www.w3.org/2001/XMLSchema#negativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#long"==c.type||"http://www.w3.org/2001/XMLSchema#int"==c.type||"http://www.w3.org/2001/XMLSchema#short"==c.type||"http://www.w3.org/2001/XMLSchema#byte"==
c.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==c.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==c.type){var b=parseFloat(c.value);return isNaN(b)?!1:0!=parseFloat(c.value)}return"http://www.w3.org/2001/XMLSchema#boolean"===c.type?"true"===c.value||
!0===c.value||"True"===c.value:"http://www.w3.org/2001/XMLSchema#string"===c.type?""!=c.value:"http://www.w3.org/2001/XMLSchema#dateTime"===c.type?null!=new Date(c.value):QueryFilters.isEbvError(c)?c:null==c.type?""!=c.value?!0:!1:QueryFilters.ebvError()}return!0===c.value}};QueryFilters.effectiveBooleanValue=QueryFilters.ebv;QueryFilters.ebvTrue=function(){return{token:"literal",type:"http://www.w3.org/2001/XMLSchema#boolean",value:!0}};QueryFilters.ebvFalse=function(){return{token:"literal",type:"http://www.w3.org/2001/XMLSchema#boolean",
value:!1}};QueryFilters.ebvError=function(){return{token:"literal",type:"https://github.com/antoniogarrote/js-tools/types#error",value:null}};QueryFilters.isEbvError=function(c){return"object"==typeof c&&null!=c?"https://github.com/antoniogarrote/js-tools/types#error"===c.type:!1};QueryFilters.ebvBoolean=function(c){return QueryFilters.isEbvError(c)?c:!0===c?QueryFilters.ebvTrue():QueryFilters.ebvFalse()};QueryFilters.runRelationalFilter=function(c,b,a,f,h,r,d){c=c.operator;if("="===c)return QueryFilters.runEqualityFunction(b,
a,f,h,r,d);if("!="===c)return b=QueryFilters.runEqualityFunction(b,a,f,h,r,d),QueryFilters.isEbvError(b)||(b.value=!b.value),b;if("<"===c)return QueryFilters.runLtFunction(b,a,f);if(">"===c)return QueryFilters.runGtFunction(b,a,f);if("<="===c)return QueryFilters.runLtEqFunction(b,a,f);if(">="===c)return QueryFilters.runGtEqFunction(b,a,f);throw"Error applying relational filter, unknown operator";};QueryFilters.effectiveTypeValue=function(c){if("literal"==c.token){if("http://www.w3.org/2001/XMLSchema#integer"==
c.type)return c=parseInt(c.value);if("http://www.w3.org/2001/XMLSchema#decimal"==c.type||"http://www.w3.org/2001/XMLSchema#float"==c.type||"http://www.w3.org/2001/XMLSchema#double"==c.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==c.type)return c=parseFloat(c.value);if("http://www.w3.org/2001/XMLSchema#negativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#long"==c.type||"http://www.w3.org/2001/XMLSchema#int"==c.type||"http://www.w3.org/2001/XMLSchema#short"==c.type||"http://www.w3.org/2001/XMLSchema#byte"==
c.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==c.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==c.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==c.type)return c=parseInt(c.value);if("http://www.w3.org/2001/XMLSchema#date"==c.type||"http://www.w3.org/2001/XMLSchema#dateTime"==c.type)try{return v.parseISO8601(c.value)}catch(b){return null}else return"http://www.w3.org/2001/XMLSchema#boolean"==
c.type?!0===c.value||"true"===c.value||"1"===c.value||1===c.value||!0===c.value?!0:!1===c.value||"false"===c.value||"0"===c.value||0===c.value||!1===c.value?!1:void 0:"http://www.w3.org/2001/XMLSchema#string"==c.type?null===c.value||void 0===c.value?void 0:""+c.value:c.value}else throw console.log("not implemented yet"),console.log(c),"value not supported in operations yet";};QueryFilters.runOrFunction=function(c,b,a,f,h){for(var r=null,d=0;d<c.operands.length;d++){var l=QueryFilters.runFilter(c.operands[d],
b,a,f,h);0==QueryFilters.isEbvError(l)&&(l=QueryFilters.ebv(l));null==r?r=l:QueryFilters.isEbvError(l)?r=QueryFilters.isEbvError(r)?QueryFilters.ebvError():!0===r?!0:QueryFilters.ebvError():!0===l?r=!0:QueryFilters.isEbvError(r)&&(r=QueryFilters.ebvError())}return QueryFilters.ebvBoolean(r)};QueryFilters.runAndFunction=function(c,b,a,f,h){for(var r=null,d=0;d<c.operands.length;d++){var l=QueryFilters.runFilter(c.operands[d],b,a,f,h);0==QueryFilters.isEbvError(l)&&(l=QueryFilters.ebv(l));null==r?r=
l:QueryFilters.isEbvError(l)?r=QueryFilters.isEbvError(r)?QueryFilters.ebvError():!0===r?QueryFilters.ebvError():!1:!0===l?QueryFilters.isEbvError(r)&&(r=QueryFilters.ebvError()):r=!1}return QueryFilters.ebvBoolean(r)};QueryFilters.runEqualityFunction=function(c,b,a,f,h,r){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();if(QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b))return a=QueryFilters.effectiveTypeValue(c),h=QueryFilters.effectiveTypeValue(b),isNaN(a)||
isNaN(h)?QueryFilters.ebvBoolean(QueryFilters.RDFTermEquality(c,b,f,r)):QueryFilters.ebvBoolean(a==h);if((QueryFilters.isSimpleLiteral(c)||QueryFilters.isXsdType("string",c))&&(QueryFilters.isSimpleLiteral(b)||QueryFilters.isXsdType("string",b))||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isXsdType("boolean",b))return QueryFilters.ebvBoolean(QueryFilters.effectiveTypeValue(c)==QueryFilters.effectiveTypeValue(b));if((QueryFilters.isXsdType("dateTime",c)||QueryFilters.isXsdType("date",c))&&(QueryFilters.isXsdType("dateTime",
b)||QueryFilters.isXsdType("date",b))){if(QueryFilters.isXsdType("dateTime",c)&&QueryFilters.isXsdType("date",b)||QueryFilters.isXsdType("date",c)&&QueryFilters.isXsdType("dateTime",b))return QueryFilters.ebvFalse();c=v.compareDateComponents(c.value,b.value);return null!=c?0==c?QueryFilters.ebvTrue():QueryFilters.ebvFalse():QueryFilters.ebvError()}return QueryFilters.isRDFTerm(c)&&QueryFilters.isRDFTerm(b)?QueryFilters.ebvBoolean(QueryFilters.RDFTermEquality(c,b,f,r)):QueryFilters.ebvFalse()};QueryFilters.runGtFunction=
function(c,b,a){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();if(QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b)||QueryFilters.isSimpleLiteral(c)&&QueryFilters.isSimpleLiteral(b)||QueryFilters.isXsdType("string",c)&&QueryFilters.isXsdType("string",b)||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isXsdType("boolean",b))return QueryFilters.ebvBoolean(QueryFilters.effectiveTypeValue(c)>QueryFilters.effectiveTypeValue(b));if((QueryFilters.isXsdType("dateTime",
c)||QueryFilters.isXsdType("date",c))&&(QueryFilters.isXsdType("dateTime",b)||QueryFilters.isXsdType("date",b))){if(QueryFilters.isXsdType("dateTime",c)&&QueryFilters.isXsdType("date",b)||QueryFilters.isXsdType("date",c)&&QueryFilters.isXsdType("dateTime",b))return QueryFilters.ebvFalse();c=v.compareDateComponents(c.value,b.value);return null!=c?1==c?QueryFilters.ebvTrue():QueryFilters.ebvFalse():QueryFilters.ebvError()}return QueryFilters.ebvFalse()};QueryFilters.runTotalGtFunction=function(c,b){return QueryFilters.isEbvError(c)||
QueryFilters.isEbvError(b)?QueryFilters.ebvError():QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b)||QueryFilters.isSimpleLiteral(c)&&QueryFilters.isSimpleLiteral(b)||QueryFilters.isXsdType("string",c)&&QueryFilters.isSimpleLiteral("string",b)||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isSimpleLiteral("boolean",b)||QueryFilters.isXsdType("dateTime",c)&&QueryFilters.isSimpleLiteral("dateTime",b)?QueryFilters.runGtFunction(c,b,[]):c.token&&"uri"===c.token&&b.token&&"uri"===b.token?QueryFilters.ebvBoolean(c.value>
b.value):c.token&&"literal"===c.token&&b.token&&"literal"===b.token?QueryFilters.ebvBoolean(""+c.value+c.type+c.lang>""+b.value+b.type+b.lang):c.token&&"blank"===c.token&&b.token&&"blank"===b.token?QueryFilters.ebvBoolean(c.value>b.value):c.value&&b.value?QueryFilters.ebvBoolean(c.value>b.value):QueryFilters.ebvTrue()};QueryFilters.runLtFunction=function(c,b,a){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();if(QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b)||
QueryFilters.isSimpleLiteral(c)&&QueryFilters.isSimpleLiteral(b)||QueryFilters.isXsdType("string",c)&&QueryFilters.isXsdType("string",b)||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isXsdType("boolean",b))return QueryFilters.ebvBoolean(QueryFilters.effectiveTypeValue(c)<QueryFilters.effectiveTypeValue(b));if((QueryFilters.isXsdType("dateTime",c)||QueryFilters.isXsdType("date",c))&&(QueryFilters.isXsdType("dateTime",b)||QueryFilters.isXsdType("date",b))){if(QueryFilters.isXsdType("dateTime",
c)&&QueryFilters.isXsdType("date",b)||QueryFilters.isXsdType("date",c)&&QueryFilters.isXsdType("dateTime",b))return QueryFilters.ebvFalse();c=v.compareDateComponents(c.value,b.value);return null!=c?-1==c?QueryFilters.ebvTrue():QueryFilters.ebvFalse():QueryFilters.ebvError()}return QueryFilters.ebvFalse()};QueryFilters.runGtEqFunction=function(c,b,a){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();if(QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b)||QueryFilters.isSimpleLiteral(c)&&
QueryFilters.isSimpleLiteral(b)||QueryFilters.isXsdType("string",c)&&QueryFilters.isXsdType("string",b)||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isXsdType("boolean",b))return QueryFilters.ebvBoolean(QueryFilters.effectiveTypeValue(c)>=QueryFilters.effectiveTypeValue(b));if((QueryFilters.isXsdType("dateTime",c)||QueryFilters.isXsdType("date",c))&&(QueryFilters.isXsdType("dateTime",b)||QueryFilters.isXsdType("date",b))){if(QueryFilters.isXsdType("dateTime",c)&&QueryFilters.isXsdType("date",
b)||QueryFilters.isXsdType("date",c)&&QueryFilters.isXsdType("dateTime",b))return QueryFilters.ebvFalse();c=v.compareDateComponents(c.value,b.value);return null!=c?-1!=c?QueryFilters.ebvTrue():QueryFilters.ebvFalse():QueryFilters.ebvError()}return QueryFilters.ebvFalse()};QueryFilters.runLtEqFunction=function(c,b,a){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();if(QueryFilters.isNumeric(c)&&QueryFilters.isNumeric(b)||QueryFilters.isSimpleLiteral(c)&&QueryFilters.isSimpleLiteral(b)||
QueryFilters.isXsdType("string",c)&&QueryFilters.isXsdType("string",b)||QueryFilters.isXsdType("boolean",c)&&QueryFilters.isXsdType("boolean",b))return QueryFilters.ebvBoolean(QueryFilters.effectiveTypeValue(c)<=QueryFilters.effectiveTypeValue(b));if((QueryFilters.isXsdType("dateTime",c)||QueryFilters.isXsdType("date",c))&&(QueryFilters.isXsdType("dateTime",b)||QueryFilters.isXsdType("date",b))){if(QueryFilters.isXsdType("dateTime",c)&&QueryFilters.isXsdType("date",b)||QueryFilters.isXsdType("date",
c)&&QueryFilters.isXsdType("dateTime",b))return QueryFilters.ebvFalse();c=v.compareDateComponents(c.value,b.value);return null!=c?1!=c?QueryFilters.ebvTrue():QueryFilters.ebvFalse():QueryFilters.ebvError()}return QueryFilters.ebvFalse()};QueryFilters.runAddition=function(c,b,a,f,h,r){var d=QueryFilters.runFilter(c,a,f,h,r);if(QueryFilters.isEbvError(d))return QueryFilters.ebvError();c=d;if(QueryFilters.isNumeric(d)){for(d=0;d<b.length;d++){var l=QueryFilters.runFilter(b[d].expression,a,f,h,r);if(QueryFilters.isNumeric(l))"+"===
b[d].operator?c=QueryFilters.runSumFunction(c,l):"-"===b[d].operator&&(c=QueryFilters.runSubFunction(c,l));else return QueryFilters.ebvFalse()}return c}return QueryFilters.ebvFalse()};QueryFilters.runSumFunction=function(c,b){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();var a=QueryFilters.effectiveTypeValue(c)+QueryFilters.effectiveTypeValue(b);return QueryFilters.isDouble(c)||QueryFilters.isDouble(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#double",
value:a}:QueryFilters.isFloat(c)||QueryFilters.isFloat(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#float",value:a}:QueryFilters.isDecimal(c)||QueryFilters.isDecimal(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#decimal",value:a}:{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:a}};QueryFilters.runSubFunction=function(c,b){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();var a=QueryFilters.effectiveTypeValue(c)-
QueryFilters.effectiveTypeValue(b);return QueryFilters.isDouble(c)||QueryFilters.isDouble(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#double",value:a}:QueryFilters.isFloat(c)||QueryFilters.isFloat(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#float",value:a}:QueryFilters.isDecimal(c)||QueryFilters.isDecimal(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#decimal",value:a}:{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:a}};QueryFilters.runMultiplication=
function(c,b,a,f,h,r){c=QueryFilters.runFilter(c,a,f,h,r);if(QueryFilters.isEbvError(c))return c;var d=c;if(QueryFilters.isNumeric(c)){for(var l=0;l<b.length;l++){var m=QueryFilters.runFilter(b[l].expression,a,f,h,r);if(QueryFilters.isEbvError(m))return c;if(QueryFilters.isNumeric(m))"*"===b[l].operator?d=QueryFilters.runMulFunction(d,m):"/"===b[l].operator&&(d=QueryFilters.runDivFunction(d,m));else return QueryFilters.ebvFalse()}return d}return QueryFilters.ebvFalse()};QueryFilters.runMulFunction=
function(c,b){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();var a=QueryFilters.effectiveTypeValue(c)*QueryFilters.effectiveTypeValue(b);return QueryFilters.isDouble(c)||QueryFilters.isDouble(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#double",value:a}:QueryFilters.isFloat(c)||QueryFilters.isFloat(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#float",value:a}:QueryFilters.isDecimal(c)||QueryFilters.isDecimal(b)?{token:"literal",
type:"http://www.w3.org/2001/XMLSchema#decimal",value:a}:{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:a}};QueryFilters.runDivFunction=function(c,b){if(QueryFilters.isEbvError(c)||QueryFilters.isEbvError(b))return QueryFilters.ebvError();var a=QueryFilters.effectiveTypeValue(c)/QueryFilters.effectiveTypeValue(b);return QueryFilters.isDouble(c)||QueryFilters.isDouble(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#double",value:a}:QueryFilters.isFloat(c)||QueryFilters.isFloat(b)?
{token:"literal",type:"http://www.w3.org/2001/XMLSchema#float",value:a}:QueryFilters.isDecimal(c)||QueryFilters.isDecimal(b)?{token:"literal",type:"http://www.w3.org/2001/XMLSchema#decimal",value:a}:{token:"literal",type:"http://www.w3.org/2001/XMLSchema#integer",value:a}};QueryFilters.runBuiltInCall=function(c,b,a,f,h,r){if("notexists"===c||"exists"===c){c=[];for(var d in a)c.push(JSON.stringify(a[d]));c=c.sort().join("");return b[c]}d=[];for(var l=0;l<b.length;l++)if("var"===b[l].token)d.push(b[l]);
else{var m=QueryFilters.runFilter(b[l],a,f,h,r);if(QueryFilters.isEbvError(m))return m;d.push(m)}if("str"===c)return"literal"===d[0].token?{token:"literal",type:null,value:""+d[0].value}:"uri"===d[0].token?{token:"literal",type:null,value:d[0].value}:QueryFilters.ebvFalse();if("lang"===c)return"literal"===d[0].token?null!=d[0].lang?{token:"literal",value:""+d[0].lang}:{token:"literal",value:""}:QueryFilters.ebvError();if("datatype"===c)return"literal"===d[0].token?(a=d[0],null!=a.type?"string"===
typeof a.type?{token:"uri",value:a.type,prefix:null,suffix:null}:a.type:null==a.lang?{token:"uri",value:"http://www.w3.org/2001/XMLSchema#string",prefix:null,suffix:null}:QueryFilters.ebvError()):QueryFilters.ebvError();if("isliteral"===c)return"literal"===d[0].token?QueryFilters.ebvTrue():QueryFilters.ebvFalse();if("isblank"===c)return"blank"===d[0].token?QueryFilters.ebvTrue():QueryFilters.ebvFalse();if("isuri"===c||"isiri"===c)return"uri"===d[0].token?QueryFilters.ebvTrue():QueryFilters.ebvFalse();
if("sameterm"===c)return a=QueryFilters.RDFTermEquality(d[0],d[1],f,r),QueryFilters.isEbvError(a)&&(a=!1),QueryFilters.ebvBoolean(a);if("langmatches"===c)return a=d[0],b=d[1],"literal"===a.token&&"literal"===b.token?"*"===b.value&&""!=a.value?QueryFilters.ebvTrue():QueryFilters.ebvBoolean(0===a.value.toLowerCase().indexOf(b.value.toLowerCase())):QueryFilters.ebvError();if("bound"===c)return b=d[0].value,null==b?QueryFilters.ebvError():null!=a[b]?QueryFilters.ebvTrue():QueryFilters.ebvFalse();if(null!=
f.customFns[c])return f.customFns[c](QueryFilters,d);throw"Builtin call "+c+" not implemented yet";};QueryFilters.runUnaryExpression=function(c,b,a,f,h,r){b=QueryFilters.runFilter(b,a,f,h,r);if(QueryFilters.isEbvError(b))return b;if("!"===c){var d=QueryFilters.ebv(b);return QueryFilters.isEbvError(d)?QueryFilters.ebvFalse():QueryFilters.ebvBoolean(!d)}if("+"===c)return QueryFilters.isNumeric(b)?b:QueryFilters.ebvError();if("-"===c){if(QueryFilters.isNumeric(b)){c={};for(d in b)c[d]=b[d];c.value=-c.value;
return c}return QueryFilters.ebvError()}};QueryFilters.runRegex=function(c,b,a,f,h,r,d){if(null!=c)c=QueryFilters.runFilter(c,f,h,r,d);else return QueryFilters.ebvError();if(null!=b)b=QueryFilters.runFilter(b,f,h,r,d);else return QueryFilters.ebvError();null!=a&&(a=QueryFilters.runFilter(a,f,h,r,d));if(null==b||"literal"!==b.token||null!=a&&"literal"!==a.token)return QueryFilters.ebvError();b=b.value;a=null==a?null:a.value;if(null!=c&&"var"==c.token)if(null!=f[c.value])c=f[c.value];else return QueryFilters.ebvError();
else if(null!=c&&"literal"===c.token)if(null==c.type||QueryFilters.isXsdType("string",c))c=c.value;else return QueryFilters.ebvError();else return QueryFilters.ebvError();return(null==a?new RegExp(b):new RegExp(b,a.toLowerCase())).exec(c)?QueryFilters.ebvTrue():QueryFilters.ebvFalse()};QueryFilters.normalizeLiteralDatatype=function(c,b,a){null!=c.value.type&&"object"==typeof c.value.type&&(c.value.type=v.lexicalFormBaseUri(c.value.type,a));return c};QueryFilters.runIriRefOrFunction=function(c,b,a,
f,h,r){if(null==b)return c;for(var d=[],l=0;l<b.length;l++)d.push(QueryFilters.runFilter(b[l],a,f,h,r));c=v.lexicalFormBaseUri(c,r);if("http://www.w3.org/2001/XMLSchema#integer"==c||"http://www.w3.org/2001/XMLSchema#decimal"==c||"http://www.w3.org/2001/XMLSchema#double"==c||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==c||"http://www.w3.org/2001/XMLSchema#negativeInteger"==c||"http://www.w3.org/2001/XMLSchema#long"==c||"http://www.w3.org/2001/XMLSchema#int"==c||"http://www.w3.org/2001/XMLSchema#short"==
c||"http://www.w3.org/2001/XMLSchema#byte"==c||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==c||"http://www.w3.org/2001/XMLSchema#unsignedLong"==c||"http://www.w3.org/2001/XMLSchema#unsignedInt"==c||"http://www.w3.org/2001/XMLSchema#unsignedShort"==c||"http://www.w3.org/2001/XMLSchema#unsignedByte"==c||"http://www.w3.org/2001/XMLSchema#positiveInteger"==c)if(d=d[0],"literal"===d.token){d=QueryFilters.normalizeLiteralDatatype(d,f,r);if("http://www.w3.org/2001/XMLSchema#integer"==d.type||"http://www.w3.org/2001/XMLSchema#decimal"==
d.type||"http://www.w3.org/2001/XMLSchema#double"==d.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==d.type||"http://www.w3.org/2001/XMLSchema#negativeInteger"==d.type||"http://www.w3.org/2001/XMLSchema#long"==d.type||"http://www.w3.org/2001/XMLSchema#int"==d.type||"http://www.w3.org/2001/XMLSchema#short"==d.type||"http://www.w3.org/2001/XMLSchema#byte"==d.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==
d.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==d.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==d.type)return d.type=c,d;if("http://www.w3.org/2001/XMLSchema#boolean"==d.type)return 1==QueryFilters.ebv(d)?(d.type=c,d.value=1):(d.type=c,d.value=0),d;if("http://www.w3.org/2001/XMLSchema#float"==d.type||"http://www.w3.org/2001/XMLSchema#double"==d.type)return d.type=c,d.value=parseInt(d.value),d;if("http://www.w3.org/2001/XMLSchema#string"==
d.type||null==d.type){if(2<d.value.split(".").length||2<d.value.split("-").length||2<d.value.split("/").length||2<d.value.split("+").length||"http://www.w3.org/2001/XMLSchema#decimal"==c&&(-1!=d.value.indexOf("e")||-1!=d.value.indexOf("E")))return QueryFilters.ebvError();if("http://www.w3.org/2001/XMLSchema#int"==c||"http://www.w3.org/2001/XMLSchema#integer"==c)if(-1!=d.value.indexOf("e")||-1!=d.value.indexOf("E")||-1!=d.value.indexOf("."))return QueryFilters.ebvError();try{d.value=parseInt(parseFloat(d.value));
if(isNaN(d.value))return QueryFilters.ebvError();d.type=c;return d}catch(m){return QueryFilters.ebvError()}}else return QueryFilters.ebvError()}else return QueryFilters.ebvError();else{if("http://www.w3.org/2001/XMLSchema#boolean"==c)return d=d[0],"literal"===d.token&&null==d.type?"true"===d.value||"1"===d.value?QueryFilters.ebvTrue():"false"===d.value||"0"===d.value?QueryFilters.ebvFalse():QueryFilters.ebvError():"literal"===d.token?QueryFilters.isEbvError(d)?d:QueryFilters.ebvBoolean(d):QueryFilters.ebvError();
if("http://www.w3.org/2001/XMLSchema#string"==c)return d=d[0],"literal"===d.token?(d=QueryFilters.normalizeLiteralDatatype(d,f,r),"http://www.w3.org/2001/XMLSchema#integer"==d.type||"http://www.w3.org/2001/XMLSchema#decimal"==d.type||"http://www.w3.org/2001/XMLSchema#double"==d.type||"http://www.w3.org/2001/XMLSchema#nonPositiveInteger"==d.type||"http://www.w3.org/2001/XMLSchema#negativeInteger"==d.type||"http://www.w3.org/2001/XMLSchema#long"==d.type||"http://www.w3.org/2001/XMLSchema#int"==d.type||
"http://www.w3.org/2001/XMLSchema#short"==d.type||"http://www.w3.org/2001/XMLSchema#byte"==d.type||"http://www.w3.org/2001/XMLSchema#nonNegativeInteger"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedLong"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedInt"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedShort"==d.type||"http://www.w3.org/2001/XMLSchema#unsignedByte"==d.type||"http://www.w3.org/2001/XMLSchema#positiveInteger"==d.type||"http://www.w3.org/2001/XMLSchema#float"==d.type?(d.type=
c,d.value=""+d.value,d):"http://www.w3.org/2001/XMLSchema#string"==d.type?d:"http://www.w3.org/2001/XMLSchema#boolean"==d.type?(QueryFilters.ebv(d)?(d.type=c,d.value="true"):(d.type=c,d.value="false"),d):"http://www.w3.org/2001/XMLSchema#dateTime"==d.type||"http://www.w3.org/2001/XMLSchema#date"==d.type?(d.type=c,"string"!=typeof d.value&&(d.value=v.iso8601(d.value)),d):null==d.type?(d.value=""+d.value,d.type=c,d):QueryFilters.ebvError()):"uri"===d.token?{token:"literal",value:v.lexicalFormBaseUri(d,
r),type:c,lang:null}:QueryFilters.ebvError();if("http://www.w3.org/2001/XMLSchema#dateTime"==c||"http://www.w3.org/2001/XMLSchema#date"==c){d=d[0];if("http://www.w3.org/2001/XMLSchema#dateTime"==d.type||"http://www.w3.org/2001/XMLSchema#date"==d.type)return d;if("http://www.w3.org/2001/XMLSchema#string"==d.type||null==d.type)try{return d.value=v.iso8601(v.parseISO8601(d.value)),d.type=c,d}catch(m){return QueryFilters.ebvError()}else return QueryFilters.ebvError()}else if("http://www.w3.org/2001/XMLSchema#float"==
c)if(d=d[0],"literal"===d.token){d=QueryFilters.normalizeLiteralDatatype(d,f,r);if("http://www.w3.org/2001/XMLSchema#decimal"==d.type||"http://www.w3.org/2001/XMLSchema#int"==d.type)return d.type=c,d.value=parseFloat(d.value),d;if("http://www.w3.org/2001/XMLSchema#boolean"==d.type)return 1==QueryFilters.ebv(d)?(d.type=c,d.value=1):(d.type=c,d.value=0),d;if("http://www.w3.org/2001/XMLSchema#float"==d.type||"http://www.w3.org/2001/XMLSchema#double"==d.type)return d.type=c,d.value=parseFloat(d.value),
d;if("http://www.w3.org/2001/XMLSchema#string"==d.type)try{d.value=parseFloat(d.value);if(isNaN(d.value))return QueryFilters.ebvError();d.type=c;return d}catch(m){return QueryFilters.ebvError()}else if(null==d.type){if(2<d.value.split(".").length||2<d.value.split("-").length||2<d.value.split("/").length||2<d.value.split("+").length)return QueryFilters.ebvError();try{d.value=parseFloat(d.value);if(isNaN(d.value))return QueryFilters.ebvError();d.type=c;return d}catch(m){return QueryFilters.ebvError()}}else return QueryFilters.ebvError()}else return QueryFilters.ebvError();
else return null!=f.customFns[c]?f.customFns[c](QueryFilters,d):QueryFilters.ebvError()}};B.exports={QueryFilters:QueryFilters}},{"./utils":57}],53:[function(z,B,C){var v=z("./utils"),h=z("./utils"),c={variablesInBGP:function(b){var a=b.variables;if(a)return a;var c=b.value||b,a=[],h;for(h in c)c[h]&&"var"===c[h].token?a.push(c[h].value):c[h]&&"blank"===c[h].token&&a.push("blank:"+c[h].value);return b.variables=a},connected:function(b,a){for(var c="/"+b.vars.join("/")+"/",h=0;h<a.vars.length;h++)if(-1!=
c.indexOf("/"+a.vars[h]+"/"))return!0;return!1},variablesIntersectionBGP:function(b,a){for(var f=c.variablesInBGP(b),h=c.variablesInBGP(a),r={},d=0;d<f.lenght;d++)r[f[d]]=1;for(d=0;d<h.length;d++)f=r[h[d]]||0,f++,r[h[d]]=f;var h=[],l;for(l in r)2==r[l]&&h.push(r[l]);return h},executeAndBGPsGroups:function(b){for(var a={},f={},h=0,r=function(a,b){for(var c=0;c<a.length;c++)if(-1!=b.indexOf("/"+a[c]+"/"))return!0;return!1},d=function(b,c,d,h){var k=[],l="",n="",m;for(m in c)l+=m,k=k.concat(a[m]),n+=
f[m];n=n+x.join("/")+"/";k.push(b);d[l]=k;h[l]=n},l=0;l<b.length;l++){var m=b[l],u={},n={},x=c.variablesInBGP(m),z={},y;for(y in f)r(x,f[y])?z[y]=!0:(u[y]=a[y],n[y]=f[y]);0===v.size(z)?(u["g"+h]=[m],n["g"+h]="/"+x.join("/")+"/",h++):d(m,z,u,n);a=u;f=n}return v.values(a)},intersectionSize:function(b,a){for(var c=a.i.split("_"),h=0;h<c.length;h++)if(""!=c[h]&&-1!=b.i.indexOf("_"+c[h]+"_"))return 1;return 0},createJoinTree:function(b,a){for(var c="/"+b.vars.join("/")+"/",h=b.vars.concat([]),r=[],d=0;d<
a.vars.length;d++)-1!=c.indexOf("/"+a.vars[d]+"/")?0==a.vars[d].indexOf("_:")?r.push("blank:"+a.vars[d]):r.push(a.vars[d]):h.push(a.vars[d]);for(var c=a.i.split("_"),l=b.i.split("_"),m={},d=0;d<c.length;d++)""!=c[d]&&(m[c[d]]=!0);for(d=0;d<l.length;d++)""!=l[d]&&(m[l[d]]=!0);d=v.keys(m);return{left:b,right:a,cost:b.cost+a.cost,i:"_"+d.sort().join("_")+"_",vars:h,join:r}},executeBushyTree:function(b,a,f,h,r){null==b.left?c.executeEmptyJoinBGP(b.right,a,f,h,r):null==b.right?c.executeEmptyJoinBGP(b.left,
a,f,h,r):c.executeBushyTree(b.left,a,f,h,function(d){null!=d?c.executeBushyTree(b.right,a,f,h,function(a){null!=a?r(c.joinBindings2(b.join,d,a)):r(null)}):r(null)})},executeAndBGPsDPSize:function(b,a,f,k,r){b=c.executeAndBGPsGroups(b);var d=[];h.eachSeries(b,function(a,b){f.computeCosts(a,k,function(a){var f={},h={},k={},l=1,r=null,v={};k["1"]=[];for(var z=0;z<a.length;z++){l=[];delete a[z].variables;for(var A in a[z])"_cost"!=A&&("var"===a[z][A].token?l.push(a[z][A].value):"blank"===a[z][A].token&&
l.push(a[z][A].value));h["_"+z+"_"]={left:a[z],right:null,cost:a[z]._cost,i:"_"+z+"_",vars:l};l={left:a[z],right:null,cost:a[z]._cost,i:"_"+z+"_",vars:l};f["_"+z+"_"]=l;delete a[z]._cost;v["_"+z+"_"]=!0;k["1"].push("_"+z+"_");if(null==r||r.cost>l.cost)r=l}for(A=2;A<=a.length;A++)for(var B=1;B<A;B++)for(var C=k[""+B]||[],N=k[""+(A-B)]||[],z=0;z<C.length;z++)for(var W=0;W<N.length;W++)if(C[z]!==N[W]){var O=h[C[z]],J=h[N[W]];if(0==c.intersectionSize(O,J)&&c.connected(O,J)&&(l=A,O=c.createJoinTree(f[O.i],
f[J.i]),!v[O.i])){v[O.i]=!0;J=O.cost+1;null!=f[O.i]&&(J=f[O.i].cost);var ta=k[A]||[];ta.push(O.i);h[O.i]=O;k[A]=ta;J>O.cost&&(l===A&&(r=O),f[O.i]=O)}}d.push(r);b()})},function(){var b=null;h.eachSeries(d,function(d,h){c.executeBushyTree(d,a,f,k,function(a){a?(b=null==b?a:c.crossProductBindings(b,a),h()):h("Error executing bushy tree")})},function(a){a?r(null,a):r(b)})})},executeEmptyJoinBGP:function(b,a,f,h,r){return c.executeBGPDatasets(b,a,f,h,r)},executeBGPDatasets:function(b,a,f,k,r){var d={};
if(null==b.graph){var l=[];h.eachSeries(a.implicit,function(a,h){null==d[a.oid]?(d[a.oid]=!0,b.graph=a,f.rangeQuery(b,k,function(a){a=c.buildBindingsFromRange(a,b);l.push(a);h()})):h()},function(){var a=c.unionManyBindings(l);r(a)})}else if("var"===b.graph.token){var m=b.graph.value,l=[];h.eachSeries(a.named,function(a,h){null==d[a.oid]?(d[a.oid]=!0,b.graph=a,null!=l?f.rangeQuery(b,k,function(d){if(null!=d){d=c.buildBindingsFromRange(d,b);for(var f=0;f<d.length;f++)d[f][m]=a.oid;l.push(d)}else l=
null;h()}):h()):h()},function(){if(null==l)r(null);else{var a=c.unionManyBindings(l);r(a)}})}else f.rangeQuery(b,k,function(a){null!=a?(a=c.buildBindingsFromRange(a,b),r(a)):r(null)})},buildBindingsFromRange:function(b,a){c.variablesInBGP(a);var f=a.value||a,h={};for(u in f)f[u]&&"var"===f[u].token?h[u]=f[u].value:f[u]&&"blank"===f[u].token&&(h[u]="blank:"+f[u].value);f=[];if(null!=b)for(var r=0;r<b.length;r++){var d={},l=b[r],m=!1,u;for(u in h){var n=l[u];if(null==d[h[u]]||d[h[u]]===n)d[h[u]]=n;
else{m=!0;break}}m||f.push(d)}return f},areCompatibleBindings:function(b,a){for(var c in b)if(null!=a[c]&&a[c]!=b[c])return!1;return!0},mergeBindings:function(b,a){var c={},h;for(h in b)c[h]=b[h];for(h in a)c[h]=a[h];return c},joinBindings2:function(b,a,f){for(var h={},r,d,l,m,u=[],n=0;n<a.length;n++){r=a[n];m=h;for(var v=0;v<b.length;v++)d=b[v],d=r[d],v==b.length-1?(l=m[d]||[],l.push(r),m[d]=l):(l=m[d]||{},m=m[d]=l)}for(n=0;n<f.length;n++)for(r=f[n],m=h,v=0;v<b.length;v++)if(d=b[v],d=r[d],null!=
m[d])if(v==b.length-1)for(a=0;a<m[d].length;a++)u.push(c.mergeBindings(m[d][a],r));else m=m[d];return u},joinBindings:function(b,a){for(var f=[],h=0;h<b.length;h++)for(var r=b[h],d=0;d<a.length;d++){var l=a[d];c.areCompatibleBindings(r,l)&&f.push(c.mergeBindings(r,l))}return f},augmentMissingBindings:function(b,a){for(var c in a)null==b[c]&&(b[c]=null);return b},leftOuterJoinBindings:function(b,a){for(var f=[],h=0;h<b.length;h++){for(var r=b[h],d=!1,l=0;l<a.length;l++){var m=a[l];c.areCompatibleBindings(r,
m)&&(d=!0,f.push(c.mergeBindings(r,m)))}!1===d&&(c.augmentMissingBindings(r,m),f.push(r))}return f},crossProductBindings:function(b,a){for(var f=[],h=0;h<b.length;h++)for(var r=b[h],d=0;d<a.length;d++)f.push(c.mergeBindings(r,a[d]));return f},unionBindings:function(b,a){return b.concat(a)},unionManyBindings:function(b){for(var a=[],f=0;f<b.length;f++)a=c.unionBindings(a,b[f]);return a}};B.exports={QueryPlan:c}},{"./utils":57}],54:[function(z,B,C){var v=z("./network_transport").NetworkTransport,h=
z("./rvn3_parser").RVN3Parser,c=z("./jsonld_parser").JSONLDParser,b=z("./utils");C=function(a){this.precedences=["text/turtle","text/n3","application/ld+json","application/json"];this.parsers={"text/turtle":h.parser,"text/n3":h.parser,"application/ld+json":c.parser,"application/json":c.parser};"undefined"!==typeof RDFXMLParser&&(this.precedences.push("application/rdf+xml"),this.parsers["application/rdf+xml"]=RDFXMLParser.parser);if(null!=a)for(var f in a.parsers)this.parsers[f]=a.parsers[f];if(a&&
null!=a.precedences)for(f in this.precedences=a.precedences,a.parsers)b.include(this.precedences,f)||this.precedences.push(f);this.acceptHeaderValue="";for(a=0;a<this.precedences.length;a++)this.acceptHeaderValue=0!=a?this.acceptHeaderValue+","+this.precedences[a]:this.acceptHeaderValue+this.precedences[a]};C.prototype.registerParser=function(a,b){this.parsers[a]=b;this.precedences.push(a)};C.prototype.unregisterParser=function(a){delete this.parsers[a];for(var b=[],c=0;c<this.precedences.length;c++)this.precedences[c]!=
a&&b.push(this.precedences[c]);this.precedences=b};C.prototype.setAcceptHeaderPrecedence=function(a){this.precedences=a};C.prototype.load=function(a,b,c){var h=this;v.load(a,this.acceptHeaderValue,function(d,l){if(d)c(d);else{var m=l.headers["Content-Type"]||l.headers["content-type"],u=l.data;if(null!=m){var m=m.split(";")[0],n;for(n in h.parsers)if(-1!=n.indexOf("/")){var v=n.split("/");if("*"===v[1]){if(-1!=m.indexOf(v[0]))return h.tryToParse(h.parsers[n],b,u,{documentURI:a},c)}else if(-1!=m.indexOf(n)||
-1!=m.indexOf(v[1]))return h.tryToParse(h.parsers[n],b,u,{documentURI:a},c)}else if(-1!=m.indexOf(n))return h.tryToParse(h.parsers[n],b,u,{documentURI:a},c);c(Error("Unknown media type : "+m))}else c(Error("Uknown media type"))}})};C.prototype.loadFromFile=function(a,b,c,h){try{var d=this;z("fs").readFile(c.split("file:/")[1],function(l,m){l?h(l):(m=m.toString("utf8"),d.tryToParse(a,b,m,{documentURI:c},h))})}catch(l){h(l)}};C.prototype.tryToParse=function(a,c,h,r,d){try{"string"===typeof h&&(h=b.normalizeUnicodeLiterals(h)),
a.parse(h,c,r,d)}catch(l){console.log(l.message),console.log(l.stack),d(l)}};B.exports={RDFLoader:C}},{"./jsonld_parser":43,"./network_transport":45,"./rvn3_parser":56,"./utils":57,fs:16}],55:[function(z,B,C){var v=z("./utils"),h=z("./query_filters").QueryFilters;RDFModel={defaultContext:{rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",owl:"http://www.w3.org/2002/07/owl#",xsd:"http://www.w3.org/2001/XMLSchema#",dcterms:"http://purl.org/dc/terms/",foaf:"http://xmlns.com/foaf/0.1/",
cal:"http://www.w3.org/2002/12/cal/ical#",vcard:"http://www.w3.org/2006/vcard/ns# ",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",cc:"http://creativecommons.org/ns#",sioc:"http://rdfs.org/sioc/ns#",doap:"http://usefulinc.com/ns/doap#",com:"http://purl.org/commerce#",ps:"http://purl.org/payswarm#",gr:"http://purl.org/goodrelations/v1#",sig:"http://purl.org/signature#",ccard:"http://purl.org/commerce/creditcard#",ldp:"http://www.w3.org/ns/ldp#"},UrisMap:function(){this.defaultNs="";this.interfaceProperties=
"get remove set setDefault addAll resolve shrink".split(" ")}};RDFModel.UrisMap.prototype.values=function(){var c={},b;for(b in this)v.include(this.interfaceProperties,b)||"function"===typeof this[b]||"defaultNs"===b||"interfaceProperties"===b||(c[b]=this[b]);return c};RDFModel.UrisMap.prototype.get=function(c){if(-1!=c.indexOf(" "))throw"Prefix must not contain any whitespaces";return this[c]};RDFModel.UrisMap.prototype.remove=function(c){if(-1!=c.indexOf(" "))throw"Prefix must not contain any whitespaces";
delete this[c];return null};RDFModel.UrisMap.prototype.set=function(c,b){if(-1!=c.indexOf(" "))throw"Prefix must not contain any whitespaces";this[c]=b};RDFModel.UrisMap.prototype.setDefault=function(c){this.defaultNs=c};RDFModel.UrisMap.prototype.addAll=function(c,b){for(var a in c)v.include(this.interfaceProperties,a)||(null!=this[a]?!0===b&&(this[a]=c[a]):this[a]=c[a]);return this};RDFModel.UrisMap.prototype.resolve=function(c){var b=c.split(":");c=b[0];b=b[1];return""===c?null==this.defaultNs?
null:this.defaultNs+b:null!=this[c]?this[c]+b:null};RDFModel.UrisMap.prototype.shrink=function(c){for(var b in this){var a=this[b];if(0===c.indexOf(a)&&""!==a&&"defaultNs"!=b)return c=c.split(a)[1],b+":"+c}return c};RDFModel.Profile=function(){this.prefixes=new RDFModel.UrisMap;this.terms=new RDFModel.UrisMap};RDFModel.Profile.prototype.importProfile=function(c,b){this.prefixes.addAll(c.prefixes,b);this.terms.addAll(c.terms,b)};RDFModel.Profile.prototype.resolve=function(c){return-1!=c.indexOf(":")?
this.prefixes.resolve(c):null!=this.terms[c]?this.terms.resolve(c):null};RDFModel.Profile.prototype.setDefaultPrefix=function(c){this.prefixes.setDefault(c)};RDFModel.Profile.prototype.setDefaultVocabulary=function(c){this.terms.setDefault(c)};RDFModel.Profile.prototype.setPrefix=function(c,b){this.prefixes.set(c,b)};RDFModel.Profile.prototype.setTerm=function(c,b){this.terms.set(c,b)};RDFModel.RDFEnvironment=function(){RDFModel.Profile.call(this);this.blankNodeCounter=0;var c=this;this.filters={s:function(a){return function(b){return b.subject.equals(a)}},
p:function(a){return function(b){return b.predicate.equals(a)}},o:function(a){return function(b){return b.object.equals(a)}},sp:function(a,b){return function(c){return c.subject.equals(a)&&c.predicate.equals(b)}},so:function(a,b){return function(c){return c.subject.equals(a)&&c.object.equals(b)}},po:function(a,b){return function(c){return c.predicate.equals(a)&&c.object.equals(b)}},spo:function(a,b,c){return function(h){return h.subject.equals(a)&&h.predicate.equals(b)&&h.object.equals(c)}},describes:function(a){return function(b){return b.subject.equals(a)||
b.object.equals(a)}},type:function(a){var b=c.resolve("rdf:type");return function(c){return c.predicate.equals(b)&&c.object.equals(a)}}};for(var b in RDFModel.defaultContext)this.prefixes.set(b,RDFModel.defaultContext[b])};RDFModel.RDFEnvironment.prototype=v.create(RDFModel.Profile.prototype,{constructor:RDFModel.RDFEnvironment});RDFModel.RDFEnvironment.prototype.createBlankNode=function(){var c=new RDFModel.BlankNode(this.blankNodeCounter);this.blankNodeCounter++;return c};RDFModel.RDFEnvironment.prototype.createNamedNode=
function(c){var b=this.resolve(c);return null!=b?new RDFModel.NamedNode(b):new RDFModel.NamedNode(c)};RDFModel.RDFEnvironment.prototype.createLiteral=function(c,b,a){return null!=a?new RDFModel.Literal(c,b,a.toString()):new RDFModel.Literal(c,b,a)};RDFModel.RDFEnvironment.prototype.createTriple=function(c,b,a){return new RDFModel.Triple(c,b,a)};RDFModel.RDFEnvironment.prototype.createGraph=function(c){var b=new RDFModel.Graph;if(null!=c)for(var a=0;a<c.length;a++)b.add(c[a]);return b};RDFModel.RDFEnvironment.prototype.createAction=
function(c,b){return function(a){return c(a)?b(a):a}};RDFModel.RDFEnvironment.prototype.createProfile=function(c){if(!0===c)return new RDFModel.RDFEnvironment.Profile;c=new RDFModel.RDFEnvironment.Profile;c.importProfile(this);return c};RDFModel.RDFEnvironment.prototype.createTermMap=function(c){if(!0===c)return new RDFModel.UrisMap;c=this.terms.values();var b=new RDFModel.UrisMap,a;for(a in c)b[a]=c[a];return b};RDFModel.RDFEnvironment.prototype.createPrefixMap=function(c){if(!0===c)return new RDFModel.UrisMap;
c=this.prefixes.values();var b=new RDFModel.UrisMap,a;for(a in c)b[a]=c[a];return b};RDFModel.RDFNode=function(c){this.interfaceName=c;this.attributes=["interfaceName","nominalValue"]};RDFModel.RDFNode.prototype.equals=function(c){if(null==c.interfaceName)return this.valueOf()==c;for(var b in this.attributes){var a=this.attributes[b];if(this[a]!=c[a])return!1}return!0};RDFModel.BlankNode=function(c){RDFModel.RDFNode.call(this,"BlankNode");this.nominalValue="_:"+c;this.bnodeId=c};RDFModel.BlankNode.prototype=
v.create(RDFModel.RDFNode.prototype,{constructor:RDFModel.BlankNode});RDFModel.BlankNode.prototype.toString=function(){return this.nominalValue};RDFModel.BlankNode.prototype.toNT=function(){return this.nominalValue};RDFModel.BlankNode.prototype.valueOf=function(){return this.nominalValue};RDFModel.Literal=function(c,b,a){RDFModel.RDFNode.call(this,"Literal");this.nominalValue=c;null!=b?this.language=b:null!=a&&(this.datatype=a)};RDFModel.Literal.prototype=v.create(RDFModel.RDFNode.prototype,{constructor:RDFModel.Literal});
RDFModel.Literal.prototype.toString=function(){var c='"'+this.nominalValue+'"';if(null!=this.language)c=c+"@"+this.language;else if(null!=this.datatype||this.type)c=c+"^^<"+(this.datatype||this.type)+">";return c};RDFModel.Literal.prototype.toNT=function(){return this.toString()};RDFModel.Literal.prototype.valueOf=function(){return h.effectiveTypeValue({token:"literal",type:this.type||this.datatype,value:this.nominalValue,language:this.language})};RDFModel.NamedNode=function(c){RDFModel.RDFNode.call(this,
"NamedNode");this.nominalValue=null!=c.value?c.value:c};RDFModel.NamedNode.prototype=v.create(RDFModel.RDFNode.prototype,{constructor:RDFModel.NamedNode});RDFModel.NamedNode.prototype.toString=function(){return this.nominalValue};RDFModel.NamedNode.prototype.toNT=function(){return"<"+this.toString()+">"};RDFModel.NamedNode.prototype.valueOf=function(){return this.nominalValue};RDFModel.Triple=function(c,b,a){this.subject=c;this.predicate=b;this.object=a};RDFModel.Triple.prototype.equals=function(c){return this.subject.equals(c.subject)&&
this.predicate.equals(c.predicate)&&this.object.equals(c.object)};RDFModel.Triple.prototype.toString=function(){return this.subject.toNT()+" "+this.predicate.toNT()+" "+this.object.toNT()+" . \r\n"};RDFModel.Graph=function(){this.triples=[];this.duplicates={};this.actions=[];this.length=0};RDFModel.Graph.prototype.add=function(c){for(var b=0;b<this.actions.length;b++)c=this.actions[b](c);b=c.subject.toString()+c.predicate.toString()+c.object.toString();this.duplicates[b]||(this.duplicates[b]=!0,this.triples.push(c));
this.length=this.triples.length;return this};RDFModel.Graph.prototype.addAction=function(c,b){this.actions.push(c);if(1==b)for(var a=0;a<this.triples.length;a++)this.triples[a]=c(this.triples[a]);return this};RDFModel.Graph.prototype.addAll=function(c){c=c.toArray();for(var b=0;b<c.length;b++)this.add(c[b]);this.length=this.triples.length;return this};RDFModel.Graph.prototype.remove=function(c){for(var b=null,a=0;a<this.triples.length;a++)if(this.triples[a].equals(c)){delete this.duplicates[c.subject.toString()+
c.predicate.toString()+c.object.toString()];b=a;break}null!=b&&this.triples.splice(b,1);this.length=this.triples.length;return this};RDFModel.Graph.prototype.toArray=function(){return this.triples};RDFModel.Graph.prototype.some=function(c){for(var b=0;b<this.triples.length;b++)if(!0===c(this.triples[b],this))return!0;return!1};RDFModel.Graph.prototype.every=function(c){for(var b=0;b<this.triples.length;b++)if(!1===c(this.triples[b],this))return!1;return!0};RDFModel.Graph.prototype.filter=function(c){for(var b=
new RDFModel.Graph,a=0;a<this.triples.length;a++)!0===c(this.triples[a],this)&&b.add(this.triples[a]);return b};RDFModel.Graph.prototype.forEach=function(c){for(var b=0;b<this.triples.length;b++)c(this.triples[b],this)};RDFModel.Graph.prototype.merge=function(c){c=new RDFModel.Graph;for(var b=0;b<this.triples.length;b++)c.add(this.triples[b]);return c};RDFModel.Graph.prototype.match=function(c,b,a,f){for(var h=new RDFModel.Graph,r=0,d=0;d<this.triples.length;d++){var l=this.triples[d];if(null==c||
l.subject.equals(c))if(null==b||l.predicate.equals(b))if(null==a||l.object.equals(a))if(null==f||r<f)r++,h.add(l);else break}return h};RDFModel.Graph.prototype.removeMatches=function(c,b,a){for(var f=[],h=0;h<this.triples.length;h++){var r=this.triples[h];if(null==c||r.subject.equals(c))null!=b&&!r.predicate.equals(b)||null!=a&&!r.object.equals(a)||f.push(r)}for(h=0;h<f.length;h++)this.remove(f[h]);return this};RDFModel.Graph.prototype.toNT=function(){var c="";this.forEach(function(b){c+=b.toString()});
return c};RDFModel.buildRDFResource=function(c,b,a,f){return"blank"===c.token?RDFModel.buildBlankNode(c,b,a,f):"literal"===c.token?RDFModel.buildLiteral(c,b,a,f):"uri"===c.token?RDFModel.buildNamedNode(c,b,a,f):"var"===c.token?(c=b[c.value],null!=c?RDFModel.buildRDFResource(c,b,a,f):null):null};RDFModel.buildBlankNode=function(c,b,a,f){null!=c.valuetmp&&(c.value=c.valuetmp);0===c.value.indexOf("_:")&&(c.value=c.value.split("_:")[1]);return new RDFModel.BlankNode(c.value)};RDFModel.buildLiteral=function(c,
b,a,f){return new RDFModel.Literal(c.value,c.lang,c.type)};RDFModel.buildNamedNode=function(c,b,a,f){null==c.value&&null!=c.prefix&&(b=a.resolveNsInEnvironment(c.prefix,f),c.value=b+c.suffix);return new RDFModel.NamedNode(c)};RDFModel.rdf=new RDFModel.RDFEnvironment;B.exports=RDFModel},{"./query_filters":52,"./utils":57}],56:[function(z,B,C){function v(c){switch(c[0]){case '"':return 0<c.indexOf("^^")?(c=c.split("^^"),{literal:c[0]+"^^<"+c[1]+">"}):{literal:c};case "_":return{blank:c.replace("b",
"")};default:return{token:"uri",value:c,prefix:null,suffix:null}}}var h=z("n3").Parser;B.exports={RVN3Parser:{parser:{async:!0,parse:function(c,b,a,f){f||(f=a,a=b,b=null);b&&"string"===typeof b&&(b={token:"uri",value:b,prefix:null,suffix:null});a&&a.baseURI&&(a.documentIRI=a.baseURI);var k=[];(new h(a)).parse(c,function(a,c){a?f(a):c?k.push({subject:v(c.subject),predicate:v(c.predicate),object:v(c.object),graph:b}):f(!1,k)})},resetBlankNodeIds:function(){h._resetBlankNodeIds()}}}}},{n3:4}],57:[function(z,
B,C){(function(v){var h=function(){return"undefined"!==typeof v&&v.nextTick?v.nextTick:"undefined"!==typeof window&&window.setImmediate?window.setImmediate:function(a){setTimeout(a,0)}}(),c=0,b=100,a=function(a){c++;c<b?a():(c=0,h(a))},f=function(a){try{if(null==a)return"";if("uri"===a.token)return"u"+a.value;if("blank"===a.token)return"b"+a.value;if("literal"===a.token){var b="l"+a.value,b=b+(a.type||"");return b+=a.lang||""}}catch(c){if("object"===typeof a){b="";for(p in a)b=b+p+a[p];return b}return a}};
parseISO8601=function(a){return Date.parse(a)};Date.prototype.toISOString||function(){function a(b){return 10>b?"0"+b:b}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1E3).toFixed(3).slice(2,5)+"Z"}}();iso8601=function(a){return a.toISOString()};compareDateComponents=function(a,b){var c=parseISO8601(a),d=parseISO8601(b);
return c==d?0:c<d?-1:1};lexicalFormLiteral=function(a,b){var c=a.value,d=a.lang,f=a.type,h=null;null!=c&&null!=f&&"string"!=typeof f?(c=f.value,null==c&&(c=f.suffix,f=b.namespaces[f.prefix],a.type=f+c,c=f+c),h=-1!=c.indexOf("hexBinary")?'"'+a.value.toLowerCase()+'"^^<'+c+">":'"'+a.value+'"^^<'+c+">"):h=null==d&&null==f?'"'+c+'"':null==f?'"'+c+'"@'+d:-1!=f.indexOf("hexBinary")?'"'+a.value.toLowerCase()+'"^^<'+f+">":'"'+a.value+'"^^<'+f+">";return h};normalizeUnicodeLiterals=function(a){for(var b=a.match(/\\u[0-9abcdefABCDEF]{4,4}/g)||
[],c={},d=0;d<b.length;d++)null==c[b[d]]&&(c[b[d]]=!0,a=a.replace(new RegExp("\\"+b[d],"g"),eval("'"+b[d]+"'")));return a};registerIndexedDB=function(a){if("undefined"===typeof window&&"undefined"!==typeof v&&!1===v.browser){var b=z("sqlite3"),c=z("indexeddb-js"),b=new b.Database(":memory:"),c=c.makeScope("sqlite3",b);a.indexedDB=c.indexedDB;a.IDBKeyRange=c.IDBKeyRange}else c="undefined"===typeof window?self:window,c.indexedDB=c.indexedDB||c.mozIndexedDB||c.webkitIndexedDB||c.msIndexedDB,c.IDBKeyRange=
c.IDBKeyRange||c.webkitIDBKeyRange||c.msIDBKeyRange,c.indexedDB?(a.indexedDB=c.indexedDB,a.IDBKeyRange=c.IDBKeyRange):console.log("The browser does not support IndexDB.")};guid=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()};var f=function(a){try{if(null==a)return"";if("uri"===a.token)return"u"+a.value;if("blank"===a.token)return"b"+a.value;if("literal"===a.token){var b="l"+a.value,b=b+(a.type||"");
return b+=a.lang||""}}catch(c){if("object"===typeof a){b="";for(p in a)b=b+p+a[p];return b}return a}},k=function(a,b){for(var c=[],d=0;d<a.length;d++)b(a[d])&&c.push(a[d]);return c},r=function(a,b){if(a.forEach)a.forEach(b);else for(var c=0;c<a.length;c++)b(a[c])};clone=function(a){return JSON.parse(JSON.stringify(a))};var d=function(){function a(){}return function(b){var c=typeof b;if("function"==c||b&&"object"==c){a.prototype=b;var d=new a;a.prototype=null}return d||void 0}}(),l=function(a,b,c){a()?
b(function(d){if(d)return c(d);l(a,b,c)}):c()},m=function(b,c,d){d=d||function(){};if(!b.length)return d();var f=0,h=function(){c(b[f],function(c){c?(d(c),d=function(){}):(f+=1,f>=b.length?d():a(h))})};h()},u=function(a,b,c,d){m(a,function(a,d){c(b,a,function(a,c){b=c;d(a)})},function(a){d(a,b)})};B.exports={isWorker:function(){return"undefined"===typeof v||!0===v.browser?"undefined"===typeof window?!0:!1:!1},nextTick:a,hasTerm:f,lexicalFormBaseUri:function(a,b){var c=null;b=b||{};if(null==a.value)var c=
a.prefix,d=a.suffix,f=b.namespaces[c],c=null!=f?f+d:c+":"+d;else c=a.value;if(null===c)return null;-1==c.indexOf(":")&&(c=(b.base||"")+c);return c},parseISO8601:parseISO8601,compareDateComponents:compareDateComponents,iso8601:iso8601,normalizeUnicodeLiterals:normalizeUnicodeLiterals,lexicalFormLiteral:lexicalFormLiteral,registerIndexedDB:registerIndexedDB,guid:guid,hashTerm:f,keys:function(a){var b=[],c;for(c in a)b.push(c);return b},values:function(a){var b=[],c;for(c in a)b.push(a[c]);return b},
size:function(a){if(a.length)return a.length;var b=0,c;for(c in a)b++;return b},map:function(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d]);return c},each:r,forEach:r,include:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return!0;return!1},reject:k,remove:k,clone:clone,create:d,whilst:l,eachSeries:m,eachParallel:function(b,c,d){d=d||function(){};if(!b.length)return d();for(var f=!1,h=0,k=function(a){if(a)throw f=!0,Error(a);f||(h++,h===b.length&&d())},l=0;l<b.length;l++)(function(b,
c,d,f){a(function(){try{f(b[c],function(){d()})}catch(a){d(a)}})})(b,l,k,c)},seq:function(){var a=arguments;return function(){var b=this,c=Array.prototype.slice.call(arguments),d=c.pop();u(a,c,function(a,c,d){c.apply(b,a.concat([function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1);d(a,b)}]))},function(a,c){d.apply(b,[a].concat(c))})}},yieldFrequency:function(a){b=a}}}).call(this,z("qC859L"))},{qC859L:24}]},{},[41])(41)});