diff --git a/DOCUMENTATION/FORDEV.md b/DOCUMENTATION/FORDEV.md
index 9605080..36afe54 100644
--- a/DOCUMENTATION/FORDEV.md
+++ b/DOCUMENTATION/FORDEV.md
@@ -1,7 +1,12 @@
-To apply changes to the app, run `npm run dev` to build the APK and `npm run android` to sync the changes to the android project.
+To build the native Android TV app APK, run:
+```bash
+npm run dev
+```
+This builds the Vyla JS resolver asset and compiles the native Android TV app via `./gradlew assembleDebug` to produce `vyla.apk`.
-To release a new version, run
+To open and develop in Android Studio, open the `android` folder directly.
+To release a new version:
```bash
npm version patch
git push origin main
diff --git a/android/app/build.gradle b/android/app/build.gradle
index b8c1fe4..f87484b 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -1,21 +1,20 @@
apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-parcelize'
android {
namespace "tv.vyla.app"
- compileSdk rootProject.ext.compileSdkVersion
+ compileSdk 34
+
defaultConfig {
applicationId "tv.vyla.app"
- minSdkVersion rootProject.ext.minSdkVersion
- targetSdkVersion rootProject.ext.targetSdkVersion
+ minSdkVersion 24
+ targetSdkVersion 34
versionCode 1
- versionName "1.0"
+ versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- aaptOptions {
- // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
- // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
- ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
- }
}
+
buildTypes {
release {
signingConfig signingConfigs.debug
@@ -23,35 +22,58 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
-}
-repositories {
- flatDir{
- dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = '17'
+ }
+
+ buildFeatures {
+ compose true
+ }
+
+ composeOptions {
+ kotlinCompilerExtensionVersion '1.5.10'
}
}
dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
- implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
- implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
- implementation project(':capacitor-android')
- testImplementation "junit:junit:$junitVersion"
- androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
- androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
- implementation project(':capacitor-cordova-android-plugins')
+ implementation "androidx.core:core-ktx:1.12.0"
+ implementation "androidx.appcompat:appcompat:1.6.1"
+ implementation "androidx.activity:activity-compose:1.8.2"
+
+ implementation platform("androidx.compose:compose-bom:2024.02.02")
+ implementation "androidx.compose.ui:ui"
+ implementation "androidx.compose.ui:ui-graphics"
+ implementation "androidx.compose.ui:ui-tooling-preview"
+ implementation "androidx.compose.material3:material3"
+ implementation "androidx.compose.material:material-icons-extended"
+
+ implementation "androidx.tv:tv-material:1.0.0"
+
+ implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0"
+ implementation "androidx.lifecycle:lifecycle-runtime-compose:2.7.0"
+
+ implementation "io.coil-kt:coil-compose:2.6.0"
+
+ implementation "androidx.media3:media3-exoplayer:1.3.1"
+ implementation "androidx.media3:media3-exoplayer-hls:1.3.1"
+ implementation "androidx.media3:media3-ui:1.3.1"
+ implementation "androidx.media3:media3-common:1.3.1"
+ implementation "androidx.media3:media3-session:1.3.1"
+
implementation "com.squareup.okhttp3:okhttp:4.12.0"
+ implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "org.nanohttpd:nanohttpd:2.3.1"
-}
-apply from: 'capacitor.build.gradle'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"
-try {
- def servicesJSON = file('google-services.json')
- if (servicesJSON.text) {
- apply plugin: 'com.google.gms.google-services'
- }
-} catch(Exception e) {
- logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
+ testImplementation "junit:junit:4.13.2"
+ androidTestImplementation "androidx.test.ext:junit:1.1.5"
+ androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
}
diff --git a/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java
index f2c2217..8824bed 100644
--- a/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java
+++ b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java
@@ -18,7 +18,6 @@ public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
- // Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.getcapacitor.app", appContext.getPackageName());
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 5c8716f..e952955 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -7,12 +7,13 @@
@@ -21,7 +22,7 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name=".MainActivity"
android:label="@string/title_activity_main"
- android:theme="@style/AppTheme.NoActionBarLaunch"
+ android:theme="@style/AppTheme.NoActionBar"
android:banner="@drawable/tv_banner"
android:launchMode="singleTask"
android:exported="true"
@@ -34,19 +35,5 @@
-
-
-
-
-
-
-
-
diff --git a/android/app/src/main/assets/vyla-local.js b/android/app/src/main/assets/vyla-local.js
new file mode 100644
index 0000000..ffbe885
--- /dev/null
+++ b/android/app/src/main/assets/vyla-local.js
@@ -0,0 +1,18 @@
+(()=>{var Dn=Object.create;var $e=Object.defineProperty;var Hn=Object.getOwnPropertyDescriptor;var qn=Object.getOwnPropertyNames;var Kn=Object.getPrototypeOf,zn=Object.prototype.hasOwnProperty;var Pr=r=>t=>{var e=r[t];if(e)return e();throw new Error("Module not found in bundle: "+t)};var F=(r,t)=>()=>(r&&(t=r(r=0)),t);var Be=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Q=(r,t)=>{for(var e in t)$e(r,e,{get:t[e],enumerable:!0})},Gn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qn(t))!zn.call(r,i)&&i!==e&&$e(r,i,{get:()=>t[i],enumerable:!(n=Hn(t,i))||n.enumerable});return r};var Vn=(r,t,e)=>(e=r!=null?Dn(Kn(r)):{},Gn(t||!r||!r.__esModule?$e(e,"default",{value:r,enumerable:!0}):e,r));var Nr=Be(It=>{"use strict";$();It.byteLength=Jn;It.toByteArray=Wn;It.fromByteArray=ei;var X=[],G=[],Xn=typeof Uint8Array<"u"?Uint8Array:Array,ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(nt=0,Lr=ve.length;nt0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function Jn(r){var t=Or(r),e=t[0],n=t[1];return(e+n)*3/4-n}function Yn(r,t,e){return(t+e)*3/4-e}function Wn(r){var t,e=Or(r),n=e[0],i=e[1],s=new Xn(Yn(r,n,i)),o=0,l=i>0?n-4:n,a;for(a=0;a>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=G[r.charCodeAt(a)]<<2|G[r.charCodeAt(a+1)]>>4,s[o++]=t&255),i===1&&(t=G[r.charCodeAt(a)]<<10|G[r.charCodeAt(a+1)]<<4|G[r.charCodeAt(a+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function Zn(r){return X[r>>18&63]+X[r>>12&63]+X[r>>6&63]+X[r&63]}function ti(r,t,e){for(var n,i=[],s=t;sl?l:o+s));return n===1?(t=r[e-1],i.push(X[t>>2]+X[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(X[t>>10]+X[t>>4&63]+X[t<<2&63]+"=")),i.join("")}});var jr=Be(Ue=>{$();Ue.read=function(r,t,e,n,i){var s,o,l=i*8-n-1,a=(1<>1,f=-7,u=e?i-1:0,p=e?-1:1,m=r[t+u];for(u+=p,s=m&(1<<-f)-1,m>>=-f,f+=l;f>0;s=s*256+r[t+u],u+=p,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+r[t+u],u+=p,f-=8);if(s===0)s=1-c;else{if(s===a)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(m?-1:1)*o*Math.pow(2,s-n)};Ue.write=function(r,t,e,n,i,s){var o,l,a,c=s*8-i-1,f=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,h=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+u>=1?t+=p/a:t+=p*Math.pow(2,1-u),t*a>=2&&(o++,a/=2),o+u>=f?(l=0,o=f):o+u>=1?(l=(t*a-1)*Math.pow(2,i),o=o+u):(l=t*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;r[e+m]=l&255,m+=h,l/=256,i-=8);for(o=o<0;r[e+m]=o&255,m+=h,o/=256,c-=8);r[e+m-h]|=A*128}});var sn=Be(pt=>{"use strict";$();var Re=Nr(),ut=jr(),Dr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pt.Buffer=g;pt.SlowBuffer=ai;pt.INSPECT_MAX_BYTES=50;var $t=2147483647;pt.kMaxLength=$t;g.TYPED_ARRAY_SUPPORT=ri();!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ri(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function W(r){if(r>$t)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,g.prototype),t}function g(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Fe(r)}return zr(r,t,e)}g.poolSize=8192;function zr(r,t,e){if(typeof r=="string")return ii(r,t);if(ArrayBuffer.isView(r))return si(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(J(r,ArrayBuffer)||r&&J(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(r,SharedArrayBuffer)||r&&J(r.buffer,SharedArrayBuffer)))return ke(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return g.from(n,t,e);let i=oi(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return g.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}g.from=function(r,t,e){return zr(r,t,e)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function Gr(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function ni(r,t,e){return Gr(r),r<=0?W(r):t!==void 0?typeof e=="string"?W(r).fill(t,e):W(r).fill(t):W(r)}g.alloc=function(r,t,e){return ni(r,t,e)};function Fe(r){return Gr(r),W(r<0?0:Te(r)|0)}g.allocUnsafe=function(r){return Fe(r)};g.allocUnsafeSlow=function(r){return Fe(r)};function ii(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!g.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Vr(r,t)|0,n=W(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function Ce(r){let t=r.length<0?0:Te(r.length)|0,e=W(t);for(let n=0;n=$t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+$t.toString(16)+" bytes");return r|0}function ai(r){return+r!=r&&(r=0),g.alloc(+r)}g.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==g.prototype};g.compare=function(t,e){if(J(t,Uint8Array)&&(t=g.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.isBuffer(t)||!g.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let s=0,o=Math.min(n,i);si.length?(g.isBuffer(o)||(o=g.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(g.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Vr(r,t){if(g.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||J(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return _e(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return nn(r).length;default:if(i)return n?-1:_e(r).length;t=(""+t).toLowerCase(),i=!0}}g.byteLength=Vr;function li(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return yi(this,t,e);case"utf8":case"utf-8":return Jr(this,t,e);case"ascii":return di(this,t,e);case"latin1":case"binary":return gi(this,t,e);case"base64":return mi(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wi(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}g.prototype._isBuffer=!0;function it(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}g.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ee&&(t+=" ... "),""};Dr&&(g.prototype[Dr]=g.prototype.inspect);g.prototype.compare=function(t,e,n,i,s){if(J(t,Uint8Array)&&(t=g.from(t,t.offset,t.byteLength)),!g.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let o=s-i,l=n-e,a=Math.min(o,l),c=this.slice(i,s),f=t.slice(e,n);for(let u=0;u2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Me(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=g.from(t,n)),g.isBuffer(t))return t.length===0?-1:Hr(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Hr(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Hr(r,t,e,n,i){let s=1,o=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,l/=2,e/=2}function a(f,u){return s===1?f[u]:f.readUInt16BE(u*s)}let c;if(i){let f=-1;for(c=e;co&&(e=o-l),c=e;c>=0;c--){let f=!0;for(let u=0;ui&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return ci(this,t,e,n);case"utf8":case"utf-8":return ui(this,t,e,n);case"ascii":case"latin1":case"binary":return fi(this,t,e,n);case"base64":return pi(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hi(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mi(r,t,e){return t===0&&e===r.length?Re.fromByteArray(r):Re.fromByteArray(r.slice(t,e))}function Jr(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i239?4:s>223?3:s>191?2:1;if(i+l<=e){let a,c,f,u;switch(l){case 1:s<128&&(o=s);break;case 2:a=r[i+1],(a&192)===128&&(u=(s&31)<<6|a&63,u>127&&(o=u));break;case 3:a=r[i+1],c=r[i+2],(a&192)===128&&(c&192)===128&&(u=(s&15)<<12|(a&63)<<6|c&63,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:a=r[i+1],c=r[i+2],f=r[i+3],(a&192)===128&&(c&192)===128&&(f&192)===128&&(u=(s&15)<<18|(a&63)<<12|(c&63)<<6|f&63,u>65535&&u<1114112&&(o=u))}}o===null?(o=65533,l=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=l}return Ai(n)}var qr=4096;function Ai(r){let t=r.length;if(t<=qr)return String.fromCharCode.apply(String,r);let e="",n=0;for(;nn)&&(e=n);let i="";for(let s=t;sn&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),ee)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||N(t,e,this.length);let i=this[t],s=1,o=0;for(;++o>>0,e=e>>>0,n||N(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};g.prototype.readUint8=g.prototype.readUInt8=function(t,e){return t=t>>>0,e||N(t,1,this.length),this[t]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||N(t,2,this.length),this[t]|this[t+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||N(t,2,this.length),this[t]<<8|this[t+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||N(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};g.prototype.readBigUInt64LE=tt(function(t){t=t>>>0,ft(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&yt(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,ft(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&yt(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<>>0,e=e>>>0,n||N(t,e,this.length);let i=this[t],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*e)),i};g.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||N(t,e,this.length);let i=e,s=1,o=this[t+--i];for(;i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};g.prototype.readInt8=function(t,e){return t=t>>>0,e||N(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};g.prototype.readInt16LE=function(t,e){t=t>>>0,e||N(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};g.prototype.readInt16BE=function(t,e){t=t>>>0,e||N(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};g.prototype.readInt32LE=function(t,e){return t=t>>>0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};g.prototype.readInt32BE=function(t,e){return t=t>>>0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};g.prototype.readBigInt64LE=tt(function(t){t=t>>>0,ft(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&yt(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<>>0,ft(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&yt(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,e||N(t,4,this.length),ut.read(this,t,!0,23,4)};g.prototype.readFloatBE=function(t,e){return t=t>>>0,e||N(t,4,this.length),ut.read(this,t,!1,23,4)};g.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||N(t,8,this.length),ut.read(this,t,!0,52,8)};g.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||N(t,8,this.length),ut.read(this,t,!1,52,8)};function q(r,t,e,n,i,s){if(!g.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||tr.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;q(this,t,e,n,l,0)}let s=1,o=0;for(this[e]=t&255;++o>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;q(this,t,e,n,l,0)}let s=n-1,o=1;for(this[e+s]=t&255;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+n};g.prototype.writeUint8=g.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,255,0),this[e]=t&255,e+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function Yr(r,t,e,n,i){rn(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,e}function Wr(r,t,e,n,i){rn(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=o,o=o>>8,r[e+2]=o,o=o>>8,r[e+1]=o,o=o>>8,r[e]=o,e+8}g.prototype.writeBigUInt64LE=tt(function(t,e=0){return Yr(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=tt(function(t,e=0){return Wr(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let a=Math.pow(2,8*n-1);q(this,t,e,n,a-1,-a)}let s=0,o=1,l=0;for(this[e]=t&255;++s>0)-l&255;return e+n};g.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let a=Math.pow(2,8*n-1);q(this,t,e,n,a-1,-a)}let s=n-1,o=1,l=0;for(this[e+s]=t&255;--s>=0&&(o*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/o>>0)-l&255;return e+n};g.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};g.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};g.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};g.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};g.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};g.prototype.writeBigInt64LE=tt(function(t,e=0){return Yr(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=tt(function(t,e=0){return Wr(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Zr(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function tn(r,t,e,n,i){return t=+t,e=e>>>0,i||Zr(r,t,e,4,34028234663852886e22,-34028234663852886e22),ut.write(r,t,e,n,23,4),e+4}g.prototype.writeFloatLE=function(t,e,n){return tn(this,t,e,!0,n)};g.prototype.writeFloatBE=function(t,e,n){return tn(this,t,e,!1,n)};function en(r,t,e,n,i){return t=+t,e=e>>>0,i||Zr(r,t,e,8,17976931348623157e292,-17976931348623157e292),ut.write(r,t,e,n,52,8),e+8}g.prototype.writeDoubleLE=function(t,e,n){return en(this,t,e,!0,n)};g.prototype.writeDoubleBE=function(t,e,n){return en(this,t,e,!1,n)};g.prototype.copy=function(t,e,n,i){if(!g.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?i=Kr(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=Kr(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function Kr(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function Ei(r,t,e){ft(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&yt(t,r.length-(e+1))}function rn(r,t,e,n,i,s){if(r>e||r3?t===0||t===BigInt(0)?l=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:l=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:l=`>= ${t}${o} and <= ${e}${o}`,new ct.ERR_OUT_OF_RANGE("value",l,r)}Ei(n,i,s)}function ft(r,t){if(typeof r!="number")throw new ct.ERR_INVALID_ARG_TYPE(t,"number",r)}function yt(r,t,e){throw Math.floor(r)!==r?(ft(r,e),new ct.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new ct.ERR_BUFFER_OUT_OF_BOUNDS:new ct.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var xi=/[^+/0-9A-Za-z-_]/g;function bi(r){if(r=r.split("=")[0],r=r.trim().replace(xi,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function _e(r,t){t=t||1/0;let e,n=r.length,i=null,s=[];for(let o=0;o55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function Si(r){let t=[];for(let e=0;e>8,i=e%256,s.push(i),s.push(n);return s}function nn(r){return Re.toByteArray(bi(r))}function Bt(r,t,e,n){let i;for(i=0;i=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function J(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Me(r){return r!==r}var $i=(function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t})();function tt(r){return typeof BigInt>"u"?Bi:r}function Bi(){throw new Error("BigInt not supported")}});var R,$=F(()=>{R=Vn(sn(),1);globalThis.Buffer=globalThis.Buffer||R.Buffer;globalThis.process=globalThis.process||{env:{}};AbortSignal.timeout||(AbortSignal.timeout=r=>{let t=new AbortController;return setTimeout(()=>t.abort(),r),t.signal})});var Pe,Le=F(()=>{$();Pe=globalThis.crypto});async function k(r,t){let e=await fetch(r,t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async function H(r,t){let e=await fetch(r,t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.text()}function Oe(r){let t=Date.now();for(let[e,n]of r)t-n.ts>=n.ttl&&r.delete(e);if(r.size>3e3){let e=r.size-3e3,n=r.keys();for(let i=0;i=e.ttl){r.delete(t);return}return e.val}}function Ci(r,t,e,n){r.set(t,{val:e,ts:Date.now(),ttl:n})}async function ln(r,t,e,n,i,s=null){let o=/dub$/.test(r.key)?"dub":"sub";return{id:e,s:n,e:i,clientIP:s,absoluteBase:"/",audio:o,sdk:t,config:r}}async function K(r,t,e,n){var f,u,p;let i=r,s=t,o=e,l=n;i==="movie"||i==="tv"?(o=i,s=t,i=process.env.TMDB_API_KEY):(s==="movie"||s==="tv")&&(o=s,s=i,i=process.env.TMDB_API_KEY),i||(i=process.env.TMDB_API_KEY);let a=`${s}-${o}-${l||""}`,c=Ri(je,a);if(c!==void 0)return c;if(!i)return{isAnime:!1,titles:[],year:null,imdbId:null};try{let[m,h]=await Promise.all([fetch(`https://api.themoviedb.org/3/${o}/${s}?api_key=${i}&append_to_response=external_ids`,{signal:AbortSignal.timeout(5e3)}),l&&o==="tv"?fetch(`https://api.themoviedb.org/3/tv/${s}/season/${l}?api_key=${i}`,{signal:AbortSignal.timeout(5e3)}):Promise.resolve(null)]),A=null,d=null;m.ok?A=await m.json():(f=m.body)==null||f.cancel(),h&&(h.ok?d=await h.json():(u=h.body)==null||u.cancel());let I=((A==null?void 0:A.genres)||[]).some(E=>E.id===16)&&(((A==null?void 0:A.origin_country)||[]).includes("JP")||(A==null?void 0:A.original_language)==="ja"),b=[];d!=null&&d.name&&b.push(d.name);let y=(A==null?void 0:A.title)||(A==null?void 0:A.name)||"",x=(A==null?void 0:A.original_title)||(A==null?void 0:A.original_name)||"";y&&b.push(y),x&&x!==y&&b.push(x);let S=(d==null?void 0:d.air_date)||(A==null?void 0:A.release_date)||(A==null?void 0:A.first_air_date)||"",U={isAnime:I,titles:[...new Set(b.filter(Boolean))],year:S?parseInt(S.slice(0,4),10):null,imdbId:(A==null?void 0:A.imdb_id)||((p=A==null?void 0:A.external_ids)==null?void 0:p.imdb_id)||null};return Ci(je,a,U,6e5),U}catch{return{isAnime:!1,titles:[],year:null,imdbId:null}}}var Ne,j,v,je,vi,Ui,T=F(()=>{$();Le();Ne=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15","Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"],j=()=>Ne[Math.floor(Math.random()*Ne.length)],v=Ne[0];je=new Map,vi=new Map,Ui=new Map;setInterval(()=>{Oe(Ui),Oe(je),Oe(vi)},6e4)});var vt={};Q(vt,{getStream:()=>_i});async function ki(r,t,e,n){let i=(n==null?void 0:n.titles)||[],s=[];for(let l of i){let a=l.toLowerCase().replace(/[^a-z0-9\s]/g," ").replace(/\s+/g," ").trim();s.includes(a)||s.push(a);let c=l.split(/[\s:]+/).filter(f=>f.length>2);if(c.length>=2){let f=c.slice(0,3).join(" ").toLowerCase();s.includes(f)||s.push(f)}}let o=[];for(let l of s){try{let c=(await k(`https://123animehub.cc/ajax/film/search?keyword=${encodeURIComponent(l)}&_=${Date.now()}`,{headers:{"X-Requested-With":"XMLHttpRequest",Referer:"https://123animehub.cc",Accept:"application/json","User-Agent":v},signal:AbortSignal.timeout(8e3)})).html||"",f=0;for(;(f=c.indexOf('href="/anime/',f))!==-1;){let u=f+13,p=c.indexOf('"',u),m=c.slice(u,p);o.includes(m)||o.push(m),f=p}}catch{}if(o.length)break}for(let l of o)try{let a=await k(`https://123animehub.cc/ajax/episode/info?epr=${encodeURIComponent(t?`${l}/${t}/${e}`:`${l}/1`)}&ts=1&_=${Date.now()}`,{headers:{Referer:`https://123animehub.cc/anime/${l}`,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/javascript, */*; q=0.01","User-Agent":v},signal:AbortSignal.timeout(1e4)});if(a!=null&&a.target)return a.target}catch{}return null}async function _i({id:r,s:t,e}){if(!t)return null;let n=await K(r,"tv",t);if(!n.isAnime)return null;let i=await ki(r,t,e,n);if(!i)return null;let s=i.match(/\/embed-[^/]+\/([A-Za-z0-9+/=]+)$/);if(!s)return null;let o=new URL(i).origin;try{let l=await fetch(i,{headers:{"User-Agent":v},signal:AbortSignal.timeout(1e4)});if(!l.ok)return null;let a=l.headers.get("set-cookie"),c=await k(`${o}/hs/getSources?id=${s[1]}`,{headers:{Referer:i,Accept:"*/*","User-Agent":v,...a?{Cookie:a.split(";")[0].trim()}:{}},signal:AbortSignal.timeout(1e4)}),f=typeof c.sources=="string"&&c.sources.length?c.sources:Array.isArray(c.sources)&&c.sources.length?c.sources[0].file||c.sources[0].src||c.sources[0].url:null;if(f)return{url:f,headers:{Referer:"https://play2.echovideo.ru/",Origin:"https://play2.echovideo.ru"}}}catch{}return null}var De=F(()=>{$();T()});var Ut={};Q(Ut,{getStream:()=>Mi});function Ti(r){let t="https://a.111477.xyz/::sort=file-desc::limit=3";r&&(t+=`::tmdb=${r}`);let e=R.Buffer.from(t,"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${Fi}/config/${e}`}async function Qi(r,t,e){var s;let n=(r==null?void 0:r.tmdbApiKey)||process.env.TMDB_API_KEY;if(!n)return null;let i=e?"tv":"movie";try{let o=await fetch(`https://api.themoviedb.org/3/${i}/${t}?api_key=${n}&append_to_response=external_ids`,{signal:AbortSignal.timeout(6e3)});if(!o.ok)return null;let l=await o.json();return l.imdb_id||((s=l.external_ids)==null?void 0:s.imdb_id)||null}catch{return null}}async function Mi({id:r,s:t,e,sdk:n}){let i=!!(t&&e),s=j(),o=(n==null?void 0:n.tmdbApiKey)||process.env.TMDB_API_KEY,l=await Qi(n,r,i),a=[];l&&l.startsWith("tt")&&a.push(l),a.push(`tmdb:${r}`);let c=Ti(o),f=new Set,u=[],p={"User-Agent":s,Accept:"application/json, text/plain, */*"};for(let m of a){let h=i?`${c}/stream/series/${m}:${t||1}:${e||1}.json`:`${c}/stream/movie/${m}.json`;try{let A=await fetch(h,{headers:p,signal:AbortSignal.timeout(12e3)});if(!A.ok)continue;let d=await A.json();if(Array.isArray(d==null?void 0:d.streams)&&d.streams.length>0){for(let w of d.streams){if(!w||typeof w!="object")continue;let I=String(w.url||"").trim();if(!I||!I.startsWith("http")||f.has(I))continue;f.add(I);let b=w.title?String(w.title).trim():"",y=w.name?String(w.name).trim():"111477",x=b||y;u.push({url:I,label:x,headers:p})}if(u.length>0)break}}catch{}}return u.length===0?null:{url:u[0].url,allUrls:u,headers:u[0].headers}}var Fi,He=F(()=>{$();T();Fi="https://st.111477.xyz"});var Rt={};Q(Rt,{getStream:()=>Oi});async function Pi(r){try{let t=await fetch(r,{headers:{"User-Agent":v,Referer:"https://anihq.cc/"}}),e=await t.text(),n=e.match(/window\.location\.href\s*=\s*['"](https?:\/\/[^'"]+)['"]/);n&&(t=await fetch(n[1],{headers:{"User-Agent":v,Referer:"https://anihq.cc/"}}),e=await t.text());let i=t.url,s=e.match(/
+
+
+
+
+