varfaceapi=(()=>{varXs=Object.defineProperty,Sv=Object.prototype.hasOwnProperty,S=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),lf=e=>Xs(e,"__esModule",{value:!0}),Oe=(e,t)=>{lf(e);for(varnint)Xs(e,n,{get:t[n],enumerable:!0})},Tv=(e,t)=>{if(lf(e),typeoft=="object"||typeoft=="function")for(letnint)!Sv.call(e,n)&&n!=="default"&&Xs(e,n,{get:()=>t[n],enumerable:!0});returne},Iv=e=>e&&e.__esModule?e:Tv(Xs({},"default",{value:e,enumerable:!0}),e);varBe=S(Av=>{Oe(Av,{__assign:()=>Zp,__asyncDelegator:()=>Wv,__asyncGenerator:()=>Uv,__asyncValues:()=>qv,__await:()=>hi,__awaiter:()=>Ov,__classPrivateFieldGet:()=>$v,__classPrivateFieldSet:()=>Hv,__createBinding:()=>Qp,__decorate:()=>Rv,__exportStar:()=>Dv,__extends:()=>Nv,__generator:()=>kv,__importDefault:()=>Gv,__importStar:()=>jv,__makeTemplateObject:()=>Bv,__metadata:()=>Ev,__param:()=>Cv,__read:()=>uf,__rest:()=>_v,__spread:()=>Fv,__spreadArrays:()=>Mv,__values:()=>el});varXp=function(e,t){returnXp=Object.setPrototypeOf||{__proto__:[]}instanceofArray&&function(n,r){n.__proto__=r}||function(n,r){for(variinr)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Xp(e,t)};functionNv(e,t){Xp(e,t);functionn(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,newn())}varZp=function(){returnZp=Object.assign||function(t){for(varn,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(varoinn)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}returnt},Zp.apply(this,arguments)};function_v(e,t){varn={};for(varrine)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeofObject.getOwnPropertySymbols=="function")for(vari=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);returnn}functionRv(e,t,n,r){vari=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,a;if(typeofReflect=="object"&&typeofReflect.decorate=="function")o=Reflect.decorate(e,t,n,r);elsefor(vars=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);returni>3&&o&&Object.defineProperty(t,n,o),o}functionCv(e,t){returnfunction(n,r){t(n,r,e)}}functionEv(e,t){if(typeofReflect=="object"&&typeofReflect.metadata=="function")returnReflect.metadata(e,t)}functionOv(e,t,n,r){functioni(o){returnoinstanceofn?o:newn(function(a){a(o)})}returnnew(n||(n=Promise))(function(o,a){functions(l){try{p(r.next(l))}catch(u){a(u)}}functionc(l){try{p(r.throw(l))}catch(u){a(u)}}functionp(l){l.done?o(l.value):i(l.value).then(s,c)}p((r=r.apply(e,t||[])).next())})}functionkv(e,t){varn={label:0,sent:function(){if(o[0]&1)throwo[1];returno[1]},trys:[],ops:[]},r,i,o,a;returna={next:s(0),throw:s(1),return:s(2)},typeofSymbol=="function"&&(a[Symbol.iterator]=function(){returnthis}),a;functions(p){returnfunction(l){returnc([p,l])}}functionc(p){if(r)thrownewTypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)returno;(i=0,o)&&(p=[p[0]&2,o.value]);switch(p[0]){case0:case1:o=p;break;case4:returnn.label++,{value:p[1],done:!1};case5:n.label++,i=p[1],p=[0];continue;case7:p=n.ops.pop(),n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){n.label=p[1];break}if(p[0]===6&&n.label<o[1]){n.label=o[1],o=p;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(p);break}o[2]&&n.ops.pop(),n.trys.pop();continue}p=t.call(e,n)}catch(l){p=[6,l],i=0}finally{r=o=0}if(p[0]&5)throwp[1];return{value:p[0]?p[1]:void0,done:!0}}}varQp=Object.create?function(e,t,n,r){r===void0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){returnt[n]}})}:function(e,t,n,r){r===void0&&(r=n),e[r]=t[n]};functionDv(e,t){for(varnine)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Qp(t,e,n)}functionel(e){vart=typeofSymbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)returnn.call(e);if(e&&typeofe.length=
`;return m[m.length-1]=" "+m[m.length-1]+"]"+(o?"":y),m}function js(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}class yr{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=Z(e),n!=null){const r=n.length;f(r===this.size,()=>`Lengthofvalues'${r}'doesnotmatchthesizeinferredbytheshape'${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||dm(t,this.size),this.strides=Bt(e)}set(e,...t){t.length===0&&(t=[0]),f(t.length===this.rank,()=>`Thenumberofprovidedcoordinates(${t.length})mustmatchtherank(${this.rank})`);const n=this.locToIndex(t);this.values[n]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(const r of e){if(r<0||r>=this.shape[t]){const i=`Requestedoutofrangeelementat${e}.Buffershape=${this.shape}`;throw new Error(i)}t++}let n=e[e.length-1];for(let r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.values[n]}locToIndex(e){if(this.rank===0)return 0;if(this.rank===1)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(this.rank===0)return[];if(this.rank===1)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return jt().makeTensor(this.values,this.shape,this.dtype)}}let jt=null,oi=null,S0=null;function Ny(e){jt=e}function _y(e){oi=e}function Ry(e){S0=e}class de{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Z(e),this.strides=Bt(e),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return oi.buffer(this.shape,this.dtype,e)}bufferSync(){return oi.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return cr(this.shape,e)}arraySync(){return cr(this.shape,this.dataSync())}async data(){this.throwIfDisposed();const e=jt().read(this.dataId);if(this.dtype==="string"){const t=await e;try{return t.map(n=>Ep(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataSync(){this.throwIfDisposed();const e=jt().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>Ep(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await jt().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){if(this.isDisposed)return;jt().disposeTensor(this),this.isDisposedInternal=!0}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return oi.print(this,e)}clone(){return this.throwIfDisposed(),oi.clone(this)}toString(e=!1){const t=this.dataSync();return Iy(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),oi.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),jt().makeVariable(this,e,t,n)}}Object.defineProperty(de,Symbol.hasInstance,{value:e=>!!e&&e.dataId!=null&&e.shape!=null&&e.dtype!=null});class Nn extends de{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r);this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtypeofthenewvalue(${e.dtype})andpreviousvalue(${this.dtype})mustmatch`);if(!Le(e.shape,this.shape))throw new Error(`shapeofthenewvalue(${e.shape})andpreviousvalue(${this.shape})mustmatch`);jt().disposeTensor(this),this.dataId=e.dataId,jt().incRef(this,null)}dispose(){jt().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(Nn,Symbol.hasInstance,{value:e=>e instanceof de&&e.assign!=null&&e.assign instanceof Function});var al;(function(e){e.R0="R0",e.R1="R1",e.R2
rank${o.rank}.`),f(J(t),()=>`ErrorinlocalResponseNormalization:depthRadiusmustbeanintegerbutgotdepthRadius${t}.`);let a=o,s=!1;o.rank===3&&(s=!0,a=x(o,[1,o.shape[0],o.shape[1],o.shape[2]]));const c=(m,b)=>{const y=m.localResponseNormalization4D(a,t,n,r,i);return b([a,y]),y},p={x:a},l={depthRadius:t,bias:n,alpha:r,beta:i},u=g.runKernelFunc(c,p,null,No,l);return s?x(u,[u.shape[1],u.shape[2],u.shape[3]]):u}const Jl=d({localResponseNormalization_:L1});function v1(e){const t=h(e,"x","log"),n={x:t};return g.runKernelFunc((r,i)=>{const o=r.log(t);return i([t]),o},n,null,To)}const gt=d({log_:v1});function S1(e){const t=h(e,"x","log1p"),n={x:t};return g.runKernelFunc((r,i)=>{const o=r.log1p(t);return i([t]),o},n,null,Io)}const Ni=d({log1p_:S1});function aS(e){return f(qt(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{const r=h(t,"x","tf.grad",null),i=n!=null?h(n,"dy","tf.grad"):null;return g.tidy(()=>{const{value:o,grads:a}=g.gradients(()=>e(r),[r],i);return i!=null&&$(o.shape,i.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Up(a),a[0]})}}function cS(e){return f(qt(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{f(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");const r=rn(t,"args","tf.grads",null),i=n!=null?h(n,"dy","tf.grads"):null;return g.tidy(()=>{const{value:o,grads:a}=g.gradients(()=>e(...r),r,i);return i!=null&&$(o.shape,i.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Up(a),a})}}function pS(e){return f(qt(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{f(t instanceof de,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),f(n==null||n instanceof de,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");const{grads:r,value:i}=g.gradients(()=>e(t),[t],n);return Up(r),{grad:r[0],value:i}}}function lS(e){return f(qt(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{f(Array.isArray(t)&&t.every(i=>i instanceof de),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),f(n==null||n instanceof de,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");const r=g.gradients(()=>e(...t),t,n);return n!=null&&$(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Up(r.grads),r}}function kh(e,t){f(qt(e),()=>"The f passed in variableGrads(f) must be a function"),f(t==null||Array.isArray(t)&&t.every(p=>p instanceof Nn),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const n=t!=null;if(!n){t=[];for(const p in g.registeredVariables)t.push(g.registeredVariables[p])}const r=n?t.filter(p=>!p.trainable):null,i=t.length;t=t.filter(p=>p.trainable),f(t.length>0,()=>`variableGrads()expectsatleastoneoftheinputvariablestobetrainable,butnoneofthe${i}variablesistrainable.`);const o=!0,{value:a,grads:s}=g.gradients(e,t,null,o);f(s.some(p=>p!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),f(a.rank===0,()=>`ThefpassedinvariableGrads(f)mustreturnascalar,butitreturnedarank-${a.rank}tensor`);const c={};return t.forEach((p,l)=>{s[l]!=null&&(c[p.name]=s[l])}),r!=null&&r.forEach(p=>c[p.name]=null),{value:a,grads:c}}function $e(e){return g.customGrad(e)}function Up(e){const t=e.filter(n=>n==null).length;if(t>0)throw new Error(`Cannotcomputegradientofy=f(x)withrespecttox.Makesurethat
Expected:${o}.`);for(let a=0;a<o.length;++a){const s=i[a],c=o[a];if(!n(s,c))throw new Error(`Arraysdiffer:actual[${a}]=${s},expected[${a}]=${c}.
Actual:${i}.
Expected:${o}.`)}}function hC(e,t){e().then(()=>t.fail(),()=>t())}function dC(e,t){const n=typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[t]:t;return Rt(e)||Rt(e[0])||Rt(t)||Rt(t[0])?jm(e,n,(r,i)=>r==i):jm(e,t,(r,i)=>Gm(r,i,0))}function mC(e,t,n){if(n==null&&(n=Pm()),!Gm(e,t,n))throw new Error(`Numbersdiffer:actual===${e},expected===${t}`)}function Gm(e,t,n){return!isFinite(e)&&!isFinite(t)?!0:!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function fC(e,t,n){for(let r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error(`Valueoutofrange:${e[r]}low:${t},high:${n}`)}function gC(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}const Wp=Iv(Nf());class zs{constructor(e,t,n,r,i){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);const o=i||Math.random();this.random=Wp.alea(o.toString())}nextValue(){if(!isNaN(this.nextVal)){const r=this.nextVal;return this.nextVal=NaN,r}let e,t,n=!1;for(;!n;){let r,i,o;do r=2*this.random()-1,i=2*this.random()-1,o=r*r+i*i;while(o>=1||o===0);const a=Math.sqrt(-2*Math.log(o)/o);e=this.mean+this.stdDev*r*a,t=this.mean+this.stdDev*i*a,(!this.truncated||this.isValidTruncated(e))&&(n=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class By{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;const i=r||Math.random();this.randu=Wp.alea(i.toString()),this.randn=new zs(0,1,n,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,i,o;for(;;){do r=this.randn.nextValue(),o=1+this.c*r;while(o<=0);if(o*=o*o,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-o+Math.log(o)),i=this.randu(),i<t||Math.log(i)<n)break}return o=1/this.beta*this.d*o,this.alpha<1&&(o*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(o)}convertValue(e){return this.dtype==="float32"?e:Math.round(e)}}class Py{constructor(e=0,t=1,n,r){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=n,r==null&&(r=Math.random()),typeof r=="number"&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`Thedifferencebetween${e}-${t}<=1anddtypeisnotfloat`);this.random=Wp.alea(r)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}function bC(e,t,n=1,r="float32",i){if(n==null&&(n=1),r==null&&(r="float32"),r!=="float32"&&r!=="int32")throw new Error(`Unsupporteddatatype${r}`);const o=new By(t,n,r,i),a=ke(e,r);for(let s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}const Ol=d({randomGamma_:bC});function wC(e,t=0,n=1,r,i){if(r!=null&&r==="bool")throw new Error(`Unsupporteddatatype${r}`);const o=new zs(t,n,r,!1,i),a=ke(e,r);for(let s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}const El=d({randomNormal_:wC});function yC(e,t=0,n=1,r="float32",i){const o=ke(e,r),a=new Py(t,n,null,i);for(let s=0;s<o.values.length;s++)o.values[s]=a.nextValue();return o.toTensor()}const Li=d({randomUniform_:yC});function ht(e,t){lt(e);const n=Fe(e,t);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");const r=null;return ze(e,r,n,t)}function vr(e,t,n=1,r="float32"){if(n===0)throw new Error("Cannot have a step of zero");const i=()=>{const a=e===t,s=e<t&&n<0,c=t<e&&n>1;if(a||s||c)return Ue([0],r);const p=Math.abs(Math.ceil((t-e)/n)),l=Pt(p,r);t<e&&n===1&&(n=-1),l[0]=e;for(let u=1;u<l.length;u++)l[u]=l[u-1]+n;return ht(l,r)},o={start:e,stop:t,step:n,dtype:r};return g.runKernelFunc(i,{},null,Sh,o)}function xC(e){const t=h(e,"x","reciprocal"),n={x:t};return g.runKernelFunc((r,i)=>{const o=r.reciprocal(t);return i([t]),o},n,null,jo)}const Cl=d({reciprocal_:xC});function LC(e){const t=h(e,"x","relu"),n=(i,o)=>(o([t]),t.dtype==="bool"?R(t,"int32"):i.relu(t)),r={x
ManifestJSONhasweightswithnames:${s.join(", ")}.`)}const c=i.reduce((b,y,w)=>(y&&b.push(w),b),[]),p=[];c.forEach(b=>{t[b].paths.forEach(y=>{const w=n+(n.endsWith("/")?"":"/")+y;p.push(w)})});const l=await e(p),u={};let m=0;return c.forEach(b=>{const y=t[b].paths.length;let w=0;for(let N=0;N<y;N++)w+=l[m+N].byteLength;const L=new ArrayBuffer(w),T=new Uint8Array(L);let A=0;for(let N=0;N<y;N++){const C=new Uint8Array(l[m+N]);T.set(C,A),A+=C.byteLength}const _=o[b];_.forEach(N=>{const C=L.slice(N.groupOffset,N.groupOffset+N.sizeBytes),F=Vm(C,[N.manifestEntry]);for(const E in F)u[E]=F[E]}),m+=y}),u}}const EO="application/octet-stream",OO="application/json";class Zm{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,t.fetchFunc!=null?(f(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=se().platform.fetch,f(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&f(e.length===2,()=>`URLpathsforhttpmusthavealengthof2,(actuallengthis${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData();const n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,userDefinedMetadata:e.userDefinedMetadata,weightsManifest:n};t.body.append("model.json",new Blob([JSON.stringify(r)],{type:OO}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:EO}),"model.weights.bin");const i=await this.fetch(this.path,t);if(i.ok)return{modelArtifactsInfo:Js(e),responses:[i]};throw new Error(`BrowserHTTPRequest.save()failedduetoHTTPresponsestatus${i.status}.`)}async load(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Requestto${this.path}failedwithstatuscode${e.status}.PleaseverifythisURLpointstothemodelJSONofthemodeltoload.`);let t;try{t=await e.json()}catch(l){let u=`FailedtoparsemodelJSONofresponsefrom${this.path}.`;throw this.path.endsWith(".pb")?u+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":u+=" Please make sure the server is serving valid JSON for this request.",new Error(u)}const n=t.modelTopology,r=t.weightsManifest,i=t.generatedBy,o=t.convertedBy,a=t.format,s=t.userDefinedMetadata;if(n==null&&r==null)throw new Error(`TheJSONfromHTTPpath${this.path}containsneithermodeltopologyormanifestforweights.`);let c,p;if(r!=null){const l=await this.loadWeights(r);[c,p]=l}return{modelTopology:n,weightSpecs:c,weightData:p,userDefinedMetadata:s,generatedBy:i,convertedBy:o,format:a}}async loadWeights(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=kO(t),i=this.weightPathPrefix||n,o=[];for(const c of e)o.push(...c.weights);const a=[];e.forEach(c=>{c.paths.forEach(p=>{a.push(i+p+r)})});const s=await Xm(a,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[o,Ks(s)]}}Zm.URL_SCHEME_REGEX=/^https?:\/\//;function kO(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),r=e.substring(0,t),i=n>t?e.substring(n):"";return[r+"/",i]}function Qm(e){return e.match(Zm.URL_SCHEME_REGEX)!=null}const Nx=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.f