museaikit
Version:
A powerful music-focused AI toolkit
2 lines • 1.92 MB
JavaScript
/*! For license information please see museaikit.js.LICENSE.txt */
(()=>{var __webpack_modules__={24:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(s,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function o(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,o)}u((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.pianorollToNoteSequence=e.unbatchOutput=e.batchInput=void 0;var i=n(8644),a=n(6453),o=n(9007);e.batchInput=function(t,e){var n=Math.ceil(t.length/e),r=t.length%e,s=0;if(n>1&&r>0&&r<=3&&(n-=1,s=r,r=0),1===n)return i.tensor2d(t).expandDims(0);var a,o=e+6,u=i.tensor2d(t.slice(0,o)).expandDims(0),l=i.tensor2d(t.slice(t.length-o)).expandDims(0);if(2===n)return i.concat([u,l],0);a=r?i.tensor2d(t).pad([[0,e-r],[0,0]]).as3D(n,e,-1):i.tensor2d(t.slice(0,t.length-s)).as3D(n,e,-1);var c=i.slice(a,[0,e-3],[n-2,-1]),h=i.slice(a,[2,0],[-1,3]),p=i.concat([c,a.slice(1,n-2),h],1);return i.concat([u,p,l],0)},e.unbatchOutput=function(t,e,n){return 1===t.shape[0]?t:i.tidy((function(){var r=t.slice([0,0],[1,e]),s=n%e;s<=3&&(s+=e);var a=t.slice([t.shape[0]-1,t.shape[1]-s],[-1,-1]),o=[r,a];if(t.shape[0]>2){var u=t.shape[0]-2;o=[r,t.slice([1,3],[u,e]).as3D(1,u*e,-1),a]}return i.concat(o,1)}))},e.pianorollToNoteSequence=function(t,e,n,u,l){return void 0===u&&(u=.5),void 0===l&&(l=.5),r(this,void 0,void 0,(function(){function r(t,e){h.notes.push(a.NoteSequence.Note.create({pitch:t+o.MIN_MIDI_PITCH,startTime:(p[t]-1)*o.FRAME_LENGTH_SECONDS,endTime:e*o.FRAME_LENGTH_SECONDS,velocity:d[t]})),p[t]=0}function c(t,e,n){p[t]?f[t]||(r(t,e),p[t]=e+1,d[t]=n):(p[t]=e+1,d[t]=n)}var h,p,d,f,m,g,y,v,b,w,x,_,S;return s(this,(function(s){switch(s.label){case 0:return h=a.NoteSequence.create(),p=new Uint32Array(o.MIDI_PITCHES),d=new Uint8Array(o.MIDI_PITCHES),f=new Uint8Array(o.MIDI_PITCHES),m=i.tidy((function(){var r=i.greater(e,u),s=i.greater(t,l);return r=r.pad([[0,1],[0,0]]),s=s.pad([[0,1],[0,0]]),n=n.pad([[0,1],[0,0]]),[s=i.logicalOr(s,r),r,n]})),[4,Promise.all(m.map((function(t){return t.data()})))];case 1:for(g=s.sent(),y=g[0],v=g[1],b=g[2],m.forEach((function(t){return t.dispose()})),w=t.shape[0],x=0;x<w+1;++x){for(_=0;_<o.MIDI_PITCHES;++_)S=x*o.MIDI_PITCHES+_,v[S]?c(_,x,b[S]):!y[S]&&p[_]&&r(_,x);f=v.slice(x*o.MIDI_PITCHES,(x+1)*o.MIDI_PITCHES)}return h.totalTime=w*o.FRAME_LENGTH_SECONDS,[2,h]}}))}))}},26:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getOfflineAudioContext=e.isSafari=e.navigator=e.performance=e.fetch=void 0;var r=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("cannot find the global object")}();e.fetch=r.fetch.bind(r),e.performance=r.performance,e.navigator=r.navigator,e.isSafari=!!r.webkitOfflineAudioContext;var s=void 0!==r.WorkerGlobalScope;e.getOfflineAudioContext=function(t){if(t=e.isSafari?44100:t,s)throw new Error("Cannot use offline audio context in a web worker.");var n=r.webkitOfflineAudioContext;return e.isSafari?new n(1,t,t):new r.OfflineAudioContext(1,t,t)}},40:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PianoGenieKeysigChord=e.PianoGenieKeysigChordFamily=e.PianoGenieChord=e.PianoGenieKeysig=e.PianoGenie=void 0;var r=n(1433);Object.defineProperty(e,"PianoGenie",{enumerable:!0,get:function(){return r.PianoGenie}}),Object.defineProperty(e,"PianoGenieKeysig",{enumerable:!0,get:function(){return r.PianoGenieKeysig}}),Object.defineProperty(e,"PianoGenieChord",{enumerable:!0,get:function(){return r.PianoGenieChord}}),Object.defineProperty(e,"PianoGenieKeysigChordFamily",{enumerable:!0,get:function(){return r.PianoGenieKeysigChordFamily}}),Object.defineProperty(e,"PianoGenieKeysigChord",{enumerable:!0,get:function(){return r.PianoGenieKeysigChord}})},99:(t,e,n)=>{"use strict";n.d(e,{N:()=>m});var r=n(1585),s=n(1830),i=n(5441),a=n(565),o=n(8189),u=n(5119),l=n(7523),c=n(2198),h=n(8646),p=n(5703),d=n(929),f=n(2302);const m=(0,d.op)({fusedMatMul_:function({a:t,b:e,transposeA:n=!1,transposeB:d=!1,bias:m,activation:g="linear",preluActivationWeights:y}){if(!1===(0,h.zE)(r.T2.state.gradientDepth,g)){let r=(0,p.N)(t,e,n,d);return null!=m&&(r=(0,l.W)(r,m)),(0,h.f2)(r,g,y)}let v=(0,o.YT)(t,"a","fused matMul"),b=(0,o.YT)(e,"b","fused matMul");[v,b]=(0,a.makeTypesMatch)(v,b);const w=n?v.shape[v.rank-2]:v.shape[v.rank-1],x=d?b.shape[b.rank-1]:b.shape[b.rank-2],_=n?v.shape[v.rank-1]:v.shape[v.rank-2],S=d?b.shape[b.rank-2]:b.shape[b.rank-1],T=v.shape.slice(0,-2),k=b.shape.slice(0,-2),A=u.Ze(T),C=u.Ze(k);u.vA(v.rank>=2&&b.rank>=2&&v.rank===b.rank,(()=>`Error in fused matMul: inputs must have the same rank of at least 2, got ranks ${v.rank} and ${b.rank}.`)),u.vA(u.r1(T,k),(()=>`Error in fused matMul: outer dimensions (${T}) and (${k}) of Tensors with shapes ${v.shape} and ${b.shape} must match.`)),u.vA(w===x,(()=>`Error in fused matMul: inner shapes (${w}) and (${x}) of Tensors with shapes ${v.shape} and ${b.shape} and transposeA=${n} and transposeB=${d} must match.`));const N=v.shape.slice(0,-2).concat([_,S]),I=n?(0,f.t)(v,[A,w,_]):(0,f.t)(v,[A,_,w]),E=d?(0,f.t)(b,[C,S,x]):(0,f.t)(b,[C,x,S]);let O,M;null!=m&&(O=(0,o.YT)(m,"bias","fused matMul"),[O]=(0,a.makeTypesMatch)(O,v),c.Ky(N,O.shape)),null!=y&&(M=(0,o.YT)(y,"prelu weights","fused matMul"));const D=(t,e)=>{const[r,s,i,a]=e,o=(0,h.XB)((0,f.t)(t,i.shape),i,g);let u,l;return n||d?!n&&d?(u=(0,p.N)(o,s,!1,!1),l=(0,p.N)(o,r,!0,!1)):n&&!d?(u=(0,p.N)(s,o,!1,!0),l=(0,p.N)(r,o,!1,!1)):(u=(0,p.N)(s,o,!0,!0),l=(0,p.N)(o,r,!0,!0)):(u=(0,p.N)(o,s,!1,!0),l=(0,p.N)(r,o,!0,!1)),null!=m?[u,l,(0,h.Do)(a,o)]:[u,l]},R=t=>t.fusedBatchMatMul({a:I,b:E,transposeA:n,transposeB:d,bias:O,activation:g,preluActivationWeights:M}),P={a:I,b:E,bias:O,preluActivationWeights:M},F={transposeA:n,transposeB:d,activation:g};if(null==m){const t=(0,s._X)(((t,e,n)=>{const s=r.T2.runKernelFunc(R,P,null,i.Dr,F);return n([t,e,s]),{value:(0,f.t)(s,N),gradFunc:D}}));return t(I,E)}{const t=(0,s._X)(((t,e,n,s)=>{const a=r.T2.runKernelFunc(R,P,null,i.Dr,F);return s([t,e,a,n]),{value:(0,f.t)(a,N),gradFunc:D}}));return t(I,E,O)}}})},112:(t,e,n)=>{"use strict";n.d(e,{V:()=>u});var r=n(1585),s=n(5441),i=n(8189),a=n(929),o=n(9809);const u=(0,a.op)({relu_:function(t){const e=(0,i.YT)(t,"x","relu"),n={x:e};return r.T2.runKernelFunc(((t,n)=>(n([e]),"bool"===e.dtype?(0,o.w)(e,"int32"):t.relu(e))),n,null,s.fU)}})},125:(t,e,n)=>{"use strict";n.d(e,{o:()=>a});var r=n(1585),s=n(5441),i=n(8189);const a=(0,n(929).op)({clone_:function(t){const e=(0,i.YT)(t,"x","clone",null),n={x:e};return r.T2.runKernelFunc((()=>r.T2.makeTensorFromDataId(e.dataId,e.shape,e.dtype)),n,null,s.lz)}})},129:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MelodyRegister=e.MelodyShape=e.MelodyRhythm=e.Melody=e.NOTE_OFF=e.NO_EVENT=void 0;var r=n(8644),s=n(6453),i=n(1875);e.NO_EVENT=0,e.NOTE_OFF=1;var a=function(){function t(t,e,n){this.events=t,this.minPitch=e,this.maxPitch=n}return t.fromNoteSequence=function(n,r,s,a,o){void 0===a&&(a=!0),i.assertIsQuantizedSequence(n);var u=n.notes.sort((function(t,e){return t.quantizedStartStep===e.quantizedStartStep?e.pitch-t.pitch:t.quantizedStartStep-e.quantizedStartStep})),l=new Int32Array(o||n.totalQuantizedSteps),c=-1;return u.forEach((function(t){if(t.quantizedStartStep===c){if(a)return;throw new Error("`NoteSequence` is not monophonic.")}if(t.pitch<r||t.pitch>s)throw Error("`NoteSequence` has a pitch outside of the valid range: "+"".concat(t.pitch));l[t.quantizedStartStep]=t.pitch-r+2,l[t.quantizedEndStep]=e.NOTE_OFF,c=t.quantizedStartStep})),new t(l,r,s)},t.prototype.toNoteSequence=function(t,n){for(var r=i.createQuantizedNoteSequence(t,n),a=null,o=0;o<this.events.length;++o){var u=this.events[o];switch(u){case e.NO_EVENT:break;case e.NOTE_OFF:a&&(a.quantizedEndStep=o,r.notes.push(a),a=null);break;default:a&&(a.quantizedEndStep=o,r.notes.push(a)),a=s.NoteSequence.Note.create({pitch:u-2+this.minPitch,quantizedStartStep:o})}}return a&&(a.quantizedEndStep=this.events.length,r.notes.push(a)),r.totalQuantizedSteps=this.events.length,r},t}();e.Melody=a;var o=function(){function t(){this.depth=1}return t.prototype.extract=function(t){for(var e=t.events.length,n=r.buffer([e,1]),s=0;s<e;++s)n.set(t.events[s]>=2?1:0,s,0);return n.toTensor().as2D(e,1)},t}();e.MelodyRhythm=o;var u=function(){function t(){this.depth=3}return t.prototype.extract=function(t){for(var e=t.events.length,n=r.buffer([e,3]),s=null,i=null,a=0;a<e;++a)if(t.events[a]>=2){if(null!==s){0===n.get(s,0)&&0===n.get(s,1)&&0===n.get(s,2)&&(s=-1);var o;o=t.events[a]<i?0:t.events[a]>i?2:1;for(var u=a;u>s;--u)n.set(1,u,o)}s=a,i=t.events[a]}if(s!==e-1)if(null===s||0===n.get(s,0)&&0===n.get(s,1)&&0===n.get(s,2))for(u=0;u<e;++u)n.set(1,u,1);else for(u=e-1;u>s;--u)for(var l=0;l<3;l++)n.set(n.get(s,l),u,l);return n.toTensor().as2D(e,3)},t}();e.MelodyShape=u;var l=function(){function t(t){this.boundaryPitches=t,this.depth=t.length+1}return t.prototype.meanMelodyPitch=function(t){for(var n=0,r=0,s=null,i=0;i<t.events.length;++i)t.events[i]===e.NOTE_OFF?s=null:t.events[i]>=2&&(s=t.minPitch+t.events[i]-2),null!==s&&(n+=s,r+=1);return r?n/r:null},t.prototype.extract=function(t){var e=t.events.length,n=this.meanMelodyPitch(t);if(null===n)return r.zeros([e,this.depth]);for(var s=0;s<this.boundaryPitches.length&&n>=this.boundaryPitches[s];)s++;for(var i=r.buffer([e,this.depth]),a=0;a<e;++a)i.set(1,a,s);return i.toTensor().as2D(e,this.depth)},t}();e.MelodyRegister=l},152:(t,e,n)=>{"use strict";n.d(e,{z:()=>o});var r=n(1585),s=n(5441),i=n(565),a=n(8189);const o=(0,n(929).op)({mod_:function(t,e){let n=(0,a.YT)(t,"a","mod"),o=(0,a.YT)(e,"b","mod");[n,o]=(0,i.makeTypesMatch)(n,o);const u={a:n,b:o};return r.T2.runKernelFunc(((t,e)=>{const r=t.mod(n,o);return e([n,o]),r}),u,null,s.BL)}})},159:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Performance=void 0;var r=n(6453),s=n(1516),i=n(1875),a=n(4240),o=function(){function t(t,e,n,r,s){this.events=t,this.maxShiftSteps=e,this.numVelocityBins=n,this.program=r,this.isDrum=s}return t.fromNoteSequence=function(e,n,r,a){i.assertIsQuantizedSequence(e);for(var o=e.notes.filter((function(t,e){return void 0===a||t.instrument===a})),u=o.sort((function(t,e){return t.startTime===e.startTime?t.pitch-e.pitch:t.startTime-e.startTime})),l=u.map((function(t,e){return{step:t.quantizedStartStep,index:e,isOffset:0}})),c=u.map((function(t,e){return{step:t.quantizedEndStep,index:e,isOffset:1}})),h=l.concat(c).sort((function(t,e){return t.step===e.step?t.index===e.index?t.isOffset-e.isOffset:t.index-e.index:t.step-e.step})),p=r?Math.ceil((s.MIDI_VELOCITIES-1)/r):void 0,d=[],f=0,m=r,g=0,y=h;g<y.length;g++){var v=y[g];if(v.step>f){for(;v.step>f+n;)d.push({type:"time-shift",steps:n}),f+=n;d.push({type:"time-shift",steps:v.step-f}),f=v.step}if(v.isOffset)d.push({type:"note-off",pitch:u[v.index].pitch});else{if(p){var b=Math.floor((u[v.index].velocity-s.MIN_MIDI_VELOCITY-1)/p)+1;b!==m&&(d.push({type:"velocity-change",velocityBin:b}),m=b)}d.push({type:"note-on",pitch:u[v.index].pitch})}}var w=!!o.some((function(t){return t.isDrum}))&&(!o.some((function(t){return!t.isDrum}))||void 0),x=Array.from(new Set(o.map((function(t){return t.program})))),_=new t(d,n,r,w||1!==x.length?void 0:x[0],w);return _.setNumSteps(e.totalQuantizedSteps),_},t.prototype.getNumSteps=function(){return this.events.filter((function(t){return"time-shift"===t.type})).map((function(t){return t.steps})).reduce((function(t,e){return t+e}),0)},t.prototype.setNumSteps=function(t){var e=this.getNumSteps();if(e<t){if(this.events.length){var n=this.events[this.events.length-1];if("time-shift"===n.type){var r=Math.min(t-e,this.maxShiftSteps-n.steps);n.steps+=r,e+=r}}for(;e<t;)e+this.maxShiftSteps>t?(this.events.push({type:"time-shift",steps:t-e}),e=t):(this.events.push({type:"time-shift",steps:this.maxShiftSteps}),e+=this.maxShiftSteps)}else if(e>t)for(;this.events.length&&e>t;){var s=this.events[this.events.length-1];"time-shift"===s.type?e-s.steps<t?(s.steps-=e-t,e=t):(this.events.pop(),e-=s.steps):this.events.pop()}},t.prototype.toNoteSequence=function(t){for(var e=this,n=this.numVelocityBins?Math.ceil((s.MIDI_VELOCITIES-1)/this.numVelocityBins):void 0,i=r.NoteSequence.create(),o=0,u=void 0,l=new Map,c=s.MIN_MIDI_PITCH;c<=s.MAX_MIDI_PITCH;++c)l.set(c,[]);for(var h=0,p=this.events;h<p.length;h++){var d=p[h];switch(d.type){case"note-on":l.get(d.pitch).push([o,u]);break;case"note-off":var f=l.get(d.pitch);if(f.length){var m=f.shift(),g=m[0],y=m[1];o>g?i.notes.push(r.NoteSequence.Note.create({pitch:d.pitch,velocity:y,instrument:t,quantizedStartStep:g,quantizedEndStep:o,program:this.program,isDrum:this.isDrum})):a.log("Ignoring zero-length note: "+"(pitch = ".concat(d.pitch,", step = ").concat(o,")"),"Performance")}else a.log("Ignoring note-off with no previous note-on:"+"(pitch = ".concat(d.pitch,", step = ").concat(o,")"),"Performance");break;case"time-shift":o+=d.steps;break;case"velocity-change":if(!n)throw new Error("Unexpected velocity change event: ".concat(d));u=s.MIN_MIDI_VELOCITY+(d.velocityBin-1)*n+1;break;default:throw new Error("Unrecognized performance event: ".concat(d))}}return l.forEach((function(n,s){for(var u=0,l=n;u<l.length;u++){var c=l[u],h=c[0],p=c[1];o>h?i.notes.push(r.NoteSequence.Note.create({pitch:s,velocity:p,instrument:t,quantizedStartStep:h,quantizedEndStep:o,program:e.program,isDrum:e.isDrum})):a.log("Ignoring zero-length note: "+"(pitch = ".concat(s,", step = ").concat(o,")"),"Performance")}})),i.totalQuantizedSteps=o,i},t}();e.Performance=o},167:(t,e,n)=>{"use strict";n.d(e,{I:()=>c});var r=n(1585),s=n(5441),i=n(8189),a=n(5119),o=n(7195),u=n(929),l=n(2302);const c=(0,u.op)({conv3d_:function(t,e,n,u,c="NDHWC",h=[1,1,1]){const p=(0,i.YT)(t,"x","conv3d"),d=(0,i.YT)(e,"filter","conv3d");let f=p,m=!1;4===p.rank&&(m=!0,f=(0,l.t)(p,[1,p.shape[0],p.shape[1],p.shape[2],p.shape[3]])),a.vA(5===f.rank,(()=>`Error in conv3d: input must be rank 5, but got rank ${f.rank}.`)),a.vA(5===d.rank,(()=>`Error in conv3d: filter must be rank 5, but got rank ${d.rank}.`)),a.vA(f.shape[4]===d.shape[3],(()=>`Error in conv3d: depth of input (${f.shape[4]}) must match input depth for filter ${d.shape[3]}.`)),a.vA((0,o.G0)(n,h),(()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${h}'`)),a.vA("NDHWC"===c,(()=>`Error in conv3d: got dataFormat of ${c} but only NDHWC is currently supported.`));const g={x:f,filter:d},y={strides:n,pad:u,dataFormat:c,dilations:h},v=r.T2.runKernelFunc(((t,e)=>{const r=o.p$(f.shape,d.shape,n,h,u),s=t.conv3d(f,d,r);return e([f,d]),s}),g,null,s.A1,y);return m?(0,l.t)(v,[v.shape[1],v.shape[2],v.shape[3],v.shape[4]]):v}})},178:(t,e,n)=>{"use strict";n.d(e,{P:()=>l});var r=n(1585),s=n(5441),i=n(565),a=n(8189),o=n(2198),u=n(9809);const l=(0,n(929).op)({maximum_:function(t,e){let n=(0,a.YT)(t,"a","maximum"),l=(0,a.YT)(e,"b","maximum");[n,l]=(0,i.makeTypesMatch)(n,l),"bool"===n.dtype&&(n=(0,u.w)(n,"int32"),l=(0,u.w)(l,"int32")),(0,o.Ky)(n.shape,l.shape);const c={a:n,b:l};return r.T2.runKernelFunc(((t,e)=>{const r=t.maximum(n,l);return e([n,l]),r}),c,null,s.LD)}})},251:(t,e)=>{e.read=function(t,e,n,r,s){var i,a,o=8*s-r-1,u=(1<<o)-1,l=u>>1,c=-7,h=n?s-1:0,p=n?-1:1,d=t[e+h];for(h+=p,i=d&(1<<-c)-1,d>>=-c,c+=o;c>0;i=256*i+t[e+h],h+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),i-=l}return(d?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,s,i){var a,o,u,l=8*i-s-1,c=(1<<l)-1,h=c>>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*u-1)*Math.pow(2,s),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;t[n+d]=255&o,d+=f,o/=256,s-=8);for(a=a<<s|o,l+=s;l>0;t[n+d]=255&a,d+=f,a/=256,l-=8);t[n+d-f]|=128*m}},252:(t,e,n)=>{"use strict";n.d(e,{v:()=>l});var r=n(1585),s=n(5441),i=n(5119),a=n(7195),o=n(929),u=n(2302);const l=(0,o.op)({conv2DBackpropInput_:function(t,e,n,o,l,c="NHWC",h){i.vA(t.length===e.rank,(()=>`Length of inShape (${t.length}) and rank of dy (${e.rank}) must match`));let p=t,d=e,f=!1;3===e.rank&&(f=!0,d=(0,u.t)(e,[1,e.shape[0],e.shape[1],e.shape[2]]),p=[1,t[0],t[1],t[2]]),i.vA(4===p.length,(()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${p.length}.`)),i.vA(4===d.rank,(()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${d.rank}`)),i.vA(4===n.rank,(()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`));const m="NHWC"===c?p[3]:p[1],g="NHWC"===c?d.shape[3]:d.shape[1];i.vA(m===n.shape[2],(()=>`Error in conv2dDerInput: depth of input (${m}) must match input depth for filter ${n.shape[2]}.`)),i.vA(g===n.shape[3],(()=>`Error in conv2dDerInput: depth of output (${g}) must match output depth for filter ${n.shape[3]}.`)),null!=h&&i.vA(i.E6(l),(()=>`Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode ${h} but got pad ${l}.`));const y={dy:d,filter:n},v={strides:o,pad:l,dataFormat:c,dimRoundingMode:h,inputShape:p},b=r.T2.runKernelFunc(((t,e)=>{const r=a.$Q(c),s=a.uf(p,n.shape,o,1,l,h,!1,r),i=t.conv2dDerInput(d,n,s);return e([d,n]),i}),y,null,s.jf,v);return f?(0,u.t)(b,[b.shape[1],b.shape[2],b.shape[3]]):b}})},259:(t,e,n)=>{"use strict";n.d(e,{qY:()=>y,yl:()=>c,rT:()=>v,B4:()=>g,Q5:()=>m,qP:()=>f});var r=n(5119);function s(t,e,n,s){const a=(0,r.Ur)(e),l=function(t,e,n,s){const a=(0,r.Ze)(e),o=s[s.length-1],l=new Array(o).fill(0),c=e.length,h="complex64"===n?u(t):t;if(c>1)for(let t=0;t<a/o;t++){const e=t*o;for(let t=0;t<o;t++)l[t]=Math.max(l[t],i(h[e+t],0,n).length)}return l}(t,e,n,a),c=e.length,h=o(t,e,n,a,l),p=["Tensor"];return s&&(p.push(` dtype: ${n}`),p.push(` rank: ${c}`),p.push(` shape: [${e}]`),p.push(" values:")),p.push(h.map((t=>" "+t)).join("\n")),p.join("\n")}function i(t,e,n){let s;return s=Array.isArray(t)?`${parseFloat(t[0].toFixed(7))} + ${parseFloat(t[1].toFixed(7))}j`:(0,r.Kg)(t)?`'${t}'`:"bool"===n?a(t):parseFloat(t.toFixed(7)).toString(),(0,r.av)(s,e)}function a(t){return 0===t?"false":"true"}function o(t,e,n,r,s,l=!0){const c="complex64"===n?2:1,h=e[0],p=e.length;if(0===p)return"complex64"===n?[i(u(t)[0],0,n)]:"bool"===n?[a(t[0])]:[t[0].toString()];if(1===p){if(h>20){const e=3*c;let r=Array.from(t.slice(0,e)),a=Array.from(t.slice((h-3)*c,h*c));return"complex64"===n&&(r=u(r),a=u(a)),["["+r.map(((t,e)=>i(t,s[e],n))).join(", ")+", ..., "+a.map(((t,e)=>i(t,s[h-3+e],n))).join(", ")+"]"]}return["["+("complex64"===n?u(t):Array.from(t)).map(((t,e)=>i(t,s[e],n))).join(", ")+"]"]}const d=e.slice(1),f=r.slice(1),m=r[0]*c,g=[];if(h>20){for(let e=0;e<3;e++){const r=e*m,i=r+m;g.push(...o(t.slice(r,i),d,n,f,s,!1))}g.push("...");for(let e=h-3;e<h;e++){const r=e*m,i=r+m;g.push(...o(t.slice(r,i),d,n,f,s,e===h-1))}}else for(let e=0;e<h;e++){const r=e*m,i=r+m;g.push(...o(t.slice(r,i),d,n,f,s,e===h-1))}const y=2===p?",":"";g[0]="["+g[0]+y;for(let t=1;t<g.length-1;t++)g[t]=" "+g[t]+y;let v=",\n";for(let t=2;t<p;t++)v+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(l?"":v),g}function u(t){const e=[];for(let n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var l=n(9783);class c{constructor(t,e,n){if(this.dtype=e,this.shape=t.slice(),this.size=r.Ze(t),null!=n){const t=n.length;r.vA(t===this.size,(()=>`Length of values '${t}' does not match the size inferred by the shape '${this.size}'.`))}if("complex64"===e)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||r.Ab(e,this.size),this.strides=(0,r.Ur)(t)}set(t,...e){0===e.length&&(e=[0]),r.vA(e.length===this.rank,(()=>`The number of provided coordinates (${e.length}) must match the rank (${this.rank})`));const n=this.locToIndex(e);this.values[n]=t}get(...t){0===t.length&&(t=[0]);let e=0;for(const n of t){if(n<0||n>=this.shape[e]){const e=`Requested out of range element at ${t}. Buffer shape=${this.shape}`;throw new Error(e)}e++}let n=t[t.length-1];for(let e=0;e<t.length-1;++e)n+=this.strides[e]*t[e];return this.values[n]}locToIndex(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];let e=t[t.length-1];for(let n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e}indexToLoc(t){if(0===this.rank)return[];if(1===this.rank)return[t];const e=new Array(this.shape.length);for(let n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e}get rank(){return this.shape.length}toTensor(){return h().makeTensor(this.values,this.shape,this.dtype)}}let h=null,p=null,d=null;function f(t){h=t}function m(t){p=t}function g(t){d=t}class y{constructor(t,e,n,s){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=r.Ze(t),this.strides=(0,r.Ur)(t),this.dataId=n,this.id=s,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const t=await this.data();return p.buffer(this.shape,this.dtype,t)}bufferSync(){return p.buffer(this.shape,this.dtype,this.dataSync())}async array(){const t=await this.data();return(0,r.yw)(this.shape,t)}arraySync(){return(0,r.yw)(this.shape,this.dataSync())}async data(){this.throwIfDisposed();const t=h().read(this.dataId);if("string"===this.dtype){const e=await t;try{return e.map((t=>l.decodeString(t)))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return t}dataSync(){this.throwIfDisposed();const t=h().readSync(this.dataId);if("string"===this.dtype)try{return t.map((t=>l.decodeString(t)))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t}async bytes(){this.throwIfDisposed();const t=await h().read(this.dataId);return"string"===this.dtype?t:new Uint8Array(t.buffer)}dispose(){this.isDisposed||(h().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(t=!1){return p.print(this,t)}clone(){return this.throwIfDisposed(),p.clone(this)}toString(t=!1){return s(this.dataSync(),this.shape,this.dtype,t)}cast(t){return this.throwIfDisposed(),p.cast(this,t)}variable(t=!0,e,n){return this.throwIfDisposed(),h().makeVariable(this,t,e,n)}}Object.defineProperty(y,Symbol.hasInstance,{value:t=>!!t&&null!=t.data&&null!=t.dataSync&&null!=t.throwIfDisposed});class v extends y{constructor(t,e,n,r){super(t.shape,t.dtype,t.dataId,r),this.trainable=e,this.name=n}assign(t){if(t.dtype!==this.dtype)throw new Error(`dtype of the new value (${t.dtype}) and previous value (${this.dtype}) must match`);if(!r.r1(t.shape,this.shape))throw new Error(`shape of the new value (${t.shape}) and previous value (${this.shape}) must match`);h().disposeTensor(this),this.dataId=t.dataId,h().incRef(this,null)}dispose(){h().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(v,Symbol.hasInstance,{value:t=>t instanceof y&&null!=t.assign&&t.assign instanceof Function})},269:(t,e,n)=>{"use strict";n.d(e,{y:()=>a});var r=n(1585),s=n(5441),i=n(8189);const a=(0,n(929).op)({asinh_:function(t){const e=(0,i.YT)(t,"x","asinh"),n={x:e};return r.T2.runKernelFunc(((t,n)=>{const r=t.asinh(e);return n([e]),r}),n,null,s.ep)}})},308:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Abs:()=>qt.lj,Acos:()=>qt.Vv,Acosh:()=>qt.PH,AdadeltaOptimizer:()=>Se,AdagradOptimizer:()=>ke,AdamOptimizer:()=>Ne,AdamaxOptimizer:()=>Oe,Add:()=>qt.OM,AddN:()=>qt.Ek,All:()=>qt.u8,Any:()=>qt.FS,ArgMax:()=>qt.Jp,ArgMin:()=>qt.p_,Asin:()=>qt.QK,Asinh:()=>qt.ep,Atan:()=>qt.Ty,Atan2:()=>qt.lx,Atanh:()=>qt.zP,AvgPool:()=>qt.ho,AvgPool3D:()=>qt.cS,AvgPool3DBackprop:()=>qt.CE,AvgPoolBackprop:()=>qt.vq,BatchMatMul:()=>qt.jA,BatchToSpaceND:()=>qt.Ik,BroadcastTo:()=>qt.LB,Cast:()=>qt.KX,Ceil:()=>qt.QD,ClipByValue:()=>qt.v,Complex:()=>qt.pr,Concat:()=>qt.$d,Conv2D:()=>qt.p2,Conv2DBackpropFilter:()=>qt.rF,Conv2DBackpropInput:()=>qt.jf,Conv3D:()=>qt.A1,Conv3DBackpropFilterV2:()=>qt.iG,Conv3DBackpropInputV2:()=>qt.gC,Cos:()=>qt.t2,Cosh:()=>qt.Mn,CropAndResize:()=>qt.MR,Cumsum:()=>qt.nY,DataStorage:()=>Mn.GJ,DepthToSpace:()=>qt.TM,DepthwiseConv2dNative:()=>qt.tG,DepthwiseConv2dNativeBackpropFilter:()=>qt.X$,DepthwiseConv2dNativeBackpropInput:()=>qt.nV,Diag:()=>qt.OR,Dilation2D:()=>qt.jx,Dilation2DBackpropFilter:()=>qt.pk,Dilation2DBackpropInput:()=>qt.bP,Div:()=>qt.i,ENV:()=>m.Km,Elu:()=>qt.P,EluGrad:()=>qt.rs,Environment:()=>m.OH,Equal:()=>qt.BR,Erf:()=>qt._s,Exp:()=>qt.ox,Expm1:()=>qt.yb,FFT:()=>qt.rG,Fill:()=>qt.SQ,FlipLeftRight:()=>qt.Bx,Floor:()=>qt.Zg,FloorDiv:()=>qt.El,FromPixels:()=>qt.aw,FusedBatchNorm:()=>qt.i5,FusedConv2D:()=>qt.aA,FusedDepthwiseConv2D:()=>qt.T7,GatherNd:()=>qt.O4,GatherV2:()=>qt.mx,Greater:()=>qt.Xh,GreaterEqual:()=>qt.lL,IFFT:()=>qt.OA,Identity:()=>qt.lz,Imag:()=>qt.dv,IsFinite:()=>qt.gI,IsInf:()=>qt.E3,IsNan:()=>qt.iP,KernelBackend:()=>Mn.uI,LRN:()=>qt.jM,LRNBackprop:()=>qt.jZ,Less:()=>qt.mI,LessEqual:()=>qt.Cw,LinSpace:()=>qt.mn,Log:()=>qt.M3,Log1p:()=>qt.Cg,LogSoftmax:()=>qt.zf,LogicalAnd:()=>qt.RU,LogicalNot:()=>qt.nZ,LogicalOr:()=>qt.LX,Max:()=>qt.VA,MaxPool:()=>qt.t3,MaxPool3D:()=>qt.yS,MaxPool3DBackprop:()=>qt.eD,MaxPoolBackprop:()=>qt.fP,MaxPoolWithArgmax:()=>qt.TL,Maximum:()=>qt.LD,Mean:()=>qt.g5,Min:()=>qt.lN,Minimum:()=>qt.LG,MirrorPad:()=>qt.x7,Mod:()=>qt.BL,MomentumOptimizer:()=>De,Multiply:()=>qt.xu,Negate:()=>qt.NV,NonMaxSuppressionV3:()=>qt.SD,NonMaxSuppressionV4:()=>qt.Zl,NonMaxSuppressionV5:()=>qt.e0,NotEqual:()=>qt.yl,OP_SCOPE_SUFFIX:()=>Fe.BTT,OneHot:()=>qt.ur,OnesLike:()=>qt.LW,Optimizer:()=>_e,PadV2:()=>qt.OD,Pool:()=>qt.bC,Pow:()=>qt.py,Prelu:()=>qt.Nc,Prod:()=>qt.kd,RMSPropOptimizer:()=>Re,Range:()=>qt.Q6,Rank:()=>Pe.rg,Real:()=>qt.LR,Reciprocal:()=>qt.hu,Reduction:()=>$e.i,Relu:()=>qt.fU,Relu6:()=>qt.P_,Reshape:()=>qt.R2,ResizeBilinear:()=>qt.hg,ResizeBilinearGrad:()=>qt.FC,ResizeNearestNeighbor:()=>qt.jO,ResizeNearestNeighborGrad:()=>qt.XQ,Reverse:()=>qt.D7,RotateWithOffset:()=>qt.BK,Round:()=>qt.hV,Rsqrt:()=>qt.TO,SGDOptimizer:()=>Me,ScatterNd:()=>qt.pJ,SelectV2:()=>qt.Hx,Selu:()=>qt.u$,Sigmoid:()=>qt.vI,Sign:()=>qt.YV,Sin:()=>qt.hq,Sinh:()=>qt.J3,Slice:()=>qt.Ji,Softmax:()=>qt.K2,Softplus:()=>qt.Fi,SpaceToBatchND:()=>qt.A8,SparseToDense:()=>qt.jg,SplitV:()=>qt.Bl,Sqrt:()=>qt.dF,Square:()=>qt.M6,SquaredDifference:()=>qt.Dd,Step:()=>qt.pn,StridedSlice:()=>qt.Uc,Sub:()=>qt.Pb,Sum:()=>qt.Wu,Tan:()=>qt.oF,Tanh:()=>qt.iu,Tensor:()=>gt.qY,TensorBuffer:()=>gt.yl,Tile:()=>qt.FA,TopK:()=>qt.TB,Transpose:()=>qt.wx,Unique:()=>qt.Ew,Unpack:()=>qt.dX,UnsortedSegmentSum:()=>qt.pP,Variable:()=>gt.rT,ZerosLike:()=>qt.xJ,_FusedMatMul:()=>qt.Dr,abs:()=>Fe.tnl,acos:()=>Fe.HQu,acosh:()=>Fe.FqL,add:()=>Fe.WQq,addN:()=>Fe.QiD,addStrict:()=>Fe.zZ2,all:()=>Fe.Q7R,any:()=>Fe.bzn,argMax:()=>Fe.FLi,argMin:()=>Fe.XRg,asin:()=>Fe.qRo,asinh:()=>Fe.yHs,atan:()=>Fe.rYl,atan2:()=>Fe.FPz,atanh:()=>Fe.rfv,avgPool:()=>Fe.$jT,avgPool3d:()=>Fe.sub,backend:()=>de.Hs,backend_util:()=>c,basicLSTMCell:()=>Fe.lZX,batchNorm:()=>Fe.$v7,batchNorm2d:()=>Fe.BFc,batchNorm3d:()=>Fe.kSi,batchNorm4d:()=>Fe.T5N,batchToSpaceND:()=>Fe.GTe,booleanMaskAsync:()=>Fe.ftb,broadcastTo:()=>Fe.hOW,browser:()=>a,buffer:()=>Fe.ra8,cast:()=>Fe.wgE,ceil:()=>Fe.mkO,clipByValue:()=>Fe.zQh,clone:()=>Fe.o8B,complex:()=>Fe.faB,concat:()=>Fe.xWs,concat1d:()=>Fe.I1m,concat2d:()=>Fe.RPU,concat3d:()=>Fe.O5O,concat4d:()=>Fe.P1l,conv1d:()=>Fe.kA9,conv2d:()=>Fe.Xtf,conv2dTranspose:()=>Fe.wX9,conv3d:()=>Fe.IPL,conv3dTranspose:()=>Fe.jIJ,copyRegisteredKernels:()=>Vt.Cf,cos:()=>Fe.gnS,cosh:()=>Fe.yIG,cosineWindow:()=>Fe._jP,cumsum:()=>Fe.rCv,customGrad:()=>we._X,deprecationWarn:()=>de.fL,depthToSpace:()=>Fe.Rj8,depthwiseConv2d:()=>Fe.Gl3,device_util:()=>r,diag:()=>Fe.smy,dilation2d:()=>Fe.X7t,disableDeprecationWarnings:()=>de.IS,dispose:()=>de.AS,disposeVariables:()=>de.rm,div:()=>Fe.y4m,divNoNan:()=>Fe.ek5,divStrict:()=>Fe.H5s,dot:()=>Fe.Omf,dropout:()=>Fe.EZY,elu:()=>Fe.Pqc,enableDebugMode:()=>de.gY,enableProdMode:()=>de.Sm,enclosingPowerOfTwo:()=>Fe.FJY,engine:()=>de.Hi,env:()=>m._K,equal:()=>Fe.LCg,equalStrict:()=>Fe.OrU,erf:()=>Fe.Y12,exp:()=>Fe.oNF,expandDims:()=>Fe.UG6,expm1:()=>Fe.IYd,eye:()=>Fe.y5U,fft:()=>Fe.hVP,fill:()=>Fe.GSj,findBackend:()=>de.go,findBackendFactory:()=>de.W4,floor:()=>Fe.RIf,floorDiv:()=>Fe.wh_,fused:()=>Fe.cZk,gather:()=>Fe.kgh,gatherND:()=>Fe.SY9,gather_util:()=>o,getBackend:()=>de.jz,getGradient:()=>Vt.vQ,getKernel:()=>Vt._5,getKernelsForBackend:()=>Vt.Op,grad:()=>we.Dv,grads:()=>we.ok,greater:()=>Fe.rhj,greaterEqual:()=>Fe.DQN,greaterEqualStrict:()=>Fe.yZg,greaterStrict:()=>Fe.Ir$,ifft:()=>Fe.KGM,imag:()=>Fe.ngS,image:()=>Fe.Slp,inTopKAsync:()=>Fe.U4u,io:()=>s,irfft:()=>Fe.ggX,isFinite:()=>Fe.MIs,isInf:()=>Fe.EN4,isNaN:()=>Fe.yrW,keep:()=>de.aC,kernel_impls:()=>h,leakyRelu:()=>Fe.H8d,less:()=>Fe.M7h,lessEqual:()=>Fe.InN,lessEqualStrict:()=>Fe.XTi,lessStrict:()=>Fe.h4n,linalg:()=>Fe.mPL,linspace:()=>Fe.mT8,localResponseNormalization:()=>Fe.Kgs,log:()=>Fe.Rm2,log1p:()=>Fe.Kko,logSigmoid:()=>Fe.nqI,logSoftmax:()=>Fe.HPB,logSumExp:()=>Fe.VZ,logicalAnd:()=>Fe.n76,logicalNot:()=>Fe.NSZ,logicalOr:()=>Fe.ztW,logicalXor:()=>Fe.rxB,losses:()=>Fe.YYh,matMul:()=>Fe.NoW,math:()=>i,max:()=>Fe.T9B,maxPool:()=>Fe.jgi,maxPool3d:()=>Fe.NYV,maxPoolWithArgmax:()=>Fe.RO,maximum:()=>Fe.PhQ,maximumStrict:()=>Fe.EJc,mean:()=>Fe.i2o,memory:()=>de.m1,min:()=>Fe.jkA,minimum:()=>Fe.BpO,minimumStrict:()=>Fe.oKM,mirrorPad:()=>Fe.FFZ,mod:()=>Fe.ziu,modStrict:()=>Fe.Es7,moments:()=>Fe.Clk,movingAverage:()=>Fe.CRk,mul:()=>Fe.lKK,mulStrict:()=>Fe.QX_,multiRNNCell:()=>Fe.YDF,multinomial:()=>Fe.OjQ,neg:()=>Fe.HZy,nextFrame:()=>qe,norm:()=>Fe.xbf,notEqual:()=>Fe.Ec,notEqualStrict:()=>Fe.FD3,oneHot:()=>Fe.Mw0,ones:()=>Fe.SaS,onesLike:()=>Fe.P61,op:()=>Fe.op,outerProduct:()=>Fe.X4o,pad:()=>Fe.eVF,pad1d:()=>Fe.BZs,pad2d:()=>Fe.grY,pad3d:()=>Fe.XHu,pad4d:()=>Fe.WLX,pool:()=>Fe.dzn,pow:()=>Fe.n7C,powStrict:()=>Fe.o1j,prelu:()=>Fe.NsG,print:()=>Fe.yyV,prod:()=>Fe._eU,profile:()=>de.ME,rand:()=>Fe._9M,randomGamma:()=>Fe.pR9,randomNormal:()=>Fe.FE$,randomUniform:()=>Fe.YeY,range:()=>Fe.y17,ready:()=>de.Gc,real:()=>Fe.xav,reciprocal:()=>Fe.VOZ,registerBackend:()=>de.gJ,registerGradient:()=>Vt.kr,registerKernel:()=>Vt.tA,relu:()=>Fe.VVh,relu6:()=>Fe.j__,removeBackend:()=>de.rE,reshape:()=>Fe.tQQ,reverse:()=>Fe.BEg,reverse1d:()=>Fe.QD2,reverse2d:()=>Fe.LMr,reverse3d:()=>Fe.I2l,reverse4d:()=>Fe.JYU,rfft:()=>Fe.z8$,round:()=>Fe.LIG,rsqrt:()=>Fe.Z$r,scalar:()=>Fe.d_2,scatterND:()=>Fe.NFr,scatter_util:()=>Yt,selu:()=>Fe.WfX,separableConv2d:()=>Fe.wdz,serialization:()=>u,setBackend:()=>de.jh,setPlatform:()=>de.Ok,setdiff1dAsync:()=>Fe.F12,sigmoid:()=>Fe.ry7,sign:()=>Fe._SZ,signal:()=>Fe.vPA,sin:()=>Fe.F8e,sinh:()=>Fe.L0l,slice:()=>Fe.dik,slice1d:()=>Fe.Q$M,slice2d:()=>Fe.zAd,slice3d:()=>Fe.wck,slice4d:()=>Fe.R0O,slice_util:()=>Kt,softmax:()=>Fe.Vs9,softplus:()=>Fe.lw0,spaceToBatchND:()=>Fe.eDJ,sparseToDense:()=>Fe.Zhr,spectral:()=>Fe.lOn,split:()=>Fe.lDo,sqrt:()=>Fe.RZD,square:()=>Fe.EwI,squaredDifference:()=>Fe.Pbu,squaredDifferenceStrict:()=>Fe.AZd,squeeze:()=>Fe.r2V,stack:()=>Fe.t$z,step:()=>Fe.PMw,stridedSlice:()=>Fe.Ym9,sub:()=>Fe.jbE,subStrict:()=>Fe.wjd,sum:()=>Fe.czq,sumOutType:()=>Pe.ch,tan:()=>Fe.Mlm,tanh:()=>Fe.ymU,tensor:()=>Fe.OEK,tensor1d:()=>Fe.tGX,tensor2d:()=>Fe.KtR,tensor3d:()=>Fe.$_$,tensor4d:()=>Fe.g9W,tensor5d:()=>Fe.Lpo,tensor6d:()=>Fe.yxw,tensor_util:()=>Jt,test_util:()=>l,tidy:()=>de.DZ,tile:()=>Fe.Vsq,time:()=>de.kB,topk:()=>Fe.rfw,train:()=>ze,transpose:()=>Fe.mgz,truncatedNormal:()=>Fe.efE,unique:()=>Fe.AmM,unregisterGradient:()=>Vt.rY,unregisterKernel:()=>Vt.iP,unsortedSegmentSum:()=>Fe.zAU,unstack:()=>Fe.K$i,upcastType:()=>Pe.Tu,util:()=>he,valueAndGrad:()=>we.jY,valueAndGrads:()=>we.mu,variable:()=>Fe.bvq,variableGrads:()=>we.y7,version_core:()=>pe,where:()=>Fe._M9,whereAsync:()=>Fe.YJN,zeros:()=>Fe.Ul9,zerosLike:()=>Fe.POl});var r={};n.r(r),n.d(r,{isBrowser:()=>f,isMobile:()=>d});var s={};n.r(s),n.d(s,{browserFiles:()=>xt,browserHTTPRequest:()=>Et,concatenateArrayBuffers:()=>C,copyModel:()=>ut,decodeWeights:()=>S,encodeWeights:()=>_,fromMemory:()=>Dt,getLoadHandlers:()=>P,getModelArtifactsInfoForJSON:()=>I,getSaveHandlers:()=>R,http:()=>It,isHTTPScheme:()=>Ct,listModels:()=>at,loadWeights:()=>Tt,moveModel:()=>lt,registerLoadRouter:()=>D,registerSaveRouter:()=>M,removeModel:()=>ot,weightsLoaderFactory:()=>kt,withSaveHandler:()=>Rt});var i={};n.r(i),n.d(i,{confusionMatrix:()=>Bt});var a={};n.r(a),n.d(a,{fromPixels:()=>Gt,toPixels:()=>Wt});var o={};n.r(o),n.d(o,{prepareAndValidate:()=>Ht});var u={};n.r(u),n.d(u,{Serializable:()=>Qt,SerializationMap:()=>Xt,registerClass:()=>Zt});var l={};n.r(l),n.d(l,{TEST_EPSILON_FLOAT16:()=>ee,expectArrayBuffersEqual:()=>ce,expectArraysClose:()=>ne,expectArraysEqual:()=>ae,expectNumbersClose:()=>oe,expectPromiseToFail:()=>ie,expectValuesInRange:()=>le,testEpsilon:()=>re});var c={};n.r(c),n.d(c,{ERF_A1:()=>an,ERF_A2:()=>on,ERF_A3:()=>un,ERF_A4:()=>ln,ERF_A5:()=>cn,ERF_P:()=>sn,PARALLELIZE_THRESHOLD:()=>Ke.m,SELU_SCALE:()=>rn,SELU_SCALEALPHA:()=>nn,applyActivation:()=>Ye.f2,assertAndGetBroadcastShape:()=>We.Ky,assertAxesAreInnerMostDims:()=>Ue.WC,assertParamsConsistent:()=>Ge.L,assignToTypedArray:()=>vn,axesAreInnerMostDims:()=>Ue.WH,calculateShapes:()=>Yt.calculateShapes,castTensor:()=>Sn,combineLocations:()=>Ue.aF,complexWithEvenIndex:()=>mn,complexWithOddIndex:()=>gn,computeConv2DInfo:()=>He.uf,computeConv3DInfo:()=>He.p$,computeDefaultPad:()=>He.G8,computeDilation2DInfo:()=>He.YQ,computeOptimalWindowSize:()=>Ke.x,computeOutAndReduceShapes:()=>Ue.lb,computeOutShape:()=>Ge.P,computePool2DInfo:()=>He.E6,computePool3DInfo:()=>He.l5,convertConv2DDataFormat:()=>He.$Q,eitherStridesOrDilationsAreOne:()=>He.G0,expandShapeToKeepDim:()=>Ue.SM,exponent:()=>wn,exponents:()=>bn,getAxesPermutation:()=>Ue.Em,getBroadcastDims:()=>We.NE,getComplexWithIndex:()=>yn,getFusedBiasGradient:()=>Ye.Do,getFusedDyActivation:()=>Ye.XB,getImageCenter:()=>Qe,getInnerMostAxes:()=>Ue.fK,getPermuted:()=>Ze,getReductionAxes:()=>We.Lx,getReshaped:()=>Xe,getReshapedPermuted:()=>Je,getSliceBeginCoords:()=>tn,getSliceSize:()=>en,getUndoAxesPermutation:()=>Ue.gx,linspaceImpl:()=>kn,log:()=>pn,mergeRealAndImagArrays:()=>dn,prepareAndValidate:()=>Ht,prepareSplitSize:()=>xn.z,reshapeTensor:()=>Tn,segment_util:()=>_n,shouldFuse:()=>Ye.zE,slice_util:()=>Kt,splitRealAndImagArrays:()=>fn,tupleValuesAreOne:()=>He.Dh,upcastType:()=>Pe.Tu,validateInput:()=>Yt.validateInput,validateUpdateShape:()=>Yt.validateUpdateShape,warn:()=>hn});var h={};n.r(h),n.d(h,{nonMaxSuppressionV3Impl:()=>An.c7,nonMaxSuppressionV4Impl:()=>An.ZS,nonMaxSuppressionV5Impl:()=>An.ut,split:()=>Nn,tile:()=>In,topkImpl:()=>En,whereImpl:()=>On.Y});var p=n(1585);function d(){if("undefined"!=typeof navigator&&null!=navigator){const t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function f(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}var m=n(6574);const g=(0,m._K)();g.registerFlag("DEBUG",(()=>!1),(t=>{t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")})),g.registerFlag("IS_BROWSER",(()=>f())),g.registerFlag("IS_NODE",(()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node)),g.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),g.registerFlag("PROD",(()=>!1)),g.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>g.getBool("DEBUG"))),g.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),g.registerFlag("IS_TEST",(()=>!1));var y=n(7148),v=n(4027),b=n(5119);const w={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},x=4;async function _(t,e){const n=[],r=[],s=Array.isArray(t)?t.map((t=>t.name)):Object.keys(t);for(let i=0;i<s.length;++i){const a=s[i],o=Array.isArray(t)?t[i].tensor:t[a];if("float32"!==o.dtype&&"int32"!==o.dtype&&"bool"!==o.dtype&&"string"!==o.dtype&&"complex64"!==o.dtype)throw new Error(`Unsupported dtype in weight '${a}': ${o.dtype}`);const u={name:a,shape:o.shape,dtype:o.dtype};if("string"===o.dtype){const t=new Promise((async t=>{const e=await o.bytes(),n=e.reduce(((t,e)=>t+e.length),0)+x*e.length,r=new Uint8Array(n);let s=0;for(let t=0;t<e.length;t++){const n=e[t],i=new Uint8Array(new Uint32Array([n.length]).buffer);r.set(i,s),s+=x,r.set(n,s),s+=n.length}t(r)}));r.push(t)}else r.push(o.data());null!=e&&(u.group=e),n.push(u)}return{data:T(await Promise.all(r)),specs:n}}function S(t,e){const n={};let r,s=0;for(const i of e){const e=i.name,a=i.dtype,o=i.shape,u=(0,b.Ze)(o);let l;if("quantization"in i){const n=i.quantization;if("uint8"===n.dtype||"uint16"===n.dtype){if(!("min"in n)||!("scale"in n))throw new Error(`Weight ${i.name} with quantization ${n.dtype} doesn't have corresponding metadata min and scale.`)}else{if("float16"!==n.dtype)throw new Error(`Weight ${i.name} has unknown quantization dtype ${n.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);if("float32"!==a)throw new Error(`Weight ${i.name} is quantized with ${n.dtype} which only supports weights of type float32 not ${a}.`)}const o=w[n.dtype],c=t.slice(s,s+u*o),h="uint8"===n.dtype?new Uint8Array(c):new Uint16Array(c);if("float32"===a)if("uint8"===n.dtype||"uint16"===n.dtype){l=new Float32Array(h.length);for(let t=0;t<h.length;t++){const e=h[t];l[t]=e*n.scale+n.min}}else{if("float16"!==n.dtype)throw new Error(`Unsupported quantization type ${n.dtype} for weight type float32.`);void 0===r&&(r=E()),l=r(h)}else{if("int32"!==a)throw new Error(`Unsupported dtype in weight '${e}': ${a}`);if("uint8"!==n.dtype&&"uint16"!==n.dtype)throw new Error(`Unsupported quantization type ${n.dtype} for weight type int32.`);l=new Int32Array(h.length);for(let t=0;t<h.length;t++){const e=h[t];l[t]=Math.round(e*n.scale+n.min)}}s+=u*o}else if("string"===a){const e=(0,b.Ze)(i.shape);l=[];for(let n=0;n<e;n++){const e=new Uint32Array(t.slice(s,s+x))[0];s+=x;const n=new Uint8Array(t.slice(s,s+e));l.push(n),s+=e}}else{const r=w[a],i=t.slice(s,s+u*r);if("float32"===a)l=new Float32Array(i);else if("int32"===a)l=new Int32Array(i);else if("bool"===a)l=new Uint8Array(i);else{if("complex64"!==a)throw new Error(`Unsupported dtype in weight '${e}': ${a}`);{l=new Float32Array(i);const t=new Float32Array(l.length/2),r=new Float32Array(l.length/2);for(let e=0;e<t.length;e++)t[e]=l[2*e],r[e]=l[2*e+1];const s=(0,v.O)(t,o,"float32"),a=(0,v.O)(r,o,"float32");n[e]=(0,y.f)(s,a),s.dispose(),a.dispose()}}s+=u*r}"complex64"!==a&&(n[e]=(0,v.O)(l,o,a))}return n}function T(t){if(null===t)throw new Error(`Invalid input value: ${JSON.stringify(t)}`);let e=0;const n=[];t.forEach((t=>{if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${t.constructor.name}`)}));const r=new Uint8Array(e);let s=0;return n.forEach((t=>{r.set(new Uint8Array(t.buffer),s),s+=t.byteLength})),r.buffer}const k="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function A(t){return k?Buffer.byteLength(t):new Blob([t]).size}function C(t){if(1===t.length)return t[0];let e=0;t.forEach((t=>{e+=t.byteLength}));const n=new Uint8Array(e);let r=0;return t.forEach((t=>{n.set(new Uint8Array(t),r),r+=t.byteLength})),n.buffer}function N(t){for(t=t.trim();t.endsWith("/");)t=t.slice(0,t.length-1);const e=t.split("/");return e[e.length-1]}function I(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==t.modelTopology?0:A(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:A(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}function E(){const t=function(){const t=t=>{let e=t<<13,n=0;for(;!(8388608&e);)n-=8388608,e<<=1;return e&=-8388609,n+=947912704,e|n},e=new Uint32Array(2048);e[0]=0;for(let n=1;n<1024;n++)e[n]=t(n);for(let t=1024;t<2048;t++)e[t]=939524096+(t-1024<<13);return e}(),e=function(){const t=new Uint32Array(64);t[0]=0,t[31]=1199570944,t[32]=2147483648,t[63]=3347054592;for(let e=1;e<31;e++)t[e]=e<<23;for(let e=33;e<63;e++)t[e]=2147483648+(e-32<<23);return t}(),n=function(){const t=new Uint32Array(64);for(let e=0;e<64;e++)t[e]=1024;return t[0]=t[32]=0,t}();return r=>{const s=new ArrayBuffer(4*r.length),i=new Uint32Array(s);for(let s=0;s<r.length;s++){const a=r[s],o=t[n[a>>10]+(1023&a)]+e[a>>10];i[s]=o}return new Float32Array(s)}}class O{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==O.instance&&(O.instance=new O),O.instance}static registerSaveRouter(t){O.getInstance().saveRouters.push(t)}static registerLoadRouter(t){O.getInstance().loadRouters.push(t)}static getSaveHandlers(t){return O.getHandlers(t,"save")}static getLoadHandlers(t,e){return O.getHandlers(t,"load",e)}static getHandlers(t,e,n){const r=[];return("load"===e?O.getInstance().loadRouters:O.getInstance().saveRouters).forEach((e=>{const s=e(t,n);null!==s&&r.push(s)})),r}}const M=t=>O.registerSaveRouter(t),D=t=>O.registerLoadRouter(t),R=t=>O.getSaveHandlers(t),P=(t,e)=>O.getLoadHandlers(t,e),F="tensorflowjs",$="models_store",L="model_info_store";function z(){if(!(0,m._K)().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const t="undefined"==typeof window?self:window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function B(t){const e=t.result;e.createObjectStore($,{keyPath:"modelPath"}),e.createObjectStore(L,{keyPath:"modelPath"})}class q{constructor(t){if(this.indexedDB=z(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,t)}async load(){return this.databaseAction(this.modelPath)}databaseAction(t,e){return new Promise(((t,n)=>{const r=this.indexedDB.open(F,1);r.onupgradeneeded=()=>B(r),r.onsuccess=()=>{const s=r.result;if(null==e){const e=s.transaction($,"readonly"),r=e.objectStore($).get(this.modelPath);r.onsuccess=()=>{if(null==r.result)return s.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));t(r.result.modelArtifacts)},r.onerror=t=>(s.close(),n(r.error)),e.oncomplete=()=>s.close()}else{const r=I(e),i=s.transaction(L,"readwrite");let a=i.objectStore(L);const o=a.put({modelPath:this.modelPath,modelArtifactsInfo:r});let u;o.onsuccess=()=>{u=s.transaction($,"readwrite");const o=u.objectStore($).put({modelPath:this.modelPath,modelArtifacts:e,modelArtifactsInfo:r});o.onsuccess=()=>t({modelArtifactsInfo:r}),o.onerror=t=>{a=i.objectStore(L);const e=a.delete(this.modelPath);e.onsuccess=()=>(s.close(),n(o.error)),e.onerror=t=>(s.close(),n(o.error))}},o.onerror=t=>(s.close(),n(o.error)),i.oncomplete=()=>{null==u?s.close():u.oncomplete=()=>s.close()}}},r.onerror=t=>n(r.error)}))}}q.URL_SCHEME="indexeddb://";const V=t=>{return(0,m._K)().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(q.URL_SCHEME)?(e=t.slice(q.URL_SCHEME.length),new q(e)):null;var e};O.registerSaveRouter(V),O.registerLoadRouter(V);class j{constructor(){this.indexedDB=z()}async listModels(){return new Promise(((t,e)=>{const n=this.indexedDB.open(F,1);n.onupgradeneeded=()=>B(n),n.onsuccess=()=>{const r=n.result,s=r.transaction(L,"readonly"),i=s.objectStore(L).getAll();i.onsuccess=()=>{const e={};for(const t of i.result)e[t.modelPath]=t.modelArtifactsInfo;t(e)},i.onerror=t=>(r.close(),e(i.error)),s.oncomplete=()=>r.close()},n.onerror=t=>e(n.error)}))}async removeModel(t){var e;return t=(e=t).startsWith(q.URL_SCHEME)?e.slice(q.URL_SCHEME.length):e,new Promise(((e,n)=>{const r=this.indexedDB.open(F,1);r.onupgradeneeded=()=>B(r),r.onsuccess=()=>{const s=r.result,i=s.transaction(L,"readwrite"),a=i.objectStore(L),o=a.get(t);let u;o.onsuccess=()=>{if(null==o.result)return s.close(),n(new Error(`Cannot find model with path '${t}' in IndexedDB.`));{const r=a.delete(t),i=()=>{u=s.transaction($,"readwrite");const r=u.objectStore($).delete(t);r.onsuccess=()=>e(o.result.modelArtifactsInfo),r.onerror=t=>n(o.error)};r.onsuccess=i,r.onerror=t=>(i(),s.close(),n(o.error))}},o.onerror=t=>(s.close(),n(o.error)),i.oncomplete=()=>{null==u?s.close():u.oncomplete=()=>s.close()}},r.onerror=t=>n(r.error)}))}}const U="/",W="tensorflowjs_models",G="info",H="model_topology",Y="weight_specs",K="weight_data",Q="model_metadata";function X(t){return{info:[W,t,G].join(U),topology:[W,t,H].join(U),weightSpecs:[W,t,Y].join(U),weightData:[W,t,K].join(U),modelMetadata:[W,t,Q].join(U)}}function Z(t){const e=t.split(U);if(e.length<3)throw new Error(`Invalid key format: ${t}`);return e.slice(1,e.length-1).join(U)}class J{constructor(t){if(!(0,m._K)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=X(this.modelPath)}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),r=I(t);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(t){if(k)return Buffer.from(t).toString("base64");const e=new Uint8Array(t);let n="";for(let t=0,r=e.length;t<r;t++)n+=String.fromCharCode(e[t]);return btoa(n)}(t.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata})),{modelArtifactsInfo:r}}catch(t){throw this.L