@antv/g-webgpu 1.7.64 → 1.7.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -348,783 +348,6 @@
348
348
  return _setPrototypeOf(o, p);
349
349
  }
350
350
 
351
- function createCommonjsModule(fn, basedir, module) {
352
- return module = {
353
- path: basedir,
354
- exports: {},
355
- require: function (path, base) {
356
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
357
- }
358
- }, fn(module, module.exports), module.exports;
359
- }
360
-
361
- function commonjsRequire () {
362
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
363
- }
364
-
365
- var runtime_1 = createCommonjsModule(function (module) {
366
- /**
367
- * Copyright (c) 2014-present, Facebook, Inc.
368
- *
369
- * This source code is licensed under the MIT license found in the
370
- * LICENSE file in the root directory of this source tree.
371
- */
372
-
373
- var runtime = (function (exports) {
374
-
375
- var Op = Object.prototype;
376
- var hasOwn = Op.hasOwnProperty;
377
- var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; };
378
- var undefined$1; // More compressible than void 0.
379
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
380
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
381
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
382
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
383
-
384
- function define(obj, key, value) {
385
- Object.defineProperty(obj, key, {
386
- value: value,
387
- enumerable: true,
388
- configurable: true,
389
- writable: true
390
- });
391
- return obj[key];
392
- }
393
- try {
394
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
395
- define({}, "");
396
- } catch (err) {
397
- define = function(obj, key, value) {
398
- return obj[key] = value;
399
- };
400
- }
401
-
402
- function wrap(innerFn, outerFn, self, tryLocsList) {
403
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
404
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
405
- var generator = Object.create(protoGenerator.prototype);
406
- var context = new Context(tryLocsList || []);
407
-
408
- // The ._invoke method unifies the implementations of the .next,
409
- // .throw, and .return methods.
410
- defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) });
411
-
412
- return generator;
413
- }
414
- exports.wrap = wrap;
415
-
416
- // Try/catch helper to minimize deoptimizations. Returns a completion
417
- // record like context.tryEntries[i].completion. This interface could
418
- // have been (and was previously) designed to take a closure to be
419
- // invoked without arguments, but in all the cases we care about we
420
- // already have an existing method we want to call, so there's no need
421
- // to create a new function object. We can even get away with assuming
422
- // the method takes exactly one argument, since that happens to be true
423
- // in every case, so we don't have to touch the arguments object. The
424
- // only additional allocation required is the completion record, which
425
- // has a stable shape and so hopefully should be cheap to allocate.
426
- function tryCatch(fn, obj, arg) {
427
- try {
428
- return { type: "normal", arg: fn.call(obj, arg) };
429
- } catch (err) {
430
- return { type: "throw", arg: err };
431
- }
432
- }
433
-
434
- var GenStateSuspendedStart = "suspendedStart";
435
- var GenStateSuspendedYield = "suspendedYield";
436
- var GenStateExecuting = "executing";
437
- var GenStateCompleted = "completed";
438
-
439
- // Returning this object from the innerFn has the same effect as
440
- // breaking out of the dispatch switch statement.
441
- var ContinueSentinel = {};
442
-
443
- // Dummy constructor functions that we use as the .constructor and
444
- // .constructor.prototype properties for functions that return Generator
445
- // objects. For full spec compliance, you may wish to configure your
446
- // minifier not to mangle the names of these two functions.
447
- function Generator() {}
448
- function GeneratorFunction() {}
449
- function GeneratorFunctionPrototype() {}
450
-
451
- // This is a polyfill for %IteratorPrototype% for environments that
452
- // don't natively support it.
453
- var IteratorPrototype = {};
454
- define(IteratorPrototype, iteratorSymbol, function () {
455
- return this;
456
- });
457
-
458
- var getProto = Object.getPrototypeOf;
459
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
460
- if (NativeIteratorPrototype &&
461
- NativeIteratorPrototype !== Op &&
462
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
463
- // This environment has a native %IteratorPrototype%; use it instead
464
- // of the polyfill.
465
- IteratorPrototype = NativeIteratorPrototype;
466
- }
467
-
468
- var Gp = GeneratorFunctionPrototype.prototype =
469
- Generator.prototype = Object.create(IteratorPrototype);
470
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
471
- defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true });
472
- defineProperty(
473
- GeneratorFunctionPrototype,
474
- "constructor",
475
- { value: GeneratorFunction, configurable: true }
476
- );
477
- GeneratorFunction.displayName = define(
478
- GeneratorFunctionPrototype,
479
- toStringTagSymbol,
480
- "GeneratorFunction"
481
- );
482
-
483
- // Helper for defining the .next, .throw, and .return methods of the
484
- // Iterator interface in terms of a single ._invoke method.
485
- function defineIteratorMethods(prototype) {
486
- ["next", "throw", "return"].forEach(function(method) {
487
- define(prototype, method, function(arg) {
488
- return this._invoke(method, arg);
489
- });
490
- });
491
- }
492
-
493
- exports.isGeneratorFunction = function(genFun) {
494
- var ctor = typeof genFun === "function" && genFun.constructor;
495
- return ctor
496
- ? ctor === GeneratorFunction ||
497
- // For the native GeneratorFunction constructor, the best we can
498
- // do is to check its .name property.
499
- (ctor.displayName || ctor.name) === "GeneratorFunction"
500
- : false;
501
- };
502
-
503
- exports.mark = function(genFun) {
504
- if (Object.setPrototypeOf) {
505
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
506
- } else {
507
- genFun.__proto__ = GeneratorFunctionPrototype;
508
- define(genFun, toStringTagSymbol, "GeneratorFunction");
509
- }
510
- genFun.prototype = Object.create(Gp);
511
- return genFun;
512
- };
513
-
514
- // Within the body of any async function, `await x` is transformed to
515
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
516
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
517
- // meant to be awaited.
518
- exports.awrap = function(arg) {
519
- return { __await: arg };
520
- };
521
-
522
- function AsyncIterator(generator, PromiseImpl) {
523
- function invoke(method, arg, resolve, reject) {
524
- var record = tryCatch(generator[method], generator, arg);
525
- if (record.type === "throw") {
526
- reject(record.arg);
527
- } else {
528
- var result = record.arg;
529
- var value = result.value;
530
- if (value &&
531
- typeof value === "object" &&
532
- hasOwn.call(value, "__await")) {
533
- return PromiseImpl.resolve(value.__await).then(function(value) {
534
- invoke("next", value, resolve, reject);
535
- }, function(err) {
536
- invoke("throw", err, resolve, reject);
537
- });
538
- }
539
-
540
- return PromiseImpl.resolve(value).then(function(unwrapped) {
541
- // When a yielded Promise is resolved, its final value becomes
542
- // the .value of the Promise<{value,done}> result for the
543
- // current iteration.
544
- result.value = unwrapped;
545
- resolve(result);
546
- }, function(error) {
547
- // If a rejected Promise was yielded, throw the rejection back
548
- // into the async generator function so it can be handled there.
549
- return invoke("throw", error, resolve, reject);
550
- });
551
- }
552
- }
553
-
554
- var previousPromise;
555
-
556
- function enqueue(method, arg) {
557
- function callInvokeWithMethodAndArg() {
558
- return new PromiseImpl(function(resolve, reject) {
559
- invoke(method, arg, resolve, reject);
560
- });
561
- }
562
-
563
- return previousPromise =
564
- // If enqueue has been called before, then we want to wait until
565
- // all previous Promises have been resolved before calling invoke,
566
- // so that results are always delivered in the correct order. If
567
- // enqueue has not been called before, then it is important to
568
- // call invoke immediately, without waiting on a callback to fire,
569
- // so that the async generator function has the opportunity to do
570
- // any necessary setup in a predictable way. This predictability
571
- // is why the Promise constructor synchronously invokes its
572
- // executor callback, and why async functions synchronously
573
- // execute code before the first await. Since we implement simple
574
- // async functions in terms of async generators, it is especially
575
- // important to get this right, even though it requires care.
576
- previousPromise ? previousPromise.then(
577
- callInvokeWithMethodAndArg,
578
- // Avoid propagating failures to Promises returned by later
579
- // invocations of the iterator.
580
- callInvokeWithMethodAndArg
581
- ) : callInvokeWithMethodAndArg();
582
- }
583
-
584
- // Define the unified helper method that is used to implement .next,
585
- // .throw, and .return (see defineIteratorMethods).
586
- defineProperty(this, "_invoke", { value: enqueue });
587
- }
588
-
589
- defineIteratorMethods(AsyncIterator.prototype);
590
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
591
- return this;
592
- });
593
- exports.AsyncIterator = AsyncIterator;
594
-
595
- // Note that simple async functions are implemented on top of
596
- // AsyncIterator objects; they just return a Promise for the value of
597
- // the final result produced by the iterator.
598
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
599
- if (PromiseImpl === void 0) PromiseImpl = Promise;
600
-
601
- var iter = new AsyncIterator(
602
- wrap(innerFn, outerFn, self, tryLocsList),
603
- PromiseImpl
604
- );
605
-
606
- return exports.isGeneratorFunction(outerFn)
607
- ? iter // If outerFn is a generator, return the full iterator.
608
- : iter.next().then(function(result) {
609
- return result.done ? result.value : iter.next();
610
- });
611
- };
612
-
613
- function makeInvokeMethod(innerFn, self, context) {
614
- var state = GenStateSuspendedStart;
615
-
616
- return function invoke(method, arg) {
617
- if (state === GenStateExecuting) {
618
- throw new Error("Generator is already running");
619
- }
620
-
621
- if (state === GenStateCompleted) {
622
- if (method === "throw") {
623
- throw arg;
624
- }
625
-
626
- // Be forgiving, per 25.3.3.3.3 of the spec:
627
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
628
- return doneResult();
629
- }
630
-
631
- context.method = method;
632
- context.arg = arg;
633
-
634
- while (true) {
635
- var delegate = context.delegate;
636
- if (delegate) {
637
- var delegateResult = maybeInvokeDelegate(delegate, context);
638
- if (delegateResult) {
639
- if (delegateResult === ContinueSentinel) continue;
640
- return delegateResult;
641
- }
642
- }
643
-
644
- if (context.method === "next") {
645
- // Setting context._sent for legacy support of Babel's
646
- // function.sent implementation.
647
- context.sent = context._sent = context.arg;
648
-
649
- } else if (context.method === "throw") {
650
- if (state === GenStateSuspendedStart) {
651
- state = GenStateCompleted;
652
- throw context.arg;
653
- }
654
-
655
- context.dispatchException(context.arg);
656
-
657
- } else if (context.method === "return") {
658
- context.abrupt("return", context.arg);
659
- }
660
-
661
- state = GenStateExecuting;
662
-
663
- var record = tryCatch(innerFn, self, context);
664
- if (record.type === "normal") {
665
- // If an exception is thrown from innerFn, we leave state ===
666
- // GenStateExecuting and loop back for another invocation.
667
- state = context.done
668
- ? GenStateCompleted
669
- : GenStateSuspendedYield;
670
-
671
- if (record.arg === ContinueSentinel) {
672
- continue;
673
- }
674
-
675
- return {
676
- value: record.arg,
677
- done: context.done
678
- };
679
-
680
- } else if (record.type === "throw") {
681
- state = GenStateCompleted;
682
- // Dispatch the exception by looping back around to the
683
- // context.dispatchException(context.arg) call above.
684
- context.method = "throw";
685
- context.arg = record.arg;
686
- }
687
- }
688
- };
689
- }
690
-
691
- // Call delegate.iterator[context.method](context.arg) and handle the
692
- // result, either by returning a { value, done } result from the
693
- // delegate iterator, or by modifying context.method and context.arg,
694
- // setting context.delegate to null, and returning the ContinueSentinel.
695
- function maybeInvokeDelegate(delegate, context) {
696
- var methodName = context.method;
697
- var method = delegate.iterator[methodName];
698
- if (method === undefined$1) {
699
- // A .throw or .return when the delegate iterator has no .throw
700
- // method, or a missing .next mehtod, always terminate the
701
- // yield* loop.
702
- context.delegate = null;
703
-
704
- // Note: ["return"] must be used for ES3 parsing compatibility.
705
- if (methodName === "throw" && delegate.iterator["return"]) {
706
- // If the delegate iterator has a return method, give it a
707
- // chance to clean up.
708
- context.method = "return";
709
- context.arg = undefined$1;
710
- maybeInvokeDelegate(delegate, context);
711
-
712
- if (context.method === "throw") {
713
- // If maybeInvokeDelegate(context) changed context.method from
714
- // "return" to "throw", let that override the TypeError below.
715
- return ContinueSentinel;
716
- }
717
- }
718
- if (methodName !== "return") {
719
- context.method = "throw";
720
- context.arg = new TypeError(
721
- "The iterator does not provide a '" + methodName + "' method");
722
- }
723
-
724
- return ContinueSentinel;
725
- }
726
-
727
- var record = tryCatch(method, delegate.iterator, context.arg);
728
-
729
- if (record.type === "throw") {
730
- context.method = "throw";
731
- context.arg = record.arg;
732
- context.delegate = null;
733
- return ContinueSentinel;
734
- }
735
-
736
- var info = record.arg;
737
-
738
- if (! info) {
739
- context.method = "throw";
740
- context.arg = new TypeError("iterator result is not an object");
741
- context.delegate = null;
742
- return ContinueSentinel;
743
- }
744
-
745
- if (info.done) {
746
- // Assign the result of the finished delegate to the temporary
747
- // variable specified by delegate.resultName (see delegateYield).
748
- context[delegate.resultName] = info.value;
749
-
750
- // Resume execution at the desired location (see delegateYield).
751
- context.next = delegate.nextLoc;
752
-
753
- // If context.method was "throw" but the delegate handled the
754
- // exception, let the outer generator proceed normally. If
755
- // context.method was "next", forget context.arg since it has been
756
- // "consumed" by the delegate iterator. If context.method was
757
- // "return", allow the original .return call to continue in the
758
- // outer generator.
759
- if (context.method !== "return") {
760
- context.method = "next";
761
- context.arg = undefined$1;
762
- }
763
-
764
- } else {
765
- // Re-yield the result returned by the delegate method.
766
- return info;
767
- }
768
-
769
- // The delegate iterator is finished, so forget it and continue with
770
- // the outer generator.
771
- context.delegate = null;
772
- return ContinueSentinel;
773
- }
774
-
775
- // Define Generator.prototype.{next,throw,return} in terms of the
776
- // unified ._invoke helper method.
777
- defineIteratorMethods(Gp);
778
-
779
- define(Gp, toStringTagSymbol, "Generator");
780
-
781
- // A Generator should always return itself as the iterator object when the
782
- // @@iterator function is called on it. Some browsers' implementations of the
783
- // iterator prototype chain incorrectly implement this, causing the Generator
784
- // object to not be returned from this call. This ensures that doesn't happen.
785
- // See https://github.com/facebook/regenerator/issues/274 for more details.
786
- define(Gp, iteratorSymbol, function() {
787
- return this;
788
- });
789
-
790
- define(Gp, "toString", function() {
791
- return "[object Generator]";
792
- });
793
-
794
- function pushTryEntry(locs) {
795
- var entry = { tryLoc: locs[0] };
796
-
797
- if (1 in locs) {
798
- entry.catchLoc = locs[1];
799
- }
800
-
801
- if (2 in locs) {
802
- entry.finallyLoc = locs[2];
803
- entry.afterLoc = locs[3];
804
- }
805
-
806
- this.tryEntries.push(entry);
807
- }
808
-
809
- function resetTryEntry(entry) {
810
- var record = entry.completion || {};
811
- record.type = "normal";
812
- delete record.arg;
813
- entry.completion = record;
814
- }
815
-
816
- function Context(tryLocsList) {
817
- // The root entry object (effectively a try statement without a catch
818
- // or a finally block) gives us a place to store values thrown from
819
- // locations where there is no enclosing try statement.
820
- this.tryEntries = [{ tryLoc: "root" }];
821
- tryLocsList.forEach(pushTryEntry, this);
822
- this.reset(true);
823
- }
824
-
825
- exports.keys = function(val) {
826
- var object = Object(val);
827
- var keys = [];
828
- for (var key in object) {
829
- keys.push(key);
830
- }
831
- keys.reverse();
832
-
833
- // Rather than returning an object with a next method, we keep
834
- // things simple and return the next function itself.
835
- return function next() {
836
- while (keys.length) {
837
- var key = keys.pop();
838
- if (key in object) {
839
- next.value = key;
840
- next.done = false;
841
- return next;
842
- }
843
- }
844
-
845
- // To avoid creating an additional object, we just hang the .value
846
- // and .done properties off the next function object itself. This
847
- // also ensures that the minifier will not anonymize the function.
848
- next.done = true;
849
- return next;
850
- };
851
- };
852
-
853
- function values(iterable) {
854
- if (iterable) {
855
- var iteratorMethod = iterable[iteratorSymbol];
856
- if (iteratorMethod) {
857
- return iteratorMethod.call(iterable);
858
- }
859
-
860
- if (typeof iterable.next === "function") {
861
- return iterable;
862
- }
863
-
864
- if (!isNaN(iterable.length)) {
865
- var i = -1, next = function next() {
866
- while (++i < iterable.length) {
867
- if (hasOwn.call(iterable, i)) {
868
- next.value = iterable[i];
869
- next.done = false;
870
- return next;
871
- }
872
- }
873
-
874
- next.value = undefined$1;
875
- next.done = true;
876
-
877
- return next;
878
- };
879
-
880
- return next.next = next;
881
- }
882
- }
883
-
884
- // Return an iterator with no values.
885
- return { next: doneResult };
886
- }
887
- exports.values = values;
888
-
889
- function doneResult() {
890
- return { value: undefined$1, done: true };
891
- }
892
-
893
- Context.prototype = {
894
- constructor: Context,
895
-
896
- reset: function(skipTempReset) {
897
- this.prev = 0;
898
- this.next = 0;
899
- // Resetting context._sent for legacy support of Babel's
900
- // function.sent implementation.
901
- this.sent = this._sent = undefined$1;
902
- this.done = false;
903
- this.delegate = null;
904
-
905
- this.method = "next";
906
- this.arg = undefined$1;
907
-
908
- this.tryEntries.forEach(resetTryEntry);
909
-
910
- if (!skipTempReset) {
911
- for (var name in this) {
912
- // Not sure about the optimal order of these conditions:
913
- if (name.charAt(0) === "t" &&
914
- hasOwn.call(this, name) &&
915
- !isNaN(+name.slice(1))) {
916
- this[name] = undefined$1;
917
- }
918
- }
919
- }
920
- },
921
-
922
- stop: function() {
923
- this.done = true;
924
-
925
- var rootEntry = this.tryEntries[0];
926
- var rootRecord = rootEntry.completion;
927
- if (rootRecord.type === "throw") {
928
- throw rootRecord.arg;
929
- }
930
-
931
- return this.rval;
932
- },
933
-
934
- dispatchException: function(exception) {
935
- if (this.done) {
936
- throw exception;
937
- }
938
-
939
- var context = this;
940
- function handle(loc, caught) {
941
- record.type = "throw";
942
- record.arg = exception;
943
- context.next = loc;
944
-
945
- if (caught) {
946
- // If the dispatched exception was caught by a catch block,
947
- // then let that catch block handle the exception normally.
948
- context.method = "next";
949
- context.arg = undefined$1;
950
- }
951
-
952
- return !! caught;
953
- }
954
-
955
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
956
- var entry = this.tryEntries[i];
957
- var record = entry.completion;
958
-
959
- if (entry.tryLoc === "root") {
960
- // Exception thrown outside of any try block that could handle
961
- // it, so set the completion value of the entire function to
962
- // throw the exception.
963
- return handle("end");
964
- }
965
-
966
- if (entry.tryLoc <= this.prev) {
967
- var hasCatch = hasOwn.call(entry, "catchLoc");
968
- var hasFinally = hasOwn.call(entry, "finallyLoc");
969
-
970
- if (hasCatch && hasFinally) {
971
- if (this.prev < entry.catchLoc) {
972
- return handle(entry.catchLoc, true);
973
- } else if (this.prev < entry.finallyLoc) {
974
- return handle(entry.finallyLoc);
975
- }
976
-
977
- } else if (hasCatch) {
978
- if (this.prev < entry.catchLoc) {
979
- return handle(entry.catchLoc, true);
980
- }
981
-
982
- } else if (hasFinally) {
983
- if (this.prev < entry.finallyLoc) {
984
- return handle(entry.finallyLoc);
985
- }
986
-
987
- } else {
988
- throw new Error("try statement without catch or finally");
989
- }
990
- }
991
- }
992
- },
993
-
994
- abrupt: function(type, arg) {
995
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
996
- var entry = this.tryEntries[i];
997
- if (entry.tryLoc <= this.prev &&
998
- hasOwn.call(entry, "finallyLoc") &&
999
- this.prev < entry.finallyLoc) {
1000
- var finallyEntry = entry;
1001
- break;
1002
- }
1003
- }
1004
-
1005
- if (finallyEntry &&
1006
- (type === "break" ||
1007
- type === "continue") &&
1008
- finallyEntry.tryLoc <= arg &&
1009
- arg <= finallyEntry.finallyLoc) {
1010
- // Ignore the finally entry if control is not jumping to a
1011
- // location outside the try/catch block.
1012
- finallyEntry = null;
1013
- }
1014
-
1015
- var record = finallyEntry ? finallyEntry.completion : {};
1016
- record.type = type;
1017
- record.arg = arg;
1018
-
1019
- if (finallyEntry) {
1020
- this.method = "next";
1021
- this.next = finallyEntry.finallyLoc;
1022
- return ContinueSentinel;
1023
- }
1024
-
1025
- return this.complete(record);
1026
- },
1027
-
1028
- complete: function(record, afterLoc) {
1029
- if (record.type === "throw") {
1030
- throw record.arg;
1031
- }
1032
-
1033
- if (record.type === "break" ||
1034
- record.type === "continue") {
1035
- this.next = record.arg;
1036
- } else if (record.type === "return") {
1037
- this.rval = this.arg = record.arg;
1038
- this.method = "return";
1039
- this.next = "end";
1040
- } else if (record.type === "normal" && afterLoc) {
1041
- this.next = afterLoc;
1042
- }
1043
-
1044
- return ContinueSentinel;
1045
- },
1046
-
1047
- finish: function(finallyLoc) {
1048
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1049
- var entry = this.tryEntries[i];
1050
- if (entry.finallyLoc === finallyLoc) {
1051
- this.complete(entry.completion, entry.afterLoc);
1052
- resetTryEntry(entry);
1053
- return ContinueSentinel;
1054
- }
1055
- }
1056
- },
1057
-
1058
- "catch": function(tryLoc) {
1059
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1060
- var entry = this.tryEntries[i];
1061
- if (entry.tryLoc === tryLoc) {
1062
- var record = entry.completion;
1063
- if (record.type === "throw") {
1064
- var thrown = record.arg;
1065
- resetTryEntry(entry);
1066
- }
1067
- return thrown;
1068
- }
1069
- }
1070
-
1071
- // The context.catch method must only be called with a location
1072
- // argument that corresponds to a known catch block.
1073
- throw new Error("illegal catch attempt");
1074
- },
1075
-
1076
- delegateYield: function(iterable, resultName, nextLoc) {
1077
- this.delegate = {
1078
- iterator: values(iterable),
1079
- resultName: resultName,
1080
- nextLoc: nextLoc
1081
- };
1082
-
1083
- if (this.method === "next") {
1084
- // Deliberately forget the last sent value so that we don't
1085
- // accidentally pass it on to the delegate.
1086
- this.arg = undefined$1;
1087
- }
1088
-
1089
- return ContinueSentinel;
1090
- }
1091
- };
1092
-
1093
- // Regardless of whether this script is executing as a CommonJS module
1094
- // or not, return the runtime object so that we can declare the variable
1095
- // regeneratorRuntime in the outer scope, which allows this module to be
1096
- // injected easily by `bin/regenerator --include-runtime script.js`.
1097
- return exports;
1098
-
1099
- }(
1100
- // If this script is executing as a CommonJS module, use module.exports
1101
- // as the regeneratorRuntime namespace. Otherwise create a new empty
1102
- // object. Either way, the resulting object will be used to initialize
1103
- // the regeneratorRuntime variable at the top of this file.
1104
- module.exports
1105
- ));
1106
-
1107
- try {
1108
- regeneratorRuntime = runtime;
1109
- } catch (accidentalStrictMode) {
1110
- // This module should not be running in strict mode, so the above
1111
- // assignment should always work unless something is misconfigured. Just
1112
- // in case runtime.js accidentally runs in strict mode, in modern engines
1113
- // we can explicitly access globalThis. In older engines we can escape
1114
- // strict mode using a global Function call. This could conceivably fail
1115
- // if a Content Security Policy forbids using Function, but in that case
1116
- // the proper solution is to fix the accidental strict mode problem. If
1117
- // you've misconfigured your bundler to force strict mode and applied a
1118
- // CSP to forbid Function, and you're not willing to fix either of those
1119
- // problems, please detail your unique predicament in a GitHub issue.
1120
- if (typeof globalThis === "object") {
1121
- globalThis.regeneratorRuntime = runtime;
1122
- } else {
1123
- Function("r", "regeneratorRuntime = r")(runtime);
1124
- }
1125
- }
1126
- });
1127
-
1128
351
  /**
1129
352
  * Common utilities
1130
353
  * @module glMatrix
@@ -1887,6 +1110,20 @@
1887
1110
  return isType(value, 'Number');
1888
1111
  };
1889
1112
 
1113
+ function createCommonjsModule(fn, basedir, module) {
1114
+ return module = {
1115
+ path: basedir,
1116
+ exports: {},
1117
+ require: function (path, base) {
1118
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
1119
+ }
1120
+ }, fn(module, module.exports), module.exports;
1121
+ }
1122
+
1123
+ function commonjsRequire () {
1124
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1125
+ }
1126
+
1890
1127
  var eventemitter3 = createCommonjsModule(function (module) {
1891
1128
 
1892
1129
  var has = Object.prototype.hasOwnProperty
@@ -3419,7 +2656,8 @@
3419
2656
  x: '',
3420
2657
  y: '',
3421
2658
  z: '',
3422
- lineWidth: 0
2659
+ lineWidth: 0,
2660
+ anchor: [0.5, 0.5, 0.5]
3423
2661
  }, style)
3424
2662
  }, rest)) || this;
3425
2663
  _this.cullable.enable = false;
@@ -3454,17 +2692,16 @@
3454
2692
  var _proto = MeshUpdater.prototype;
3455
2693
  _proto.update = function update(parsedStyle) {
3456
2694
  var geometry = parsedStyle.geometry;
3457
- geometry.computeBoundingBox();
3458
- // const minX = Math.min(x1, x2);
3459
- // const maxX = Math.max(x1, x2);
3460
- // const minY = Math.min(y1, y2);
3461
- // const maxY = Math.max(y1, y2);
3462
- // const width = maxX - minX;
3463
- // const height = maxY - minY;
2695
+ var aabb = geometry.computeBoundingBox();
2696
+ var max = aabb.getMax();
2697
+ var min = aabb.getMin();
2698
+ var width = max[0] - min[0];
2699
+ var height = max[1] - min[1];
2700
+ var depth = max[2] - min[2];
3464
2701
  return {
3465
- width: 0,
3466
- height: 0,
3467
- depth: 0
2702
+ width: width,
2703
+ height: height,
2704
+ depth: depth
3468
2705
  };
3469
2706
  };
3470
2707
  return MeshUpdater;
@@ -9602,7 +8839,7 @@
9602
8839
  }();
9603
8840
  var frag = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\n// @see https://www.shadertoy.com/view/4llXD7\nfloat sdRoundedBox(vec2 p, vec2 b, vec2 r) {\n vec2 q = abs(p) - b + r;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n } else if (shape == 2) {\n outer_df = sdRoundedBox(v_Data.xy, vec2(1.0), vec2(0.0));\n inner_df = sdRoundedBox(v_Data.xy, r, vec2(0.0));\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n // vec2 imagecoord = mod(v_Uv, 0.1);\n // vec4 texel = texture(SAMPLER_2D(u_Map), imagecoord);\n // u_Color = texel;\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}"; // eslint-disable-line
9604
8841
 
9605
- var vert = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}"; // eslint-disable-line
8842
+ var vert = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n bool isBillboard = a_StylePacked3.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}"; // eslint-disable-line
9606
8843
 
9607
8844
  var SDFVertexAttributeBufferIndex;
9608
8845
  (function (SDFVertexAttributeBufferIndex) {
@@ -9658,7 +8895,7 @@
9658
8895
  var radius = circle.parsedStyle.radius;
9659
8896
  var omitStroke = _this.shouldOmitStroke(circle.parsedStyle);
9660
8897
  var size = _this.getSize(object.parsedStyle, circle.nodeName);
9661
- instanced.push.apply(instanced, size.concat([SDF_Shape.indexOf(circle.nodeName), radius || 0, omitStroke ? 1 : 0, 0]));
8898
+ instanced.push.apply(instanced, size.concat([SDF_Shape.indexOf(circle.nodeName), radius || 0, omitStroke ? 1 : 0, circle.parsedStyle.isBillboard ? 1 : 0]));
9662
8899
  interleaved.push(-1, -1, 0, 0, 1, -1, 1, 0, 1, 1, 1, 1, -1, 1, 0, 1);
9663
8900
  indices.push(0 + offset, 2 + offset, 1 + offset, 0 + offset, 3 + offset, 2 + offset);
9664
8901
  });
@@ -9710,7 +8947,7 @@
9710
8947
  halfWidth = _this2$getSize[0],
9711
8948
  halfHeight = _this2$getSize[1];
9712
8949
  var size = [halfWidth, halfHeight];
9713
- packed.push.apply(packed, size.concat([SDF_Shape.indexOf(object.nodeName), object.parsedStyle.radius || 0, omitStroke ? 1 : 0, 0]));
8950
+ packed.push.apply(packed, size.concat([SDF_Shape.indexOf(object.nodeName), object.parsedStyle.radius || 0, omitStroke ? 1 : 0, circle.parsedStyle.isBillboard ? 1 : 0]));
9714
8951
  });
9715
8952
  this.geometry.updateVertexBuffer(SDFVertexAttributeBufferIndex.PACKED_STYLE, SDFVertexAttributeLocation.SIZE, startIndex, new Uint8Array(new Float32Array(packed).buffer));
9716
8953
  }
@@ -11461,7 +10698,7 @@
11461
10698
  }(Instanced);
11462
10699
  var frag$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}"; // eslint-disable-line
11463
10700
 
11464
- var vert$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec4 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nbool isPerspectiveMatrix(mat4 m) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size.xy;\n\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n float isBillboard = a_Size.w;\n if (isBillboard < 0.5) {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n } else {\n gl_Position = project(vec4(offset, a_Size.z, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}"; // eslint-disable-line
10701
+ var vert$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec4 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nbool isPerspectiveMatrix(mat4 m) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size.xy;\n\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n bool isBillboard = a_Size.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}"; // eslint-disable-line
11465
10702
 
11466
10703
  var ImageMesh = /*#__PURE__*/function (_Instanced) {
11467
10704
  _inheritsLoose$1(ImageMesh, _Instanced);
@@ -11559,7 +10796,7 @@
11559
10796
  }(Instanced);
11560
10797
  var frag$4 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_Uv).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}"; // eslint-disable-line
11561
10798
 
11562
- var vert$4 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_Uv;\nout float v_GammaScale;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_Uv = a_Tex / u_SDFMapSize;\n float fontScale = u_FontSize / 24.;\n\n float isBillboard = a_StylePacked2.y;\n float sizeAttenuation = a_StylePacked2.z;\n if (isBillboard > 0.5) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\n vec2 scale;\n scale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\n scale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n if (sizeAttenuation < 0.5) {\n bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n }\n\n vec2 alignedPosition = a_Offset * fontScale * scale;\n\n float rotation = 0.0;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n mvPosition.xy += rotatedPosition;\n\n gl_Position = u_ProjectionMatrix * mvPosition;\n v_GammaScale = 1.0;\n } else {\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n }\n}"; // eslint-disable-line
10799
+ var vert$4 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_Uv;\nout float v_GammaScale;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_Uv = a_Tex / u_SDFMapSize;\n float fontScale = u_FontSize / 24.;\n\n bool isBillboard = a_StylePacked2.y > 0.5;\n float sizeAttenuation = a_StylePacked2.z;\n vec2 offset = a_Offset * fontScale;\n\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n v_GammaScale = 1.0;\n } else {\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n }\n}"; // eslint-disable-line
11563
10800
 
11564
10801
  // borrow from mapbox/src/symbol
11565
10802
  function createImage(image, _ref, channels, data) {