@mediapipe/tasks-decision 1.2.1-rc.20261102 → 1.2.2-rc.20261103

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/NOTICE CHANGED
@@ -9922,6 +9922,252 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9922
9922
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9923
9923
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9924
9924
 
9925
+ =================
9926
+ highway
9927
+ This project is dual-licensed under your choice of either the Apache
9928
+ License 2.0 or the BSD 3-Clause License.
9929
+
9930
+ The full texts of all applicable licenses are included below, separated by
9931
+ '---'.
9932
+
9933
+ --------------------------------------------------------------------------------
9934
+ Apache License 2.0
9935
+ --------------------------------------------------------------------------------
9936
+
9937
+ Apache License
9938
+ Version 2.0, January 2004
9939
+ http://www.apache.org/licenses/
9940
+
9941
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9942
+
9943
+ 1. Definitions.
9944
+
9945
+ "License" shall mean the terms and conditions for use, reproduction,
9946
+ and distribution as defined by Sections 1 through 9 of this document.
9947
+
9948
+ "Licensor" shall mean the copyright owner or entity authorized by
9949
+ the copyright owner that is granting the License.
9950
+
9951
+ "Legal Entity" shall mean the union of the acting entity and all
9952
+ other entities that control, are controlled by, or are under common
9953
+ control with that entity. For the purposes of this definition,
9954
+ "control" means (i) the power, direct or indirect, to cause the
9955
+ direction or management of such entity, whether by contract or
9956
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
9957
+ outstanding shares, or (iii) beneficial ownership of such entity.
9958
+
9959
+ "You" (or "Your") shall mean an individual or Legal Entity
9960
+ exercising permissions granted by this License.
9961
+
9962
+ "Source" form shall mean the preferred form for making modifications,
9963
+ including but not limited to software source code, documentation
9964
+ source, and configuration files.
9965
+
9966
+ "Object" form shall mean any form resulting from mechanical
9967
+ transformation or translation of a Source form, including but
9968
+ not limited to compiled object code, generated documentation,
9969
+ and conversions to other media types.
9970
+
9971
+ "Work" shall mean the work of authorship, whether in Source or
9972
+ Object form, made available under the License, as indicated by a
9973
+ copyright notice that is included in or attached to the work
9974
+ (an example is provided in the Appendix below).
9975
+
9976
+ "Derivative Works" shall mean any work, whether in Source or Object
9977
+ form, that is based on (or derived from) the Work and for which the
9978
+ editorial revisions, annotations, elaborations, or other modifications
9979
+ represent, as a whole, an original work of authorship. For the purposes
9980
+ of this License, Derivative Works shall not include works that remain
9981
+ separable from, or merely link (or bind by name) to the interfaces of,
9982
+ the Work and Derivative Works thereof.
9983
+
9984
+ "Contribution" shall mean any work of authorship, including
9985
+ the original version of the Work and any modifications or additions
9986
+ to that Work or Derivative Works thereof, that is intentionally
9987
+ submitted to Licensor for inclusion in the Work by the copyright owner
9988
+ or by an individual or Legal Entity authorized to submit on behalf of
9989
+ the copyright owner. For the purposes of this definition, "submitted"
9990
+ means any form of electronic, verbal, or written communication sent
9991
+ to the Licensor or its representatives, including but not limited to
9992
+ communication on electronic mailing lists, source code control systems,
9993
+ and issue tracking systems that are managed by, or on behalf of, the
9994
+ Licensor for the purpose of discussing and improving the Work, but
9995
+ excluding communication that is conspicuously marked or otherwise
9996
+ designated in writing by the copyright owner as "Not a Contribution."
9997
+
9998
+ "Contributor" shall mean Licensor and any individual or Legal Entity
9999
+ on behalf of whom a Contribution has been received by Licensor and
10000
+ subsequently incorporated within the Work.
10001
+
10002
+ 2. Grant of Copyright License. Subject to the terms and conditions of
10003
+ this License, each Contributor hereby grants to You a perpetual,
10004
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
10005
+ copyright license to reproduce, prepare Derivative Works of,
10006
+ publicly display, publicly perform, sublicense, and distribute the
10007
+ Work and such Derivative Works in Source or Object form.
10008
+
10009
+ 3. Grant of Patent License. Subject to the terms and conditions of
10010
+ this License, each Contributor hereby grants to You a perpetual,
10011
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
10012
+ (except as stated in this section) patent license to make, have made,
10013
+ use, offer to sell, sell, import, and otherwise transfer the Work,
10014
+ where such license applies only to those patent claims licensable
10015
+ by such Contributor that are necessarily infringed by their
10016
+ Contribution(s) alone or by combination of their Contribution(s)
10017
+ with the Work to which such Contribution(s) was submitted. If You
10018
+ institute patent litigation against any entity (including a
10019
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
10020
+ or a Contribution incorporated within the Work constitutes direct
10021
+ or contributory patent infringement, then any patent licenses
10022
+ granted to You under this License for that Work shall terminate
10023
+ as of the date such litigation is filed.
10024
+
10025
+ 4. Redistribution. You may reproduce and distribute copies of the
10026
+ Work or Derivative Works thereof in any medium, with or without
10027
+ modifications, and in Source or Object form, provided that You
10028
+ meet the following conditions:
10029
+
10030
+ (a) You must give any other recipients of the Work or
10031
+ Derivative Works a copy of this License; and
10032
+
10033
+ (b) You must cause any modified files to carry prominent notices
10034
+ stating that You changed the files; and
10035
+
10036
+ (c) You must retain, in the Source form of any Derivative Works
10037
+ that You distribute, all copyright, patent, trademark, and
10038
+ attribution notices from the Source form of the Work,
10039
+ excluding those notices that do not pertain to any part of
10040
+ the Derivative Works; and
10041
+
10042
+ (d) If the Work includes a "NOTICE" text file as part of its
10043
+ distribution, then any Derivative Works that You distribute must
10044
+ include a readable copy of the attribution notices contained
10045
+ within such NOTICE file, excluding those notices that do not
10046
+ pertain to any part of the Derivative Works, in at least one
10047
+ of the following places: within a NOTICE text file distributed
10048
+ as part of the Derivative Works; within the Source form or
10049
+ documentation, if provided along with the Derivative Works; or,
10050
+ within a display generated by the Derivative Works, if and
10051
+ wherever such third-party notices normally appear. The contents
10052
+ of the NOTICE file are for informational purposes only and
10053
+ do not modify the License. You may add Your own attribution
10054
+ notices within Derivative Works that You distribute, alongside
10055
+ or as an addendum to the NOTICE text from the Work, provided
10056
+ that such additional attribution notices cannot be construed
10057
+ as modifying the License.
10058
+
10059
+ You may add Your own copyright statement to Your modifications and
10060
+ may provide additional or different license terms and conditions
10061
+ for use, reproduction, or distribution of Your modifications, or
10062
+ for any such Derivative Works as a whole, provided Your use,
10063
+ reproduction, and distribution of the Work otherwise complies with
10064
+ the conditions stated in this License.
10065
+
10066
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
10067
+ any Contribution intentionally submitted for inclusion in the Work
10068
+ by You to the Licensor shall be under the terms and conditions of
10069
+ this License, without any additional terms or conditions.
10070
+ Notwithstanding the above, nothing herein shall supersede or modify
10071
+ the terms of any separate license agreement you may have executed
10072
+ with Licensor regarding such Contributions.
10073
+
10074
+ 6. Trademarks. This License does not grant permission to use the trade
10075
+ names, trademarks, service marks, or product names of the Licensor,
10076
+ except as required for reasonable and customary use in describing the
10077
+ origin of the Work and reproducing the content of the NOTICE file.
10078
+
10079
+ 7. Disclaimer of Warranty. Unless required by applicable law or
10080
+ agreed to in writing, Licensor provides the Work (and each
10081
+ Contributor provides its Contributions) on an "AS IS" BASIS,
10082
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10083
+ implied, including, without limitation, any warranties or conditions
10084
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
10085
+ PARTICULAR PURPOSE. You are solely responsible for determining the
10086
+ appropriateness of using or redistributing the Work and assume any
10087
+ risks associated with Your exercise of permissions under this License.
10088
+
10089
+ 8. Limitation of Liability. In no event and under no legal theory,
10090
+ whether in tort (including negligence), contract, or otherwise,
10091
+ unless required by applicable law (such as deliberate and grossly
10092
+ negligent acts) or agreed to in writing, shall any Contributor be
10093
+ liable to You for damages, including any direct, indirect, special,
10094
+ incidental, or consequential damages of any character arising as a
10095
+ result of this License or out of the use or inability to use the
10096
+ Work (including but not limited to damages for loss of goodwill,
10097
+ work stoppage, computer failure or malfunction, or any and all
10098
+ other commercial damages or losses), even if such Contributor
10099
+ has been advised of the possibility of such damages.
10100
+
10101
+ 9. Accepting Warranty or Additional Liability. While redistributing
10102
+ the Work or Derivative Works thereof, You may choose to offer,
10103
+ and charge a fee for, acceptance of support, warranty, indemnity,
10104
+ or other liability obligations and/or rights consistent with this
10105
+ License. However, in accepting such obligations, You may act only
10106
+ on Your own behalf and on Your sole responsibility, not on behalf
10107
+ of any other Contributor, and only if You agree to indemnify,
10108
+ defend, and hold each Contributor harmless for any liability
10109
+ incurred by, or claims asserted against, such Contributor by reason
10110
+ of your accepting any such warranty or additional liability.
10111
+
10112
+ END OF TERMS AND CONDITIONS
10113
+
10114
+ APPENDIX: How to apply the Apache License to your work.
10115
+
10116
+ To apply the Apache License to your work, attach the following
10117
+ boilerplate notice, with the fields enclosed by brackets "[]"
10118
+ replaced with your own identifying information. (Don't include
10119
+ the brackets!) The text should be enclosed in the appropriate
10120
+ comment syntax for the file format. We also recommend that a
10121
+ file or class name and description of purpose be included on the
10122
+ same "printed page" as the copyright notice for easier
10123
+ identification within third-party archives.
10124
+
10125
+ Copyright [yyyy] [name of copyright owner]
10126
+
10127
+ Licensed under the Apache License, Version 2.0 (the "License");
10128
+ you may not use this file except in compliance with the License.
10129
+ You may obtain a copy of the License at
10130
+
10131
+ http://www.apache.org/licenses/LICENSE-2.0
10132
+
10133
+ Unless required by applicable law or agreed to in writing, software
10134
+ distributed under the License is distributed on an "AS IS" BASIS,
10135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10136
+ See the License for the specific language governing permissions and
10137
+ limitations under the License.
10138
+
10139
+ --------------------------------------------------------------------------------
10140
+ BSD 3-Clause License
10141
+ --------------------------------------------------------------------------------
10142
+
10143
+ Copyright (c) The Highway Project Authors. All rights reserved.
10144
+
10145
+ Redistribution and use in source and binary forms, with or without modification,
10146
+ are permitted provided that the following conditions are met:
10147
+
10148
+ 1. Redistributions of source code must retain the above copyright notice, this
10149
+ list of conditions and the following disclaimer.
10150
+
10151
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10152
+ this list of conditions and the following disclaimer in the documentation
10153
+ and/or other materials provided with the distribution.
10154
+
10155
+ 3. Neither the name of the copyright holder nor the names of its
10156
+ contributors may be used to endorse or promote products derived from
10157
+ this software without specific prior written permission.
10158
+
10159
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
10160
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10161
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
10162
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
10163
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10164
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
10165
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
10166
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
10167
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10168
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10169
+
10170
+
9925
10171
  =================
9926
10172
  ICU4C
9927
10173
  UNICODE LICENSE V3
@@ -1,2 +1,2 @@
1
- "use strict";var t="undefined"!=typeof self?self:{};var e,r="undefined"!=typeof TextEncoder;function n(t){if(r)t=(e||=new TextEncoder).encode(t);else{let e=0,r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var n=t.charCodeAt(i);if(n<128)r[e++]=n;else{if(n<2048)r[e++]=n>>6|192;else{if(n>=55296&&n<=57343){if(n<=56319&&i<t.length){let o=t.charCodeAt(++i);if(o>=56320&&o<=57343){n=1024*(n-55296)+o-56320+65536,r[e++]=n>>18|240,r[e++]=n>>12&63|128,r[e++]=n>>6&63|128,r[e++]=63&n|128;continue}i--}n=65533}r[e++]=n>>12|224,r[e++]=n>>6&63|128}r[e++]=63&n|128}}t=e===r.length?r:r.subarray(0,e)}return t}function i(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var o={},a=null;function s(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return function(t,e){function r(e){for(;n<t.length;){let e=t.charAt(n++),r=a[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}u();for(var n=0;;){let t=r(-1),n=r(0),i=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|n>>4),64!=i&&(e(n<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,function(t){n[i++]=t}),i!==r?n.subarray(0,i):n}function u(){if(!a){a={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=t.concat(e[r].split(""));o[r]=n;for(let t=0;t<n.length;t++){let e=n[t];void 0===a[e]&&(a[e]=t)}}}}var l="undefined"!=typeof Uint8Array,h=!(-1!=i().indexOf("Trident")||-1!=i().indexOf("MSIE"))&&"function"==typeof btoa,c=/[-_.]/g,f={"-":"+",_:"/",".":"="};function d(t){return f[t]||""}function p(t){if(!h)return s(t);t=c.test(t)?t.replace(c,d):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var v,g={},m=class{constructor(t,e){if(y(e),this.i=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function y(t){if(t!==g)throw Error("illegal external caller")}function b(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var w,S,_=void 0;function A(t){return b(t=Error(t),"warning"),t}function B(e,r){if(null!=e){var n=_??={},i=n[e]||0;i>=r||(n[e]=i+1,b(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}t:{for(var T=["CLOSURE_FLAGS"],I=t,x=0;x<T.length;x++)if(null==(I=I[T[x]])){S=null;break t}S=I}var E=S&&S[748402147];function P(){return"function"==typeof BigInt}w=null==E||E;var L="function"==typeof Symbol&&"symbol"==typeof Symbol();function U(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var j,k=U("jas",void 0,!0),O=U(void 0,"1oa"),N=U(void 0,"0ubsb"),F=U(void 0,"0actk"),V=U("m_m","ra",!0),D={ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},M=Object.defineProperties,C=L?k:"ga",G=[];function $(t,e){L||C in t||M(t,D),t[C]|=e}function W(t,e){L||C in t||M(t,D),t[C]=e}function R(t,e){return 2&e&&(t|=2),1|t}W(G,7),j=Object.freeze(G);var z={};function H(t,e){return void 0===e?t.i!==K&&!!(2&t.m[C]):!!(2&e)&&t.i!==K}var K={};function q(t,e){if(null!=t)if("string"==typeof t)t=t?new m(t,g):v||=new m(null,g);else if(!(t instanceof m))if(l&&null!=t&&t instanceof Uint8Array)t=t.length?new m(new Uint8Array(t),g):v||=new m(null,g);else{if(!e)throw Error();t=void 0}return t}function J(t){return t.qa=!0,t}var X=J(t=>"number"==typeof t),Y=J(t=>"string"==typeof t),Z=J(t=>"boolean"==typeof t),Q="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function tt(t){var e=t;if(Y(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(X(e)&&!Number.isSafeInteger(e))throw Error(String(e));return Q?BigInt(t):t=Z(t)?t?"1":"0":Y(t)?t.trim()||"0":String(t)}var et=J(t=>Q?t>=nt&&t<=ot:"-"===t[0]?at(t,rt):at(t,it)),rt=Number.MIN_SAFE_INTEGER.toString(),nt=Q?BigInt(Number.MIN_SAFE_INTEGER):void 0,it=Number.MAX_SAFE_INTEGER.toString(),ot=Q?BigInt(Number.MAX_SAFE_INTEGER):void 0;function at(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n>i)return!1;if(n<i)return!0}}var st,ut=0,lt=0;function ht(t){var e=t>>>0;ut=e,lt=(t-e)/4294967296>>>0}function ct(t){if(t<0){ht(-t);let[e,r]=mt(ut,lt);ut=e>>>0,lt=r>>>0}else ht(t)}function ft(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:dt(t,e)}function dt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else P()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+pt(r)+pt(t));return r}function pt(t){return t=String(t),"0000000".slice(t.length)+t}function vt(){var t=ut,e=lt;if(2147483648&e)if(P())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,n]=mt(t,e);t="-"+dt(r,n)}else t=dt(t,e);return t}function gt(t){if(t.length<16)ct(Number(t));else if(P())t=BigInt(t),ut=Number(t&BigInt(4294967295))>>>0,lt=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);lt=ut=0;let r=t.length;for(let n=e,i=(r-e)%6+e;i<=r;n=i,i+=6){let e=Number(t.slice(n,i));lt*=1e6,(ut=1e6*ut+e)>=4294967296&&(lt+=Math.trunc(ut/4294967296),lt>>>=0,ut>>>=0)}if(e){let[t,e]=mt(ut,lt);ut=t,lt=e}}}function mt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var yt="function"==typeof BigInt?BigInt.asIntN:void 0,bt="function"==typeof BigInt?BigInt.asUintN:void 0,wt=Number.isSafeInteger,St=Number.isFinite,_t=Math.trunc;function At(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}var Bt,Tt,It,xt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Et(t){switch(typeof t){case"bigint":return!0;case"number":return St(t);case"string":return xt.test(t);default:return!1}}function Pt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return St(t)?0|t:void 0}function Lt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(gt(t),vt())}function Ut(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(gt(t),dt(ut,lt))}function jt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(yt(64,t));if(Et(t)){if("string"===e)return e=_t(Number(t)),wt(e)?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Lt(t)),t;if("number"===e)return function(t){if(t=_t(t),!wt(t)){ct(t);var e=ut,r=lt;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=ft(e,r))?t?-e:e:t?"-"+e:e}return t}(t)}}function kt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(bt(64,t));if(Et(t)){if("string"===e)return e=_t(Number(t)),wt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Ut(t)),t;if("number"===e)return function(t){return(t=_t(t))>=0&&wt(t)||(ct(t),t=ft(ut,lt)),t}(t)}}function Ot(t){if(null==t||"string"==typeof t||t instanceof m)return t}function Nt(t){return null==t||"string"==typeof t?t:void 0}function Ft(t,e,r){if(null!=t&&t[V]===z)return t;if(Array.isArray(t)){var n=0|t[C];return(r=n|32&r|2&r)!==n&&W(t,r),new e(t)}}function Vt(t){return t}function Dt(t,e,r,n){var i=void 0!==n;n=!!n;var o=[],a=t.length,s=4294967295,u=!1,l=!!(64&e),h=l?128&e?0:-1:void 0;if(!(1&e)){var c=a&&t[a-1];null!=c&&"object"==typeof c&&c.constructor===Object?s=--a:c=void 0,!l||128&e||i||(u=!0,s=(Bt??Vt)(s-h,h,t,c,void 0)+h)}for(e=void 0,i=0;i<a;i++){let a=t[i];if(null!=a&&null!=(a=r(a,n)))if(l&&i>=s){let t=i-h;(e??={})[t]=a}else o[i]=a}if(c)for(let i in c){if(null==(t=c[i])||null==(t=r(t,n)))continue;let u;a=+i,l&&!Number.isNaN(a)&&(u=a+h)<s?o[u]=t:(e??={})[i]=t}return e&&(u?o.push(e):o[s]=e),o}function Mt(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return et(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[C];return 0===t.length&&1&e?void 0:Dt(t,e,Mt)}if(null!=t&&t[V]===z)return Ct(t);if(t instanceof m){if(null==(e=t.i))t="";else if("string"==typeof e)t=e;else{if(h){for(var r="",n=0,i=e.length-10240;n<i;)r+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?e.subarray(n):e),e=btoa(r)}else{void 0===r&&(r=0),u(),r=o[r],n=Array(Math.floor(e.length/3)),i=r[64]||"";let t=0,h=0;for(;t<e.length-2;t+=3){var a=e[t],s=e[t+1],l=e[t+2],c=r[a>>2];a=r[(3&a)<<4|s>>4],s=r[(15&s)<<2|l>>6],l=r[63&l],n[h++]=c+a+s+l}switch(c=0,l=i,e.length-t){case 2:l=r[(15&(c=e[t+1]))<<2]||i;case 1:e=e[t],n[h]=r[e>>2]+r[(3&e)<<4|c>>4]+l+i}e=n.join("")}t=t.i=e}return t}return}return t}function Ct(t){return Dt(t=t.m,0|t[C],Mt)}function Gt(t,e,r,n=0){if(null==t){var i=32;r?(t=[r],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[C],w&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(w)throw Error("carr");B(F,5)}(),256&i)throw Error("farr");if(64&i)return(i|n)!==i&&W(t,i|n),t;if(r&&(i|=128,r!==t[0]))throw Error("mid");t:{i|=64;var o=(r=t).length;if(o){var a=o-1;let t=r[a];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((a-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var s in t)(o=+s)<a&&(r[o+e]=t[s],delete t[s]);i=-16760833&i|(1023&a)<<14;break t}}if(e){if((s=Math.max(e,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&s)<<14}}}return W(t,64|i|n),t}function $t(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[C];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=Rt(t,r,!1,e&&!(16&r)):($(t,34),4&r&&Object.freeze(t))),t}return null!=t&&t[V]===z?H(t,r=0|(e=t.m)[C])?t:qt(t,e,r)?Wt(t,e):Rt(e,r):t instanceof m?t:void 0}function Wt(t,e,r){return t=new t.constructor(e),r&&(t.i=K),t.o=K,t}function Rt(t,e,r,n){return n??=!!(34&e),t=Dt(t,e,$t,n),n=32,r&&(n|=2),W(t,e=16769217&e|n),t}function zt(t){if(t.i!==K)return!1;var e=t.m;return $(e=Rt(e,0|e[C]),2048),t.m=e,t.i=void 0,t.o=void 0,!0}function Ht(t){if(!zt(t)&&H(t,0|t.m[C]))throw Error()}function Kt(t,e){void 0===e&&(e=0|t[C]),32&e&&!(4096&e)&&W(t,4096|e)}function qt(t,e,r){return!!(2&r)||!(!(32&r)||4096&r)&&(W(e,2|r),t.i=K,!0)}function Jt(t,e,r){if(null!==(t=Xt(t.m,e,void 0,r)))return t}function Xt(t,e,r,n){if(-1===e)return null;var i=e+(r?0:-1),o=t.length-1;if(!(o<1+(r?0:-1))){if(i>=o){var a=t[o];if(null!=a&&"object"==typeof a&&a.constructor===Object){r=a[e];var s=!0}else{if(i!==o)return;r=a}}else r=t[i];if(n&&null!=r){if(null==(n=n(r)))return n;if(!Object.is(n,r))return s?a[e]=n:t[i]=n,n}return r}}function Yt(t,e,r){Ht(t);var n=t.m;return Zt(n,0|n[C],e,r),t}function Zt(t,e,r,n,i){var o=r+(i?0:-1),a=t.length-1;if(a>=1+(i?0:-1)&&o>=a){let i=t[a];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[r]=n,e}return o<=a?(t[o]=n,e):(void 0!==n&&(r>=(a=(e??=0|t[C])>>14&1023||536870912)?null!=n&&(t[a+(i?0:-1)]={[r]:n}):t[o]=n),e)}function Qt(t,e,r){return t=Xt(t,e,r),Array.isArray(t)?t:j}function te(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function ee(t){return q(t,!0)}function re(t){if(L)return t[O]??(t[O]=new Map);if(O in t)return t[O];var e=new Map;return Object.defineProperty(t,O,{value:e}),e}function ne(t,e,r,n){var i=t.get(n);if(null!=i)return i;i=0;for(let t=0;t<n.length;t++){let o=n[t];null!=Xt(e,o)&&(0!==i&&(r=Zt(e,r,i)),i=o)}return t.set(n,i),i}function ie(t,e,r){var n=t.m,i=0|n[C];if(e=function(t,e,r,n){var i=!1;if(null!=(n=Xt(t,n,void 0,t=>{var n=Ft(t,r,e);return i=n!==t&&null!=n,n})))return i&&!H(n)&&Kt(t,e),n}(n,i,e,r),null==e)return e;if(!H(t,i=0|n[C])){var o,a=e;let s=a.m,u=0|s[C];(o=H(a,u)?qt(a,s,u)?Wt(a,s,!0):new a.constructor(Rt(s,u,!1)):a)!==e&&(zt(t)&&(i=0|(n=t.m)[C]),Kt(n,i=Zt(n,i,r,e=o)))}return e}function oe(t){return null==t&&(t=void 0),t}function ae(t,e,r){return Yt(t,e,r=oe(r)),r&&!H(r)&&Kt(t.m),t}function se(t,e,r,n){t:{var i=n=oe(n);Ht(t);let s=t.m;var o=0|s[C];if(null==i){var a=re(s);if(ne(a,s,o,r)!==e)break t;a.set(r,0)}else{let t=re(a=s),n=ne(t,a,o,r);n!==e&&(n&&(o=Zt(a,o,n)),t.set(r,e))}Zt(s,o,e,i)}return n&&!H(n)&&Kt(t.m),t}function ue(t,e){return-273&(2&e?2|t:-3&t)}function le(t,e){var r=pn;Ht(t);var n=t.m,i=n,o=0|n[C],a=(t?H(t,o):2&o)?1:2;2===a&&t&&zt(t)&&(o=0|(i=t.m)[C]);var s=Qt(i,8),u=s===j?7:0|s[C],l=R(u,o);if(t=!(4&l)){var h=o;let t=!!(2&l);t&&(h|=2);let e=!t,n=!0,i=0,a=0;for(;i<s.length;i++){let o=Ft(s[i],r,h);if(o instanceof r){if(!t){let t=H(o);e&&=!t,n&&=t}s[a++]=o}}a<i&&(s.length=a),l|=4,l=n?-4097&l:4096|l,l=e?8|l:-9&l}l!==u&&(W(s,l),2&l&&Object.freeze(s)),l=u=l,(h=te(u))&&2===a&&(s=Array.prototype.slice.call(s),l=0,u=ue(u,o),o=Zt(i,o,8,s),h=!1),h||(1===a||4===a&&(2&u||!(16&u)&&32&o)?((u|=!s.length||t&&!(4096&u)||32&o&&!(4096&u||16&u)?2:256)!==l&&W(s,u),Object.freeze(s)):u!==l&&W(s,u)),2&u||!(4096&u||16&u)||Kt(i,o),a=s,e=null!=e?e:new r,a.push(e),t=r=a===j?7:0|a[C],(e=H(e))?(r&=-9,1===a.length&&(r&=-4097)):r|=4096,r!==t&&W(a,r),e||Kt(n)}function he(t,e,r){return Yt(t,e,null==r?r:function(t){if(!Et(t))throw A("int64");switch(typeof t){case"string":var e=_t(Number(t));return wt(e)?t=tt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=P()?tt(yt(64,BigInt(t))):tt(Lt(t))),t;case"bigint":return tt(yt(64,t));default:return wt(t)||(t=_t(t),wt(t)?t=String(t):(ct(t),t=vt())),tt(t)}}(r))}function ce(t,e,r){return Yt(t,e,null==r?r:function(t){if(!Et(t))throw A("uint64");switch(typeof t){case"string":var e=_t(Number(t));return wt(e)&&e>=0?t=tt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=P()?tt(bt(64,BigInt(t))):tt(Ut(t))),t;case"bigint":return tt(bt(64,t));default:return t>=0&&wt(t)||((t=_t(t))>=0&&wt(t)?t=String(t):(ct(t),t=dt(ut,lt))),tt(t)}}(r))}function fe(t,e,r){if(null!=r&&"string"!=typeof r)throw Error();return Yt(t,e,r)}function de(t,e,r){if(null!=r){if(!St(r))throw A("enum");r|=0}return Yt(t,e,r)}var pe=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error()}};function ve(t){if("string"==typeof t)return new pe(p(t),!0);if(Array.isArray(t))return new pe(new Uint8Array(t),!0);if(t.constructor===Uint8Array)return new pe(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new pe(t,!1);if(t.constructor===m){y(g);var e=t.i;return e=(null==(e=null==e||l&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?p(e):null)?e:t.i=e)||new Uint8Array(0),new pe(e,!0,t)}if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new pe(t,!1);throw Error()}function ge(t){return new be(4294967295&t,Math.floor(t/4294967296))}function me(t){return t?/^\d+$/.test(t)?(gt(t),new be(ut,lt)):null:ye||=new be(0,0)}var ye,be=class{constructor(t,e){this.j=t>>>0,this.i=e>>>0}};function we(t){return new Le(4294967295&t,Math.floor(t/4294967296))}function Se(t){return t?/^-?\d+$/.test(t)?(gt(t),new Le(ut,lt)):null:_e||=new Le(0,0)}var _e,Ae,Be,Te,Ie,xe,Ee,Pe,Le=class{constructor(t,e){this.j=t>>>0,this.i=e>>>0}};function Ue(t,e,r){return"undefined"!=typeof BigInt64Array?(Ee||(Ee=new BigInt64Array(1),Pe=new Uint32Array(Ee.buffer),Ee[0]=BigInt(1),xe=1===Pe[0]),Ee[0]=t,new e(Pe[t=xe?0:1],Pe[1-t])):(Ie||(Ae=BigInt(Number.MIN_SAFE_INTEGER),Be=BigInt(Number.MAX_SAFE_INTEGER),Te=BigInt(4294967295),Ie=BigInt(32)),t>=Ae&&t<=Be?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&Te),Number(t>>Ie))))}function je(t,e,r){for(;r>0||e>127;)t.i.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.i.push(e)}function ke(t,e){for(;e>127;)t.i.push(127&e|128),e>>>=7;t.i.push(e)}function Oe(t,e){if(e>=0)ke(t,e);else{for(let r=0;r<9;r++)t.i.push(127&e|128),e>>=7;t.i.push(1)}}function Ne(t,e){gt(e),function(t){var e=lt>>31;t(ut<<1^e,(lt<<1|ut>>>31)^e)}((e,r)=>{je(t,e>>>0,r>>>0)})}function Fe(t,e){t.i.push(e>>>0&255),t.i.push(e>>>8&255),t.i.push(e>>>16&255),t.i.push(e>>>24&255)}var Ve=class{constructor(){this.i=[]}length(){return this.i.length}end(){var t=this.i;return this.i=[],t}};function De(t,e){0!==e.length&&(t.l.push(e),t.j+=e.length)}function Me(t,e,r){ke(t.i,8*e+r)}function Ce(t,e){return Me(t,e,2),e=t.i.end(),De(t,e),e.push(t.j),e}function Ge(t,e){var r=e.pop();for(r=t.j+t.i.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.j++;e.push(r),t.j++}function $e(t,e,r){if(null!=r)switch(Me(t,e,0),typeof r){case"number":t=t.i,ct(r),je(t,ut,lt);break;case"bigint":r=Ue(r,Le,we),je(t.i,r.j,r.i);break;default:r=Se(r),je(t.i,r.j,r.i)}}function We(t,e,r){Me(t,e,2),ke(t.i,r.length),De(t,t.i.end()),De(t,r)}var Re=class{constructor(){this.l=[],this.j=0,this.i=new Ve}};function ze(t){if("string"==typeof t)Se(t)}function He(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Ke=He(),qe=He(),Je=He(),Xe=He(),Ye=He(),Ze=He(),Qe=He(),tr=He(),er=He(),rr=He(),nr=He(),ir=He(),or=class{constructor(t,e){this.m=Gt(t,e,void 0,2048)}toJSON(){return Ct(this)}};or.prototype[V]=z,or.prototype.toString=function(){return this.m.toString()};var ar=class{constructor(t,e){this.i=t,t=Ke,this.j=!!t&&e===t||!1}};function sr(t,e,r,n,i){null!=(e=vr(e,n))&&(r=Ce(t,r),i(e,t),Ge(t,r))}var ur,lr,hr=new ar(sr,Ke),cr=new ar(sr,Ke),fr=Symbol(),dr=Symbol();function pr(t){var e=gr,r=mr,n=t[fr];if(n)return n;(n={}).oa=t,n.aa=function(t){switch(typeof t){case"boolean":return Tt||=[0,void 0,!0];case"number":return t>0?void 0:0===t?It||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(t[0]);var i=t[1],o=1;i&&i.constructor===Object&&(n.ea=i,"function"==typeof(i=t[++o])&&(n.ha=!0,ur??=i,lr??=t[o+1],i=t[o+=2]));for(var a={};i&&Array.isArray(i)&&i.length&&"number"==typeof i[0]&&i[0]>0;){for(var s=0;s<i.length;s++)a[i[s]]=i;i=t[++o]}for(s=1;void 0!==i;){let h;"number"==typeof i&&(s+=i,i=t[++o]);var u=void 0;if(i instanceof ar?h=i:(h=hr,o--),h?.j){i=t[++o],u=t;var l=o;"function"==typeof i&&(i=i(),u[l]=i),u=i}for(l=s+1,"number"==typeof(i=t[++o])&&i<0&&(l-=i,i=t[++o]);s<l;s++){let t=a[s];u?r(n,s,h,u,t):e(n,s,h,t)}}return t[fr]=n}function vr(t,e){return t instanceof or?t.m:Array.isArray(t)?Gt(t,e[0],e[1]):void 0}function gr(t,e,r){t[e]=r.i}function mr(t,e,r,n){var i,o,a=r.i;t[e]=(t,e,r)=>a(t,e,r,o||=pr(n).aa,i||=yr(n))}function yr(t){var e=t[dr];if(!e){let r=pr(t);e=(t,e)=>br(t,e,r),t[dr]=e}return e}function br(t,e,r){!function(t,e,r){var n,i=128&e?0:-1,o=t.length;(n=!!o)&&(n=null!=(n=t[o-1])&&"object"==typeof n&&n.constructor===Object);var a=o+(n?-1:0);for(e=128&e?1:0;e<a;e++)r(e-i,t[e]);if(n){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}(t,0|t[C],(t,n)=>{if(null!=n){var i=function(t,e){var r=t[e];if(r)return r;if((r=t.ea)&&(r=r[e])){var n=(r=Array.isArray(r)?r[0]instanceof ar?r:[cr,r]:[r,void 0])[0].i;if(r=r[1]){let e=yr(r),i=pr(r).aa;r=t.ha?lr(i,e):(t,r,o)=>n(t,r,o,i,e)}else r=n;return t[e]=r}}(r,t);i?i(e,n,t):t<500||B(N,3)}})}function wr(t,e,r){if(Array.isArray(e)){var n=0|e[C];if(4&n)return e;for(var i=0,o=0;i<e.length;i++){let r=t(e[i]);null!=r&&(e[o++]=r)}return o<i&&(e.length=o),t=1|n,r&&(t=-1537&t|4),t!==n&&W(e,t),r&&2&t&&Object.freeze(e),e}}var Sr=(t,e)=>{var r=new Re;br(t.m,r,pr(e)),De(r,r.i.end()),t=new Uint8Array(r.j);var n=(e=r.l).length,i=0;for(let r=0;r<n;r++){let n=e[r];t.set(n,i),i+=n.length}return r.l=[t],t};function _r(t,e){return new ar(t,e)}function Ar(t,e){return new ar(t,e)}function Br(t,e,r){null!=(e=jt(e))&&(ze(e),$e(t,r,e))}function Tr(t,e,r){null!=(e=Pt(e))&&null!=e&&(Me(t,r,0),Oe(t.i,e))}function Ir(t,e,r){null!=(e=Nt(e))&&We(t,r,n(e))}function xr(t,e,r,n,i){null!=(e=vr(e,n))&&(r=Ce(t,r),i(e,t),Ge(t,r))}function Er(t,e,r){null!=(e=Ot(e))&&We(t,r,ve(e).buffer)}function Pr(t,e,r){null!=(e=Pt(e))&&(e=parseInt(e,10),Me(t,r,0),Oe(t.i,e))}var Lr,Ur=_r(function(t,e,r){null!=(e=At(e))&&(Me(t,r,1),t=t.i,(r=st||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),ut=r.getUint32(0,!0),lt=r.getUint32(4,!0),Fe(t,ut),Fe(t,lt))},rr),jr=_r(function(t,e,r){null!=(e=At(e))&&(Me(t,r,5),t=t.i,(r=st||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),lt=0,Fe(t,ut=r.getUint32(0,!0)))},er),kr=_r(Br,Ze),Or=_r(Br,Ze),Nr=Ar(function(t,e,r){if(null!=(e=wr(jt,e,!1)))for(let n=0;n<e.length;n++)$e(t,r,e[n])},Ze),Fr=_r(function(t,e,r){if(null!=(e=kt(e))){if("string"==typeof e)me(e);if(null!=e)switch(Me(t,r,0),typeof e){case"number":t=t.i,ct(e),je(t,ut,lt);break;case"bigint":r=Ue(e,be,ge),je(t.i,r.j,r.i);break;default:r=me(e),je(t.i,r.j,r.i)}}},Qe),Vr=_r(Tr,Xe),Dr=Ar(function(t,e,r){if(null!=(e=wr(Pt,e,!0)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&(Me(n,i,0),Oe(n.i,o))}},Xe),Mr=Ar(function(t,e,r){if(null!=(e=wr(Pt,e,!0))&&e.length){r=Ce(t,r);for(let r=0;r<e.length;r++)Oe(t.i,e[r]);Ge(t,r)}},Xe),Cr=_r(function(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Me(t,r,0),t.i.i.push(e?1:0))},qe),Gr=_r(Ir,Je),$r=Ar(function(t,e,r){if(null!=(e=wr(Nt,e,!0)))for(let s=0;s<e.length;s++){var i=t,o=r,a=e[s];null!=a&&We(i,o,n(a))}},Je),Wr=function(t,e,r=Ke){return new ar(e,r)}(0,function(t,e,r,n,i){if(Array.isArray(e)){for(let o=0;o<e.length;o++)xr(t,e[o],r,n,i);1&(t=0|e[C])||W(e,1|t)}}),Rr=new ar(xr,Ke),zr=_r(Er,nr),Hr=Ar(function(t,e,r){if(null!=(e=wr(Ot,e,!1)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&We(n,i,ve(o).buffer)}},nr),Kr=_r(function(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return St(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(Me(t,r,0),ke(t.i,e))},Ye),qr=_r(Pr,ir),Jr=_r(Pr,ir),Xr=_r(function(t,e,r){if(null!=(e=jt(e))&&(ze(e),null!=e))switch(Me(t,r,0),typeof e){case"number":t=t.i,e=(r=e)<0,ht(r=2*Math.abs(r)),r=ut;let n=lt;e&&(0==r?0==n?n=r=4294967295:(n--,r=4294967295):r--),je(t,ut=r,lt=n);break;case"bigint":t=t.i,e=e<<BigInt(1)^e>>BigInt(63),ut=Number(BigInt.asUintN(32,e)),lt=Number(BigInt.asUintN(32,e>>BigInt(32))),je(t,ut,lt);break;default:Ne(t.i,e)}},tr),Yr=[0,zr,Hr,Cr,Gr],Zr=[0,_r(Ir,Je),[0,Jr,[0,_r(Br,Ze),_r(Tr,Xe)],Jr,-1,[0,qr],Jr,-1],_r(Er,nr)],Qr=[0,1,[0,12,Vr,10,Cr],[0,7,[0,Vr,-1]]],tn=globalThis.trustedTypes;var en=class{constructor(t){this.i=t}toString(){return this.i+""}};function rn(t){var e;return void 0===Lr&&(Lr=function(){var t=null;if(!tn)return t;try{let e=t=>t;t=tn.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Lr)?e.createScriptURL(t):t,new en(t)}function nn(t,...e){if(0===e.length)return rn(t[0]);var r=t[0];for(let n=0;n<e.length;n++)r+=encodeURIComponent(e[n])+t[n+1];return rn(r)}var on=class extends or{constructor(t){super(t)}},an=class extends or{constructor(t){super(t)}},sn=class extends or{constructor(t){super(t)}},un=[1,2,3,4,5,6],ln=class extends or{constructor(t){super(t)}j(){return null!=Jt(this,1,ee)}l(){return null!=Nt(Jt(this,2))}},hn=class extends or{constructor(t){super(t)}};function cn(t,e,r){return r=`wasm${r?"_module":""}_internal`,Promise.resolve({wasmLoaderPath:`${e}/${t}_${r}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`})}var fn=class{};function dn(t){return de(new pn,1,t)}fn.forVisionTasks=function(t,e=!1){return cn("vision",t??nn``,e)},fn.forLiteRtLmTextTasks=function(t,e=!1){return cn("litertlm_text",t??nn``,e)},fn.forTextTasks=function(t,e=!1){return cn("text",t??nn``,e)},fn.forRetrievalTasks=function(t,e=!1){return cn("retrieval",t??nn``,e)},fn.forGenAiTasks=function(t,e=!1){return cn("genai",t??nn``,e)},fn.forDecisionTasks=function(t,e=!1){return cn("decision",t??nn``,e)},fn.forAudioTasks=function(t,e=!1){return cn("audio",t??nn``,e)};var pn=class extends or{constructor(t){super(t)}},vn=class extends or{constructor(t){super(t)}},gn=[0,qr,2,Fr,-2,Or,Wr,[0,qr,Or]],mn=class extends or{constructor(t){super(t)}},yn=class extends or{constructor(t){super(t)}};function bn(t){var e=new Sn;return e=de(e,1,30),de(e,2,t)}var wn,Sn=class extends or{constructor(t){super(t)}},_n=[3,4,5,6,7],An=class extends or{constructor(t){super(t)}},Bn=class extends or{constructor(t){super(t)}};Bn.prototype.j=(wn=[0,[0,qr,Gr,-3,qr],[0,_n,qr,-1,Rr,[0,qr,Gr,Fr],Rr,gn,Rr,[0,1,gn],Rr,[0,qr],Rr,[0,qr,Gr,Fr]]],function(){return Sr(this,wn)});var Tn=class{constructor(){this.i="undefined"!=typeof AbortController}async send(t,e,r){var n=this.i?new AbortController:void 0,i=n&&t.V>0?setTimeout(()=>{n.abort()},t.V):void 0;try{let i=await fetch(t.url,{method:t.na,headers:{...t.ma},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.V&&n?n.signal:null});200===i.status?e?.(await i.text()):r?.(i.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400)}finally{clearTimeout(i)}}},In=class extends or{constructor(t){super(t,37)}},xn=[-4,{},Qr,qr,Zr],En=[0,Gr,qr,1,Gr,-1,qr,1,qr,1,Or],Pn=[0,qr,Gr,-2],Ln=[0,Gr,qr],Un=[0,Gr,qr],jn=[0,Cr,-3],kn=[0,qr,Gr,-1,Or,Vr,-1,Gr,-5,Wr,[0,Gr,-4],-1,Cr,[0,Cr,-3],qr];var On=class extends or{constructor(t){super(t,19)}},Nn=function(t){return e=>Sr(e,t)}([-19,{},[0,qr,1,[0,Gr,-6,Or,Vr,Gr,-1,Or],1,[0,Gr,1,Gr,-5],Gr,-1,[0,qr,Gr,-8],[0,Gr,-3],[0,Gr,qr,Gr,-2],[0,Gr,-1,qr,Gr,-1,qr,Gr,-1,[0,Wr,[0,Gr,-1],Cr,Gr,-5],[0,qr,Cr,Vr,-2]],Or,[0,Gr,-3,Or,Vr,Gr,-1],[0,qr,Gr,-1],[0,Gr,-9],[0,Gr,-6,qr,Gr,1,Gr,Cr,qr,-1,Cr,Gr,-2,qr,Gr,qr,Gr,Vr,-1],1,[0,qr],1,[0,Gr,-4],1,En,[0,[1,2,3,4,5,6],Rr,En,Rr,Ln,Rr,Un,Rr,[0,qr],Rr,kn,Rr,Pn],Ln,Un,kn,[0,[0,qr,Gr,-1,Or,Vr,-1,Gr,-4,Wr,[0,Gr,-4],-1,1,jn],[0,qr,Gr,-1,Or,Vr,-1,Gr,-4,jn]],Pn,[0,Gr,[0,Vr,-3,qr],qr,-2,[0,Vr,-1],Cr],4,[0,Gr,qr,Gr,-1,Or,qr,Gr,-1,qr,Vr,-1]],qr,Wr,[-37,{},kr,Gr,Wr,[0,Gr,-1],zr,1,zr,[0,$r,-1,Dr,Nr,-1],Gr,[0,Vr,Gr,-1],Cr,Vr,Or,Gr,-1,Xr,Yr,kr,zr,qr,Dr,Or,-1,[0,qr,-1],Gr,Cr,Gr,Mr,Gr,-1,Ur,1,Ur,xn,Cr,[0,qr,[0,jr,Vr,-2],[0,jr]],[0,qr,Or]],kr,Hr,Gr,-1,kr,qr,-1,[0,Cr,-1,qr,Cr],[0,Or,-1,Gr],[0,kr,Cr,Or],Or,1,Kr,1,xn]),Fn=class{constructor(t){this.j=[],this.o=new Tn,this.l=t??"",this.i=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.i&&(clearInterval(this.i),this.i=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.j.length)t?.();else{var r=this.j;this.j=[],r=function(t){var e=new On;Ht(e=de(e,2,1786));var r=e.m,n=0|r[C];if(null==t)Zt(r,n,3);else{var i=t===j?7:0|t[C],o=i,a=te(i),s=a||Object.isFrozen(t),u=!0,l=!0;for(let e=0;e<t.length;e++){var h=t[e];a||(h=H(h),u&&=!h,l&&=h)}a||(i=u?13:5,i=l?-4097&i:4096|i),s&&i===o||(t=Array.prototype.slice.call(t),o=0,i=ue(i,n)),i!==o&&W(t,i),n=Zt(r,n,3,t),2&i||!(4096&i||16&i)||Kt(r,n)}return e}(r),r=Nn(r),this.o.send({url:"https://odml.pa.googleapis.com/v1/log",na:"POST",V:1e4,body:r,pa:2,ma:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.l},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.j=[],void 0!==this.i&&(clearInterval(this.i),this.i=void 0),e?.("net-send-failed",t)})}}};class Vn{constructor(){this.M=this.D=this.I=this.B=this.G=this.H=this.F=0}}function Dn(t,e){var r=new Bn;r=ae(r,1,t.L),r=ae(r,2,e),e=Yt(e=new In,6,q(r=r.j(),!1)),(t=t.C).error||t.j.push(e)}function Mn(t,e){var r={F:e.F-t.l.F,H:e.H-t.l.H,G:e.G-t.l.G,B:e.B-t.l.B,I:e.I-t.l.I,D:e.D,M:e.M},n=bn(1);r=Cn(t,r),Dn(t,n=se(n,4,_n,r)),t.l=e}function Cn(t,e){var r=new vn;return t=ce(t=he(t=de(r,1,t.J),7,e.B),5,e.D),t=ce(t,6,e.M),e.G>0&&ce(t,4,e.I/e.G),0!==e.F&&le(t,r=he(r=dn(3),2,e.F)),0!==e.H&&le(t,e=he(r=dn(4),2,e.H)),t}var Gn=class{constructor(t,e){this.K=performance.now(),this.o=performance.now(),this.j=new Map,this.A=0,this.i=new Vn,this.l=new Vn,this.C=new Fn(e),this.J=function(t){switch(t){case"IMAGE":return 11;case"VIDEO":return 12;case"LIVE_STREAM":return 13;case"AUDIO_CLIPS":return 14;case"AUDIO_STREAM":return 15;default:return 10}}(t),t=new An,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=fe(t=de(t,1,e),2,""),t=fe(t,3,""),t=fe(t,4,"1.2.1"),t=fe(t,5,""),this.L=de(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}Z(){var t=new yn;t=ce(t=de(t,1,this.J),3,performance.now()-this.K),Dn(this,t=se(bn(0),3,_n,t)),this.o=performance.now()}S(t){var e=this.j.get(t);if(void 0!==e&&(this.j.delete(t),t=performance.now()-e,++this.i.G,this.i.I+=t,this.i.D=Math.max(this.i.D,t),this.A=Math.max(this.A,t),performance.now()>this.o+3e4)){for(let[r,n]of this.j.entries())t=r,n<e&&(this.i.B++,this.j.delete(t));e={...this.i,M:performance.now()-this.o},this.i.D=0,this.o=performance.now(),Mn(this,e)}}ia(){var t={...this.i,B:this.i.B+this.j.size,D:this.A,M:performance.now()-this.K};Mn(this,t);var e=new mn;e=ae(e,2,t=Cn(this,t)),Dn(this,e=se(t=bn(2),5,_n,e))}close(){var t=this.C;"function"==typeof t.close?t.close():t.flush()}};function $n(){var t=navigator;return"undefined"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Wn(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}function Rn(t,e,r){t.o||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(e=t.h.stringToNewUTF8(e)),t.h._free(e)}function zn(t,e,r){t.o||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");var n=new Uint32Array(e.length);for(let r=0;r<e.length;r++)n[r]=t.h.stringToNewUTF8(e[r]);e=t.h._malloc(4*n.length),t.h.HEAPU32.set(n,e>>2),r(e);for(let e of n)t.h._free(e);t.h._free(e)}function Hn(t,e,r){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=r}function Kn(t,e,r){var n=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(r(n,i),n=[]):n.push(t)}}var qn=function(t){return class extends t{get W(){return this.h}fa(){if("function"==typeof this.W._mediapipeLoggerGetEncodedApiKey){let t=this.W._mediapipeLoggerGetEncodedApiKey();return this.W._decodeBase64(t)}}}}(function(t){return class extends t{la(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.l=!0,this.h=t,this.i=null,this.j=0,this.o="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:$n()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){var e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){var r=t.length,n=this.h._malloc(r);this.h.HEAPU8.set(t,n),e?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(t,e,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Rn(this,n||"input_audio",n=>{Rn(this,i=i||"audio_header",i=>{this.h._configureAudio(n,i,t,e??0,r)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,r){this.addAudioToStreamWithShape(t,0,0,e,r)}addAudioToStreamWithShape(t,e,r,n,i){var o=4*t.length;this.j!==o&&(this.i&&this.h._free(this.i),this.i=this.h._malloc(o),this.j=o),this.h.HEAPF32.set(t,this.i/4),Rn(this,n,t=>{this.h._addAudioToInputStream(this.i,e,r,t,i)})}addGpuBufferToStream(t,e,r){Rn(this,e,e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();var n=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!n)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);var[i,o]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height];!this.l||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);var[a,s]=[i,o];this.h._addBoundTextureToStream(e,a,s,r)})}addBoolToStream(t,e,r){Rn(this,e,e=>{this.h._addBoolToInputStream(t,e,r)})}addDoubleToStream(t,e,r){Rn(this,e,e=>{this.h._addDoubleToInputStream(t,e,r)})}addFloatToStream(t,e,r){Rn(this,e,e=>{this.h._addFloatToInputStream(t,e,r)})}addIntToStream(t,e,r){Rn(this,e,e=>{this.h._addIntToInputStream(t,e,r)})}addUintToStream(t,e,r){Rn(this,e,e=>{this.h._addUintToInputStream(t,e,r)})}addStringToStream(t,e,r){Rn(this,e,e=>{Rn(this,t,t=>{this.h._addStringToInputStream(t,e,r)})})}addStringRecordToStream(t,e,r){Rn(this,e,e=>{zn(this,Object.keys(t),n=>{zn(this,Object.values(t),i=>{this.h._addFlatHashMapToInputStream(n,i,Object.keys(t).length,e,r)})})})}addProtoToStream(t,e,r,n){Rn(this,r,r=>{Rn(this,e,e=>{var i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,r,n),this.h._free(i)})})}addEmptyPacketToStream(t,e){Rn(this,t,t=>{this.h._addEmptyPacketToInputStream(t,e)})}addBoolVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputStream(n,e,r)})}addDoubleVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputStream(n,e,r)})}addFloatVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputStream(n,e,r)})}addIntVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputStream(n,e,r)})}addUintVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputStream(n,e,r)})}addStringVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Rn(this,e,t=>{this.h._addStringVectorEntry(n,t)});this.h._addStringVectorToInputStream(n,e,r)})}addBoolToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addBoolToInputSidePacket(t,e)})}addDoubleToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addDoubleToInputSidePacket(t,e)})}addFloatToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addFloatToInputSidePacket(t,e)})}addIntToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addIntToInputSidePacket(t,e)})}addUintToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addUintToInputSidePacket(t,e)})}addStringToInputSidePacket(t,e){Rn(this,e,e=>{Rn(this,t,t=>{this.h._addStringToInputSidePacket(t,e)})})}addProtoToInputSidePacket(t,e,r){Rn(this,r,r=>{Rn(this,e,e=>{var n=this.h._malloc(t.length);this.h.HEAPU8.set(t,n),this.h._addProtoToInputSidePacket(n,t.length,e,r),this.h._free(n)})})}addBoolVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputSidePacket(r,e)})}addDoubleVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputSidePacket(r,e)})}addFloatVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputSidePacket(r,e)})}addIntVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputSidePacket(r,e)})}addUintVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputSidePacket(r,e)})}addStringVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Rn(this,e,t=>{this.h._addStringVectorEntry(r,t)});this.h._addStringVectorToInputSidePacket(r,e)})}attachBoolListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachBoolListener(t)})}attachBoolVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachBoolVectorListener(t)})}attachIntListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachIntListener(t)})}attachIntVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachIntVectorListener(t)})}attachUintListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachUintListener(t)})}attachUintVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachUintVectorListener(t)})}attachDoubleListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachDoubleListener(t)})}attachDoubleVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachDoubleVectorListener(t)})}attachFloatListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachFloatListener(t)})}attachFloatVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachFloatVectorListener(t)})}attachStringListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachStringListener(t)})}attachStringVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachStringVectorListener(t)})}attachProtoListener(t,e,r){Hn(this,t,e),Rn(this,t,t=>{this.h._attachProtoListener(t,r||!1)})}attachProtoVectorListener(t,e,r){Kn(this,t,e),Rn(this,t,t=>{this.h._attachProtoVectorListener(t,r||!1)})}attachAudioListener(t,e,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Hn(this,t,(t,r)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,r)}),Rn(this,t,t=>{this.h._attachAudioListener(t,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}})),Jn=class extends qn{};async function Xn(t,e){var r=await(async(t,e,r)=>{var n=pi;if(t&&await Wn(t),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(e&&(await Wn(e),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((t=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new n(r,null)})(t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&e.endsWith(".data")?t.assetBinaryPath.toString():e});return Yn(r,e),await r.T(e),r}function Yn(t,e){e=e.sa??"";var r=t.j.fa();t.l=new Gn(e,r)}function Zn(t,e){try{t.j.h.FS_unlink("/model.litertlm")}catch{}t.j.h.FS_createDataFile("/","model.litertlm",e,!0,!1,!1),fe(e=ie(t.baseOptions,ln,1)||new ln,2,"/model.litertlm"),Yt(e,1),ae(t.baseOptions,1,e)}function Qn(t,e,r=!0){if(r){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(ie(t.baseOptions,ln,1)?.j()||ie(t.baseOptions,ln,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){var r=ie(t.baseOptions,sn,3);if(!r){var n=r=new sn,i=new an;se(n,4,un,i)}"delegate"in e&&("GPU"===e.delegate?(e=r,n=new on,se(e,2,un,n)):(e=r,n=new an,se(e,4,un,n))),ae(t.baseOptions,3,r)}(t,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${t.status})`)}).then(e=>{Zn(t,new Uint8Array(e))});if(r.modelAssetBuffer instanceof Uint8Array)Zn(t,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(t){for(var e=[],r=0;;){let{done:n,value:i}=await t.read();if(n)break;e.push(i),r+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(r.modelAssetBuffer).then(e=>{Zn(t,e)})}return Promise.resolve()}function ti(t){try{let e=t.o.length;if(1===e)throw Error(t.o[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.o.map(t=>t.message).join(", "))}finally{t.o=[]}}var ei=class{constructor(t){this.j=t,this.o=[],this.j.setAutoRenderToScreen(!1)}setGraph(t,e){this.j.attachErrorListener((t,e)=>{this.o.push(Error(e))}),this.j.la(),this.j.setGraph(t,e),this.l?.Z(),ti(this)}finishProcessing(t){this.j.finishProcessing(),ti(this),this.l&&void 0!==t&&this.l.S(t)}close(){this.l?.ia(),this.l?.close(),this.j.closeGraph()}};function ri(t,e){var r="object"==typeof t&&null!==t,n=(r?t.imageBytes:void 0)??e?.imageBytes;return e=(r?t.audioSamples:void 0)??e?.audioSamples,{text:r?t.text??"":t,imageBytes:n,audioSamples:e,N:!!(n&&n.byteLength>0)||!!(e&&e.length>0)}}function ni(t){return(t=t.trim())?Math.max(1,Math.ceil(t.length/4)):0}function ii(t){var e={};if(t.criteria)for(let[r,n]of Object.entries(t.criteria))e[r]=n;if(t.options)for(let r of t.options)e[r.label]=r.description??"";return e}function oi(t){if(t.options&&t.options.length>0){var e=t.options.map(t=>t.description?`${t.label}: ${t.description}`:t.label),r=(t=t.options.map(t=>t.label)).map(t=>Number(t)),n=r.every(t=>Number.isFinite(t))&&t.every(t=>""!==t.trim());return r=n?r:t.map((t,e)=>e),{rubric:e,labels:t,R:r,P:n}}return t=(e=t.rubric??[]).map((t,e)=>String(e)),n=e.map((t,e)=>e),{rubric:e,labels:t,R:n,P:!1}}function ai(t,e,r,n){var i=t.probabilities??[],o=0,a=-1,s=0;for(let t=0;t<i.length;t++){let e=i[t];e>a&&(a=e,o=t),s+=(t<r.length?r[t]:t)*e}return{...t,expectedScore:n&&i.length>0?s:t.expectedScore,selectedKey:o<e.length?e[o]:t.selectedKey??String(o)}}ei.prototype.close=ei.prototype.close;var si=[];async function ui(t,e){var r=si.pop();if(r){Yn(t=new pi(r,null),e);try{return await t.T(e),t}catch(e){throw t.close(),e}}return async function(t,e){return Xn(t,e)}(t,e)}function li(t,e){var r=t.X.then(()=>{var r=t.ba++;return t.l&&(1===t.backendType||-1===t.backendType?function(t,e){++t.i.F,t.j.set(e,performance.now())}(t.l,r):function(t,e){++t.i.H,t.j.set(e,performance.now())}(t.l,r)),Promise.resolve().then(e).then(e=>(t.l?.S(r),e),e=>{throw t.l?.S(r),e})});return t.X=r.then(()=>{},()=>{}),r}function hi(t){if(!t)return 0;var e=t.context?ni(t.context):0;for(let r of t.questions??[]){e+=ni(r.prompt)+4;for(let t of r.options??[])e+=ni(t.description?`${t.label}: ${t.description}`:t.label)+2}return e}function ci(t){if(t.byteLength>=30&&80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]){let e=t[26]|t[27]<<8;if(e+(t=t[28]|t[29]<<8)<=4096)return 30+e+t}return 0}function fi(t,e,r=0){if(t=t.j.h,e<64){if(!(r=t._malloc(e)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:r,v:r}}if(!(t=t._malloc(e+64)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:(t+r+63&-64)-r>>>0,v:t}}async function di(t,e,r,n){var i=t.j.h;if(r instanceof Uint8Array){var o=r.byteLength;if(0===o)return{u:0,v:0,size:0};let{u:e,v:n}=fi(t,o,ci(r));return i.HEAPU8.set(r,e),{u:e,v:n,size:o}}if(n=n&&n>0?n:0,!r&&e){if(e=e.toString(),!(r=await fetch(e)).ok||!r.body)throw Error(`Failed to fetch asset: ${e} (${r.status})`);(e=Number(r.headers.get("content-length")||0))>0&&(n=e),r=r.body.getReader()}if(!r)return{u:0,v:0,size:0};if(n>0){e=[];for(var a=0;a<30;){let{value:t,done:n}=await r.read();if(n)break;t&&t.byteLength>0&&(e.push(t),a+=Number(t.byteLength))}if(0===a)return{u:0,v:0,size:0};let u=e[0];if(u.byteLength<30&&e.length>1)for(var s of(u=new Uint8Array(Math.min(a,30)),a=0,e)){let t=Math.min(s.byteLength,u.byteLength-a);if(u.set(s.subarray(0,t),a),(a+=t)>=u.byteLength)break}let{u:l,v:h}=fi(t,n,ci(u));for(o of(t=0,e)){if(t+(s=Number(o.byteLength))>n)throw i._free(h),Error(`Stream exceeded expected content-length (${n} bytes).`);i.HEAPU8.set(o,l+t>>>0),t+=s}for(e.length=0;;){let{value:e,done:a}=await r.read();if(a)break;if(e&&e.byteLength>0){if(t+(o=Number(e.byteLength))>n)throw i._free(h),Error(`Stream exceeded expected content-length (${n} bytes).`);i.HEAPU8.set(e,l+t>>>0),t+=o}}return{u:l,v:h,size:t}}for(o=[],n=0;;){let{value:t,done:e}=await r.read();if(e)break;t&&t.byteLength>0&&(s=Number(t.byteLength),o.push(t),n+=s)}if(0===n)return{u:0,v:0,size:0};r=o[0];var{u:u,v:l}=fi(t,n,r?ci(r):0);for(t=0,r=0;r<o.length;r++)(s=o[r])&&(i.HEAPU8.set(s,u+t>>>0),t+=s.byteLength,o[r]=void 0);return{u:u,v:l,size:n}}var pi=class extends ei{constructor(t,e){super(new Jn(t,e)),this.baseOptions=new hn,this.L=this.C=this.K=this.A=this.i=this.maxNumTokens=this.backendType=0,this.Y=!1,this.ba=this.J=0,this.X=Promise.resolve()}get contextWindow(){return this.maxNumTokens}get contextUsage(){return this.J}U(t){this.O=t,this.J=hi(t)}async ka(t){if(0!==this.i){var e=t.questions??[];if(0!==e.length){var r=this.j.h;"function"==typeof r.prewarmSchema?await li(this,()=>r.prewarmSchema(this.i,t.context??"",e)):await li(this,()=>r.evaluateSchema(this.i,"__PREWARM__",t.context??"",e))}}}async ja(t,e){return t=e?.context?`${e.context}\n${t}`:t,hi(this.O)+ni(t)}async T(t){if(0!==this.i)throw Error("Decision does not support updating options after initialization.");if("CPU"===t.baseOptions?.delegate?this.backendType=-1:void 0!==t.backendType&&(this.backendType=t.backendType),void 0!==t.maxNumTokens&&(this.maxNumTokens=t.maxNumTokens),t.schema?this.U(t.schema):(t.questions||t.context||t.expectedInputs)&&this.U({context:t.context,expectedInputs:t.expectedInputs,questions:t.questions}),-1===this.backendType){this.j.h.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.j.h).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),n=r?.info,i=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${n?.vendor??""} ${n?.architecture??""} ${n?.description??""}`);if(r&&!i){for(var o of(i=[],["shader-f16","subgroups"]))r.features.has(o)&&i.push(o);o={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(o[t]=e)}let t=await r.requestDevice({requiredFeatures:i,requiredLimits:o});if(!t.adapterInfo&&n)try{Object.defineProperty(t,"adapterInfo",{value:n,writable:!0,configurable:!0})}catch{try{t.adapterInfo=n}catch{}}e.preinitializedWebGPUDevice=t}}e.preinitializedWebGPUDevice&&("object"==typeof(r=self).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}if(r=e=this.j.h,(n=!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer))&&"function"==typeof e.createDecisionFromBuffers&&"function"==typeof r._malloc){if(r=await di(this,t.baseOptions?.modelAssetPath,t.baseOptions?.modelAssetBuffer,t.modelAssetSize),this.A=r.u,this.K=r.v,n=0,t.companionPleAssetPath||t.companionPleAssetBuffer)try{let e=await di(this,t.companionPleAssetPath,t.companionPleAssetBuffer,t.companionPleAssetSize);this.C=e.u,this.L=e.v,n=e.size}catch(t){console.warn("Optional companion per-layer embedder not loaded:",t)}this.i=await e.createDecisionFromBuffers(this.A,r.size,this.C,n,this.backendType,this.maxNumTokens)}else await Qn(this,t,n),this.i=await e.createDecision("/model.litertlm",this.backendType,this.maxNumTokens);this.l?.Z()}evaluateBoolean(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,n=e.context?`${e.context}\n${e.condition}`:e.condition,i=ri(t,e);return i.N?li(this,()=>r.evaluateContextBoolean(this.i,i.text,n,e.threshold??.5,e.temperature??0,{imageBytes:i.imageBytes,audioSamples:i.audioSamples})):li(this,()=>r.evaluateBoolean(this.i,i.text,n,e.threshold??.5,e.temperature??0))}evaluateChoice(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,n=ii(e),i=e.instructions??"",o=e.context?i?`${e.context}\n${i}`:e.context:i,a=ri(t,e);return t=(e.options??[]).some(t=>t.imageBytes&&t.imageBytes.byteLength>0||t.audioSamples&&t.audioSamples.length>0),a.N||t?li(this,()=>r.evaluateContextChoice(this.i,a.text,n,e.options??[],e.temperature??0,o,{imageBytes:a.imageBytes,audioSamples:a.audioSamples})):li(this,()=>r.evaluateChoice(this.i,a.text,n,e.temperature??0,o))}async evaluateScore(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,{rubric:n,labels:i,R:o,P:a}=oi(e),s=e.instructions??"",u=e.context?s?`${e.context}\n${s}`:e.context:s,l=ri(t,e);return ai(t=l.N?await li(this,()=>r.evaluateContextScore(this.i,l.text,n,e.temperature??0,u,{imageBytes:l.imageBytes,audioSamples:l.audioSamples})):await li(this,()=>r.evaluateScore(this.i,l.text,n,e.temperature??0,u)),i,o,a)}async evaluate(t,e,r){if(0===this.i)throw Error("Decision is already closed.");if(r?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");var n=ri(t,r),i=r?.context?n.text?`${r.context}\n${n.text}`:r.context:n.text,o=e.context;t=(n.imageBytes&&n.imageBytes.byteLength>0?70:0)+(n.audioSamples&&n.audioSamples.length>0?Math.ceil(n.audioSamples.length/640):0),this.J=hi(e)+ni(i)+t;var a=this.j.h,s=e.questions??[];return 0===s.length?{}:(e=s.some(t=>(t.options??[]).some(t=>t.imageBytes&&t.imageBytes.byteLength>0||t.audioSamples&&t.audioSamples.length>0)),n.N||e?li(this,()=>a.evaluateContextSchema(this.i,i,o??"",s,{imageBytes:n.imageBytes,audioSamples:n.audioSamples})):li(this,()=>a.evaluateSchema(this.i,i,o??"",s)))}async da(t,e,r){var n=[];for(let i of t)n.push(await this.evaluate(i,e,r));return n}async ca(t,e){if(!this.O)throw Error("No session schema configured. Pass `schema` or `questions` in DecisionMakerOptions or call setSchema() before classify().");return this.evaluate(t,this.O,e)}async evaluateBooleanBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,i=e.context?`${e.context}\n${e.condition}`:e.condition;if("function"==typeof n.evaluateBooleanBatch)return li(this,()=>n.evaluateBooleanBatch(this.i,t,i,e.threshold??.5,e.temperature??0,r));var o=[];for(let n of t)o.push(await this.evaluateBoolean(r?`${r}\n${n}`:n,e));return o}async evaluateChoiceBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,i=ii(e),o=e.instructions??"",a=e.context?o?`${e.context}\n${o}`:e.context:o;if("function"==typeof n.evaluateChoiceBatch)return li(this,()=>n.evaluateChoiceBatch(this.i,t,i,e.temperature??0,a,r));o=[];for(let n of t)o.push(await this.evaluateChoice(r?`${r}\n${n}`:n,e));return o}async evaluateScoreBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,{rubric:i,labels:o,R:a,P:s}=oi(e),u=e.instructions??"",l=e.context?u?`${e.context}\n${u}`:e.context:u;if("function"==typeof n.evaluateScoreBatch)return(await li(this,()=>n.evaluateScoreBatch(this.i,t,i,e.temperature??0,l,r))).map(t=>ai(t,o,a,s));u=[];for(let n of t)u.push(await this.evaluateScore(r?`${r}\n${n}`:n,e));return u}close(){if(!this.Y){this.Y=!0;var t=this.j.h;if(0!==this.i){try{t.deleteDecision(this.i)}catch{}this.i=0}var e=this.K||this.A;if(0!==e){try{t._free(e)}catch{}this.K=this.A=0}if(0!==(e=this.L||this.C)){try{t._free(e)}catch{}this.L=this.C=0}super.close(),t&&!si.includes(t)&&si.push(t)}}};pi.prototype.close=pi.prototype.close,pi.prototype.evaluateScoreBatch=pi.prototype.evaluateScoreBatch,pi.prototype.evaluateChoiceBatch=pi.prototype.evaluateChoiceBatch,pi.prototype.evaluateBooleanBatch=pi.prototype.evaluateBooleanBatch,pi.prototype.classify=pi.prototype.ca,pi.prototype.evaluateBatch=pi.prototype.da,pi.prototype.evaluate=pi.prototype.evaluate,pi.prototype.evaluateScore=pi.prototype.evaluateScore,pi.prototype.evaluateChoice=pi.prototype.evaluateChoice,pi.prototype.evaluateBoolean=pi.prototype.evaluateBoolean,pi.prototype.setOptions=pi.prototype.T,pi.prototype.measureContextUsage=pi.prototype.ja,pi.prototype.prewarm=pi.prototype.ka,pi.prototype.setSchema=pi.prototype.U,pi.createFromModelBuffer=function(t,e,r=0,n=0){return ui(t,{baseOptions:{modelAssetBuffer:e},backendType:r,maxNumTokens:n})},pi.createFromModelPath=function(t,e,r=0,n=0){return ui(t,{baseOptions:{modelAssetPath:e},backendType:r,maxNumTokens:n})},pi.createFromOptions=ui,exports.DecisionMaker=pi,exports.FilesetResolver=fn,exports.TaskRunner=ei;
1
+ "use strict";var t="undefined"!=typeof self?self:{};var e,r="undefined"!=typeof TextEncoder;function n(t){if(r)t=(e||=new TextEncoder).encode(t);else{let e=0,r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var n=t.charCodeAt(i);if(n<128)r[e++]=n;else{if(n<2048)r[e++]=n>>6|192;else{if(n>=55296&&n<=57343){if(n<=56319&&i<t.length){let o=t.charCodeAt(++i);if(o>=56320&&o<=57343){n=1024*(n-55296)+o-56320+65536,r[e++]=n>>18|240,r[e++]=n>>12&63|128,r[e++]=n>>6&63|128,r[e++]=63&n|128;continue}i--}n=65533}r[e++]=n>>12|224,r[e++]=n>>6&63|128}r[e++]=63&n|128}}t=e===r.length?r:r.subarray(0,e)}return t}function i(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var o={},a=null;function s(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return function(t,e){function r(e){for(;n<t.length;){let e=t.charAt(n++),r=a[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}u();for(var n=0;;){let t=r(-1),n=r(0),i=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|n>>4),64!=i&&(e(n<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,function(t){n[i++]=t}),i!==r?n.subarray(0,i):n}function u(){if(!a){a={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=t.concat(e[r].split(""));o[r]=n;for(let t=0;t<n.length;t++){let e=n[t];void 0===a[e]&&(a[e]=t)}}}}var l="undefined"!=typeof Uint8Array,h=!(-1!=i().indexOf("Trident")||-1!=i().indexOf("MSIE"))&&"function"==typeof btoa,c=/[-_.]/g,f={"-":"+",_:"/",".":"="};function d(t){return f[t]||""}function p(t){if(!h)return s(t);t=c.test(t)?t.replace(c,d):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var v,g={},m=class{constructor(t,e){if(y(e),this.i=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function y(t){if(t!==g)throw Error("illegal external caller")}function b(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var w,S,_=void 0;function A(t){return b(t=Error(t),"warning"),t}function B(e,r){if(null!=e){var n=_??={},i=n[e]||0;i>=r||(n[e]=i+1,b(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}t:{for(var T=["CLOSURE_FLAGS"],I=t,x=0;x<T.length;x++)if(null==(I=I[T[x]])){S=null;break t}S=I}var E=S&&S[748402147];function P(){return"function"==typeof BigInt}w=null==E||E;var L="function"==typeof Symbol&&"symbol"==typeof Symbol();function U(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var j,k=U("jas",void 0,!0),O=U(void 0,"1oa"),N=U(void 0,"0ubsb"),F=U(void 0,"0actk"),V=U("m_m","ra",!0),D={ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},M=Object.defineProperties,C=L?k:"ga",G=[];function $(t,e){L||C in t||M(t,D),t[C]|=e}function W(t,e){L||C in t||M(t,D),t[C]=e}function R(t,e){return 2&e&&(t|=2),1|t}W(G,7),j=Object.freeze(G);var z={};function H(t,e){return void 0===e?t.i!==K&&!!(2&t.m[C]):!!(2&e)&&t.i!==K}var K={};function q(t,e){if(null!=t)if("string"==typeof t)t=t?new m(t,g):v||=new m(null,g);else if(!(t instanceof m))if(l&&null!=t&&t instanceof Uint8Array)t=t.length?new m(new Uint8Array(t),g):v||=new m(null,g);else{if(!e)throw Error();t=void 0}return t}function J(t){return t.qa=!0,t}var X=J(t=>"number"==typeof t),Y=J(t=>"string"==typeof t),Z=J(t=>"boolean"==typeof t),Q="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function tt(t){var e=t;if(Y(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(X(e)&&!Number.isSafeInteger(e))throw Error(String(e));return Q?BigInt(t):t=Z(t)?t?"1":"0":Y(t)?t.trim()||"0":String(t)}var et=J(t=>Q?t>=nt&&t<=ot:"-"===t[0]?at(t,rt):at(t,it)),rt=Number.MIN_SAFE_INTEGER.toString(),nt=Q?BigInt(Number.MIN_SAFE_INTEGER):void 0,it=Number.MAX_SAFE_INTEGER.toString(),ot=Q?BigInt(Number.MAX_SAFE_INTEGER):void 0;function at(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n>i)return!1;if(n<i)return!0}}var st,ut=0,lt=0;function ht(t){var e=t>>>0;ut=e,lt=(t-e)/4294967296>>>0}function ct(t){if(t<0){ht(-t);let[e,r]=mt(ut,lt);ut=e>>>0,lt=r>>>0}else ht(t)}function ft(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:dt(t,e)}function dt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else P()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+pt(r)+pt(t));return r}function pt(t){return t=String(t),"0000000".slice(t.length)+t}function vt(){var t=ut,e=lt;if(2147483648&e)if(P())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,n]=mt(t,e);t="-"+dt(r,n)}else t=dt(t,e);return t}function gt(t){if(t.length<16)ct(Number(t));else if(P())t=BigInt(t),ut=Number(t&BigInt(4294967295))>>>0,lt=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);lt=ut=0;let r=t.length;for(let n=e,i=(r-e)%6+e;i<=r;n=i,i+=6){let e=Number(t.slice(n,i));lt*=1e6,(ut=1e6*ut+e)>=4294967296&&(lt+=Math.trunc(ut/4294967296),lt>>>=0,ut>>>=0)}if(e){let[t,e]=mt(ut,lt);ut=t,lt=e}}}function mt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var yt="function"==typeof BigInt?BigInt.asIntN:void 0,bt="function"==typeof BigInt?BigInt.asUintN:void 0,wt=Number.isSafeInteger,St=Number.isFinite,_t=Math.trunc;function At(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}var Bt,Tt,It,xt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Et(t){switch(typeof t){case"bigint":return!0;case"number":return St(t);case"string":return xt.test(t);default:return!1}}function Pt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return St(t)?0|t:void 0}function Lt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(gt(t),vt())}function Ut(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(gt(t),dt(ut,lt))}function jt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(yt(64,t));if(Et(t)){if("string"===e)return e=_t(Number(t)),wt(e)?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Lt(t)),t;if("number"===e)return function(t){if(t=_t(t),!wt(t)){ct(t);var e=ut,r=lt;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=ft(e,r))?t?-e:e:t?"-"+e:e}return t}(t)}}function kt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(bt(64,t));if(Et(t)){if("string"===e)return e=_t(Number(t)),wt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Ut(t)),t;if("number"===e)return function(t){return(t=_t(t))>=0&&wt(t)||(ct(t),t=ft(ut,lt)),t}(t)}}function Ot(t){if(null==t||"string"==typeof t||t instanceof m)return t}function Nt(t){return null==t||"string"==typeof t?t:void 0}function Ft(t,e,r){if(null!=t&&t[V]===z)return t;if(Array.isArray(t)){var n=0|t[C];return(r=n|32&r|2&r)!==n&&W(t,r),new e(t)}}function Vt(t){return t}function Dt(t,e,r,n){var i=void 0!==n;n=!!n;var o=[],a=t.length,s=4294967295,u=!1,l=!!(64&e),h=l?128&e?0:-1:void 0;if(!(1&e)){var c=a&&t[a-1];null!=c&&"object"==typeof c&&c.constructor===Object?s=--a:c=void 0,!l||128&e||i||(u=!0,s=(Bt??Vt)(s-h,h,t,c,void 0)+h)}for(e=void 0,i=0;i<a;i++){let a=t[i];if(null!=a&&null!=(a=r(a,n)))if(l&&i>=s){let t=i-h;(e??={})[t]=a}else o[i]=a}if(c)for(let i in c){if(null==(t=c[i])||null==(t=r(t,n)))continue;let u;a=+i,l&&!Number.isNaN(a)&&(u=a+h)<s?o[u]=t:(e??={})[i]=t}return e&&(u?o.push(e):o[s]=e),o}function Mt(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return et(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[C];return 0===t.length&&1&e?void 0:Dt(t,e,Mt)}if(null!=t&&t[V]===z)return Ct(t);if(t instanceof m){if(null==(e=t.i))t="";else if("string"==typeof e)t=e;else{if(h){for(var r="",n=0,i=e.length-10240;n<i;)r+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?e.subarray(n):e),e=btoa(r)}else{void 0===r&&(r=0),u(),r=o[r],n=Array(Math.floor(e.length/3)),i=r[64]||"";let t=0,h=0;for(;t<e.length-2;t+=3){var a=e[t],s=e[t+1],l=e[t+2],c=r[a>>2];a=r[(3&a)<<4|s>>4],s=r[(15&s)<<2|l>>6],l=r[63&l],n[h++]=c+a+s+l}switch(c=0,l=i,e.length-t){case 2:l=r[(15&(c=e[t+1]))<<2]||i;case 1:e=e[t],n[h]=r[e>>2]+r[(3&e)<<4|c>>4]+l+i}e=n.join("")}t=t.i=e}return t}return}return t}function Ct(t){return Dt(t=t.m,0|t[C],Mt)}function Gt(t,e,r,n=0){if(null==t){var i=32;r?(t=[r],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[C],w&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(w)throw Error("carr");B(F,5)}(),256&i)throw Error("farr");if(64&i)return(i|n)!==i&&W(t,i|n),t;if(r&&(i|=128,r!==t[0]))throw Error("mid");t:{i|=64;var o=(r=t).length;if(o){var a=o-1;let t=r[a];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((a-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var s in t)(o=+s)<a&&(r[o+e]=t[s],delete t[s]);i=-16760833&i|(1023&a)<<14;break t}}if(e){if((s=Math.max(e,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&s)<<14}}}return W(t,64|i|n),t}function $t(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[C];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=Rt(t,r,!1,e&&!(16&r)):($(t,34),4&r&&Object.freeze(t))),t}return null!=t&&t[V]===z?H(t,r=0|(e=t.m)[C])?t:qt(t,e,r)?Wt(t,e):Rt(e,r):t instanceof m?t:void 0}function Wt(t,e,r){return t=new t.constructor(e),r&&(t.i=K),t.o=K,t}function Rt(t,e,r,n){return n??=!!(34&e),t=Dt(t,e,$t,n),n=32,r&&(n|=2),W(t,e=16769217&e|n),t}function zt(t){if(t.i!==K)return!1;var e=t.m;return $(e=Rt(e,0|e[C]),2048),t.m=e,t.i=void 0,t.o=void 0,!0}function Ht(t){if(!zt(t)&&H(t,0|t.m[C]))throw Error()}function Kt(t,e){void 0===e&&(e=0|t[C]),32&e&&!(4096&e)&&W(t,4096|e)}function qt(t,e,r){return!!(2&r)||!(!(32&r)||4096&r)&&(W(e,2|r),t.i=K,!0)}function Jt(t,e,r){if(null!==(t=Xt(t.m,e,void 0,r)))return t}function Xt(t,e,r,n){if(-1===e)return null;var i=e+(r?0:-1),o=t.length-1;if(!(o<1+(r?0:-1))){if(i>=o){var a=t[o];if(null!=a&&"object"==typeof a&&a.constructor===Object){r=a[e];var s=!0}else{if(i!==o)return;r=a}}else r=t[i];if(n&&null!=r){if(null==(n=n(r)))return n;if(!Object.is(n,r))return s?a[e]=n:t[i]=n,n}return r}}function Yt(t,e,r){Ht(t);var n=t.m;return Zt(n,0|n[C],e,r),t}function Zt(t,e,r,n,i){var o=r+(i?0:-1),a=t.length-1;if(a>=1+(i?0:-1)&&o>=a){let i=t[a];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[r]=n,e}return o<=a?(t[o]=n,e):(void 0!==n&&(r>=(a=(e??=0|t[C])>>14&1023||536870912)?null!=n&&(t[a+(i?0:-1)]={[r]:n}):t[o]=n),e)}function Qt(t,e,r){return t=Xt(t,e,r),Array.isArray(t)?t:j}function te(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function ee(t){return q(t,!0)}function re(t){if(L)return t[O]??(t[O]=new Map);if(O in t)return t[O];var e=new Map;return Object.defineProperty(t,O,{value:e}),e}function ne(t,e,r,n){var i=t.get(n);if(null!=i)return i;i=0;for(let t=0;t<n.length;t++){let o=n[t];null!=Xt(e,o)&&(0!==i&&(r=Zt(e,r,i)),i=o)}return t.set(n,i),i}function ie(t,e,r){var n=t.m,i=0|n[C];if(e=function(t,e,r,n){var i=!1;if(null!=(n=Xt(t,n,void 0,t=>{var n=Ft(t,r,e);return i=n!==t&&null!=n,n})))return i&&!H(n)&&Kt(t,e),n}(n,i,e,r),null==e)return e;if(!H(t,i=0|n[C])){var o,a=e;let s=a.m,u=0|s[C];(o=H(a,u)?qt(a,s,u)?Wt(a,s,!0):new a.constructor(Rt(s,u,!1)):a)!==e&&(zt(t)&&(i=0|(n=t.m)[C]),Kt(n,i=Zt(n,i,r,e=o)))}return e}function oe(t){return null==t&&(t=void 0),t}function ae(t,e,r){return Yt(t,e,r=oe(r)),r&&!H(r)&&Kt(t.m),t}function se(t,e,r,n){t:{var i=n=oe(n);Ht(t);let s=t.m;var o=0|s[C];if(null==i){var a=re(s);if(ne(a,s,o,r)!==e)break t;a.set(r,0)}else{let t=re(a=s),n=ne(t,a,o,r);n!==e&&(n&&(o=Zt(a,o,n)),t.set(r,e))}Zt(s,o,e,i)}return n&&!H(n)&&Kt(t.m),t}function ue(t,e){return-273&(2&e?2|t:-3&t)}function le(t,e){var r=pn;Ht(t);var n=t.m,i=n,o=0|n[C],a=(t?H(t,o):2&o)?1:2;2===a&&t&&zt(t)&&(o=0|(i=t.m)[C]);var s=Qt(i,8),u=s===j?7:0|s[C],l=R(u,o);if(t=!(4&l)){var h=o;let t=!!(2&l);t&&(h|=2);let e=!t,n=!0,i=0,a=0;for(;i<s.length;i++){let o=Ft(s[i],r,h);if(o instanceof r){if(!t){let t=H(o);e&&=!t,n&&=t}s[a++]=o}}a<i&&(s.length=a),l|=4,l=n?-4097&l:4096|l,l=e?8|l:-9&l}l!==u&&(W(s,l),2&l&&Object.freeze(s)),l=u=l,(h=te(u))&&2===a&&(s=Array.prototype.slice.call(s),l=0,u=ue(u,o),o=Zt(i,o,8,s),h=!1),h||(1===a||4===a&&(2&u||!(16&u)&&32&o)?((u|=!s.length||t&&!(4096&u)||32&o&&!(4096&u||16&u)?2:256)!==l&&W(s,u),Object.freeze(s)):u!==l&&W(s,u)),2&u||!(4096&u||16&u)||Kt(i,o),a=s,e=null!=e?e:new r,a.push(e),t=r=a===j?7:0|a[C],(e=H(e))?(r&=-9,1===a.length&&(r&=-4097)):r|=4096,r!==t&&W(a,r),e||Kt(n)}function he(t,e,r){return Yt(t,e,null==r?r:function(t){if(!Et(t))throw A("int64");switch(typeof t){case"string":var e=_t(Number(t));return wt(e)?t=tt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=P()?tt(yt(64,BigInt(t))):tt(Lt(t))),t;case"bigint":return tt(yt(64,t));default:return wt(t)||(t=_t(t),wt(t)?t=String(t):(ct(t),t=vt())),tt(t)}}(r))}function ce(t,e,r){return Yt(t,e,null==r?r:function(t){if(!Et(t))throw A("uint64");switch(typeof t){case"string":var e=_t(Number(t));return wt(e)&&e>=0?t=tt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=P()?tt(bt(64,BigInt(t))):tt(Ut(t))),t;case"bigint":return tt(bt(64,t));default:return t>=0&&wt(t)||((t=_t(t))>=0&&wt(t)?t=String(t):(ct(t),t=dt(ut,lt))),tt(t)}}(r))}function fe(t,e,r){if(null!=r&&"string"!=typeof r)throw Error();return Yt(t,e,r)}function de(t,e,r){if(null!=r){if(!St(r))throw A("enum");r|=0}return Yt(t,e,r)}var pe=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error()}};function ve(t){if("string"==typeof t)return new pe(p(t),!0);if(Array.isArray(t))return new pe(new Uint8Array(t),!0);if(t.constructor===Uint8Array)return new pe(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new pe(t,!1);if(t.constructor===m){y(g);var e=t.i;return e=(null==(e=null==e||l&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?p(e):null)?e:t.i=e)||new Uint8Array(0),new pe(e,!0,t)}if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new pe(t,!1);throw Error()}function ge(t){return new be(4294967295&t,Math.floor(t/4294967296))}function me(t){return t?/^\d+$/.test(t)?(gt(t),new be(ut,lt)):null:ye||=new be(0,0)}var ye,be=class{constructor(t,e){this.j=t>>>0,this.i=e>>>0}};function we(t){return new Le(4294967295&t,Math.floor(t/4294967296))}function Se(t){return t?/^-?\d+$/.test(t)?(gt(t),new Le(ut,lt)):null:_e||=new Le(0,0)}var _e,Ae,Be,Te,Ie,xe,Ee,Pe,Le=class{constructor(t,e){this.j=t>>>0,this.i=e>>>0}};function Ue(t,e,r){return"undefined"!=typeof BigInt64Array?(Ee||(Ee=new BigInt64Array(1),Pe=new Uint32Array(Ee.buffer),Ee[0]=BigInt(1),xe=1===Pe[0]),Ee[0]=t,new e(Pe[t=xe?0:1],Pe[1-t])):(Ie||(Ae=BigInt(Number.MIN_SAFE_INTEGER),Be=BigInt(Number.MAX_SAFE_INTEGER),Te=BigInt(4294967295),Ie=BigInt(32)),t>=Ae&&t<=Be?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&Te),Number(t>>Ie))))}function je(t,e,r){for(;r>0||e>127;)t.i.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.i.push(e)}function ke(t,e){for(;e>127;)t.i.push(127&e|128),e>>>=7;t.i.push(e)}function Oe(t,e){if(e>=0)ke(t,e);else{for(let r=0;r<9;r++)t.i.push(127&e|128),e>>=7;t.i.push(1)}}function Ne(t,e){gt(e),function(t){var e=lt>>31;t(ut<<1^e,(lt<<1|ut>>>31)^e)}((e,r)=>{je(t,e>>>0,r>>>0)})}function Fe(t,e){t.i.push(e>>>0&255),t.i.push(e>>>8&255),t.i.push(e>>>16&255),t.i.push(e>>>24&255)}var Ve=class{constructor(){this.i=[]}length(){return this.i.length}end(){var t=this.i;return this.i=[],t}};function De(t,e){0!==e.length&&(t.l.push(e),t.j+=e.length)}function Me(t,e,r){ke(t.i,8*e+r)}function Ce(t,e){return Me(t,e,2),e=t.i.end(),De(t,e),e.push(t.j),e}function Ge(t,e){var r=e.pop();for(r=t.j+t.i.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.j++;e.push(r),t.j++}function $e(t,e,r){if(null!=r)switch(Me(t,e,0),typeof r){case"number":t=t.i,ct(r),je(t,ut,lt);break;case"bigint":r=Ue(r,Le,we),je(t.i,r.j,r.i);break;default:r=Se(r),je(t.i,r.j,r.i)}}function We(t,e,r){Me(t,e,2),ke(t.i,r.length),De(t,t.i.end()),De(t,r)}var Re=class{constructor(){this.l=[],this.j=0,this.i=new Ve}};function ze(t){if("string"==typeof t)Se(t)}function He(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Ke=He(),qe=He(),Je=He(),Xe=He(),Ye=He(),Ze=He(),Qe=He(),tr=He(),er=He(),rr=He(),nr=He(),ir=He(),or=class{constructor(t,e){this.m=Gt(t,e,void 0,2048)}toJSON(){return Ct(this)}};or.prototype[V]=z,or.prototype.toString=function(){return this.m.toString()};var ar=class{constructor(t,e){this.i=t,t=Ke,this.j=!!t&&e===t||!1}};function sr(t,e,r,n,i){null!=(e=vr(e,n))&&(r=Ce(t,r),i(e,t),Ge(t,r))}var ur,lr,hr=new ar(sr,Ke),cr=new ar(sr,Ke),fr=Symbol(),dr=Symbol();function pr(t){var e=gr,r=mr,n=t[fr];if(n)return n;(n={}).oa=t,n.aa=function(t){switch(typeof t){case"boolean":return Tt||=[0,void 0,!0];case"number":return t>0?void 0:0===t?It||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(t[0]);var i=t[1],o=1;i&&i.constructor===Object&&(n.ea=i,"function"==typeof(i=t[++o])&&i.length>0&&(n.ha=!0,ur??=i,lr??=t[o+1],i=t[o+=2]));for(var a={};i&&Array.isArray(i)&&i.length&&"number"==typeof i[0]&&i[0]>0;){for(var s=0;s<i.length;s++)a[i[s]]=i;i=t[++o]}for(s=1;void 0!==i;){let h;"number"==typeof i&&(s+=i,i=t[++o]);var u=void 0;if(i instanceof ar?h=i:(h=hr,o--),h?.j){i=t[++o],u=t;var l=o;"function"==typeof i&&(i=i(),u[l]=i),u=i}for(l=s+1,"number"==typeof(i=t[++o])&&i<0&&(l-=i,i=t[++o]);s<l;s++){let t=a[s];u?r(n,s,h,u,t):e(n,s,h,t)}}return t[fr]=n}function vr(t,e){return t instanceof or?t.m:Array.isArray(t)?Gt(t,e[0],e[1]):void 0}function gr(t,e,r){t[e]=r.i}function mr(t,e,r,n){var i,o,a=r.i;t[e]=(t,e,r)=>a(t,e,r,o||=pr(n).aa,i||=yr(n))}function yr(t){var e=t[dr];if(!e){let r=pr(t);e=(t,e)=>br(t,e,r),t[dr]=e}return e}function br(t,e,r){!function(t,e,r){var n,i=128&e?0:-1,o=t.length;(n=!!o)&&(n=null!=(n=t[o-1])&&"object"==typeof n&&n.constructor===Object);var a=o+(n?-1:0);for(e=128&e?1:0;e<a;e++)r(e-i,t[e]);if(n){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}(t,0|t[C],(t,n)=>{if(null!=n){var i=function(t,e){var r=t[e];if(r)return r;if((r=t.ea)&&(r=r[e])){var n=(r=Array.isArray(r)?r[0]instanceof ar?r:[cr,r]:[r,void 0])[0].i;if(r=r[1]){let e=yr(r),i=pr(r).aa;r=t.ha?lr(i,e):(t,r,o)=>n(t,r,o,i,e)}else r=n;return t[e]=r}}(r,t);i?i(e,n,t):t<500||B(N,3)}})}function wr(t,e,r){if(Array.isArray(e)){var n=0|e[C];if(4&n)return e;for(var i=0,o=0;i<e.length;i++){let r=t(e[i]);null!=r&&(e[o++]=r)}return o<i&&(e.length=o),t=1|n,r&&(t=-1537&t|4),t!==n&&W(e,t),r&&2&t&&Object.freeze(e),e}}var Sr=(t,e)=>{var r=new Re;br(t.m,r,pr(e)),De(r,r.i.end()),t=new Uint8Array(r.j);var n=(e=r.l).length,i=0;for(let r=0;r<n;r++){let n=e[r];t.set(n,i),i+=n.length}return r.l=[t],t};function _r(t,e){return new ar(t,e)}function Ar(t,e){return new ar(t,e)}function Br(t,e,r){null!=(e=jt(e))&&(ze(e),$e(t,r,e))}function Tr(t,e,r){null!=(e=Pt(e))&&null!=e&&(Me(t,r,0),Oe(t.i,e))}function Ir(t,e,r){null!=(e=Nt(e))&&We(t,r,n(e))}function xr(t,e,r,n,i){null!=(e=vr(e,n))&&(r=Ce(t,r),i(e,t),Ge(t,r))}function Er(t,e,r){null!=(e=Ot(e))&&We(t,r,ve(e).buffer)}function Pr(t,e,r){null!=(e=Pt(e))&&(e=parseInt(e,10),Me(t,r,0),Oe(t.i,e))}var Lr,Ur=_r(function(t,e,r){null!=(e=At(e))&&(Me(t,r,1),t=t.i,(r=st||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),ut=r.getUint32(0,!0),lt=r.getUint32(4,!0),Fe(t,ut),Fe(t,lt))},rr),jr=_r(function(t,e,r){null!=(e=At(e))&&(Me(t,r,5),t=t.i,(r=st||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),lt=0,Fe(t,ut=r.getUint32(0,!0)))},er),kr=_r(Br,Ze),Or=_r(Br,Ze),Nr=Ar(function(t,e,r){if(null!=(e=wr(jt,e,!1)))for(let n=0;n<e.length;n++)$e(t,r,e[n])},Ze),Fr=_r(function(t,e,r){if(null!=(e=kt(e))){if("string"==typeof e)me(e);if(null!=e)switch(Me(t,r,0),typeof e){case"number":t=t.i,ct(e),je(t,ut,lt);break;case"bigint":r=Ue(e,be,ge),je(t.i,r.j,r.i);break;default:r=me(e),je(t.i,r.j,r.i)}}},Qe),Vr=_r(Tr,Xe),Dr=Ar(function(t,e,r){if(null!=(e=wr(Pt,e,!0)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&(Me(n,i,0),Oe(n.i,o))}},Xe),Mr=Ar(function(t,e,r){if(null!=(e=wr(Pt,e,!0))&&e.length){r=Ce(t,r);for(let r=0;r<e.length;r++)Oe(t.i,e[r]);Ge(t,r)}},Xe),Cr=_r(function(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Me(t,r,0),t.i.i.push(e?1:0))},qe),Gr=_r(Ir,Je),$r=Ar(function(t,e,r){if(null!=(e=wr(Nt,e,!0)))for(let s=0;s<e.length;s++){var i=t,o=r,a=e[s];null!=a&&We(i,o,n(a))}},Je),Wr=function(t,e,r=Ke){return new ar(e,r)}(0,function(t,e,r,n,i){if(Array.isArray(e)){for(let o=0;o<e.length;o++)xr(t,e[o],r,n,i);1&(t=0|e[C])||W(e,1|t)}}),Rr=new ar(xr,Ke),zr=_r(Er,nr),Hr=Ar(function(t,e,r){if(null!=(e=wr(Ot,e,!1)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&We(n,i,ve(o).buffer)}},nr),Kr=_r(function(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return St(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(Me(t,r,0),ke(t.i,e))},Ye),qr=_r(Pr,ir),Jr=_r(Pr,ir),Xr=_r(function(t,e,r){if(null!=(e=jt(e))&&(ze(e),null!=e))switch(Me(t,r,0),typeof e){case"number":t=t.i,e=(r=e)<0,ht(r=2*Math.abs(r)),r=ut;let n=lt;e&&(0==r?0==n?n=r=4294967295:(n--,r=4294967295):r--),je(t,ut=r,lt=n);break;case"bigint":t=t.i,e=e<<BigInt(1)^e>>BigInt(63),ut=Number(BigInt.asUintN(32,e)),lt=Number(BigInt.asUintN(32,e>>BigInt(32))),je(t,ut,lt);break;default:Ne(t.i,e)}},tr),Yr=[0,zr,Hr,Cr,Gr],Zr=[0,_r(Ir,Je),[0,Jr,[0,_r(Br,Ze),_r(Tr,Xe)],Jr,-1,[0,qr],Jr,-1],_r(Er,nr)],Qr=[0,1,[0,12,Vr,10,Cr],[0,7,[0,Vr,-1]]],tn=globalThis.trustedTypes;var en=class{constructor(t){this.i=t}toString(){return this.i+""}};function rn(t){var e;return void 0===Lr&&(Lr=function(){var t=null;if(!tn)return t;try{let e=t=>t;t=tn.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Lr)?e.createScriptURL(t):t,new en(t)}function nn(t,...e){if(0===e.length)return rn(t[0]);var r=t[0];for(let n=0;n<e.length;n++)r+=encodeURIComponent(e[n])+t[n+1];return rn(r)}var on=class extends or{constructor(t){super(t)}},an=class extends or{constructor(t){super(t)}},sn=class extends or{constructor(t){super(t)}},un=[1,2,3,4,5,6],ln=class extends or{constructor(t){super(t)}j(){return null!=Jt(this,1,ee)}l(){return null!=Nt(Jt(this,2))}},hn=class extends or{constructor(t){super(t)}};function cn(t,e,r){return r=`wasm${r?"_module":""}_internal`,Promise.resolve({wasmLoaderPath:`${e}/${t}_${r}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`})}var fn=class{};function dn(t){return de(new pn,1,t)}fn.forVisionTasks=function(t,e=!1){return cn("vision",t??nn``,e)},fn.forLiteRtLmTextTasks=function(t,e=!1){return cn("litertlm_text",t??nn``,e)},fn.forTextTasks=function(t,e=!1){return cn("text",t??nn``,e)},fn.forRetrievalTasks=function(t,e=!1){return cn("retrieval",t??nn``,e)},fn.forGenAiTasks=function(t,e=!1){return cn("genai",t??nn``,e)},fn.forDecisionTasks=function(t,e=!1){return cn("decision",t??nn``,e)},fn.forAudioTasks=function(t,e=!1){return cn("audio",t??nn``,e)};var pn=class extends or{constructor(t){super(t)}},vn=class extends or{constructor(t){super(t)}},gn=[0,qr,2,Fr,-2,Or,Wr,[0,qr,Or]],mn=class extends or{constructor(t){super(t)}},yn=class extends or{constructor(t){super(t)}};function bn(t){var e=new Sn;return e=de(e,1,30),de(e,2,t)}var wn,Sn=class extends or{constructor(t){super(t)}},_n=[3,4,5,6,7],An=class extends or{constructor(t){super(t)}},Bn=class extends or{constructor(t){super(t)}};Bn.prototype.j=(wn=[0,[0,qr,Gr,-3,qr],[0,_n,qr,-1,Rr,[0,qr,Gr,Fr],Rr,gn,Rr,[0,1,gn],Rr,[0,qr],Rr,[0,qr,Gr,Fr]]],function(){return Sr(this,wn)});var Tn=class{constructor(){this.i="undefined"!=typeof AbortController}async send(t,e,r){var n=this.i?new AbortController:void 0,i=n&&t.V>0?setTimeout(()=>{n.abort()},t.V):void 0;try{let i=await fetch(t.url,{method:t.na,headers:{...t.ma},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.V&&n?n.signal:null});200===i.status?e?.(await i.text()):r?.(i.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400,!0)}finally{clearTimeout(i)}}},In=class extends or{constructor(t){super(t,37)}},xn=[-4,{},Qr,qr,Zr],En=[0,Gr,qr,1,Gr,-1,qr,1,qr,1,Or],Pn=[0,qr,Gr,-2],Ln=[0,Gr,qr],Un=[0,Gr,qr],jn=[0,Cr,-3],kn=[0,qr,Gr,-1,Or,Vr,-1,Gr,-5,Wr,[0,Gr,-4],-1,Cr,[0,Cr,-3],qr];var On=class extends or{constructor(t){super(t,19)}},Nn=function(t){return e=>Sr(e,t)}([-19,{},[0,qr,1,[0,Gr,-6,Or,Vr,Gr,-1,Or],1,[0,Gr,1,Gr,-5],Gr,-1,[0,qr,Gr,-8],[0,Gr,-3],[0,Gr,qr,Gr,-2],[0,Gr,-1,qr,Gr,-1,qr,Gr,-1,[0,Wr,[0,Gr,-1],Cr,Gr,-5],[0,qr,Cr,Vr,-2]],Or,[0,Gr,-3,Or,Vr,Gr,-1],[0,qr,Gr,-1],[0,Gr,-9],[0,Gr,-6,qr,Gr,1,Gr,Cr,qr,-1,Cr,Gr,-2,qr,Gr,qr,Gr,Vr,-1],1,[0,qr],1,[0,Gr,-4],1,En,[0,[1,2,3,4,5,6],Rr,En,Rr,Ln,Rr,Un,Rr,[0,qr],Rr,kn,Rr,Pn],Ln,Un,kn,[0,[0,qr,Gr,-1,Or,Vr,-1,Gr,-4,Wr,[0,Gr,-4],-1,1,jn],[0,qr,Gr,-1,Or,Vr,-1,Gr,-4,jn]],Pn,[0,Gr,[0,Vr,-3,qr],qr,-2,[0,Vr,-1],Cr],4,[0,Gr,qr,Gr,-1,Or,qr,Gr,-1,qr,Vr,-1]],qr,Wr,[-37,{},kr,Gr,Wr,[0,Gr,-1],zr,1,zr,[0,$r,-1,Dr,Nr,-1],Gr,[0,Vr,Gr,-1],Cr,Vr,Or,Gr,-1,Xr,Yr,kr,zr,qr,Dr,Or,-1,[0,qr,-1],Gr,Cr,Gr,Mr,Gr,-1,Ur,1,Ur,xn,Cr,[0,qr,[0,jr,Vr,-2],[0,jr]],[0,qr,Or]],kr,Hr,Gr,-1,kr,qr,-1,[0,Cr,-1,qr,Cr],[0,Or,-1,Gr],[0,kr,Cr,Or],Or,1,Kr,1,xn]),Fn=class{constructor(t){this.j=[],this.o=new Tn,this.l=t??"",this.i=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.i&&(clearInterval(this.i),this.i=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.j.length)t?.();else{var r=this.j;this.j=[],r=function(t){var e=new On;Ht(e=de(e,2,1786));var r=e.m,n=0|r[C];if(null==t)Zt(r,n,3);else{var i=t===j?7:0|t[C],o=i,a=te(i),s=a||Object.isFrozen(t),u=!0,l=!0;for(let e=0;e<t.length;e++){var h=t[e];a||(h=H(h),u&&=!h,l&&=h)}a||(i=u?13:5,i=l?-4097&i:4096|i),s&&i===o||(t=Array.prototype.slice.call(t),o=0,i=ue(i,n)),i!==o&&W(t,i),n=Zt(r,n,3,t),2&i||!(4096&i||16&i)||Kt(r,n)}return e}(r),r=Nn(r),this.o.send({url:"https://odml.pa.googleapis.com/v1/log",na:"POST",V:1e4,body:r,pa:2,ma:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.l},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.j=[],void 0!==this.i&&(clearInterval(this.i),this.i=void 0),e?.("net-send-failed",t)})}}};class Vn{constructor(){this.M=this.D=this.I=this.B=this.G=this.H=this.F=0}}function Dn(t,e){var r=new Bn;r=ae(r,1,t.L),r=ae(r,2,e),e=Yt(e=new In,6,q(r=r.j(),!1)),(t=t.C).error||t.j.push(e)}function Mn(t,e){var r={F:e.F-t.l.F,H:e.H-t.l.H,G:e.G-t.l.G,B:e.B-t.l.B,I:e.I-t.l.I,D:e.D,M:e.M},n=bn(1);r=Cn(t,r),Dn(t,n=se(n,4,_n,r)),t.l=e}function Cn(t,e){var r=new vn;return t=ce(t=he(t=de(r,1,t.J),7,e.B),5,e.D),t=ce(t,6,e.M),e.G>0&&ce(t,4,e.I/e.G),0!==e.F&&le(t,r=he(r=dn(3),2,e.F)),0!==e.H&&le(t,e=he(r=dn(4),2,e.H)),t}var Gn=class{constructor(t,e){this.K=performance.now(),this.o=performance.now(),this.j=new Map,this.A=0,this.i=new Vn,this.l=new Vn,this.C=new Fn(e),this.J=function(t){switch(t){case"IMAGE":return 11;case"VIDEO":return 12;case"LIVE_STREAM":return 13;case"AUDIO_CLIPS":return 14;case"AUDIO_STREAM":return 15;default:return 10}}(t),t=new An,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=fe(t=de(t,1,e),2,""),t=fe(t,3,""),t=fe(t,4,"1.2.2"),t=fe(t,5,""),this.L=de(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}Z(){var t=new yn;t=ce(t=de(t,1,this.J),3,performance.now()-this.K),Dn(this,t=se(bn(0),3,_n,t)),this.o=performance.now()}S(t){var e=this.j.get(t);if(void 0!==e&&(this.j.delete(t),t=performance.now()-e,++this.i.G,this.i.I+=t,this.i.D=Math.max(this.i.D,t),this.A=Math.max(this.A,t),performance.now()>this.o+3e4)){for(let[r,n]of this.j.entries())t=r,n<e&&(this.i.B++,this.j.delete(t));e={...this.i,M:performance.now()-this.o},this.i.D=0,this.o=performance.now(),Mn(this,e)}}ia(){var t={...this.i,B:this.i.B+this.j.size,D:this.A,M:performance.now()-this.K};Mn(this,t);var e=new mn;e=ae(e,2,t=Cn(this,t)),Dn(this,e=se(t=bn(2),5,_n,e))}close(){var t=this.C;"function"==typeof t.close?t.close():t.flush()}};function $n(){var t=navigator;return"undefined"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Wn(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}function Rn(t,e,r){t.o||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(e=t.h.stringToNewUTF8(e)),t.h._free(e)}function zn(t,e,r){t.o||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");var n=new Uint32Array(e.length);for(let r=0;r<e.length;r++)n[r]=t.h.stringToNewUTF8(e[r]);e=t.h._malloc(4*n.length),t.h.HEAPU32.set(n,e>>2),r(e);for(let e of n)t.h._free(e);t.h._free(e)}function Hn(t,e,r){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=r}function Kn(t,e,r){var n=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(r(n,i),n=[]):n.push(t)}}var qn=function(t){return class extends t{get W(){return this.h}fa(){if("function"==typeof this.W._mediapipeLoggerGetEncodedApiKey){let t=this.W._mediapipeLoggerGetEncodedApiKey();return this.W._decodeBase64(t)}}}}(function(t){return class extends t{la(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.l=!0,this.h=t,this.i=null,this.j=0,this.o="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:$n()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){var e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){var r=t.length,n=this.h._malloc(r);this.h.HEAPU8.set(t,n),e?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(t,e,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Rn(this,n||"input_audio",n=>{Rn(this,i=i||"audio_header",i=>{this.h._configureAudio(n,i,t,e??0,r)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,r){this.addAudioToStreamWithShape(t,0,0,e,r)}addAudioToStreamWithShape(t,e,r,n,i){var o=4*t.length;this.j!==o&&(this.i&&this.h._free(this.i),this.i=this.h._malloc(o),this.j=o),this.h.HEAPF32.set(t,this.i/4),Rn(this,n,t=>{this.h._addAudioToInputStream(this.i,e,r,t,i)})}addGpuBufferToStream(t,e,r){Rn(this,e,e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();var n=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!n)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);var[i,o]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height];!this.l||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);var[a,s]=[i,o];this.h._addBoundTextureToStream(e,a,s,r)})}addBoolToStream(t,e,r){Rn(this,e,e=>{this.h._addBoolToInputStream(t,e,r)})}addDoubleToStream(t,e,r){Rn(this,e,e=>{this.h._addDoubleToInputStream(t,e,r)})}addFloatToStream(t,e,r){Rn(this,e,e=>{this.h._addFloatToInputStream(t,e,r)})}addIntToStream(t,e,r){Rn(this,e,e=>{this.h._addIntToInputStream(t,e,r)})}addUintToStream(t,e,r){Rn(this,e,e=>{this.h._addUintToInputStream(t,e,r)})}addStringToStream(t,e,r){Rn(this,e,e=>{Rn(this,t,t=>{this.h._addStringToInputStream(t,e,r)})})}addStringRecordToStream(t,e,r){Rn(this,e,e=>{zn(this,Object.keys(t),n=>{zn(this,Object.values(t),i=>{this.h._addFlatHashMapToInputStream(n,i,Object.keys(t).length,e,r)})})})}addProtoToStream(t,e,r,n){Rn(this,r,r=>{Rn(this,e,e=>{var i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,r,n),this.h._free(i)})})}addEmptyPacketToStream(t,e){Rn(this,t,t=>{this.h._addEmptyPacketToInputStream(t,e)})}addBoolVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputStream(n,e,r)})}addDoubleVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputStream(n,e,r)})}addFloatVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputStream(n,e,r)})}addIntVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputStream(n,e,r)})}addUintVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputStream(n,e,r)})}addStringVectorToStream(t,e,r){Rn(this,e,e=>{var n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Rn(this,e,t=>{this.h._addStringVectorEntry(n,t)});this.h._addStringVectorToInputStream(n,e,r)})}addBoolToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addBoolToInputSidePacket(t,e)})}addDoubleToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addDoubleToInputSidePacket(t,e)})}addFloatToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addFloatToInputSidePacket(t,e)})}addIntToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addIntToInputSidePacket(t,e)})}addUintToInputSidePacket(t,e){Rn(this,e,e=>{this.h._addUintToInputSidePacket(t,e)})}addStringToInputSidePacket(t,e){Rn(this,e,e=>{Rn(this,t,t=>{this.h._addStringToInputSidePacket(t,e)})})}addProtoToInputSidePacket(t,e,r){Rn(this,r,r=>{Rn(this,e,e=>{var n=this.h._malloc(t.length);this.h.HEAPU8.set(t,n),this.h._addProtoToInputSidePacket(n,t.length,e,r),this.h._free(n)})})}addBoolVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputSidePacket(r,e)})}addDoubleVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputSidePacket(r,e)})}addFloatVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputSidePacket(r,e)})}addIntVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputSidePacket(r,e)})}addUintVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputSidePacket(r,e)})}addStringVectorToInputSidePacket(t,e){Rn(this,e,e=>{var r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Rn(this,e,t=>{this.h._addStringVectorEntry(r,t)});this.h._addStringVectorToInputSidePacket(r,e)})}attachBoolListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachBoolListener(t)})}attachBoolVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachBoolVectorListener(t)})}attachIntListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachIntListener(t)})}attachIntVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachIntVectorListener(t)})}attachUintListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachUintListener(t)})}attachUintVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachUintVectorListener(t)})}attachDoubleListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachDoubleListener(t)})}attachDoubleVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachDoubleVectorListener(t)})}attachFloatListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachFloatListener(t)})}attachFloatVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachFloatVectorListener(t)})}attachStringListener(t,e){Hn(this,t,e),Rn(this,t,t=>{this.h._attachStringListener(t)})}attachStringVectorListener(t,e){Kn(this,t,e),Rn(this,t,t=>{this.h._attachStringVectorListener(t)})}attachProtoListener(t,e,r){Hn(this,t,e),Rn(this,t,t=>{this.h._attachProtoListener(t,r||!1)})}attachProtoVectorListener(t,e,r){Kn(this,t,e),Rn(this,t,t=>{this.h._attachProtoVectorListener(t,r||!1)})}attachAudioListener(t,e,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Hn(this,t,(t,r)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,r)}),Rn(this,t,t=>{this.h._attachAudioListener(t,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}})),Jn=class extends qn{};async function Xn(t,e){var r=await(async(t,e,r)=>{var n=pi;if(t&&await Wn(t),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(e&&(await Wn(e),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((t=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new n(r,null)})(t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&e.endsWith(".data")?t.assetBinaryPath.toString():e});return Yn(r,e),await r.T(e),r}function Yn(t,e){e=e.sa??"";var r=t.j.fa();t.l=new Gn(e,r)}function Zn(t,e){try{t.j.h.FS_unlink("/model.litertlm")}catch{}t.j.h.FS_createDataFile("/","model.litertlm",e,!0,!1,!1),fe(e=ie(t.baseOptions,ln,1)||new ln,2,"/model.litertlm"),Yt(e,1),ae(t.baseOptions,1,e)}function Qn(t,e,r=!0){if(r){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(ie(t.baseOptions,ln,1)?.j()||ie(t.baseOptions,ln,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){var r=ie(t.baseOptions,sn,3);if(!r){var n=r=new sn,i=new an;se(n,4,un,i)}"delegate"in e&&("GPU"===e.delegate?(e=r,n=new on,se(e,2,un,n)):(e=r,n=new an,se(e,4,un,n))),ae(t.baseOptions,3,r)}(t,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${t.status})`)}).then(e=>{Zn(t,new Uint8Array(e))});if(r.modelAssetBuffer instanceof Uint8Array)Zn(t,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(t){for(var e=[],r=0;;){let{done:n,value:i}=await t.read();if(n)break;e.push(i),r+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(r.modelAssetBuffer).then(e=>{Zn(t,e)})}return Promise.resolve()}function ti(t){try{let e=t.o.length;if(1===e)throw Error(t.o[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.o.map(t=>t.message).join(", "))}finally{t.o=[]}}var ei=class{constructor(t){this.j=t,this.o=[],this.j.setAutoRenderToScreen(!1)}setGraph(t,e){this.j.attachErrorListener((t,e)=>{this.o.push(Error(e))}),this.j.la(),this.j.setGraph(t,e),this.l?.Z(),ti(this)}finishProcessing(t){this.j.finishProcessing(),ti(this),this.l&&void 0!==t&&this.l.S(t)}close(){this.l?.ia(),this.l?.close(),this.j.closeGraph()}};function ri(t,e){var r="object"==typeof t&&null!==t,n=(r?t.imageBytes:void 0)??e?.imageBytes;return e=(r?t.audioSamples:void 0)??e?.audioSamples,{text:r?t.text??"":t,imageBytes:n,audioSamples:e,N:!!(n&&n.byteLength>0)||!!(e&&e.length>0)}}function ni(t){return(t=t.trim())?Math.max(1,Math.ceil(t.length/4)):0}function ii(t){var e={};if(t.criteria)for(let[r,n]of Object.entries(t.criteria))e[r]=n;if(t.options)for(let r of t.options)e[r.label]=r.description??"";return e}function oi(t){if(t.options&&t.options.length>0){var e=t.options.map(t=>t.description?`${t.label}: ${t.description}`:t.label),r=(t=t.options.map(t=>t.label)).map(t=>Number(t)),n=r.every(t=>Number.isFinite(t))&&t.every(t=>""!==t.trim());return r=n?r:t.map((t,e)=>e),{rubric:e,labels:t,R:r,P:n}}return t=(e=t.rubric??[]).map((t,e)=>String(e)),n=e.map((t,e)=>e),{rubric:e,labels:t,R:n,P:!1}}function ai(t,e,r,n){var i=t.probabilities??[],o=0,a=-1,s=0;for(let t=0;t<i.length;t++){let e=i[t];e>a&&(a=e,o=t),s+=(t<r.length?r[t]:t)*e}return{...t,expectedScore:n&&i.length>0?s:t.expectedScore,selectedKey:o<e.length?e[o]:t.selectedKey??String(o)}}ei.prototype.close=ei.prototype.close;var si=[];async function ui(t,e){var r=si.pop();if(r){Yn(t=new pi(r,null),e);try{return await t.T(e),t}catch(e){throw t.close(),e}}return async function(t,e){return Xn(t,e)}(t,e)}function li(t,e){var r=t.X.then(()=>{var r=t.ba++;return t.l&&(1===t.backendType||-1===t.backendType?function(t,e){++t.i.F,t.j.set(e,performance.now())}(t.l,r):function(t,e){++t.i.H,t.j.set(e,performance.now())}(t.l,r)),Promise.resolve().then(e).then(e=>(t.l?.S(r),e),e=>{throw t.l?.S(r),e})});return t.X=r.then(()=>{},()=>{}),r}function hi(t){if(!t)return 0;var e=t.context?ni(t.context):0;for(let r of t.questions??[]){e+=ni(r.prompt)+4;for(let t of r.options??[])e+=ni(t.description?`${t.label}: ${t.description}`:t.label)+2}return e}function ci(t){if(t.byteLength>=30&&80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]){let e=t[26]|t[27]<<8;if(e+(t=t[28]|t[29]<<8)<=4096)return 30+e+t}return 0}function fi(t,e,r=0){if(t=t.j.h,e<64){if(!(r=t._malloc(e)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:r,v:r}}if(!(t=t._malloc(e+64)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:(t+r+63&-64)-r>>>0,v:t}}async function di(t,e,r,n){var i=t.j.h;if(r instanceof Uint8Array){var o=r.byteLength;if(0===o)return{u:0,v:0,size:0};let{u:e,v:n}=fi(t,o,ci(r));return i.HEAPU8.set(r,e),{u:e,v:n,size:o}}if(n=n&&n>0?n:0,!r&&e){if(e=e.toString(),!(r=await fetch(e)).ok||!r.body)throw Error(`Failed to fetch asset: ${e} (${r.status})`);(e=Number(r.headers.get("content-length")||0))>0&&(n=e),r=r.body.getReader()}if(!r)return{u:0,v:0,size:0};if(n>0){e=[];for(var a=0;a<30;){let{value:t,done:n}=await r.read();if(n)break;t&&t.byteLength>0&&(e.push(t),a+=Number(t.byteLength))}if(0===a)return{u:0,v:0,size:0};let u=e[0];if(u.byteLength<30&&e.length>1)for(var s of(u=new Uint8Array(Math.min(a,30)),a=0,e)){let t=Math.min(s.byteLength,u.byteLength-a);if(u.set(s.subarray(0,t),a),(a+=t)>=u.byteLength)break}let{u:l,v:h}=fi(t,n,ci(u));for(o of(t=0,e)){if(t+(s=Number(o.byteLength))>n)throw i._free(h),Error(`Stream exceeded expected content-length (${n} bytes).`);i.HEAPU8.set(o,l+t>>>0),t+=s}for(e.length=0;;){let{value:e,done:a}=await r.read();if(a)break;if(e&&e.byteLength>0){if(t+(o=Number(e.byteLength))>n)throw i._free(h),Error(`Stream exceeded expected content-length (${n} bytes).`);i.HEAPU8.set(e,l+t>>>0),t+=o}}return{u:l,v:h,size:t}}for(o=[],n=0;;){let{value:t,done:e}=await r.read();if(e)break;t&&t.byteLength>0&&(s=Number(t.byteLength),o.push(t),n+=s)}if(0===n)return{u:0,v:0,size:0};r=o[0];var{u:u,v:l}=fi(t,n,r?ci(r):0);for(t=0,r=0;r<o.length;r++)(s=o[r])&&(i.HEAPU8.set(s,u+t>>>0),t+=s.byteLength,o[r]=void 0);return{u:u,v:l,size:n}}var pi=class extends ei{constructor(t,e){super(new Jn(t,e)),this.baseOptions=new hn,this.L=this.C=this.K=this.A=this.i=this.maxNumTokens=this.backendType=0,this.Y=!1,this.ba=this.J=0,this.X=Promise.resolve()}get contextWindow(){return this.maxNumTokens}get contextUsage(){return this.J}U(t){this.O=t,this.J=hi(t)}async ka(t){if(0!==this.i){var e=t.questions??[];if(0!==e.length){var r=this.j.h;"function"==typeof r.prewarmSchema?await li(this,()=>r.prewarmSchema(this.i,t.context??"",e)):await li(this,()=>r.evaluateSchema(this.i,"__PREWARM__",t.context??"",e))}}}async ja(t,e){return t=e?.context?`${e.context}\n${t}`:t,hi(this.O)+ni(t)}async T(t){if(0!==this.i)throw Error("Decision does not support updating options after initialization.");if("CPU"===t.baseOptions?.delegate?this.backendType=-1:void 0!==t.backendType&&(this.backendType=t.backendType),void 0!==t.maxNumTokens&&(this.maxNumTokens=t.maxNumTokens),t.schema?this.U(t.schema):(t.questions||t.context||t.expectedInputs)&&this.U({context:t.context,expectedInputs:t.expectedInputs,questions:t.questions}),-1===this.backendType){this.j.h.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.j.h).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),n=r?.info,i=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${n?.vendor??""} ${n?.architecture??""} ${n?.description??""}`);if(r&&!i){for(var o of(i=[],["shader-f16","subgroups"]))r.features.has(o)&&i.push(o);o={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(o[t]=e)}let t=await r.requestDevice({requiredFeatures:i,requiredLimits:o});if(!t.adapterInfo&&n)try{Object.defineProperty(t,"adapterInfo",{value:n,writable:!0,configurable:!0})}catch{try{t.adapterInfo=n}catch{}}e.preinitializedWebGPUDevice=t}}e.preinitializedWebGPUDevice&&("object"==typeof(r=self).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}if(r=e=this.j.h,(n=!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer))&&"function"==typeof e.createDecisionFromBuffers&&"function"==typeof r._malloc){if(r=await di(this,t.baseOptions?.modelAssetPath,t.baseOptions?.modelAssetBuffer,t.modelAssetSize),this.A=r.u,this.K=r.v,n=0,t.companionPleAssetPath||t.companionPleAssetBuffer)try{let e=await di(this,t.companionPleAssetPath,t.companionPleAssetBuffer,t.companionPleAssetSize);this.C=e.u,this.L=e.v,n=e.size}catch(t){console.warn("Optional companion per-layer embedder not loaded:",t)}this.i=await e.createDecisionFromBuffers(this.A,r.size,this.C,n,this.backendType,this.maxNumTokens)}else await Qn(this,t,n),this.i=await e.createDecision("/model.litertlm",this.backendType,this.maxNumTokens);this.l?.Z()}evaluateBoolean(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,n=e.context?`${e.context}\n${e.condition}`:e.condition,i=ri(t,e);return i.N?li(this,()=>r.evaluateContextBoolean(this.i,i.text,n,e.threshold??.5,e.temperature??0,{imageBytes:i.imageBytes,audioSamples:i.audioSamples})):li(this,()=>r.evaluateBoolean(this.i,i.text,n,e.threshold??.5,e.temperature??0))}evaluateChoice(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,n=ii(e),i=e.instructions??"",o=e.context?i?`${e.context}\n${i}`:e.context:i,a=ri(t,e);return t=(e.options??[]).some(t=>t.imageBytes&&t.imageBytes.byteLength>0||t.audioSamples&&t.audioSamples.length>0),a.N||t?li(this,()=>r.evaluateContextChoice(this.i,a.text,n,e.options??[],e.temperature??0,o,{imageBytes:a.imageBytes,audioSamples:a.audioSamples})):li(this,()=>r.evaluateChoice(this.i,a.text,n,e.temperature??0,o))}async evaluateScore(t,e){if(0===this.i)throw Error("Decision is already closed.");var r=this.j.h,{rubric:n,labels:i,R:o,P:a}=oi(e),s=e.instructions??"",u=e.context?s?`${e.context}\n${s}`:e.context:s,l=ri(t,e);return ai(t=l.N?await li(this,()=>r.evaluateContextScore(this.i,l.text,n,e.temperature??0,u,{imageBytes:l.imageBytes,audioSamples:l.audioSamples})):await li(this,()=>r.evaluateScore(this.i,l.text,n,e.temperature??0,u)),i,o,a)}async evaluate(t,e,r){if(0===this.i)throw Error("Decision is already closed.");if(r?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");var n=ri(t,r),i=r?.context?n.text?`${r.context}\n${n.text}`:r.context:n.text,o=e.context;t=(n.imageBytes&&n.imageBytes.byteLength>0?70:0)+(n.audioSamples&&n.audioSamples.length>0?Math.ceil(n.audioSamples.length/640):0),this.J=hi(e)+ni(i)+t;var a=this.j.h,s=e.questions??[];return 0===s.length?{}:(e=s.some(t=>(t.options??[]).some(t=>t.imageBytes&&t.imageBytes.byteLength>0||t.audioSamples&&t.audioSamples.length>0)),n.N||e?li(this,()=>a.evaluateContextSchema(this.i,i,o??"",s,{imageBytes:n.imageBytes,audioSamples:n.audioSamples})):li(this,()=>a.evaluateSchema(this.i,i,o??"",s)))}async da(t,e,r){var n=[];for(let i of t)n.push(await this.evaluate(i,e,r));return n}async ca(t,e){if(!this.O)throw Error("No session schema configured. Pass `schema` or `questions` in DecisionMakerOptions or call setSchema() before classify().");return this.evaluate(t,this.O,e)}async evaluateBooleanBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,i=e.context?`${e.context}\n${e.condition}`:e.condition;if("function"==typeof n.evaluateBooleanBatch)return li(this,()=>n.evaluateBooleanBatch(this.i,t,i,e.threshold??.5,e.temperature??0,r));var o=[];for(let n of t)o.push(await this.evaluateBoolean(r?`${r}\n${n}`:n,e));return o}async evaluateChoiceBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,i=ii(e),o=e.instructions??"",a=e.context?o?`${e.context}\n${o}`:e.context:o;if("function"==typeof n.evaluateChoiceBatch)return li(this,()=>n.evaluateChoiceBatch(this.i,t,i,e.temperature??0,a,r));o=[];for(let n of t)o.push(await this.evaluateChoice(r?`${r}\n${n}`:n,e));return o}async evaluateScoreBatch(t,e,r=""){if(0===this.i)throw Error("Decision is already closed.");if(0===t.length)return[];var n=this.j.h,{rubric:i,labels:o,R:a,P:s}=oi(e),u=e.instructions??"",l=e.context?u?`${e.context}\n${u}`:e.context:u;if("function"==typeof n.evaluateScoreBatch)return(await li(this,()=>n.evaluateScoreBatch(this.i,t,i,e.temperature??0,l,r))).map(t=>ai(t,o,a,s));u=[];for(let n of t)u.push(await this.evaluateScore(r?`${r}\n${n}`:n,e));return u}close(){if(!this.Y){this.Y=!0;var t=this.j.h;if(0!==this.i){try{t.deleteDecision(this.i)}catch{}this.i=0}var e=this.K||this.A;if(0!==e){try{t._free(e)}catch{}this.K=this.A=0}if(0!==(e=this.L||this.C)){try{t._free(e)}catch{}this.L=this.C=0}super.close(),t&&!si.includes(t)&&si.push(t)}}};pi.prototype.close=pi.prototype.close,pi.prototype.evaluateScoreBatch=pi.prototype.evaluateScoreBatch,pi.prototype.evaluateChoiceBatch=pi.prototype.evaluateChoiceBatch,pi.prototype.evaluateBooleanBatch=pi.prototype.evaluateBooleanBatch,pi.prototype.classify=pi.prototype.ca,pi.prototype.evaluateBatch=pi.prototype.da,pi.prototype.evaluate=pi.prototype.evaluate,pi.prototype.evaluateScore=pi.prototype.evaluateScore,pi.prototype.evaluateChoice=pi.prototype.evaluateChoice,pi.prototype.evaluateBoolean=pi.prototype.evaluateBoolean,pi.prototype.setOptions=pi.prototype.T,pi.prototype.measureContextUsage=pi.prototype.ja,pi.prototype.prewarm=pi.prototype.ka,pi.prototype.setSchema=pi.prototype.U,pi.createFromModelBuffer=function(t,e,r=0,n=0){return ui(t,{baseOptions:{modelAssetBuffer:e},backendType:r,maxNumTokens:n})},pi.createFromModelPath=function(t,e,r=0,n=0){return ui(t,{baseOptions:{modelAssetPath:e},backendType:r,maxNumTokens:n})},pi.createFromOptions=ui,exports.DecisionMaker=pi,exports.FilesetResolver=fn,exports.TaskRunner=ei;
2
2
  //# sourceMappingURL=decision_bundle_cjs.js.map