File size: 58,016 Bytes
ded55b3
 
1
2
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86860,e=>{"use strict";var t,r=e.i(47167);function n(e,t,r,n,a,s,i,o,l,h){let c=0|r[n],u=0|r[n+1],f=0|r[n+2],d=0|r[n+3],g=0|r[n+4],p=0|r[n+5],y=0|r[n+6],w=0|r[n+7],b=0|r[n+8],m=0|r[n+9],k=0|r[n+10],v=0|r[n+11],U=0|r[n+12],L=0|r[n+13],A=0|r[n+14],x=0|r[n+15],E=0|e[t],S=0|e[t+1],T=0|e[t+2],$=0|e[t+3],_=0|e[t+4],C=0|e[t+5],R=0|e[t+6],I=0|e[t+7],B=0x6a09e667,M=0xbb67ae85,W=0x3c6ef372,z=0xa54ff53a,O=0|o,F=o/0x100000000|0,P=0|l,D=0|h;O^=E=(E+_|0)+c|0,_^=B=B+(O=O>>>16|O<<16)|0,O^=E=(E+(_=_>>>12|_<<20)|0)+u|0,_^=B=B+(O=O>>>8|O<<24)|0,_=_>>>7|_<<25,F^=S=(S+C|0)+f|0,C^=M=M+(F=F>>>16|F<<16)|0,F^=S=(S+(C=C>>>12|C<<20)|0)+d|0,C^=M=M+(F=F>>>8|F<<24)|0,C=C>>>7|C<<25,P^=T=(T+R|0)+g|0,R^=W=W+(P=P>>>16|P<<16)|0,P^=T=(T+(R=R>>>12|R<<20)|0)+p|0,R^=W=W+(P=P>>>8|P<<24)|0,R=R>>>7|R<<25,D^=$=($+I|0)+y|0,I^=z=z+(D=D>>>16|D<<16)|0,D^=$=($+(I=I>>>12|I<<20)|0)+w|0,I^=z=z+(D=D>>>8|D<<24)|0,I=I>>>7|I<<25,D^=E=(E+C|0)+b|0,C^=W=W+(D=D>>>16|D<<16)|0,D^=E=(E+(C=C>>>12|C<<20)|0)+m|0,C^=W=W+(D=D>>>8|D<<24)|0,C=C>>>7|C<<25,O^=S=(S+R|0)+k|0,R^=z=z+(O=O>>>16|O<<16)|0,O^=S=(S+(R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,0x1f83d9ab,0x5be0cd19]);new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8,3,4,10,12,13,2,7,14,6,5,9,0,11,15,8,1,10,7,12,9,14,3,13,15,4,0,11,2,5,8,1,6,12,13,9,11,15,10,14,8,7,2,5,3,0,1,6,4,9,14,11,5,8,12,15,1,13,3,0,10,2,6,4,7,11,15,5,0,1,9,8,6,14,10,2,12,3,4,7,13]);let s=4===new Uint8Array(new Uint32Array([0x1020304]).buffer)[0];function i(e,t,r,n,a){let s=a>>>2,i=0;for(;i<s;++i,n+=4){let a=e[t+i];r[n]=255&a,r[n+1]=a>>>8&255,r[n+2]=a>>>16&255,r[n+3]=a>>>24&255}let o=3&a;if(o>0){let a=e[t+i];r[n]=255&a,o>1&&(r[n+1]=a>>>8&255),o>2&&(r[n+2]=a>>>16&255)}}function o(e){return[127&e|128,e>>>7&127]}function l(e){return[127&e|128,e>>>7&127|128,e>>>14&127|128,e>>>21&127|128,e>>>28&15]}function h(e){let t=[],r=0|e,n=!0;for(;n;){let e=127&r;0==(r>>=7)&&(64&e)==0||-1===r&&(64&e)!=0?n=!1:e|=128,t.push(e)}return t}new Uint8Array([0,1,28,2,29,14,24,3,30,22,20,15,25,17,4,8,31,27,13,23,21,19,16,7,26,12,18,6,11,5,10,9]);let c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8,3,4,10,12,13,2,7,14,6,5,9,0,11,15,8,1,10,7,12,9,14,3,13,15,4,0,11,2,5,8,1,6,12,13,9,11,15,10,14,8,7,2,5,3,0,1,6,4,9,14,11,5,8,12,15,1,13,3,0,10,2,6,4,7,11,15,5,0,1,9,8,6,14,10,2,12,3,4,7,13],u=null,f=null,d=null,g=832,p=4928,y=5056,w=5072,b=5088,m=5216,k=7264,v=7328,U=7360;new Uint32Array(512);let L=new Uint32Array(512),A=[];for(let e=0;e<64;e++)A.push(L.subarray(8*e,8*e+8));let x=!1;new Uint32Array(32),new Uint32Array(8),new Uint32Array(8),new Uint32Array(16),new Uint32Array(8),new Uint32Array(32),new Uint32Array(16),new Uint32Array(8),new Uint32Array(4),new Uint32Array(4),new Uint32Array(4),new Uint32Array(4),new Uint8Array(new Uint32Array(8).buffer,0,32),new Uint32Array(4);class E{inputCv;blockWords;counter;blockLen;flags;outputBlock;outputBlockOffset;constructor(e,t,r,n,a){this.inputCv=e,this.blockWords=t,this.counter=r,this.blockLen=n,this.flags=8|a,this.outputBlock=new Uint32Array(16),this.outputBlockOffset=64}read(e){let t=new Uint8Array(e),r=0;for(;r<e;){this.outputBlockOffset>=64&&(n(this.inputCv,0,this.blockWords,0,this.outputBlock,0,!0,this.counter++,this.blockLen,this.flags),this.outputBlockOffset=0);let a=Math.min(64-this.outputBlockOffset,e-r),s=this.outputBlockOffset>>>2;if(0==(3&this.outputBlockOffset)&&a>=4){let e=a>>>2;i(this.outputBlock,s,t,r,e<<2);let n=e<<2;r+=n,this.outputBlockOffset+=n}else{for(let e=0;e<a;e++){let n=this.outputBlockOffset+e>>>2,a=this.outputBlockOffset+e&3;t[r+e]=this.outputBlock[n]>>>(a<<3)&255}r+=a,this.outputBlockOffset+=a}}return t}}class S{chainingValue;chunkCounter;blockWords;blockLen;blocksCompressed;flags;constructor(e,t,r){this.chainingValue=new Uint32Array(e),this.chunkCounter=t,this.blockWords=new Uint32Array(16),this.blockLen=0,this.blocksCompressed=0,this.flags=r}resetTo(e,t,r){this.chainingValue.set(e),this.chunkCounter=t,this.blockLen=0,this.blocksCompressed=0,this.flags=r}startFlag(){return+(0===this.blocksCompressed)}update(e,t,r){let a=0;for(;r>0;){64===this.blockLen&&(n(this.chainingValue,0,this.blockWords,0,this.chainingValue,0,!1,this.chunkCounter,64,this.flags|this.startFlag()),this.blocksCompressed++,this.blockLen=0);let o=Math.min(64-this.blockLen,r);if(0===this.blockLen&&64===o){var s=t,i=this.blockWords;for(let t=0;t<16;++t,s+=4)i[t]=e[s]|e[s+1]<<8|e[s+2]<<16|e[s+3]<<24}else for(let r=0;r<o;r++){let n=this.blockLen+r,a=n>>>2,s=3&n;0===s?this.blockWords[a]=e[t+r]:this.blockWords[a]|=e[t+r]<<(s<<3)}this.blockLen+=o,t+=o,r-=o,a+=o}return a}output(){let e=this.blockLen+3>>>2;for(let t=e;t<16;t++)this.blockWords[t]=0;return{inputCv:this.chainingValue,blockWords:this.blockWords,blockLen:this.blockLen,counter:this.chunkCounter,flags:this.flags|this.startFlag()|2}}len(){return 64*this.blocksCompressed+this.blockLen}}class T{chunkState;keyWords;cvStack;cvStackLen;flags;parentBlock;parentCv;chunkCv;outWords;finalizeCv;constructor(e,t){this.keyWords=new Uint32Array(e||a),this.flags=t??0,this.chunkState=new S(this.keyWords,0,this.flags),this.cvStack=new Uint32Array(432),this.cvStackLen=0,this.parentBlock=new Uint32Array(16),this.parentCv=new Uint32Array(8),this.chunkCv=new Uint32Array(8),this.outWords=new Uint32Array(16),this.finalizeCv=new Uint32Array(8)}reset(){return this.chunkState.resetTo(this.keyWords,0,this.flags),this.cvStackLen=0,this}static newKeyed(e){if(32!==e.length)throw Error(`Key must be 32 bytes, got ${e.length}`);let t=new Uint32Array(8);if(s){let r=new Uint32Array(e.buffer,e.byteOffset,8);t.set(r)}else for(let r=0;r<8;r++){let n=4*r;t[r]=e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24}return new T(t,16)}static newDeriveKey(e){let t=function(e){if("u">typeof TextEncoder)return new TextEncoder().encode(e);let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return new Uint8Array(t)}(e),r=new T(new Uint32Array(a),32);r.update(t);let s=new Uint32Array(8),i=r.finalizeOutput();return n(i.inputCv,0,i.blockWords,0,s,0,!1,i.counter,i.blockLen,8|i.flags),new T(s,64)}pushCv(e,t){this.cvStack.set(e.subarray(t,t+8),8*this.cvStackLen),this.cvStackLen++}popCv(e,t){this.cvStackLen--,e.set(this.cvStack.subarray(8*this.cvStackLen,(this.cvStackLen+1)*8),t)}addChunkCv(e,t,r){let a=this.parentBlock,s=this.parentCv;for(;(1&r)==0;)this.popCv(a,0),a.set(e.subarray(t,t+8),8),n(this.keyWords,0,a,0,s,0,!1,0,64,4|this.flags),e=s,t=0,r>>>=1;this.pushCv(e,t)}update(e){let t=0,r=e.length;for(;r>0;){if(1024===this.chunkState.len()){let e=this.chunkState.output(),t=this.chunkCv;n(e.inputCv,0,e.blockWords,0,t,0,!1,e.counter,e.blockLen,e.flags);let r=this.chunkState.chunkCounter+1;this.addChunkCv(t,0,r),this.chunkState.resetTo(this.keyWords,r,this.flags)}let a=Math.min(1024-this.chunkState.len(),r);this.chunkState.update(e,t,a),t+=a,r-=a}return this}finalizeOutput(){let e=this.chunkState.output(),t=this.parentBlock,r=this.finalizeCv;if(this.cvStackLen>0)for(n(e.inputCv,0,e.blockWords,0,r,0,!1,e.counter,e.blockLen,e.flags);this.cvStackLen>0;){if(this.cvStackLen--,t.set(this.cvStack.subarray(8*this.cvStackLen,(this.cvStackLen+1)*8),0),t.set(r,8),!(this.cvStackLen>0))return{inputCv:this.keyWords,blockWords:t,blockLen:64,counter:0,flags:4|this.flags};n(this.keyWords,0,t,0,r,0,!1,0,64,4|this.flags)}return e}finalize(e=32){let t=this.finalizeOutput(),r=new Uint8Array(e);if(e<=64){let a=this.outWords;if(n(t.inputCv,0,t.blockWords,0,a,0,e>32,t.counter,t.blockLen,8|t.flags),s){let t=new Uint8Array(a.buffer);r.set(t.subarray(0,e))}else i(a,0,r,0,e)}else{let t=this.finalizeXof().read(e);r.set(t)}return r}finalizeXof(){let e=this.finalizeOutput();return new E(new Uint32Array(e.inputCv),new Uint32Array(e.blockWords),e.counter,e.blockLen,e.flags)}}"u">typeof globalThis&&void 0!==globalThis.document&&queueMicrotask(()=>{x||(x=function(){if(u)return!0;if(!function(){try{let e=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,22,1,20,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11]);return WebAssembly.validate(e)}catch{return!1}}())return!1;try{let e=d||function(){let e=[];function t(t){e.push(...t)}t([0,97,115,109]),t([1,0,0,0]),t([1]),t([4]),t([1]),t([96,0,0]),t([2]),t([11]),t([1]),t([2,106,115]),t([3,109,101,109]),t([2,0,1]),t([3]),t([4]),t([3]),t([0]),t([0]),t([0]),t([7]),t([50]),t([3]),t([10]),t([99,111,109,112,114,101,115,115,52,120]),t([0,0]),t([16]),t([99,111,109,112,114,101,115,115,67,104,117,110,107,115,52,120]),t([0,1]),t([14]),t([99,111,109,112,114,101,115,115,80,97,114,101,110,116]),t([0,2]),t([10]);let r=e.length;t([0,0,0,0,0]),t([3]);let n=e.length;t([0,0,0,0,0]);let a=e.length;t([1]),t([32,123]);for(let e=0;e<16;e++)t([65,...o(16*e)]),t([253,0,2,0]),t([33,e]);for(let e=0;e<8;e++)t([65,...o(512+16*e)]),t([253,0,2,0]),t([33,16+e]);let s=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a];for(let e=0;e<4;e++){let r=[];for(let t=0;t<4;t++)r.push(255&s[e]),r.push(s[e]>>>8&255),r.push(s[e]>>>16&255),r.push(s[e]>>>24&255);t([253,12,...r]),t([33,24+e])}t([65,...o(768)]),t([253,0,2,0]),t([33,28]),t([65,...o(784)]),t([253,0,2,0]),t([33,29]),t([65,...o(800)]),t([253,0,2,0]),t([33,30]),t([65,...o(816)]),t([253,0,2,0]),t([33,31]);let i=0;function u(e,r,n,a){let s=c[i++],o=c[i++];t([32,16+e]),t([32,16+r]),t([253,174,1]),t([32,s]),t([253,174,1]),t([33,16+e]),t([32,16+a]),t([32,16+e]),t([253,81]),t([34,16+a]),t([32,16+a]),t([253,13,2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13]),t([33,16+a]),t([32,16+n]),t([32,16+a]),t([253,174,1]),t([33,16+n]),t([32,16+r]),t([32,16+n]),t([253,81]),t([34,16+r]),t([65,12]),t([253,173,1]),t([32,16+r]),t([65,20]),t([253,171,1]),t([253,80]),t([33,16+r]),t([32,16+e]),t([32,16+r]),t([253,174,1]),t([32,o]),t([253,174,1]),t([33,16+e]),t([32,16+a]),t([32,16+e]),t([253,81]),t([34,16+a]),t([32,16+a]),t([253,13,1,2,3,0,5,6,7,4,9,10,11,8,13,14,15,12]),t([33,16+a]),t([32,16+n]),t([32,16+a]),t([253,174,1]),t([33,16+n]),t([32,16+r]),t([32,16+n]),t([253,81]),t([34,16+r]),t([65,7]),t([253,173,1]),t([32,16+r]),t([65,25]),t([253,171,1]),t([253,80]),t([33,16+r])}for(let e=0;e<7;e++)u(0,4,8,12),u(1,5,9,13),u(2,6,10,14),u(3,7,11,15),u(0,5,10,15),u(1,6,11,12),u(2,7,8,13),u(3,4,9,14);for(let e=0;e<8;e++)t([65,...o(640+16*e)]),t([32,16+e]),t([32,24+e]),t([253,81]),t([253,11,2,0]);t([11]);let f=l(e.length-a);for(let t=0;t<5;t++)e[n+t]=f[t];let d=e.length;t([0,0,0,0,0]);let m=e.length;t(function(){let e=[];function t(t){e.push(...t)}t([2]),t([32,123]),t([1,127]);let r=g,n=p,a=b,s=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a];for(let e=0;e<8;e++)t([65,...o(n+16*e)]),t([253,0,2,0]),t([33,16+e]);t([65,0]),t([33,32]),t([2,64]),t([3,64]);for(let e=0;e<16;e++)t([32,32]),t([65,...o(256)]),t([108]),t([65,...o(r+16*e)]),t([106]),t([253,0,2,0]),t([33,e]);for(let e=0;e<4;e++){let r=[];for(let t=0;t<4;t++)r.push(255&s[e]),r.push(s[e]>>>8&255),r.push(s[e]>>>16&255),r.push(s[e]>>>24&255);t([253,12,...r]),t([33,24+e])}t([65,...o(y)]),t([253,0,2,0]),t([33,28]),t([253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t([33,29]);let i=[];for(let e=0;e<4;e++)i.push(64,0,0,0);t([253,12,...i]),t([33,30]),t([65,...o(w)]),t([253,0,2,0]),t([32,32]),t([69]),t([32,32]),t([65,15]),t([70]),t([65,1]),t([116]),t([114]),t([253,17]),t([253,80]),t([33,31]);let l=0;function h(e,r,n,a){let s=c[l++],i=c[l++];t([32,16+e]),t([32,16+r]),t([253,174,1]),t([32,s]),t([253,174,1]),t([33,16+e]),t([32,16+a]),t([32,16+e]),t([253,81]),t([34,16+a]),t([32,16+a]),t([253,13,2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13]),t([33,16+a]),t([32,16+n]),t([32,16+a]),t([253,174,1]),t([33,16+n]),t([32,16+r]),t([32,16+n]),t([253,81]),t([34,16+r]),t([65,12]),t([253,173,1]),t([32,16+r]),t([65,20]),t([253,171,1]),t([253,80]),t([33,16+r]),t([32,16+e]),t([32,16+r]),t([253,174,1]),t([32,i]),t([253,174,1]),t([33,16+e]),t([32,16+a]),t([32,16+e]),t([253,81]),t([34,16+a]),t([32,16+a]),t([253,13,1,2,3,0,5,6,7,4,9,10,11,8,13,14,15,12]),t([33,16+a]),t([32,16+n]),t([32,16+a]),t([253,174,1]),t([33,16+n]),t([32,16+r]),t([32,16+n]),t([253,81]),t([34,16+r]),t([65,7]),t([253,173,1]),t([32,16+r]),t([65,25]),t([253,171,1]),t([253,80]),t([33,16+r])}for(let e=0;e<7;e++)h(0,4,8,12),h(1,5,9,13),h(2,6,10,14),h(3,7,11,15),h(0,5,10,15),h(1,6,11,12),h(2,7,8,13),h(3,4,9,14);for(let e=0;e<8;e++)t([32,16+e]),t([32,24+e]),t([253,81]),t([33,16+e]);t([32,32]),t([65,1]),t([106]),t([34,32]),t([65,16]),t([73]),t([13,0]),t([11]),t([11]);for(let e=0;e<8;e++)t([65,...o(a+16*e)]),t([32,16+e]),t([253,11,2,0]);return t([11]),e}());let U=l(e.length-m);for(let t=0;t<5;t++)e[d+t]=U[t];let L=e.length;t([0,0,0,0,0]);let A=e.length;t(function(){let e=[];function t(t){e.push(...t)}t([1]),t([32,127]);let r=k,n=v,a=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19];for(let e=0;e<16;e++)t([65,...o(r+4*e)]),t([40,2,0]),t([33,e]);for(let e=0;e<8;e++)t([65,...h(a[e])]),t([33,16+e]);for(let e=0;e<4;e++)t([65,...h(a[e])]),t([33,24+e]);function s(e,r,n,a,s,i){let o=16+e,l=16+r,h=16+n,c=16+a;t([32,o]),t([32,l]),t([106]),t([32,s]),t([106]),t([33,o]),t([32,c]),t([32,o]),t([115]),t([65,16]),t([120]),t([33,c]),t([32,h]),t([32,c]),t([106]),t([33,h]),t([32,l]),t([32,h]),t([115]),t([65,12]),t([120]),t([33,l]),t([32,o]),t([32,l]),t([106]),t([32,i]),t([106]),t([33,o]),t([32,c]),t([32,o]),t([115]),t([65,8]),t([120]),t([33,c]),t([32,h]),t([32,c]),t([106]),t([33,h]),t([32,l]),t([32,h]),t([115]),t([65,7]),t([120]),t([33,l])}t([65,0]),t([33,28]),t([65,0]),t([33,29]),t([65,192,0]),t([33,30]),t([65,4]),t([33,31]);let i=0;for(let e=0;e<7;e++)s(0,4,8,12,c[i],c[i+1]),s(1,5,9,13,c[i+=2],c[i+1]),s(2,6,10,14,c[i+=2],c[i+1]),s(3,7,11,15,c[i+=2],c[i+1]),s(0,5,10,15,c[i+=2],c[i+1]),s(1,6,11,12,c[i+=2],c[i+1]),s(2,7,8,13,c[i+=2],c[i+1]),s(3,4,9,14,c[i+=2],c[i+1]),i+=2;for(let e=0;e<8;e++)t([65,...o(n+4*e)]),t([32,16+e]),t([32,24+e]),t([115]),t([54,2,0]);return t([11]),e}());let x=l(e.length-A);for(let t=0;t<5;t++)e[L+t]=x[t];let E=l(e.length-r-5);for(let t=0;t<5;t++)e[r+t]=E[t];return new Uint8Array(e)}();d=e;let t={js:{mem:f=new WebAssembly.Memory({initial:1})}},r=new WebAssembly.Module(e.buffer);return(u=new WebAssembly.Instance(r,t)).exports.compress4x,u.exports.compressChunks4x,u.exports.compressParent,new Uint8Array(f.buffer),new Uint32Array(f.buffer),!function(){if(!f)return;let e=f.buffer;new Uint32Array(e,m,512),new Uint32Array(e,k,16),new Uint32Array(e,v,8),new Uint32Array(e,U,32),new Uint32Array(e,g,1024),new Uint32Array(e,p,32),new Uint32Array(e,y,4),new Uint32Array(e,w,4),new Uint32Array(e,b,32)}(),!0}catch(e){return console.warn("Failed to initialize WASM SIMD:",e),!1}}())}),new Uint8Array([102,151,245,119,91,149,80,222,49,53,203,172,165,151,24,28,157,228,33,16,155,235,43,88,180,208,176,75,147,173,242,41]);let $=new Uint8Array([1,126,197,199,165,71,41,150,253,148,102,102,180,138,2,230,93,221,83,111,55,199,109,210,248,99,82,230,74,83,113,63]);T.newKeyed($);let _=new Uint8Array(32),C=new Uint8Array([127,24,87,214,206,86,237,102,18,127,249,19,231,165,195,243,164,205,38,213,181,219,73,230,65,36,152,127,40,251,148,195]);T.newKeyed(_),T.newKeyed(C);var R="https://huggingface.co";async function I(e,t){let r=new B(e.url,e.status,e.headers.get("X-Request-Id")??t?.requestId);r.message=`Api error with status ${r.statusCode}${t?.message?`. ${t.message}`:""}`;let n=[`URL: ${r.url}`,r.requestId?`Request ID: ${r.requestId}`:void 0].filter(Boolean).join(". ");if(e.headers.get("Content-Type")?.startsWith("application/json")){let t=await e.json();r.message=t.error||t.message||r.message,t.error_description&&(r.message=r.message?r.message+`: ${t.error_description}`:t.error_description),r.data=t}else r.data={message:await e.text()};throw r.message+=`. ${n}`,r}var B=class extends Error{statusCode;url;requestId;data;constructor(e,t,r,n){super(n),this.statusCode=t,this.requestId=r,this.url=e}};function M(e){if(!e.startsWith("hf_"))throw TypeError("Your access token must start with 'hf_'")}var W="u">typeof window&&void 0!==window.document,z="object"==typeof self&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,O=!(!W&&!z);new Promise(e=>{});var F=class extends Blob{static async create(e,t){let r=t?.fetch??fetch,n=await r(e,{headers:{Range:"bytes=0-0",...t?.accessToken&&{Authorization:`Bearer ${t.accessToken}`}}});if(!n.ok)throw await I(n);let a=n.headers.get("content-type")||"";if(206===n.status){let s=Number(n.headers.get("content-range")?.split("/").pop());if(await n.body?.cancel(),Number.isFinite(s)&&s>=(t?.cacheBelow??1e6))return new F(e,0,s,a,!0,r,t?.accessToken);let i=await r(e,{...t?.accessToken&&{headers:{Authorization:`Bearer ${t.accessToken}`}}});if(!i.ok)throw await I(i);return i.blob()}return n.blob()}url;start;end;contentType;full;fetch;accessToken;constructor(e,t,r,n,a,s,i){super([]),this.url=e,this.start=t,this.end=r,this.contentType=n,this.full=a,this.fetch=s,this.accessToken=i}get size(){return this.end-this.start}get type(){return this.contentType}slice(e=0,t=this.size){if(e<0||t<0)throw TypeError("Unsupported negative start/end on WebBlob.slice");return new F(this.url,this.start+e,Math.min(this.start+t,this.end),this.contentType,0===e&&t===this.size&&this.full,this.fetch,this.accessToken)}async arrayBuffer(){return(await this.fetchRange()).arrayBuffer()}async text(){return(await this.fetchRange()).text()}stream(){let e=new TransformStream;return this.fetchRange().then(t=>t.body?.pipeThrough(e)).catch(t=>e.writable.abort(t.message)),e.readable}fetchRange(){let e=this.fetch;return this.full?e(this.url,{...this.accessToken&&{headers:{Authorization:`Bearer ${this.accessToken}`}}}).then(e=>e.ok?e:I(e)):e(this.url,{headers:{Range:`bytes=${this.start}-${this.end-1}`,...this.accessToken&&{Authorization:`Bearer ${this.accessToken}`}}}).then(e=>e.ok?e:I(e))}};function P(...e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function D(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}N(5242880),function(){try{new Uint32Array(65536)}catch(t){let e=Array(65536);for(let t=0;t<65536;t++)e[t]=0;return e}}();var H={4:65536,5:262144,6:1048576,7:4194304};function N(e){return new Uint8Array(e)}function j(e,t){let r,n;return void 0===t&&(t=function(e){let t=0;if(0x184d2204!==D(e,0))throw Error("invalid magic number");t+=4;let r=e[t++];if((192&r)!=64)throw Error("incompatible descriptor version "+(192&r));let n=(16&r)!=0,a=e[t++]>>4&7;if(void 0===H[a])throw Error("invalid block size "+a);let s=H[a];if((8&r)!=0){var i;return i=t,e[i++]|e[i++]<<8|e[i++]<<16|e[i++]<<24|e[i++]<<32|e[i++]<<40|e[i++]<<48|e[i++]<<56}t++;let o=0;for(;;){let r=D(e,t);if(t+=4,0x80000000&r?(r&=0x7fffffff,o+=r):r>0&&(o+=s),0===r)return o;n&&(t+=4),t+=r}}(e)),(n=function(e,t){let r,n,a=0,s=0;if(0x184d2204!==D(e,0))throw Error("invalid magic number");if(a+=4,(192&(n=e[a++]))!=64)throw Error("incompatible descriptor version");if(r=(16&n)!=0,void 0===H[e[a++]>>4&7])throw Error("invalid block size");for((8&n)!=0&&(a+=8),a++;;){var i;if(i=D(e,a),a+=4,0===i)break;if(r&&(a+=4),(0x80000000&i)!=0){i&=0x7fffffff;for(let r=0;r<i;r++)t[s++]=e[a++]}else s=function(e,t,r,n,a){let s,i,o,l,h,c=void 0!==t.copyWithin&&void 0!==t.fill;for(o=r+n;r<o;){let n=e[r++],u=n>>4;if(u>0){if(15===u)for(;u+=e[r],255===e[r++];);for(l=r+u;r<l;)t[a++]=e[r++]}if(r>=o)break;if(s=15&n,i=e[r++]|e[r++]<<8,15===s)for(;s+=e[r],255===e[r++];);if(s+=4,c&&1===i)t.fill(0|t[a-1],a,a+s),a+=s;else if(c&&i>s&&s>31)t.copyWithin(a,a-i,a-i+s),a+=s;else for(l=(h=a-i)+s;h<l;)t[a++]=0|t[h++]}return a}(e,t,a,i,s),a+=i}return(4&n)!=0&&(a+=4),s}(e,r=N(t)))!==t&&(r=r.slice(0,n)),r}var V=class{ranges=[];add(e,t){if(t<=e)throw TypeError("End must be greater than start");let r=[];for(let n=0;n<this.ranges.length;n++){let a=this.ranges[n];if(e<a.end&&t>a.start&&r.push({index:n,range:a}),null!==a.data)throw Error("Overlapping range already has data")}if(0===r.length){this.ranges.push({start:e,end:t,refCount:1,data:null}),this.ranges.sort((e,t)=>e.start-t.start);return}let n=[],a=e;for(let e=0;e<r.length;e++){let{range:s}=r[e];a<s.start?n.push({start:a,end:s.start,refCount:1,data:null}):s.start<a&&n.push({start:s.start,end:a,refCount:s.refCount,data:null}),n.push({start:Math.max(a,s.start),end:Math.min(t,s.end),refCount:s.refCount+1,data:null}),s.end>t&&n.push({start:t,end:s.end,refCount:s.refCount,data:null}),a=Math.max(a,s.end)}a<t&&n.push({start:a,end:t,refCount:1,data:null});let s=r[0].index,i=r[r.length-1].index;this.ranges.splice(s,i-s+1,...n),this.ranges.sort((e,t)=>e.start-t.start)}remove(e,t){if(t<=e)throw TypeError("End must be greater than start");let r=[];for(let n=0;n<this.ranges.length;n++){let a=this.ranges[n];e<a.end&&t>a.start&&r.push({index:n,range:a})}if(0===r.length)throw Error("No ranges found to remove");if(e!==r[0].range.start||t!==r[r.length-1].range.end)throw Error("Range boundaries must match existing boundaries");for(let e=0;e<r.length;e++){let{range:t}=r[e];t.refCount--}this.ranges=this.ranges.filter(e=>e.refCount>0)}getRanges(e,t){if(t<=e)throw TypeError("End must be greater than start");return this.ranges.filter(r=>e<r.end&&t>r.start)}getAllRanges(){return[...this.ranges]}};function q(e,t,r=0){let n=t.length;if(0===n)return r<=e.length?r:-1;let a=n-1,s=e.length-n,i=new Uint16Array(256).fill(n);for(let e=0;e<a;e++)i[t[e]]=a-e;let o=r;for(;o<=s;){let r=a;for(;r>=0&&e[o+r]===t[r];)r--;if(r<0)return o;o+=i[e[o+a]]}return -1}var K=new TextEncoder,G=K.encode("\r\n"),J=K.encode("\r\n\r\n"),Q=class{#e;#t=G;#r=[];#n=0;#a;#s=0;#i=0;#o=!1;constructor(e){const t=function(e){for(let t of e.split(";")){let e=t.trim();if(e.toLowerCase().startsWith("boundary="))return e.slice(9).replace(/^"|"$/g,"")}return null}(e);if(!t)throw Error(`No boundary found in Content-Type: ${e}`);this.#e=K.encode(`\r
--${t}`)}push(e){if(this.#o)return[];let t=e&&e.byteLength?P(this.#t,e):this.#t;this.#t=new Uint8Array(0);let r=[];for(;;){if(0===this.#i||2===this.#i){let e=q(t,this.#e,0);if(-1===e){let e=Math.max(0,t.byteLength-(this.#e.byteLength-1));2===this.#i&&e>0&&this.#l(t.subarray(0,e)),this.#t=t.slice(e);break}if(2===this.#i){this.#l(t.subarray(0,e));let n=this.#h(),a=q(n,J,0);if(-1===a)throw Error("Malformed multipart part: missing header/data separator");r.push(n.subarray(a+J.byteLength))}t=t.slice(e+this.#e.byteLength),this.#i=1;continue}if(t.byteLength<2){this.#t=t;break}if(45===t[0]&&45===t[1]){this.#o=!0;break}if(t[0]===G[0]&&t[1]===G[1]){t=t.slice(2),this.#i=2;continue}throw Error("Malformed multipart body: expected CRLF or closing delimiter after boundary")}return r}#l(e){if(this.#n+=e.byteLength,e.byteLength>=65536){this.#c(),this.#r.push(e);return}let t=0;for(;t<e.byteLength;){this.#a||(this.#a=new Uint8Array(65536),this.#s=0);let r=Math.min(65536-this.#s,e.byteLength-t);this.#a.set(e.subarray(t,t+r),this.#s),this.#s+=r,t+=r,65536===this.#s&&(this.#r.push(this.#a),this.#a=void 0)}}#c(){this.#a&&this.#s>0&&this.#r.push(this.#a.subarray(0,this.#s)),this.#a=void 0,this.#s=0}#h(){this.#c();let e=new Uint8Array(this.#n),t=0;for(let r of this.#r)e.set(r,t),t+=r.byteLength;return this.#r=[],this.#n=0,e}};function X(e){return e.reduce((e,t)=>e+t,0)}var Z=[Symbol.for("undici.globalDispatcher.2"),Symbol.for("undici.globalDispatcher.1")];async function Y(){let e=globalThis,r=()=>Z.map(t=>e[t]).find(e=>"function"==typeof e?.dispatch),n=r();if(void 0===n&&(await (await fetch("data:,")).arrayBuffer(),n=r()),void 0!==n){var a;return t?.base!==n&&(t={base:n,http1:(a=n,{dispatch:(e,t)=>a.dispatch({...e,allowH2:!1},t)})}),t.http1}}var ee=async(e,t)=>{let r=await Y();return r?fetch(e,{...t,dispatcher:r}):fetch(e,t)},et=!function(e=void 0!==r.default?r.default.versions:void 0,t=O){return!t&&!!e?.undici&&!e.bun&&Number(e.undici.split(".")[0])>=8}()?(e,t)=>fetch(e,t):ee,er=O?4:8,en=class{#u=[];wait(){return new Promise(e=>this.#u.push(e))}notifyAll(){let e=this.#u;for(let t of(this.#u=[],e))t()}};function ea(e){return new Promise(t=>setTimeout(t,e))}var es={0:"None",1:"LZ4",2:"ByteGroupingLZ4"};function ei(e){let t={version:e.getUint8(0),compressed_length:e.getUint8(1)|e.getUint8(2)<<8|e.getUint8(3)<<16,compression_scheme:e.getUint8(4),uncompressed_length:e.getUint8(5)|e.getUint8(6)<<8|e.getUint8(7)<<16};if(0!==t.version)throw Error(`Unsupported chunk version ${t.version}`);if(0!==t.compression_scheme&&1!==t.compression_scheme&&2!==t.compression_scheme)throw Error(`Unsupported compression scheme ${es[t.compression_scheme]??t.compression_scheme}`);return t}function eo(e,t){switch(e.compression_scheme){case 1:return j(t,e.uncompressed_length);case 2:return function(e){let t=Math.floor(e.byteLength/4),r=e.byteLength%4,n=t+ +(r>=1),a=n+t+ +(r>=2),s=a+t+ +(3==r),i=new Uint8Array(e.byteLength);for(let t=0,r=0;t<e.byteLength;t+=4,r++)i[t]=e[r];for(let t=1,r=n;t<e.byteLength;t+=4,r++)i[t]=e[r];for(let t=2,r=a;t<e.byteLength;t+=4,r++)i[t]=e[r];for(let t=3,r=s;t<e.byteLength;t+=4,r++)i[t]=e[r];return i}(j(t,e.uncompressed_length));default:return t.slice()}}function el(e,t,r){let n=r.getRanges(t.chunks.start,t.chunks.end),a=new Map,s=t.chunks.start,i=0;for(;i<e.byteLength;){if(s>=t.chunks.end)throw Error(`Multipart part for chunks ${t.chunks.start}-${t.chunks.end} contains more chunks than expected`);if(e.byteLength-i<8)throw Error("Truncated chunk header in multipart part");let r=ei(new DataView(e.buffer,e.byteOffset+i,8)),o=i+8,l=o+r.compressed_length;if(l>e.byteLength)throw Error("Truncated chunk data in multipart part");let h=eo(r,e.subarray(o,l)),c=n.find(e=>s>=e.start&&s<e.end);if(c){let e=a.get(c);e||(e=[],a.set(c,e)),e.push(h)}s++,i=l}if(s!==t.chunks.end)throw Error(`Multipart part decoded chunks ${t.chunks.start}-${s} but expected ${t.chunks.start}-${t.chunks.end}`);return a}function eh(e){let t=0;for(let[r,n]of e)r.data||(r.data=n,t+=X(n.map(e=>e.byteLength)));return t}var ec=class extends Blob{fetch;accessToken;refreshUrl;reconstructionUrl;hash;start=0;end=0;internalLogging=!1;reconstructionInfo;listener;parallelDownloads;constructor(e){if(super([]),this.fetch=e.fetch??et,this.accessToken=function(e){return e.accessToken?(M(e.accessToken),e.accessToken):e.credentials?.accessToken?(M(e.credentials.accessToken),e.credentials.accessToken):void 0}(e),this.refreshUrl=e.refreshUrl,this.end=e.size,this.reconstructionUrl=e.reconstructionUrl,this.hash=e.hash,this.listener=e.listener,this.internalLogging=e.internalLogging??!1,this.parallelDownloads=e.parallelDownloads,e.readToken){const t=ed({refreshUrl:this.refreshUrl,initialAccessToken:this.accessToken});ef.set(t,{accessToken:e.readToken.accessToken,expiresAt:new Date(1e3*e.readToken.exp),casUrl:e.readToken.casUrl})}}get size(){return this.end-this.start}#f(){let e=new ec({fetch:this.fetch,hash:this.hash,refreshUrl:this.refreshUrl,reconstructionUrl:this.reconstructionUrl,size:this.size});return e.accessToken=this.accessToken,e.start=this.start,e.end=this.end,e.reconstructionInfo=this.reconstructionInfo,e.listener=this.listener,e.internalLogging=this.internalLogging,e.parallelDownloads=this.parallelDownloads,e}slice(e=0,t=this.size){if(e<0||t<0)throw TypeError("Unsupported negative start/end on XetBlob.slice");let r=this.#f();return r.start=this.start+e,r.end=Math.min(this.start+t,this.end),(r.start!==this.start||r.end!==this.end)&&(r.reconstructionInfo=void 0),r}#d;#g(){return this.#d||(this.#d=(async()=>{let e=await eg(this.accessToken,this.fetch,this.refreshUrl),t=this.reconstructionUrl?this.reconstructionUrl.replace("/v1/reconstructions/","/v2/reconstructions/"):`${e.casUrl}/v2/reconstructions/${this.hash}`,r=await this.fetch(t,{headers:{Authorization:`Bearer ${e.accessToken}`,Range:`bytes=${this.start}-${this.end-1}`}});if(!r.ok)throw await I(r);return this.reconstructionInfo=await r.json(),this.reconstructionInfo})().finally(()=>this.#d=void 0)),this.#d}async #p(){if(0===this.size)return new ReadableStream({start(e){e.close()}});this.reconstructionInfo||await this.#g();let e=new Map;if(!this.reconstructionInfo)throw Error("Failed to load reconstruction info");for(let t of this.reconstructionInfo.terms){let r=e.get(t.hash);r||(r=new V,e.set(t.hash,r)),r.add(t.range.start,t.range.end)}let t=this.listener,r=this.internalLogging?(...e)=>console.log(...e):()=>{};async function*n(n,a,s,i){let o=0,l=n.offset_into_first_range;for(let h of n.terms){let c;if(o>=s)break;let u=e.get(h.hash);if(!u)throw Error(`Failed to find range list for term ${h.hash}`);let f=e=>{for(let t of e.xorbs[h.hash]??[]){let e=t.ranges.find(e=>e.chunks.start<=h.range.start&&e.chunks.end>=h.range.end);if(e)return{entry:t,descriptor:e}}},d=e=>`bytes=${e.ranges.map(e=>`${e.bytes.start}-${e.bytes.end}`).join(",")}`,g=async e=>{let r=await a(e.url,{headers:{Range:d(e)}});if(403===r.status){let t=f(n=await i());if(!t)throw Error(`Failed to find fetch info for term ${h.hash} and range ${h.range.start}-${h.range.end} after refresh`);e=t.entry,r=await a(e.url,{headers:{Range:d(e)}})}if(!r.ok)throw await I(r);let s=r.headers.get("content-type")??"";if(!s.includes("multipart/byteranges"))throw Error(`Expected multipart/byteranges response for multi-range request, got "${s}"`);let o=r.body?.getReader();if(!o)throw Error("Failed to get reader from response body");let l=new Q(s),c=[],g=0,p=t=>{for(let r of t){let t=e.ranges[g];if(!t)throw Error(`Received more multipart parts than the ${e.ranges.length} signed ranges`);c.push(el(r,t,u)),g++}};try{for(;;){let e=await o.read();if(t?.({event:"read"}),e.done)break;e.value&&p(l.push(e.value))}p(l.push())}finally{await o.cancel().catch(()=>{})}if(g!==e.ranges.length)throw Error(`Multi-range fetch produced ${g} parts but expected ${e.ranges.length} for term ${h.hash}`);for(let e of c)eh(e)},p=u.getRanges(h.range.start,h.range.end);if(!p.every(e=>e.data)){let e=f(n);if(!e)throw Error(`Failed to find fetch info for term ${h.hash} and range ${h.range.start}-${h.range.end}`);e.entry.ranges.length>1&&(await g(e.entry),p=u.getRanges(h.range.start,h.range.end))}if(p.every(e=>e.data)){r("all data available for term",h.hash,l);let e=X(p.map(e=>X(e.data.map(e=>e.byteLength))));if(e!==h.unpacked_length)throw Error(`Term ${h.hash} range ${h.range.start}-${h.range.end} decoded to ${e} bytes, expected ${h.unpacked_length}`);e:for(let e of p)for(let r of e.data){if(l){let e=Math.min(l,r.byteLength);if(r=r.slice(e),l-=e,!r.byteLength)continue}if(r.byteLength>s-o&&(r=r.slice(0,s-o)),o+=r.byteLength,yield e.refCount>1?r.slice():r,t?.({event:"progress",progress:{read:o,total:s}}),o>=s)break e}u.remove(h.range.start,h.range.end);continue}let y=f(n);if(!y)throw Error(`Failed to find fetch info for term ${h.hash} and range ${h.range.start}-${h.range.end}`);let w=y.descriptor;r("term",h),r("descriptor",w),r("readBytesToSkip",l);let b=await a(y.entry.url,{headers:{Range:`bytes=${w.bytes.start}-${w.bytes.end}`}});if(403===b.status){if(!(y=f(n=await i())))throw Error(`Failed to find fetch info for term ${h.hash} and range ${h.range.start}-${h.range.end} after refresh`);w=y.descriptor,b=await a(y.entry.url,{headers:{Range:`bytes=${w.bytes.start}-${w.bytes.end}`}})}if(!b.ok)throw await I(b);r("expected content length",b.headers.get("content-length"),"range",w.bytes,b.headers.get("content-range"));let m=b.body?.getReader();if(!m)throw Error("Failed to get reader from response body");let k=!1,v=w.chunks.start,U=u.getRanges(w.chunks.start,w.chunks.end),L=0;t:for(;!k&&o<s;){let e=await m.read();if(t?.({event:"read"}),k=e.done,r("read",e.value?.byteLength,"bytes","total read",o,"toSkip",l),!e.value){r("no data in result, cancelled",e);continue}for(L+=e.value.byteLength,c&&(e.value=P(c,e.value),c=void 0);o<s&&e.value?.byteLength;){if(e.value.byteLength<8){c=e.value;continue t}let n=ei(new DataView(e.value.buffer,e.value.byteOffset,8));if(r("chunk header",n,"to skip",l),e.value.byteLength<n.compressed_length+8){c=e.value;continue t}e.value=e.value.slice(8);let a=eo(n,e.value.subarray(0,n.compressed_length)),i=U.find(e=>v>=e.start&&v<e.end),u=v>=h.range.start&&v<h.range.end,f=u?2:1,d=!1;if(i&&i.refCount>=f&&(i.data??=[],i.data.push(a),d=!0),u){if(l){let e=Math.min(l,a.byteLength);a=a.slice(l),l-=e}a.byteLength>s-o&&(a=a.slice(0,s-o)),a.byteLength&&(r("yield",a.byteLength,"bytes",e.value.byteLength,"total read",o,d),o+=a.byteLength,yield d?a.slice():a,t?.({event:"progress",progress:{read:o,total:s}}))}v++,e.value=e.value.slice(n.compressed_length)}}if(k&&o<s&&L<w.bytes.end-w.bytes.start+1)throw r("done",k,"total read",o,s,L),r("failed to fetch all data for term",h.hash),Error(`Failed to fetch all data for term ${h.hash}, fetched ${L} bytes out of ${w.bytes.end-w.bytes.start+1}`);r("done",k,"total read",o,s,L),r("cancel reader"),await m.cancel()}}let a=!1===this.parallelDownloads?void 0:!0===this.parallelDownloads||void 0===this.parallelDownloads?{}:this.parallelDownloads;async function*s(n,a,s,i,o){let l=0,h=n.offset_into_first_range,c=n.terms,u=(e,t)=>{for(let r of e.xorbs[t.hash]??[])if(r.ranges.find(e=>e.chunks.start<=t.range.start&&e.chunks.end>=t.range.end))return r},f=[],d=new Map,g=[];for(let e of c){let t=u(n,e);if(!t)throw Error(`Failed to find fetch info for term ${e.hash} and range ${e.range.start}-${e.range.end}`);let r=d.get(t.url);void 0===r&&(r=f.length,f.push({hash:e.hash,ranges:t.ranges,url:t.url}),d.set(t.url,r)),g.push(r)}let p=Math.max(1,o.maxConcurrency??er),y=e=>X(e.ranges.map(e=>e.bytes.end-e.bytes.start+1)),w=f.length?Math.max(...f.map(y)):0,b=o.maxInFlightBytes??Math.min(0x10000000,Math.max(0x4000000,3*w)),m={nextEntry:0,neededEntry:0,target:1,error:void 0,finished:!1,inFlightBytes:0,decodedBytes:0,active:0,claimed:0,maxActive:0,activeHighWater:0,count429:0,targetHistory:[]},k=new en,v=async(e,t)=>{for(;!m.error&&!m.finished&&m.inFlightBytes+e>b&&t!==m.neededEntry;)await k.wait();m.inFlightBytes+=e},U=e=>{m.inFlightBytes-=e,k.notifyAll()},L=e=>{for(let t of f){let r=(e.xorbs[t.hash]??[]).find(e=>e.ranges.length===t.ranges.length&&e.ranges.every((e,r)=>e.chunks.start===t.ranges[r].chunks.start&&e.chunks.end===t.ranges[r].chunks.end));r&&(t.url=r.url,t.ranges=r.ranges)}},A=e=>`bytes=${e.ranges.map(e=>`${e.bytes.start}-${e.bytes.end}`).join(",")}`,x=async(r,s,o)=>{if(m.error||m.finished)return;let l=e.get(r.hash);if(!l)throw Error(`Failed to find range list for entry ${r.hash}`);let h=await a(r.url,{headers:{Range:A(r)}}),c=0,u=0;for(;403===h.status&&c<1||429===h.status&&u<3;)await h.body?.cancel().catch(()=>{}),403===h.status?(c++,L(n=await i())):(u++,m.count429++,k.notifyAll(),await ea(300*u)),h=await a(r.url,{headers:{Range:A(r)}});if(!h.ok)throw await I(h);let f=h.body?.getReader();if(!f)throw Error("Failed to get reader from response body");try{if(r.ranges.length>1){let e=h.headers.get("content-type")??"";if(!e.includes("multipart/byteranges"))throw Error(`Expected multipart/byteranges response for multi-range request, got "${e}"`);let n=new Q(e),a=0,s=async e=>{for(let t of e){let e=r.ranges[a];if(!e)throw Error(`Received more multipart parts than the ${r.ranges.length} signed ranges`);let n=el(t,e,l);o.committed+=eh(n),m.decodedBytes+=t.byteLength,a++,k.notifyAll()}};for(;;){if(m.error||m.finished)return;let e=await f.read();if(t?.({event:"read"}),e.done)break;e.value&&await s(n.push(e.value))}if(await s(n.push()),!m.finished&&a!==r.ranges.length)throw Error(`Multi-range fetch produced ${a} parts but expected ${r.ranges.length} for ${r.hash}`)}else{let e,n=r.ranges[0],a=l.getRanges(n.chunks.start,n.chunks.end),s=new Map,i=n.chunks.start,h=!1;for(;!h;){if(m.error||m.finished)return;let r=await f.read();t?.({event:"read"}),h=r.done;let n=r.value;if(n)for(e&&(n=P(e,n),e=void 0);n.byteLength;){if(n.byteLength<8){e=n;break}let t=ei(new DataView(n.buffer,n.byteOffset,8));if(n.byteLength<8+t.compressed_length){e=n;break}let r=eo(t,n.subarray(8,8+t.compressed_length)),l=a.find(e=>i>=e.start&&i<e.end);if(l){let e=s.get(l);e||(e=[],s.set(l,e)),e.push(r),i!==l.end-1||l.data||(l.data=e,o.committed+=X(e.map(e=>e.byteLength)),k.notifyAll())}m.decodedBytes+=r.byteLength,i++,n=n.slice(8+t.compressed_length)}}if(!m.finished){for(let e of a)if(!e.data)throw Error(`Failed to fetch all data for ${r.hash} chunks ${e.start}-${e.end} (stream ended early)`)}}}finally{await f.cancel().catch(()=>{})}},E=e=>e instanceof TypeError||/terminated|socket|network|ECONNRESET|fetch failed/i.test(String(e)),S=async e=>{for(;;){if(m.error||m.finished)return;if(e>=m.target){await k.wait();continue}let t=m.nextEntry;if(t>=f.length)return;m.nextEntry++,m.claimed++;let n=y(f[t]);try{let e;if(await v(n,t),m.error||m.finished)return void U(n);m.active++,m.maxActive=Math.max(m.maxActive,m.active),m.activeHighWater=Math.max(m.activeHighWater,m.active);let a={committed:0};for(let s=0;s<2;s++)try{await x(f[t],t,a),U(n-a.committed),e=void 0;break}catch(n){if(e=n,0===s&&!m.finished&&E(n)){r("retrying entry after transient error",f[t].hash,n),await ea(250);continue}}e&&(U(n),m.error??=e),m.active--}finally{m.claimed--,k.notifyAll()}}},T=Promise.allSettled(Array.from({length:p},(e,t)=>S(t))),$=new Map,_=0,C=0,R=1,B=0,M=setInterval(()=>{let e=m.decodedBytes-_;_=m.decodedBytes;let t=m.activeHighWater;if(m.activeHighWater=m.active,B=Math.max(0,B-1),m.count429>C)C=m.count429,m.target=Math.max(1,m.target-1),R=1,B=10;else if(0===e&&m.nextEntry<f.length)m.target=Math.min(p,m.target+1),R=1;else if(R>0)R--;else if(m.claimed>=m.target&&t<=m.target){let t=(($.get(m.target)??e)+e)/2;$.set(m.target,t);let r=$.get(m.target-1);m.target>1&&void 0===r?(m.target--,R=1):void 0!==r&&t<1.05*r?($.delete(m.target),m.target--,R=1,B=10):0===B&&m.target<p&&(m.target++,R=1)}m.targetHistory.push(m.target),k.notifyAll()},o.controllerTickMs??500);try{for(let n=0;n<c.length;n++){let a=c[n];if(l>=s)break;m.neededEntry=g[n],k.notifyAll();let i=e.get(a.hash);if(!i)throw Error(`Failed to find range list for term ${a.hash}`);let o=i.getRanges(a.range.start,a.range.end);for(;!o.every(e=>e.data);){if(m.error)throw m.error;if(0===m.claimed&&m.nextEntry>=f.length)throw Error(`Download workers finished without producing data for term ${a.hash} range ${a.range.start}-${a.range.end}`);await k.wait(),o=i.getRanges(a.range.start,a.range.end)}r("all data available for term",a.hash,h);let u=X(o.map(e=>X(e.data.map(e=>e.byteLength))));if(u!==a.unpacked_length)throw Error(`Term ${a.hash} range ${a.range.start}-${a.range.end} decoded to ${u} bytes, expected ${a.unpacked_length}`);e:for(let e of o)for(let r of e.data){if(h){let e=Math.min(h,r.byteLength);if(r=r.slice(e),h-=e,!r.byteLength)continue}if(r.byteLength>s-l&&(r=r.slice(0,s-l)),l+=r.byteLength,yield e.refCount>1?r.slice():r,t?.({event:"progress",progress:{read:l,total:s}}),l>=s)break e}let d=0;for(let e of o)1===e.refCount&&e.data&&(d+=X(e.data.map(e=>e.byteLength)));i.remove(a.range.start,a.range.end),U(d)}}finally{m.finished=!0,clearInterval(M),k.notifyAll(),await T,o.onStat?.({entries:f.length,maxActive:m.maxActive,finalTarget:m.target,count429:m.count429,targetHistory:m.targetHistory})}}let i=a&&(a.maxConcurrency??er)>1?s(this.reconstructionInfo,this.fetch,this.end-this.start,this.#g.bind(this),a):n(this.reconstructionInfo,this.fetch,this.end-this.start,this.#g.bind(this));return new ReadableStream({async pull(e){let t=await i.next();t.value&&e.enqueue(t.value),t.done&&e.close()},async cancel(){await i.return?.(void 0)},type:"bytes"},{highWaterMark:1e3})}async arrayBuffer(){let e=(await this.#p()).getReader(),t=[];for(;;){let{done:r,value:n}=await e.read();if(r)break;t.push(n)}return function(e){let t=new Uint8Array(X(e.map(e=>e.byteLength))),r=0;for(let n of e)t.set(n,r),r+=n.byteLength;return t}(t).buffer}async text(){return new TextDecoder().decode(await this.arrayBuffer())}async response(){return new Response(await this.#p())}stream(){let e=new TransformStream;return this.#p().then(t=>t.pipeThrough(e)).catch(t=>e.writable.abort(t.message)),e.readable}},eu=new Map,ef=new Map;function ed(e){return JSON.stringify([e.refreshUrl,e.initialAccessToken])}async function eg(e,t,r){let n=ed({refreshUrl:r,initialAccessToken:e}),a=ef.get(n);if(a&&a.expiresAt>new Date(Date.now()+6e4))return{accessToken:a.accessToken,casUrl:a.casUrl};let s=eu.get(n);if(s)return s;let i=(async()=>{let a=await t(r,{headers:{...e?{Authorization:`Bearer ${e}`}:{}}});if(!a.ok)throw Error(`Failed to get JWT token: ${a.status} ${await a.text()}`);let s=await a.json(),i={accessToken:s.accessToken,expiresAt:new Date(1e3*s.exp),casUrl:s.casUrl};for(let[e,t]of ef.entries())if(t.expiresAt<new Date(Date.now()+6e4))ef.delete(e);else break;if(ef.size>=1e3){let e=ef.keys().next().value;e&&ef.delete(e)}return ef.set(n,i),{accessToken:s.accessToken,casUrl:s.casUrl}})().finally(()=>{eu.delete(n)});return eu.set(n,i),i}"ff".repeat(32);var ep=class extends Blob{originalBlob;spliceOperations;constructor(e,t){super(),this.originalBlob=e,this.spliceOperations=t}static create(e,t){for(let r of(Array.isArray(t)||(t=[t]),t))if(r.start<0||r.end<0||r.start>e.size||r.end>e.size||r.start>r.end)throw Error("Invalid start/end positions for SplicedBlob");let r=[...t].sort((e,t)=>e.start-t.start);for(let e=0;e<r.length-1;e++)if(r[e].end>r[e+1].start)throw Error("Overlapping splice operations are not supported");return new ep(e,r)}get size(){let e=0,t=0;for(let r of this.spliceOperations)e+=r.end-r.start,t+=r.insert.size;return this.originalBlob.size-e+t}get type(){return this.originalBlob.type}slice(e=0,t=this.size){if(e<0||t<0)throw TypeError("Unsupported negative start/end on SplicedBlob.slice");if(e=Math.min(e,this.size),t=Math.min(t,this.size),e>=t)return new Blob([]);let r=this.segments,n=[0],a=0;for(let e of r)a+=e.size,n.push(a);let s=[];for(let a=0;a<r.length;a++){let i=n[a];if(n[a+1]<=e)continue;if(i>=t)break;let o=Math.max(0,e-i),l=Math.min(r[a].size,t-i);o<l&&s.push(r[a].slice(o,l))}return new Blob(s)}get firstSpliceIndex(){return this.spliceOperations[0]?.start??1/0}async arrayBuffer(){let e=this.segments,t=await Promise.all(e.map(e=>e.arrayBuffer())),r=new Uint8Array(X(t.map(e=>e.byteLength))),n=0;for(let e of t)r.set(new Uint8Array(e),n),n+=e.byteLength;return r.buffer}async text(){let e=await this.arrayBuffer();return new TextDecoder().decode(e)}stream(){return new ReadableStream({start:async e=>{try{for(let t of this.segments){let r=t.stream().getReader();try{for(;;){let{done:t,value:n}=await r.read();if(t)break;e.enqueue(n)}}finally{r.releaseLock()}}e.close()}catch(t){e.error(t)}}})}get segments(){let e=[],t=0;for(let r of[...this.spliceOperations].sort((e,t)=>e.start-t.start))t<r.start&&e.push(this.originalBlob.slice(t,r.start)),r.insert.size>0&&e.push(r.insert),t=r.end;return t<this.originalBlob.size&&e.push(this.originalBlob.slice(t)),e}};async function ey(e){let t;if("u"<typeof window&&!e?.redirectedUrl)throw Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");if("u"<typeof localStorage&&(!e?.nonce||!e?.codeVerifier))throw Error("oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier");let r=e?.redirectedUrl??window.location.href,n=(()=>{try{return new URL(r).searchParams}catch(e){throw Error("Failed to parse redirected URL: "+r)}})(),[a,s]=[n.get("error"),n.get("error_description")];if(a)throw Error(`${a}: ${s}`);let i=n.get("code"),o=e?.nonce??localStorage.getItem("huggingface.co:oauth:nonce");if(!i)throw Error("Missing oauth code from query parameters in redirected URL: "+r);if(!o)throw Error("Missing oauth nonce from localStorage");let l=e?.codeVerifier??localStorage.getItem("huggingface.co:oauth:code_verifier");if(!l)throw Error("Missing oauth code_verifier from localStorage");let h=n.get("state");if(!h)throw Error("Missing oauth state from query parameters in redirected URL");try{t=JSON.parse(h)}catch{throw Error("Invalid oauth state in redirected URL, unable to parse JSON: "+h)}if(t.nonce!==o)throw Error("Invalid oauth state in redirected URL");let c=e?.hubUrl||R,u=`${new URL(c).origin}/.well-known/openid-configuration`,f=await fetch(u,{headers:{Accept:"application/json"}});if(!f.ok)throw await I(f);let d=await f.json(),g=await fetch(d.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:i,redirect_uri:t.redirectUri,code_verifier:l}).toString()});if(e?.codeVerifier||localStorage.removeItem("huggingface.co:oauth:code_verifier"),e?.nonce||localStorage.removeItem("huggingface.co:oauth:nonce"),!g.ok)throw await I(g);let p=await g.json(),y=new Date(Date.now()+1e3*p.expires_in),w=await fetch(d.userinfo_endpoint,{headers:{Authorization:`Bearer ${p.access_token}`}});if(!w.ok)throw await I(w);let b=await w.json();return{accessToken:p.access_token,accessTokenExpiresAt:y,userInfo:b,state:t.state,scope:p.scope}}async function ew(e){if("u"<typeof window&&!e?.redirectedUrl)throw Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");if("u"<typeof localStorage&&(!e?.nonce||!e?.codeVerifier))throw Error("oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier");let t=new URLSearchParams(e?.redirectedUrl??window.location.search);return t.has("error")?ey(e):!!t.has("code")&&(localStorage.getItem("huggingface.co:oauth:nonce")?ey(e):(console.warn("Missing oauth nonce from localStorage. This can happen when the user refreshes the page after logging in, without changing the URL."),!1))}async function eb(e){if("u"<typeof window&&(!e?.redirectUrl||!e?.clientId))throw Error("oauthLogin is only available in the browser, unless you provide clientId and redirectUrl");if("u"<typeof localStorage&&!e?.localStorage)throw Error("oauthLogin requires localStorage to be available in the context, unless you provide a localStorage empty object as argument");let t=e?.hubUrl||R,r=`${new URL(t).origin}/.well-known/openid-configuration`,n=await fetch(r,{headers:{Accept:"application/json"}});if(!n.ok)throw await I(n);let a=await n.json(),s=globalThis.crypto.randomUUID(),i=globalThis.crypto.randomUUID()+globalThis.crypto.randomUUID();if(e?.localStorage){if(void 0!==e.localStorage.codeVerifier&&null!==e.localStorage.codeVerifier)throw Error("localStorage.codeVerifier must be initially set to null or undefined, and will be filled by oauthLoginUrl");if(void 0!==e.localStorage.nonce&&null!==e.localStorage.nonce)throw Error("localStorage.nonce must be initially set to null or undefined, and will be filled by oauthLoginUrl");e.localStorage.codeVerifier=i,e.localStorage.nonce=s}else localStorage.setItem("huggingface.co:oauth:nonce",s),localStorage.setItem("huggingface.co:oauth:code_verifier",i);let o=e?.redirectUrl||("u">typeof window?window.location.href:void 0);if(!o)throw Error("Missing redirectUrl");let l=JSON.stringify({nonce:s,redirectUri:o,state:e?.state}),h="u">typeof window?window.huggingface?.variables??null:null,c=e?.clientId||h?.OAUTH_CLIENT_ID;if(!c){if(h)throw Error("Missing clientId, please add hf_oauth: true to the README.md's metadata in your static Space");throw Error("Missing clientId")}let u=(function(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{let t=[];return e.forEach(e=>{t.push(String.fromCharCode(e))}),globalThis.btoa(t.join(""))}})(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(i)))).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/=/g,"");return`${a.authorization_endpoint}?${new URLSearchParams({client_id:c,scope:e?.scopes||h?.OAUTH_SCOPES||"openid profile",response_type:"code",redirect_uri:o,state:l,code_challenge:u,code_challenge_method:"S256"}).toString()}`}new Uint8Array(32),new Uint8Array([72,70,82,101,112,111,77,101,116,97,68,97,116,97,0,85,105,103,69,106,123,129,87,131,165,189,217,92,205,209,74,169]),[...["transformer","unet"].map(e=>({single:`${e}/diffusion_pytorch_model.safetensors`,index:`${e}/diffusion_pytorch_model.safetensors.index.json`}))],e.s(["oauthHandleRedirectIfPresent",0,ew,"oauthLoginUrl",0,eb],86860)},23384,e=>{"use strict";var t=e.i(43476),r=e.i(86860),n=e.i(71645),a=e.i(96869);let s="sharpify:hf-session:v1";function i(e,t){return"object"==typeof e&&null!==e&&"string"==typeof e.accessToken&&e.accessToken.startsWith("hf_")&&"number"==typeof e.expiresAt&&Number.isFinite(e.expiresAt)&&e.expiresAt>t&&"string"==typeof e.username&&e.username.length>0}function o(e){let t=new URL(e);for(let e of["code","state","error","error_description","error_uri","hf_login"])t.searchParams.delete(e);return`${t.pathname}${t.search}${t.hash}`}let l=function(e){let t=e.now??Date.now,r=0,n=null;function a(){try{return e.getStorage()}catch{return null}}function o(){try{a()?.removeItem(s)}catch{}}return{load:function(l){let h=new URL(l).searchParams;if(!h.has("code")&&!h.has("error"))return Promise.resolve(function(){try{let e=a()?.getItem(s);if(!e)return null;let r=JSON.parse(e);if(i(r,t()))return r}catch{}return o(),null}());if(n?.url===l)return n.task;let c=++r,u=Promise.resolve().then(e.handleRedirect).then(e=>{if(c!==r)return null;let n=e?{accessToken:e.accessToken,expiresAt:e.accessTokenExpiresAt.getTime(),username:e.userInfo.preferred_username}:null;if(!i(n,t()))throw o(),Error("Hugging Face did not return a valid sign-in session.");try{a()?.setItem(s,JSON.stringify(n))}catch{}return n}).catch(e=>{throw c===r&&o(),e});return n={url:l,task:u},u},clear:function(){r+=1,n=null,o()}}}({handleRedirect:r.oauthHandleRedirectIfPresent,getStorage:()=>window.sessionStorage}),h=(0,n.createContext)(null);e.s(["HfOAuthProvider",0,function({children:e}){let[s,i]=(0,n.useState)(null),[c,u]=(0,n.useState)(!a.REQUIRES_HF_SIGN_IN),[f,d]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[y,w]=(0,n.useState)(null),b=(0,n.useRef)(!1),m=(0,n.useCallback)(async()=>{if(a.REQUIRES_HF_SIGN_IN&&!b.current){b.current=!0,p(!0),d(null);try{let e=`${window.location.origin}${window.location.pathname}`;window.location.assign(await (0,r.oauthLoginUrl)({redirectUrl:e}))}catch{d("Hugging Face sign-in is unavailable right now."),b.current=!1,p(!1)}}},[]);(0,n.useEffect)(()=>{if(!a.REQUIRES_HF_SIGN_IN)return;let e=!0,t=new URLSearchParams(window.location.search),r=t.has("code")||t.has("error"),n="1"===t.get("hf_login"),s=window.self!==window.top;return l.load(window.location.href).then(t=>{e&&(i(t),!n||s||t||m())}).catch(()=>{e&&r&&d("Hugging Face sign-in did not finish. Please try again.")}).finally(()=>{if(e){var t;let e;(r||n)&&window.history.replaceState(window.history.state,"",o(window.location.href)),w(s?((e=new URL(o(t=window.location.href),new URL(t).origin)).searchParams.set("hf_login","1"),e.href):null),u(!0)}}),()=>{e=!1}},[m]),(0,n.useEffect)(()=>{let e;if(!s)return;let t=()=>{window.clearTimeout(e);let r=s.expiresAt-Date.now();r<=0?(l.clear(),i(null)):e=window.setTimeout(t,Math.min(r,0x7fffffff))};return t(),window.addEventListener("focus",t),()=>{window.clearTimeout(e),window.removeEventListener("focus",t)}},[s]);let k=(0,n.useCallback)(()=>{l.clear(),i(null),d(null)},[]),v=(0,n.useMemo)(()=>({required:a.REQUIRES_HF_SIGN_IN,ready:c,accessToken:s?.accessToken??null,username:s?.username??null,error:f,isSigningIn:g,signInUrl:y,signIn:m,signOut:k}),[f,g,c,s,m,y,k]);return(0,t.jsx)(h.Provider,{value:v,children:e})},"useHfOAuth",0,function(){let e=(0,n.useContext)(h);if(!e)throw Error("useHfOAuth must be used within HfOAuthProvider.");return e}],23384)},96869,e=>{"use strict";e.i(47167);let t="suplo6669/sharpify-ai-inference".trim()||"",r=t.length>0;e.s(["HF_INFERENCE_SPACE",0,t,"REQUIRES_HF_SIGN_IN",0,r])}]);