@orbit-software/sdk 1.10.0
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/esm/Overlay.d.ts +2 -0
- package/dist/esm/app/helpers.d.ts +2 -0
- package/dist/esm/app/ui/assets/IconBack.d.ts +1 -0
- package/dist/esm/app/ui/assets/IconClosePlain.d.ts +3 -0
- package/dist/esm/app/ui/components/AvatarProgress.d.ts +13 -0
- package/dist/esm/app/ui/components/ClosableModal.d.ts +11 -0
- package/dist/esm/app/ui/components/IconBalance.d.ts +3 -0
- package/dist/esm/app/ui/components/InputSwitch.d.ts +9 -0
- package/dist/esm/app/ui/components/Inventory/Inventory.d.ts +2 -0
- package/dist/esm/app/ui/components/Inventory/context.d.ts +10 -0
- package/dist/esm/app/ui/components/XsButton.d.ts +6 -0
- package/dist/esm/app/ui/hooks/useAnimateNumber.d.ts +1 -0
- package/dist/esm/app/utils.d.ts +2 -0
- package/dist/esm/boolean-D78EXBUO.mjs +1986 -0
- package/dist/esm/bootstrap.d.ts +1 -0
- package/dist/esm/features/profile/assets/IconAd.d.ts +1 -0
- package/dist/esm/features/profile/assets/IconAddCircle.d.ts +1 -0
- package/dist/esm/features/profile/assets/IconCurrencyStar.d.ts +3 -0
- package/dist/esm/features/profile/assets/IconDrag.d.ts +2 -0
- package/dist/esm/features/profile/assets/IconEdit.d.ts +2 -0
- package/dist/esm/features/profile/assets/IconGame.d.ts +2 -0
- package/dist/esm/features/profile/assets/IconNoSign.d.ts +1 -0
- package/dist/esm/features/profile/assets/IconProfile.d.ts +1 -0
- package/dist/esm/features/profile/assets/moneyTongue.json.d.ts +3 -0
- package/dist/esm/features/profile/assets/newspaper.json.d.ts +3 -0
- package/dist/esm/features/profile/assets/profileBgGradients.d.ts +6 -0
- package/dist/esm/features/profile/components/Avatars.d.ts +8 -0
- package/dist/esm/features/profile/components/BalanceConfetti.d.ts +6 -0
- package/dist/esm/features/profile/components/BuyMenu.d.ts +8 -0
- package/dist/esm/features/profile/components/CircleParticles.d.ts +10 -0
- package/dist/esm/features/profile/components/FormattedXP.d.ts +8 -0
- package/dist/esm/features/profile/components/LevelInfoModal.d.ts +9 -0
- package/dist/esm/features/profile/components/ModalContainer.d.ts +6 -0
- package/dist/esm/features/profile/components/OverlayProfile.d.ts +8 -0
- package/dist/esm/features/profile/components/Profile.d.ts +3 -0
- package/dist/esm/features/profile/components/PurchaseConfirm.d.ts +9 -0
- package/dist/esm/features/profile/components/Ribbon.d.ts +6 -0
- package/dist/esm/features/profile/components/StarParticles.d.ts +10 -0
- package/dist/esm/features/profile/components/TaskCard.d.ts +21 -0
- package/dist/esm/features/profile/components/XpProgress.d.ts +14 -0
- package/dist/esm/features/profile/hooks/useAnimatedProfile.d.ts +5 -0
- package/dist/esm/gaussian-splat-compression-CzzkTP3L.mjs +1632 -0
- package/dist/esm/hooks/useForceRerender.d.ts +1 -0
- package/dist/esm/hooks/useMiniApp.d.ts +3 -0
- package/dist/esm/howler-Mh6LB0k5.mjs +572 -0
- package/dist/esm/i18n/index.d.ts +2 -0
- package/dist/esm/i18n/locales/translations/en.json.d.ts +213 -0
- package/dist/esm/i18n/locales/translations/ru.json.d.ts +210 -0
- package/dist/esm/launcherSrc/App.d.ts +2 -0
- package/dist/esm/launcherSrc/api/client.d.ts +3 -0
- package/dist/esm/launcherSrc/api/types.d.ts +181 -0
- package/dist/esm/launcherSrc/api/userApi.d.ts +22 -0
- package/dist/esm/launcherSrc/app/components/DebugConsole.d.ts +2 -0
- package/dist/esm/launcherSrc/app/contexts/SnackbarContext.d.ts +18 -0
- package/dist/esm/launcherSrc/app/helpers.d.ts +5 -0
- package/dist/esm/launcherSrc/app/hooks/forceRerender.d.ts +1 -0
- package/dist/esm/launcherSrc/app/hooks/useMainButtonControl.d.ts +7 -0
- package/dist/esm/launcherSrc/app/hooks/useMiniApp.d.ts +3 -0
- package/dist/esm/launcherSrc/app/hooks.d.ts +11 -0
- package/dist/esm/launcherSrc/app/store.d.ts +19 -0
- package/dist/esm/launcherSrc/app/ui/assets/IconBack.d.ts +1 -0
- package/dist/esm/launcherSrc/app/ui/assets/IconCheck.d.ts +2 -0
- package/dist/esm/launcherSrc/app/ui/assets/IconCheckThin.d.ts +2 -0
- package/dist/esm/launcherSrc/app/ui/assets/IconCross.d.ts +2 -0
- package/dist/esm/launcherSrc/app/ui/assets/IconSearch.d.ts +2 -0
- package/dist/esm/launcherSrc/app/ui/components/AvatarProgress.d.ts +13 -0
- package/dist/esm/launcherSrc/app/ui/components/ClosableModal.d.ts +10 -0
- package/dist/esm/launcherSrc/app/ui/components/FormattedXP.d.ts +8 -0
- package/dist/esm/launcherSrc/app/ui/components/IconBalance.d.ts +3 -0
- package/dist/esm/launcherSrc/app/ui/components/InputSwitch.d.ts +9 -0
- package/dist/esm/launcherSrc/app/ui/components/Twemoji.d.ts +8 -0
- package/dist/esm/launcherSrc/app/ui/components/UICell.d.ts +16 -0
- package/dist/esm/launcherSrc/app/ui/components/UIDateInput.d.ts +21 -0
- package/dist/esm/launcherSrc/app/ui/components/UIDivider.d.ts +4 -0
- package/dist/esm/launcherSrc/app/ui/components/UIEmoji.d.ts +8 -0
- package/dist/esm/launcherSrc/app/ui/components/UIHero.d.ts +10 -0
- package/dist/esm/launcherSrc/app/ui/components/UISection.d.ts +9 -0
- package/dist/esm/launcherSrc/app/ui/components/UITextarea.d.ts +7 -0
- package/dist/esm/launcherSrc/app/ui/components/XpProgress.d.ts +13 -0
- package/dist/esm/launcherSrc/app/ui/components/XsButton.d.ts +6 -0
- package/dist/esm/launcherSrc/app/ui/hooks/useAnimateNumber.d.ts +1 -0
- package/dist/esm/launcherSrc/app/utils.d.ts +13 -0
- package/dist/esm/launcherSrc/assets/Icon28Edit.d.ts +2 -0
- package/dist/esm/launcherSrc/assets/Icon28Game.d.ts +1 -0
- package/dist/esm/launcherSrc/assets/Icon28Link.d.ts +1 -0
- package/dist/esm/launcherSrc/features/admin/components/Admin.d.ts +3 -0
- package/dist/esm/launcherSrc/features/admin/components/OverlayControl.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconFilter.d.ts +1 -0
- package/dist/esm/launcherSrc/features/games/assets/IconPlayers.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconQuestion.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconQuestionCircle.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconStar.d.ts +4 -0
- package/dist/esm/launcherSrc/features/games/assets/IconThumbsDownFilled.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconThumbsDownOutlined.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconThumbsUpFilled.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/assets/IconThumbsUpOutlined.d.ts +2 -0
- package/dist/esm/launcherSrc/features/games/components/GameItem.d.ts +10 -0
- package/dist/esm/launcherSrc/features/games/components/GamePage/GamePage.d.ts +6 -0
- package/dist/esm/launcherSrc/features/games/components/GamePage/GameReview.d.ts +10 -0
- package/dist/esm/launcherSrc/features/games/components/GamePage/GameReviews.d.ts +9 -0
- package/dist/esm/launcherSrc/features/games/components/Games.d.ts +3 -0
- package/dist/esm/launcherSrc/features/games/components/ResetStorageButton.d.ts +3 -0
- package/dist/esm/launcherSrc/features/games/components/ReviewModal.d.ts +10 -0
- package/dist/esm/launcherSrc/features/games/hooks/useGamesData.d.ts +13 -0
- package/dist/esm/launcherSrc/features/games/redux/gamesSlice.d.ts +34 -0
- package/dist/esm/launcherSrc/features/games/service/gamesService.d.ts +3 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/Rating.d.ts +1 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/RatingCard/RatingCard.d.ts +10 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/RatingInfo/RatingInfo.d.ts +1 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/RatingLevel/IconWreaths.d.ts +3 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/RatingLevel/RatingLevel.d.ts +6 -0
- package/dist/esm/launcherSrc/features/leaderboard/components/RatingLevel/lock.d.ts +3 -0
- package/dist/esm/launcherSrc/features/leaderboard/hooks/useLeaderboardData.d.ts +10 -0
- package/dist/esm/launcherSrc/features/leaderboard/index.d.ts +1 -0
- package/dist/esm/launcherSrc/features/leaderboard/redux/leaderboardSlice.d.ts +18 -0
- package/dist/esm/launcherSrc/features/leaderboard/services/leaderboardService.d.ts +2 -0
- package/dist/esm/launcherSrc/features/navigation/assets/IconGame.d.ts +1 -0
- package/dist/esm/launcherSrc/features/navigation/assets/IconProfile.d.ts +1 -0
- package/dist/esm/launcherSrc/features/navigation/assets/IconSmile.d.ts +2 -0
- package/dist/esm/launcherSrc/features/navigation/components/FloatingProfile.d.ts +2 -0
- package/dist/esm/launcherSrc/features/navigation/components/IconWithCounter.d.ts +7 -0
- package/dist/esm/launcherSrc/features/navigation/redux/navigationSlice.d.ts +15 -0
- package/dist/esm/launcherSrc/features/navigation/redux/tabsSlice.d.ts +12 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconAd.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconAddCircle.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconChevronRight.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconColorPicker.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconCurrencyStar.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconGlobe.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconLock.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconNoSign.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/assets/IconSignature.d.ts +5 -0
- package/dist/esm/launcherSrc/features/profile/assets/profileBgGradients.d.ts +50 -0
- package/dist/esm/launcherSrc/features/profile/components/AdsFree/BuyAdsFreeButton.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/AdsFree/PurchaseAdsFree.d.ts +9 -0
- package/dist/esm/launcherSrc/features/profile/components/Avatars/AvatarCreation.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/components/Avatars/Avatars.d.ts +11 -0
- package/dist/esm/launcherSrc/features/profile/components/Avatars/EditAvatarButton.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/components/Balance/ProfileBalance.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/Balance/TopUpModal/BuyMenu.d.ts +8 -0
- package/dist/esm/launcherSrc/features/profile/components/Balance/TopUpModal/BuyOption.d.ts +10 -0
- package/dist/esm/launcherSrc/features/profile/components/Balance/TopUpModal/Ribbon.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/BoxOpeningModal.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/DailyModal.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/FIllProfile/FIllBirthdate.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/FIllProfile/FillCountry.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/FIllProfile/FillEmail.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/FIllProfile/FillProfile.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/FIllProfile/FillProfileLayout.d.ts +4 -0
- package/dist/esm/launcherSrc/features/profile/components/LevelInfoModal.d.ts +9 -0
- package/dist/esm/launcherSrc/features/profile/components/Profile.d.ts +3 -0
- package/dist/esm/launcherSrc/features/profile/components/ProfileGames.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/ProfileInventory.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/components/ProfileLeaderboard.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/ProfileReviews.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/ProfileTrophies.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/components/Tasks/TaskCard.d.ts +24 -0
- package/dist/esm/launcherSrc/features/profile/components/Tasks/Tasks.d.ts +2 -0
- package/dist/esm/launcherSrc/features/profile/components/particles/BalanceConfetti.d.ts +6 -0
- package/dist/esm/launcherSrc/features/profile/components/particles/CircleParticles.d.ts +10 -0
- package/dist/esm/launcherSrc/features/profile/components/particles/ConfettiParticles.d.ts +10 -0
- package/dist/esm/launcherSrc/features/profile/components/particles/StarParticles.d.ts +10 -0
- package/dist/esm/launcherSrc/features/profile/contexts/BoxOpeningContext.d.ts +12 -0
- package/dist/esm/launcherSrc/features/profile/data/countries.d.ts +10 -0
- package/dist/esm/launcherSrc/features/profile/hooks/useProfileData.d.ts +26 -0
- package/dist/esm/launcherSrc/features/profile/redux/profileSlice.d.ts +131 -0
- package/dist/esm/launcherSrc/features/profile/redux/shopSlice.d.ts +18 -0
- package/dist/esm/launcherSrc/features/profile/services/buyMenuService.d.ts +1 -0
- package/dist/esm/launcherSrc/features/profile/services/profileService.d.ts +12 -0
- package/dist/esm/launcherSrc/features/profile/services/shopService.d.ts +2 -0
- package/dist/esm/launcherSrc/i18n/index.d.ts +2 -0
- package/dist/esm/launcherSrc/index.d.ts +0 -0
- package/dist/esm/launcherSrc/setupTests.d.ts +0 -0
- package/dist/esm/launcherSrc/utils/openTelegramLinkFixed.d.ts +1 -0
- package/dist/esm/navmesh-BbINhDrO.mjs +1336 -0
- package/dist/esm/opentype-PR7hcvG5.mjs +4286 -0
- package/dist/esm/physics-B9pWoHiG.mjs +4375 -0
- package/dist/esm/process-DGf1Bnd3.mjs +2274 -0
- package/dist/esm/sdk-4y_oRGP7.mjs +76474 -0
- package/dist/esm/sdk.d.ts +130 -0
- package/dist/esm/sdk.mjs +9 -0
- package/dist/esm/sdk.umd.js +8382 -0
- package/dist/esm/stores/profileStore.d.ts +16 -0
- package/dist/esm/ui-C32u2WA-.mjs +2678 -0
- package/dist/esm/utils/global.d.ts +1 -0
- package/dist/umd/sdk.umd.js +8382 -0
- package/dist/umd_react/sdk_react.umd.js +8562 -0
- package/index.html +13 -0
- package/package.json +96 -0
|
@@ -0,0 +1,1632 @@
|
|
|
1
|
+
var Ht = Object.create, it = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Yt = Object.getOwnPropertyNames, Qt = Object.getPrototypeOf, Zt = Object.prototype.hasOwnProperty, Xt = (t, a, s) => a in t ? it(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s, H = (t, a) => () => (a || t((a = { exports: {} }).exports, a), a.exports), dt = (t, a) => {
|
|
2
|
+
for (var s in a) it(t, s, { get: a[s], enumerable: !0 });
|
|
3
|
+
}, Jt = (t, a, s, n) => {
|
|
4
|
+
if (a && typeof a == "object" || typeof a == "function") for (let i of Yt(a)) !Zt.call(t, i) && i !== s && it(t, i, { get: () => a[i], enumerable: !(n = Wt(a, i)) || n.enumerable });
|
|
5
|
+
return t;
|
|
6
|
+
}, T = (t, a, s) => (s = t != null ? Ht(Qt(t)) : {}, Jt(it(s, "default", { value: t, enumerable: !0 }), t)), P = (t, a, s) => (Xt(t, typeof a != "symbol" ? a + "" : a, s), s), Kt = H((t, a) => {
|
|
7
|
+
function s(n) {
|
|
8
|
+
for (var i = new Array(n), e = 0; e < n; ++e) i[e] = e;
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
a.exports = s;
|
|
12
|
+
}), ta = H((t, a) => {
|
|
13
|
+
a.exports = function(i) {
|
|
14
|
+
return i != null && (s(i) || n(i) || !!i._isBuffer);
|
|
15
|
+
};
|
|
16
|
+
function s(i) {
|
|
17
|
+
return !!i.constructor && typeof i.constructor.isBuffer == "function" && i.constructor.isBuffer(i);
|
|
18
|
+
}
|
|
19
|
+
function n(i) {
|
|
20
|
+
return typeof i.readFloatLE == "function" && typeof i.slice == "function" && s(i.slice(0, 0));
|
|
21
|
+
}
|
|
22
|
+
}), tt = H((t, a) => {
|
|
23
|
+
var s = Kt(), n = ta(), i = typeof Float64Array < "u";
|
|
24
|
+
function e(d, l) {
|
|
25
|
+
return d[0] - l[0];
|
|
26
|
+
}
|
|
27
|
+
function o() {
|
|
28
|
+
var d = this.stride, l = new Array(d.length), c;
|
|
29
|
+
for (c = 0; c < l.length; ++c) l[c] = [Math.abs(d[c]), c];
|
|
30
|
+
l.sort(e);
|
|
31
|
+
var p = new Array(l.length);
|
|
32
|
+
for (c = 0; c < p.length; ++c) p[c] = l[c][1];
|
|
33
|
+
return p;
|
|
34
|
+
}
|
|
35
|
+
function r(d, l) {
|
|
36
|
+
var c = ["View", l, "d", d].join("");
|
|
37
|
+
l < 0 && (c = "View_Nil" + d);
|
|
38
|
+
var p = d === "generic";
|
|
39
|
+
if (l === -1) {
|
|
40
|
+
var g = "function " + c + "(a){this.data=a;};var proto=" + c + ".prototype;proto.dtype='" + d + "';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new " + c + "(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_" + c + "(a){return new " + c + "(a);}", z = new Function(g);
|
|
41
|
+
return z();
|
|
42
|
+
} else if (l === 0) {
|
|
43
|
+
var g = "function " + c + "(a,d) {this.data = a;this.offset = d};var proto=" + c + ".prototype;proto.dtype='" + d + "';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function " + c + "_copy() {return new " + c + "(this.data,this.offset)};proto.pick=function " + c + "_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function " + c + "_get(){return " + (p ? "this.data.get(this.offset)" : "this.data[this.offset]") + "};proto.set=function " + c + "_set(v){return " + (p ? "this.data.set(this.offset,v)" : "this.data[this.offset]=v") + "};return function construct_" + c + "(a,b,c,d){return new " + c + "(a,d)}", z = new Function("TrivialArray", g);
|
|
44
|
+
return z(u[d][0]);
|
|
45
|
+
}
|
|
46
|
+
var g = ["'use strict'"], y = s(l), m = y.map(function(k) {
|
|
47
|
+
return "i" + k;
|
|
48
|
+
}), _ = "this.offset+" + y.map(function(k) {
|
|
49
|
+
return "this.stride[" + k + "]*i" + k;
|
|
50
|
+
}).join("+"), b = y.map(function(k) {
|
|
51
|
+
return "b" + k;
|
|
52
|
+
}).join(","), M = y.map(function(k) {
|
|
53
|
+
return "c" + k;
|
|
54
|
+
}).join(",");
|
|
55
|
+
g.push("function " + c + "(a," + b + "," + M + ",d){this.data=a", "this.shape=[" + b + "]", "this.stride=[" + M + "]", "this.offset=d|0}", "var proto=" + c + ".prototype", "proto.dtype='" + d + "'", "proto.dimension=" + l), g.push("Object.defineProperty(proto,'size',{get:function " + c + "_size(){return " + y.map(function(k) {
|
|
56
|
+
return "this.shape[" + k + "]";
|
|
57
|
+
}).join("*"), "}})"), l === 1 ? g.push("proto.order=[0]") : (g.push("Object.defineProperty(proto,'order',{get:"), l < 4 ? (g.push("function " + c + "_order(){"), l === 2 ? g.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})") : l === 3 && g.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")) : g.push("ORDER})")), g.push("proto.set=function " + c + "_set(" + m.join(",") + ",v){"), p ? g.push("return this.data.set(" + _ + ",v)}") : g.push("return this.data[" + _ + "]=v}"), g.push("proto.get=function " + c + "_get(" + m.join(",") + "){"), p ? g.push("return this.data.get(" + _ + ")}") : g.push("return this.data[" + _ + "]}"), g.push("proto.index=function " + c + "_index(", m.join(), "){return " + _ + "}"), g.push("proto.hi=function " + c + "_hi(" + m.join(",") + "){return new " + c + "(this.data," + y.map(function(k) {
|
|
58
|
+
return ["(typeof i", k, "!=='number'||i", k, "<0)?this.shape[", k, "]:i", k, "|0"].join("");
|
|
59
|
+
}).join(",") + "," + y.map(function(k) {
|
|
60
|
+
return "this.stride[" + k + "]";
|
|
61
|
+
}).join(",") + ",this.offset)}");
|
|
62
|
+
var x = y.map(function(k) {
|
|
63
|
+
return "a" + k + "=this.shape[" + k + "]";
|
|
64
|
+
}), w = y.map(function(k) {
|
|
65
|
+
return "c" + k + "=this.stride[" + k + "]";
|
|
66
|
+
});
|
|
67
|
+
g.push("proto.lo=function " + c + "_lo(" + m.join(",") + "){var b=this.offset,d=0," + x.join(",") + "," + w.join(","));
|
|
68
|
+
for (var v = 0; v < l; ++v) g.push("if(typeof i" + v + "==='number'&&i" + v + ">=0){d=i" + v + "|0;b+=c" + v + "*d;a" + v + "-=d}");
|
|
69
|
+
g.push("return new " + c + "(this.data," + y.map(function(k) {
|
|
70
|
+
return "a" + k;
|
|
71
|
+
}).join(",") + "," + y.map(function(k) {
|
|
72
|
+
return "c" + k;
|
|
73
|
+
}).join(",") + ",b)}"), g.push("proto.step=function " + c + "_step(" + m.join(",") + "){var " + y.map(function(k) {
|
|
74
|
+
return "a" + k + "=this.shape[" + k + "]";
|
|
75
|
+
}).join(",") + "," + y.map(function(k) {
|
|
76
|
+
return "b" + k + "=this.stride[" + k + "]";
|
|
77
|
+
}).join(",") + ",c=this.offset,d=0,ceil=Math.ceil");
|
|
78
|
+
for (var v = 0; v < l; ++v) g.push("if(typeof i" + v + "==='number'){d=i" + v + "|0;if(d<0){c+=b" + v + "*(a" + v + "-1);a" + v + "=ceil(-a" + v + "/d)}else{a" + v + "=ceil(a" + v + "/d)}b" + v + "*=d}");
|
|
79
|
+
g.push("return new " + c + "(this.data," + y.map(function(k) {
|
|
80
|
+
return "a" + k;
|
|
81
|
+
}).join(",") + "," + y.map(function(k) {
|
|
82
|
+
return "b" + k;
|
|
83
|
+
}).join(",") + ",c)}");
|
|
84
|
+
for (var A = new Array(l), S = new Array(l), v = 0; v < l; ++v) A[v] = "a[i" + v + "]", S[v] = "b[i" + v + "]";
|
|
85
|
+
g.push("proto.transpose=function " + c + "_transpose(" + m + "){" + m.map(function(k, F) {
|
|
86
|
+
return k + "=(" + k + "===undefined?" + F + ":" + k + "|0)";
|
|
87
|
+
}).join(";"), "var a=this.shape,b=this.stride;return new " + c + "(this.data," + A.join(",") + "," + S.join(",") + ",this.offset)}"), g.push("proto.pick=function " + c + "_pick(" + m + "){var a=[],b=[],c=this.offset");
|
|
88
|
+
for (var v = 0; v < l; ++v) g.push("if(typeof i" + v + "==='number'&&i" + v + ">=0){c=(c+this.stride[" + v + "]*i" + v + ")|0}else{a.push(this.shape[" + v + "]);b.push(this.stride[" + v + "])}");
|
|
89
|
+
g.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"), g.push("return function construct_" + c + "(data,shape,stride,offset){return new " + c + "(data," + y.map(function(k) {
|
|
90
|
+
return "shape[" + k + "]";
|
|
91
|
+
}).join(",") + "," + y.map(function(k) {
|
|
92
|
+
return "stride[" + k + "]";
|
|
93
|
+
}).join(",") + ",offset)}");
|
|
94
|
+
var z = new Function("CTOR_LIST", "ORDER", g.join(`
|
|
95
|
+
`));
|
|
96
|
+
return z(u[d], o);
|
|
97
|
+
}
|
|
98
|
+
function h(d) {
|
|
99
|
+
if (n(d)) return "buffer";
|
|
100
|
+
if (i) switch (Object.prototype.toString.call(d)) {
|
|
101
|
+
case "[object Float64Array]":
|
|
102
|
+
return "float64";
|
|
103
|
+
case "[object Float32Array]":
|
|
104
|
+
return "float32";
|
|
105
|
+
case "[object Int8Array]":
|
|
106
|
+
return "int8";
|
|
107
|
+
case "[object Int16Array]":
|
|
108
|
+
return "int16";
|
|
109
|
+
case "[object Int32Array]":
|
|
110
|
+
return "int32";
|
|
111
|
+
case "[object Uint8Array]":
|
|
112
|
+
return "uint8";
|
|
113
|
+
case "[object Uint16Array]":
|
|
114
|
+
return "uint16";
|
|
115
|
+
case "[object Uint32Array]":
|
|
116
|
+
return "uint32";
|
|
117
|
+
case "[object Uint8ClampedArray]":
|
|
118
|
+
return "uint8_clamped";
|
|
119
|
+
case "[object BigInt64Array]":
|
|
120
|
+
return "bigint64";
|
|
121
|
+
case "[object BigUint64Array]":
|
|
122
|
+
return "biguint64";
|
|
123
|
+
}
|
|
124
|
+
return Array.isArray(d) ? "array" : "generic";
|
|
125
|
+
}
|
|
126
|
+
var u = { float32: [], float64: [], int8: [], int16: [], int32: [], uint8: [], uint16: [], uint32: [], array: [], uint8_clamped: [], bigint64: [], biguint64: [], buffer: [], generic: [] };
|
|
127
|
+
function f(d, l, c, p) {
|
|
128
|
+
if (d === void 0) {
|
|
129
|
+
var M = u.array[0];
|
|
130
|
+
return M([]);
|
|
131
|
+
} else typeof d == "number" && (d = [d]);
|
|
132
|
+
l === void 0 && (l = [d.length]);
|
|
133
|
+
var g = l.length;
|
|
134
|
+
if (c === void 0) {
|
|
135
|
+
c = new Array(g);
|
|
136
|
+
for (var y = g - 1, m = 1; y >= 0; --y) c[y] = m, m *= l[y];
|
|
137
|
+
}
|
|
138
|
+
if (p === void 0) {
|
|
139
|
+
p = 0;
|
|
140
|
+
for (var y = 0; y < g; ++y) c[y] < 0 && (p -= (l[y] - 1) * c[y]);
|
|
141
|
+
}
|
|
142
|
+
for (var _ = h(d), b = u[_]; b.length <= g + 1; ) b.push(r(_, b.length - 1));
|
|
143
|
+
var M = b[g + 1];
|
|
144
|
+
return M(d, l, c, p);
|
|
145
|
+
}
|
|
146
|
+
a.exports = f;
|
|
147
|
+
}), aa = H((t, a) => {
|
|
148
|
+
function s(e, o) {
|
|
149
|
+
for (var r = 1, h = e.length, u = e[0], f = e[0], d = 1; d < h; ++d) if (f = u, u = e[d], o(u, f)) {
|
|
150
|
+
if (d === r) {
|
|
151
|
+
r++;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
e[r++] = u;
|
|
155
|
+
}
|
|
156
|
+
return e.length = r, e;
|
|
157
|
+
}
|
|
158
|
+
function n(e) {
|
|
159
|
+
for (var o = 1, r = e.length, h = e[0], u = e[0], f = 1; f < r; ++f, u = h) if (u = h, h = e[f], h !== u) {
|
|
160
|
+
if (f === o) {
|
|
161
|
+
o++;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
e[o++] = h;
|
|
165
|
+
}
|
|
166
|
+
return e.length = o, e;
|
|
167
|
+
}
|
|
168
|
+
function i(e, o, r) {
|
|
169
|
+
return e.length === 0 ? e : o ? (r || e.sort(o), s(e, o)) : (r || e.sort(), n(e));
|
|
170
|
+
}
|
|
171
|
+
a.exports = i;
|
|
172
|
+
}), sa = H((t, a) => {
|
|
173
|
+
var s = aa();
|
|
174
|
+
function n(u, f, d) {
|
|
175
|
+
var l = u.length, c = f.arrayArgs.length, p = f.indexArgs.length > 0, g = [], y = [], m = 0, _ = 0, b, M;
|
|
176
|
+
for (b = 0; b < l; ++b) y.push(["i", b, "=0"].join(""));
|
|
177
|
+
for (M = 0; M < c; ++M) for (b = 0; b < l; ++b) _ = m, m = u[b], b === 0 ? y.push(["d", M, "s", b, "=t", M, "p", m].join("")) : y.push(["d", M, "s", b, "=(t", M, "p", m, "-s", _, "*t", M, "p", _, ")"].join(""));
|
|
178
|
+
for (y.length > 0 && g.push("var " + y.join(",")), b = l - 1; b >= 0; --b) m = u[b], g.push(["for(i", b, "=0;i", b, "<s", m, ";++i", b, "){"].join(""));
|
|
179
|
+
for (g.push(d), b = 0; b < l; ++b) {
|
|
180
|
+
for (_ = m, m = u[b], M = 0; M < c; ++M) g.push(["p", M, "+=d", M, "s", b].join(""));
|
|
181
|
+
p && (b > 0 && g.push(["index[", _, "]-=s", _].join("")), g.push(["++index[", m, "]"].join(""))), g.push("}");
|
|
182
|
+
}
|
|
183
|
+
return g.join(`
|
|
184
|
+
`);
|
|
185
|
+
}
|
|
186
|
+
function i(u, f, d, l) {
|
|
187
|
+
for (var c = f.length, p = d.arrayArgs.length, g = d.blockSize, y = d.indexArgs.length > 0, m = [], _ = 0; _ < p; ++_) m.push(["var offset", _, "=p", _].join(""));
|
|
188
|
+
for (var _ = u; _ < c; ++_) m.push(["for(var j" + _ + "=SS[", f[_], "]|0;j", _, ">0;){"].join("")), m.push(["if(j", _, "<", g, "){"].join("")), m.push(["s", f[_], "=j", _].join("")), m.push(["j", _, "=0"].join("")), m.push(["}else{s", f[_], "=", g].join("")), m.push(["j", _, "-=", g, "}"].join("")), y && m.push(["index[", f[_], "]=j", _].join(""));
|
|
189
|
+
for (var _ = 0; _ < p; ++_) {
|
|
190
|
+
for (var b = ["offset" + _], M = u; M < c; ++M) b.push(["j", M, "*t", _, "p", f[M]].join(""));
|
|
191
|
+
m.push(["p", _, "=(", b.join("+"), ")"].join(""));
|
|
192
|
+
}
|
|
193
|
+
m.push(n(f, d, l));
|
|
194
|
+
for (var _ = u; _ < c; ++_) m.push("}");
|
|
195
|
+
return m.join(`
|
|
196
|
+
`);
|
|
197
|
+
}
|
|
198
|
+
function e(u) {
|
|
199
|
+
for (var f = 0, d = u[0].length; f < d; ) {
|
|
200
|
+
for (var l = 1; l < u.length; ++l) if (u[l][f] !== u[0][f]) return f;
|
|
201
|
+
++f;
|
|
202
|
+
}
|
|
203
|
+
return f;
|
|
204
|
+
}
|
|
205
|
+
function o(u, f, d) {
|
|
206
|
+
for (var l = u.body, c = [], p = [], g = 0; g < u.args.length; ++g) {
|
|
207
|
+
var y = u.args[g];
|
|
208
|
+
if (!(y.count <= 0)) {
|
|
209
|
+
var m = new RegExp(y.name, "g"), _ = "", b = f.arrayArgs.indexOf(g);
|
|
210
|
+
switch (f.argTypes[g]) {
|
|
211
|
+
case "offset":
|
|
212
|
+
var M = f.offsetArgIndex.indexOf(g), x = f.offsetArgs[M];
|
|
213
|
+
b = x.array, _ = "+q" + M;
|
|
214
|
+
case "array":
|
|
215
|
+
_ = "p" + b + _;
|
|
216
|
+
var w = "l" + g, v = "a" + b;
|
|
217
|
+
if (f.arrayBlockIndices[b] === 0) y.count === 1 ? d[b] === "generic" ? y.lvalue ? (c.push(["var ", w, "=", v, ".get(", _, ")"].join("")), l = l.replace(m, w), p.push([v, ".set(", _, ",", w, ")"].join(""))) : l = l.replace(m, [v, ".get(", _, ")"].join("")) : l = l.replace(m, [v, "[", _, "]"].join("")) : d[b] === "generic" ? (c.push(["var ", w, "=", v, ".get(", _, ")"].join("")), l = l.replace(m, w), y.lvalue && p.push([v, ".set(", _, ",", w, ")"].join(""))) : (c.push(["var ", w, "=", v, "[", _, "]"].join("")), l = l.replace(m, w), y.lvalue && p.push([v, "[", _, "]=", w].join("")));
|
|
218
|
+
else {
|
|
219
|
+
for (var A = [y.name], S = [_], z = 0; z < Math.abs(f.arrayBlockIndices[b]); z++) A.push("\\s*\\[([^\\]]+)\\]"), S.push("$" + (z + 1) + "*t" + b + "b" + z);
|
|
220
|
+
if (m = new RegExp(A.join(""), "g"), _ = S.join("+"), d[b] === "generic") throw new Error("cwise: Generic arrays not supported in combination with blocks!");
|
|
221
|
+
l = l.replace(m, [v, "[", _, "]"].join(""));
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
case "scalar":
|
|
225
|
+
l = l.replace(m, "Y" + f.scalarArgs.indexOf(g));
|
|
226
|
+
break;
|
|
227
|
+
case "index":
|
|
228
|
+
l = l.replace(m, "index");
|
|
229
|
+
break;
|
|
230
|
+
case "shape":
|
|
231
|
+
l = l.replace(m, "shape");
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return [c.join(`
|
|
237
|
+
`), l, p.join(`
|
|
238
|
+
`)].join(`
|
|
239
|
+
`).trim();
|
|
240
|
+
}
|
|
241
|
+
function r(u) {
|
|
242
|
+
for (var f = new Array(u.length), d = !0, l = 0; l < u.length; ++l) {
|
|
243
|
+
var c = u[l], p = c.match(/\d+/);
|
|
244
|
+
p ? p = p[0] : p = "", c.charAt(0) === 0 ? f[l] = "u" + c.charAt(1) + p : f[l] = c.charAt(0) + p, l > 0 && (d = d && f[l] === f[l - 1]);
|
|
245
|
+
}
|
|
246
|
+
return d ? f[0] : f.join("");
|
|
247
|
+
}
|
|
248
|
+
function h(u, f) {
|
|
249
|
+
for (var d = f[1].length - Math.abs(u.arrayBlockIndices[0]) | 0, l = new Array(u.arrayArgs.length), c = new Array(u.arrayArgs.length), p = 0; p < u.arrayArgs.length; ++p) c[p] = f[2 * p], l[p] = f[2 * p + 1];
|
|
250
|
+
for (var g = [], y = [], m = [], _ = [], b = [], p = 0; p < u.arrayArgs.length; ++p) {
|
|
251
|
+
u.arrayBlockIndices[p] < 0 ? (m.push(0), _.push(d), g.push(d), y.push(d + u.arrayBlockIndices[p])) : (m.push(u.arrayBlockIndices[p]), _.push(u.arrayBlockIndices[p] + d), g.push(0), y.push(u.arrayBlockIndices[p]));
|
|
252
|
+
for (var M = [], x = 0; x < l[p].length; x++) m[p] <= l[p][x] && l[p][x] < _[p] && M.push(l[p][x] - m[p]);
|
|
253
|
+
b.push(M);
|
|
254
|
+
}
|
|
255
|
+
for (var w = ["SS"], v = ["'use strict'"], A = [], x = 0; x < d; ++x) A.push(["s", x, "=SS[", x, "]"].join(""));
|
|
256
|
+
for (var p = 0; p < u.arrayArgs.length; ++p) {
|
|
257
|
+
w.push("a" + p), w.push("t" + p), w.push("p" + p);
|
|
258
|
+
for (var x = 0; x < d; ++x) A.push(["t", p, "p", x, "=t", p, "[", m[p] + x, "]"].join(""));
|
|
259
|
+
for (var x = 0; x < Math.abs(u.arrayBlockIndices[p]); ++x) A.push(["t", p, "b", x, "=t", p, "[", g[p] + x, "]"].join(""));
|
|
260
|
+
}
|
|
261
|
+
for (var p = 0; p < u.scalarArgs.length; ++p) w.push("Y" + p);
|
|
262
|
+
if (u.shapeArgs.length > 0 && A.push("shape=SS.slice(0)"), u.indexArgs.length > 0) {
|
|
263
|
+
for (var S = new Array(d), p = 0; p < d; ++p) S[p] = "0";
|
|
264
|
+
A.push(["index=[", S.join(","), "]"].join(""));
|
|
265
|
+
}
|
|
266
|
+
for (var p = 0; p < u.offsetArgs.length; ++p) {
|
|
267
|
+
for (var z = u.offsetArgs[p], k = [], x = 0; x < z.offset.length; ++x) z.offset[x] !== 0 && (z.offset[x] === 1 ? k.push(["t", z.array, "p", x].join("")) : k.push([z.offset[x], "*t", z.array, "p", x].join("")));
|
|
268
|
+
k.length === 0 ? A.push("q" + p + "=0") : A.push(["q", p, "=", k.join("+")].join(""));
|
|
269
|
+
}
|
|
270
|
+
var F = s([].concat(u.pre.thisVars).concat(u.body.thisVars).concat(u.post.thisVars));
|
|
271
|
+
A = A.concat(F), A.length > 0 && v.push("var " + A.join(","));
|
|
272
|
+
for (var p = 0; p < u.arrayArgs.length; ++p) v.push("p" + p + "|=0");
|
|
273
|
+
u.pre.body.length > 3 && v.push(o(u.pre, u, c));
|
|
274
|
+
var N = o(u.body, u, c), q = e(b);
|
|
275
|
+
q < d ? v.push(i(q, b[0], u, N)) : v.push(n(b[0], u, N)), u.post.body.length > 3 && v.push(o(u.post, u, c)), u.debug && console.log("-----Generated cwise routine for ", f, `:
|
|
276
|
+
` + v.join(`
|
|
277
|
+
`) + `
|
|
278
|
+
----------`);
|
|
279
|
+
var E = [u.funcName || "unnamed", "_cwise_loop_", l[0].join("s"), "m", q, r(c)].join(""), W = new Function(["function ", E, "(", w.join(","), "){", v.join(`
|
|
280
|
+
`), "} return ", E].join(""));
|
|
281
|
+
return W();
|
|
282
|
+
}
|
|
283
|
+
a.exports = h;
|
|
284
|
+
}), na = H((t, a) => {
|
|
285
|
+
var s = sa();
|
|
286
|
+
function n(i) {
|
|
287
|
+
var e = ["'use strict'", "var CACHED={}"], o = [], r = i.funcName + "_cwise_thunk";
|
|
288
|
+
e.push(["return function ", r, "(", i.shimArgs.join(","), "){"].join(""));
|
|
289
|
+
for (var h = [], u = [], f = [["array", i.arrayArgs[0], ".shape.slice(", Math.max(0, i.arrayBlockIndices[0]), i.arrayBlockIndices[0] < 0 ? "," + i.arrayBlockIndices[0] + ")" : ")"].join("")], d = [], l = [], c = 0; c < i.arrayArgs.length; ++c) {
|
|
290
|
+
var p = i.arrayArgs[c];
|
|
291
|
+
o.push(["t", p, "=array", p, ".dtype,", "r", p, "=array", p, ".order"].join("")), h.push("t" + p), h.push("r" + p), u.push("t" + p), u.push("r" + p + ".join()"), f.push("array" + p + ".data"), f.push("array" + p + ".stride"), f.push("array" + p + ".offset|0"), c > 0 && (d.push("array" + i.arrayArgs[0] + ".shape.length===array" + p + ".shape.length+" + (Math.abs(i.arrayBlockIndices[0]) - Math.abs(i.arrayBlockIndices[c]))), l.push("array" + i.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0, i.arrayBlockIndices[0]) + "]===array" + p + ".shape[shapeIndex+" + Math.max(0, i.arrayBlockIndices[c]) + "]"));
|
|
292
|
+
}
|
|
293
|
+
i.arrayArgs.length > 1 && (e.push("if (!(" + d.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"), e.push("for(var shapeIndex=array" + i.arrayArgs[0] + ".shape.length-" + Math.abs(i.arrayBlockIndices[0]) + "; shapeIndex-->0;) {"), e.push("if (!(" + l.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')"), e.push("}"));
|
|
294
|
+
for (var c = 0; c < i.scalarArgs.length; ++c) f.push("scalar" + i.scalarArgs[c]);
|
|
295
|
+
o.push(["type=[", u.join(","), "].join()"].join("")), o.push("proc=CACHED[type]"), e.push("var " + o.join(",")), e.push(["if(!proc){", "CACHED[type]=proc=compile([", h.join(","), "])}", "return proc(", f.join(","), ")}"].join("")), i.debug && console.log(`-----Generated thunk:
|
|
296
|
+
` + e.join(`
|
|
297
|
+
`) + `
|
|
298
|
+
----------`);
|
|
299
|
+
var g = new Function("compile", e.join(`
|
|
300
|
+
`));
|
|
301
|
+
return g(s.bind(void 0, i));
|
|
302
|
+
}
|
|
303
|
+
a.exports = n;
|
|
304
|
+
}), ia = H((t, a) => {
|
|
305
|
+
var s = na();
|
|
306
|
+
function n() {
|
|
307
|
+
this.argTypes = [], this.shimArgs = [], this.arrayArgs = [], this.arrayBlockIndices = [], this.scalarArgs = [], this.offsetArgs = [], this.offsetArgIndex = [], this.indexArgs = [], this.shapeArgs = [], this.funcName = "", this.pre = null, this.body = null, this.post = null, this.debug = !1;
|
|
308
|
+
}
|
|
309
|
+
function i(e) {
|
|
310
|
+
var o = new n();
|
|
311
|
+
o.pre = e.pre, o.body = e.body, o.post = e.post;
|
|
312
|
+
var r = e.args.slice(0);
|
|
313
|
+
o.argTypes = r;
|
|
314
|
+
for (var h = 0; h < r.length; ++h) {
|
|
315
|
+
var u = r[h];
|
|
316
|
+
if (u === "array" || typeof u == "object" && u.blockIndices) {
|
|
317
|
+
if (o.argTypes[h] = "array", o.arrayArgs.push(h), o.arrayBlockIndices.push(u.blockIndices ? u.blockIndices : 0), o.shimArgs.push("array" + h), h < o.pre.args.length && o.pre.args[h].count > 0) throw new Error("cwise: pre() block may not reference array args");
|
|
318
|
+
if (h < o.post.args.length && o.post.args[h].count > 0) throw new Error("cwise: post() block may not reference array args");
|
|
319
|
+
} else if (u === "scalar") o.scalarArgs.push(h), o.shimArgs.push("scalar" + h);
|
|
320
|
+
else if (u === "index") {
|
|
321
|
+
if (o.indexArgs.push(h), h < o.pre.args.length && o.pre.args[h].count > 0) throw new Error("cwise: pre() block may not reference array index");
|
|
322
|
+
if (h < o.body.args.length && o.body.args[h].lvalue) throw new Error("cwise: body() block may not write to array index");
|
|
323
|
+
if (h < o.post.args.length && o.post.args[h].count > 0) throw new Error("cwise: post() block may not reference array index");
|
|
324
|
+
} else if (u === "shape") {
|
|
325
|
+
if (o.shapeArgs.push(h), h < o.pre.args.length && o.pre.args[h].lvalue) throw new Error("cwise: pre() block may not write to array shape");
|
|
326
|
+
if (h < o.body.args.length && o.body.args[h].lvalue) throw new Error("cwise: body() block may not write to array shape");
|
|
327
|
+
if (h < o.post.args.length && o.post.args[h].lvalue) throw new Error("cwise: post() block may not write to array shape");
|
|
328
|
+
} else if (typeof u == "object" && u.offset) o.argTypes[h] = "offset", o.offsetArgs.push({ array: u.array, offset: u.offset }), o.offsetArgIndex.push(h);
|
|
329
|
+
else throw new Error("cwise: Unknown argument type " + r[h]);
|
|
330
|
+
}
|
|
331
|
+
if (o.arrayArgs.length <= 0) throw new Error("cwise: No array arguments specified");
|
|
332
|
+
if (o.pre.args.length > r.length) throw new Error("cwise: Too many arguments in pre() block");
|
|
333
|
+
if (o.body.args.length > r.length) throw new Error("cwise: Too many arguments in body() block");
|
|
334
|
+
if (o.post.args.length > r.length) throw new Error("cwise: Too many arguments in post() block");
|
|
335
|
+
return o.debug = !!e.printCode || !!e.debug, o.funcName = e.funcName || "cwise", o.blockSize = e.blockSize || 64, s(o);
|
|
336
|
+
}
|
|
337
|
+
a.exports = i;
|
|
338
|
+
}), at = H((t) => {
|
|
339
|
+
var a = ia(), s = { body: "", args: [], thisVars: [], localVars: [] };
|
|
340
|
+
function n(l) {
|
|
341
|
+
if (!l) return s;
|
|
342
|
+
for (var c = 0; c < l.args.length; ++c) {
|
|
343
|
+
var p = l.args[c];
|
|
344
|
+
c === 0 ? l.args[c] = { name: p, lvalue: !0, rvalue: !!l.rvalue, count: l.count || 1 } : l.args[c] = { name: p, lvalue: !1, rvalue: !0, count: 1 };
|
|
345
|
+
}
|
|
346
|
+
return l.thisVars || (l.thisVars = []), l.localVars || (l.localVars = []), l;
|
|
347
|
+
}
|
|
348
|
+
function i(l) {
|
|
349
|
+
return a({ args: l.args, pre: n(l.pre), body: n(l.body), post: n(l.proc), funcName: l.funcName });
|
|
350
|
+
}
|
|
351
|
+
function e(l) {
|
|
352
|
+
for (var c = [], p = 0; p < l.args.length; ++p) c.push("a" + p);
|
|
353
|
+
var g = new Function("P", ["return function ", l.funcName, "_ndarrayops(", c.join(","), ") {P(", c.join(","), ");return a0}"].join(""));
|
|
354
|
+
return g(i(l));
|
|
355
|
+
}
|
|
356
|
+
var o = { add: "+", sub: "-", mul: "*", div: "/", mod: "%", band: "&", bor: "|", bxor: "^", lshift: "<<", rshift: ">>", rrshift: ">>>" };
|
|
357
|
+
(function() {
|
|
358
|
+
for (var l in o) {
|
|
359
|
+
var c = o[l];
|
|
360
|
+
t[l] = e({ args: ["array", "array", "array"], body: { args: ["a", "b", "c"], body: "a=b" + c + "c" }, funcName: l }), t[l + "eq"] = e({ args: ["array", "array"], body: { args: ["a", "b"], body: "a" + c + "=b" }, rvalue: !0, funcName: l + "eq" }), t[l + "s"] = e({ args: ["array", "array", "scalar"], body: { args: ["a", "b", "s"], body: "a=b" + c + "s" }, funcName: l + "s" }), t[l + "seq"] = e({ args: ["array", "scalar"], body: { args: ["a", "s"], body: "a" + c + "=s" }, rvalue: !0, funcName: l + "seq" });
|
|
361
|
+
}
|
|
362
|
+
})();
|
|
363
|
+
var r = { not: "!", bnot: "~", neg: "-", recip: "1.0/" };
|
|
364
|
+
(function() {
|
|
365
|
+
for (var l in r) {
|
|
366
|
+
var c = r[l];
|
|
367
|
+
t[l] = e({ args: ["array", "array"], body: { args: ["a", "b"], body: "a=" + c + "b" }, funcName: l }), t[l + "eq"] = e({ args: ["array"], body: { args: ["a"], body: "a=" + c + "a" }, rvalue: !0, count: 2, funcName: l + "eq" });
|
|
368
|
+
}
|
|
369
|
+
})();
|
|
370
|
+
var h = { and: "&&", or: "||", eq: "===", neq: "!==", lt: "<", gt: ">", leq: "<=", geq: ">=" };
|
|
371
|
+
(function() {
|
|
372
|
+
for (var l in h) {
|
|
373
|
+
var c = h[l];
|
|
374
|
+
t[l] = e({ args: ["array", "array", "array"], body: { args: ["a", "b", "c"], body: "a=b" + c + "c" }, funcName: l }), t[l + "s"] = e({ args: ["array", "array", "scalar"], body: { args: ["a", "b", "s"], body: "a=b" + c + "s" }, funcName: l + "s" }), t[l + "eq"] = e({ args: ["array", "array"], body: { args: ["a", "b"], body: "a=a" + c + "b" }, rvalue: !0, count: 2, funcName: l + "eq" }), t[l + "seq"] = e({ args: ["array", "scalar"], body: { args: ["a", "s"], body: "a=a" + c + "s" }, rvalue: !0, count: 2, funcName: l + "seq" });
|
|
375
|
+
}
|
|
376
|
+
})();
|
|
377
|
+
var u = ["abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", "log", "round", "sin", "sqrt", "tan"];
|
|
378
|
+
(function() {
|
|
379
|
+
for (var l = 0; l < u.length; ++l) {
|
|
380
|
+
var c = u[l];
|
|
381
|
+
t[c] = e({ args: ["array", "array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b"], body: "a=this_f(b)", thisVars: ["this_f"] }, funcName: c }), t[c + "eq"] = e({ args: ["array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a"], body: "a=this_f(a)", thisVars: ["this_f"] }, rvalue: !0, count: 2, funcName: c + "eq" });
|
|
382
|
+
}
|
|
383
|
+
})();
|
|
384
|
+
var f = ["max", "min", "atan2", "pow"];
|
|
385
|
+
(function() {
|
|
386
|
+
for (var l = 0; l < f.length; ++l) {
|
|
387
|
+
var c = f[l];
|
|
388
|
+
t[c] = e({ args: ["array", "array", "array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b", "c"], body: "a=this_f(b,c)", thisVars: ["this_f"] }, funcName: c }), t[c + "s"] = e({ args: ["array", "array", "scalar"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b", "c"], body: "a=this_f(b,c)", thisVars: ["this_f"] }, funcName: c + "s" }), t[c + "eq"] = e({ args: ["array", "array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b"], body: "a=this_f(a,b)", thisVars: ["this_f"] }, rvalue: !0, count: 2, funcName: c + "eq" }), t[c + "seq"] = e({ args: ["array", "scalar"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b"], body: "a=this_f(a,b)", thisVars: ["this_f"] }, rvalue: !0, count: 2, funcName: c + "seq" });
|
|
389
|
+
}
|
|
390
|
+
})();
|
|
391
|
+
var d = ["atan2", "pow"];
|
|
392
|
+
(function() {
|
|
393
|
+
for (var l = 0; l < d.length; ++l) {
|
|
394
|
+
var c = d[l];
|
|
395
|
+
t[c + "op"] = e({ args: ["array", "array", "array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b", "c"], body: "a=this_f(c,b)", thisVars: ["this_f"] }, funcName: c + "op" }), t[c + "ops"] = e({ args: ["array", "array", "scalar"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b", "c"], body: "a=this_f(c,b)", thisVars: ["this_f"] }, funcName: c + "ops" }), t[c + "opeq"] = e({ args: ["array", "array"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b"], body: "a=this_f(b,a)", thisVars: ["this_f"] }, rvalue: !0, count: 2, funcName: c + "opeq" }), t[c + "opseq"] = e({ args: ["array", "scalar"], pre: { args: [], body: "this_f=Math." + c, thisVars: ["this_f"] }, body: { args: ["a", "b"], body: "a=this_f(b,a)", thisVars: ["this_f"] }, rvalue: !0, count: 2, funcName: c + "opseq" });
|
|
396
|
+
}
|
|
397
|
+
})(), t.any = a({ args: ["array"], pre: s, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 1 }], body: "if(a){return true}", localVars: [], thisVars: [] }, post: { args: [], localVars: [], thisVars: [], body: "return false" }, funcName: "any" }), t.all = a({ args: ["array"], pre: s, body: { args: [{ name: "x", lvalue: !1, rvalue: !0, count: 1 }], body: "if(!x){return false}", localVars: [], thisVars: [] }, post: { args: [], localVars: [], thisVars: [], body: "return true" }, funcName: "all" }), t.sum = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=0" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 1 }], body: "this_s+=a", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return this_s" }, funcName: "sum" }), t.prod = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=1" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 1 }], body: "this_s*=a", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return this_s" }, funcName: "prod" }), t.norm2squared = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=0" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 2 }], body: "this_s+=a*a", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return this_s" }, funcName: "norm2squared" }), t.norm2 = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=0" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 2 }], body: "this_s+=a*a", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return Math.sqrt(this_s)" }, funcName: "norm2" }), t.norminf = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=0" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 4 }], body: "if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return this_s" }, funcName: "norminf" }), t.norm1 = a({ args: ["array"], pre: { args: [], localVars: [], thisVars: ["this_s"], body: "this_s=0" }, body: { args: [{ name: "a", lvalue: !1, rvalue: !0, count: 3 }], body: "this_s+=a<0?-a:a", localVars: [], thisVars: ["this_s"] }, post: { args: [], localVars: [], thisVars: ["this_s"], body: "return this_s" }, funcName: "norm1" }), t.sup = a({ args: ["array"], pre: { body: "this_h=-Infinity", args: [], thisVars: ["this_h"], localVars: [] }, body: { body: "if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_", args: [{ name: "_inline_1_arg0_", lvalue: !1, rvalue: !0, count: 2 }], thisVars: ["this_h"], localVars: [] }, post: { body: "return this_h", args: [], thisVars: ["this_h"], localVars: [] } }), t.inf = a({ args: ["array"], pre: { body: "this_h=Infinity", args: [], thisVars: ["this_h"], localVars: [] }, body: { body: "if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_", args: [{ name: "_inline_1_arg0_", lvalue: !1, rvalue: !0, count: 2 }], thisVars: ["this_h"], localVars: [] }, post: { body: "return this_h", args: [], thisVars: ["this_h"], localVars: [] } }), t.argmin = a({ args: ["index", "array", "shape"], pre: { body: "{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}", args: [{ name: "_inline_0_arg0_", lvalue: !1, rvalue: !1, count: 0 }, { name: "_inline_0_arg1_", lvalue: !1, rvalue: !1, count: 0 }, { name: "_inline_0_arg2_", lvalue: !1, rvalue: !0, count: 1 }], thisVars: ["this_i", "this_v"], localVars: [] }, body: { body: "{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}", args: [{ name: "_inline_1_arg0_", lvalue: !1, rvalue: !0, count: 2 }, { name: "_inline_1_arg1_", lvalue: !1, rvalue: !0, count: 2 }], thisVars: ["this_i", "this_v"], localVars: ["_inline_1_k"] }, post: { body: "{return this_i}", args: [], thisVars: ["this_i"], localVars: [] } }), t.argmax = a({ args: ["index", "array", "shape"], pre: { body: "{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}", args: [{ name: "_inline_0_arg0_", lvalue: !1, rvalue: !1, count: 0 }, { name: "_inline_0_arg1_", lvalue: !1, rvalue: !1, count: 0 }, { name: "_inline_0_arg2_", lvalue: !1, rvalue: !0, count: 1 }], thisVars: ["this_i", "this_v"], localVars: [] }, body: { body: "{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}", args: [{ name: "_inline_1_arg0_", lvalue: !1, rvalue: !0, count: 2 }, { name: "_inline_1_arg1_", lvalue: !1, rvalue: !0, count: 2 }], thisVars: ["this_i", "this_v"], localVars: ["_inline_1_k"] }, post: { body: "{return this_i}", args: [], thisVars: ["this_i"], localVars: [] } }), t.random = e({ args: ["array"], pre: { args: [], body: "this_f=Math.random", thisVars: ["this_f"] }, body: { args: ["a"], body: "a=this_f()", thisVars: ["this_f"] }, funcName: "random" }), t.assign = e({ args: ["array", "array"], body: { args: ["a", "b"], body: "a=b" }, funcName: "assign" }), t.assigns = e({ args: ["array", "scalar"], body: { args: ["a", "b"], body: "a=b" }, funcName: "assigns" }), t.equals = a({ args: ["array", "array"], pre: s, body: { args: [{ name: "x", lvalue: !1, rvalue: !0, count: 1 }, { name: "y", lvalue: !1, rvalue: !0, count: 1 }], body: "if(x!==y){return false}", localVars: [], thisVars: [] }, post: { args: [], localVars: [], thisVars: [], body: "return true" }, funcName: "equals" });
|
|
398
|
+
}), $ = T(tt()), R = T(at()), U = T(tt()), j = T(at()), nt = class {
|
|
399
|
+
constructor(t, a, s) {
|
|
400
|
+
this._dataNormalized = t, this._minD = a, this._maxD = s;
|
|
401
|
+
}
|
|
402
|
+
static createFromUnnormalized(t) {
|
|
403
|
+
let a = j.sup(t), s = j.inf(t), n = (0, U.default)(new Float32Array(t.size), t.shape), i = a - s;
|
|
404
|
+
return i < 1e-4 ? j.assigns(n, 0) : (j.subs(n, t, s), j.divs(n, n, i)), new nt(n, s, a);
|
|
405
|
+
}
|
|
406
|
+
get data() {
|
|
407
|
+
return this._dataNormalized;
|
|
408
|
+
}
|
|
409
|
+
get minD() {
|
|
410
|
+
return this._minD;
|
|
411
|
+
}
|
|
412
|
+
get maxD() {
|
|
413
|
+
return this._maxD;
|
|
414
|
+
}
|
|
415
|
+
denormalize() {
|
|
416
|
+
let t = (0, U.default)(new Float32Array(this._dataNormalized.size), this._dataNormalized.shape);
|
|
417
|
+
return j.muls(t, this._dataNormalized, this._maxD - this._minD), j.adds(t, t, this._minD), t;
|
|
418
|
+
}
|
|
419
|
+
}, B = class {
|
|
420
|
+
constructor(t, a) {
|
|
421
|
+
this._quantized = t, this._method = a;
|
|
422
|
+
}
|
|
423
|
+
get quantized() {
|
|
424
|
+
return this._quantized;
|
|
425
|
+
}
|
|
426
|
+
static maxIntBits(t) {
|
|
427
|
+
return 2 ** t - 1;
|
|
428
|
+
}
|
|
429
|
+
static fromNormalized(t, a) {
|
|
430
|
+
let s = t.data, n;
|
|
431
|
+
if (a === "norm8x") {
|
|
432
|
+
let i = B.maxIntBits(8), e = (0, U.default)(new Float32Array(s.size), s.shape);
|
|
433
|
+
j.muls(e, s, i), j.roundeq(e), n = (0, U.default)(new Uint8Array(e.data), s.shape);
|
|
434
|
+
} else if (a === "norm565") {
|
|
435
|
+
let i = (0, U.default)(new Float32Array(s.size), s.shape);
|
|
436
|
+
j.assign(i, s), j.mulseq(i.pick(null, 0), B.maxIntBits(5)), j.mulseq(i.pick(null, 1), B.maxIntBits(6)), j.mulseq(i.pick(null, 2), B.maxIntBits(5)), j.roundeq(i);
|
|
437
|
+
let e = (0, U.default)(new Uint16Array(i.data), s.shape), o = (0, U.default)(new Uint16Array(s.shape[0]), [s.shape[0]]), r = (0, U.default)(new Uint16Array(s.shape[0]), [s.shape[0]]);
|
|
438
|
+
j.lshifts(o, e.pick(null, 0), 11), j.lshifts(r, e.pick(null, 1), 5), j.boreq(o, r), j.boreq(o, e.pick(null, 2)), n = o;
|
|
439
|
+
} else {
|
|
440
|
+
let i = (0, U.default)(new Float32Array(s.size), s.shape);
|
|
441
|
+
j.assign(i, s), j.mulseq(i.pick(null, 0), B.maxIntBits(11)), j.mulseq(i.pick(null, 1), B.maxIntBits(10)), j.mulseq(i.pick(null, 2), B.maxIntBits(11)), j.roundeq(i);
|
|
442
|
+
let e = (0, U.default)(new Uint32Array(i.data), s.shape), o = (0, U.default)(new Uint32Array(s.shape[0]), [s.shape[0]]), r = (0, U.default)(new Uint32Array(s.shape[0]), [s.shape[0]]);
|
|
443
|
+
j.lshifts(o, e.pick(null, 0), 21), j.lshifts(r, e.pick(null, 1), 11), j.boreq(o, r), j.boreq(o, e.pick(null, 2)), n = o;
|
|
444
|
+
}
|
|
445
|
+
return new B(n, a);
|
|
446
|
+
}
|
|
447
|
+
dequantize(t, a) {
|
|
448
|
+
let s = this._method, n, i = this._quantized;
|
|
449
|
+
if (s === "norm8x") {
|
|
450
|
+
let e = B.maxIntBits(8);
|
|
451
|
+
n = (0, U.default)(new Float32Array(i.size), i.shape), j.muls(n, i, 1 / e);
|
|
452
|
+
} else if (s === "norm565") {
|
|
453
|
+
let e = (0, U.default)(new Uint8Array(i.shape[0]), [i.shape[0]]), o = (0, U.default)(new Uint8Array(i.shape[0]), [i.shape[0]]), r = (0, U.default)(new Uint8Array(i.shape[0]), [i.shape[0]]);
|
|
454
|
+
j.rrshifts(e, i, 11), j.rrshifts(o, i, 5), j.bandseq(o, B.maxIntBits(6)), j.bands(r, i, B.maxIntBits(5)), n = (0, U.default)(new Float32Array(i.shape[0] * 3), [i.shape[0], 3]), j.muls(n.pick(null, 0), e, 1 / B.maxIntBits(5)), j.muls(n.pick(null, 1), o, 1 / B.maxIntBits(6)), j.muls(n.pick(null, 2), r, 1 / B.maxIntBits(5));
|
|
455
|
+
} else {
|
|
456
|
+
let e = (0, U.default)(new Uint16Array(i.shape[0]), [i.shape[0]]), o = (0, U.default)(new Uint16Array(i.shape[0]), [i.shape[0]]), r = (0, U.default)(new Uint16Array(i.shape[0]), [i.shape[0]]);
|
|
457
|
+
j.rrshifts(e, i, 21), j.rrshifts(o, i, 11), j.bandseq(o, B.maxIntBits(10)), j.bands(r, i, B.maxIntBits(11)), n = (0, U.default)(new Float32Array(i.shape[0] * 3), [i.shape[0], 3]), j.muls(n.pick(null, 0), e, 1 / B.maxIntBits(11)), j.muls(n.pick(null, 1), o, 1 / B.maxIntBits(10)), j.muls(n.pick(null, 2), r, 1 / B.maxIntBits(11));
|
|
458
|
+
}
|
|
459
|
+
return new nt(n, t, a);
|
|
460
|
+
}
|
|
461
|
+
}, L = class {
|
|
462
|
+
constructor(t, a, s, n, i, e = !1) {
|
|
463
|
+
this._quantized = t, this._minMaxMatrix = a, this._chunkSize = s, this._quantizationMethod = n, this._variableChunkSize = i, this._isDynamicChunks = e;
|
|
464
|
+
}
|
|
465
|
+
get length() {
|
|
466
|
+
return this._quantized.shape[0];
|
|
467
|
+
}
|
|
468
|
+
get nchunks() {
|
|
469
|
+
return this._minMaxMatrix.shape[0];
|
|
470
|
+
}
|
|
471
|
+
get quantized() {
|
|
472
|
+
return this._quantized;
|
|
473
|
+
}
|
|
474
|
+
get method() {
|
|
475
|
+
return this._quantizationMethod;
|
|
476
|
+
}
|
|
477
|
+
get minmaxMatrix() {
|
|
478
|
+
return this._minMaxMatrix;
|
|
479
|
+
}
|
|
480
|
+
_createPrunedMinMax(t) {
|
|
481
|
+
let a = t.length, s = this.minmaxMatrix.shape[0] - a, n = (0, $.default)(new Float32Array(s * 2), [s, 2]), i = 0, e = s, o = 0, r = this.minmaxMatrix.shape[0];
|
|
482
|
+
for (let h = 0; h < t.length; h++) r = t[h], e = r - o + i, e > i && R.assign(n.hi(e, 2).lo(i, 0), this.minmaxMatrix.hi(r, 2).lo(o, 0)), i = e, o = r + 1;
|
|
483
|
+
return i < s && R.assign(n.lo(i, 0), this.minmaxMatrix.lo(o, 0)), n;
|
|
484
|
+
}
|
|
485
|
+
_createPrunedQuantized(t) {
|
|
486
|
+
let a = t.length, s = this.quantized.shape[0] - a, n = this._quantizationMethod, i, e;
|
|
487
|
+
if (n === "norm8x") {
|
|
488
|
+
e = this._quantized.shape[1];
|
|
489
|
+
let f = e ? s * e : s;
|
|
490
|
+
i = (0, $.default)(new Uint8Array(f), e ? [s, e] : [s, 1]);
|
|
491
|
+
} else n === "norm565" ? i = (0, $.default)(new Uint16Array(s), [s]) : i = (0, $.default)(new Uint32Array(s), [s]);
|
|
492
|
+
let o = 0, r = s, h = 0, u = i.shape[0];
|
|
493
|
+
for (let f = 0; f < t.length; f++) u = t[f], r = u - h + o, r > o && (e ? R.assign(i.hi(r, e).lo(o, 0), this._quantized.hi(u, e).lo(h, 0)) : R.assign(i.hi(r).lo(o), this._quantized.hi(u).lo(h))), o = r, h = u + 1;
|
|
494
|
+
return o < s && (e ? R.assign(i.lo(o, 0), this._quantized.lo(h, 0)) : R.assign(i.lo(o), this._quantized.lo(h))), i;
|
|
495
|
+
}
|
|
496
|
+
pruneFeature(t, a, s) {
|
|
497
|
+
let n = this._createPrunedQuantized(t), i = this._createPrunedMinMax(a);
|
|
498
|
+
return new L(n, i, this._chunkSize, this._quantizationMethod, s, !0);
|
|
499
|
+
}
|
|
500
|
+
static getRequiredNChunks(t, a) {
|
|
501
|
+
return Math.floor(t / a);
|
|
502
|
+
}
|
|
503
|
+
static fromArray(t, a, s) {
|
|
504
|
+
let n = t.shape[0], i = Math.floor(n / s), e = (0, $.default)(new Float32Array(i * 2), [i, 2], [2, 1]), o;
|
|
505
|
+
a === "norm8x" ? o = (0, $.default)(new Uint8Array(t.size), t.shape) : a === "norm565" ? o = (0, $.default)(new Uint16Array(t.shape[0]), [t.shape[0]]) : o = (0, $.default)(new Uint32Array(t.shape[0]), [t.shape[0]]);
|
|
506
|
+
for (let r = 0; r < i; r++) {
|
|
507
|
+
let h = r * s, u = r + 1 < i ? (r + 1) * s : n, f;
|
|
508
|
+
t.shape.length > 1 ? f = nt.createFromUnnormalized(t.hi(u, t.shape[1]).lo(h, 0)) : f = nt.createFromUnnormalized(t.hi(u).lo(h)), e.set(r, 0, f.minD), e.set(r, 1, f.maxD), o.shape.length > 1 ? R.assign(o.hi(u, o.shape[1]).lo(h, 0), B.fromNormalized(f, a).quantized) : R.assign(o.hi(u).lo(h), B.fromNormalized(f, a).quantized);
|
|
509
|
+
}
|
|
510
|
+
return new L(o, e, s, a);
|
|
511
|
+
}
|
|
512
|
+
denormDequant() {
|
|
513
|
+
let t = this._minMaxMatrix.shape[0], a = this._quantized, s = a.shape[0], n = this._quantizationMethod, i = this._chunkSize, e;
|
|
514
|
+
if (this._isDynamicChunks) {
|
|
515
|
+
if (!this._variableChunkSize) throw new Error("variable chunk must exists if chunkSize isDynamic");
|
|
516
|
+
e = this._variableChunkSize;
|
|
517
|
+
}
|
|
518
|
+
let o;
|
|
519
|
+
n === "norm8x" ? o = (0, $.default)(new Float32Array(a.size), a.shape) : o = (0, $.default)(new Float32Array(s * 3), [s, 3]);
|
|
520
|
+
let r = 0, h = i;
|
|
521
|
+
for (let u = 0; u < t; u++) {
|
|
522
|
+
let [f, d] = [this._minMaxMatrix.get(u, 0), this._minMaxMatrix.get(u, 1)];
|
|
523
|
+
this._isDynamicChunks && (h = e[u]);
|
|
524
|
+
let l = u + 1 < t ? r + h : s, c;
|
|
525
|
+
a.shape.length > 1 ? c = new B(a.hi(l, a.shape[1]).lo(r, 0), n) : c = new B(a.hi(l).lo(r), n), R.assign(o.hi(l, o.shape[1]).lo(r, 0), c.dequantize(f, d).denormalize()), r = l;
|
|
526
|
+
}
|
|
527
|
+
return o;
|
|
528
|
+
}
|
|
529
|
+
static async fetchArrayBuffer(t) {
|
|
530
|
+
return await (await fetch(t, { mode: "cors" })).arrayBuffer();
|
|
531
|
+
}
|
|
532
|
+
}, G = T(tt()), V = T(at()), ea = "http://127.0.0.1:8000", J = T(tt()), C = T(at()), bt = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
|
|
533
|
+
function _t(t) {
|
|
534
|
+
return t < 1e5 ? t < 100 ? t < 10 ? 0 : 1 : t < 1e4 ? t < 1e3 ? 2 : 3 : 4 : t < 1e7 ? t < 1e6 ? 5 : 6 : t < 1e9 ? t < 1e8 ? 7 : 8 : 9;
|
|
535
|
+
}
|
|
536
|
+
function vt(t, a) {
|
|
537
|
+
if (t === a) return 0;
|
|
538
|
+
if (~~t === t && ~~a === a) {
|
|
539
|
+
if (t === 0 || a === 0) return t < a ? -1 : 1;
|
|
540
|
+
if (t < 0 || a < 0) {
|
|
541
|
+
if (a >= 0) return -1;
|
|
542
|
+
if (t >= 0) return 1;
|
|
543
|
+
t = -t, a = -a;
|
|
544
|
+
}
|
|
545
|
+
let i = _t(t), e = _t(a), o = 0;
|
|
546
|
+
return i < e ? (t *= bt[e - i - 1], a /= 10, o = -1) : i > e && (a *= bt[i - e - 1], t /= 10, o = 1), t === a ? o : t < a ? -1 : 1;
|
|
547
|
+
}
|
|
548
|
+
let s = String(t), n = String(a);
|
|
549
|
+
return s === n ? 0 : s < n ? -1 : 1;
|
|
550
|
+
}
|
|
551
|
+
function oa(t) {
|
|
552
|
+
let a = 0;
|
|
553
|
+
for (; t >= 32; ) a |= t & 1, t >>= 1;
|
|
554
|
+
return t + a;
|
|
555
|
+
}
|
|
556
|
+
function Mt(t, a, s, n) {
|
|
557
|
+
let i = a + 1;
|
|
558
|
+
if (i === s) return 1;
|
|
559
|
+
if (n(t[i++], t[a]) < 0) {
|
|
560
|
+
for (; i < s && n(t[i], t[i - 1]) < 0; ) i++;
|
|
561
|
+
ra(t, a, i);
|
|
562
|
+
} else for (; i < s && n(t[i], t[i - 1]) >= 0; ) i++;
|
|
563
|
+
return i - a;
|
|
564
|
+
}
|
|
565
|
+
function ra(t, a, s) {
|
|
566
|
+
for (s--; a < s; ) {
|
|
567
|
+
let n = t[a];
|
|
568
|
+
t[a++] = t[s], t[s--] = n;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function xt(t, a, s, n, i) {
|
|
572
|
+
for (n === a && n++; n < s; n++) {
|
|
573
|
+
let e = t[n], o = a, r = n;
|
|
574
|
+
for (; o < r; ) {
|
|
575
|
+
let u = o + r >>> 1;
|
|
576
|
+
i(e, t[u]) < 0 ? r = u : o = u + 1;
|
|
577
|
+
}
|
|
578
|
+
let h = n - o;
|
|
579
|
+
switch (h) {
|
|
580
|
+
case 3:
|
|
581
|
+
t[o + 3] = t[o + 2];
|
|
582
|
+
case 2:
|
|
583
|
+
t[o + 2] = t[o + 1];
|
|
584
|
+
case 1:
|
|
585
|
+
t[o + 1] = t[o];
|
|
586
|
+
break;
|
|
587
|
+
default:
|
|
588
|
+
for (; h > 0; ) t[o + h] = t[o + h - 1], h--;
|
|
589
|
+
}
|
|
590
|
+
t[o] = e;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function et(t, a, s, n, i, e) {
|
|
594
|
+
let o = 0, r = 0, h = 1;
|
|
595
|
+
if (e(t, a[s + i]) > 0) {
|
|
596
|
+
for (r = n - i; h < r && e(t, a[s + i + h]) > 0; ) o = h, h = (h << 1) + 1, h <= 0 && (h = r);
|
|
597
|
+
h > r && (h = r), o += i, h += i;
|
|
598
|
+
} else {
|
|
599
|
+
for (r = i + 1; h < r && e(t, a[s + i - h]) <= 0; ) o = h, h = (h << 1) + 1, h <= 0 && (h = r);
|
|
600
|
+
h > r && (h = r);
|
|
601
|
+
let u = o;
|
|
602
|
+
o = i - h, h = i - u;
|
|
603
|
+
}
|
|
604
|
+
for (o++; o < h; ) {
|
|
605
|
+
let u = o + (h - o >>> 1);
|
|
606
|
+
e(t, a[s + u]) > 0 ? o = u + 1 : h = u;
|
|
607
|
+
}
|
|
608
|
+
return h;
|
|
609
|
+
}
|
|
610
|
+
function ot(t, a, s, n, i, e) {
|
|
611
|
+
let o = 0, r = 0, h = 1;
|
|
612
|
+
if (e(t, a[s + i]) < 0) {
|
|
613
|
+
for (r = i + 1; h < r && e(t, a[s + i - h]) < 0; ) o = h, h = (h << 1) + 1, h <= 0 && (h = r);
|
|
614
|
+
h > r && (h = r);
|
|
615
|
+
let u = o;
|
|
616
|
+
o = i - h, h = i - u;
|
|
617
|
+
} else {
|
|
618
|
+
for (r = n - i; h < r && e(t, a[s + i + h]) >= 0; ) o = h, h = (h << 1) + 1, h <= 0 && (h = r);
|
|
619
|
+
h > r && (h = r), o += i, h += i;
|
|
620
|
+
}
|
|
621
|
+
for (o++; o < h; ) {
|
|
622
|
+
let u = o + (h - o >>> 1);
|
|
623
|
+
e(t, a[s + u]) < 0 ? h = u : o = u + 1;
|
|
624
|
+
}
|
|
625
|
+
return h;
|
|
626
|
+
}
|
|
627
|
+
var ha = class {
|
|
628
|
+
constructor(t, a) {
|
|
629
|
+
P(this, "array", null), P(this, "compare", null), P(this, "minGallop", 7), P(this, "length", 0), P(this, "tmpStorageLength", 256), P(this, "stackLength", 0), P(this, "runStart", null), P(this, "runLength", null), P(this, "stackSize", 0), this.array = t, this.compare = a, this.length = t.length, this.length < 2 * 256 && (this.tmpStorageLength = this.length >>> 1), this.tmp = new Array(this.tmpStorageLength), this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40, this.runStart = new Array(this.stackLength), this.runLength = new Array(this.stackLength);
|
|
630
|
+
}
|
|
631
|
+
pushRun(t, a) {
|
|
632
|
+
this.runStart[this.stackSize] = t, this.runLength[this.stackSize] = a, this.stackSize += 1;
|
|
633
|
+
}
|
|
634
|
+
mergeRuns() {
|
|
635
|
+
for (; this.stackSize > 1; ) {
|
|
636
|
+
let t = this.stackSize - 2;
|
|
637
|
+
if (t >= 1 && this.runLength[t - 1] <= this.runLength[t] + this.runLength[t + 1] || t >= 2 && this.runLength[t - 2] <= this.runLength[t] + this.runLength[t - 1]) this.runLength[t - 1] < this.runLength[t + 1] && t--;
|
|
638
|
+
else if (this.runLength[t] > this.runLength[t + 1]) break;
|
|
639
|
+
this.mergeAt(t);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
forceMergeRuns() {
|
|
643
|
+
for (; this.stackSize > 1; ) {
|
|
644
|
+
let t = this.stackSize - 2;
|
|
645
|
+
t > 0 && this.runLength[t - 1] < this.runLength[t + 1] && t--, this.mergeAt(t);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
mergeAt(t) {
|
|
649
|
+
let a = this.compare, s = this.array, n = this.runStart[t], i = this.runLength[t], e = this.runStart[t + 1], o = this.runLength[t + 1];
|
|
650
|
+
this.runLength[t] = i + o, t === this.stackSize - 3 && (this.runStart[t + 1] = this.runStart[t + 2], this.runLength[t + 1] = this.runLength[t + 2]), this.stackSize--;
|
|
651
|
+
let r = ot(s[e], s, n, i, 0, a);
|
|
652
|
+
n += r, i -= r, i !== 0 && (o = et(s[n + i - 1], s, e, o, o - 1, a), o !== 0 && (i <= o ? this.mergeLow(n, i, e, o) : this.mergeHigh(n, i, e, o)));
|
|
653
|
+
}
|
|
654
|
+
mergeLow(t, a, s, n) {
|
|
655
|
+
let i = this.compare, e = this.array, o = this.tmp, r = 0;
|
|
656
|
+
for (r = 0; r < a; r++) o[r] = e[t + r];
|
|
657
|
+
let h = 0, u = s, f = t;
|
|
658
|
+
if (e[f++] = e[u++], --n === 0) {
|
|
659
|
+
for (r = 0; r < a; r++) e[f + r] = o[h + r];
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (a === 1) {
|
|
663
|
+
for (r = 0; r < n; r++) e[f + r] = e[u + r];
|
|
664
|
+
e[f + n] = o[h];
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
let d = this.minGallop;
|
|
668
|
+
for (; ; ) {
|
|
669
|
+
let l = 0, c = 0, p = !1;
|
|
670
|
+
do
|
|
671
|
+
if (i(e[u], o[h]) < 0) {
|
|
672
|
+
if (e[f++] = e[u++], c++, l = 0, --n === 0) {
|
|
673
|
+
p = !0;
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
} else if (e[f++] = o[h++], l++, c = 0, --a === 1) {
|
|
677
|
+
p = !0;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
while ((l | c) < d);
|
|
681
|
+
if (p) break;
|
|
682
|
+
do {
|
|
683
|
+
if (l = ot(e[u], o, h, a, 0, i), l !== 0) {
|
|
684
|
+
for (r = 0; r < l; r++) e[f + r] = o[h + r];
|
|
685
|
+
if (f += l, h += l, a -= l, a <= 1) {
|
|
686
|
+
p = !0;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
if (e[f++] = e[u++], --n === 0) {
|
|
691
|
+
p = !0;
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
if (c = et(o[h], e, u, n, 0, i), c !== 0) {
|
|
695
|
+
for (r = 0; r < c; r++) e[f + r] = e[u + r];
|
|
696
|
+
if (f += c, u += c, n -= c, n === 0) {
|
|
697
|
+
p = !0;
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
if (e[f++] = o[h++], --a === 1) {
|
|
702
|
+
p = !0;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
d--;
|
|
706
|
+
} while (l >= 7 || c >= 7);
|
|
707
|
+
if (p) break;
|
|
708
|
+
d < 0 && (d = 0), d += 2;
|
|
709
|
+
}
|
|
710
|
+
if (this.minGallop = d, d < 1 && (this.minGallop = 1), a === 1) {
|
|
711
|
+
for (r = 0; r < n; r++) e[f + r] = e[u + r];
|
|
712
|
+
e[f + n] = o[h];
|
|
713
|
+
} else {
|
|
714
|
+
if (a === 0) throw new Error("mergeLow preconditions were not respected");
|
|
715
|
+
for (r = 0; r < a; r++) e[f + r] = o[h + r];
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
mergeHigh(t, a, s, n) {
|
|
719
|
+
let i = this.compare, e = this.array, o = this.tmp, r = 0;
|
|
720
|
+
for (r = 0; r < n; r++) o[r] = e[s + r];
|
|
721
|
+
let h = t + a - 1, u = n - 1, f = s + n - 1, d = 0, l = 0;
|
|
722
|
+
if (e[f--] = e[h--], --a === 0) {
|
|
723
|
+
for (d = f - (n - 1), r = 0; r < n; r++) e[d + r] = o[r];
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (n === 1) {
|
|
727
|
+
for (f -= a, h -= a, l = f + 1, d = h + 1, r = a - 1; r >= 0; r--) e[l + r] = e[d + r];
|
|
728
|
+
e[f] = o[u];
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
let c = this.minGallop;
|
|
732
|
+
for (; ; ) {
|
|
733
|
+
let p = 0, g = 0, y = !1;
|
|
734
|
+
do
|
|
735
|
+
if (i(o[u], e[h]) < 0) {
|
|
736
|
+
if (e[f--] = e[h--], p++, g = 0, --a === 0) {
|
|
737
|
+
y = !0;
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
} else if (e[f--] = o[u--], g++, p = 0, --n === 1) {
|
|
741
|
+
y = !0;
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
while ((p | g) < c);
|
|
745
|
+
if (y) break;
|
|
746
|
+
do {
|
|
747
|
+
if (p = a - ot(o[u], e, t, a, a - 1, i), p !== 0) {
|
|
748
|
+
for (f -= p, h -= p, a -= p, l = f + 1, d = h + 1, r = p - 1; r >= 0; r--) e[l + r] = e[d + r];
|
|
749
|
+
if (a === 0) {
|
|
750
|
+
y = !0;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (e[f--] = o[u--], --n === 1) {
|
|
755
|
+
y = !0;
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
if (g = n - et(e[h], o, 0, n, n - 1, i), g !== 0) {
|
|
759
|
+
for (f -= g, u -= g, n -= g, l = f + 1, d = u + 1, r = 0; r < g; r++) e[l + r] = o[d + r];
|
|
760
|
+
if (n <= 1) {
|
|
761
|
+
y = !0;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (e[f--] = e[h--], --a === 0) {
|
|
766
|
+
y = !0;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
c--;
|
|
770
|
+
} while (p >= 7 || g >= 7);
|
|
771
|
+
if (y) break;
|
|
772
|
+
c < 0 && (c = 0), c += 2;
|
|
773
|
+
}
|
|
774
|
+
if (this.minGallop = c, c < 1 && (this.minGallop = 1), n === 1) {
|
|
775
|
+
for (f -= a, h -= a, l = f + 1, d = h + 1, r = a - 1; r >= 0; r--) e[l + r] = e[d + r];
|
|
776
|
+
e[f] = o[u];
|
|
777
|
+
} else {
|
|
778
|
+
if (n === 0) throw new Error("mergeHigh preconditions were not respected");
|
|
779
|
+
for (d = f - (n - 1), r = 0; r < n; r++) e[d + r] = o[r];
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
function ua(t, a, s, n) {
|
|
784
|
+
if (!Array.isArray(t)) throw new TypeError("Can only sort arrays");
|
|
785
|
+
a ? typeof a != "function" && (n = s, s = a, a = vt) : a = vt, s || (s = 0), n || (n = t.length);
|
|
786
|
+
let i = n - s;
|
|
787
|
+
if (i < 2) return;
|
|
788
|
+
let e = 0;
|
|
789
|
+
if (i < 32) {
|
|
790
|
+
e = Mt(t, s, n, a), xt(t, s, n, s + e, a);
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
let o = new ha(t, a), r = oa(i);
|
|
794
|
+
do {
|
|
795
|
+
if (e = Mt(t, s, n, a), e < r) {
|
|
796
|
+
let h = i;
|
|
797
|
+
h > r && (h = r), xt(t, s, s + h, s + e, a), e = h;
|
|
798
|
+
}
|
|
799
|
+
o.pushRun(s, e), o.mergeRuns(), i -= e, s += e;
|
|
800
|
+
} while (i !== 0);
|
|
801
|
+
o.forceMergeRuns();
|
|
802
|
+
}
|
|
803
|
+
function rt(t) {
|
|
804
|
+
let a = (0, J.default)(new Int32Array(t.shape[0]), [t.shape[0]]), s = (0, J.default)(new Int32Array(t.shape[0]), [t.shape[0]]);
|
|
805
|
+
return C.bands(a, t, 1023), C.lshifts(s, a, 16), C.bxoreq(a, s), C.bandseq(a, 4278190335), C.lshifts(s, a, 8), C.bxoreq(a, s), C.bandseq(a, 50393103), C.lshifts(s, a, 4), C.bxoreq(a, s), C.bandseq(a, 51130563), C.lshifts(s, a, 2), C.bxoreq(a, s), C.bandseq(a, 153391689), a;
|
|
806
|
+
}
|
|
807
|
+
function la(t) {
|
|
808
|
+
let a = rt(t.pick(null, 0)), s = rt(t.pick(null, 1));
|
|
809
|
+
C.lshiftseq(s, 1);
|
|
810
|
+
let n = rt(t.pick(null, 2));
|
|
811
|
+
return C.lshiftseq(n, 2), C.boreq(a, s), C.boreq(a, n), a;
|
|
812
|
+
}
|
|
813
|
+
function Z(t, a) {
|
|
814
|
+
if (t.shape[0] !== a.shape[0]) throw new Error("wrong length");
|
|
815
|
+
let s = (0, J.default)(new Float32Array(t.size), t.shape, t.stride, t.offset);
|
|
816
|
+
for (let n = 0; n < a.shape[0]; n++) {
|
|
817
|
+
let i = a.get(n);
|
|
818
|
+
if (t.shape.length > 1) for (let e = 0; e < t.shape[1]; e++) s.set(n, e, t.get(i, e));
|
|
819
|
+
else s.set(n, t.get(i));
|
|
820
|
+
}
|
|
821
|
+
return s;
|
|
822
|
+
}
|
|
823
|
+
function ca(t) {
|
|
824
|
+
let a = C.sup(t), s = C.inf(t), n = 1e3 / Math.min(1e3, a - s), i = (0, J.default)(new Float32Array(t.data), t.shape);
|
|
825
|
+
C.mulseq(i, n);
|
|
826
|
+
let e = (0, J.default)(new Int32Array(i.data), t.shape), o = la(e), r = Array.from(o.data).map((u, f) => [u, f]);
|
|
827
|
+
ua(r, (u, f) => u[0] - f[0]);
|
|
828
|
+
let h = r.map(([u, f]) => f);
|
|
829
|
+
return (0, J.default)(Uint32Array.from(h));
|
|
830
|
+
}
|
|
831
|
+
var Y = class {
|
|
832
|
+
constructor(t, a, s, n, i, e, o, r, h, u) {
|
|
833
|
+
this.propertyDescs = t, this.format = a, this.nsplats = s, this.xyz = n, this.colors = i, this.harmonics = e, this.opacity = o, this.scaling = r, this.rotation = h, this.maxSHDegree = u;
|
|
834
|
+
}
|
|
835
|
+
getPlyBinary() {
|
|
836
|
+
let t = Y._generateHeaderString(this.propertyDescs, this.format, this.nsplats), a = new TextEncoder().encode(t), s = Object.keys(this.propertyDescs).length, n = (0, G.default)(new Float32Array(this.nsplats * s), [this.nsplats, s]);
|
|
837
|
+
if (V.assign(n.pick(null, this.propertyDescs.x.index), this.xyz.pick(null, 0)), V.assign(n.pick(null, this.propertyDescs.y.index), this.xyz.pick(null, 1)), V.assign(n.pick(null, this.propertyDescs.z.index), this.xyz.pick(null, 2)), V.assign(n.pick(null, this.propertyDescs.f_dc_0.index), this.colors.pick(null, 0)), V.assign(n.pick(null, this.propertyDescs.f_dc_1.index), this.colors.pick(null, 1)), V.assign(n.pick(null, this.propertyDescs.f_dc_2.index), this.colors.pick(null, 2)), V.assign(n.pick(null, this.propertyDescs.opacity.index), this.opacity.pick(null, 0)), V.assign(n.pick(null, this.propertyDescs.scale_0.index), this.scaling.pick(null, 0)), V.assign(n.pick(null, this.propertyDescs.scale_1.index), this.scaling.pick(null, 1)), V.assign(n.pick(null, this.propertyDescs.scale_2.index), this.scaling.pick(null, 2)), V.assign(n.pick(null, this.propertyDescs.rot_0.index), this.rotation.pick(null, 0)), V.assign(n.pick(null, this.propertyDescs.rot_1.index), this.rotation.pick(null, 1)), V.assign(n.pick(null, this.propertyDescs.rot_2.index), this.rotation.pick(null, 2)), V.assign(n.pick(null, this.propertyDescs.rot_3.index), this.rotation.pick(null, 3)), this.harmonics && this.harmonics.length > 0) for (let o = 0; o < this.harmonics.length; o++) {
|
|
838
|
+
let r = o * 3;
|
|
839
|
+
V.assign(n.pick(null, this.propertyDescs[`f_rest_${r}`].index), this.harmonics[o].pick(null, 0)), V.assign(n.pick(null, this.propertyDescs[`f_rest_${r + 1}`].index), this.harmonics[o].pick(null, 1)), V.assign(n.pick(null, this.propertyDescs[`f_rest_${r + 2}`].index), this.harmonics[o].pick(null, 2));
|
|
840
|
+
}
|
|
841
|
+
let i = new Uint8Array(n.data.buffer), e = new Uint8Array(i.length + a.length);
|
|
842
|
+
return e.set(a), e.set(i, a.length), e.buffer;
|
|
843
|
+
}
|
|
844
|
+
save(t, a) {
|
|
845
|
+
let s = this.getPlyBinary(), n = new Blob([s], { type: "application/octet-stream" }), i = new File([n], t), e = new FormData();
|
|
846
|
+
e.append("file", i), e.append("filename", t), e.append("basedir", a), fetch(`${ea}/push_file`, { method: "POST", body: e });
|
|
847
|
+
}
|
|
848
|
+
static async loadFile(t) {
|
|
849
|
+
return await (await fetch(t)).arrayBuffer();
|
|
850
|
+
}
|
|
851
|
+
mortonPositionSplatsSort() {
|
|
852
|
+
let t = ca(this.xyz), a = Z(this.xyz, t), s = Z(this.colors, t), n = Z(this.opacity, t), i = Z(this.scaling, t), e = Z(this.rotation, t), o = [];
|
|
853
|
+
for (let r = 0; r < this.harmonics.length; r++) o.push(Z(this.harmonics[r], t));
|
|
854
|
+
return new Y(this.propertyDescs, this.format, this.nsplats, a, s, o, n, i, e, this.maxSHDegree);
|
|
855
|
+
}
|
|
856
|
+
static _generateHeaderString(t, a, s) {
|
|
857
|
+
let n = `ply
|
|
858
|
+
format ${a.format} ${a.version}
|
|
859
|
+
element vertex ${s}`, i = Object.keys(t).length, e = Array(i);
|
|
860
|
+
for (let o in t) {
|
|
861
|
+
let r = t[o];
|
|
862
|
+
e[r.index] = { name: o, dtype: r.dtype };
|
|
863
|
+
}
|
|
864
|
+
for (let o = 0; o < e.length; o++) n = `${n}
|
|
865
|
+
property ${e[o].dtype} ${e[o].name}`;
|
|
866
|
+
return `${n}
|
|
867
|
+
end_header
|
|
868
|
+
`;
|
|
869
|
+
}
|
|
870
|
+
static fromArrayBuffer(t, a = 3) {
|
|
871
|
+
let { splatCount: s, vertexData: n, propertiesDesc: i, format: e } = Y.decodeHeader(t), o = n.buffer.slice(n.byteOffset), r = Object.keys(i).length, h = (0, G.default)(new Float32Array(o), [s, r]), u = 0, f = {}, d = { double: 8, int: 4, uint: 4, float: 4, short: 2, ushort: 2, uchar: 1, char: 1 };
|
|
872
|
+
for (let b in i) if (i.hasOwnProperty(b)) {
|
|
873
|
+
let M = i[b].dtype;
|
|
874
|
+
f[b] = u, u += d[M];
|
|
875
|
+
}
|
|
876
|
+
let l = (0, G.default)(new Float32Array(s * 3), [s, 3]);
|
|
877
|
+
V.assign(l.pick(null, 0), h.pick(null, f.x / 4)), V.assign(l.pick(null, 1), h.pick(null, f.y / 4)), V.assign(l.pick(null, 2), h.pick(null, f.z / 4));
|
|
878
|
+
let c = (0, G.default)(new Float32Array(s * 3), [s, 3]);
|
|
879
|
+
V.assign(c.pick(null, 0), h.pick(null, f.scale_0 / 4)), V.assign(c.pick(null, 1), h.pick(null, f.scale_1 / 4)), V.assign(c.pick(null, 2), h.pick(null, f.scale_2 / 4));
|
|
880
|
+
let p = (0, G.default)(new Float32Array(s * 3), [s, 3]);
|
|
881
|
+
V.assign(p.pick(null, 0), h.pick(null, f.f_dc_0 / 4)), V.assign(p.pick(null, 1), h.pick(null, f.f_dc_1 / 4)), V.assign(p.pick(null, 2), h.pick(null, f.f_dc_2 / 4));
|
|
882
|
+
let g = (0, G.default)(new Float32Array(s * 4), [s, 4]);
|
|
883
|
+
V.assign(g.pick(null, 0), h.pick(null, f.rot_1 / 4)), V.assign(g.pick(null, 1), h.pick(null, f.rot_2 / 4)), V.assign(g.pick(null, 2), h.pick(null, f.rot_3 / 4)), V.assign(g.pick(null, 3), h.pick(null, f.rot_0 / 4));
|
|
884
|
+
for (let b = 0; b < s; b++) {
|
|
885
|
+
let M = g.pick(b, null), x = Math.sqrt(M.get(0) ** 2 + M.get(1) ** 2 + M.get(2) ** 2 + M.get(3) ** 2);
|
|
886
|
+
V.divseq(M, x);
|
|
887
|
+
}
|
|
888
|
+
let y = (0, G.default)(new Float32Array(s * 1), [s, 1]);
|
|
889
|
+
V.assign(y.pick(null, 0), h.pick(null, f.opacity / 4)), V.negeq(y), V.expeq(y), V.addseq(y, 1), V.recipeq(y), V.mulseq(y, 255);
|
|
890
|
+
let m = (Math.min(Math.max(a, 0), 3) + 1) ** 2 - 1, _ = [];
|
|
891
|
+
for (let b = 0; b < m; b++) {
|
|
892
|
+
let M = (0, G.default)(new Float32Array(s * 3), [s, 3]), x = b * 3;
|
|
893
|
+
V.assign(M.pick(null, 0), h.pick(null, f[`f_rest_${x}`] / 4)), V.assign(M.pick(null, 1), h.pick(null, f[`f_rest_${x + 1}`] / 4)), V.assign(M.pick(null, 2), h.pick(null, f[`f_rest_${x + 2}`] / 4)), _.push(M);
|
|
894
|
+
}
|
|
895
|
+
return new Y(i, e, s, l, p, _, y, c, g, a);
|
|
896
|
+
}
|
|
897
|
+
static async fromPLYFile(t, a = 3) {
|
|
898
|
+
let s = await Y.loadFile(t);
|
|
899
|
+
return Y.fromArrayBuffer(s, a);
|
|
900
|
+
}
|
|
901
|
+
static decodeHeader(t) {
|
|
902
|
+
let a = new TextDecoder(), s = 0, n = "", i = 100;
|
|
903
|
+
for (; ; ) {
|
|
904
|
+
if (s + i >= t.byteLength) throw new Error("End of file reached while searching for end of header");
|
|
905
|
+
let l = new Uint8Array(t, s, i);
|
|
906
|
+
n += a.decode(l), s += i;
|
|
907
|
+
let c = s - i * 2, p = new Uint8Array(t, Math.max(0, c), c > 0 ? i * 2 : i);
|
|
908
|
+
if (a.decode(p).includes("end_header")) break;
|
|
909
|
+
}
|
|
910
|
+
let e = n.split(`
|
|
911
|
+
`), o = 0, r = {}, h = 0, u;
|
|
912
|
+
for (let l = 0; l < e.length; l++) {
|
|
913
|
+
let c = e[l].trim();
|
|
914
|
+
if (c.startsWith("element vertex")) {
|
|
915
|
+
let p = c.match(/\d+/);
|
|
916
|
+
p && (o = parseInt(p[0]));
|
|
917
|
+
} else if (c.startsWith("property")) {
|
|
918
|
+
let p = c.match(/(\w+)\s+(\w+)\s+(\w+)/);
|
|
919
|
+
if (p) {
|
|
920
|
+
let g = p[2], y = p[3];
|
|
921
|
+
r[y] = { dtype: g, index: h }, h++;
|
|
922
|
+
}
|
|
923
|
+
} else if (c.startsWith("format")) {
|
|
924
|
+
let p = c.match(/(\w+)\s+(\w+)\s+(\d+\.?\d*)/);
|
|
925
|
+
p && (u = { format: p[2], version: p[3] });
|
|
926
|
+
} else if (c === "end_header") break;
|
|
927
|
+
}
|
|
928
|
+
let f = n.indexOf("end_header") + 10 + 1, d = new DataView(t, f);
|
|
929
|
+
return { splatCount: o, vertexData: d, headerOffset: s, propertiesDesc: r, format: u };
|
|
930
|
+
}
|
|
931
|
+
}, lt = class {
|
|
932
|
+
constructor(t, a, s, n, i, e, o, r) {
|
|
933
|
+
this.config = t, this.xyz = a, this.scaling = s, this.color = n, this.opacity = i, this.harmonics = o, this.quaternion = e, this.variableChunkSize = r;
|
|
934
|
+
}
|
|
935
|
+
get isDynamicChunks() {
|
|
936
|
+
return this.variableChunkSize && this.variableChunkSize.length > 0;
|
|
937
|
+
}
|
|
938
|
+
get nchunks() {
|
|
939
|
+
return this.xyz.nchunks;
|
|
940
|
+
}
|
|
941
|
+
get nsplats() {
|
|
942
|
+
return this.xyz.length;
|
|
943
|
+
}
|
|
944
|
+
get chunkSize() {
|
|
945
|
+
return this.config.chunkSize;
|
|
946
|
+
}
|
|
947
|
+
static compressFromGaussianData(t, a) {
|
|
948
|
+
let s = L.fromArray(t.xyz, a.xyz, a.chunkSize), n = L.fromArray(t.scaling, a.scaling, a.chunkSize), i = L.fromArray(t.colors, a.color, a.chunkSize), e = L.fromArray(t.opacity, a.opacity, a.chunkSize), o = L.fromArray(t.rotation, a.quaternion, a.chunkSize), r = t.harmonics, h = [];
|
|
949
|
+
if (a.harmonics) for (let u = 0; u < r.length; u++) {
|
|
950
|
+
let f = L.fromArray(r[u], a.harmonics, a.chunkSize);
|
|
951
|
+
h.push(f);
|
|
952
|
+
}
|
|
953
|
+
return new lt(a, s, n, i, e, o, h);
|
|
954
|
+
}
|
|
955
|
+
_countIndexesInChunks(t) {
|
|
956
|
+
let a = [], s = this.nchunks, n = this.chunkSize, i = this.nsplats, e = L.getRequiredNChunks(i, n);
|
|
957
|
+
if (s === e) for (let o = 0; o < t.length; o++) {
|
|
958
|
+
let r = t[o], h = Math.floor(r / this.chunkSize);
|
|
959
|
+
h in a ? a[h].push(r) : a[h] = [r];
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
let o = this.variableChunkSize, r = {}, h = 0;
|
|
963
|
+
for (let u = 0; u < s; u++) r[u] = h, h += o[u];
|
|
964
|
+
for (let u = 0; u < t.length; u++) {
|
|
965
|
+
let f = t[u], d = Math.min(Math.floor(f / n), s - 1);
|
|
966
|
+
for (; f >= r[d] + o[d]; ) d++;
|
|
967
|
+
d in a ? a[d].push(f) : a[d] = [f];
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return a;
|
|
971
|
+
}
|
|
972
|
+
pruneSplats(t) {
|
|
973
|
+
let a = this._countIndexesInChunks(t), s, n = [];
|
|
974
|
+
return a.length > 0 && (s = this.variableChunkSize ? [...this.variableChunkSize] : Array(this.nchunks).fill(this.chunkSize), a.forEach((i, e) => {
|
|
975
|
+
s[e] -= i.length, s[e] <= 0 && n.push(e);
|
|
976
|
+
}), s = s.filter((i) => i > 0)), new lt(this.config, this.xyz.pruneFeature(t, n, s), this.scaling.pruneFeature(t, n, s), this.color.pruneFeature(t, n, s), this.opacity.pruneFeature(t, n, s), this.quaternion.pruneFeature(t, n, s), this.harmonics ? this.harmonics.map((i) => i.pruneFeature(t, n, this.variableChunkSize)) : void 0, s);
|
|
977
|
+
}
|
|
978
|
+
static async loadConfig(t) {
|
|
979
|
+
return await (await fetch(t, { method: "GET", mode: "cors", headers: { Accept: "application/json" } })).json();
|
|
980
|
+
}
|
|
981
|
+
toGaussians() {
|
|
982
|
+
var i;
|
|
983
|
+
let t = { format: "binary_little_endian", version: "1.0" }, a = {}, s = 0;
|
|
984
|
+
if (a.x = { dtype: "float", index: s }, s++, a.y = { dtype: "float", index: s }, s++, a.z = { dtype: "float", index: s }, s++, a.f_dc_0 = { dtype: "float", index: s }, s++, a.f_dc_1 = { dtype: "float", index: s }, s++, a.f_dc_2 = { dtype: "float", index: s }, s++, this.harmonics && this.harmonics.length > 0) for (let e = 0; e < this.harmonics.length; e++) a[`f_rest_${e}`] = { dtype: "float", index: s }, s++, a[`f_rest_${e + 1}`] = { dtype: "float", index: s }, s++, a[`f_rest_${e + 2}`] = { dtype: "float", index: s }, s++;
|
|
985
|
+
a.opacity = { dtype: "float", index: s }, s++, a.scale_0 = { dtype: "float", index: s }, s++, a.scale_1 = { dtype: "float", index: s }, s++, a.scale_2 = { dtype: "float", index: s }, s++, a.rot_0 = { dtype: "float", index: s }, s++, a.rot_1 = { dtype: "float", index: s }, s++, a.rot_2 = { dtype: "float", index: s }, s++, a.rot_3 = { dtype: "float", index: s }, s++;
|
|
986
|
+
let n = (i = this.harmonics) == null ? void 0 : i.map((e) => e.denormDequant());
|
|
987
|
+
return new Y(a, t, this.xyz.length, this.xyz.denormDequant(), this.color.denormDequant(), n || [], this.opacity.denormDequant(), this.scaling.denormDequant(), this.quaternion.denormDequant(), 3);
|
|
988
|
+
}
|
|
989
|
+
}, X = T(tt()), O = T(at()), D = 1e-6, I = typeof Float32Array < "u" ? Float32Array : Array, ht = Math.random;
|
|
990
|
+
Math.hypot || (Math.hypot = function() {
|
|
991
|
+
for (var t = 0, a = arguments.length; a--; ) t += arguments[a] * arguments[a];
|
|
992
|
+
return Math.sqrt(t);
|
|
993
|
+
});
|
|
994
|
+
var Q = {};
|
|
995
|
+
dt(Q, { add: () => Ba, adjoint: () => va, clone: () => pa, copy: () => da, create: () => qt, determinant: () => Ma, equals: () => Ia, exactEquals: () => Ca, frob: () => Na, fromMat2d: () => ja, fromMat4: () => fa, fromQuat: () => Va, fromRotation: () => qa, fromScaling: () => za, fromTranslation: () => Aa, fromValues: () => ya, identity: () => ma, invert: () => _a, mul: () => Ea, multiply: () => zt, multiplyScalar: () => La, multiplyScalarAndAdd: () => Ua, normalFromMat4: () => Sa, projection: () => Da, rotate: () => wa, scale: () => ka, set: () => ga, str: () => Fa, sub: () => Oa, subtract: () => jt, translate: () => xa, transpose: () => ba });
|
|
996
|
+
function qt() {
|
|
997
|
+
var t = new I(9);
|
|
998
|
+
return I != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[0] = 1, t[4] = 1, t[8] = 1, t;
|
|
999
|
+
}
|
|
1000
|
+
function fa(t, a) {
|
|
1001
|
+
return t[0] = a[0], t[1] = a[1], t[2] = a[2], t[3] = a[4], t[4] = a[5], t[5] = a[6], t[6] = a[8], t[7] = a[9], t[8] = a[10], t;
|
|
1002
|
+
}
|
|
1003
|
+
function pa(t) {
|
|
1004
|
+
var a = new I(9);
|
|
1005
|
+
return a[0] = t[0], a[1] = t[1], a[2] = t[2], a[3] = t[3], a[4] = t[4], a[5] = t[5], a[6] = t[6], a[7] = t[7], a[8] = t[8], a;
|
|
1006
|
+
}
|
|
1007
|
+
function da(t, a) {
|
|
1008
|
+
return t[0] = a[0], t[1] = a[1], t[2] = a[2], t[3] = a[3], t[4] = a[4], t[5] = a[5], t[6] = a[6], t[7] = a[7], t[8] = a[8], t;
|
|
1009
|
+
}
|
|
1010
|
+
function ya(t, a, s, n, i, e, o, r, h) {
|
|
1011
|
+
var u = new I(9);
|
|
1012
|
+
return u[0] = t, u[1] = a, u[2] = s, u[3] = n, u[4] = i, u[5] = e, u[6] = o, u[7] = r, u[8] = h, u;
|
|
1013
|
+
}
|
|
1014
|
+
function ga(t, a, s, n, i, e, o, r, h, u) {
|
|
1015
|
+
return t[0] = a, t[1] = s, t[2] = n, t[3] = i, t[4] = e, t[5] = o, t[6] = r, t[7] = h, t[8] = u, t;
|
|
1016
|
+
}
|
|
1017
|
+
function ma(t) {
|
|
1018
|
+
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t;
|
|
1019
|
+
}
|
|
1020
|
+
function ba(t, a) {
|
|
1021
|
+
if (t === a) {
|
|
1022
|
+
var s = a[1], n = a[2], i = a[5];
|
|
1023
|
+
t[1] = a[3], t[2] = a[6], t[3] = s, t[5] = a[7], t[6] = n, t[7] = i;
|
|
1024
|
+
} else t[0] = a[0], t[1] = a[3], t[2] = a[6], t[3] = a[1], t[4] = a[4], t[5] = a[7], t[6] = a[2], t[7] = a[5], t[8] = a[8];
|
|
1025
|
+
return t;
|
|
1026
|
+
}
|
|
1027
|
+
function _a(t, a) {
|
|
1028
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = a[4], r = a[5], h = a[6], u = a[7], f = a[8], d = f * o - r * u, l = -f * e + r * h, c = u * e - o * h, p = s * d + n * l + i * c;
|
|
1029
|
+
return p ? (p = 1 / p, t[0] = d * p, t[1] = (-f * n + i * u) * p, t[2] = (r * n - i * o) * p, t[3] = l * p, t[4] = (f * s - i * h) * p, t[5] = (-r * s + i * e) * p, t[6] = c * p, t[7] = (-u * s + n * h) * p, t[8] = (o * s - n * e) * p, t) : null;
|
|
1030
|
+
}
|
|
1031
|
+
function va(t, a) {
|
|
1032
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = a[4], r = a[5], h = a[6], u = a[7], f = a[8];
|
|
1033
|
+
return t[0] = o * f - r * u, t[1] = i * u - n * f, t[2] = n * r - i * o, t[3] = r * h - e * f, t[4] = s * f - i * h, t[5] = i * e - s * r, t[6] = e * u - o * h, t[7] = n * h - s * u, t[8] = s * o - n * e, t;
|
|
1034
|
+
}
|
|
1035
|
+
function Ma(t) {
|
|
1036
|
+
var a = t[0], s = t[1], n = t[2], i = t[3], e = t[4], o = t[5], r = t[6], h = t[7], u = t[8];
|
|
1037
|
+
return a * (u * e - o * h) + s * (-u * i + o * r) + n * (h * i - e * r);
|
|
1038
|
+
}
|
|
1039
|
+
function zt(t, a, s) {
|
|
1040
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = a[4], h = a[5], u = a[6], f = a[7], d = a[8], l = s[0], c = s[1], p = s[2], g = s[3], y = s[4], m = s[5], _ = s[6], b = s[7], M = s[8];
|
|
1041
|
+
return t[0] = l * n + c * o + p * u, t[1] = l * i + c * r + p * f, t[2] = l * e + c * h + p * d, t[3] = g * n + y * o + m * u, t[4] = g * i + y * r + m * f, t[5] = g * e + y * h + m * d, t[6] = _ * n + b * o + M * u, t[7] = _ * i + b * r + M * f, t[8] = _ * e + b * h + M * d, t;
|
|
1042
|
+
}
|
|
1043
|
+
function xa(t, a, s) {
|
|
1044
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = a[4], h = a[5], u = a[6], f = a[7], d = a[8], l = s[0], c = s[1];
|
|
1045
|
+
return t[0] = n, t[1] = i, t[2] = e, t[3] = o, t[4] = r, t[5] = h, t[6] = l * n + c * o + u, t[7] = l * i + c * r + f, t[8] = l * e + c * h + d, t;
|
|
1046
|
+
}
|
|
1047
|
+
function wa(t, a, s) {
|
|
1048
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = a[4], h = a[5], u = a[6], f = a[7], d = a[8], l = Math.sin(s), c = Math.cos(s);
|
|
1049
|
+
return t[0] = c * n + l * o, t[1] = c * i + l * r, t[2] = c * e + l * h, t[3] = c * o - l * n, t[4] = c * r - l * i, t[5] = c * h - l * e, t[6] = u, t[7] = f, t[8] = d, t;
|
|
1050
|
+
}
|
|
1051
|
+
function ka(t, a, s) {
|
|
1052
|
+
var n = s[0], i = s[1];
|
|
1053
|
+
return t[0] = n * a[0], t[1] = n * a[1], t[2] = n * a[2], t[3] = i * a[3], t[4] = i * a[4], t[5] = i * a[5], t[6] = a[6], t[7] = a[7], t[8] = a[8], t;
|
|
1054
|
+
}
|
|
1055
|
+
function Aa(t, a) {
|
|
1056
|
+
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = a[0], t[7] = a[1], t[8] = 1, t;
|
|
1057
|
+
}
|
|
1058
|
+
function qa(t, a) {
|
|
1059
|
+
var s = Math.sin(a), n = Math.cos(a);
|
|
1060
|
+
return t[0] = n, t[1] = s, t[2] = 0, t[3] = -s, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t;
|
|
1061
|
+
}
|
|
1062
|
+
function za(t, a) {
|
|
1063
|
+
return t[0] = a[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = a[1], t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t;
|
|
1064
|
+
}
|
|
1065
|
+
function ja(t, a) {
|
|
1066
|
+
return t[0] = a[0], t[1] = a[1], t[2] = 0, t[3] = a[2], t[4] = a[3], t[5] = 0, t[6] = a[4], t[7] = a[5], t[8] = 1, t;
|
|
1067
|
+
}
|
|
1068
|
+
function Va(t, a) {
|
|
1069
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = s + s, r = n + n, h = i + i, u = s * o, f = n * o, d = n * r, l = i * o, c = i * r, p = i * h, g = e * o, y = e * r, m = e * h;
|
|
1070
|
+
return t[0] = 1 - d - p, t[3] = f - m, t[6] = l + y, t[1] = f + m, t[4] = 1 - u - p, t[7] = c - g, t[2] = l - y, t[5] = c + g, t[8] = 1 - u - d, t;
|
|
1071
|
+
}
|
|
1072
|
+
function Sa(t, a) {
|
|
1073
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = a[4], r = a[5], h = a[6], u = a[7], f = a[8], d = a[9], l = a[10], c = a[11], p = a[12], g = a[13], y = a[14], m = a[15], _ = s * r - n * o, b = s * h - i * o, M = s * u - e * o, x = n * h - i * r, w = n * u - e * r, v = i * u - e * h, A = f * g - d * p, S = f * y - l * p, z = f * m - c * p, k = d * y - l * g, F = d * m - c * g, N = l * m - c * y, q = _ * N - b * F + M * k + x * z - w * S + v * A;
|
|
1074
|
+
return q ? (q = 1 / q, t[0] = (r * N - h * F + u * k) * q, t[1] = (h * z - o * N - u * S) * q, t[2] = (o * F - r * z + u * A) * q, t[3] = (i * F - n * N - e * k) * q, t[4] = (s * N - i * z + e * S) * q, t[5] = (n * z - s * F - e * A) * q, t[6] = (g * v - y * w + m * x) * q, t[7] = (y * M - p * v - m * b) * q, t[8] = (p * w - g * M + m * _) * q, t) : null;
|
|
1075
|
+
}
|
|
1076
|
+
function Da(t, a, s) {
|
|
1077
|
+
return t[0] = 2 / a, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = -2 / s, t[5] = 0, t[6] = -1, t[7] = 1, t[8] = 1, t;
|
|
1078
|
+
}
|
|
1079
|
+
function Fa(t) {
|
|
1080
|
+
return "mat3(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ")";
|
|
1081
|
+
}
|
|
1082
|
+
function Na(t) {
|
|
1083
|
+
return Math.hypot(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8]);
|
|
1084
|
+
}
|
|
1085
|
+
function Ba(t, a, s) {
|
|
1086
|
+
return t[0] = a[0] + s[0], t[1] = a[1] + s[1], t[2] = a[2] + s[2], t[3] = a[3] + s[3], t[4] = a[4] + s[4], t[5] = a[5] + s[5], t[6] = a[6] + s[6], t[7] = a[7] + s[7], t[8] = a[8] + s[8], t;
|
|
1087
|
+
}
|
|
1088
|
+
function jt(t, a, s) {
|
|
1089
|
+
return t[0] = a[0] - s[0], t[1] = a[1] - s[1], t[2] = a[2] - s[2], t[3] = a[3] - s[3], t[4] = a[4] - s[4], t[5] = a[5] - s[5], t[6] = a[6] - s[6], t[7] = a[7] - s[7], t[8] = a[8] - s[8], t;
|
|
1090
|
+
}
|
|
1091
|
+
function La(t, a, s) {
|
|
1092
|
+
return t[0] = a[0] * s, t[1] = a[1] * s, t[2] = a[2] * s, t[3] = a[3] * s, t[4] = a[4] * s, t[5] = a[5] * s, t[6] = a[6] * s, t[7] = a[7] * s, t[8] = a[8] * s, t;
|
|
1093
|
+
}
|
|
1094
|
+
function Ua(t, a, s, n) {
|
|
1095
|
+
return t[0] = a[0] + s[0] * n, t[1] = a[1] + s[1] * n, t[2] = a[2] + s[2] * n, t[3] = a[3] + s[3] * n, t[4] = a[4] + s[4] * n, t[5] = a[5] + s[5] * n, t[6] = a[6] + s[6] * n, t[7] = a[7] + s[7] * n, t[8] = a[8] + s[8] * n, t;
|
|
1096
|
+
}
|
|
1097
|
+
function Ca(t, a) {
|
|
1098
|
+
return t[0] === a[0] && t[1] === a[1] && t[2] === a[2] && t[3] === a[3] && t[4] === a[4] && t[5] === a[5] && t[6] === a[6] && t[7] === a[7] && t[8] === a[8];
|
|
1099
|
+
}
|
|
1100
|
+
function Ia(t, a) {
|
|
1101
|
+
var s = t[0], n = t[1], i = t[2], e = t[3], o = t[4], r = t[5], h = t[6], u = t[7], f = t[8], d = a[0], l = a[1], c = a[2], p = a[3], g = a[4], y = a[5], m = a[6], _ = a[7], b = a[8];
|
|
1102
|
+
return Math.abs(s - d) <= D * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(n - l) <= D * Math.max(1, Math.abs(n), Math.abs(l)) && Math.abs(i - c) <= D * Math.max(1, Math.abs(i), Math.abs(c)) && Math.abs(e - p) <= D * Math.max(1, Math.abs(e), Math.abs(p)) && Math.abs(o - g) <= D * Math.max(1, Math.abs(o), Math.abs(g)) && Math.abs(r - y) <= D * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(h - m) <= D * Math.max(1, Math.abs(h), Math.abs(m)) && Math.abs(u - _) <= D * Math.max(1, Math.abs(u), Math.abs(_)) && Math.abs(f - b) <= D * Math.max(1, Math.abs(f), Math.abs(b));
|
|
1103
|
+
}
|
|
1104
|
+
var Ea = zt, Oa = jt, ct = {};
|
|
1105
|
+
dt(ct, { add: () => ks, adjoint: () => Ya, clone: () => Ta, copy: () => Pa, create: () => $a, determinant: () => Qa, equals: () => js, exactEquals: () => zs, frob: () => ws, fromQuat: () => ps, fromQuat2: () => hs, fromRotation: () => is, fromRotationTranslation: () => Dt, fromRotationTranslationScale: () => cs, fromRotationTranslationScaleOrigin: () => fs, fromScaling: () => ns, fromTranslation: () => ss, fromValues: () => Ra, fromXRotation: () => es, fromYRotation: () => os, fromZRotation: () => rs, frustum: () => ds, getRotation: () => ls, getScaling: () => Ft, getTranslation: () => us, identity: () => Vt, invert: () => Wa, lookAt: () => vs, mul: () => Vs, multiply: () => St, multiplyScalar: () => As, multiplyScalarAndAdd: () => qs, ortho: () => bs, orthoNO: () => Bt, orthoZO: () => _s, perspective: () => ys, perspectiveFromFieldOfView: () => ms, perspectiveNO: () => Nt, perspectiveZO: () => gs, rotate: () => Ja, rotateX: () => Ka, rotateY: () => ts, rotateZ: () => as, scale: () => Xa, set: () => Ga, str: () => xs, sub: () => Ss, subtract: () => Lt, targetTo: () => Ms, translate: () => Za, transpose: () => Ha });
|
|
1106
|
+
function $a() {
|
|
1107
|
+
var t = new I(16);
|
|
1108
|
+
return I != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0), t[0] = 1, t[5] = 1, t[10] = 1, t[15] = 1, t;
|
|
1109
|
+
}
|
|
1110
|
+
function Ta(t) {
|
|
1111
|
+
var a = new I(16);
|
|
1112
|
+
return a[0] = t[0], a[1] = t[1], a[2] = t[2], a[3] = t[3], a[4] = t[4], a[5] = t[5], a[6] = t[6], a[7] = t[7], a[8] = t[8], a[9] = t[9], a[10] = t[10], a[11] = t[11], a[12] = t[12], a[13] = t[13], a[14] = t[14], a[15] = t[15], a;
|
|
1113
|
+
}
|
|
1114
|
+
function Pa(t, a) {
|
|
1115
|
+
return t[0] = a[0], t[1] = a[1], t[2] = a[2], t[3] = a[3], t[4] = a[4], t[5] = a[5], t[6] = a[6], t[7] = a[7], t[8] = a[8], t[9] = a[9], t[10] = a[10], t[11] = a[11], t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15], t;
|
|
1116
|
+
}
|
|
1117
|
+
function Ra(t, a, s, n, i, e, o, r, h, u, f, d, l, c, p, g) {
|
|
1118
|
+
var y = new I(16);
|
|
1119
|
+
return y[0] = t, y[1] = a, y[2] = s, y[3] = n, y[4] = i, y[5] = e, y[6] = o, y[7] = r, y[8] = h, y[9] = u, y[10] = f, y[11] = d, y[12] = l, y[13] = c, y[14] = p, y[15] = g, y;
|
|
1120
|
+
}
|
|
1121
|
+
function Ga(t, a, s, n, i, e, o, r, h, u, f, d, l, c, p, g, y) {
|
|
1122
|
+
return t[0] = a, t[1] = s, t[2] = n, t[3] = i, t[4] = e, t[5] = o, t[6] = r, t[7] = h, t[8] = u, t[9] = f, t[10] = d, t[11] = l, t[12] = c, t[13] = p, t[14] = g, t[15] = y, t;
|
|
1123
|
+
}
|
|
1124
|
+
function Vt(t) {
|
|
1125
|
+
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1126
|
+
}
|
|
1127
|
+
function Ha(t, a) {
|
|
1128
|
+
if (t === a) {
|
|
1129
|
+
var s = a[1], n = a[2], i = a[3], e = a[6], o = a[7], r = a[11];
|
|
1130
|
+
t[1] = a[4], t[2] = a[8], t[3] = a[12], t[4] = s, t[6] = a[9], t[7] = a[13], t[8] = n, t[9] = e, t[11] = a[14], t[12] = i, t[13] = o, t[14] = r;
|
|
1131
|
+
} else t[0] = a[0], t[1] = a[4], t[2] = a[8], t[3] = a[12], t[4] = a[1], t[5] = a[5], t[6] = a[9], t[7] = a[13], t[8] = a[2], t[9] = a[6], t[10] = a[10], t[11] = a[14], t[12] = a[3], t[13] = a[7], t[14] = a[11], t[15] = a[15];
|
|
1132
|
+
return t;
|
|
1133
|
+
}
|
|
1134
|
+
function Wa(t, a) {
|
|
1135
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = a[4], r = a[5], h = a[6], u = a[7], f = a[8], d = a[9], l = a[10], c = a[11], p = a[12], g = a[13], y = a[14], m = a[15], _ = s * r - n * o, b = s * h - i * o, M = s * u - e * o, x = n * h - i * r, w = n * u - e * r, v = i * u - e * h, A = f * g - d * p, S = f * y - l * p, z = f * m - c * p, k = d * y - l * g, F = d * m - c * g, N = l * m - c * y, q = _ * N - b * F + M * k + x * z - w * S + v * A;
|
|
1136
|
+
return q ? (q = 1 / q, t[0] = (r * N - h * F + u * k) * q, t[1] = (i * F - n * N - e * k) * q, t[2] = (g * v - y * w + m * x) * q, t[3] = (l * w - d * v - c * x) * q, t[4] = (h * z - o * N - u * S) * q, t[5] = (s * N - i * z + e * S) * q, t[6] = (y * M - p * v - m * b) * q, t[7] = (f * v - l * M + c * b) * q, t[8] = (o * F - r * z + u * A) * q, t[9] = (n * z - s * F - e * A) * q, t[10] = (p * w - g * M + m * _) * q, t[11] = (d * M - f * w - c * _) * q, t[12] = (r * S - o * k - h * A) * q, t[13] = (s * k - n * S + i * A) * q, t[14] = (g * b - p * x - y * _) * q, t[15] = (f * x - d * b + l * _) * q, t) : null;
|
|
1137
|
+
}
|
|
1138
|
+
function Ya(t, a) {
|
|
1139
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = a[4], r = a[5], h = a[6], u = a[7], f = a[8], d = a[9], l = a[10], c = a[11], p = a[12], g = a[13], y = a[14], m = a[15];
|
|
1140
|
+
return t[0] = r * (l * m - c * y) - d * (h * m - u * y) + g * (h * c - u * l), t[1] = -(n * (l * m - c * y) - d * (i * m - e * y) + g * (i * c - e * l)), t[2] = n * (h * m - u * y) - r * (i * m - e * y) + g * (i * u - e * h), t[3] = -(n * (h * c - u * l) - r * (i * c - e * l) + d * (i * u - e * h)), t[4] = -(o * (l * m - c * y) - f * (h * m - u * y) + p * (h * c - u * l)), t[5] = s * (l * m - c * y) - f * (i * m - e * y) + p * (i * c - e * l), t[6] = -(s * (h * m - u * y) - o * (i * m - e * y) + p * (i * u - e * h)), t[7] = s * (h * c - u * l) - o * (i * c - e * l) + f * (i * u - e * h), t[8] = o * (d * m - c * g) - f * (r * m - u * g) + p * (r * c - u * d), t[9] = -(s * (d * m - c * g) - f * (n * m - e * g) + p * (n * c - e * d)), t[10] = s * (r * m - u * g) - o * (n * m - e * g) + p * (n * u - e * r), t[11] = -(s * (r * c - u * d) - o * (n * c - e * d) + f * (n * u - e * r)), t[12] = -(o * (d * y - l * g) - f * (r * y - h * g) + p * (r * l - h * d)), t[13] = s * (d * y - l * g) - f * (n * y - i * g) + p * (n * l - i * d), t[14] = -(s * (r * y - h * g) - o * (n * y - i * g) + p * (n * h - i * r)), t[15] = s * (r * l - h * d) - o * (n * l - i * d) + f * (n * h - i * r), t;
|
|
1141
|
+
}
|
|
1142
|
+
function Qa(t) {
|
|
1143
|
+
var a = t[0], s = t[1], n = t[2], i = t[3], e = t[4], o = t[5], r = t[6], h = t[7], u = t[8], f = t[9], d = t[10], l = t[11], c = t[12], p = t[13], g = t[14], y = t[15], m = a * o - s * e, _ = a * r - n * e, b = a * h - i * e, M = s * r - n * o, x = s * h - i * o, w = n * h - i * r, v = u * p - f * c, A = u * g - d * c, S = u * y - l * c, z = f * g - d * p, k = f * y - l * p, F = d * y - l * g;
|
|
1144
|
+
return m * F - _ * k + b * z + M * S - x * A + w * v;
|
|
1145
|
+
}
|
|
1146
|
+
function St(t, a, s) {
|
|
1147
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = a[4], h = a[5], u = a[6], f = a[7], d = a[8], l = a[9], c = a[10], p = a[11], g = a[12], y = a[13], m = a[14], _ = a[15], b = s[0], M = s[1], x = s[2], w = s[3];
|
|
1148
|
+
return t[0] = b * n + M * r + x * d + w * g, t[1] = b * i + M * h + x * l + w * y, t[2] = b * e + M * u + x * c + w * m, t[3] = b * o + M * f + x * p + w * _, b = s[4], M = s[5], x = s[6], w = s[7], t[4] = b * n + M * r + x * d + w * g, t[5] = b * i + M * h + x * l + w * y, t[6] = b * e + M * u + x * c + w * m, t[7] = b * o + M * f + x * p + w * _, b = s[8], M = s[9], x = s[10], w = s[11], t[8] = b * n + M * r + x * d + w * g, t[9] = b * i + M * h + x * l + w * y, t[10] = b * e + M * u + x * c + w * m, t[11] = b * o + M * f + x * p + w * _, b = s[12], M = s[13], x = s[14], w = s[15], t[12] = b * n + M * r + x * d + w * g, t[13] = b * i + M * h + x * l + w * y, t[14] = b * e + M * u + x * c + w * m, t[15] = b * o + M * f + x * p + w * _, t;
|
|
1149
|
+
}
|
|
1150
|
+
function Za(t, a, s) {
|
|
1151
|
+
var n = s[0], i = s[1], e = s[2], o, r, h, u, f, d, l, c, p, g, y, m;
|
|
1152
|
+
return a === t ? (t[12] = a[0] * n + a[4] * i + a[8] * e + a[12], t[13] = a[1] * n + a[5] * i + a[9] * e + a[13], t[14] = a[2] * n + a[6] * i + a[10] * e + a[14], t[15] = a[3] * n + a[7] * i + a[11] * e + a[15]) : (o = a[0], r = a[1], h = a[2], u = a[3], f = a[4], d = a[5], l = a[6], c = a[7], p = a[8], g = a[9], y = a[10], m = a[11], t[0] = o, t[1] = r, t[2] = h, t[3] = u, t[4] = f, t[5] = d, t[6] = l, t[7] = c, t[8] = p, t[9] = g, t[10] = y, t[11] = m, t[12] = o * n + f * i + p * e + a[12], t[13] = r * n + d * i + g * e + a[13], t[14] = h * n + l * i + y * e + a[14], t[15] = u * n + c * i + m * e + a[15]), t;
|
|
1153
|
+
}
|
|
1154
|
+
function Xa(t, a, s) {
|
|
1155
|
+
var n = s[0], i = s[1], e = s[2];
|
|
1156
|
+
return t[0] = a[0] * n, t[1] = a[1] * n, t[2] = a[2] * n, t[3] = a[3] * n, t[4] = a[4] * i, t[5] = a[5] * i, t[6] = a[6] * i, t[7] = a[7] * i, t[8] = a[8] * e, t[9] = a[9] * e, t[10] = a[10] * e, t[11] = a[11] * e, t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15], t;
|
|
1157
|
+
}
|
|
1158
|
+
function Ja(t, a, s, n) {
|
|
1159
|
+
var i = n[0], e = n[1], o = n[2], r = Math.hypot(i, e, o), h, u, f, d, l, c, p, g, y, m, _, b, M, x, w, v, A, S, z, k, F, N, q, E;
|
|
1160
|
+
return r < D ? null : (r = 1 / r, i *= r, e *= r, o *= r, h = Math.sin(s), u = Math.cos(s), f = 1 - u, d = a[0], l = a[1], c = a[2], p = a[3], g = a[4], y = a[5], m = a[6], _ = a[7], b = a[8], M = a[9], x = a[10], w = a[11], v = i * i * f + u, A = e * i * f + o * h, S = o * i * f - e * h, z = i * e * f - o * h, k = e * e * f + u, F = o * e * f + i * h, N = i * o * f + e * h, q = e * o * f - i * h, E = o * o * f + u, t[0] = d * v + g * A + b * S, t[1] = l * v + y * A + M * S, t[2] = c * v + m * A + x * S, t[3] = p * v + _ * A + w * S, t[4] = d * z + g * k + b * F, t[5] = l * z + y * k + M * F, t[6] = c * z + m * k + x * F, t[7] = p * z + _ * k + w * F, t[8] = d * N + g * q + b * E, t[9] = l * N + y * q + M * E, t[10] = c * N + m * q + x * E, t[11] = p * N + _ * q + w * E, a !== t && (t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15]), t);
|
|
1161
|
+
}
|
|
1162
|
+
function Ka(t, a, s) {
|
|
1163
|
+
var n = Math.sin(s), i = Math.cos(s), e = a[4], o = a[5], r = a[6], h = a[7], u = a[8], f = a[9], d = a[10], l = a[11];
|
|
1164
|
+
return a !== t && (t[0] = a[0], t[1] = a[1], t[2] = a[2], t[3] = a[3], t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15]), t[4] = e * i + u * n, t[5] = o * i + f * n, t[6] = r * i + d * n, t[7] = h * i + l * n, t[8] = u * i - e * n, t[9] = f * i - o * n, t[10] = d * i - r * n, t[11] = l * i - h * n, t;
|
|
1165
|
+
}
|
|
1166
|
+
function ts(t, a, s) {
|
|
1167
|
+
var n = Math.sin(s), i = Math.cos(s), e = a[0], o = a[1], r = a[2], h = a[3], u = a[8], f = a[9], d = a[10], l = a[11];
|
|
1168
|
+
return a !== t && (t[4] = a[4], t[5] = a[5], t[6] = a[6], t[7] = a[7], t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15]), t[0] = e * i - u * n, t[1] = o * i - f * n, t[2] = r * i - d * n, t[3] = h * i - l * n, t[8] = e * n + u * i, t[9] = o * n + f * i, t[10] = r * n + d * i, t[11] = h * n + l * i, t;
|
|
1169
|
+
}
|
|
1170
|
+
function as(t, a, s) {
|
|
1171
|
+
var n = Math.sin(s), i = Math.cos(s), e = a[0], o = a[1], r = a[2], h = a[3], u = a[4], f = a[5], d = a[6], l = a[7];
|
|
1172
|
+
return a !== t && (t[8] = a[8], t[9] = a[9], t[10] = a[10], t[11] = a[11], t[12] = a[12], t[13] = a[13], t[14] = a[14], t[15] = a[15]), t[0] = e * i + u * n, t[1] = o * i + f * n, t[2] = r * i + d * n, t[3] = h * i + l * n, t[4] = u * i - e * n, t[5] = f * i - o * n, t[6] = d * i - r * n, t[7] = l * i - h * n, t;
|
|
1173
|
+
}
|
|
1174
|
+
function ss(t, a) {
|
|
1175
|
+
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = a[0], t[13] = a[1], t[14] = a[2], t[15] = 1, t;
|
|
1176
|
+
}
|
|
1177
|
+
function ns(t, a) {
|
|
1178
|
+
return t[0] = a[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = a[1], t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = a[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1179
|
+
}
|
|
1180
|
+
function is(t, a, s) {
|
|
1181
|
+
var n = s[0], i = s[1], e = s[2], o = Math.hypot(n, i, e), r, h, u;
|
|
1182
|
+
return o < D ? null : (o = 1 / o, n *= o, i *= o, e *= o, r = Math.sin(a), h = Math.cos(a), u = 1 - h, t[0] = n * n * u + h, t[1] = i * n * u + e * r, t[2] = e * n * u - i * r, t[3] = 0, t[4] = n * i * u - e * r, t[5] = i * i * u + h, t[6] = e * i * u + n * r, t[7] = 0, t[8] = n * e * u + i * r, t[9] = i * e * u - n * r, t[10] = e * e * u + h, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t);
|
|
1183
|
+
}
|
|
1184
|
+
function es(t, a) {
|
|
1185
|
+
var s = Math.sin(a), n = Math.cos(a);
|
|
1186
|
+
return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = n, t[6] = s, t[7] = 0, t[8] = 0, t[9] = -s, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1187
|
+
}
|
|
1188
|
+
function os(t, a) {
|
|
1189
|
+
var s = Math.sin(a), n = Math.cos(a);
|
|
1190
|
+
return t[0] = n, t[1] = 0, t[2] = -s, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = s, t[9] = 0, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1191
|
+
}
|
|
1192
|
+
function rs(t, a) {
|
|
1193
|
+
var s = Math.sin(a), n = Math.cos(a);
|
|
1194
|
+
return t[0] = n, t[1] = s, t[2] = 0, t[3] = 0, t[4] = -s, t[5] = n, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1195
|
+
}
|
|
1196
|
+
function Dt(t, a, s) {
|
|
1197
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = n + n, h = i + i, u = e + e, f = n * r, d = n * h, l = n * u, c = i * h, p = i * u, g = e * u, y = o * r, m = o * h, _ = o * u;
|
|
1198
|
+
return t[0] = 1 - (c + g), t[1] = d + _, t[2] = l - m, t[3] = 0, t[4] = d - _, t[5] = 1 - (f + g), t[6] = p + y, t[7] = 0, t[8] = l + m, t[9] = p - y, t[10] = 1 - (f + c), t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
|
|
1199
|
+
}
|
|
1200
|
+
function hs(t, a) {
|
|
1201
|
+
var s = new I(3), n = -a[0], i = -a[1], e = -a[2], o = a[3], r = a[4], h = a[5], u = a[6], f = a[7], d = n * n + i * i + e * e + o * o;
|
|
1202
|
+
return d > 0 ? (s[0] = (r * o + f * n + h * e - u * i) * 2 / d, s[1] = (h * o + f * i + u * n - r * e) * 2 / d, s[2] = (u * o + f * e + r * i - h * n) * 2 / d) : (s[0] = (r * o + f * n + h * e - u * i) * 2, s[1] = (h * o + f * i + u * n - r * e) * 2, s[2] = (u * o + f * e + r * i - h * n) * 2), Dt(t, a, s), t;
|
|
1203
|
+
}
|
|
1204
|
+
function us(t, a) {
|
|
1205
|
+
return t[0] = a[12], t[1] = a[13], t[2] = a[14], t;
|
|
1206
|
+
}
|
|
1207
|
+
function Ft(t, a) {
|
|
1208
|
+
var s = a[0], n = a[1], i = a[2], e = a[4], o = a[5], r = a[6], h = a[8], u = a[9], f = a[10];
|
|
1209
|
+
return t[0] = Math.hypot(s, n, i), t[1] = Math.hypot(e, o, r), t[2] = Math.hypot(h, u, f), t;
|
|
1210
|
+
}
|
|
1211
|
+
function ls(t, a) {
|
|
1212
|
+
var s = new I(3);
|
|
1213
|
+
Ft(s, a);
|
|
1214
|
+
var n = 1 / s[0], i = 1 / s[1], e = 1 / s[2], o = a[0] * n, r = a[1] * i, h = a[2] * e, u = a[4] * n, f = a[5] * i, d = a[6] * e, l = a[8] * n, c = a[9] * i, p = a[10] * e, g = o + f + p, y = 0;
|
|
1215
|
+
return g > 0 ? (y = Math.sqrt(g + 1) * 2, t[3] = 0.25 * y, t[0] = (d - c) / y, t[1] = (l - h) / y, t[2] = (r - u) / y) : o > f && o > p ? (y = Math.sqrt(1 + o - f - p) * 2, t[3] = (d - c) / y, t[0] = 0.25 * y, t[1] = (r + u) / y, t[2] = (l + h) / y) : f > p ? (y = Math.sqrt(1 + f - o - p) * 2, t[3] = (l - h) / y, t[0] = (r + u) / y, t[1] = 0.25 * y, t[2] = (d + c) / y) : (y = Math.sqrt(1 + p - o - f) * 2, t[3] = (r - u) / y, t[0] = (l + h) / y, t[1] = (d + c) / y, t[2] = 0.25 * y), t;
|
|
1216
|
+
}
|
|
1217
|
+
function cs(t, a, s, n) {
|
|
1218
|
+
var i = a[0], e = a[1], o = a[2], r = a[3], h = i + i, u = e + e, f = o + o, d = i * h, l = i * u, c = i * f, p = e * u, g = e * f, y = o * f, m = r * h, _ = r * u, b = r * f, M = n[0], x = n[1], w = n[2];
|
|
1219
|
+
return t[0] = (1 - (p + y)) * M, t[1] = (l + b) * M, t[2] = (c - _) * M, t[3] = 0, t[4] = (l - b) * x, t[5] = (1 - (d + y)) * x, t[6] = (g + m) * x, t[7] = 0, t[8] = (c + _) * w, t[9] = (g - m) * w, t[10] = (1 - (d + p)) * w, t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
|
|
1220
|
+
}
|
|
1221
|
+
function fs(t, a, s, n, i) {
|
|
1222
|
+
var e = a[0], o = a[1], r = a[2], h = a[3], u = e + e, f = o + o, d = r + r, l = e * u, c = e * f, p = e * d, g = o * f, y = o * d, m = r * d, _ = h * u, b = h * f, M = h * d, x = n[0], w = n[1], v = n[2], A = i[0], S = i[1], z = i[2], k = (1 - (g + m)) * x, F = (c + M) * x, N = (p - b) * x, q = (c - M) * w, E = (1 - (l + m)) * w, W = (y + _) * w, K = (p + b) * v, gt = (y - _) * v, mt = (1 - (l + g)) * v;
|
|
1223
|
+
return t[0] = k, t[1] = F, t[2] = N, t[3] = 0, t[4] = q, t[5] = E, t[6] = W, t[7] = 0, t[8] = K, t[9] = gt, t[10] = mt, t[11] = 0, t[12] = s[0] + A - (k * A + q * S + K * z), t[13] = s[1] + S - (F * A + E * S + gt * z), t[14] = s[2] + z - (N * A + W * S + mt * z), t[15] = 1, t;
|
|
1224
|
+
}
|
|
1225
|
+
function ps(t, a) {
|
|
1226
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = s + s, r = n + n, h = i + i, u = s * o, f = n * o, d = n * r, l = i * o, c = i * r, p = i * h, g = e * o, y = e * r, m = e * h;
|
|
1227
|
+
return t[0] = 1 - d - p, t[1] = f + m, t[2] = l - y, t[3] = 0, t[4] = f - m, t[5] = 1 - u - p, t[6] = c + g, t[7] = 0, t[8] = l + y, t[9] = c - g, t[10] = 1 - u - d, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
1228
|
+
}
|
|
1229
|
+
function ds(t, a, s, n, i, e, o) {
|
|
1230
|
+
var r = 1 / (s - a), h = 1 / (i - n), u = 1 / (e - o);
|
|
1231
|
+
return t[0] = e * 2 * r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e * 2 * h, t[6] = 0, t[7] = 0, t[8] = (s + a) * r, t[9] = (i + n) * h, t[10] = (o + e) * u, t[11] = -1, t[12] = 0, t[13] = 0, t[14] = o * e * 2 * u, t[15] = 0, t;
|
|
1232
|
+
}
|
|
1233
|
+
function Nt(t, a, s, n, i) {
|
|
1234
|
+
var e = 1 / Math.tan(a / 2), o;
|
|
1235
|
+
return t[0] = e / s, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, i != null && i !== 1 / 0 ? (o = 1 / (n - i), t[10] = (i + n) * o, t[14] = 2 * i * n * o) : (t[10] = -1, t[14] = -2 * n), t;
|
|
1236
|
+
}
|
|
1237
|
+
var ys = Nt;
|
|
1238
|
+
function gs(t, a, s, n, i) {
|
|
1239
|
+
var e = 1 / Math.tan(a / 2), o;
|
|
1240
|
+
return t[0] = e / s, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, i != null && i !== 1 / 0 ? (o = 1 / (n - i), t[10] = i * o, t[14] = i * n * o) : (t[10] = -1, t[14] = -n), t;
|
|
1241
|
+
}
|
|
1242
|
+
function ms(t, a, s, n) {
|
|
1243
|
+
var i = Math.tan(a.upDegrees * Math.PI / 180), e = Math.tan(a.downDegrees * Math.PI / 180), o = Math.tan(a.leftDegrees * Math.PI / 180), r = Math.tan(a.rightDegrees * Math.PI / 180), h = 2 / (o + r), u = 2 / (i + e);
|
|
1244
|
+
return t[0] = h, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = u, t[6] = 0, t[7] = 0, t[8] = -((o - r) * h * 0.5), t[9] = (i - e) * u * 0.5, t[10] = n / (s - n), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = n * s / (s - n), t[15] = 0, t;
|
|
1245
|
+
}
|
|
1246
|
+
function Bt(t, a, s, n, i, e, o) {
|
|
1247
|
+
var r = 1 / (a - s), h = 1 / (n - i), u = 1 / (e - o);
|
|
1248
|
+
return t[0] = -2 * r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * u, t[11] = 0, t[12] = (a + s) * r, t[13] = (i + n) * h, t[14] = (o + e) * u, t[15] = 1, t;
|
|
1249
|
+
}
|
|
1250
|
+
var bs = Bt;
|
|
1251
|
+
function _s(t, a, s, n, i, e, o) {
|
|
1252
|
+
var r = 1 / (a - s), h = 1 / (n - i), u = 1 / (e - o);
|
|
1253
|
+
return t[0] = -2 * r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = u, t[11] = 0, t[12] = (a + s) * r, t[13] = (i + n) * h, t[14] = e * u, t[15] = 1, t;
|
|
1254
|
+
}
|
|
1255
|
+
function vs(t, a, s, n) {
|
|
1256
|
+
var i, e, o, r, h, u, f, d, l, c, p = a[0], g = a[1], y = a[2], m = n[0], _ = n[1], b = n[2], M = s[0], x = s[1], w = s[2];
|
|
1257
|
+
return Math.abs(p - M) < D && Math.abs(g - x) < D && Math.abs(y - w) < D ? Vt(t) : (f = p - M, d = g - x, l = y - w, c = 1 / Math.hypot(f, d, l), f *= c, d *= c, l *= c, i = _ * l - b * d, e = b * f - m * l, o = m * d - _ * f, c = Math.hypot(i, e, o), c ? (c = 1 / c, i *= c, e *= c, o *= c) : (i = 0, e = 0, o = 0), r = d * o - l * e, h = l * i - f * o, u = f * e - d * i, c = Math.hypot(r, h, u), c ? (c = 1 / c, r *= c, h *= c, u *= c) : (r = 0, h = 0, u = 0), t[0] = i, t[1] = r, t[2] = f, t[3] = 0, t[4] = e, t[5] = h, t[6] = d, t[7] = 0, t[8] = o, t[9] = u, t[10] = l, t[11] = 0, t[12] = -(i * p + e * g + o * y), t[13] = -(r * p + h * g + u * y), t[14] = -(f * p + d * g + l * y), t[15] = 1, t);
|
|
1258
|
+
}
|
|
1259
|
+
function Ms(t, a, s, n) {
|
|
1260
|
+
var i = a[0], e = a[1], o = a[2], r = n[0], h = n[1], u = n[2], f = i - s[0], d = e - s[1], l = o - s[2], c = f * f + d * d + l * l;
|
|
1261
|
+
c > 0 && (c = 1 / Math.sqrt(c), f *= c, d *= c, l *= c);
|
|
1262
|
+
var p = h * l - u * d, g = u * f - r * l, y = r * d - h * f;
|
|
1263
|
+
return c = p * p + g * g + y * y, c > 0 && (c = 1 / Math.sqrt(c), p *= c, g *= c, y *= c), t[0] = p, t[1] = g, t[2] = y, t[3] = 0, t[4] = d * y - l * g, t[5] = l * p - f * y, t[6] = f * g - d * p, t[7] = 0, t[8] = f, t[9] = d, t[10] = l, t[11] = 0, t[12] = i, t[13] = e, t[14] = o, t[15] = 1, t;
|
|
1264
|
+
}
|
|
1265
|
+
function xs(t) {
|
|
1266
|
+
return "mat4(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ", " + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + ")";
|
|
1267
|
+
}
|
|
1268
|
+
function ws(t) {
|
|
1269
|
+
return Math.hypot(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]);
|
|
1270
|
+
}
|
|
1271
|
+
function ks(t, a, s) {
|
|
1272
|
+
return t[0] = a[0] + s[0], t[1] = a[1] + s[1], t[2] = a[2] + s[2], t[3] = a[3] + s[3], t[4] = a[4] + s[4], t[5] = a[5] + s[5], t[6] = a[6] + s[6], t[7] = a[7] + s[7], t[8] = a[8] + s[8], t[9] = a[9] + s[9], t[10] = a[10] + s[10], t[11] = a[11] + s[11], t[12] = a[12] + s[12], t[13] = a[13] + s[13], t[14] = a[14] + s[14], t[15] = a[15] + s[15], t;
|
|
1273
|
+
}
|
|
1274
|
+
function Lt(t, a, s) {
|
|
1275
|
+
return t[0] = a[0] - s[0], t[1] = a[1] - s[1], t[2] = a[2] - s[2], t[3] = a[3] - s[3], t[4] = a[4] - s[4], t[5] = a[5] - s[5], t[6] = a[6] - s[6], t[7] = a[7] - s[7], t[8] = a[8] - s[8], t[9] = a[9] - s[9], t[10] = a[10] - s[10], t[11] = a[11] - s[11], t[12] = a[12] - s[12], t[13] = a[13] - s[13], t[14] = a[14] - s[14], t[15] = a[15] - s[15], t;
|
|
1276
|
+
}
|
|
1277
|
+
function As(t, a, s) {
|
|
1278
|
+
return t[0] = a[0] * s, t[1] = a[1] * s, t[2] = a[2] * s, t[3] = a[3] * s, t[4] = a[4] * s, t[5] = a[5] * s, t[6] = a[6] * s, t[7] = a[7] * s, t[8] = a[8] * s, t[9] = a[9] * s, t[10] = a[10] * s, t[11] = a[11] * s, t[12] = a[12] * s, t[13] = a[13] * s, t[14] = a[14] * s, t[15] = a[15] * s, t;
|
|
1279
|
+
}
|
|
1280
|
+
function qs(t, a, s, n) {
|
|
1281
|
+
return t[0] = a[0] + s[0] * n, t[1] = a[1] + s[1] * n, t[2] = a[2] + s[2] * n, t[3] = a[3] + s[3] * n, t[4] = a[4] + s[4] * n, t[5] = a[5] + s[5] * n, t[6] = a[6] + s[6] * n, t[7] = a[7] + s[7] * n, t[8] = a[8] + s[8] * n, t[9] = a[9] + s[9] * n, t[10] = a[10] + s[10] * n, t[11] = a[11] + s[11] * n, t[12] = a[12] + s[12] * n, t[13] = a[13] + s[13] * n, t[14] = a[14] + s[14] * n, t[15] = a[15] + s[15] * n, t;
|
|
1282
|
+
}
|
|
1283
|
+
function zs(t, a) {
|
|
1284
|
+
return t[0] === a[0] && t[1] === a[1] && t[2] === a[2] && t[3] === a[3] && t[4] === a[4] && t[5] === a[5] && t[6] === a[6] && t[7] === a[7] && t[8] === a[8] && t[9] === a[9] && t[10] === a[10] && t[11] === a[11] && t[12] === a[12] && t[13] === a[13] && t[14] === a[14] && t[15] === a[15];
|
|
1285
|
+
}
|
|
1286
|
+
function js(t, a) {
|
|
1287
|
+
var s = t[0], n = t[1], i = t[2], e = t[3], o = t[4], r = t[5], h = t[6], u = t[7], f = t[8], d = t[9], l = t[10], c = t[11], p = t[12], g = t[13], y = t[14], m = t[15], _ = a[0], b = a[1], M = a[2], x = a[3], w = a[4], v = a[5], A = a[6], S = a[7], z = a[8], k = a[9], F = a[10], N = a[11], q = a[12], E = a[13], W = a[14], K = a[15];
|
|
1288
|
+
return Math.abs(s - _) <= D * Math.max(1, Math.abs(s), Math.abs(_)) && Math.abs(n - b) <= D * Math.max(1, Math.abs(n), Math.abs(b)) && Math.abs(i - M) <= D * Math.max(1, Math.abs(i), Math.abs(M)) && Math.abs(e - x) <= D * Math.max(1, Math.abs(e), Math.abs(x)) && Math.abs(o - w) <= D * Math.max(1, Math.abs(o), Math.abs(w)) && Math.abs(r - v) <= D * Math.max(1, Math.abs(r), Math.abs(v)) && Math.abs(h - A) <= D * Math.max(1, Math.abs(h), Math.abs(A)) && Math.abs(u - S) <= D * Math.max(1, Math.abs(u), Math.abs(S)) && Math.abs(f - z) <= D * Math.max(1, Math.abs(f), Math.abs(z)) && Math.abs(d - k) <= D * Math.max(1, Math.abs(d), Math.abs(k)) && Math.abs(l - F) <= D * Math.max(1, Math.abs(l), Math.abs(F)) && Math.abs(c - N) <= D * Math.max(1, Math.abs(c), Math.abs(N)) && Math.abs(p - q) <= D * Math.max(1, Math.abs(p), Math.abs(q)) && Math.abs(g - E) <= D * Math.max(1, Math.abs(g), Math.abs(E)) && Math.abs(y - W) <= D * Math.max(1, Math.abs(y), Math.abs(W)) && Math.abs(m - K) <= D * Math.max(1, Math.abs(m), Math.abs(K));
|
|
1289
|
+
}
|
|
1290
|
+
var Vs = St, Ss = Lt, ft = {};
|
|
1291
|
+
dt(ft, { add: () => pn, calculateW: () => an, clone: () => un, conjugate: () => on, copy: () => cn, create: () => pt, dot: () => Pt, equals: () => _n, exactEquals: () => bn, exp: () => Et, fromEuler: () => rn, fromMat3: () => $t, fromValues: () => ln, getAngle: () => Xs, getAxisAngle: () => Zs, identity: () => Qs, invert: () => en, len: () => gn, length: () => Rt, lerp: () => yn, ln: () => Ot, mul: () => dn, multiply: () => It, normalize: () => yt, pow: () => sn, random: () => nn, rotateX: () => Js, rotateY: () => Ks, rotateZ: () => tn, rotationTo: () => vn, scale: () => Tt, set: () => fn, setAxes: () => xn, setAxisAngle: () => Ct, slerp: () => st, sqlerp: () => Mn, sqrLen: () => mn, squaredLength: () => Gt, str: () => hn });
|
|
1292
|
+
function Ut() {
|
|
1293
|
+
var t = new I(3);
|
|
1294
|
+
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t;
|
|
1295
|
+
}
|
|
1296
|
+
function Ds(t) {
|
|
1297
|
+
var a = t[0], s = t[1], n = t[2];
|
|
1298
|
+
return Math.hypot(a, s, n);
|
|
1299
|
+
}
|
|
1300
|
+
function wt(t, a, s) {
|
|
1301
|
+
var n = new I(3);
|
|
1302
|
+
return n[0] = t, n[1] = a, n[2] = s, n;
|
|
1303
|
+
}
|
|
1304
|
+
function Fs(t, a) {
|
|
1305
|
+
var s = a[0], n = a[1], i = a[2], e = s * s + n * n + i * i;
|
|
1306
|
+
return e > 0 && (e = 1 / Math.sqrt(e)), t[0] = a[0] * e, t[1] = a[1] * e, t[2] = a[2] * e, t;
|
|
1307
|
+
}
|
|
1308
|
+
function Ns(t, a) {
|
|
1309
|
+
return t[0] * a[0] + t[1] * a[1] + t[2] * a[2];
|
|
1310
|
+
}
|
|
1311
|
+
function ut(t, a, s) {
|
|
1312
|
+
var n = a[0], i = a[1], e = a[2], o = s[0], r = s[1], h = s[2];
|
|
1313
|
+
return t[0] = i * h - e * r, t[1] = e * o - n * h, t[2] = n * r - i * o, t;
|
|
1314
|
+
}
|
|
1315
|
+
var Bs = Ds;
|
|
1316
|
+
(function() {
|
|
1317
|
+
var t = Ut();
|
|
1318
|
+
return function(a, s, n, i, e, o) {
|
|
1319
|
+
var r, h;
|
|
1320
|
+
for (s || (s = 3), n || (n = 0), i ? h = Math.min(i * s + n, a.length) : h = a.length, r = n; r < h; r += s) t[0] = a[r], t[1] = a[r + 1], t[2] = a[r + 2], e(t, t, o), a[r] = t[0], a[r + 1] = t[1], a[r + 2] = t[2];
|
|
1321
|
+
return a;
|
|
1322
|
+
};
|
|
1323
|
+
})();
|
|
1324
|
+
function Ls() {
|
|
1325
|
+
var t = new I(4);
|
|
1326
|
+
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0), t;
|
|
1327
|
+
}
|
|
1328
|
+
function Us(t) {
|
|
1329
|
+
var a = new I(4);
|
|
1330
|
+
return a[0] = t[0], a[1] = t[1], a[2] = t[2], a[3] = t[3], a;
|
|
1331
|
+
}
|
|
1332
|
+
function Cs(t, a, s, n) {
|
|
1333
|
+
var i = new I(4);
|
|
1334
|
+
return i[0] = t, i[1] = a, i[2] = s, i[3] = n, i;
|
|
1335
|
+
}
|
|
1336
|
+
function Is(t, a) {
|
|
1337
|
+
return t[0] = a[0], t[1] = a[1], t[2] = a[2], t[3] = a[3], t;
|
|
1338
|
+
}
|
|
1339
|
+
function Es(t, a, s, n, i) {
|
|
1340
|
+
return t[0] = a, t[1] = s, t[2] = n, t[3] = i, t;
|
|
1341
|
+
}
|
|
1342
|
+
function Os(t, a, s) {
|
|
1343
|
+
return t[0] = a[0] + s[0], t[1] = a[1] + s[1], t[2] = a[2] + s[2], t[3] = a[3] + s[3], t;
|
|
1344
|
+
}
|
|
1345
|
+
function $s(t, a, s) {
|
|
1346
|
+
return t[0] = a[0] * s, t[1] = a[1] * s, t[2] = a[2] * s, t[3] = a[3] * s, t;
|
|
1347
|
+
}
|
|
1348
|
+
function Ts(t) {
|
|
1349
|
+
var a = t[0], s = t[1], n = t[2], i = t[3];
|
|
1350
|
+
return Math.hypot(a, s, n, i);
|
|
1351
|
+
}
|
|
1352
|
+
function Ps(t) {
|
|
1353
|
+
var a = t[0], s = t[1], n = t[2], i = t[3];
|
|
1354
|
+
return a * a + s * s + n * n + i * i;
|
|
1355
|
+
}
|
|
1356
|
+
function Rs(t, a) {
|
|
1357
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = s * s + n * n + i * i + e * e;
|
|
1358
|
+
return o > 0 && (o = 1 / Math.sqrt(o)), t[0] = s * o, t[1] = n * o, t[2] = i * o, t[3] = e * o, t;
|
|
1359
|
+
}
|
|
1360
|
+
function Gs(t, a) {
|
|
1361
|
+
return t[0] * a[0] + t[1] * a[1] + t[2] * a[2] + t[3] * a[3];
|
|
1362
|
+
}
|
|
1363
|
+
function Hs(t, a, s, n) {
|
|
1364
|
+
var i = a[0], e = a[1], o = a[2], r = a[3];
|
|
1365
|
+
return t[0] = i + n * (s[0] - i), t[1] = e + n * (s[1] - e), t[2] = o + n * (s[2] - o), t[3] = r + n * (s[3] - r), t;
|
|
1366
|
+
}
|
|
1367
|
+
function Ws(t, a) {
|
|
1368
|
+
return t[0] === a[0] && t[1] === a[1] && t[2] === a[2] && t[3] === a[3];
|
|
1369
|
+
}
|
|
1370
|
+
function Ys(t, a) {
|
|
1371
|
+
var s = t[0], n = t[1], i = t[2], e = t[3], o = a[0], r = a[1], h = a[2], u = a[3];
|
|
1372
|
+
return Math.abs(s - o) <= D * Math.max(1, Math.abs(s), Math.abs(o)) && Math.abs(n - r) <= D * Math.max(1, Math.abs(n), Math.abs(r)) && Math.abs(i - h) <= D * Math.max(1, Math.abs(i), Math.abs(h)) && Math.abs(e - u) <= D * Math.max(1, Math.abs(e), Math.abs(u));
|
|
1373
|
+
}
|
|
1374
|
+
(function() {
|
|
1375
|
+
var t = Ls();
|
|
1376
|
+
return function(a, s, n, i, e, o) {
|
|
1377
|
+
var r, h;
|
|
1378
|
+
for (s || (s = 4), n || (n = 0), i ? h = Math.min(i * s + n, a.length) : h = a.length, r = n; r < h; r += s) t[0] = a[r], t[1] = a[r + 1], t[2] = a[r + 2], t[3] = a[r + 3], e(t, t, o), a[r] = t[0], a[r + 1] = t[1], a[r + 2] = t[2], a[r + 3] = t[3];
|
|
1379
|
+
return a;
|
|
1380
|
+
};
|
|
1381
|
+
})();
|
|
1382
|
+
function pt() {
|
|
1383
|
+
var t = new I(4);
|
|
1384
|
+
return I != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t;
|
|
1385
|
+
}
|
|
1386
|
+
function Qs(t) {
|
|
1387
|
+
return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t;
|
|
1388
|
+
}
|
|
1389
|
+
function Ct(t, a, s) {
|
|
1390
|
+
s = s * 0.5;
|
|
1391
|
+
var n = Math.sin(s);
|
|
1392
|
+
return t[0] = n * a[0], t[1] = n * a[1], t[2] = n * a[2], t[3] = Math.cos(s), t;
|
|
1393
|
+
}
|
|
1394
|
+
function Zs(t, a) {
|
|
1395
|
+
var s = Math.acos(a[3]) * 2, n = Math.sin(s / 2);
|
|
1396
|
+
return n > D ? (t[0] = a[0] / n, t[1] = a[1] / n, t[2] = a[2] / n) : (t[0] = 1, t[1] = 0, t[2] = 0), s;
|
|
1397
|
+
}
|
|
1398
|
+
function Xs(t, a) {
|
|
1399
|
+
var s = Pt(t, a);
|
|
1400
|
+
return Math.acos(2 * s * s - 1);
|
|
1401
|
+
}
|
|
1402
|
+
function It(t, a, s) {
|
|
1403
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = s[0], h = s[1], u = s[2], f = s[3];
|
|
1404
|
+
return t[0] = n * f + o * r + i * u - e * h, t[1] = i * f + o * h + e * r - n * u, t[2] = e * f + o * u + n * h - i * r, t[3] = o * f - n * r - i * h - e * u, t;
|
|
1405
|
+
}
|
|
1406
|
+
function Js(t, a, s) {
|
|
1407
|
+
s *= 0.5;
|
|
1408
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = Math.sin(s), h = Math.cos(s);
|
|
1409
|
+
return t[0] = n * h + o * r, t[1] = i * h + e * r, t[2] = e * h - i * r, t[3] = o * h - n * r, t;
|
|
1410
|
+
}
|
|
1411
|
+
function Ks(t, a, s) {
|
|
1412
|
+
s *= 0.5;
|
|
1413
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = Math.sin(s), h = Math.cos(s);
|
|
1414
|
+
return t[0] = n * h - e * r, t[1] = i * h + o * r, t[2] = e * h + n * r, t[3] = o * h - i * r, t;
|
|
1415
|
+
}
|
|
1416
|
+
function tn(t, a, s) {
|
|
1417
|
+
s *= 0.5;
|
|
1418
|
+
var n = a[0], i = a[1], e = a[2], o = a[3], r = Math.sin(s), h = Math.cos(s);
|
|
1419
|
+
return t[0] = n * h + i * r, t[1] = i * h - n * r, t[2] = e * h + o * r, t[3] = o * h - e * r, t;
|
|
1420
|
+
}
|
|
1421
|
+
function an(t, a) {
|
|
1422
|
+
var s = a[0], n = a[1], i = a[2];
|
|
1423
|
+
return t[0] = s, t[1] = n, t[2] = i, t[3] = Math.sqrt(Math.abs(1 - s * s - n * n - i * i)), t;
|
|
1424
|
+
}
|
|
1425
|
+
function Et(t, a) {
|
|
1426
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = Math.sqrt(s * s + n * n + i * i), r = Math.exp(e), h = o > 0 ? r * Math.sin(o) / o : 0;
|
|
1427
|
+
return t[0] = s * h, t[1] = n * h, t[2] = i * h, t[3] = r * Math.cos(o), t;
|
|
1428
|
+
}
|
|
1429
|
+
function Ot(t, a) {
|
|
1430
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = Math.sqrt(s * s + n * n + i * i), r = o > 0 ? Math.atan2(o, e) / o : 0;
|
|
1431
|
+
return t[0] = s * r, t[1] = n * r, t[2] = i * r, t[3] = 0.5 * Math.log(s * s + n * n + i * i + e * e), t;
|
|
1432
|
+
}
|
|
1433
|
+
function sn(t, a, s) {
|
|
1434
|
+
return Ot(t, a), Tt(t, t, s), Et(t, t), t;
|
|
1435
|
+
}
|
|
1436
|
+
function st(t, a, s, n) {
|
|
1437
|
+
var i = a[0], e = a[1], o = a[2], r = a[3], h = s[0], u = s[1], f = s[2], d = s[3], l, c, p, g, y;
|
|
1438
|
+
return c = i * h + e * u + o * f + r * d, c < 0 && (c = -c, h = -h, u = -u, f = -f, d = -d), 1 - c > D ? (l = Math.acos(c), p = Math.sin(l), g = Math.sin((1 - n) * l) / p, y = Math.sin(n * l) / p) : (g = 1 - n, y = n), t[0] = g * i + y * h, t[1] = g * e + y * u, t[2] = g * o + y * f, t[3] = g * r + y * d, t;
|
|
1439
|
+
}
|
|
1440
|
+
function nn(t) {
|
|
1441
|
+
var a = ht(), s = ht(), n = ht(), i = Math.sqrt(1 - a), e = Math.sqrt(a);
|
|
1442
|
+
return t[0] = i * Math.sin(2 * Math.PI * s), t[1] = i * Math.cos(2 * Math.PI * s), t[2] = e * Math.sin(2 * Math.PI * n), t[3] = e * Math.cos(2 * Math.PI * n), t;
|
|
1443
|
+
}
|
|
1444
|
+
function en(t, a) {
|
|
1445
|
+
var s = a[0], n = a[1], i = a[2], e = a[3], o = s * s + n * n + i * i + e * e, r = o ? 1 / o : 0;
|
|
1446
|
+
return t[0] = -s * r, t[1] = -n * r, t[2] = -i * r, t[3] = e * r, t;
|
|
1447
|
+
}
|
|
1448
|
+
function on(t, a) {
|
|
1449
|
+
return t[0] = -a[0], t[1] = -a[1], t[2] = -a[2], t[3] = a[3], t;
|
|
1450
|
+
}
|
|
1451
|
+
function $t(t, a) {
|
|
1452
|
+
var s = a[0] + a[4] + a[8], n;
|
|
1453
|
+
if (s > 0) n = Math.sqrt(s + 1), t[3] = 0.5 * n, n = 0.5 / n, t[0] = (a[5] - a[7]) * n, t[1] = (a[6] - a[2]) * n, t[2] = (a[1] - a[3]) * n;
|
|
1454
|
+
else {
|
|
1455
|
+
var i = 0;
|
|
1456
|
+
a[4] > a[0] && (i = 1), a[8] > a[i * 3 + i] && (i = 2);
|
|
1457
|
+
var e = (i + 1) % 3, o = (i + 2) % 3;
|
|
1458
|
+
n = Math.sqrt(a[i * 3 + i] - a[e * 3 + e] - a[o * 3 + o] + 1), t[i] = 0.5 * n, n = 0.5 / n, t[3] = (a[e * 3 + o] - a[o * 3 + e]) * n, t[e] = (a[e * 3 + i] + a[i * 3 + e]) * n, t[o] = (a[o * 3 + i] + a[i * 3 + o]) * n;
|
|
1459
|
+
}
|
|
1460
|
+
return t;
|
|
1461
|
+
}
|
|
1462
|
+
function rn(t, a, s, n) {
|
|
1463
|
+
var i = 0.5 * Math.PI / 180;
|
|
1464
|
+
a *= i, s *= i, n *= i;
|
|
1465
|
+
var e = Math.sin(a), o = Math.cos(a), r = Math.sin(s), h = Math.cos(s), u = Math.sin(n), f = Math.cos(n);
|
|
1466
|
+
return t[0] = e * h * f - o * r * u, t[1] = o * r * f + e * h * u, t[2] = o * h * u - e * r * f, t[3] = o * h * f + e * r * u, t;
|
|
1467
|
+
}
|
|
1468
|
+
function hn(t) {
|
|
1469
|
+
return "quat(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")";
|
|
1470
|
+
}
|
|
1471
|
+
var un = Us, ln = Cs, cn = Is, fn = Es, pn = Os, dn = It, Tt = $s, Pt = Gs, yn = Hs, Rt = Ts, gn = Rt, Gt = Ps, mn = Gt, yt = Rs, bn = Ws, _n = Ys, vn = function() {
|
|
1472
|
+
var t = Ut(), a = wt(1, 0, 0), s = wt(0, 1, 0);
|
|
1473
|
+
return function(n, i, e) {
|
|
1474
|
+
var o = Ns(i, e);
|
|
1475
|
+
return o < -0.999999 ? (ut(t, a, i), Bs(t) < 1e-6 && ut(t, s, i), Fs(t, t), Ct(n, t, Math.PI), n) : o > 0.999999 ? (n[0] = 0, n[1] = 0, n[2] = 0, n[3] = 1, n) : (ut(t, i, e), n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = 1 + o, yt(n, n));
|
|
1476
|
+
};
|
|
1477
|
+
}(), Mn = function() {
|
|
1478
|
+
var t = pt(), a = pt();
|
|
1479
|
+
return function(s, n, i, e, o, r) {
|
|
1480
|
+
return st(t, n, o, r), st(a, i, e, r), st(s, t, a, 2 * r * (1 - r)), s;
|
|
1481
|
+
};
|
|
1482
|
+
}(), xn = function() {
|
|
1483
|
+
var t = qt();
|
|
1484
|
+
return function(a, s, n, i) {
|
|
1485
|
+
return t[0] = n[0], t[3] = n[1], t[6] = n[2], t[1] = i[0], t[4] = i[1], t[7] = i[2], t[2] = -s[0], t[5] = -s[1], t[8] = -s[2], yt(a, $t(a, t));
|
|
1486
|
+
};
|
|
1487
|
+
}(), kt = { xyz: 3, color: 3, opacity: 1, scaling: 3, quaternion: 4, harmonics: 3 }, At = class {
|
|
1488
|
+
constructor(t) {
|
|
1489
|
+
this.version = "", this._buffer = t;
|
|
1490
|
+
}
|
|
1491
|
+
get buffer() {
|
|
1492
|
+
return this._buffer;
|
|
1493
|
+
}
|
|
1494
|
+
get decoded() {
|
|
1495
|
+
return this._decoded || (this._decoded = this.decodeBuffer()), this._decoded;
|
|
1496
|
+
}
|
|
1497
|
+
get colorsA() {
|
|
1498
|
+
let t = 0.28209479177387814, a = this.decoded.color.denormDequant(), s = this.decoded.opacity.denormDequant(), n = (0, X.default)(new Float32Array(a.shape[0] * 4), [a.shape[0], 4]);
|
|
1499
|
+
return O.mulseq(a, t), O.addseq(a, 0.5), O.mulseq(a, 255), O.maxseq(a, 0), O.minseq(a, 255), this.version === "" && (O.negeq(s), O.expeq(s), O.addseq(s, 1), O.recipeq(s), O.mulseq(s, 255)), O.assign(n.hi(a.shape[0], 3).lo(0, 0), a), O.assign(n.hi(a.shape[0], 4).lo(0, 3), s), (0, X.default)(new Uint8Array(n.data), [a.shape[0], 4]).data;
|
|
1500
|
+
}
|
|
1501
|
+
get nsplats() {
|
|
1502
|
+
return this.decoded.nsplats;
|
|
1503
|
+
}
|
|
1504
|
+
getSplatCount() {
|
|
1505
|
+
return this.decoded.nsplats;
|
|
1506
|
+
}
|
|
1507
|
+
get precomputedCovarianceBufferData() {
|
|
1508
|
+
return this._precomputedCovarianceBufferData;
|
|
1509
|
+
}
|
|
1510
|
+
decodeBuffer() {
|
|
1511
|
+
let { splatCount: t, chunkCount: a, chunkSize: s, typeChunks: n, vertexData: i, propertiesDesc: e, version: o } = this.decodeHeader();
|
|
1512
|
+
this.version = o;
|
|
1513
|
+
let r = { xyz: e.xyz.compressionMethod, color: e.color.compressionMethod, opacity: e.opacity.compressionMethod, scaling: e.scaling.compressionMethod, quaternion: e.quaternion.compressionMethod, chunkSize: s };
|
|
1514
|
+
e.harmonics_0 && (r.harmonics = e.harmonics_0.compressionMethod);
|
|
1515
|
+
let h = i.byteOffset, u = Array(Object.keys(e).length);
|
|
1516
|
+
for (let m in e) u[e[m].index] = { name: m, method: e[m].compressionMethod };
|
|
1517
|
+
let f = a * 2 * 4, d = h, l = n === "dynamic" ? a * 2 : 0, c, p = !1;
|
|
1518
|
+
if (l > 0) {
|
|
1519
|
+
let m = new Uint16Array(i.buffer.slice(d, d + l));
|
|
1520
|
+
d += l, c = Array.from(m), p = !0;
|
|
1521
|
+
}
|
|
1522
|
+
let g = {};
|
|
1523
|
+
for (let m of u) {
|
|
1524
|
+
let _ = 0, b = !0;
|
|
1525
|
+
if (m.method === "norm8x") _ = t * 1 * kt[m.name];
|
|
1526
|
+
else if (m.method === "norm11") _ = t * 4;
|
|
1527
|
+
else if (m.method === "norm565") _ = t * 2;
|
|
1528
|
+
else throw b = !1, new Error(`Not Implemented format: ${m.method}`);
|
|
1529
|
+
let M;
|
|
1530
|
+
if (b) {
|
|
1531
|
+
let v = i.buffer.slice(d, d + f);
|
|
1532
|
+
M = (0, X.default)(new Float32Array(v), [a, 2]), d += f;
|
|
1533
|
+
} else throw new Error("loading chunk byt hasnot minmax!");
|
|
1534
|
+
let x = i.buffer.slice(d, d + _);
|
|
1535
|
+
d += _;
|
|
1536
|
+
let w;
|
|
1537
|
+
if (m.method === "norm8x") w = (0, X.default)(new Uint8Array(x), [t, kt[m.name]]);
|
|
1538
|
+
else if (m.method === "norm11") w = (0, X.default)(new Uint32Array(x));
|
|
1539
|
+
else if (m.method === "norm565") w = (0, X.default)(new Uint16Array(x));
|
|
1540
|
+
else throw new Error(`Not Implemented format: ${m.method}`);
|
|
1541
|
+
g[m.name] = new L(w, M, s, m.method, c, p);
|
|
1542
|
+
}
|
|
1543
|
+
let y = [];
|
|
1544
|
+
for (let m = 0; m < 15; m++) {
|
|
1545
|
+
let _ = g[`harmonics_${m}`];
|
|
1546
|
+
_ && (y.push(_), delete g[`harmonics_${m}`]);
|
|
1547
|
+
}
|
|
1548
|
+
return y.length > 0 && (g.harmonics = y), new lt(r, g.xyz, g.scaling, g.color, g.opacity, g.quaternion, g.harmonics, c);
|
|
1549
|
+
}
|
|
1550
|
+
buildPreComputedBuffers() {
|
|
1551
|
+
let t = this.decoded, a = t.nsplats, s = new ArrayBuffer(24 * a), n = new Float32Array(s), i = t.scaling.denormDequant(), e = t.quaternion.denormDequant(), o = ft.create(), r = Q.create(), h = Q.create(), u = Q.create(), f = ct.create();
|
|
1552
|
+
for (let d = 0; d < a; d++) {
|
|
1553
|
+
ct.fromScaling(f, [Math.exp(i.get(d, 0)), Math.exp(i.get(d, 1)), Math.exp(i.get(d, 2))]), Q.fromMat4(h, f), ft.set(o, e.get(d, 0), e.get(d, 1), e.get(d, 2), e.get(d, 3)), Q.fromQuat(r, o), Q.multiply(u, r, h);
|
|
1554
|
+
let l = u;
|
|
1555
|
+
n[6 * d] = l[0] * l[0] + l[3] * l[3] + l[6] * l[6], n[6 * d + 1] = l[0] * l[1] + l[3] * l[4] + l[6] * l[7], n[6 * d + 2] = l[0] * l[2] + l[3] * l[5] + l[6] * l[8], n[6 * d + 3] = l[1] * l[1] + l[4] * l[4] + l[7] * l[7], n[6 * d + 4] = l[1] * l[2] + l[4] * l[5] + l[7] * l[8], n[6 * d + 5] = l[2] * l[2] + l[5] * l[5] + l[8] * l[8];
|
|
1556
|
+
}
|
|
1557
|
+
this._precomputedCovarianceBufferData = s;
|
|
1558
|
+
}
|
|
1559
|
+
decodeHeader() {
|
|
1560
|
+
let t = this._buffer, a = new TextDecoder(), s = 0, n = "", i = 100;
|
|
1561
|
+
for (; ; ) {
|
|
1562
|
+
if (s + i >= t.byteLength) throw new Error("End of file reached while searching for end of header");
|
|
1563
|
+
let g = new Uint8Array(t, s, i);
|
|
1564
|
+
n += a.decode(g), s += i;
|
|
1565
|
+
let y = s - i * 2, m = new Uint8Array(t, Math.max(0, y), y >= 0 ? i * 2 : i);
|
|
1566
|
+
if (a.decode(m).includes("end_header")) break;
|
|
1567
|
+
}
|
|
1568
|
+
let e = n.split(`
|
|
1569
|
+
`), o = 0, r = 0, h = 0, u = 0, f = "", d = "", l = {};
|
|
1570
|
+
for (let g = 0; g < e.length; g++) {
|
|
1571
|
+
let y = e[g].trim();
|
|
1572
|
+
if (y.startsWith("version")) d = y.split(" ")[1] ?? "";
|
|
1573
|
+
else if (y.startsWith("element vertex")) {
|
|
1574
|
+
let m = y.match(/\d+/);
|
|
1575
|
+
m && (o = parseInt(m[0]));
|
|
1576
|
+
} else if (y.startsWith("property")) {
|
|
1577
|
+
let m = y.match(/(\w+)\s+(\w+)\s+(\w+)/);
|
|
1578
|
+
if (m) {
|
|
1579
|
+
let _ = m[2], b = m[3];
|
|
1580
|
+
l[_] = { compressionMethod: b, index: u }, u++;
|
|
1581
|
+
}
|
|
1582
|
+
} else if (y.startsWith("element chunks")) {
|
|
1583
|
+
let m = y.match(/\d+/);
|
|
1584
|
+
m && (r = parseInt(m[0]));
|
|
1585
|
+
} else if (y.startsWith("element chunkSize")) {
|
|
1586
|
+
let m = y.match(/\d+/);
|
|
1587
|
+
m && (h = parseInt(m[0]));
|
|
1588
|
+
} else if (y.startsWith("element typeChunks")) {
|
|
1589
|
+
let m = y.match(/(\w+)\s+(\w+)\s+(\w+)/);
|
|
1590
|
+
m && (f = m[3]);
|
|
1591
|
+
} else if (y === "end_header") break;
|
|
1592
|
+
}
|
|
1593
|
+
let c = n.indexOf("end_header") + 10 + 1, p = new DataView(t, c);
|
|
1594
|
+
return { splatCount: o, chunkCount: r, chunkSize: h, typeChunks: f, vertexData: p, propertiesDesc: l, version: d };
|
|
1595
|
+
}
|
|
1596
|
+
pruneSplats(t) {
|
|
1597
|
+
let a = this.decodeBuffer().pruneSplats(t);
|
|
1598
|
+
return At.fromCompressedGaussianSplats(a, this.version);
|
|
1599
|
+
}
|
|
1600
|
+
static fromCompressedGaussianSplats(t, a) {
|
|
1601
|
+
let s = t.xyz.length, n = t.xyz.nchunks, i = `gspline
|
|
1602
|
+
version ${a}
|
|
1603
|
+
element vertex ${s}
|
|
1604
|
+
element chunks ${n}
|
|
1605
|
+
element chunkSize ${t.chunkSize}
|
|
1606
|
+
element typeChunks ${t.isDynamicChunks ? "dynamic" : "static"}
|
|
1607
|
+
property xyz ${t.xyz.method}
|
|
1608
|
+
property color ${t.color.method}
|
|
1609
|
+
property opacity ${t.opacity.method}
|
|
1610
|
+
property scaling ${t.scaling.method}
|
|
1611
|
+
property quaternion ${t.quaternion.method}`;
|
|
1612
|
+
if (t.harmonics && t.harmonics.length > 0) for (let A = 0; A < t.harmonics.length; A++) i = `${i}
|
|
1613
|
+
property harmonics_${A} ${t.harmonics[A].method}`;
|
|
1614
|
+
i = `${i}
|
|
1615
|
+
end_header
|
|
1616
|
+
`;
|
|
1617
|
+
let e = new TextEncoder().encode(i), o = n * 2 * 4, r = t.xyz.quantized.data.buffer.byteLength, h = t.xyz instanceof L ? o : 0, u = t.color.quantized.data.buffer.byteLength, f = t.color instanceof L ? o : 0, d = t.opacity.quantized.data.buffer.byteLength, l = t.opacity instanceof L ? o : 0, c = t.scaling.quantized.data.buffer.byteLength, p = t.scaling instanceof L ? o : 0, g = t.quaternion.quantized.data.buffer.byteLength, y = t.quaternion instanceof L ? o : 0, m = t.variableChunkSize ? Uint16Array.from(t.variableChunkSize) : void 0, _ = m ? m.byteLength : 0, b = e.byteLength + _ + r + h + u + f + d + l + c + p + g + y, M = 0, x = 0;
|
|
1618
|
+
if (t.harmonics && t.harmonics.length > 0) for (let A = 0; A < t.harmonics.length; A++) M += t.harmonics[A].quantized.data.buffer.byteLength, x += t.harmonics[A] instanceof L ? o : 0;
|
|
1619
|
+
M = 0, x = 0, b += M + x;
|
|
1620
|
+
let w = new Uint8Array(b), v = 0;
|
|
1621
|
+
if (w.set(e, v), v += e.byteLength, _ > 0 && (w.set(new Uint8Array(m.buffer), v), v += _), t.xyz instanceof L && (w.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(t.xyz.quantized.data.buffer), v), v += r, t.color instanceof L && (w.set(new Uint8Array(t.color.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(t.color.quantized.data.buffer), v), v += u, t.opacity instanceof L && (w.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(t.opacity.quantized.data.buffer), v), v += d, t.scaling instanceof L && (w.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(t.scaling.quantized.data.buffer), v), v += c, t.quaternion instanceof L && (w.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(t.quaternion.quantized.data.buffer), v), v += g, M > 0 && t.harmonics && t.harmonics.length > 0) for (let A = 0; A < t.harmonics.length; A++) {
|
|
1622
|
+
let S = t.harmonics[A];
|
|
1623
|
+
S instanceof L && (w.set(new Uint8Array(S.minmaxMatrix.data.buffer), v), v += o), w.set(new Uint8Array(S.quantized.data.buffer), v), v += S.quantized.data.byteLength;
|
|
1624
|
+
}
|
|
1625
|
+
return new At(w.buffer);
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
export {
|
|
1629
|
+
lt as CompressedGaussianSplats,
|
|
1630
|
+
At as GSplineBuffer,
|
|
1631
|
+
Y as GaussianPLYData
|
|
1632
|
+
};
|