diff --git a/submissions/StudyTracker/README.md b/submissions/StudyTracker/README.md new file mode 100644 index 00000000..0f0fce39 --- /dev/null +++ b/submissions/StudyTracker/README.md @@ -0,0 +1,119 @@ + +# Study Tracker Chrome Extension + +Study Tracker is a Chrome extension that uses face detection and expression recognition to monitor your study sessions. It tracks the time you spend studying and records your dominant facial expression during each session. The extension aggregates your study data by day and displays a 7-day history, giving you insights into your study habits and mood over time. + +## Table of Contents + +- [Features](#features) +- [Installation](#installation) +- [Usage](#usage) +- [How It Works](#how-it-works) +- [Dependencies](#dependencies) +- [Project Structure](#project-structure) +- [Customization](#customization) +- [Troubleshooting](#troubleshooting) +- [License](#license) + +## Features + +- **Face Detection & Expression Recognition:** Uses `face-api.js` to detect faces, facial landmarks, and expressions. +- **Study Time Tracking:** Accumulates study time every second when your face is detected. +- **Daily Aggregation:** Records study data per day with total study time and the dominant facial expression. +- **7-Day History:** Displays your study history for the last 7 days, including study duration and mood. +- **Toggle Overlays:** Option to show or hide detection overlays (landmarks, bounding boxes, expression labels). +- **Alert System:** Plays an alert sound if no face is detected for 30 consecutive seconds. + +## Installation + +1. **Clone or Download the Repository:** + ```bash + git clone https://github.com/raghib112/Study-Tracker.git + ``` +2. **Place Models:** + - Download the required models from [face-api.js models](https://github.com/justadudewhohacks/face-api.js/tree/master/weights) and place them in the `/models` directory of the extension. + +3. **Add Alert Sound:** + - Ensure that you have an `alert.mp3` file in the root of the extension directory. This sound will play if no face is detected for 30 seconds. + +4. **Load the Extension in Chrome:** + - Open Chrome and navigate to `chrome://extensions/`. + - Enable "Developer mode" (top right). + - Click "Load unpacked" and select your extension’s directory. + +## Usage + +1. Click on the Study Tracker icon in your Chrome toolbar. +2. The extension will open a popup with a video feed from your webcam. +3. The extension will: + - Detect your face and update the study time in real time. + - Display your current dominant facial expression alongside the accumulated study time. + - Aggregate your study data per day. +4. Use the **Toggle Landmarks** button to show/hide detection overlays (bounding boxes, landmarks, and expression labels). +5. If no face is detected for 30 seconds, an alert sound will play to remind you to start studying. + +## How It Works + +- **Face Detection:** The extension uses `face-api.js` to perform real-time face detection, landmark detection, and expression recognition. +- **Study Time Tracking:** Each time a face is detected, the extension increments the study timer (in seconds) and updates the daily record stored in `localStorage`. +- **Daily Aggregation:** Study data is saved in an object keyed by date. For each day, it stores the total time studied (in seconds) and tallies the count of each detected facial expression. +- **7-Day History:** The extension processes the daily records to show the total study time (converted to hours, minutes, and seconds) and the dominant expression for each of the last 7 days. +- **No-Face Alert:** If no face is detected continuously for 30 seconds, an alert sound (`alert.mp3`) is played. + +## Dependencies + +- [face-api.js](https://github.com/justadudewhohacks/face-api.js) +- [Tailwind CSS](https://tailwindcss.com/) via the Tailwind Browser CDN + +## Project Structure + + + +``` +study-tracker-extension/ +├── manifest.json # Chrome extension manifest file +├── popup.html # HTML file for the extension's popup UI +├── script.js # JavaScript file containing detection and tracking logic +├── face-api.min.js # Face API library file +├── models/ # Directory containing face-api.js models (downloaded separately) +├── alert.mp3 # Alert sound file for no-face detection +└── README.md # This file +``` + +## Customization + +- **Study Duration and Alert Timing:** + - The extension tracks study time continuously. You can adjust the 30-second no-face alert interval by modifying the value in `popup.js` (`30000` ms). +- **UI Styling:** + - The popup uses Tailwind CSS for a modern look. Customize styles in `popup.html` or add your own CSS as needed. + +## Troubleshooting + +- **Models Not Loading:** + - Ensure that the `/models` directory is correctly placed and contains the necessary model files. +- **Webcam Permissions:** + - Make sure your browser has permission to access the webcam. +- **Alert Sound Not Playing:** + - Confirm that `alert.mp3` is in the extension directory and that your browser supports the audio format. +- **Performance Issues:** + - The extension throttles detection to every 500ms. Adjust this value in `popup.js` if needed. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +--- + +Feel free to contribute, open issues, or suggest improvements! + diff --git a/submissions/StudyTracker/alert.mp3 b/submissions/StudyTracker/alert.mp3 new file mode 100644 index 00000000..185fc313 Binary files /dev/null and b/submissions/StudyTracker/alert.mp3 differ diff --git a/submissions/StudyTracker/background.js b/submissions/StudyTracker/background.js new file mode 100644 index 00000000..fee288ae --- /dev/null +++ b/submissions/StudyTracker/background.js @@ -0,0 +1,11 @@ +chrome.runtime.onInstalled.addListener(() => { + console.log("Study Tracker Extension Installed!"); +}); + +// Keep background script running even when popup is closed +chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.action === "logStudyTime") { + console.log(`Logging study time: ${message.time} seconds`); + sendResponse({ status: "Time logged successfully!" }); + } +}); diff --git a/submissions/StudyTracker/content.js b/submissions/StudyTracker/content.js new file mode 100644 index 00000000..d54a9e8b --- /dev/null +++ b/submissions/StudyTracker/content.js @@ -0,0 +1,9 @@ +setInterval(() => { + chrome.runtime.sendMessage({ action: "logStudyTime", time: 10 }, response => { + if (chrome.runtime.lastError) { + console.warn("Background script is inactive."); + } else { + console.log(response.status); + } + }); +}, 10000); // Send data every 10 seconds diff --git a/submissions/StudyTracker/face-api.min.js b/submissions/StudyTracker/face-api.min.js new file mode 100644 index 00000000..bc22120d --- /dev/null +++ b/submissions/StudyTracker/face-api.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).faceapi=t.faceapi||{})}(this,function(c){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function a(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var O=function(){return(O=Object.assign||function(t){for(var e,n=1,r=arguments.length;na[0]&&e[1]a[0]&&e[1]a)&&1===t[a]&&(n.push(t[a]),r.push(a)),o[i]<=a&&i++}1!==t[a]&&(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}}function A(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function M(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function F(t,e,n){if("float32"===e)for(var r=0;r=this.shape[n]){var a="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(a)}n++}for(var s=t[t.length-1],u=0;u {...}) to avoid memory leaks.");return t.kept=!0,t},t.prototype.startTape=function(){0===this.gradientDepth&&(this.activeTape=[]),this.gradientDepth++},t.prototype.endTape=function(){this.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:"unnamed scope",id:this.nextScopeId++};t&&(e.name=t),this.scopeStack.push(e),this.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=Dt(t),r=new Set(n.map(function(t){return t.id})),o=0;o {op();...}); to avoid memory leaks.");return null!=this.activeScope&&(t.scopeId=this.activeScope.id,this.activeScope.track.push(t)),t},t.nextTensorId=0,t.nextVariableId=0,t}();(Ot=Mt||(Mt={}))[Ot.NUMBER=0]="NUMBER",Ot[Ot.BOOLEAN=1]="BOOLEAN",Ot[Ot.STRING=2]="STRING";var Lt,Bt,Wt=[{name:"DEBUG",type:Mt.BOOLEAN},{name:"IS_BROWSER",type:Mt.BOOLEAN},{name:"WEBGL_LAZILY_UNPACK",type:Mt.BOOLEAN},{name:"WEBGL_CPU_FORWARD",type:Mt.BOOLEAN},{name:"WEBGL_PACK",type:Mt.BOOLEAN},{name:"WEBGL_PACK_BATCHNORMALIZATION",type:Mt.BOOLEAN},{name:"WEBGL_PACK_CLIP",type:Mt.BOOLEAN},{name:"WEBGL_PACK_DEPTHWISECONV",type:Mt.BOOLEAN},{name:"WEBGL_PACK_BINARY_OPERATIONS",type:Mt.BOOLEAN},{name:"WEBGL_PACK_ARRAY_OPERATIONS",type:Mt.BOOLEAN},{name:"WEBGL_PACK_IMAGE_OPERATIONS",type:Mt.BOOLEAN},{name:"WEBGL_PACK_REDUCE",type:Mt.BOOLEAN},{name:"WEBGL_CONV_IM2COL",type:Mt.BOOLEAN},{name:"WEBGL_MAX_TEXTURE_SIZE",type:Mt.NUMBER},{name:"WEBGL_NUM_MB_BEFORE_PAGING",type:Mt.NUMBER},{name:"WEBGL_MAX_TEXTURES_IN_SHADER",type:Mt.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:Mt.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:Mt.BOOLEAN},{name:"WEBGL_VERSION",type:Mt.NUMBER},{name:"WEBGL_RENDER_FLOAT32_ENABLED",type:Mt.BOOLEAN},{name:"WEBGL_DOWNLOAD_FLOAT_ENABLED",type:Mt.BOOLEAN},{name:"WEBGL_FENCE_API_ENABLED",type:Mt.BOOLEAN},{name:"WEBGL_SIZE_UPLOAD_UNIFORM",type:Mt.NUMBER},{name:"BACKEND",type:Mt.STRING},{name:"EPSILON",type:Mt.NUMBER},{name:"PROD",type:Mt.BOOLEAN},{name:"TENSORLIKE_CHECK_SHAPE_CONSISTENCY",type:Mt.BOOLEAN},{name:"DEPRECATION_WARNINGS_ENABLED",type:Mt.BOOLEAN}];function zt(t){try{if(null!=l(t))return!0}catch(t){return!1}return!1}var Ut="tfjsflags";function Gt(){var e={};if("undefined"==typeof window||void 0===window.location||void 0===window.location.search)return e;var t,a,n=(t=window.location.search,a={},t.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(t){for(var e=[],n=1;nt.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,r=n[n.length-1],o=1,i=0;i=l[e]:o<=l[e]);o+=r)n+=1;return n}),[c,f,h]}function De(t,e,n,r,o){var i=e[o],a=n[o]||1;(t&1<o}).sort(function(t,e){return e.score-t.score}),a=[],s=0;s=r){h=!0;break}if(!h&&(a.push(l),a.length>=n))break}return He(a,"int32")}function hn(t,e,n){var r=t.subarray(4*e,4*e+4),o=t.subarray(4*n,4*n+4),i=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(o[0],o[2]),l=Math.min(o[1],o[3]),h=Math.max(o[0],o[2]),p=Math.max(o[1],o[3]),f=(s-i)*(u-a),d=(h-c)*(p-l);if(f<=0||d<=0)return 0;var v=Math.max(i,c),m=Math.max(a,l),g=Math.min(s,h),y=Math.min(u,p),x=Math.max(g-v,0)*Math.max(y-m,0);return x/(f+d-x)}function pn(n,t,r){var o=new Array(n.rank).fill(0),i=n.shape.slice();return t.map(function(t){i[r]=t;var e=n.slice(o,i);return o[r]+=t,e})}function fn(t,e,n,r,o){for(var i=e[e.length-1],a=[t.length/i,i],s=a[0],u=a[1],c=A(n,s*r),l=A("int32",s*r),h=0;h":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < "+r+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "};function vn(e,t){return["x","y","z","w","u","v"].slice(0,t).map(function(t){return e+"."+t})}function mn(t,e){return 1===e?[t]:vn(t,e)}function gn(t,e){for(var n=t.length,r=[],o=0;o= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+u+";\n wC+= "+a+") {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "},Ln=function(t,e,n,r,o,i){this.outputShape=[],this.variableNames=["x","mean","variance"],xn(t,e),xn(t,n);var a="0.0";null!=r&&(xn(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=o&&(xn(t,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+a+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+i+"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n "},Bn=function(t,e,n,r,o,i){this.usesPackedTextures=!0,this.variableNames=["x","mean","variance"],xn(t,e),xn(t,n);var a="vec4(0.0)";null!=r&&(xn(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="vec4(1.0)";null!=o&&(xn(t,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = "+a+";\n vec4 scale = "+s+";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4("+i+"));\n\n setOutput((x - mean) * inv + offset);\n }\n "},Wn="return areal * breal - aimag * bimag;",zn="return areal * bimag + aimag * breal;",Un=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=xn(e,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n "+t+"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n "},Gn="return a + b;",Vn="return a - b;",Hn="return a * b;",qn="return (a - b) * (a - b);",jn=function(t,e,n){this.variableNames=["A","B"],this.outputShape=xn(e,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+t+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},$n=function(t,e,n){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.usesPackedTextures=!0,this.outputShape=xn(e,n),this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n "+t+"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},Kn=function(){function t(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n uniform float min;\n uniform float max;\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, min, max));\n }\n "}return t.prototype.getCustomSetupFunc=function(n,r){var o=this;return function(t,e){null==o.minLoc&&(o.minLoc=t.getUniformLocationNoThrow(e,"min"),o.maxLoc=t.getUniformLocationNoThrow(e,"max")),t.gl.uniform1f(o.minLoc,n),t.gl.uniform1f(o.maxLoc,r)}},t}(),Xn=function(){function t(t){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t,this.userCode="\n uniform float min;\n uniform float max;\n\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(min), vec4(max)));\n }\n "}return t.prototype.getCustomSetupFunc=function(n,r){var o=this;return function(t,e){null==o.minLoc&&(o.minLoc=t.getUniformLocationNoThrow(e,"min"),o.maxLoc=t.getUniformLocationNoThrow(e,"max")),t.gl.uniform1f(o.minLoc,n),t.gl.uniform1f(o.maxLoc,r)}},t}(),Yn=function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "},Qn=function(t){this.outputShape=[],this.outputShape=Re(t,1),this.variableNames=t.map(function(t,e){return"T"+e});var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},tr=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,o=t.strideWidth,i=e-1-t.padInfo.top,a=n-1-t.padInfo.left;this.userCode="\n const ivec2 pads = ivec2("+i+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},er=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,o=t.padInfo.front,i=t.padInfo.top,a=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n int xF = wF + yF * "+e+" - "+o+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+n+" - "+i+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},nr=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,c=r-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3("+s+", "+u+", "+c+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < "+e+"; wF++) {\n float dyF = float(dyFCorner + wF) / "+o+".0;\n\n if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = "+e+" - 1 - wF;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+n+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},rr=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,o=t.padInfo.left,i=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+i+" + dm;\n\n float dotProd = 0.0;\n\n // TODO: Vec4 over the batch size\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},or=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,o=t.strideWidth,i=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2("+i+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TODO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},ir=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.top,n=t.padInfo.left,r=t.strideHeight,o=t.strideWidth,i=t.dilationHeight,a=t.dilationWidth,s=t.filterHeight,u=t.filterWidth,c=4*Math.floor(t.inChannels/4),l=t.inChannels%4;this.userCode="\n const ivec2 strides = ivec2("+r+", "+o+");\n const ivec2 pads = ivec2("+e+", "+n+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+"; wR++) {\n int xR = xRCorner + wR * "+i+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+"; wC++) {\n int xC = xCCorner + wC * "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+c+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===l)+") {\n dotProd +=\n getX(batch, xR, xC, "+c+") *\n getW(wR, wC, "+c+", d2);\n } else if ("+(2===l)+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+c+"),\n getX(batch, xR, xC, "+c+" + 1)\n );\n vec2 wValues = vec2(\n getW(wR, wC, "+c+", d2),\n getW(wR, wC, "+c+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===l)+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+c+"),\n getX(batch, xR, xC, "+c+" + 1),\n getX(batch, xR, xC, "+c+" + 2)\n );\n vec3 wValues = vec3(\n getW(wR, wC, "+c+", d2),\n getW(wR, wC, "+c+" + 1, d2),\n getW(wR, wC, "+c+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n setOutput(dotProd);\n }\n "},ar=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterDepth,h=t.filterHeight,p=t.filterWidth,f=4*Math.floor(t.inChannels/4),d=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3("+o+", "+i+", "+a+");\n const ivec3 pads = ivec3("+e+", "+n+", "+r+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < "+l+"; wF++) {\n int xF = xFCorner + wF * "+s+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+h+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+f+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===d)+") {\n dotProd +=\n getX(batch, xF, xR, xC, "+f+") *\n getW(wF, wR, wC, "+f+", d2);\n } else if ("+(2===d)+") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, "+f+"),\n getX(batch, xF, xR, xC, "+f+" + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, "+f+", d2),\n getW(wF, wR, wC, "+f+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===d)+") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, "+f+"),\n getX(batch, xF, xR, xC, "+f+" + 1),\n getX(batch, xF, xR, xC, "+f+" + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, "+f+", d2),\n getW(wF, wR, wC, "+f+" + 1, d2),\n getW(wF, wR, wC, "+f+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},sr=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,o=t.padInfo.left,i=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,h=t.outChannels/t.inChannels;this.userCode="\n const ivec2 strides = ivec2("+i+", "+a+");\n const ivec2 pads = ivec2("+r+", "+o+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+h+";\n int q = d2 - d1 * "+h+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+c+"; wR++) {\n int xR = xRCorner + wR * "+s+";\n\n if (xR < 0 || xR >= "+e+") {\n continue;\n }\n\n for (int wC = 0; wC < "+l+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+n+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n setOutput(dotProd);\n }\n "},ur=function(t){this.variableNames=["x","W"],this.usesPackedTextures=!0,this.outputShape=t.outShape;for(var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,o=t.padInfo.left,i=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,h=l,p="int xR; int xC; int xCOffset;",f=0;f= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+d+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+f+"C"+d+" = vec4(0.);\n }\n\n xCOffset = xC + 1 - 2;\n if(xR >= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n vec4 previous = getX(batch, xR, xCOffset, d1);\n xR"+f+"C"+d+" = vec4(previous.zw, xTexelR"+f+"C"+d+".xy);\n } else {\n xR"+f+"C"+d+" = vec4(0, 0, xTexelR"+f+"C"+d+".xy);\n }\n ":"\n if(xR >= 0 && xR < "+e+" && xC >= 0 && xC < "+n+") {\n xTexelR"+f+"C"+d+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+f+"C"+d+" = vec4(0.);\n }\n\n xR"+f+"C"+d+" = xTexelR"+f+"C"+d+";\n ",d+1= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n }\n ",1= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+d+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+f+"C"+d+" = vec4(0.);\n }\n "),p+="\n xR"+f+"C"+(d+1)+" = vec4(\n xTexelR"+f+"C"+d+".zw, xTexelR"+f+"C"+(d+2)+".xy);\n "):p+="\n xCOffset = xC + "+m+";\n\n if(xR >= 0 && xR < "+e+" &&\n xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n }\n\n xR"+f+"C"+(d+1)+" = xTexelR"+f+"C"+(d+2)+";\n "}}else d= 0 && xR < "+e+") {\n ",o%2==1?(p+="\n xCOffset = xC + 1 - "+a+";\n if(xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+d+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+f+"C"+d+" = vec4(0.);\n }\n\n if(xC + 1 >= 0 && xC + 1 < "+n+") {\n xTexelR"+f+"C"+(d+2)+" = getX(batch, xR, xC + 1, d1);\n } else {\n xTexelR"+f+"C"+(d+2)+" = vec4(0.);\n }\n\n xR"+f+"C"+d+" = vec4(\n xTexelR"+f+"C"+d+".zw, xTexelR"+f+"C"+(d+2)+".zw);\n ",d+1= 0 && xCOffset < "+n+") {\n final = getX(batch, xR, xCOffset, d1);\n }\n xR"+f+"C"+(d+1)+" = vec4(xTexelR"+f+"C"+(d+2)+".xy, final.xy);\n ")):(p+="\n if(xC >= 0 && xC < "+n+") {\n xTexelR"+f+"C"+d+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+f+"C"+d+" = vec4(0.);\n }\n\n xCOffset = xC + "+a+";\n if(xCOffset >= 0 && xCOffset < "+n+") {\n xTexelR"+f+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+f+"C"+(d+2)+" = vec4(0.);\n }\n\n xR"+f+"C"+d+" = vec4(\n xTexelR"+f+"C"+d+".xy, xTexelR"+f+"C"+(d+2)+".xy);\n ",d+1= "+i+") {\n return;\n }\n\n float height_scale = "+y+";\n float width_scale = "+E+";\n\n float in_y = "+x+";\n if( in_y < 0.0 || in_y > "+d+" ) {\n setOutput(float("+o+"));\n return;\n }\n float in_x = "+C+";\n if( in_x < 0.0 || in_x > "+v+" ) {\n setOutput(float("+o+"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if("+p+" == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n "},lr=function(t,e,n){this.variableNames=["x"];var r=(this.outputShape=t).length,o=t[t.length-1],i=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+o+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+Dn(r)+" coords = getOutputCoords();\n int end = "+hr(r,"coords")+";\n float val = 0.0;\n for (int i = "+o+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+i+" end) {\n continue;\n }\n if (idx == end && "+e+") {\n continue;\n }\n "+hr(r,"coords")+" = idx;\n val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(r,"coords")+");\n }\n setOutput(val);\n }\n "};function hr(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var pr=function(){function t(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+e+";\n int offset_h = imod(h, "+e+");\n int in_w = w / "+e+";\n int offset_w = imod(w, "+e+");\n int offset_d = (offset_h * "+e+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n "}return t.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},t.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},t.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},t.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},t}(),fr=function(t){this.variableNames=["A"];var e=wn();this.outputShape=t,this.userCode="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n\n void main() {\n float x = getAAtOutCoords();\n "+e.output+" = encode_float(x);\n }\n "},dr="return real * expR - imag * expI;",vr="return real * expI + imag * expR;",mr=function(t,e,n){this.variableNames=["real","imag"];var r=e[1];this.outputShape=e;var o=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,i=n?r+".0":"1.0";this.userCode="\n const float exponentMultiplier = "+o+";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n "+t+"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float("+r+");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < "+r+"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / "+i+";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n "},gr=function(){function t(t,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=t,this.userCode="\n uniform float value;\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}return t.prototype.getCustomSetupFunc=function(n){var r=this;return function(t,e){null==r.valueLoc&&(r.valueLoc=t.getUniformLocationNoThrow(e,"value")),t.gl.uniform1f(r.valueLoc,n)}},t}(),yr=function(t){this.variableNames=["A"];var e=wn(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+n+".0);\n\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n "},xr=function(t,e,n){this.variableNames=["A","indices"];var r=t.slice();r[n]=e,this.outputShape=r,this.rank=r.length;var o=Dn(this.rank),i=function(t,e){var n=t.length;if(4= "+r);for(var o=0,i=0;i= "+i);for(var a=r%2==1,s=n%2==1,u=Math.floor(r/2),c=Math.floor(n/2),l=Math.ceil(r/2),h=l*Math.ceil(n/2),p=_(n)*_(r),f=0;f=n.length-2?_(n[e]):n[e]})).length&&(n=[2,n[0]])),2!==n.length){var o=I(n);n=o.newShape}var i=B(n);if(n.length<=1&&i<=r)return[1,i];if(2===n.length&&n[0]<=r&&n[1]<=r)return n;if(3===n.length&&n[0]*n[1]<=r&&n[2]<=r)return[n[0]*n[1],n[2]];if(3===n.length&&n[0]<=r&&n[1]*n[2]<=r)return[n[0],n[1]*n[2]];if(4===n.length&&n[0]*n[1]*n[2]<=r&&n[3]<=r)return[n[0]*n[1]*n[2],n[3]];if(4===n.length&&n[0]<=r&&n[1]*n[2]*n[3]<=r)return[n[0],n[1]*n[2]*n[3]];if(t){var a=oo(n),s=2,u=2;return n.length&&(s=(e=io(n))[0],u=e[1]),b(i=a*(s/2)*(u/2)).map(function(t){return 2*t})}return b(i)}function so(t){return t%2==0}function uo(t,e){if(E(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(so(n)&&so(r)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&so(t[0])&&so(e[0])}var co=Object.freeze({callAndCheck:Ar,canBeRepresented:Dr,getWebGLErrorMessage:Mr,getExtensionOrThrow:Or,createVertexShader:Pr,createFragmentShader:Fr,createProgram:Br,linkProgram:Wr,validateProgram:zr,createStaticVertexBuffer:Ur,createStaticIndexBuffer:Gr,getNumChannels:Vr,createTexture:Hr,validateTextureSize:qr,createFramebuffer:jr,bindVertexBufferToProgramAttribute:$r,bindTextureUnit:Kr,unbindTextureUnit:function(t,e,n){ro(t,n),Ar(t,e,function(){return t.activeTexture(t.TEXTURE0+n)}),Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Xr,getProgramUniformLocation:Yr,bindTextureToProgramUniformSampler:Qr,bindCanvasToFramebuffer:function(t,e){Ar(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),Ar(t,e,function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)}),Ar(t,e,function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)})},bindColorTextureToFramebuffer:Jr,unbindColorTextureFromFramebuffer:Zr,validateFramebuffer:to,getFramebufferErrorMessage:eo,getBatchDim:oo,getRowsCols:io,getTextureShapeFromLogicalShape:ao,isReshapeFree:uo});function lo(t,e){var n=wn();return Pr(t,e,n.version+"\n precision highp float;\n "+n.attribute+" vec3 clipSpacePos;\n "+n.attribute+" vec2 uv;\n "+n.varyingVs+" vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function ho(t,e){return Ur(t,e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function po(t,e){return Gr(t,e,new Uint16Array([0,1,2,2,1,3]))}function fo(t,e){var n,r,o,i,a,s,u,c,l=t;return c=2===Zt.get("WEBGL_VERSION")?(n=l.R32F,r=l.R16F,o=l.RGBA16F,i=l.RGBA32F,a=l.RED,s=4,u=1,l.HALF_FLOAT):(n=t.RGBA,r=t.RGBA,o=t.RGBA,i=l.RGBA,a=t.RGBA,u=s=4,null!=e?e.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:i,textureFormatFloat:a,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:c}}function vo(t,e,n,r,o,i,a){qr(n,r);var s=Hr(t,e),u=t.TEXTURE_2D;return Ar(t,e,function(){return t.bindTexture(u,s)}),Ar(t,e,function(){return t.texParameteri(u,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)}),Ar(t,e,function(){return t.texParameteri(u,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}),Ar(t,e,function(){return t.texParameteri(u,t.TEXTURE_MIN_FILTER,t.NEAREST)}),Ar(t,e,function(){return t.texParameteri(u,t.TEXTURE_MAG_FILTER,t.NEAREST)}),Ar(t,e,function(){return t.texImage2D(u,0,o,n,r,0,i,a,null)}),Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)}),s}function mo(t,e,n,r,o){var i=Sr(n,r);return vo(t,e,i[0],i[1],o.internalFormatFloat,o.textureFormatFloat,t.FLOAT)}function go(t,e,n,r,o){var i=Sr(n,r);return vo(t,e,i[0],i[1],o.internalFormatHalfFloat,o.textureFormatFloat,o.textureTypeHalfFloat)}function yo(t,e,n,r,o){var i=Sr(n,r);return vo(t,e,i[0],i[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function xo(t,e,n,r,o){var i=kr(n,r);return vo(t,e,i[0],i[1],o.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function wo(t,e,n,r,o){var i=kr(n,r);return vo(t,e,i[0],i[1],o.internalFormatPackedHalfFloat,t.RGBA,o.textureTypeHalfFloat)}function bo(t,e,n,r){return Ar(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),$r(t,e,n,"clipSpacePos",r,3,20,0)&&$r(t,e,n,"uv",r,2,20,12)}function Eo(t,e,n,r){Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),Ar(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)}),Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function Co(t,e,n,r,o,i,a){qr(r,o),Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),Ar(t,e,function(){return t.texSubImage2D(t.TEXTURE_2D,0,0,0,r,o,a,t.FLOAT,i)}),Ar(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function _o(t,e,n,r,o,i,a,s){var u,c=Sr(r,o),l=c[0],h=c[1],p=r*o;1===s.defaultNumChannels&&p===i.length?u=i:function(t,e,n){var r=Rr(t.length,n);if(e.length= "+r);for(var o=0,i=0;i= "+t[1]+" || pos >= "+t[0]+") continue;\n\n int offsetY = int(blockIndex / ("+u+")) * "+a+" - "+p+";\n int d0 = offsetY + "+l+" * (pos / "+f+");\n\n if(d0 >= "+e[0]+" || d0 < 0) continue;\n\n int offsetX = int(mod(float(blockIndex), "+u+".) * "+i+". - "+h+".);\n int d1 = offsetX + "+c+" * (int(mod(float(pos), "+f+".) / "+o+".));\n\n if(d1 >= "+e[1]+" || d1 < 0) continue;\n\n vec2 innerDims = vec2(d1, int(mod(float(pos), "+o+".)));\n result[row * 2 + col] = getChannel(getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n\n "+d.output+" = result;\n }\n "},Fo=function(t,e,n,r,o){this.variableNames=["x"],this.outputShape=[];var i,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";i=.5===o?"inversesqrt("+u+")":1===o?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+a+"; j <= "+a+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+i+";\n setOutput(val);\n }\n "},Lo=function(t,e,n,r,o){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=o,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+e+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+e+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+r+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+r+")\n * float("+o+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+o+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n "},Bo=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,o=t.effectiveFilterHeight,i=t.effectiveFilterWidth,a=o-1-t.padInfo.top,s=i-1-t.padInfo.left,u=o*i-1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+o+";\n wR += "+r+") {\n float dyR = float(dyRCorner + wR) / "+e+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+i+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+n+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+u+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+i+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "},Wo=function(t,e,n,r,o,i){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=null),this.variableNames=["matrixA","matrixB"],this.usesPackedTextures=!0,this.outputShape=e;var a=n?t[1]:t[2],s=Math.ceil(a/2),u=n?"i * 2, rc.y":"rc.y, i * 2",c=r?"rc.z, i * 2":"i * 2, rc.z",l=n?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],h=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],p="",f="";i&&(p="vec4 activation(vec4 x) {\n "+i+"\n }",f="result = activation(result);");var d=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),this.userCode="\n "+p+"\n\n const float sharedDimension = "+s+".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < "+s+"; i++) {\n vec4 a = getMatrixA(rc.x, "+u+");\n vec4 b = getMatrixB(rc.x, "+c+");\n\n result += ("+l[0]+" * "+h[0]+") + ("+l[1]+" * "+h[1]+");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n "+d+"\n\n "+f+"\n\n setOutput(result);\n }\n "},zo=function(){function t(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(e-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(e-1)+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(n){var r=this;return function(t,e){null==r.seedLoc&&(r.seedLoc=t.getUniformLocation(e,"seed")),t.gl.uniform1f(r.seedLoc,n)}},t}(),Uo=function(t,e,n,r){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+r+"), float("+n+"),\n float(index == coords.y)));\n }\n "},Go=function(t){this.variableNames=["A"],this.isPackShader=!0;var e,n,r,o,i=(this.outputShape=t).length;if(0===i)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var a=mn("rc",i),s=Dn(i),u=function(t,e,n){if(1===t)return"rc > "+e[0];for(var r="",o=t-2;o= "+e[o],o= "+e+";\n bool rEdge = rp1 >= "+n+";\n "}(i,t[t.length-1],t[t.length-2],a),l=(n=a,r=(e=t).length,o=function(t,e){for(var n=[],r=0;r<=1;r++)for(var o=0;o<=1;o++){for(var i=(0===r?"r":"rp1")+", "+(0===o?"c":"cp1"),a=2;a= "+e[0]+" ? 0. : getA(rc + 1),\n 0, 0":"getA("+o[0]+"),\n cEdge ? 0. : getA("+o[1]+"),\n rEdge ? 0. : getA("+o[2]+"),\n rEdge || cEdge ? 0. : getA("+o[3]+")");this.userCode="\n void main() {\n "+s+" rc = getOutputCoords();\n\n if("+u+") {\n setOutput(vec4(0));\n } else {\n "+c+"\n\n setOutput(vec4("+l+"));\n }\n }\n "}};var Vo=function(n,t,e){this.variableNames=["x"],this.outputShape=t.map(function(t,e){return t[0]+n[e]+t[1]});var r=n.length,o=Dn(r),i=t.map(function(t){return t[0]}).join(","),a=t.map(function(t,e){return t[0]+n[e]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+o+" start = "+o+"("+i+");\n "+o+" end = "+o+"("+a+");\n\n void main() {\n "+o+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+e+"));\n } else {\n "+o+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+i+";\n int end = "+a+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+e+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "},Ho=function(n,t,e){this.variableNames=["x"],this.usesPackedTextures=!0,this.outputShape=t.map(function(t,e){return t[0]+n[e]+t[1]});for(var r=n.length,o=Dn(r),i=t.map(function(t){return t[0]}).join(","),a=t.map(function(t,e){return t[0]+n[e]}).join(","),s=mn("rc",r),u=mn("source",r),c=s[r-1]+" < "+this.outputShape[r-1],l=1===r?"source":"vec2("+u.slice(-2).join()+")",h=[o+" rc = outputLoc;",s[r-1]+" += 1;\n if("+c+") {\n ",1===r?"":"}\n rc = outputLoc;\n "+s[r-2]+" += 1;\n if("+s[r-2]+" < "+this.outputShape[r-2]+") {",1===r?"":" "+s[r-1]+" += 1;\n if("+c+") {"],p=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",f="",d=0,v=1===r?2:4;d= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+c+";\n wC += "+s+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+c+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var d=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(d="avgValue / count");var v=4*Math.floor(r/4),m=r%4,g="\n if ("+p+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+l+", "+h+");\n const float initializationValue = "+f+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+f+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+u+";\n wR += "+a+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+v+"; wC += 4) {\n int xC = xCCorner + wC * "+s+";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n getValue(batch, xR, xC + 3 * "+s+", d)\n );\n\n "+g+"\n }\n\n int xC = xCCorner + "+v+";\n if ("+(1===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+g+"\n } else if ("+(2===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n initializationValue,\n initializationValue\n );\n\n "+g+"\n } else if ("+(3===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n initializationValue\n );\n\n "+g+"\n }\n }\n setOutput("+d+");\n }\n "}},jo=function(t,e){this.variableNames=["x"];var n=t.windowSize,r=t.batchSize,o=t.inSize,i=Math.ceil(o/n);this.outputShape=[r,i];var a="0.0",s="";"prod"===e?a="1.0":"min"===e?(a="1.0 / 1e-20",s="min"):"max"===e&&(a="-1.0 / 1e-20",s="max");var u=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?u="sumValue":"prod"===e?u="prodValue":"all"===e?u="allValue":"any"===e&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,h="\n if ("+("sum"===e)+") {\n sumValue += dot(values, ones);\n } else if ("+("prod"===e)+") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",p="vec4";"all"===e?(a="1.0",h="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",p="bvec4"):"any"===e&&(a="0.0",h="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",p="bvec4");var f="";0= "+o+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+a+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+f+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+a+");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+c+"; i += 4) {\n int inIdx = inOffset + i;\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+h+"\n }\n\n int inIdx = inOffset + "+c+";\n if ("+(1===l)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+h+"\n } else if ("+(2===l)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+h+"\n } else if ("+(3===l)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+h+"\n }\n setOutput("+u+");\n }\n "},$o=function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t;for(var n="",r=0;r<4;r++){var o="thisRC = rc;";r%2==1&&(o+="thisRC.z += 1;"),1= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(o-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(i-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},Xo=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var o=t[0],i=t[1],a=t[2],s=t[3];this.outputShape=[o,e,n,s];var u=[r&&1= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+c[0]+") *\n (float(dyR) / float("+l[0]+"));\n\n float sourceFracCol =\n float("+c[1]+") *\n (float(dyC) / float("+l[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+i+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},Jo=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var o=t[0],i=t[1],a=t[2],s=t[3];this.outputShape=[o,e,n,s];var u=[r&&1= 1.0) {\n setOutput(getA("+o+"));\n } else {\n setOutput(getB("+o+"));\n }\n }\n "},oi=function(){function t(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=Dn(this.rank),r="uniform int start["+this.rank+"];",o=function(t){if(1===t)return"sourceLoc";if(t<=6)return ii.slice(0,t).map(function(t){return"sourceLoc."+t}).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n "+n+" sourceLoc;\n "+n+" coords = getOutputCoords();\n "+t.map(function(t,e){return"sourceLoc."+ii[e]+" = start["+e+"] + coords."+ii[e]+";"}).join("\n")+"\n ",this.userCode="\n "+r+"\n void main() {\n "+e+"\n setOutput(getSource("+o+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(n){var r=this;if(n.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+n.length+")");return function(t,e){null==r.startLoc&&(r.startLoc=t.getUniformLocationNoThrow(e,"start"),null==r.startLoc)||t.gl.uniform1iv(r.startLoc,n)}},t}(),ii=["x","y","z","w","u","v"];var ai=function(){function t(t){this.variableNames=["source"],this.usesPackedTextures=!0,this.outputShape=t,this.rank=t.length;var e=Dn(this.rank),n=mn("coords",this.rank),r=mn("sourceLoc",this.rank),o=1===this.rank?"sourceLoc":"vec2("+r.slice(-2).join()+")",i="getChannel(getSource("+r.join()+"), "+o+")",a="\n result.x = "+i+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.y = "+i+";\n --"+r[this.rank-1]+";\n }\n ",s=1===this.rank?"":"\n --"+n[this.rank-1]+";\n if (++"+n[this.rank-2]+" < "+t[this.rank-2]+") {\n ++"+r[this.rank-2]+";\n result.z = "+i+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.w = "+i+";\n }\n }\n ",u=this.rank<=4?"sourceLoc = coords +\n "+e+"("+t.map(function(t,e){return"start["+e+"]"}).join()+");":t.map(function(t,e){return r[e]+" = "+n[e]+" + start["+e+"];"}).join("\n");this.userCode="\n uniform int start["+this.rank+"];\n void main() {\n "+e+" coords = getOutputCoords();\n "+e+" sourceLoc;\n "+u+" \n vec4 result = vec4(0.);\n "+a+"\n "+s+"\n setOutput(result);\n }\n "}return t.prototype.getCustomSetupFunc=function(n){var r=this;if(n.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+n.length+")");return function(t,e){null==r.startLoc&&(r.startLoc=t.getUniformLocationNoThrow(e,"start"),null==r.startLoc)||t.gl.uniform1iv(r.startLoc,n)}},t}(),si=function(t,e,n,r){this.variableNames=["x"];var o=n.filter(function(t,e){return-1===r.indexOf(e)});this.outputShape=o;var i=n.length,a=Dn(n.length),s=Dn(o.length),u="";if(1===i)u="coords * strides + begin";else{var c=0;u=n.map(function(t,e){return-1===r.indexOf(e)?(c++,1===o.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(c-1)+"] * strides["+e+"] + begin["+e+"]"):"begin["+e+"]"}).join(",")}this.userCode="\n "+a+" begin = "+a+"("+t+");\n "+a+" strides = "+a+"("+e+");\n\n void main() {\n "+s+" coords = getOutputCoords();\n setOutput(getX("+u+"));\n }\n "},ui=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var r,o=ci(e,n),i=li(t,o,n);if(i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]),0>>0,r=(n*=r)>>>0,r+=4294967296*(n-=r)}return 2.3283064365386963e-10*(r>>>0)});e.next=function(){var t=2091639*e.s0+2.3283064365386963e-10*e.c;return e.s0=e.s1,e.s1=e.s2,e.s2=t-(e.c=0|t)},e.c=1,e.s0=n(" "),e.s1=n(" "),e.s2=n(" "),e.s0-=n(t),e.s0<0&&(e.s0+=1),e.s1-=n(t),e.s1<0&&(e.s1+=1),e.s2-=n(t),e.s2<0&&(e.s2+=1),n=null}(t),r=e&&e.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.alea=r}(0,t)}),Di=Ti(function(t){!function(t,e,n){function i(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function r(t,e){var n=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xor128=r}(0,t)}),Mi=Ti(function(t){!function(t,e,n){function i(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function r(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,t===((e.v=0)|t)?e.x=t:n+=t;for(var r=0;r>>4),e.next()}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xorwow=r}(0,t)}),Oi=Ti(function(t){!function(t,e,n){function i(t,e){return e.x=t.x.slice(),e.i=t.i,e}function r(t,e){null==t&&(t=+new Date);var n=new function(t){var o=this;o.next=function(){var t,e,n=o.x,r=o.i;return t=n[r],e=(t^=t>>>7)^t<<24,e^=(t=n[r+1&7])^t>>>10,e^=(t=n[r+3&7])^t>>>3,e^=(t=n[r+4&7])^t<<7,t=n[r+7&7],e^=(t^=t<<13)^t<<9,n[r]=e,o.i=r+1&7,e},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&(r.x&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xorshift7=r}(0,t)}),Pi=Ti(function(t){!function(t,e,n){function i(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function r(t,e){null==t&&(t=+new Date);var n=new function(t){var i=this;i.next=function(){var t,e,n=i.w,r=i.X,o=i.i;return i.w=n=n+1640531527|0,e=r[o+34&127],t=r[o=o+1&127],e^=e<<13,t^=t<<17,e^=e>>>15,t^=t>>>12,e=r[o]=e^t,i.i=o,e+(n^n>>>16)|0},function(t,e){var n,r,o,i,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,0<=i&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(128<=o&&(s[127&(e&&e.length||0)]=-1),o=127,i=512;0>>15,n^=n>>>12,s[o]=r^n;t.w=a,t.X=s,t.i=o}(i,t)}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&(r.X&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xor4096=r}(0,t)}),Fi=Ti(function(t){!function(t,e,n){function i(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function r(t,e){var n=new function(t){var o=this,e="";o.next=function(){var t=o.b,e=o.c,n=o.d,r=o.a;return t=t<<25^t>>>7^e,e=e-n|0,n=n<<24^n>>>8^r,r=r-t|0,o.b=t=t<<20^t>>>12^e,o.c=e=e-n|0,o.d=n<<16^e>>>16^r,o.a=r-t|0},o.a=0,o.b=0,o.c=-1640531527,o.d=1367130551,t===Math.floor(t)?(o.a=t/4294967296|0,o.b=0|t):e+=t;for(var n=0;n>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.tychei=r}(0,t)}),Li=Ti(function(e){!function(s,u){var c,l=this,h=256,p=6,f="random",d=u.pow(h,p),v=u.pow(2,52),m=2*v,g=h-1;function t(t,e,n){var r=[],o=x(function t(e,n){var r,o=[],i=typeof e;if(n&&"object"==i)for(r in e)try{o.push(t(e[r],n-1))}catch(t){}return o.length?o:"string"==i?e:e+"\0"}((e=1==e?{entropy:!0}:e||{}).entropy?[t,w(s)]:null==t?function(){try{var t;return c&&(t=c.randomBytes)?t=t(h):(t=new Uint8Array(h),(l.crypto||l.msCrypto).getRandomValues(t)),w(t)}catch(t){var e=l.navigator,n=e&&e.plugins;return[+new Date,l,n,l.screen,w(s)]}}():t,3),r),i=new function(t){var e,n=t.length,a=this,r=0,o=a.i=a.j=0,i=a.S=[];for(n||(t=[n++]);r>>=1;return(t+n)/e};return a.int32=function(){return 0|i.g(4)},a.quick=function(){return i.g(4)/4294967296},a.double=a,x(w(i.S),s),(e.pass||n||function(t,e,n,r){return r&&(r.S&&y(r,i),t.state=function(){return y(i,{})}),n?(u[f]=t,e):t})(a,o,"global"in e?e.global:this==u,e.state)}function y(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function x(t,e){for(var n,r=t+"",o=0;o=this.lower},t}();function zi(t,e,n){return void 0===e&&(e="float32"),e=e||"float32",tt(t),new lt(t,e,n)}function Ui(t,e){void 0===e&&(e=!1),console.log(t.toString(e))}var Gi=Fe({batchToSpaceND_:function(t,e,n){var r=re(t,"x","batchToSpaceND"),o=e.reduce(function(t,e){return t*e});return D(r.rank>=1+e.length,function(){return"input rank is "+r.rank+" but should be > than blockShape.length "+e.length}),D(n.length===e.length,function(){return"crops.length is "+n.length+" but should be equal to blockShape.length "+e.length}),D(r.shape[0]%o==0,function(){return"input tensor batch is "+r.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+o}),Zt.engine.runKernel(function(t){return t.batchToSpaceND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}})}}),Vi=Fe({cast_:function(t,e){var n=re(t,"x","cast");return Zt.engine.runKernel(function(t){return t.cast(n,e)},{$x:n},function(t){return{$x:function(){return t.clone()}}})}}),Hi=Fe({clone_:function(t){var e=re(t,"x","clone",null);return Zt.engine.runKernel(function(t){return dt.make(e.shape,{dataId:e.dataId},e.dtype)},{$x:e},function(t){return{$x:function(){return t.toFloat()}}})}}),qi=Fe({cumsum_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var o=re(t,"x","cumsum"),i=Ce([e|=0],o.rank),a=o;null!=i&&(a=o.transpose(i));var s=Se(1,o.rank)[0],u=Zt.engine.runKernel(function(t){return t.cumsum(a,s,n,r)},{permutedX:a},function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}});return null!=i&&(u=u.transpose(i)),u}}),ji=Fe({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var r=re(t,"x","depthToSpace"),o="NHWC"===n?r.shape[1]:r.shape[2],i="NHWC"===n?r.shape[2]:r.shape[3],a="NHWC"===n?r.shape[3]:r.shape[1];return D(0<=o*e,function(){return"Negative dimension size caused by overflow when multiplying\n "+o+" and "+e+" for depthToSpace with input shape\n "+r.shape}),D(0<=i*e,function(){return"Negative dimension size caused by overflow when multiplying\n "+i+" and "+e+" for depthToSpace with input shape\n "+r.shape}),D(a%(e*e)==0,function(){return"Dimension size must be evenly divisible by "+e*e+" but is "+a+" for depthToSpace with input shape "+r.shape}),Zt.engine.runKernel(function(t){return t.depthToSpace(r,e,n)},{$x:r})}}),$i=Fe({expandDims_:function(t,e){void 0===e&&(e=0);var n=re(t,"x","expandDims");D(e<=n.rank,function(){return"Axis must be <= rank of the tensor"});var r=n.shape.slice();return e<0&&(D(-(n.rank+1)<=e,function(){return"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"}),e=n.rank+e+1),r.splice(e,0,1),ia(n,r)}}),Ki=Fe({eye_:function(t,e,n,r){void 0===r&&(r="float32"),null==e&&(e=t);for(var o=zi([t,e],r),i=t<=e?t:e,a=0;a=2, but it is "+e);var o=re(t,"indices","oneHot","int32"),i=o.shape.concat([e]);return o=o.flatten(),Zt.engine.runKernel(function(t){return t.oneHot(o,e,n,r)},{$indices:o},function(t){return{$indices:function(){return Qe(o.shape,"float32")}}}).reshape(i)}}),Qi=Fe({pad_:function(t,e,n){void 0===n&&(n=0);var r=re(t,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var o=e.map(function(t){return t[0]});return Zt.engine.runKernel(function(t){return t.pad(r,e,n)},{$x:r},function(t){return{$x:function(){return t.slice(o,r.shape)}}})}}),Ji=Fe({pad1d_:function(t,e,n){return void 0===n&&(n=0),D(2===e.length,function(){return"Invalid number of paddings. Must be length of 2."}),Qi(t,[e],n)}}),Zi=Fe({pad2d_:function(t,e,n){return void 0===n&&(n=0),D(2===e.length&&2===e[0].length&&2===e[1].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),Qi(t,e,n)}}),ta=Fe({pad3d_:function(t,e,n){return void 0===n&&(n=0),D(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),Qi(t,e,n)}}),ea=Fe({pad4d_:function(t,e,n){return void 0===n&&(n=0),D(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),Qi(t,e,n)}}),na=Fe({rand_:function(t,e,n){var r=B(t),o=null;if(null==n||"float32"===n)o=new Float32Array(r);else if("int32"===n)o=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);o=new Uint8Array(r)}for(var i=0;i=1+r.length,function(){return"input rank "+e.rank+" should be > than [blockShape] "+r.length}),D(o.length===r.length,function(){return"paddings.shape[0] "+o.length+" must be equal to [blockShape] "+r.length}),D(e.shape.reduce(function(t,e,n){return 0=-n.shape.length&&eZt.get("WEBGL_MAX_TEXTURES_IN_SHADER")){var n=Math.floor(t.length/2),r=this.concat(t.slice(0,n),e),o=this.concat(t.slice(n),e);return this.concat([r,o],e)}if(Zt.get("WEBGL_PACK_ARRAY_OPERATIONS")&&1 4 with a WebGL backend not implemented yet"});var r=e.reduce(function(t,e){return t*e}),o=de(t.shape,e,r),i=ve(o.length,e.length),a=me(t.shape,e,r),s=ge(n,e.length),u=ye(a,n,e.length);return t.reshape(o).transpose(i).reshape(a).slice(s,u)},t.prototype.spaceToBatchND=function(t,e,n){D(t.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var r=e.reduce(function(t,e){return t*e}),o=[[0,0]];o.push.apply(o,n);for(var i=1+e.length;i b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.greaterEqual=function(t,e){if(Zt.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThanEqual(a, b));\n","bool");var n=new jn("return float(a >= b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.logicalNot=function(t){var e=new mi(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},t.prototype.logicalAnd=function(t,e){if(Zt.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n","bool");var n=new jn("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.logicalOr=function(t,e){if(Zt.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n","bool");var n=new jn("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},t.prototype.select=function(t,e,n){var r=new ri(t.rank,e.shape,e.rank),o=this.makeOutputArray(r.outputShape,kt(e.dtype,n.dtype));return this.compileAndRun(r,[t,e,n],o)},t.prototype.where=function(t){fe("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return fa(t.shape,e)},t.prototype.topk=function(t,e,n){return fn(t.dataSync(),t.shape,t.dtype,e)},t.prototype.min=function(t,e){Ee("min",e,t.rank);var n=we(t.shape,e),r=n[0],o=B(n[1]),i=t.as2D(-1,o);return this.reduce(i,"min",i.dtype).reshape(r)},t.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new jn("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.mod=function(t,e){var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new jn("if (b == 0.0) return NAN;\n return mod(a, b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);Ee("max",e,t.rank);var n=we(t.shape,e),r=n[0],o=B(n[1]),i=t.as2D(-1,o);return this.reduce(i,"max",i.dtype).reshape(r)},t.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new jn("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.all=function(t,e){Ee("all",e,t.rank);var n=we(t.shape,e),r=n[0],o=B(n[1]),i=t.as2D(-1,o);return this.reduce(i,"all",i.dtype).reshape(r)},t.prototype.any=function(t,e){Ee("any",e,t.rank);var n=we(t.shape,e),r=n[0],o=B(n[1]),i=t.as2D(-1,o);return this.reduce(i,"any",i.dtype).reshape(r)},t.prototype.squaredDifference=function(t,e){var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n(qn,t.shape,e.shape):new jn(qn,t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.realDivide=function(t,e){var n=new jn("if (a == b) return 1.0;\n return a / b;",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[t,e],r)},t.prototype.floorDiv=function(t,e){if(Zt.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n vec4 resultSign = sign(a) * sign(b);\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n ivec4 result = ia / ib;\n ivec4 amodb = ia - ib * result;\n\n // Vectorize INT_DIV\n // if (resultSign < 0.0 && amodb != 0) result -= 1;\n // return float(result);\n return vec4(result -\n ivec4(lessThan(resultSign, vec4(0.0))) * ivec4(notEqual(amodb, ivec4(0))));\n","int32");var n=new jn("\n float resultSign = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n int result = ia / ib;\n int amodb = ia - ib * result;\n\n if (resultSign < 0.0 && amodb != 0) {\n result -= 1;\n }\n return float(result);\n",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"int32");return this.compileAndRun(n,[t,e],r)},t.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Gn);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=kt(t.dtype,e.dtype);if(Zt.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Gn,n);var r=new jn(Gn,t.shape,e.shape),o=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],o)},t.prototype.packedBinaryOp=function(t,e,n,r){var o=new $n(n,t.shape,e.shape),i=this.makePackedTensor(o.outputShape,r);return this.compileAndRun(o,[t,e],i)},t.prototype.complexSeparableBinaryOp=function(s,u,c){var l=this,t=this.texData.get(s.dataId),e=this.texData.get(u.dataId),n=[[t.complexTensors.real,e.complexTensors.real],[t.complexTensors.imag,e.complexTensors.imag]].map(function(t){var e=t[0],n=t[1],r=l.makeComplexComponentTensorHandle(s,e),o=l.makeComplexComponentTensorHandle(u,n),i=new jn(c,s.shape,u.shape),a=l.makeOutputArray(i.outputShape,kt(e.dtype,n.dtype));return l.compileAndRun(i,[r,o],a)}),r=n[0],o=n[1],i=this.complex(r,o);return r.dispose(),o.dispose(),i},t.prototype.makeComplexComponentTensorHandle=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},t.prototype.addN=function(t){for(var e=t[0],n=1;n 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new jn("\nif(a < 0.0 && floor(b) < b){\n return NAN;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),o=kt(t.dtype,e.dtype),i=n?this.makePackedTensor(r.outputShape,o):this.makeOutputArray(r.outputShape,o);return this.compileAndRun(r,[t,e],i)},t.prototype.ceil=function(t){var e=new mi(t.shape,"return ceil(x);");return this.compileAndRun(e,[t])},t.prototype.floor=function(t){var e=new mi(t.shape,"return floor(x);");return this.compileAndRun(e,[t])},t.prototype.sign=function(t){var e=new mi(t.shape,"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(e,[t])},t.prototype.isNaN=function(t){var e=new mi(t.shape,"return float(isnan(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.isInf=function(t){var e=new mi(t.shape,"return float(isinf(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.isFinite=function(t){var e=new mi(t.shape,"return float(!isnan(x) && !isinf(x));"),n=this.makeOutputArray(e.outputShape,"bool");return this.compileAndRun(e,[t],n)},t.prototype.round=function(t){var e=new mi(t.shape,"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n");return this.compileAndRun(e,[t])},t.prototype.exp=function(t){var e;return e=Zt.get("WEBGL_PACK")?new Ei(t.shape,xi):new mi(t.shape,xi),this.compileAndRun(e,[t])},t.prototype.expm1=function(t){var e=new mi(t.shape,"return exp(x) - 1.0;");return this.compileAndRun(e,[t])},t.prototype.log=function(t){var e;return e=Zt.get("WEBGL_PACK")?new Ei(t.shape,"\n vec4 result = log(x);\n vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n result.r = isNaN.r == 1.0 ? NAN : result.r;\n result.g = isNaN.g == 1.0 ? NAN : result.g;\n result.b = isNaN.b == 1.0 ? NAN : result.b;\n result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n return result;\n"):new mi(t.shape,"if (x < 0.0) return NAN;\n return log(x);"),this.compileAndRun(e,[t])},t.prototype.log1p=function(t){var e=new mi(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},t.prototype.sqrt=function(t){var e=new mi(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},t.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new mi(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},t.prototype.square=function(t){var e=new mi(t.shape,"return x * x;");return this.compileAndRun(e,[t])},t.prototype.reciprocal=function(t){var e=new mi(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},t.prototype.relu=function(t){var e;return e=Zt.get("WEBGL_PACK")?new Ei(t.shape,bi):new mi(t.shape,yi),this.compileAndRun(e,[t])},t.prototype.prelu=function(t,e){var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n",t.shape,e.shape):new jn("return (a < 0.) ? b * a : a;",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.elu=function(t){var e=new mi(t.shape,"return (x >= 0.0) ? x : (exp(x) - 1.0);");return this.compileAndRun(e,[t])},t.prototype.eluDer=function(t,e){var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.shape,e.shape):new jn("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.selu=function(t){var e=new mi(t.shape,"\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = 1.7580993408473768;\n float scale = 1.0507009873554805;\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n");return this.compileAndRun(e,[t])},t.prototype.int=function(t){var e=new mi(t.shape,"return float(int(x));"),n=this.makeOutputArray(e.outputShape,"int32");return this.compileAndRun(e,[t],n)},t.prototype.clip=function(t,e,n){var r,o=(r=Zt.get("WEBGL_PACK_CLIP")?new Xn(t.shape):new Kn(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,o)},t.prototype.abs=function(t){var e=new mi(t.shape,"return abs(x);");return this.compileAndRun(e,[t])},t.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new Yn(t.shape),r=[this.makeComplexComponentTensorHandle(t,e.complexTensors.real),this.makeComplexComponentTensorHandle(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},t.prototype.sigmoid=function(t){var e=new mi(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},t.prototype.softplus=function(t){var e=new mi(t.shape,"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n");return this.compileAndRun(e,[t])},t.prototype.sin=function(t){var e=new mi(t.shape,"if (isnan(x)) return x;\n return sin(x);\n");return this.compileAndRun(e,[t])},t.prototype.cos=function(t){var e=new mi(t.shape,"if (isnan(x)) return x;\n return cos(x);\n");return this.compileAndRun(e,[t])},t.prototype.tan=function(t){var e=new mi(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},t.prototype.asin=function(t){var e=new mi(t.shape,"return asin(x);");return this.compileAndRun(e,[t])},t.prototype.acos=function(t){var e=new mi(t.shape,"return acos(x);");return this.compileAndRun(e,[t])},t.prototype.atan=function(t){var e=new mi(t.shape,"if (isnan(x)) return x;\n return atan(x);\n");return this.compileAndRun(e,[t])},t.prototype.atan2=function(t,e){var n=Zt.get("WEBGL_PACK_BINARY_OPERATIONS")?new $n("\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new jn("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},t.prototype.sinh=function(t){var e=new mi(t.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},t.prototype.cosh=function(t){var e=new mi(t.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},t.prototype.tanh=function(t){var e=new mi(t.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},t.prototype.asinh=function(t){var e=new mi(t.shape,"return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(e,[t])},t.prototype.acosh=function(t){var e=new mi(t.shape,"if (isnan(x)) return x;\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));");return this.compileAndRun(e,[t])},t.prototype.atanh=function(t){var e=new mi(t.shape,"if (isnan(x)) return x;\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;");return this.compileAndRun(e,[t])},t.prototype.erf=function(t){var e=new mi(t.shape,'\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = 0.3275911;\n float a1 = 0.254829592;\n float a2 = -0.284496736;\n float a3 = 1.421413741;\n float a4 = -1.453152027;\n float a5 = 1.061405429;\n\n float t = 1.0 / (1.0 + p * x);\n return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n');return this.compileAndRun(e,[t])},t.prototype.step=function(t,e){var n,r=new mi(t.shape,(void 0===(n=e)&&(n=0),gi+"\n return x > 0.0 ? 1.0 : float("+n+");\n "));return this.compileAndRun(r,[t])},t.prototype.conv2dByMatMul=function(t,e,n){var r=t.shape,o=this.texData.get(t.dataId),i=n.inChannels,a=r[0]*r[1]*r[2],s=n.outChannels,u=(1===a||1===s)&&1e3 1 for depthToSpace, but was: "+e});var r=t.shape[0],o="NHWC"===n?t.shape[1]:t.shape[2],i="NHWC"===n?t.shape[2]:t.shape[3],a="NHWC"===n?t.shape[3]:t.shape[1],s=o*e,u=i*e,c=a/(e*e),l=new pr("NHWC"===n?[r,s,u,c]:[r,c,s,u],e,n);return this.compileAndRun(l,[t])},t.prototype.split=function(t,e,n){return pn(t,e,n)},t.prototype.scatterND=function(t,e,n){var r=Te(0,t,n),o=r.sliceRank,i=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=[u/a,a],l=t.reshape([i,o]),h=e.reshape([i,a]);if(0===u)return sn(Ge([]),n);var p=Ve(0),f=new ei(i,o,l.rank,h.rank,s,c);return this.compileAndRun(f,[h,l,p]).reshape(n)},t.prototype.sparseToDense=function(t,e,n,r){var o=Te(0,t,n),i=o.sliceRank,a=o.numUpdates,s=o.strides,u=o.outputSize,c=new ei(a,i,t.rank,e.rank,s,[u,1],!1);return this.compileAndRun(c,[e,t,r]).reshape(n)},t.prototype.fft=function(t){return this.fftImpl(t,!1)},t.prototype.ifft=function(t){return this.fftImpl(t,!0)},t.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new mr(dr,t.shape,e),o=new mr(vr,t.shape,e),i=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag)],a=this.compileAndRun(r,i),s=this.compileAndRun(o,i),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},t.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],o=Ne(t,e),i=o[0],a=o[1],s=o[2],u=o[3],c=e.reshape([a,r]),l=t.reshape([t.size/s,s]),h=new _r(r,u,[a,s]);return this.compileAndRun(h,[l,c]).reshape(i)},t.prototype.fill=function(t,e,n){if("string"===(n=n||q(e))){var r=M(n,B(t));return r.fill(e),dt.make(t,{values:r},n)}var o=new gr(t,e),i=o.getCustomSetupFunc(e),a=this.makeOutputArray(t,n);return this.compileAndRun(o,[],a,i)},t.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported under string dtype");return this.fill(t.shape,1,t.dtype)},t.prototype.zerosLike=function(t){return this.fill(t.shape,"string"===t.dtype?"":0,t.dtype)},t.prototype.makeOutputArray=function(t,e){return dt.make(t,{},e,this)},t.prototype.makePackedTensor=function(t,e){var n=dt.make(t,{},e,this);return this.texData.get(n.dataId).isPacked=!0,n},t.prototype.unpackTensor=function(t){var e=new Ci(t.shape);return this.compileAndRun(e,[t],dt.make(e.outputShape,{},t.dtype,this))},t.prototype.packTensor=function(t){var e=new Go(t.shape);return this.compileAndRun(e,[t],this.makePackedTensor(t.shape,t.dtype))},t.prototype.packedReshape=function(t,e){var n=t.reshape([oo(t.shape)].concat(io(t.shape))),r=[oo(e)].concat(io(e)),o=new $o(r,n.shape);return this.compileAndRun(o,[n]).reshape(e)},t.prototype.compileAndRun=function(o,t,e,n,r){var i=this;if(void 0===r&&(r=!0),null==e&&(e=o.usesPackedTextures?this.makePackedTensor(o.outputShape,t[0].dtype):this.makeOutputArray(o.outputShape,t[0].dtype)),0===e.size)return this.texData.get(e.dataId).values=A(e.dtype,0),e;var a=t.map(function(t){if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var e=i.texData.get(t.dataId);if(null==e.texture){if(!o.usesPackedTextures&&B(t.shape)<=Zt.get("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:i.readSync(t.dataId)};o.usesPackedTextures&&(e.isPacked=!0,e.shape=t.shape)}else if(!!e.isPacked!=!!o.usesPackedTextures)t=e.isPacked?i.unpackTensor(t):i.packTensor(t),e=i.texData.get(t.dataId);else if(e.isPacked&&!uo(e.shape,t.shape)){var n=t,r=t.shape;t.shape=e.shape,t=i.packedReshape(t,r),e=i.texData.get(t.dataId),n.shape=r}return i.uploadToGPU(t.dataId),{shape:t.shape,texData:e,isUniform:!1}});this.uploadToGPU(e.dataId);var s,u={shape:e.shape,texData:this.texData.get(e.dataId),isUniform:!1},c=function(t,e,n){var r="";e.concat(n).forEach(function(t){var e=null!=t.texData&&null!=t.texData.slice&&0p)for(var f=this.numBytesInGPU-p;0= 2, but got rank "+t.rank);if(2===t.rank)return Ic(t,o);var e=t.shape.slice(0,t.shape.length-2).reduce(function(t,e){return t*e}),i=[],a=[];return ha(t.reshape([e,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0).forEach(function(t){var e=Ic(t,o),n=e[0],r=e[1];i.push(n),a.push(r)}),[ua(i,0).reshape(t.shape),ua(a,0).reshape(t.shape)]}}),Dc=Object.freeze({gramSchmidt:Tc,qr:Ac});function Mc(t,e,n,r,o){null==r&&(r=.5),null==o&&(o=Number.NEGATIVE_INFINITY);var i=t.shape[0];return n=Math.min(n,i),D(0<=r&&r<=1,function(){return"iouThreshold must be in [0, 1], but was '"+r+"'"}),D(2===t.rank,function(){return"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"}),D(4===t.shape[1],function(){return"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]}),D(1===e.rank,function(){return"scores must be a 1D tensor"}),D(e.shape[0]===i,function(){return"scores has incompatible shape with boxes. Expected "+i+", but was "+e.shape[0]}),{maxOutputSize:n,iouThreshold:r,scoreThreshold:o}}var Oc=Fe({resizeBilinear_:function(t,e,r){void 0===r&&(r=!1);var n=re(t,"images","resizeBilinear");D(3===n.rank||4===n.rank,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+n.rank+"."}),D(2===e.length,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+e+"."});var o=n,i=!1;3===n.rank&&(i=!0,o=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var a=e[0],s=e[1],u=Zt.engine.runKernel(function(t,e){return e([o]),t.resizeBilinear(o,a,s,r)},{batchImages:o},function(e,n){return{batchImages:function(){return Zt.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,n[0],r)},{})}}});return i?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Pc=Fe({resizeNearestNeighbor_:function(t,e,r){void 0===r&&(r=!1);var n=re(t,"images","resizeNearestNeighbor");D(3===n.rank||4===n.rank,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+n.rank+"."}),D(2===e.length,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."}),D("float32"===n.dtype||"int32"===n.dtype,function(){return"`images` must have `int32` or `float32` as dtype"});var o=n,i=!1;3===n.rank&&(i=!0,o=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var a=e[0],s=e[1],u=Zt.engine.runKernel(function(t,e){return e([o]),t.resizeNearestNeighbor(o,a,s,r)},{batchImages:o},function(e,n){return{batchImages:function(){return Zt.engine.runKernel(function(t){return t.resizeNearestNeighborBackprop(e,n[0],r)},{})}}});return i?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Fc=Fe({nonMaxSuppression_:function(t,e,n,r,o){void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY);var i=re(t,"boxes","nonMaxSuppression"),a=re(e,"scores","nonMaxSuppression"),s=Mc(i,a,n,r,o);return n=s.maxOutputSize,r=s.iouThreshold,o=s.scoreThreshold,Zt.engine.runKernel(function(t){return t.nonMaxSuppression(i,a,n,r,o)},{$boxes:i})}}),Lc=function(s,u,c,l,h){return void 0===l&&(l=.5),void 0===h&&(h=Number.NEGATIVE_INFINITY),m(this,void 0,void 0,function(){var e,n,r,o,i,a;return R(this,function(t){switch(t.label){case 0:return e=re(s,"boxes","nonMaxSuppressionAsync"),n=re(u,"scores","nonMaxSuppressionAsync"),r=Mc(e,n,c,l,h),c=r.maxOutputSize,l=r.iouThreshold,h=r.scoreThreshold,[4,e.data()];case 1:return o=t.sent(),[4,n.data()];case 2:return i=t.sent(),a=ln(o,i,c,l,h),e!==s&&e.dispose(),n!==u&&n.dispose(),[2,a]}})})},Bc=Fe({cropAndResize_:function(t,e,n,r,o,i){var a=re(t,"image","cropAndResize","float32"),s=re(e,"boxes","cropAndResize","float32"),u=re(n,"boxInd","cropAndResize","int32");o=o||"bilinear",i=i||0;var c=s.shape[0];return D(4===a.rank,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."}),D(2===s.rank&&4===s.shape[1],function(){return"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."}),D(1===u.rank&&u.shape[0]===c,function(){return"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."}),D(2===r.length,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."}),D(1<=r[0]&&1<=r[1],function(){return"cropSize must be atleast [1,1], but was "+r}),D("bilinear"===o||"nearest"===o,function(){return"method must be bilinear or nearest, but was "+o}),Zt.engine.runKernel(function(t,e){return t.cropAndResize(a,s,u,r,o,i)},{$image:a,$boxes:s})}}),Wc=Object.freeze({resizeBilinear:Oc,resizeNearestNeighbor:Pc,nonMaxSuppression:Fc,nonMaxSuppressionAsync:Lc,cropAndResize:Bc});var zc=Fe({matMul_:function(t,e,s,u,c,l){var n;void 0===s&&(s=!1),void 0===u&&(u=!1),void 0===l&&(l="linear");var r=re(t,"a","fused matMul"),o=re(e,"b","fused matMul");n=Tt(r,o),r=n[0],o=n[1];var i=s?r.shape[r.rank-2]:r.shape[r.rank-1],a=u?o.shape[o.rank-1]:o.shape[o.rank-2],h=s?r.shape[r.rank-1]:r.shape[r.rank-2],p=u?o.shape[o.rank-2]:o.shape[o.rank-1],f=r.shape.slice(0,-2),d=o.shape.slice(0,-2),v=B(f),m=B(d);D(2<=r.rank&&2<=o.rank&&r.rank===o.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+r.rank+" and "+o.rank+"."}),D(E(f,d),function(){return"Error in fused matMul: outer dimensions ("+f+") and ("+d+") of Tensors with shapes "+r.shape+" and "+o.shape+" must match."}),D(i===a,function(){return"Error in fused matMul: inner shapes ("+i+") and ("+a+") of Tensors with shapes "+r.shape+" and "+o.shape+" and transposeA="+s+" and transposeB="+u+" must match."});var g,y=r.shape.slice(0,-2).concat([h,p]),x=s?r.as3D(v,i,h):r.as3D(v,h,i),w=u?o.as3D(m,p,a):o.as3D(m,a,p);null!=c&&xn(y,(g=Tt(g=re(c,"bias","fused matMul"),r)[0]).shape);var b={$a:x,$b:w};return null!=c&&(b.$bias=g),Zt.engine.runKernel(function(t,e){var n=t.fusedBatchMatMul(x,w,s,u,g,l);return e([x,w,n]),n},b,function(t,e){var n,r=e[0],o=e[1],i=e[2];if(null==l||"linear"===l)n=t;else{if("relu"!==l)throw new Error("Gradient for activation "+l+" has not been implemented yet.");n=t.mul(i.step())}var a={};return null!=c&&(a={$bias:function(){var t=n,e=yn(g.shape,n.shape);return 0-e,s=r[o]=n.inHeight))for(var b=x*e.strides[0],E=d+w*t.strides[1],C=0;C=n.inWidth))for(var k=b+R*e.strides[1],I=E+N*n.inChannels,T=k,A=0;A=n.inDepth))for(var _=E*e.strides[0],S=g+C*t.strides[1],R=0;R=n.inHeight))for(var A=_+I*e.strides[1],D=S+T*t.strides[2],M=0;M=n.inWidth))for(var B=A+F*e.strides[2],W=D+L*n.inChannels,z=B,U=0;U=n.inHeight))for(var E=w*e.strides[0],C=v+b*t.strides[1],_=0;_=n.inWidth))for(var I=E+N*e.strides[1],T=C+k*n.inChannels,A=S,D=I,M=0;M=r.outHeight||Math.floor(_)!==_))for(var S=0;S=r.outWidth||Math.floor(R)!==R)){var N=c*l-1-d.get(m,_,R,g)===C*l+S?1:0;0!==N&&(E+=v.get(m,_,R,g)*N)}}}f.set(E,m,y,x,g)}return f.toTensor()},t.prototype.avgPoolBackprop=function(t,e,n){this.assertNotComplex([t,e],"avgPoolBackprop");for(var r=n.strideHeight,o=n.strideWidth,i=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,c=n.effectiveFilterHeight,l=n.effectiveFilterWidth,h=l-1-n.padInfo.left,p=c-1-n.padInfo.top,f=zi(e.shape,"float32"),d=1/(i*a),v=t.bufferSync(),m=0;m=n.outHeight||Math.floor(_)!==_))for(var S=0;S=n.outWidth||Math.floor(R)!==R||(E+=v.get(m,_,R,g))}}f.set(E*d,m,y,x,g)}return f.toTensor()},t.prototype.cast=function(t,e){return an(t,e,this)},t.prototype.reshape=function(t,e){return sn(t,e)},t.prototype.avgPool=function(t,e){return this.assertNotComplex(t,"avgPool"),this.pool(t,e,"avg").toFloat()},t.prototype.resizeBilinear=function(t,e,n,r){this.assertNotComplex(t,"resizeBilinear");for(var o=t.shape,i=o[0],a=o[1],s=o[2],u=o[3],c=t.dataSync(),l=new Float32Array(B([i,e,n,u])),h=[r&&1 1 for depthToSpace, but was: "+e});for(var r=t.shape[0],o=t.shape[1],i=t.shape[2],a=t.shape[3],s=o*e,u=i*e,c=a/(e*e),l=t.dataSync(),h=new Float32Array(r*s*u*c),p=0,f=0;f=t.size/s)throw new Error("Invalid indices: "+f+" does not index into "+t.shape);for(var g=0;gn)}var jl=Object.freeze({WEBGL_ENVS:{HAS_WEBGL:!0},PACKED_ENVS:{WEBGL_PACK:!0},NODE_ENVS:{IS_NODE:!0},CHROME_ENVS:{IS_CHROME:!0},BROWSER_ENVS:{IS_BROWSER:!0},CPU_ENVS:{HAS_WEBGL:!1},ALL_ENVS:{},expectArraysClose:Vl,expectPromiseToFail:function(t,e){t().then(function(){return e.fail()},function(){return e()})},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return t instanceof dt&&"string"===t.dtype||e instanceof dt&&"string"===e.dtype||Array.isArray(t)&&V(t[0])||Array.isArray(e)&&V(e[0])?Hl(t,n,function(t,e){return t==e}):Vl(t,e,0)},expectNumbersClose:function(t,e,n){if(null==n&&(n=Zt.get("TEST_EPSILON")),!ql(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){var r;r=t instanceof dt?t.dataSync():t;for(var o=0;on)throw new Error("Value out of range:"+r[o]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}}),$l=Object.freeze({gpgpu_util:Do,webgl_util:co,MathBackendWebGL:va,GPGPUContext:Mo}),Kl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.minimize=function(t,e,n){void 0===e&&(e=!1);var r=this.computeGradients(t,n),o=r.value,i=r.grads;return this.applyGradients(i),Object.keys(i).forEach(function(t){return i[t].dispose()}),e?o:(o.dispose(),null)},e.prototype.computeGradients=function(t,e){return ie(t,e)},e.prototype.dispose=function(){},e}(Wl);Object.defineProperty(Kl,Symbol.hasInstance,{value:function(t){return null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}});var Xl=function(o){function t(t,e,n){void 0===n&&(n=null);var r=o.call(this)||this;return r.learningRate=t,r.rho=e,r.epsilon=n,r.accumulatedGrads={},r.accumulatedUpdates={},r.c=ce(Ve(-t)),r.rhoScalar=ce(Ve(e)),r.oneMinusRho=ce(Ve(1-e)),null===n&&(n=Zt.get("EPSILON")),r.epsilonScalar=ce(Ve(n)),r}return s(t,o),t.prototype.applyGradients=function(t){var c=this,e=function(o){var i=Zt.engine.registeredVariables[o];null==n.accumulatedGrads[o]&&ue(function(){c.accumulatedGrads[o]=nn(i).variable(!1)}),null==n.accumulatedUpdates[o]&&ue(function(){c.accumulatedUpdates[o]=nn(i).variable(!1)});var a=t[o],s=n.accumulatedGrads[o],u=n.accumulatedUpdates[o];ue(function(){var t=c.rhoScalar.mul(s).add(c.oneMinusRho.mul(a.square())),e=u.add(c.epsilonScalar).sqrt().div(s.add(c.epsilonScalar).sqrt()).mul(a),n=c.rhoScalar.mul(u).add(c.oneMinusRho.mul(e.square()));c.accumulatedGrads[o].assign(t),c.accumulatedUpdates[o].assign(n);var r=c.c.mul(e).add(i);i.assign(r)})},n=this;for(var r in t)e(r)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.rhoScalar.dispose(),this.oneMinusRho.dispose(),null!=this.accumulatedUpdates&&(Object.keys(this.accumulatedUpdates).forEach(function(t){return e.accumulatedUpdates[t].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},t.className="AdadeltaOptimizer",t}(Kl);Ul(Xl);var Yl=function(r){function t(t,e){void 0===e&&(e=.1);var n=r.call(this)||this;return n.learningRate=t,n.initialAccumulatorValue=e,n.accumulatedGrads={},n.c=ce(Ve(-t)),n.epsilon=ce(Ve(Zt.get("EPSILON"))),n}return s(t,r),t.prototype.applyGradients=function(t){var a=this,e=function(n){var r=Zt.engine.registeredVariables[n];null==s.accumulatedGrads[n]&&ue(function(){a.accumulatedGrads[n]=Je(r.shape,a.initialAccumulatorValue).variable(!1)});var o=t[n],i=s.accumulatedGrads[n];ue(function(){var t=i.add(o.square());a.accumulatedGrads[n].assign(t);var e=a.c.mul(o.div(t.add(a.epsilon).sqrt())).add(r);r.assign(e)})},s=this;for(var n in t)e(n)},t.prototype.dispose=function(){var e=this;this.epsilon.dispose(),this.c.dispose(),null!=this.accumulatedGrads&&Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},t.className="AdagradOptimizer",t}(Kl);Ul(Yl);var Ql=function(i){function t(t,e,n,r){void 0===r&&(r=null);var o=i.call(this)||this;return o.learningRate=t,o.beta1=e,o.beta2=n,o.epsilon=r,o.accumulatedFirstMoment={},o.accumulatedSecondMoment={},o.c=ce(Ve(-t)),o.beta1Scalar=ce(Ve(e)),o.beta2Scalar=ce(Ve(n)),ue(function(){o.accBeta1=Ve(e).variable(),o.accBeta2=Ve(n).variable()}),o.oneMinusBeta1=ce(Ve(1-e)),o.oneMinusBeta2=ce(Ve(1-n)),o.one=ce(Ve(1)),null===r&&(r=Zt.get("EPSILON")),o.epsScalar=ce(Ve(r)),o}return s(t,i),t.prototype.applyGradients=function(f){var d=this;ue(function(){var t=d.one.sub(d.accBeta1),e=d.one.sub(d.accBeta2);for(var n in f){var r=Zt.engine.registeredVariables[n];if(null==d.accumulatedFirstMoment[n]){var o=!1;d.accumulatedFirstMoment[n]=nn(r).variable(o)}null==d.accumulatedSecondMoment[n]&&(o=!1,d.accumulatedSecondMoment[n]=nn(r).variable(o));var i=f[n],a=d.accumulatedFirstMoment[n],s=d.accumulatedSecondMoment[n],u=d.beta1Scalar.mul(a).add(d.oneMinusBeta1.mul(i)),c=d.beta2Scalar.mul(s).add(d.oneMinusBeta2.mul(i.square())),l=u.div(t),h=c.div(e);d.accumulatedFirstMoment[n].assign(u),d.accumulatedSecondMoment[n].assign(c);var p=d.c.mul(l.div(d.epsScalar.add(h.sqrt()))).add(r);r.assign(p)}d.accBeta1.assign(d.accBeta1.mul(d.beta1Scalar)),d.accBeta2.assign(d.accBeta2.mul(d.beta2Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.accBeta1.dispose(),this.accBeta2.dispose(),this.oneMinusBeta1.dispose(),this.oneMinusBeta2.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedSecondMoment&&Object.keys(this.accumulatedSecondMoment).forEach(function(t){return e.accumulatedSecondMoment[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},t.className="AdamOptimizer",t}(Kl);Ul(Ql);var Jl=function(a){function t(t,e,n,r,o){void 0===r&&(r=null),void 0===o&&(o=0);var i=a.call(this)||this;return i.learningRate=t,i.beta1=e,i.beta2=n,i.epsilon=r,i.decay=o,i.accumulatedFirstMoment={},i.accumulatedWeightedInfNorm={},i.c=ce(Ve(-t)),i.beta1Scalar=ce(Ve(e)),i.beta2Scalar=ce(Ve(n)),i.decayScalar=ce(Ve(o)),ue(function(){i.iteration=Ve(0).variable(),i.accBeta1=Ve(e).variable()}),i.oneMinusBeta1=ce(Ve(1-e)),i.one=ce(Ve(1)),null===r&&(r=Zt.get("EPSILON")),i.epsScalar=ce(Ve(r)),i}return s(t,a),t.prototype.applyGradients=function(f){var d=this;ue(function(){var t=d.one.sub(d.accBeta1),e=d.c.div(d.one.add(d.decayScalar.mul(d.iteration)));for(var n in f){var r=Zt.engine.registeredVariables[n];if(null==d.accumulatedFirstMoment[n]){var o=!1;d.accumulatedFirstMoment[n]=nn(r).variable(o)}null==d.accumulatedWeightedInfNorm[n]&&(o=!1,d.accumulatedWeightedInfNorm[n]=nn(r).variable(o));var i=f[n],a=d.accumulatedFirstMoment[n],s=d.accumulatedWeightedInfNorm[n],u=d.beta1Scalar.mul(a).add(d.oneMinusBeta1.mul(i)),c=d.beta2Scalar.mul(s),l=i.abs(),h=c.maximum(l);d.accumulatedFirstMoment[n].assign(u),d.accumulatedWeightedInfNorm[n].assign(h);var p=e.div(t).mul(u.div(d.epsScalar.add(h))).add(r);r.assign(p)}d.iteration.assign(d.iteration.add(d.one)),d.accBeta1.assign(d.accBeta1.mul(d.beta1Scalar))})},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.accBeta1.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.oneMinusBeta1.dispose(),this.decayScalar.dispose(),this.iteration.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedWeightedInfNorm&&Object.keys(this.accumulatedWeightedInfNorm).forEach(function(t){return e.accumulatedWeightedInfNorm[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},t.className="AdamaxOptimizer",t}(Kl);Ul(Jl);var Zl=function(n){function t(t){var e=n.call(this)||this;return e.learningRate=t,e.setLearningRate(t),e}return s(t,n),t.prototype.applyGradients=function(r){var o=this;Object.keys(r).forEach(function(t){var e=r[t],n=Zt.engine.registeredVariables[t];ue(function(){var t=o.c.mul(e).add(n);n.assign(t)})})},t.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=ce(Ve(-t))},t.prototype.dispose=function(){this.c.dispose()},t.prototype.getConfig=function(){return{learningRate:this.learningRate}},t.fromConfig=function(t,e){return new t(e.learningRate)},t.className="SGDOptimizer",t}(Kl);Ul(Zl);var th=function(o){function t(t,e,n){void 0===n&&(n=!1);var r=o.call(this,t)||this;return r.learningRate=t,r.momentum=e,r.useNesterov=n,r.m=Ve(r.momentum),r.accumulations={},r}return s(t,o),t.prototype.applyGradients=function(t){var a=this,e=function(n){var r=Zt.engine.registeredVariables[n];null==s.accumulations[n]&&ue(function(){a.accumulations[n]=nn(r).variable(!1)});var o=s.accumulations[n],i=t[n];ue(function(){var t,e=a.m.mul(o).add(i);t=a.useNesterov?a.c.mul(i.add(e.mul(a.m))).add(r):a.c.mul(e).add(r),a.accumulations[n].assign(e),r.assign(t)})},s=this;for(var n in t)e(n)},t.prototype.dispose=function(){if(o.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose()},t.prototype.setMomentum=function(t){this.momentum=t},t.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},t.className="MomentumOptimizer",t}(Zl);Ul(th);var eh=function(a){function t(t,e,n,r,o){void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===o&&(o=!1);var i=a.call(this)||this;return i.learningRate=t,i.decay=e,i.momentum=n,i.epsilon=r,i.accumulatedMeanSquares={},i.accumulatedMeanGrads={},i.accumulatedMoments={},i.c=ce(Ve(t)),i.decayScalar=ce(Ve(e)),i.momentumScalar=ce(Ve(n)),i.oneMinusDecay=ce(Ve(1-e)),i.centered=o,null===r&&(r=Zt.get("EPSILON")),i.epsilonScalar=ce(Ve(r)),i}return s(t,a),t.prototype.applyGradients=function(t){var h=this,e=function(i){var a=Zt.engine.registeredVariables[i];null==n.accumulatedMeanSquares[i]&&ue(function(){h.accumulatedMeanSquares[i]=nn(a).variable(!1)}),null==n.accumulatedMeanGrads[i]&&n.centered&&ue(function(){h.accumulatedMeanGrads[i]=nn(a).variable(!1)}),null==n.accumulatedMoments[i]&&ue(function(){h.accumulatedMoments[i]=nn(a).variable(!1)});var s=n.accumulatedMeanSquares[i],u=n.accumulatedMeanGrads[i],c=n.accumulatedMoments[i],l=t[i];ue(function(){var t=h.decayScalar.mul(s).add(h.oneMinusDecay.mul(l.square()));if(h.centered){var e=h.decayScalar.mul(u).add(h.oneMinusDecay.mul(l)),n=h.momentumScalar.mul(c).add(h.c.mul(l).div(t.sub(e.square().add(h.epsilonScalar)).sqrt()));h.accumulatedMeanSquares[i].assign(t),h.accumulatedMeanGrads[i].assign(e),h.accumulatedMoments[i].assign(n);var r=a.sub(n);a.assign(r)}else{var o=h.decayScalar.mul(s).add(h.oneMinusDecay.mul(l.square()));n=h.momentumScalar.mul(c).add(h.c.mul(l).div(o.add(h.epsilonScalar).sqrt())),h.accumulatedMeanSquares[i].assign(o),h.accumulatedMoments[i].assign(n),r=a.sub(n),a.assign(r)}})},n=this;for(var r in t)e(r)},t.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.decayScalar.dispose(),this.momentumScalar.dispose(),this.oneMinusDecay.dispose(),null!=this.accumulatedMeanSquares&&Object.keys(this.accumulatedMeanSquares).forEach(function(t){return e.accumulatedMeanSquares[t].dispose()}),null!=this.accumulatedMeanGrads&&this.centered&&Object.keys(this.accumulatedMeanGrads).forEach(function(t){return e.accumulatedMeanGrads[t].dispose()}),null!=this.accumulatedMoments&&Object.keys(this.accumulatedMoments).forEach(function(t){return e.accumulatedMoments[t].dispose()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},t.className="RMSPropOptimizer",t}(Kl);Ul(eh);var nh=function(){function t(){}return t.sgd=function(t){return new Zl(t)},t.momentum=function(t,e,n){return void 0===n&&(n=!1),new th(t,e,n)},t.rmsprop=function(t,e,n,r,o){return void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===o&&(o=!1),new eh(t,e,n,r,o)},t.adam=function(t,e,n,r){return void 0===t&&(t=.001),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new Ql(t,e,n,r)},t.adadelta=function(t,e,n){return void 0===t&&(t=.001),void 0===e&&(e=.95),void 0===n&&(n=null),new Xl(t,e,n)},t.adamax=function(t,e,n,r,o){return void 0===t&&(t=.002),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===o&&(o=0),new Jl(t,e,n,r,o)},t.adagrad=function(t,e){return void 0===e&&(e=.1),new Yl(t,e)},t}(),rh={sgd:nh.sgd,momentum:nh.momentum,adadelta:nh.adadelta,adagrad:nh.adagrad,rmsprop:nh.rmsprop,adamax:nh.adamax,adam:nh.adam},oh=jt.setBackend,ih=jt.getBackend,ah=jt.disposeVariables,sh=jt.memory;pt=Gc;var uh=Object.freeze({setBackend:oh,getBackend:ih,disposeVariables:ah,memory:sh,version_core:"1.0.3",nextFrame:function(){return new Promise(function(t){return Hc(function(){return t()})})},enableProdMode:Kt,enableDebugMode:Xt,disableDeprecationWarnings:Yt,deprecationWarn:Qt,browser:Bl,environment:te,io:Ol,math:Fl,serialization:Gl,test_util:jl,util:t,webgl:$l,tensor_util:Pt,AdadeltaOptimizer:Xl,AdagradOptimizer:Yl,AdamOptimizer:Ql,AdamaxOptimizer:Jl,MomentumOptimizer:th,Optimizer:Kl,RMSPropOptimizer:eh,SGDOptimizer:Zl,Tensor:dt,TensorBuffer:lt,variable:Rt,Variable:vt,get Rank(){return mt},get Reduction(){return mc},ENV:Zt,Environment:jt,KernelBackend:on,DataStorage:rn,image:Wc,linalg:Dc,losses:kc,spectral:dc,fused:Uc,op:Fe,batchNormalization2d:os,batchNormalization3d:is,batchNormalization4d:as,batchNormalization:ss,batchNorm:us,batchNorm2d:cs,batchNorm3d:ls,batchNorm4d:hs,complex:We,real:ze,imag:Ue,concat:_i,concat1d:Si,concat2d:Ri,concat3d:Ni,concat4d:ki,split:Ii,conv1d:_s,conv2d:Ss,conv3d:Rs,conv2dDerFilter:Ns,depthwiseConv2d:ks,separableConv2d:Is,conv2dTranspose:Ts,matMul:As,dot:Ds,outerProduct:Ms,reverse:Os,reverse1d:Ps,reverse2d:Fs,reverse3d:Ls,reverse4d:Bs,maxPool:Us,avgPool:Gs,pool:Vs,slice:Hs,slice1d:qs,slice2d:js,slice3d:$s,slice4d:Ks,abs:ga,acos:ya,acosh:xa,asin:wa,asinh:ba,atan:Ea,atanh:Ca,ceil:_a,clipByValue:Sa,cos:Ra,cosh:Na,erf:ka,exp:Ia,expm1:Ta,floor:Aa,log:Da,log1p:Ma,logSigmoid:Oa,neg:Pa,reciprocal:Fa,round:La,rsqrt:Ba,sigmoid:Wa,sign:za,isNaN:Ua,isInf:Ga,isFinite:Va,sin:Ha,sinh:qa,softplus:ja,sqrt:$a,square:Ka,step:Xa,tan:Ya,tanh:Qa,all:Ys,any:Qs,argMax:Js,argMin:Zs,logSumExp:tu,max:eu,mean:nu,min:ru,moments:ou,sum:iu,prod:au,equal:su,equalStrict:uu,greater:cu,greaterEqual:lu,greaterEqualStrict:hu,greaterStrict:pu,less:fu,lessEqual:du,lessEqualStrict:vu,lessStrict:mu,notEqual:gu,notEqualStrict:yu,add:xu,addN:wu,addStrict:bu,atan2:Eu,div:Cu,divStrict:_u,floorDiv:Su,maximum:Ru,maximumStrict:Nu,minimum:ku,minimumStrict:Iu,mod:Tu,modStrict:Au,mul:Du,mulStrict:Mu,pow:Ou,powStrict:Pu,squaredDifference:Fu,squaredDifferenceStrict:Lu,sub:Bu,subStrict:Wu,elu:ju,leakyRelu:$u,prelu:Ku,relu:Xu,selu:Yu,logicalAnd:zu,logicalNot:Uu,logicalOr:Gu,logicalXor:Vu,where:Hu,whereAsync:qu,buffer:zi,print:Ui,batchToSpaceND:Gi,cast:Vi,clone:Hi,cumsum:qi,depthToSpace:ji,expandDims:$i,eye:Ki,multinomial:Xi,oneHot:Yi,pad:Qi,pad1d:Ji,pad2d:Zi,pad3d:ta,pad4d:ea,rand:na,randomNormal:ra,randomUniform:oa,reshape:ia,spaceToBatchND:aa,squeeze:sa,stack:ua,tile:ca,truncatedNormal:la,unstack:ha,setdiff1dAsync:pa,fill:Je,linspace:Ze,ones:Ye,range:tn,scalar:Ve,tensor:Ge,tensor1d:He,tensor2d:qe,tensor3d:je,tensor4d:$e,tensor5d:Ke,tensor6d:Xe,zeros:Qe,onesLike:en,zerosLike:nn,transpose:Qu,softmax:Le,logSoftmax:Be,localResponseNormalization:Ju,norm:Zu,gather:nc,unsortedSegmentSum:rc,basicLSTMCell:oc,multiRNNCell:ic,movingAverage:ac,stridedSlice:sc,topk:uc,scatterND:cc,fft:lc,ifft:hc,rfft:pc,irfft:fc,sparseToDense:vc,gatherND:yc,train:rh,tidy:ue,keep:ce,dispose:le,time:he,profile:pe,customGrad:ae,grad:function(i){return D(j(i),function(){return"The f passed in grad(f) must be a function"}),function(t,e){var r=re(t,"x","tf.grad",null),o=null!=e?re(e,"dy","tf.grad"):null;return Zt.engine.tidy(function(){var t=Zt.engine.gradients(function(){return i(r)},[r],o),e=t.value,n=t.grads;return null!=o&&g(e.shape,o.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),se(n),n[0]})}},grads:function(i){return D(j(i),function(){return"The f passed in grads(f) must be a function"}),function(t,e){D(Array.isArray(t),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var r=oe(t,"args","tf.grads",null),o=null!=e?re(e,"dy","tf.grads"):null;return Zt.engine.tidy(function(){var t=Zt.engine.gradients(function(){return i.apply(void 0,r)},r,o),e=t.value,n=t.grads;return null!=o&&g(e.shape,o.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),se(n),n})}},valueAndGrad:function(i){return D(j(i),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(t,e){D(t instanceof dt,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),D(null==e||e instanceof dt,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var n=Zt.engine.gradients(function(){return i(t)},[t],e),r=n.grads,o=n.value;return se(r),{grad:r[0],value:o}}},valueAndGrads:function(r){return D(j(r),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(t,e){D(Array.isArray(t)&&t.every(function(t){return t instanceof dt}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),D(null==e||e instanceof dt,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var n=Zt.engine.gradients(function(){return r.apply(void 0,t)},t,e);return null!=e&&g(n.value.shape,e.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),se(n.grads),n}},variableGrads:ie}),ch=function(){function t(t,e){if(!Eh(t)||!Eh(e))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:t,height:e}));this._width=t,this._height=e}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),t.prototype.reverse=function(){return new t(1/this.width,1/this.height)},t}(),lh=function(){function e(t,e){this._x=t,this._y=e}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.sub=function(t){return new e(this.x-t.x,this.y-t.y)},e.prototype.mul=function(t){return new e(this.x*t.x,this.y*t.y)},e.prototype.div=function(t){return new e(this.x/t.x,this.y/t.y)},e.prototype.abs=function(){return new e(Math.abs(this.x),Math.abs(this.y))},e.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y))},e}();function hh(t,e){return t instanceof dt&&t.shape.length===e}function ph(t){return hh(t,2)}function fh(t){return hh(t,3)}function dh(t){return hh(t,4)}function vh(t){return t%1!=0}function mh(t){return t%2==0}function gh(t,e){void 0===e&&(e=2);var n=Math.pow(10,e);return Math.floor(t*n)/n}function yh(t){return t&&t.width&&t.height}function xh(t,e){var n=t.width,r=t.height,o=e/Math.max(r,n);return new ch(Math.round(n*o),Math.round(r*o))}function wh(t){return t.reduce(function(t,e){return t.add(e)},new lh(0,0)).div(new lh(t.length,t.length))}function bh(t,n,r){return Array(t).fill(0).map(function(t,e){return n+e*r})}function Eh(t){return!!t&&t!==1/0&&t!==-1/0&&!isNaN(t)||0===t}function Ch(t){return Eh(t)&&0<=t&&t<=1}var _h,Sh=function(){function l(t,e){void 0===e&&(e=!0);var n=t||{},r=[n.left,n.top,n.right,n.bottom].every(Eh),o=[n.x,n.y,n.width,n.height].every(Eh);if(!o&&!r)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(n));var i=o?[n.x,n.y,n.width,n.height]:[n.left,n.top,n.right-n.left,n.bottom-n.top],a=i[0],s=i[1],u=i[2],c=i[3];l.assertIsValidBox({x:a,y:s,width:u,height:c},"Box.constructor",e),this._x=a,this._y=s,this._width=u,this._height=c}return l.isRect=function(t){return!!t&&[t.x,t.y,t.width,t.height].every(Eh)},l.assertIsValidBox=function(t,e,n){if(void 0===n&&(n=!1),!l.isRect(t))throw new Error(e+" - invalid box: "+JSON.stringify(t)+", expected object with properties x, y, width, height");if(!n&&(t.width<0||t.height<0))throw new Error(e+" - width ("+t.width+") and height ("+t.height+") must be positive numbers")},Object.defineProperty(l.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"topLeft",{get:function(){return new lh(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"topRight",{get:function(){return new lh(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"bottomLeft",{get:function(){return new lh(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"bottomRight",{get:function(){return new lh(this.right,this.bottom)},enumerable:!0,configurable:!0}),l.prototype.round=function(){var t=[this.x,this.y,this.width,this.height].map(function(t){return Math.round(t)});return new l({x:t[0],y:t[1],width:t[2],height:t[3]})},l.prototype.floor=function(){var t=[this.x,this.y,this.width,this.height].map(function(t){return Math.floor(t)});return new l({x:t[0],y:t[1],width:t[2],height:t[3]})},l.prototype.toSquare=function(){var t=this.x,e=this.y,n=this.width,r=this.height,o=Math.abs(n-r);return ne.classScore?t:e})]}})})},r.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],r}(xp),Pp=Object.freeze({convLayer:Kh,disposeUnusedWeightTensors:Xh,extractConvParamsFactory:Yh,extractFCParamsFactory:Qh,extractSeparableConvParamsFactory:Zh,loadSeparableConvParamsFactory:tp,extractWeightEntryFactory:ep,extractWeightsFactory:np,getModelUris:rp,SeparableConvParams:Jh,TinyYolov2:Op,get TinyYolov2SizeType(){return _p},TinyYolov2Options:Mp,validateConfig:Np});function Fp(i,a,t){if(void 0===t&&(t=!1),i.beginPath(),a.slice(1).forEach(function(t,e){var n=t.x,r=t.y,o=a[e];i.moveTo(o.x,o.y),i.lineTo(n,r)}),t){var e=a[a.length-1],n=a[0];if(!e||!n)return;i.moveTo(e.x,e.y),i.lineTo(n.x,n.y)}i.stroke()}var Lp=function(r){function o(t,e,n){return r.call(this,t,t,"",e,n)||this}return a(o,r),o.prototype.forSize=function(t,e){var n=r.prototype.forSize.call(this,t,e);return new o(n.score,n.relativeBox,n.imageDims)},o}(kh);function Bp(t){return t.detection instanceof Lp}function Wp(t,e){var n={detection:e};return Object.assign({},t,n)}function zp(e,n,r){return ue(function(){var t=Is(e,n.depthwise_filter,n.pointwise_filter,r,"same");return t=xu(t,n.bias)})}function Up(r,o,i){return void 0===i&&(i=!1),ue(function(){var t=Xu(i?xu(Ss(r,o.conv0.filters,[2,2],"same"),o.conv0.bias):zp(r,o.conv0,[2,2])),e=zp(t,o.conv1,[1,1]),n=zp(Xu(xu(t,e)),o.conv2,[1,1]);return Xu(xu(t,xu(e,n)))})}function Gp(o,i,a,s){return void 0===a&&(a=!1),void 0===s&&(s=!0),ue(function(){var t=Xu(a?xu(Ss(o,i.conv0.filters,s?[2,2]:[1,1],"same"),i.conv0.bias):zp(o,i.conv0,s?[2,2]:[1,1])),e=zp(t,i.conv1,[1,1]),n=zp(Xu(xu(t,e)),i.conv2,[1,1]),r=zp(Xu(xu(t,xu(e,n))),i.conv3,[1,1]);return Xu(xu(t,xu(e,xu(n,r))))})}function Vp(t,e){var o=Yh(t,e),i=Zh(t,e);function a(t,e,n,r){return void 0===r&&(r=!1),{conv0:r?o(t,e,3,n+"/conv0"):i(t,e,n+"/conv0"),conv1:i(e,e,n+"/conv1"),conv2:i(e,e,n+"/conv2")}}return{extractDenseBlock3Params:a,extractDenseBlock4Params:function(t,e,n,r){void 0===r&&(r=!1);var o=a(t,e,n,r);return{conv0:o.conv0,conv1:o.conv1,conv2:o.conv2,conv3:i(e,e,n+"/conv3")}}}}function Hp(e){return function(t){return{filters:e(t+"/filters",4),bias:e(t+"/bias",1)}}}function qp(t,e){var n=ep(t,e),r=Hp(n),o=tp(n);return{extractDenseBlock3Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2")}},extractDenseBlock4Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2"),conv3:o(t+"/conv3")}}}}var jp=function(t){function e(){return t.call(this,"FaceFeatureExtractor")||this}return a(e,t),e.prototype.forwardInput=function(e){var n=this.params;if(!n)throw new Error("FaceFeatureExtractor - load model before inference");return ue(function(){var t=Gp(Ep(e.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(Ve(255)),n.dense0,!0);return t=Gp(t=Gp(t=Gp(t,n.dense1),n.dense2),n.dense3),t=Gs(t,[7,7],[2,2],"valid")})},e.prototype.forward=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},e.prototype.extractParamsFromWeigthMap=function(t){return r=qp(e=t,n=[]).extractDenseBlock4Params,o={dense0:r("dense0",!0),dense1:r("dense1"),dense2:r("dense2"),dense3:r("dense3")},Xh(e,n),{params:o,paramMappings:n};var e,n,r,o},e.prototype.extractParams=function(t){return function(t){var e=[],n=np(t),r=n.extractWeights,o=n.getRemainingWeights,i=Vp(r,e).extractDenseBlock4Params,a=i(3,32,"dense0",!0),s=i(32,64,"dense1"),u=i(64,128,"dense2"),c=i(128,256,"dense3");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{dense0:a,dense1:s,dense2:u,dense3:c}}}(t)},e}(xp);function $p(t,e){return ue(function(){return xu(As(t,e.weights),e.bias)})}function Kp(e){var n={},r={};return Object.keys(e).forEach(function(t){(t.startsWith("fc")?r:n)[t]=e[t]}),{featureExtractorMap:n,classifierMap:r}}var Xp=function(r){function t(t,e){var n=r.call(this,t)||this;return n._faceFeatureExtractor=e,n}return a(t,r),Object.defineProperty(t.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),t.prototype.runNet=function(e){var n=this,r=this.params;if(!r)throw new Error(this._name+" - load model before inference");return ue(function(){var t=e instanceof gp?n.faceFeatureExtractor.forwardInput(e):e;return $p(t.as2D(t.shape[0],-1),r.fc)})},t.prototype.dispose=function(t){void 0===t&&(t=!0),this.faceFeatureExtractor.dispose(t),r.prototype.dispose.call(this,t)},t.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,r=e.paramMappings;this._params=n,this._paramMappings=r},t.prototype.extractClassifierParams=function(t){return function(t,e,n){var r=[],o=np(t),i=o.extractWeights,a=o.getRemainingWeights,s=Qh(i,r)(e,n,"fc");if(0!==a().length)throw new Error("weights remaing after extract: "+a().length);return{paramMappings:r,params:{fc:s}}}(t,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},t.prototype.extractParamsFromWeigthMap=function(t){var e,n,r,o,i,a=Kp(t),s=a.featureExtractorMap,u=a.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(s),o=ep(e=u,r=[]),i={fc:(n="fc",{weights:o(n+"/weights",2),bias:o(n+"/bias",1)})},Xh(e,r),{params:i,paramMappings:r}},t.prototype.extractParams=function(t){var e=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),r=n*e+n,o=t.slice(0,t.length-r),i=t.slice(t.length-r);return this.faceFeatureExtractor.extractWeights(o),this.extractClassifierParams(i)},t}(xp),Yp=["neutral","happy","sad","angry","fearful","disgusted","surprised"],Qp=function(){function t(n){var r=this;if(7!==n.length)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+n.length);Yp.forEach(function(t,e){r[t]=n[e]})}return t.prototype.asSortedArray=function(){var e=this;return Yp.map(function(t){return{expression:t,probability:e[t]}}).sort(function(t,e){return e.probability-t.probability})},t}(),Jp=function(e){function t(t){return void 0===t&&(t=new jp),e.call(this,"FaceExpressionNet",t)||this}return a(t,e),t.prototype.forwardInput=function(t){var e=this;return ue(function(){return Le(e.runNet(t))})},t.prototype.forward=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent()])]}})})},t.prototype.predictExpressions=function(a){return p(this,void 0,void 0,function(){var e,n,r,o,i=this;return P(this,function(t){switch(t.label){case 0:return[4,yp(a)];case 1:return e=t.sent(),[4,this.forwardInput(e)];case 2:return n=t.sent(),[4,Promise.all(ha(n).map(function(n){return p(i,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,n.data()];case 1:return e=t.sent(),n.dispose(),[2,e]}})})}))];case 3:return r=t.sent(),n.dispose(),o=r.map(function(t){return new Qp(t)}),[2,e.isBatchInput?o:o[0]]}})})},t.prototype.getDefaultModelName=function(){return"face_expression_model"},t.prototype.getClassifierChannelsIn=function(){return 256},t.prototype.getClassifierChannelsOut=function(){return 7},t}(Xp);function Zp(t){return t.expressions instanceof Qp}function tf(t,e){var n={expressions:e};return Object.assign({},t,n)}var ef=function(){function t(t,e,n){void 0===n&&(n=new lh(0,0));var r=e.width,o=e.height;this._imgDims=new ch(r,o),this._shift=n,this._positions=t.map(function(t){return t.mul(new lh(r,o)).add(n)})}return Object.defineProperty(t.prototype,"shift",{get:function(){return new lh(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativePositions",{get:function(){var e=this;return this._positions.map(function(t){return t.sub(e._shift).div(new lh(e.imageWidth,e.imageHeight))})},enumerable:!0,configurable:!0}),t.prototype.forSize=function(t,e){return new this.constructor(this.relativePositions,{width:t,height:e})},t.prototype.shiftBy=function(t,e){return new this.constructor(this.relativePositions,this._imgDims,new lh(t,e))},t.prototype.shiftByPoint=function(t){return this.shiftBy(t.x,t.y)},t.prototype.align=function(t,e){if(void 0===e&&(e={}),t){var n=t instanceof Lp?t.box.floor():new Sh(t);return this.shiftBy(n.x,n.y).align(null,e)}var r=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},e),o=r.useDlibAlignment,i=r.minBoxPadding;return o?this.alignDlib():this.alignMinBbox(i)},t.prototype.alignDlib=function(){var t=this.getRefPointsForAlignment(),e=t[0],n=t[1],r=t[2],o=function(t){return r.sub(t).magnitude()},i=(o(e)+o(n))/2,a=Math.floor(i/.45),s=wh(t),u=Math.floor(Math.max(0,s.x-.5*a)),c=Math.floor(Math.max(0,s.y-.43*a));return new Th(u,c,Math.min(a,this.imageWidth+u),Math.min(a,this.imageHeight+c))},t.prototype.alignMinBbox=function(t){var e,n,r,o,i,a,s,u=(e=this.positions,n=e.map(function(t){return t.x}),r=e.map(function(t){return t.y}),o=n.reduce(function(t,e){return e or array thereof");var n=e.asSortedArray().filter(function(t){return t.probability>i}),r=Bp(t)?t.detection.box.bottomLeft:a||new lh(0,0);new Hh(n.map(function(t){return t.expression+" ("+gh(t.probability)+")"}),r).draw(o)})},DrawFaceLandmarksOptions:af,DrawFaceLandmarks:sf,drawFaceLandmarks:function(n,t){(Array.isArray(t)?t:[t]).forEach(function(t){var e=t instanceof ef?t:rf(t)?t.landmarks:void 0;if(!e)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks> or array thereof");new sf(e).draw(n)})}});function cf(t,e){var n,r,o,i,a=[],s=np(t),u=s.extractWeights,c=s.getRemainingWeights,l=(o=Yh(n=u,r=a),i=Zh(n,r),{extractConvParams:o,extractSeparableConvParams:i,extractReductionBlockParams:function(t,e,n){return{separable_conv0:i(t,e,n+"/separable_conv0"),separable_conv1:i(e,e,n+"/separable_conv1"),expansion_conv:o(t,e,1,n+"/expansion_conv")}},extractMainBlockParams:function(t,e){return{separable_conv0:i(t,t,e+"/separable_conv0"),separable_conv1:i(t,t,e+"/separable_conv1"),separable_conv2:i(t,t,e+"/separable_conv2")}}}),h=l.extractSeparableConvParams,p=l.extractReductionBlockParams,f=l.extractMainBlockParams,d={conv_in:(0,l.extractConvParams)(3,32,3,"entry_flow/conv_in"),reduction_block_0:p(32,64,"entry_flow/reduction_block_0"),reduction_block_1:p(64,128,"entry_flow/reduction_block_1")},v={};bh(e,0,1).forEach(function(t){v["main_block_"+t]=f(128,"middle_flow/main_block_"+t)});var m={reduction_block:p(128,256,"exit_flow/reduction_block"),separable_conv:h(256,512,"exit_flow/separable_conv")};if(0!==c().length)throw new Error("weights remaing after extract: "+c().length);return{paramMappings:a,params:{entry_flow:d,middle_flow:v,exit_flow:m}}}function lf(t,e){var n,r,o,i=[],a=(n=ep(t,i),r=Hp(n),o=tp(n),{extractConvParams:r,extractSeparableConvParams:o,extractReductionBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),expansion_conv:r(t+"/expansion_conv")}},extractMainBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),separable_conv2:o(t+"/separable_conv2")}}}),s=a.extractSeparableConvParams,u=a.extractReductionBlockParams,c=a.extractMainBlockParams,l={conv_in:(0,a.extractConvParams)("entry_flow/conv_in"),reduction_block_0:u("entry_flow/reduction_block_0"),reduction_block_1:u("entry_flow/reduction_block_1")},h={};bh(e,0,1).forEach(function(t){h["main_block_"+t]=c("middle_flow/main_block_"+t)});var p={reduction_block:u("exit_flow/reduction_block"),separable_conv:s("exit_flow/separable_conv")};return Xh(t,i),{params:{entry_flow:l,middle_flow:h,exit_flow:p},paramMappings:i}}function hf(t,e,n){return xu(Ss(t,e.filters,n,"same"),e.bias)}function pf(t,e,n){void 0===n&&(n=!0);var r=n?Xu(t):t;return r=zp(r,e.separable_conv0,[1,1]),r=zp(Xu(r),e.separable_conv1,[1,1]),r=Us(r,[3,3],[2,2],"same"),r=xu(r,hf(t,e.expansion_conv,[2,2]))}var ff,df=function(n){function t(t){var e=n.call(this,"TinyXception")||this;return e._numMainBlocks=t,e}return a(t,n),t.prototype.forwardInput=function(e){var n=this,i=this.params;if(!i)throw new Error("TinyXception - load model before inference");return ue(function(){var t=Ep(e.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(Ve(256)),o=Xu(hf(t,i.entry_flow.conv_in,[2,2]));return o=pf(o=pf(o,i.entry_flow.reduction_block_0,!1),i.entry_flow.reduction_block_1),bh(n._numMainBlocks,0,1).forEach(function(t){var e,n,r;e=o,n=i.middle_flow["main_block_"+t],r=zp(Xu(e),n.separable_conv0,[1,1]),r=zp(Xu(r),n.separable_conv1,[1,1]),r=zp(Xu(r),n.separable_conv2,[1,1]),o=r=xu(r,e)}),o=pf(o,i.exit_flow.reduction_block),o=Xu(zp(o,i.exit_flow.separable_conv,[1,1]))})},t.prototype.forward=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent()])]}})})},t.prototype.getDefaultModelName=function(){return"tiny_xception_model"},t.prototype.extractParamsFromWeigthMap=function(t){return lf(t,this._numMainBlocks)},t.prototype.extractParams=function(t){return cf(t,this._numMainBlocks)},t}(xp);(ff=c.Gender||(c.Gender={})).FEMALE="female",ff.MALE="male";var vf=function(n){function t(t){void 0===t&&(t=new df(2));var e=n.call(this,"AgeGenderNet")||this;return e._faceFeatureExtractor=t,e}return a(t,n),Object.defineProperty(t.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),t.prototype.runNet=function(n){var r=this,o=this.params;if(!o)throw new Error(this._name+" - load model before inference");return ue(function(){var t=n instanceof gp?r.faceFeatureExtractor.forwardInput(n):n,e=Gs(t,[7,7],[2,2],"valid").as2D(t.shape[0],-1);return{age:$p(e,o.fc.age).as1D(),gender:$p(e,o.fc.gender)}})},t.prototype.forwardInput=function(r){var o=this;return ue(function(){var t=o.runNet(r),e=t.age,n=t.gender;return{age:e,gender:Le(n)}})},t.prototype.forward=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent()])]}})})},t.prototype.predictAgeAndGender=function(s){return p(this,void 0,void 0,function(){var e,n,r,o,i,a,u=this;return P(this,function(t){switch(t.label){case 0:return[4,yp(s)];case 1:return e=t.sent(),[4,this.forwardInput(e)];case 2:return n=t.sent(),r=ha(n.age),o=ha(n.gender),i=r.map(function(t,e){return{ageTensor:t,genderTensor:o[e]}}),[4,Promise.all(i.map(function(t){var a=t.ageTensor,s=t.genderTensor;return p(u,void 0,void 0,function(){var e,n,r,o,i;return P(this,function(t){switch(t.label){case 0:return[4,a.data()];case 1:return e=t.sent()[0],[4,s.data()];case 2:return n=t.sent()[0],o=(r=.5 1 not supported");return(o=r.getInput(0))instanceof e?(i=o,[3,4]):[3,2];case 2:return[4,pp(o)];case 3:i=t.sent(),t.label=4;case 4:n=i,t.label=5;case 5:return a=Gh(n),[2,u.map(function(t){return t instanceof Lp?t.forSize(n.width,n.height).box.floor():t}).map(function(t){return t.clipAtImageBorders(n.width,n.height)}).map(function(t){var e=t.x,n=t.y,r=t.width,o=t.height,i=up({width:r,height:o});return Gh(i).putImageData(a.getImageData(e,n,r,o),0,0),i})]}})})}function wf(u,e){return p(this,void 0,void 0,function(){return P(this,function(t){if(!fh(u)&&!dh(u))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(dh(u)&&1 1 not supported");return[2,ue(function(){var t=u.shape.slice(dh(u)?1:0),i=t[0],a=t[1],s=t[2];return e.map(function(t){return t instanceof Lp?t.forSize(a,i).box:t}).map(function(t){return t.clipAtImageBorders(a,i)}).map(function(t){var e=t.x,n=t.y,r=t.width,o=t.height;return $s(u.as3D(i,a,s),[n,e,0],[o,r,s])})})]})})}var bf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.postProcess=function(t,o,e){var i=e.map(function(t){var e=t.width,n=t.height,r=o/Math.max(n,e);return{width:e*r,height:n*r}}),a=i.length;return ue(function(){var n=function(t,e){return ua([Je([68],t),Je([68],e)],1).as2D(1,136).as1D()},r=function(t,e){var n=i[t],r=n.width,o=n.height;return e(r,o)?Math.abs(r-o)/2:0};return t.mul(Je([a,136],o)).sub(ua(Array.from(Array(a),function(t,e){return n(r(e,function(t,e){return t 0");if("number"!=typeof this._scaleFactor||this._scaleFactor<=0||1<=this._scaleFactor)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if("number"!=typeof this._maxNumScales||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||3!==this._scoreThresholds.length||this._scoreThresholds.some(function(t){return"number"!=typeof t}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(t){return"number"!=typeof t})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(t.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),t}();function Ff(l,h){function i(t,e,n,r,o){var i=$e(l(t*e*n*n),[n,n,t,e]),a=He(l(e));return h.push({paramPath:r+"/filters"},{paramPath:r+"/"+(o?"batch_norm_offset":"bias")}),{filters:i,bias:a}}function p(t,e,n,r){var o=i(t,e,n,r,!0);return{filters:o.filters,batch_norm_offset:o.bias}}function t(t,e,n){var r,o,i,a,s,u,c;return{depthwise_conv:(o=n+"/depthwise_conv",i=$e(l(9*(r=t)),[3,3,r,1]),a=He(l(r)),s=He(l(r)),u=He(l(r)),c=He(l(r)),h.push({paramPath:o+"/filters"},{paramPath:o+"/batch_norm_scale"},{paramPath:o+"/batch_norm_offset"},{paramPath:o+"/batch_norm_mean"},{paramPath:o+"/batch_norm_variance"}),{filters:i,batch_norm_scale:a,batch_norm_offset:s,batch_norm_mean:u,batch_norm_variance:c}),pointwise_conv:p(t,e,1,n+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:p(3,32,3,"mobilenetv1/conv_0"),conv_1:t(32,64,"mobilenetv1/conv_1"),conv_2:t(64,128,"mobilenetv1/conv_2"),conv_3:t(128,128,"mobilenetv1/conv_3"),conv_4:t(128,256,"mobilenetv1/conv_4"),conv_5:t(256,256,"mobilenetv1/conv_5"),conv_6:t(256,512,"mobilenetv1/conv_6"),conv_7:t(512,512,"mobilenetv1/conv_7"),conv_8:t(512,512,"mobilenetv1/conv_8"),conv_9:t(512,512,"mobilenetv1/conv_9"),conv_10:t(512,512,"mobilenetv1/conv_10"),conv_11:t(512,512,"mobilenetv1/conv_11"),conv_12:t(512,1024,"mobilenetv1/conv_12"),conv_13:t(1024,1024,"mobilenetv1/conv_13")}},extractPredictionLayerParams:function(){return{conv_0:p(1024,256,1,"prediction_layer/conv_0"),conv_1:p(256,512,3,"prediction_layer/conv_1"),conv_2:p(512,128,1,"prediction_layer/conv_2"),conv_3:p(128,256,3,"prediction_layer/conv_3"),conv_4:p(256,128,1,"prediction_layer/conv_4"),conv_5:p(128,256,3,"prediction_layer/conv_5"),conv_6:p(256,64,1,"prediction_layer/conv_6"),conv_7:p(64,128,3,"prediction_layer/conv_7"),box_predictor_0:{box_encoding_predictor:i(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),class_predictor:i(512,9,1,"prediction_layer/box_predictor_0/class_predictor")},box_predictor_1:{box_encoding_predictor:i(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),class_predictor:i(1024,18,1,"prediction_layer/box_predictor_1/class_predictor")},box_predictor_2:{box_encoding_predictor:i(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),class_predictor:i(512,18,1,"prediction_layer/box_predictor_2/class_predictor")},box_predictor_3:{box_encoding_predictor:i(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),class_predictor:i(256,18,1,"prediction_layer/box_predictor_3/class_predictor")},box_predictor_4:{box_encoding_predictor:i(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),class_predictor:i(256,18,1,"prediction_layer/box_predictor_4/class_predictor")},box_predictor_5:{box_encoding_predictor:i(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),class_predictor:i(128,18,1,"prediction_layer/box_predictor_5/class_predictor")}}}}}function Lf(t){var e=[],n=function(t,e){var i=ep(t,e);function a(t,e,n){return{filters:i(t+"/Conv2d_"+e+"_pointwise/weights",4,n+"/filters"),batch_norm_offset:i(t+"/Conv2d_"+e+"_pointwise/convolution_bn_offset",1,n+"/batch_norm_offset")}}function n(t){var e="mobilenetv1/conv_"+t,n="MobilenetV1/Conv2d_"+t+"_depthwise",r=e+"/depthwise_conv",o=e+"/pointwise_conv";return{depthwise_conv:{filters:i(n+"/depthwise_weights",4,r+"/filters"),batch_norm_scale:i(n+"/BatchNorm/gamma",1,r+"/batch_norm_scale"),batch_norm_offset:i(n+"/BatchNorm/beta",1,r+"/batch_norm_offset"),batch_norm_mean:i(n+"/BatchNorm/moving_mean",1,r+"/batch_norm_mean"),batch_norm_variance:i(n+"/BatchNorm/moving_variance",1,r+"/batch_norm_variance")},pointwise_conv:a("MobilenetV1",t,o)}}function r(t,e){return{filters:i(t+"/weights",4,e+"/filters"),bias:i(t+"/biases",1,e+"/bias")}}function o(t){return{box_encoding_predictor:r("Prediction/BoxPredictor_"+t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+t+"/box_encoding_predictor"),class_predictor:r("Prediction/BoxPredictor_"+t+"/ClassPredictor","prediction_layer/box_predictor_"+t+"/class_predictor")}}return{extractMobilenetV1Params:function(){return{conv_0:a("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:n(1),conv_2:n(2),conv_3:n(3),conv_4:n(4),conv_5:n(5),conv_6:n(6),conv_7:n(7),conv_8:n(8),conv_9:n(9),conv_10:n(10),conv_11:n(11),conv_12:n(12),conv_13:n(13)}},extractPredictionLayerParams:function(){return{conv_0:a("Prediction",0,"prediction_layer/conv_0"),conv_1:a("Prediction",1,"prediction_layer/conv_1"),conv_2:a("Prediction",2,"prediction_layer/conv_2"),conv_3:a("Prediction",3,"prediction_layer/conv_3"),conv_4:a("Prediction",4,"prediction_layer/conv_4"),conv_5:a("Prediction",5,"prediction_layer/conv_5"),conv_6:a("Prediction",6,"prediction_layer/conv_6"),conv_7:a("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:o(0),box_predictor_1:o(1),box_predictor_2:o(2),box_predictor_3:o(3),box_predictor_4:o(4),box_predictor_5:o(5)}}}}(t,e),r=n.extractMobilenetV1Params,o=n.extractPredictionLayerParams,i=t["Output/extra_dim"];if(e.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!fh(i))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+i);var a={mobilenetv1:r(),prediction_layer:o(),output_layer:{extra_dim:i}};return Xh(t,e),{params:a,paramMappings:e}}function Bf(e,n,r){return ue(function(){var t=Ss(e,n.filters,r,"same");return t=xu(t,n.batch_norm_offset),Sa(t,0,6)})}var Wf=.0010000000474974513;function zf(t,e){return ue(function(){var u=null,c=Bf(t,e.conv_0,[2,2]);if([e.conv_1,e.conv_2,e.conv_3,e.conv_4,e.conv_5,e.conv_6,e.conv_7,e.conv_8,e.conv_9,e.conv_10,e.conv_11,e.conv_12,e.conv_13].forEach(function(t,e){var n,r,o,i,a=e+1,s=(n=a,[2,4,6,12].some(function(t){return t===n})?[2,2]:[1,1]);r=c,o=t.depthwise_conv,i=s,c=Bf(c=ue(function(){var t=ks(r,o.filters,i,"same");return t=us(t,o.batch_norm_mean,o.batch_norm_variance,o.batch_norm_offset,o.batch_norm_scale,Wf),Sa(t,0,6)}),t.pointwise_conv,[1,1]),11===a&&(u=c)}),null===u)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:c,conv11:u}})}function Uf(t,e,n){var r=t.arraySync(),o=Math.min(r[e][0],r[e][2]),i=Math.min(r[e][1],r[e][3]),a=Math.max(r[e][0],r[e][2]),s=Math.max(r[e][1],r[e][3]),u=Math.min(r[n][0],r[n][2]),c=Math.min(r[n][1],r[n][3]),l=Math.max(r[n][0],r[n][2]),h=Math.max(r[n][1],r[n][3]),p=(a-o)*(s-i),f=(l-u)*(h-c);if(p<=0||f<=0)return 0;var d=Math.max(o,u),v=Math.max(i,c),m=Math.min(a,l),g=Math.min(s,h),y=Math.max(m-d,0)*Math.max(g-v,0);return y/(p+f-y)}function Gf(t,e){var n,r,o=(n=ha(Qu(t,[1,0])),{sizes:r=[Bu(n[2],n[0]),Bu(n[3],n[1])],centers:[xu(n[0],Cu(r[0],Ve(2))),xu(n[1],Cu(r[1],Ve(2)))]}),i=o.sizes,a=o.centers,s=ha(Qu(e,[1,0])),u=Cu(Du(Ia(Cu(s[2],Ve(5))),i[0]),Ve(2)),c=xu(Du(Cu(s[0],Ve(10)),i[0]),a[0]),l=Cu(Du(Ia(Cu(s[3],Ve(5))),i[1]),Ve(2)),h=xu(Du(Cu(s[1],Ve(10)),i[1]),a[1]);return Qu(ua([Bu(c,u),Bu(h,l),xu(c,u),xu(h,l)]),[1,0])}function Vf(e,n){return ue(function(){var t=e.shape[0];return{boxPredictionEncoding:ia(Kh(e,n.box_encoding_predictor),[t,-1,1,4]),classPrediction:ia(Kh(e,n.class_predictor),[t,-1,3])}})}var Hf=function(){function t(t){var e=void 0===t?{}:t,n=e.minConfidence,r=e.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=n||.5,this._maxResults=r||100,"number"!=typeof this._minConfidence||this._minConfidence<=0||1<=this._minConfidence)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if("number"!=typeof this._maxResults)throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(t.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),t}(),qf=function(t){function e(){return t.call(this,"SsdMobilenetv1")||this}return a(e,t),e.prototype.forwardInput=function(u){var c=this.params;if(!c)throw new Error("SsdMobilenetv1 - load model before inference");return ue(function(){var l,h,p,o,i,a,t=u.toBatchTensor(512,!1).toFloat(),e=zf(Bu(Du(t,Ve(.007843137718737125)),Ve(1)),c.mobilenetv1),n=(l=e.out,h=e.conv11,p=c.prediction_layer,ue(function(){var t=Bf(Bf(l,p.conv_0,[1,1]),p.conv_1,[2,2]),e=Bf(Bf(t,p.conv_2,[1,1]),p.conv_3,[2,2]),n=Bf(Bf(e,p.conv_4,[1,1]),p.conv_5,[2,2]),r=Bf(Bf(n,p.conv_6,[1,1]),p.conv_7,[2,2]),o=Vf(h,p.box_predictor_0),i=Vf(l,p.box_predictor_1),a=Vf(t,p.box_predictor_2),s=Vf(e,p.box_predictor_3),u=Vf(n,p.box_predictor_4),c=Vf(r,p.box_predictor_5);return{boxPredictions:_i([o.boxPredictionEncoding,i.boxPredictionEncoding,a.boxPredictionEncoding,s.boxPredictionEncoding,u.boxPredictionEncoding,c.boxPredictionEncoding],1),classPredictions:_i([o.classPrediction,i.classPrediction,a.classPrediction,s.classPrediction,u.classPrediction,c.classPrediction],1)}})),r=n.boxPredictions,s=n.classPredictions;return o=r,i=s,a=c.output_layer,ue(function(){var t=o.shape[0],e=Gf(ia(ca(a.extra_dim,[t,1,1]),[-1,4]),ia(o,[-1,4]));e=ia(e,[t,e.shape[0]/t,4]);var n=Wa(Hs(i,[0,0,1],[-1,-1,-1])),r=Hs(n,[0,0,0],[-1,-1,1]);return r=ia(r,[t,r.shape[1]]),{boxes:ha(e),scores:ha(r)}})})},e.prototype.forward=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent()])]}})})},e.prototype.locateFaces=function(T,A){return void 0===A&&(A={}),p(this,void 0,void 0,function(){var l,h,p,f,d,v,m,g,y,x,w,b,E,C,_,S,R,N,k,I;return P(this,function(t){switch(t.label){case 0:return l=new Hf(A),h=l.maxResults,p=l.minConfidence,[4,yp(T)];case 1:for(f=t.sent(),d=this.forwardInput(f),v=d.boxes,m=d.scores,g=v[0],y=m[0],x=1;xa}).sort(function(t,e){return e.score-t.score}),c=[],u.forEach(function(t){if(!(c.length>=s)){for(var e=t.score,n=c.length-1;0<=n;--n){var r=Uf(o,t.boxIndex,c[n]);if(0!==r&&(t.score*=r<=i?1:0,t.score<=a))break}e===t.score&&c.push(t.boxIndex)}}),C=c,_=f.getReshapedInputDimensions(0),S=f.inputSize,R=S/_.width,N=S/_.height,k=g.arraySync(),I=C.map(function(t){var e=[Math.max(0,k[t][0]),Math.min(1,k[t][2])].map(function(t){return t*N}),n=e[0],r=e[1],o=[Math.max(0,k[t][1]),Math.min(1,k[t][3])].map(function(t){return t*R}),i=o[0],a=o[1];return new Lp(w[t],new Th(i,n,a-i,r-n),{height:f.getInputHeight(0),width:f.getInputWidth(0)})}),g.dispose(),y.dispose(),[2,I]}var o,e,n,i,a,r,s,u,c})})},e.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},e.prototype.extractParamsFromWeigthMap=function(t){return Lf(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=np(t),r=n.extractWeights,o=n.getRemainingWeights,i=Ff(r,e),a=i.extractMobilenetV1Params,s=i.extractPredictionLayerParams,u=a(),c=s(),l={extra_dim:je(r(20472),[1,5118,4])};if(e.push({paramPath:"output_layer/extra_dim"}),0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{params:{mobilenetv1:u,prediction_layer:c,output_layer:l},paramMappings:e}}(t)},e}(xp);function jf(t){var e=new qf;return e.extractWeights(t),e}var $f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e}(qf),Kf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name="TinyFaceDetectorOptions",t}return a(t,e),t}(Mp),Xf=function(){function t(){}return t.prototype.then=function(n){return p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=n,[4,this.run()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},t.prototype.run=function(){return p(this,void 0,void 0,function(){return P(this,function(t){throw new Error("ComposableTask - run is not implemented")})})},t}();function Yf(a,s,u,c,l){return void 0===l&&(l=function(t){return t.alignedRect}),p(this,void 0,void 0,function(){var e,n,r,o,i;return P(this,function(t){switch(t.label){case 0:return e=a.map(function(t){return rf(t)?l(t):t.detection}),(r=c)?[3,5]:s instanceof dt?[4,wf(s,e)]:[3,2];case 1:return o=t.sent(),[3,4];case 2:return[4,xf(s,e)];case 3:o=t.sent(),t.label=4;case 4:r=o,t.label=5;case 5:return[4,u(n=r)];case 6:return i=t.sent(),n.forEach(function(t){return t instanceof dt&&t.dispose()}),[2,i]}})})}function Qf(e,r,o,i,a){return p(this,void 0,void 0,function(){var n=this;return P(this,function(t){return[2,Yf([e],r,function(e){return p(n,void 0,void 0,function(){return P(this,function(t){return[2,o(e[0])]})})},i,a)]})})}var Jf=2,Zf=12;function td(t){var e=np(t),n=e.extractWeights,r=e.getRemainingWeights,o=[],i=function(r,o){var u=Yh(r,o),c=Qh(r,o);function l(t,e){var n=He(r(t));return o.push({paramPath:e}),n}function h(t,e,n){return void 0===n&&(n=!1),{conv1:u(t[0],t[1],3,e+"/conv1"),prelu1_alpha:l(t[1],e+"/prelu1_alpha"),conv2:u(t[1],t[2],3,e+"/conv2"),prelu2_alpha:l(t[2],e+"/prelu2_alpha"),conv3:u(t[2],t[3],n?2:3,e+"/conv3"),prelu3_alpha:l(t[3],e+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=h([3,10,16,32],"pnet"),e=u(32,2,1,"pnet/conv4_1"),n=u(32,4,1,"pnet/conv4_2");return O({},t,{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=h([3,28,48,64],"rnet",!0),e=c(576,128,"rnet/fc1"),n=l(128,"rnet/prelu4_alpha"),r=c(128,2,"rnet/fc2_1"),o=c(128,4,"rnet/fc2_2");return O({},t,{fc1:e,prelu4_alpha:n,fc2_1:r,fc2_2:o})},extractONetParams:function(){var t=h([3,32,64,64],"onet"),e=u(64,128,2,"onet/conv4"),n=l(128,"onet/prelu4_alpha"),r=c(1152,256,"onet/fc1"),o=l(256,"onet/prelu5_alpha"),i=c(256,2,"onet/fc2_1"),a=c(256,4,"onet/fc2_2"),s=c(256,10,"onet/fc2_3");return O({},t,{conv4:e,prelu4_alpha:n,fc1:r,prelu5_alpha:o,fc2_1:i,fc2_2:a,fc2_3:s})}}}(n,o),a=i.extractPNetParams,s=i.extractRNetParams,u=i.extractONetParams,c=a(),l=s(),h=u();if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{pnet:c,rnet:l,onet:h},paramMappings:o}}function ed(t){var e=[],n=function(t,e){var n=ep(t,e);function u(t){return{filters:n(t+"/weights",4,t+"/filters"),bias:n(t+"/bias",1)}}function c(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}function l(t){return n(t,1)}function h(t){return{conv1:u(t+"/conv1"),prelu1_alpha:l(t+"/prelu1_alpha"),conv2:u(t+"/conv2"),prelu2_alpha:l(t+"/prelu2_alpha"),conv3:u(t+"/conv3"),prelu3_alpha:l(t+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=h("pnet"),e=u("pnet/conv4_1"),n=u("pnet/conv4_2");return O({},t,{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=h("rnet"),e=c("rnet/fc1"),n=l("rnet/prelu4_alpha"),r=c("rnet/fc2_1"),o=c("rnet/fc2_2");return O({},t,{fc1:e,prelu4_alpha:n,fc2_1:r,fc2_2:o})},extractONetParams:function(){var t=h("onet"),e=u("onet/conv4"),n=l("onet/prelu4_alpha"),r=c("onet/fc1"),o=l("onet/prelu5_alpha"),i=c("onet/fc2_1"),a=c("onet/fc2_2"),s=c("onet/fc2_3");return O({},t,{conv4:e,prelu4_alpha:n,fc1:r,prelu5_alpha:o,fc2_1:i,fc2_2:a,fc2_3:s})}}}(t,e),r=n.extractPNetParams,o=n.extractRNetParams,i=n.extractONetParams,a=r(),s=o(),u=i();return Xh(t,e),{params:{pnet:a,rnet:s,onet:u},paramMappings:e}}function nd(t,e){var n=e[0],r=e[1];return{height:Math.floor(n*t),width:Math.floor(r*t)}}var rd=function(o){function t(t,e,n,r){return o.call(this,{left:t,top:e,right:n,bottom:r},!0)||this}return a(t,o),t}(Sh);function od(t){return ue(function(){return Du(Bu(t,Ve(127.5)),Ve(.0078125))})}function id(t,e){return ue(function(){return xu(Xu(t),Du(e,Pa(Xu(Pa(t)))))})}function ad(e,n,r){return void 0===r&&(r=!1),ue(function(){var t=Kh(e,n.conv1,"valid");return t=id(t,n.prelu1_alpha),t=id(t=Kh(t=Us(t,r?[2,2]:[3,3],[2,2],"same"),n.conv2,"valid"),n.prelu2_alpha),t=id(t=Kh(t=r?t:Us(t,[3,3],[2,2],"valid"),n.conv3,"valid"),n.prelu3_alpha)})}function sd(h,t,u,p,c){c.stage1=[];var e=t.map(function(l){return ue(function(){var o,i,r,a,t={scale:l},e=(o=h,i=l,ue(function(){var t=nd(i,o.shape.slice(1)),e=t.height,n=t.width,r=od(Wc.resizeBilinear(o,[e,n]));return Qu(r,[0,2,1,3])})),n=Date.now(),s=(r=e,a=p,ue(function(){var t=ad(r,a,!0),e=Kh(t,a.conv4_1,"valid"),n=$i(eu(e,3),3);return{prob:Le(Bu(e,n),3),regions:Kh(t,a.conv4_2,"valid")}})),u=s.prob,c=s.regions;return t.pnet=Date.now()-n,{scoresTensor:ha(ha(u,3)[1])[0],regionsTensor:ha(c)[0],scale:l,statsForScale:t}})}).map(function(t){var e=t.scoresTensor,n=t.regionsTensor,r=t.scale,o=t.statsForScale,i=function(t,o,i,e){for(var n=[],a=t.arraySync(),r=0;r=e&&n.push(new lh(s,r));return n.map(function(t){var e=new Rh(Math.round((t.y*Jf+1)/i),Math.round((t.x*Jf+1)/i),Math.round((t.y*Jf+Zf)/i),Math.round((t.x*Jf+Zf)/i)),n=a[t.y][t.x],r=o.arraySync();return{cell:e,score:n,region:new rd(r[t.y][t.x][0],r[t.y][t.x][1],r[t.y][t.x][2],r[t.y][t.x][3])}})}(e,n,r,u);if(e.dispose(),n.dispose(),!i.length)return c.stage1.push(o),[];var a=Date.now(),s=bp(i.map(function(t){return t.cell}),i.map(function(t){return t.score}),.5);return o.nms=Date.now()-a,o.numBoxes=s.length,c.stage1.push(o),s.map(function(t){return i[t]})}).reduce(function(t,e){return t.concat(e)},[]),n=[],r=[];if(0g}).map(function(t){return t.idx}),c=u.map(function(t){return m[t]}),l=u.map(function(t){return i[t]}),h=[],p=[],0y}).map(function(t){return t.idx}),c=u.map(function(t){var e=i[t].regions.arraySync();return new rd(e[0][0],e[0][1],e[0][2],e[0][3])}),l=u.map(function(t,e){return g[t].calibrate(c[e])}),h=u.map(function(t){return o[t]}),p=[],f=[],d=[],0Zf}).slice(0,f),r.scales=m,r.pyramid=m.map(function(t){return nd(t,[u,c])}),g=Date.now(),[4,sd(i,m,d[0],e.pnet,r)];case 1:return y=t.sent(),r.total_stage1=Date.now()-g,y.boxes.length?(r.stage2_numInputBoxes=y.boxes.length,g=Date.now(),[4,cd(n,y.boxes,d[1],e.rnet,r)]):[2,a({results:[],stats:r})];case 2:return x=t.sent(),r.total_stage2=Date.now()-g,x.boxes.length?(r.stage3_numInputBoxes=x.boxes.length,g=Date.now(),[4,ld(n,x.boxes,d[2],e.onet,r)]):[2,a({results:[],stats:r})];case 3:return w=t.sent(),r.total_stage3=Date.now()-g,b=w.boxes.map(function(e,t){return of(Wp({},new Lp(w.scores[t],new Th(e.left/c,e.top/u,e.width/c,e.height/u),{height:u,width:c})),new mf(w.points[t].map(function(t){return t.sub(new lh(e.left,e.top)).div(new lh(e.width,e.height))}),{width:e.width,height:e.height}))}),[2,a({results:b,stats:r})]}})})},e.prototype.forward=function(n,r){return void 0===r&&(r={}),p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[4,e.apply(this,[t.sent(),r])];case 2:return[2,t.sent().results]}})})},e.prototype.forwardWithStats=function(n,r){return void 0===r&&(r={}),p(this,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=this.forwardInput,[4,yp(n)];case 1:return[2,e.apply(this,[t.sent(),r])]}})})},e.prototype.getDefaultModelName=function(){return"mtcnn_model"},e.prototype.extractParamsFromWeigthMap=function(t){return ed(t)},e.prototype.extractParams=function(t){return td(t)},e}(xp),pd=[new lh(1.603231,2.094468),new lh(6.041143,7.080126),new lh(2.882459,3.518061),new lh(4.266906,5.178857),new lh(9.041765,10.66308)],fd=[117.001,114.697,97.404],dd=function(e){function t(){var t={withSeparableConvs:!0,iouThreshold:.4,classes:["face"],anchors:pd,meanRgb:fd,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return e.call(this,t)||this}return a(t,e),Object.defineProperty(t.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),t.prototype.locateFaces=function(e,n){return p(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return[4,this.detect(e,n)];case 1:return[2,t.sent().map(function(t){return new Lp(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},t.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},t.prototype.extractParamsFromWeigthMap=function(t){return e.prototype.extractParamsFromWeigthMap.call(this,t)},t}(Op),vd=[new lh(.738768,.874946),new lh(2.42204,2.65704),new lh(4.30971,7.04493),new lh(10.246,4.59428),new lh(12.6868,11.8741)],md=[new lh(1.603231,2.094468),new lh(6.041143,7.080126),new lh(2.882459,3.518061),new lh(4.266906,5.178857),new lh(9.041765,10.66308)],gd=[117.001,114.697,97.404],yd=function(n){function t(t){void 0===t&&(t=!0);var e=Object.assign({},{withSeparableConvs:t,iouThreshold:.4,classes:["face"]},t?{anchors:md,meanRgb:gd}:{anchors:vd,withClassScores:!0});return n.call(this,e)||this}return a(t,n),Object.defineProperty(t.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),t.prototype.locateFaces=function(e,n){return p(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return[4,this.detect(e,n)];case 1:return[2,t.sent().map(function(t){return new Lp(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},t.prototype.getDefaultModelName=function(){return this.withSeparableConvs?"tiny_yolov2_separable_conv_model":"tiny_yolov2_model"},t.prototype.extractParamsFromWeigthMap=function(t){return n.prototype.extractParamsFromWeigthMap.call(this,t)},t}(Op);var xd={ssdMobilenetv1:new qf,tinyFaceDetector:new dd,tinyYolov2:new yd,mtcnn:new hd,faceLandmark68Net:new Ef,faceLandmark68TinyNet:new _f,faceRecognitionNet:new Mf,faceExpressionNet:new Jp,ageGenderNet:new vf},wd=function(t,e){return xd.ssdMobilenetv1.locateFaces(t,e)},bd=function(t){return xd.faceLandmark68Net.detectLandmarks(t)},Ed=function(t){return xd.ssdMobilenetv1.load(t)},Cd=Ed,_d=wd,Sd=bd;function Rd(t,e){var n={age:e};return Object.assign({},t,n)}function Nd(t,e,n){var r={gender:e,genderProbability:n};return Object.assign({},t,r)}var kd=function(o){function t(t,e,n){var r=o.call(this)||this;return r.parentTask=t,r.input=e,r.extractedFaces=n,r}return a(t,o),t}(Xf),Id=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n,r=this;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return[4,Yf(e=t.sent(),this.input,function(e){return p(r,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return[4,Promise.all(e.map(function(t){return xd.faceExpressionNet.predictExpressions(t)}))];case 1:return[2,t.sent()]}})})},this.extractedFaces)];case 2:return n=t.sent(),[2,e.map(function(t,e){return tf(t,n[e])})]}})})},e.prototype.withAgeAndGender=function(){return new Od(this,this.input)},e}(kd),Td=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return(e=t.sent())?[4,Qf(e,this.input,function(t){return xd.faceExpressionNet.predictExpressions(t)},this.extractedFaces)]:[2];case 2:return n=t.sent(),[2,tf(e,n)]}})})},e.prototype.withAgeAndGender=function(){return new Pd(this,this.input)},e}(kd),Ad=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.withAgeAndGender=function(){return new Fd(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Wd(this,this.input)},e}(Id),Dd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.withAgeAndGender=function(){return new Ld(this,this.input)},e.prototype.withFaceDescriptor=function(){return new zd(this,this.input)},e}(Td),Md=function(o){function t(t,e,n){var r=o.call(this)||this;return r.parentTask=t,r.input=e,r.extractedFaces=n,r}return a(t,o),t}(Xf),Od=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,o,n=this;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return[4,Yf(e=t.sent(),this.input,function(e){return p(n,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return[4,Promise.all(e.map(function(t){return xd.ageGenderNet.predictAgeAndGender(t)}))];case 1:return[2,t.sent()]}})})},this.extractedFaces)];case 2:return o=t.sent(),[2,e.map(function(t,e){var n=o[e],r=n.age;return Rd(Nd(t,n.gender,n.genderProbability),r)})]}})})},e.prototype.withFaceExpressions=function(){return new Id(this,this.input)},e}(Md),Pd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n,r,o,i;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return(e=t.sent())?[4,Qf(e,this.input,function(t){return xd.ageGenderNet.predictAgeAndGender(t)},this.extractedFaces)]:[2];case 2:return n=t.sent(),r=n.age,o=n.gender,i=n.genderProbability,[2,Rd(Nd(e,o,i),r)]}})})},e.prototype.withFaceExpressions=function(){return new Td(this,this.input)},e}(Md),Fd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.withFaceExpressions=function(){return new Ad(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Wd(this,this.input)},e}(Od),Ld=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.withFaceExpressions=function(){return new Dd(this,this.input)},e.prototype.withFaceDescriptor=function(){return new zd(this,this.input)},e}(Pd),Bd=function(r){function t(t,e){var n=r.call(this)||this;return n.parentTask=t,n.input=e,n}return a(t,r),t}(Xf),Wd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var n;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return[4,Yf(n=t.sent(),this.input,function(t){return Promise.all(t.map(function(t){return xd.faceRecognitionNet.computeFaceDescriptor(t)}))},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return[2,t.sent().map(function(t,e){return Of(n[e],t)})]}})})},e.prototype.withFaceExpressions=function(){return new Ad(this,this.input)},e.prototype.withAgeAndGender=function(){return new Fd(this,this.input)},e}(Bd),zd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return(e=t.sent())?[4,Qf(e,this.input,function(t){return xd.faceRecognitionNet.computeFaceDescriptor(t)},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return n=t.sent(),[2,Of(e,n)]}})})},e.prototype.withFaceExpressions=function(){return new Dd(this,this.input)},e.prototype.withAgeAndGender=function(){return new Ld(this,this.input)},e}(Bd),Ud=function(o){function t(t,e,n){var r=o.call(this)||this;return r.parentTask=t,r.input=e,r.useTinyLandmarkNet=n,r}return a(t,o),Object.defineProperty(t.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?xd.faceLandmark68TinyNet:xd.faceLandmark68Net},enumerable:!0,configurable:!0}),t}(Xf),Gd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n,r,o,i,a=this;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return e=t.sent(),n=e.map(function(t){return t.detection}),this.input instanceof dt?[4,wf(this.input,n)]:[3,3];case 2:return o=t.sent(),[3,5];case 3:return[4,xf(this.input,n)];case 4:o=t.sent(),t.label=5;case 5:return r=o,[4,Promise.all(r.map(function(t){return a.landmarkNet.detectLandmarks(t)}))];case 6:return i=t.sent(),r.forEach(function(t){return t instanceof dt&&t.dispose()}),[2,e.map(function(t,e){return of(t,i[e])})]}})})},e.prototype.withFaceExpressions=function(){return new Ad(this,this.input)},e.prototype.withAgeAndGender=function(){return new Fd(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Wd(this,this.input)},e}(Ud),Vd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n,r,o,i;return P(this,function(t){switch(t.label){case 0:return[4,this.parentTask];case 1:return(e=t.sent())?(n=e.detection,this.input instanceof dt?[4,wf(this.input,[n])]:[3,3]):[2];case 2:return o=t.sent(),[3,5];case 3:return[4,xf(this.input,[n])];case 4:o=t.sent(),t.label=5;case 5:return r=o,[4,this.landmarkNet.detectLandmarks(r[0])];case 6:return i=t.sent(),r.forEach(function(t){return t instanceof dt&&t.dispose()}),[2,of(e,i)]}})})},e.prototype.withFaceExpressions=function(){return new Dd(this,this.input)},e.prototype.withAgeAndGender=function(){return new Ld(this,this.input)},e.prototype.withFaceDescriptor=function(){return new zd(this,this.input)},e}(Ud),Hd=function(r){function t(t,e){void 0===e&&(e=new Hf);var n=r.call(this)||this;return n.input=t,n.options=e,n}return a(t,r),t}(Xf),qd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n,r,o;return P(this,function(t){switch(t.label){case 0:return n=(e=this).input,(r=e.options)instanceof Pf?[4,xd.mtcnn.forward(n,r)]:[3,2];case 1:return[2,t.sent().map(function(t){return t.detection})];case 2:if(!(o=r instanceof Kf?function(t){return xd.tinyFaceDetector.locateFaces(t,r)}:r instanceof Hf?function(t){return xd.ssdMobilenetv1.locateFaces(t,r)}:r instanceof Mp?function(t){return xd.tinyYolov2.locateFaces(t,r)}:null))throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,o(n)]}})})},e.prototype.runAndExtendWithFaceDetections=function(){var t=this;return new Promise(function(n){return p(t,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,this.run()];case 1:return e=t.sent(),[2,n(e.map(function(t){return Wp({},t)}))]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new Gd(this.runAndExtendWithFaceDetections(),this.input,t)},e.prototype.withFaceExpressions=function(){return new Id(this.runAndExtendWithFaceDetections(),this.input)},e.prototype.withAgeAndGender=function(){return new Od(this.runAndExtendWithFaceDetections(),this.input)},e}(Hd),jd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.run=function(){return p(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:return[4,new qd(this.input,this.options)];case 1:return e=t.sent(),n=e[0],e.forEach(function(t){t.score>n.score&&(n=t)}),[2,n]}})})},e.prototype.runAndExtendWithFaceDetection=function(){var t=this;return new Promise(function(n){return p(t,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,this.run()];case 1:return e=t.sent(),[2,n(e?Wp({},e):void 0)]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new Vd(this.runAndExtendWithFaceDetection(),this.input,t)},e.prototype.withFaceExpressions=function(){return new Td(this.runAndExtendWithFaceDetection(),this.input)},e.prototype.withAgeAndGender=function(){return new Pd(this.runAndExtendWithFaceDetection(),this.input)},e}(Hd);function $d(t,e){return void 0===e&&(e=new Hf),new qd(t,e)}function Kd(e,n){return p(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return[4,$d(e,new Hf(n?{minConfidence:n}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,t.sent()]}})})}var Xd=Kd;function Yd(t,e){if(t.length!==e.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var n=Array.from(t),r=Array.from(e);return Math.sqrt(n.map(function(t,e){return t-r[e]}).reduce(function(t,e){return t+Math.pow(e,2)},0))}var Qd=function(){function t(t,e){void 0===e&&(e=.6),this._distanceThreshold=e;var n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var r=1,o=function(){return"person "+r++};this._labeledDescriptors=n.map(function(t){if(t instanceof yf)return t;if(t instanceof Float32Array)return new yf(o(),[t]);if(t.descriptor&&t.descriptor instanceof Float32Array)return new yf(o(),[t.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor | Float32Array | Array | Float32Array>")})}return Object.defineProperty(t.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),t.prototype.computeMeanDistance=function(e,t){return t.map(function(t){return Yd(t,e)}).reduce(function(t,e){return t+e},0)/(t.length||1)},t.prototype.matchDescriptor=function(r){var o=this;return this.labeledDescriptors.map(function(t){var e=t.descriptors,n=t.label;return new gf(n,o.computeMeanDistance(r,e))}).reduce(function(t,e){return t.distancea;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e}function ya(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[r]===e&&(t[r]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null}function za(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0}function Aa(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t}function Ca(t,e,r,i){return t._startAt&&(L?t._startAt.revert(ht):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))}function Ea(t){return t._repeat?Tt(t._tTime,t=t.duration()+t._rDelay)*t:0}function Ga(t,e){return(t-e._start)*e._ts+(0<=e._ts?0:e._dirty?e.totalDuration():e._tDur)}function Ha(t){return t._end=ja(t._start+(t._tDur/Math.abs(t._ts||t._rts||X)||0))}function Ia(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=ja(r._time-(0X)&&e.render(r,!0)),Aa(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur(n=Math.abs(n))&&(a=i,o=n);return a}function tb(t){return za(t),t.scrollTrigger&&t.scrollTrigger.kill(!!L),t.progress()<1&&At(t,"onInterrupt"),t}function wb(t){if(x()&&t){var e=(t=!t.name&&t.default||t).name,r=s(t),i=e&&!r&&t.init?function(){this._props=[]}:t,n={init:T,render:he,add:Qt,kill:ce,modifier:fe,rawVars:0},a={targetTest:0,get:0,getSetter:ne,aliases:{},register:0};if(Ft(),t!==i){if(pt[e])return;qa(i,qa(ua(t,n),a)),yt(i.prototype,yt(n,ua(t,a))),pt[i.prop=e]=i,t.targetTest&&(gt.push(i),ft[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}S(e,i),t.register&&t.register(Ee,i,_e)}else t&&Ct.push(t)}function zb(t,e,r){return(6*(t+=t<0?1:1>16,e>>8&St,e&St]:0:Et.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Et[e])p=Et[e];else if("#"===e.charAt(0)){if(e.length<6&&(e="#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(s=e.charAt(3))+s+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&St,p&St,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&St,e&St]}else if("hsl"===e.substr(0,3))if(p=d=e.match(tt),r){if(~e.indexOf("="))return p=e.match(et),i&&p.length<4&&(p[3]=1),p}else o=+p[0]%360/360,u=p[1]/100,n=2*(h=p[2]/100)-(a=h<=.5?h*(u+1):h+u-h*u),3=U?u.endTime(!1):t._dur;return r(e)&&(isNaN(e)||e in o)?(a=e.charAt(0),s="%"===e.substr(-1),n=e.indexOf("="),"<"===a||">"===a?(0<=n&&(e=e.replace(/=/,"")),("<"===a?u._start:u.endTime(0<=u._repeat))+(parseFloat(e.substr(1))||0)*(s?(n<0?u:i).totalDuration()/100:1)):n<0?(e in o||(o[e]=h),o[e]):(a=parseFloat(e.charAt(n-1)+e.substr(n+1)),s&&i&&(a=a/100*($(i)?i[0]:i).totalDuration()),1=r&&te)return i;i=i._next}else for(i=t._last;i&&i._start>=r;){if("isPause"===i.data&&i._start=n._start)&&n._ts&&h!==n){if(n.parent!==this)return this.render(t,e,r);if(n.render(0=this.totalDuration()||!v&&_)&&(f!==this._start&&Math.abs(l)===Math.abs(this._ts)||this._lock||(!t&&g||!(v===m&&0=i&&(a instanceof Zt?e&&n.push(a):(r&&n.push(a),t&&n.push.apply(n,a.getChildren(!0,e,r)))),a=a._next;return n},e.getById=function getById(t){for(var e=this.getChildren(1,1,1),r=e.length;r--;)if(e[r].vars.id===t)return e[r]},e.remove=function remove(t){return r(t)?this.removeLabel(t):s(t)?this.killTweensOf(t):(ya(this,t),t===this._recent&&(this._recent=this._last),Aa(this))},e.totalTime=function totalTime(t,e){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ja(Rt.time-(0r:!r||s.isActive())&&n.push(s):(i=s.getTweensOf(a,r)).length&&n.push.apply(n,i),s=s._next;return n},e.tweenTo=function tweenTo(t,e){e=e||{};var r,i=this,n=xt(i,t),a=e.startAt,s=e.onStart,o=e.onStartParams,u=e.immediateRender,h=Zt.to(i,qa({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:n,overwrite:"auto",duration:e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale())||X,onStart:function onStart(){if(i.pause(),!r){var t=e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale());h._dur!==t&&Ra(h,t,0,1).render(h._time,!0,!0),r=1}s&&s.apply(h,o||[])}},e));return u?h.render(0):h},e.tweenFromTo=function tweenFromTo(t,e,r){return this.tweenTo(e,qa({startAt:{time:xt(this,t)}},r))},e.recent=function recent(){return this._recent},e.nextLabel=function nextLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t))},e.previousLabel=function previousLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t),1)},e.currentLabel=function currentLabel(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+X)},e.shiftChildren=function shiftChildren(t,e,r){void 0===r&&(r=0);for(var i,n=this._first,a=this.labels;n;)n._start>=r&&(n._start+=t,n._end+=t),n=n._next;if(e)for(i in a)a[i]>=r&&(a[i]+=t);return Aa(this)},e.invalidate=function invalidate(t){var e=this._first;for(this._lock=0;e;)e.invalidate(t),e=e._next;return i.prototype.invalidate.call(this,t)},e.clear=function clear(t){void 0===t&&(t=!0);for(var e,r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Aa(this)},e.totalDuration=function totalDuration(t){var e,r,i,n=0,a=this,s=a._last,o=U;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(i=a.parent;s;)e=s._prev,s._dirty&&s.totalDuration(),o<(r=s._start)&&a._sort&&s._ts&&!a._lock?(a._lock=1,Ka(a,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(n-=r,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=r/a._ts,a._time-=r,a._tTime-=r),a.shiftChildren(-r,!1,-Infinity),o=0),s._end>n&&s._ts&&(n=s._end),s=e;Ra(a,a===I&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},Timeline.updateRoot=function updateRoot(t){if(I._ts&&(na(I,Ga(t,I)),f=Rt.frame),Rt.frame>=mt){mt+=q.autoSleep||120;var e=I._first;if((!e||!e._ts)&&q.autoSleep&&Rt._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Rt.sleep()}}},Timeline}(Ut);qa(Xt.prototype,{_lock:0,_hasPause:0,_forcing:0});function ac(t,e,i,n,a,o){var u,h,l,f;if(pt[t]&&!1!==(u=new pt[t]).init(a,u.rawVars?e[t]:function _processVars(t,e,i,n,a){if(s(t)&&(t=Kt(t,a,e,i,n)),!v(t)||t.style&&t.nodeType||$(t)||Z(t))return r(t)?Kt(t,a,e,i,n):t;var o,u={};for(o in t)u[o]=Kt(t[o],a,e,i,n);return u}(e[t],n,a,o,i),i,n,o)&&(i._pt=h=new _e(i._pt,a,t,0,1,u.render,u,0,u.priority),i!==c))for(l=i._ptLookup[i._targets.indexOf(a)],f=u._props.length;f--;)l[u._props[f]]=h;return u}function gc(t,r,e,i){var n,a,s=r.ease||i||"power1.inOut";if($(r))a=e[t]||(e[t]=[]),r.forEach(function(t,e){return a.push({t:e/(r.length-1)*100,v:t,e:s})});else for(n in r)a=e[n]||(e[n]=[]),"ease"===n||a.push({t:parseFloat(t),v:r[n],e:s})}var Nt,Wt,Qt=function _addPropTween(t,e,i,n,a,o,u,h,l,f){s(n)&&(n=n(a||0,t,o));var c,d=t[e],p="get"!==i?i:s(d)?l?t[e.indexOf("set")||!s(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():d,_=s(d)?l?re:te:$t;if(r(n)&&(~n.indexOf("random(")&&(n=ob(n)),"="===n.charAt(1)&&(!(c=ka(p,n)+(Ya(p)||0))&&0!==c||(n=c))),!f||p!==n||Wt)return isNaN(p*n)||""===n?(d||e in t||Q(e,n),function _addComplexStringPropTween(t,e,r,i,n,a,s){var o,u,h,l,f,c,d,p,_=new _e(this._pt,t,e,0,1,ue,null,n),m=0,g=0;for(_.b=r,_.e=i,r+="",(d=~(i+="").indexOf("random("))&&(i=ob(i)),a&&(a(p=[r,i],t,e),r=p[0],i=p[1]),u=r.match(it)||[];o=it.exec(i);)l=o[0],f=i.substring(m,o.index),h?h=(h+1)%5:"rgba("===f.substr(-5)&&(h=1),l!==u[g++]&&(c=parseFloat(u[g-1])||0,_._pt={_next:_._pt,p:f||1===g?f:",",s:c,c:"="===l.charAt(1)?ka(c,l)-c:parseFloat(l)-c,m:h&&h<4?Math.round:0},m=it.lastIndex);return _.c=m")}),s.duration();else{for(l in u={},x)"ease"===l||"easeEach"===l||gc(l,x[l],u,x.easeEach);for(l in u)for(C=u[l].sort(function(t,e){return t.t-e.t}),o=D=0;o=t._tDur||e<0)&&t.ratio===u&&(u&&za(t,1),r||L||(At(t,u?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,r);return this},e.targets=function targets(){return this._targets},e.invalidate=function invalidate(t){return t&&this.vars.runBackwards||(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),z.prototype.invalidate.call(this,t)},e.resetTo=function resetTo(t,e,r,i){d||Rt.wake(),this._ts||this.play();var n,a=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Gt(this,a),n=this._ease(a/this._dur),function _updatePropTweens(t,e,r,i,n,a,s){var o,u,h,l,f=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!f)for(f=t._ptCache[e]=[],h=t._ptLookup,l=t._targets.length;l--;){if((o=h[l][e])&&o.d&&o.d._pt)for(o=o.d._pt;o&&o.p!==e&&o.fp!==e;)o=o._next;if(!o)return Wt=1,t.vars[e]="+=0",Gt(t,s),Wt=0,1;f.push(o)}for(l=f.length;l--;)(o=(u=f[l])._pt||u).s=!i&&0!==i||n?o.s+(i||0)+a*o.c:i,o.c=r-o.s,u.e&&(u.e=ia(r)+Ya(u.e)),u.b&&(u.b=o.s+Ya(u.b))}(this,t,e,r,i,n,a)?this.resetTo(t,e,r,i):(Ia(this,0),this.parent||xa(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function kill(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?tb(this):this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Nt&&!0!==Nt.vars.overwrite)._first||tb(this),this.parent&&i!==this.timeline.totalDuration()&&Ra(this,this._dur*this.timeline._tDur/i,0,1),this}var n,a,s,o,u,h,l,f=this._targets,c=t?Ot(t):f,d=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function _arraysMatch(t,e){for(var r=t.length,i=r===e.length;i&&r--&&t[r]===e[r];);return r<0}(f,c))return"all"===e&&(this._pt=0),tb(this);for(n=this._op=this._op||[],"all"!==e&&(r(e)&&(u={},ha(e,function(t){return u[t]=1}),e=u),e=function _addAliasesToVars(t,e){var r,i,n,a,s=t[0]?fa(t[0]).harness:0,o=s&&s.aliases;if(!o)return e;for(i in r=yt({},e),o)if(i in r)for(n=(a=o[i].split(",")).length;n--;)r[a[n]]=r[i];return r}(f,e)),l=f.length;l--;)if(~c.indexOf(f[l]))for(u in a=d[l],"all"===e?(n[l]=e,o=a,s={}):(s=n[l]=n[l]||{},o=e),o)(h=a&&a[u])&&("kill"in h.d&&!0!==h.d.kill(u)||ya(this,h,"_pt"),delete a[u]),"all"!==s&&(s[u]=1);return this._initted&&!this._pt&&p&&tb(this),this},Tween.to=function to(t,e,r){return new Tween(t,e,r)},Tween.from=function from(t,e){return Va(1,arguments)},Tween.delayedCall=function delayedCall(t,e,r,i){return new Tween(e,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:e,onReverseComplete:e,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})},Tween.fromTo=function fromTo(t,e,r){return Va(2,arguments)},Tween.set=function set(t,e){return e.duration=0,e.repeatDelay||(e.repeat=0),new Tween(t,e)},Tween.killTweensOf=function killTweensOf(t,e,r){return I.killTweensOf(t,e,r)},Tween}(Ut);qa(Zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ha("staggerTo,staggerFrom,staggerFromTo",function(r){Zt[r]=function(){var t=new Xt,e=Mt.call(arguments,0);return e.splice("staggerFromTo"===r?5:4,0,0),t[r].apply(t,e)}});function oc(t,e,r){return t.setAttribute(e,r)}function wc(t,e,r,i){i.mSet(t,e,i.m.call(i.tween,r,i.mt),i)}var $t=function _setterPlain(t,e,r){return t[e]=r},te=function _setterFunc(t,e,r){return t[e](r)},re=function _setterFuncWithParam(t,e,r,i){return t[e](i.fp,r)},ne=function _getSetter(t,e){return s(t[e])?te:u(t[e])&&t.setAttribute?oc:$t},ae=function _renderPlain(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},se=function _renderBoolean(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ue=function _renderComplexString(t,e){var r=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*t):Math.round(1e4*(r.s+r.c*t))/1e4)+i,r=r._next;i+=e.c}e.set(e.t,e.p,i,e)},he=function _renderPropTweens(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},fe=function _addPluginModifier(t,e,r,i){for(var n,a=this._pt;a;)n=a._next,a.p===i&&a.modifier(t,e,r),a=n},ce=function _killPropTweensOf(t){for(var e,r,i=this._pt;i;)r=i._next,i.p===t&&!i.op||i.op===t?ya(this,i,"_pt"):i.dep||(e=1),i=r;return!e},pe=function _sortPropTweensByPriority(t){for(var e,r,i,n,a=t._pt;a;){for(e=a._next,r=i;r&&r.pr>a.pr;)r=r._next;(a._prev=r?r._prev:n)?a._prev._next=a:i=a,(a._next=r)?r._prev=a:n=a,a=e}t._pt=i},_e=(PropTween.prototype.modifier=function modifier(t,e,r){this.mSet=this.mSet||this.set,this.set=wc,this.m=t,this.mt=r,this.tween=e},PropTween);function PropTween(t,e,r,i,n,a,s,o,u){this.t=e,this.s=i,this.c=n,this.p=r,this.r=a||ae,this.d=s||this,this.set=o||$t,this.pr=u||0,(this._next=t)&&(t._prev=this)}ha(vt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(t){return ft[t]=1}),ot.TweenMax=ot.TweenLite=Zt,ot.TimelineLite=ot.TimelineMax=Xt,I=new Xt({sortChildren:!1,defaults:V,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),q.stringFilter=Fb;function Ec(t){return(ye[t]||Te).map(function(t){return t()})}function Fc(){var t=Date.now(),o=[];20&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e}function ya(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[r]===e&&(t[r]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null}function za(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0}function Aa(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t}function Ca(t,e,r,i){return t._startAt&&(L?t._startAt.revert(ht):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))}function Ea(t){return t._repeat?Tt(t._tTime,t=t.duration()+t._rDelay)*t:0}function Ga(t,e){return(t-e._start)*e._ts+(0<=e._ts?0:e._dirty?e.totalDuration():e._tDur)}function Ha(t){return t._end=ja(t._start+(t._tDur/Math.abs(t._ts||t._rts||X)||0))}function Ia(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=ja(r._time-(0X)&&e.render(r,!0)),Aa(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur(n=Math.abs(n))&&(a=i,o=n);return a}function tb(t){return za(t),t.scrollTrigger&&t.scrollTrigger.kill(!!L),t.progress()<1&&At(t,"onInterrupt"),t}function wb(t){if(x()&&t){var e=(t=!t.name&&t.default||t).name,r=s(t),i=e&&!r&&t.init?function(){this._props=[]}:t,n={init:T,render:he,add:Qt,kill:ce,modifier:fe,rawVars:0},a={targetTest:0,get:0,getSetter:ne,aliases:{},register:0};if(Ft(),t!==i){if(pt[e])return;qa(i,qa(ua(t,n),a)),yt(i.prototype,yt(n,ua(t,a))),pt[i.prop=e]=i,t.targetTest&&(gt.push(i),ft[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}S(e,i),t.register&&t.register(Ee,i,_e)}else t&&Ct.push(t)}function zb(t,e,r){return(6*(t+=t<0?1:1>16,e>>8&St,e&St]:0:Et.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Et[e])p=Et[e];else if("#"===e.charAt(0)){if(e.length<6&&(e="#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(s=e.charAt(3))+s+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&St,p&St,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&St,e&St]}else if("hsl"===e.substr(0,3))if(p=d=e.match(tt),r){if(~e.indexOf("="))return p=e.match(et),i&&p.length<4&&(p[3]=1),p}else o=+p[0]%360/360,u=p[1]/100,n=2*(h=p[2]/100)-(a=h<=.5?h*(u+1):h+u-h*u),3=U?u.endTime(!1):t._dur;return r(e)&&(isNaN(e)||e in o)?(a=e.charAt(0),s="%"===e.substr(-1),n=e.indexOf("="),"<"===a||">"===a?(0<=n&&(e=e.replace(/=/,"")),("<"===a?u._start:u.endTime(0<=u._repeat))+(parseFloat(e.substr(1))||0)*(s?(n<0?u:i).totalDuration()/100:1)):n<0?(e in o||(o[e]=h),o[e]):(a=parseFloat(e.charAt(n-1)+e.substr(n+1)),s&&i&&(a=a/100*($(i)?i[0]:i).totalDuration()),1=r&&te)return i;i=i._next}else for(i=t._last;i&&i._start>=r;){if("isPause"===i.data&&i._start=n._start)&&n._ts&&h!==n){if(n.parent!==this)return this.render(t,e,r);if(n.render(0=this.totalDuration()||!v&&_)&&(f!==this._start&&Math.abs(l)===Math.abs(this._ts)||this._lock||(!t&&g||!(v===m&&0=i&&(a instanceof Zt?e&&n.push(a):(r&&n.push(a),t&&n.push.apply(n,a.getChildren(!0,e,r)))),a=a._next;return n},e.getById=function getById(t){for(var e=this.getChildren(1,1,1),r=e.length;r--;)if(e[r].vars.id===t)return e[r]},e.remove=function remove(t){return r(t)?this.removeLabel(t):s(t)?this.killTweensOf(t):(ya(this,t),t===this._recent&&(this._recent=this._last),Aa(this))},e.totalTime=function totalTime(t,e){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ja(Rt.time-(0r:!r||s.isActive())&&n.push(s):(i=s.getTweensOf(a,r)).length&&n.push.apply(n,i),s=s._next;return n},e.tweenTo=function tweenTo(t,e){e=e||{};var r,i=this,n=xt(i,t),a=e.startAt,s=e.onStart,o=e.onStartParams,u=e.immediateRender,h=Zt.to(i,qa({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:n,overwrite:"auto",duration:e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale())||X,onStart:function onStart(){if(i.pause(),!r){var t=e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale());h._dur!==t&&Ra(h,t,0,1).render(h._time,!0,!0),r=1}s&&s.apply(h,o||[])}},e));return u?h.render(0):h},e.tweenFromTo=function tweenFromTo(t,e,r){return this.tweenTo(e,qa({startAt:{time:xt(this,t)}},r))},e.recent=function recent(){return this._recent},e.nextLabel=function nextLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t))},e.previousLabel=function previousLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t),1)},e.currentLabel=function currentLabel(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+X)},e.shiftChildren=function shiftChildren(t,e,r){void 0===r&&(r=0);for(var i,n=this._first,a=this.labels;n;)n._start>=r&&(n._start+=t,n._end+=t),n=n._next;if(e)for(i in a)a[i]>=r&&(a[i]+=t);return Aa(this)},e.invalidate=function invalidate(t){var e=this._first;for(this._lock=0;e;)e.invalidate(t),e=e._next;return i.prototype.invalidate.call(this,t)},e.clear=function clear(t){void 0===t&&(t=!0);for(var e,r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Aa(this)},e.totalDuration=function totalDuration(t){var e,r,i,n=0,a=this,s=a._last,o=U;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(i=a.parent;s;)e=s._prev,s._dirty&&s.totalDuration(),o<(r=s._start)&&a._sort&&s._ts&&!a._lock?(a._lock=1,Ka(a,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(n-=r,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=r/a._ts,a._time-=r,a._tTime-=r),a.shiftChildren(-r,!1,-Infinity),o=0),s._end>n&&s._ts&&(n=s._end),s=e;Ra(a,a===I&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},Timeline.updateRoot=function updateRoot(t){if(I._ts&&(na(I,Ga(t,I)),f=Rt.frame),Rt.frame>=mt){mt+=q.autoSleep||120;var e=I._first;if((!e||!e._ts)&&q.autoSleep&&Rt._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Rt.sleep()}}},Timeline}(Ut);qa(Xt.prototype,{_lock:0,_hasPause:0,_forcing:0});function ac(t,e,i,n,a,o){var u,h,l,f;if(pt[t]&&!1!==(u=new pt[t]).init(a,u.rawVars?e[t]:function _processVars(t,e,i,n,a){if(s(t)&&(t=Kt(t,a,e,i,n)),!v(t)||t.style&&t.nodeType||$(t)||Z(t))return r(t)?Kt(t,a,e,i,n):t;var o,u={};for(o in t)u[o]=Kt(t[o],a,e,i,n);return u}(e[t],n,a,o,i),i,n,o)&&(i._pt=h=new _e(i._pt,a,t,0,1,u.render,u,0,u.priority),i!==c))for(l=i._ptLookup[i._targets.indexOf(a)],f=u._props.length;f--;)l[u._props[f]]=h;return u}function gc(t,r,e,i){var n,a,s=r.ease||i||"power1.inOut";if($(r))a=e[t]||(e[t]=[]),r.forEach(function(t,e){return a.push({t:e/(r.length-1)*100,v:t,e:s})});else for(n in r)a=e[n]||(e[n]=[]),"ease"===n||a.push({t:parseFloat(t),v:r[n],e:s})}var Nt,Wt,Qt=function _addPropTween(t,e,i,n,a,o,u,h,l,f){s(n)&&(n=n(a||0,t,o));var c,d=t[e],p="get"!==i?i:s(d)?l?t[e.indexOf("set")||!s(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():d,_=s(d)?l?re:te:$t;if(r(n)&&(~n.indexOf("random(")&&(n=ob(n)),"="===n.charAt(1)&&(!(c=ka(p,n)+(Ya(p)||0))&&0!==c||(n=c))),!f||p!==n||Wt)return isNaN(p*n)||""===n?(d||e in t||Q(e,n),function _addComplexStringPropTween(t,e,r,i,n,a,s){var o,u,h,l,f,c,d,p,_=new _e(this._pt,t,e,0,1,ue,null,n),m=0,g=0;for(_.b=r,_.e=i,r+="",(d=~(i+="").indexOf("random("))&&(i=ob(i)),a&&(a(p=[r,i],t,e),r=p[0],i=p[1]),u=r.match(it)||[];o=it.exec(i);)l=o[0],f=i.substring(m,o.index),h?h=(h+1)%5:"rgba("===f.substr(-5)&&(h=1),l!==u[g++]&&(c=parseFloat(u[g-1])||0,_._pt={_next:_._pt,p:f||1===g?f:",",s:c,c:"="===l.charAt(1)?ka(c,l)-c:parseFloat(l)-c,m:h&&h<4?Math.round:0},m=it.lastIndex);return _.c=m")}),s.duration();else{for(l in u={},x)"ease"===l||"easeEach"===l||gc(l,x[l],u,x.easeEach);for(l in u)for(C=u[l].sort(function(t,e){return t.t-e.t}),o=D=0;o=t._tDur||e<0)&&t.ratio===u&&(u&&za(t,1),r||L||(At(t,u?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,r);return this},e.targets=function targets(){return this._targets},e.invalidate=function invalidate(t){return t&&this.vars.runBackwards||(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),z.prototype.invalidate.call(this,t)},e.resetTo=function resetTo(t,e,r,i){d||Rt.wake(),this._ts||this.play();var n,a=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Gt(this,a),n=this._ease(a/this._dur),function _updatePropTweens(t,e,r,i,n,a,s){var o,u,h,l,f=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!f)for(f=t._ptCache[e]=[],h=t._ptLookup,l=t._targets.length;l--;){if((o=h[l][e])&&o.d&&o.d._pt)for(o=o.d._pt;o&&o.p!==e&&o.fp!==e;)o=o._next;if(!o)return Wt=1,t.vars[e]="+=0",Gt(t,s),Wt=0,1;f.push(o)}for(l=f.length;l--;)(o=(u=f[l])._pt||u).s=!i&&0!==i||n?o.s+(i||0)+a*o.c:i,o.c=r-o.s,u.e&&(u.e=ia(r)+Ya(u.e)),u.b&&(u.b=o.s+Ya(u.b))}(this,t,e,r,i,n,a)?this.resetTo(t,e,r,i):(Ia(this,0),this.parent||xa(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function kill(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?tb(this):this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Nt&&!0!==Nt.vars.overwrite)._first||tb(this),this.parent&&i!==this.timeline.totalDuration()&&Ra(this,this._dur*this.timeline._tDur/i,0,1),this}var n,a,s,o,u,h,l,f=this._targets,c=t?Ot(t):f,d=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function _arraysMatch(t,e){for(var r=t.length,i=r===e.length;i&&r--&&t[r]===e[r];);return r<0}(f,c))return"all"===e&&(this._pt=0),tb(this);for(n=this._op=this._op||[],"all"!==e&&(r(e)&&(u={},ha(e,function(t){return u[t]=1}),e=u),e=function _addAliasesToVars(t,e){var r,i,n,a,s=t[0]?fa(t[0]).harness:0,o=s&&s.aliases;if(!o)return e;for(i in r=yt({},e),o)if(i in r)for(n=(a=o[i].split(",")).length;n--;)r[a[n]]=r[i];return r}(f,e)),l=f.length;l--;)if(~c.indexOf(f[l]))for(u in a=d[l],"all"===e?(n[l]=e,o=a,s={}):(s=n[l]=n[l]||{},o=e),o)(h=a&&a[u])&&("kill"in h.d&&!0!==h.d.kill(u)||ya(this,h,"_pt"),delete a[u]),"all"!==s&&(s[u]=1);return this._initted&&!this._pt&&p&&tb(this),this},Tween.to=function to(t,e,r){return new Tween(t,e,r)},Tween.from=function from(t,e){return Va(1,arguments)},Tween.delayedCall=function delayedCall(t,e,r,i){return new Tween(e,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:e,onReverseComplete:e,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})},Tween.fromTo=function fromTo(t,e,r){return Va(2,arguments)},Tween.set=function set(t,e){return e.duration=0,e.repeatDelay||(e.repeat=0),new Tween(t,e)},Tween.killTweensOf=function killTweensOf(t,e,r){return I.killTweensOf(t,e,r)},Tween}(Ut);qa(Zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ha("staggerTo,staggerFrom,staggerFromTo",function(r){Zt[r]=function(){var t=new Xt,e=Mt.call(arguments,0);return e.splice("staggerFromTo"===r?5:4,0,0),t[r].apply(t,e)}});function oc(t,e,r){return t.setAttribute(e,r)}function wc(t,e,r,i){i.mSet(t,e,i.m.call(i.tween,r,i.mt),i)}var $t=function _setterPlain(t,e,r){return t[e]=r},te=function _setterFunc(t,e,r){return t[e](r)},re=function _setterFuncWithParam(t,e,r,i){return t[e](i.fp,r)},ne=function _getSetter(t,e){return s(t[e])?te:u(t[e])&&t.setAttribute?oc:$t},ae=function _renderPlain(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},se=function _renderBoolean(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ue=function _renderComplexString(t,e){var r=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*t):Math.round(1e4*(r.s+r.c*t))/1e4)+i,r=r._next;i+=e.c}e.set(e.t,e.p,i,e)},he=function _renderPropTweens(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},fe=function _addPluginModifier(t,e,r,i){for(var n,a=this._pt;a;)n=a._next,a.p===i&&a.modifier(t,e,r),a=n},ce=function _killPropTweensOf(t){for(var e,r,i=this._pt;i;)r=i._next,i.p===t&&!i.op||i.op===t?ya(this,i,"_pt"):i.dep||(e=1),i=r;return!e},pe=function _sortPropTweensByPriority(t){for(var e,r,i,n,a=t._pt;a;){for(e=a._next,r=i;r&&r.pr>a.pr;)r=r._next;(a._prev=r?r._prev:n)?a._prev._next=a:i=a,(a._next=r)?r._prev=a:n=a,a=e}t._pt=i},_e=(PropTween.prototype.modifier=function modifier(t,e,r){this.mSet=this.mSet||this.set,this.set=wc,this.m=t,this.mt=r,this.tween=e},PropTween);function PropTween(t,e,r,i,n,a,s,o,u){this.t=e,this.s=i,this.c=n,this.p=r,this.r=a||ae,this.d=s||this,this.set=o||$t,this.pr=u||0,(this._next=t)&&(t._prev=this)}ha(vt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(t){return ft[t]=1}),ot.TweenMax=ot.TweenLite=Zt,ot.TimelineLite=ot.TimelineMax=Xt,I=new Xt({sortChildren:!1,defaults:V,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),q.stringFilter=Fb;function Ec(t){return(ye[t]||Te).map(function(t){return t()})}function Fc(){var t=Date.now(),o=[];20&&r[r.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var a,r,u=t.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(a=u.next()).done;)i.push(a.value)}catch(e){r={error:e}}finally{try{a&&!a.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}return i}function h(e,n,t){if(t||2===arguments.length)for(var a,r=0,u=n.length;r=r&&(-1===u||a[u]>a[i])&&(u=i);a[u]=r}return[t,a]}(n.x.shape,a.perm),2),u=r[0],i=r[1],o=!0,d=0;d0?0:i-o),m=0;m+=d*s.leftPad.length;for(var f=0;f0){y(e[c+l-1]);for(f=0;f0){var i=t[0];if(0!==i)throw new Error("First split value must be 0, got ".concat(i));for(var s=1;s=i;if(!(o=o&&t[s]<=r))throw new Error("Invalid split value ".concat(t[s],", must be in [").concat(i,", ").concat(r,"]"));i=t[s]}if(i!==r)throw new Error("Last split value must be data size. Expected ".concat(r,", got ").concat(i))}var d=u-1,p=n.util.getArrayFromDType("int32",u);if(0===r||0===u){var l=new Array(r);for(s=0;s<=d;++s)p[s]=0;return[l,p]}p[0]=0;var c=function(e){var n=t[e]-t[e-1],r=0;m.nGramWidths.forEach((function(e){r+=a.getNumNGrams(n,e)})),m.preserveShort&&n>0&&0===r&&(r=1),p[e]=p[e-1]+r},m=this;for(s=1;s<=d;++s)c(s);var f=new Array(p[d]),h=function(n){var r=t[n],u=p[n];if(b.nGramWidths.forEach((function(i){var s=t[n+1]-t[n],o=a.getNumNGrams(s,i);a.createNGrams(e,r,f,u,o,i),u+=o})),b.preserveShort&&u===p[n]){var i=t[n+1]-t[n];if(0===i)return"continue";var s=i+2*b.padWidth;b.createNGrams(e,r,f,u,1,s)}},b=this;for(s=0;s0}));if(1===s.length)return M({inputs:{x:s[0]},backend:a});var o=a.makeOutput(i,t[0].dtype);if(0===n.util.sizeFromShape(i))return o;if("string"===s[0].dtype){var d=s.map((function(e){var t=n.util.sizeFromShape(e.shape.slice(r));return Z({inputs:{x:e},backend:a,attrs:{shape:[-1,t]}})})),p=d.map((function(e){return{vals:a.readSync(e.dataId),shape:e.shape}}));i=n.backend_util.computeOutShape(d.map((function(e){return e.shape})),1);var l=1===d[0].shape[0],c=function(e,t,a,r){var u=n.util.getArrayFromDType(a,n.util.sizeFromShape(t));if(r&&"string"!==a){var i=0;e.forEach((function(e){var t=n.util.sizeFromShape(e.shape);u.set(e.vals,i),i+=t}))}else{var s=0;e.forEach((function(e){for(var r="string"===a?n.backend_util.fromUint8ToStringArray(e.vals):e.vals,i=0,o=0;o=0,(function(){return"GatherV2: the index value ".concat(t," is not in [0, ").concat(c-1,"]")}))},f=0;f1)return n.util.makeZerosTypedArray(0,r);var u=Math.abs(Math.ceil((t-e)/a)),i=n.util.makeZerosTypedArray(u,r);t1||1===m?1:n.util.sizeFromShape(u.shape.slice(1));return ia(s,o,d,f,l),p},setupFunc:function(e){ia=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}},pa=y(n.Selu);var la={kernelName:"Sigmoid",backendName:"wasm",setupFunc:function(e){oa=e.wasm.cwrap(n.Sigmoid,null,["number","number"])},kernelFunc:function(e){var t=e.backend,a=e.inputs.x,r=t.dataIdMap.get(a.dataId).id,u=t.makeOutput(a.shape,a.dtype),i=t.dataIdMap.get(u.dataId).id;return 0===n.util.sizeFromShape(u.shape)||oa(r,i),u}},ca=y(n.Sign),ma=y(n.Sin),fa=y(n.Sinh),ha=y(n.Softplus);var ba,ya={kernelName:n.SpaceToBatchND,backendName:"wasm",kernelFunc:function(e){var t=e.inputs,a=e.backend,r=e.attrs,u=t.x,i=r.blockShape,s=r.paddings,o=n.util.sizeFromShape(i),d=[[0,0]];d.push.apply(d,h([],f(s),!1));for(var p=1+i.length;p0?p+1:0;if(l<0)throw new Error(n.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());var c=u.shape.slice();c[0]=l;var m=a.dataIdMap.get(u.dataId).id,f=a.dataIdMap.get(i.dataId).id,h=a.dataIdMap.get(o.dataId).id,b=a.makeOutput(c,u.dtype),y=a.dataIdMap.get(b.dataId).id,_=a.makeOutput([4],"int32"),g=a.dataIdMap.get(_.dataId).id;va(m,s[u.dtype],u.shape[0],f,h,y,g,t,0);var v,k=a.readSync(_.dataId);switch(k[0]){case 0:v=n.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage();break;case 1:v=n.backend_util.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage();break;case 2:v=n.backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(k[1],k[2]);break;case 3:v=n.backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(k[1],k[2],k[3]);break;default:v=""}if(a.disposeData(_.dataId),v)throw a.disposeData(b.dataId),new Error(v);return b}var Sa={kernelName:n.SparseSegmentMean,backendName:"wasm",setupFunc:Ia,kernelFunc:function(e){return wa(e,!0)}};var Ma,Aa={kernelName:n.SparseSegmentSum,backendName:"wasm",setupFunc:Ia,kernelFunc:function(e){return wa(e,!1)}};var xa={kernelName:n.SparseToDense,backendName:"wasm",setupFunc:function(e){Ma=e.wasm.cwrap(n.SparseToDense,null,["number","number","number","number","number","number","number","number","array","number","number"])},kernelFunc:function(e){var t=e.backend,a=e.inputs,r=e.attrs,u=a.sparseIndices,i=a.sparseValues,o=a.defaultValue,d=r.outputShape,p=t.makeOutput(d,o.dtype);if(0===n.util.sizeFromShape(d))return p;var l=n.backend_util.calculateShapes(i,u,d),c=l.sliceRank,m=l.numUpdates,f=l.sliceSize,h=l.strides,b=l.outputSize,y=t.dataIdMap.get(u.dataId).id,_=t.dataIdMap.get(i.dataId).id,g=t.dataIdMap.get(o.dataId).id,v=new Uint8Array(new Int32Array(h).buffer),k=t.dataIdMap.get(p.dataId).id;return Ma(y,_,i.shape.length,g,s[o.dtype],c,m,f,v,b,k),p}};var Fa,Na={kernelName:n.SplitV,backendName:"wasm",kernelFunc:function(e){var t=e.inputs,a=e.attrs,r=e.backend,u=t.x,i=a.numOrSizeSplits,s=a.axis,o=n.util.parseAxisParam(s,u.shape)[0],d=n.backend_util.prepareSplitSize(u,i,o),p=new Array(u.shape.length).fill(0),l=u.shape.slice();return d.map((function(e){var n=h([],f(l),!1);n[o]=e;var t=re({inputs:{x:u},attrs:{begin:p,size:n},backend:r});return p[o]+=e,t}))}},Da=y(n.Sqrt),Ra=y(n.Square),Ea=k(n.SquaredDifference);var Pa,Ca={kernelName:n.Step,backendName:"wasm",setupFunc:function(e){Fa=e.wasm.cwrap(n.Step,null,["number","number","number","number"])},kernelFunc:function(e){var n=e.backend,t=e.inputs,a=e.attrs.alpha,r=t.x,u=n.dataIdMap.get(r.dataId).id,i=n.makeOutput(r.shape,r.dtype),o=n.dataIdMap.get(i.dataId).id;return Fa(u,a,s[r.dtype],o),i}};var Wa={kernelName:n.StridedSlice,backendName:"wasm",setupFunc:function(e){Pa=e.wasm.cwrap(n.StridedSlice,null,["number","array","number","array","array","array","array","array","number","number"])},kernelFunc:function(e){var t,a=e.backend,r=e.inputs,u=e.attrs,i=r.x,s=u.begin,o=u.end,d=u.strides,p=u.beginMask,l=u.endMask,c=u.ellipsisMask,m=u.newAxisMask,f=u.shrinkAxisMask,h=n.slice_util.sliceInfo(i.shape,s,o,d,p,l,c,m,f),b=h.finalShapeSparse,y=h.finalShape,_=h.isIdentity,g=h.sliceDim0,v=h.isSimpleSlice,k=h.begin,I=h.end,w=h.strides;if(_)t=Z({inputs:{x:i},backend:a,attrs:{shape:y}});else if(g||v){n.util.assert(i.shape.length>=1,(function(){return"Input must have rank at least 1, got: ".concat(i.shape.length)}));var S=n.slice_util.computeOutShape(k,I,w),M=re({inputs:{x:i},backend:a,attrs:{begin:k,size:S}});t=Z({inputs:{x:M},backend:a,attrs:{shape:y}}),a.disposeData(M.dataId)}else{var A=a.makeOutput(b,"float32"),x=a.dataIdMap.get(i.dataId).id,F=new Uint8Array(new Int32Array(n.util.computeStrides(i.shape)).buffer),N=new Uint8Array(new Int32Array(k).buffer),D=new Uint8Array(new Int32Array(I).buffer),R=new Uint8Array(new Int32Array(w).buffer),E=new Uint8Array(new Int32Array(b).buffer),P=new Uint8Array(new Int32Array(n.util.computeStrides(b)).buffer),C=a.dataIdMap.get(A.dataId).id;Pa(x,F,i.shape.length,N,D,R,E,P,b.length,C),t=Z({inputs:{x:A},backend:a,attrs:{shape:y}}),a.disposeData(A.dataId)}return t}};var Oa={kernelName:n.StringNGrams,backendName:"wasm",kernelFunc:function(e){var n=e.backend,t=e.inputs,a=e.attrs,r=t.data,u=t.dataSplits,i=a.separator,s=a.nGramWidths,o=a.leftPad,d=a.rightPad,p=a.padWidth,l=a.preserveShortSequences,c=f(function(e,n,t,a,r,u,i,s){return new te(t,a,r,u,i,s).compute(e,n)}(n.readSync(r.dataId),n.readSync(u.dataId),i,s,o,d,p,l),2),m=c[0],h=c[1],b=n.makeOutput([m.length],"string");n.dataIdMap.get(b.dataId).stringBytes=m;var y=n.makeOutput(u.shape,"int32");return n.typedArrayFromHeap(y).set(h),[b,y]}};var Ta={kernelName:n.StringSplit,backendName:"wasm",kernelFunc:function(e){var t=e.backend,a=e.inputs,r=e.attrs,u=a.input,i=a.delimiter,s=r.skipEmpty,o=f(function(e,t,a){for(var r=e.length,u=[],i=0,s=0,o=new Array(r),d=0;d1,m,g,v,y,b,h,I,i.shape.length-1,w,k.length-1,F,t,p,M),S}};var Ya={kernelName:n.Unique,backendName:"wasm",kernelFunc:function(e){var t=e.inputs,a=e.attrs,r=e.backend,u=a.axis,i=t.x,s=function(e,t,a,r){for(var u=n.util.parseAxisParam(t,a)[0],i=[1,a[0],1],s=0;s1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof ce))throw e})),process.on("unhandledRejection",(function(e){throw e})),I=function(e,n){if(te())throw process.exitCode=e,n;var t;(t=n)instanceof ce||O("exiting due to exception: "+t),process.exit(e)},y.inspect=function(){return"[Emscripten Module object]"};var R=void 0;try{R=require("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}or.Worker=R.Worker}else(w||S)&&(S?x=self.location.href:"undefined"!=typeof document&&document.currentScript&&(x=document.currentScript.src),"undefined"!=typeof i&&i&&(x=i),x=0!==x.indexOf("blob:")?x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1):"",M||(_=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},S&&(v=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),g=function(e,n,t){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){200==a.status||0==a.status&&a.response?n(a.response):t()},a.onerror=t,a.send(null)}));M&&"undefined"==typeof performance&&(or.performance=r.performance);var E=console.log.bind(console),P=console.warn.bind(console);M&&(E=function(e){return N.writeSync(1,e+"\n")},P=function(e){return N.writeSync(2,e+"\n")});var C,W=y.print||E,O=y.printErr||P;Object.assign(y,k),k=null,y.arguments&&y.arguments,y.thisProgram&&y.thisProgram,y.quit&&(I=y.quit),y.wasmBinary&&(C=y.wasmBinary);var T,z,B=y.noExitRuntime||!0;"object"!=typeof WebAssembly&&se("no native wasm support detected");var H,L,G,U,j,q,V,K=!1,X="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Q(e,n,t){for(var a=(n>>>=0)+t,r=n;e[r]&&!(r>=a);)++r;if(r-n>16&&e.buffer&&X)return X.decode(e.buffer instanceof SharedArrayBuffer?e.slice(n,r):e.subarray(n,r));for(var u="";n>10,56320|1023&d)}}else u+=String.fromCharCode((31&i)<<6|s)}else u+=String.fromCharCode(i)}return u}function J(e){L=e,y.HEAP8=G=new Int8Array(e),y.HEAP16=new Int16Array(e),y.HEAP32=j=new Int32Array(e),y.HEAPU8=U=new Uint8Array(e),y.HEAPU16=new Uint16Array(e),y.HEAPU32=q=new Uint32Array(e),y.HEAPF32=new Float32Array(e),y.HEAPF64=V=new Float64Array(e)}A&&(L=y.buffer);var Z,Y=y.INITIAL_MEMORY||16777216;if(A)T=y.wasmMemory,L=y.buffer;else if(y.wasmMemory)T=y.wasmMemory;else if(!((T=new WebAssembly.Memory({initial:Y/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw O("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),M&&O("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");T&&(L=T.buffer),Y=L.byteLength,J(L);var $=[],ee=[],ne=[];function te(){return B}function ae(){A||_e(ee)}var re,ue=0,ie=null;function se(e){y.onAbort&&y.onAbort(e),O(e="Aborted("+e+")"),K=!0,H=1,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw c(n),n}function oe(e){return e.startsWith("data:application/octet-stream;base64,")}function de(e){return e.startsWith("file://")}function pe(e){try{if(e==re&&C)return new Uint8Array(C);if(v)return v(e);throw"both async and sync fetching of the wasm failed"}catch(e){se(e)}}oe(re="tfjs-backend-wasm-threaded-simd.wasm")||(re=F(re));var le={};function ce(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function me(e){var n,t=ye.pthreads[e];t||se(n),ye.returnWorkerToPool(t)}function fe(e){var n=ye.getNewWorker();if(!n)return 6;ye.runningWorkers.push(n),ye.pthreads[e.pthread_ptr]=n,n.pthread_ptr=e.pthread_ptr;var t={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return n.runPthread=function(){M&&n.ref(),n.postMessage(t,e.transferList),delete n.runPthread},n.loaded&&n.runPthread(),0}function he(e){if(A)return xe(1,1,e);H=e,te()||(ye.terminateAllThreads(),y.onExit&&y.onExit(e),K=!0),I(e,new ce(e))}var be=function(e,n){if(H=e,!n&&A)throw ge(e),"unwind";he(e)},ye={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){A?ye.initWorker():ye.initMainThread()},initMainThread:function(){for(var e=8;e--;)ye.allocateUnusedWorker()},initWorker:function(){B=!1},setExitStatus:function(e){H=e},terminateAllThreads:function(){var e,n,t,a;try{for(var r=m(Object.values(ye.pthreads)),u=r.next();!u.done;u=r.next()){var i=u.value;ye.returnWorkerToPool(i)}}catch(n){e={error:n}}finally{try{u&&!u.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}try{for(var s=m(ye.unusedWorkers),o=s.next();!o.done;o=s.next())(i=o.value).terminate()}catch(e){t={error:e}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(t)throw t.error}}ye.unusedWorkers=[]},returnWorkerToPool:function(e){var n=e.pthread_ptr;delete ye.pthreads[n],ye.unusedWorkers.push(e),ye.runningWorkers.splice(ye.runningWorkers.indexOf(e),1),e.pthread_ptr=0,M&&e.unref(),Ve(n)},receiveObjectTransfer:function(e){},threadInitTLS:function(){ye.tlsInitFunctions.forEach((function(e){return e()}))},loadWasmModuleToWorker:function(e,n){var t,a;e.onmessage=function(t){var a,r=t.data,u=r.cmd;if(e.pthread_ptr&&(ye.currentProxiedOperationCallerThread=e.pthread_ptr),r.targetThread&&r.targetThread!=Be()){var i=ye.pthreads[r.targetThread];return i?i.postMessage(r,r.transferList):O('Internal error! Worker sent a message "'+u+'" to target pthread '+r.targetThread+", but that thread no longer exists!"),void(ye.currentProxiedOperationCallerThread=void 0)}"processProxyingQueue"===u?Se(r.queue):"spawnThread"===u?fe(r):"cleanupThread"===u?me(r.thread):"killThread"===u?function(e){var n=ye.pthreads[e];delete ye.pthreads[e],n.terminate(),Ve(e),ye.runningWorkers.splice(ye.runningWorkers.indexOf(n),1),n.pthread_ptr=0}(r.thread):"cancelThread"===u?(a=r.thread,ye.pthreads[a].postMessage({cmd:"cancel"})):"loaded"===u?(e.loaded=!0,M&&e.unref(),n&&n(e),e.runPthread&&e.runPthread()):"print"===u?W("Thread "+r.threadId+": "+r.text):"printErr"===u?O("Thread "+r.threadId+": "+r.text):"alert"===u?alert("Thread "+r.threadId+": "+r.text):"setimmediate"===r.target?e.postMessage(r):"callHandler"===u?y[r.handler].apply(y,h([],f(r.args),!1)):u&&O("worker sent an unknown command "+u),ye.currentProxiedOperationCallerThread=void 0},e.onerror=function(e){throw O("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},M&&(e.on("message",(function(n){e.onmessage({data:n})})),e.on("error",(function(n){e.onerror(n)})),e.on("detachedExit",(function(){})));var r=[];try{for(var u=m(["onExit","onAbort","print","printErr"]),s=u.next();!s.done;s=u.next()){var o=s.value;y.hasOwnProperty(o)&&r.push(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}e.postMessage({cmd:"load",handlers:r,urlOrBlob:y.mainScriptUrlOrBlob||i,wasmMemory:T,wasmModule:z})},allocateUnusedWorker:function(){var e,n=F("tfjs-backend-wasm-threaded-simd.worker.js");e=new Worker(n),ye.unusedWorkers.push(e)},getNewWorker:function(){return 0==ye.unusedWorkers.length&&(ye.allocateUnusedWorker(),ye.loadWasmModuleToWorker(ye.unusedWorkers[0])),ye.unusedWorkers.pop()}};function _e(e){for(;e.length>0;)e.shift()(y)}function ge(e){if(A)return xe(2,0,e);try{be(e)}catch(e){!function(e){if(e instanceof ce||"unwind"==e)return H;I(1,e)}(e)}}y.PThread=ye,y.establishStackSpace=function(){var e=Be(),n=o()[e+52>>>2],t=o()[e+56>>>2];Xe(n,n-t),Je(n)};var ve,ke=[];function Ie(e,n,t,a){return A?xe(3,1,e,n,t,a):we(e,n,t,a)}function we(e,n,t,a){if("undefined"==typeof SharedArrayBuffer)return O("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var r=[];if(A&&0===r.length)return Ie(e,n,t,a);var u={startRoutine:t,pthread_ptr:e,arg:a,transferList:r};return A?(u.cmd="spawnThread",postMessage(u,r),0):fe(u)}function Se(e){Atomics.store(o(),e>>2,1),Be()&&qe(e),Atomics.compareExchange(o(),e>>2,1,0)}function Me(e){Me.shown||(Me.shown={}),Me.shown[e]||(Me.shown[e]=1,M&&(e="warning: "+e),O(e))}function Ae(e){var n=Qe(),t=e();return Je(n),t}function xe(e,n){var t=arguments.length-2,a=arguments;return Ae((function(){for(var r=t,u=Ze(8*r),i=u>>3,s=0;s>>0]=o}return Le(e,r,u,n)}))}y.invokeEntryPoint=function(e,n){var t,a,r=((a=ke[t=e])||(t>=ke.length&&(ke.length=t+1),ke[t]=a=Z.get(t)),a)(n);te()?ye.setExitStatus(r):Ke(r)},y.executeNotifiedProxyingQueue=Se,ve=M?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:function(){return performance.timeOrigin+performance.now()};var Fe=[];function Ne(e){try{return T.grow(e-L.byteLength+65535>>>16),J(T.buffer),1}catch(e){}}function De(e){return A?xe(4,1,e):52}function Re(e,n,t,a,r){return A?xe(5,1,e,n,t,a,r):70}var Ee=[null,[],[]];function Pe(e,n){var t=Ee[e];0===n||10===n?((1===e?W:O)(Q(t,0)),t.length=0):t.push(n)}function Ce(e,n,t,a){if(A)return xe(6,1,e,n,t,a);for(var r=0,u=0;u>>2],o=d()[n+4>>>2];n+=8;for(var p=0;p>>0]);r+=o}return d()[a>>>2]=r,0}function We(e){return y["_"+e]}function Oe(e,t,a,r,u){var i={string:function(e){var n=0;if(null!=e&&0!==e){var t=1+(e.length<<2);!function(e,n,t){!function(e,n,t,a){if(!(a>0))return 0;t>>>=0;for(var r=t+a-1,u=0;u=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++u)),i<=127){if(t>=r)break;n[t++>>>0]=i}else if(i<=2047){if(t+1>=r)break;n[t++>>>0]=192|i>>6,n[t++>>>0]=128|63&i}else if(i<=65535){if(t+2>=r)break;n[t++>>>0]=224|i>>12,n[t++>>>0]=128|i>>6&63,n[t++>>>0]=128|63&i}else{if(t+3>=r)break;n[t++>>>0]=240|i>>18,n[t++>>>0]=128|i>>12&63,n[t++>>>0]=128|i>>6&63,n[t++>>>0]=128|63&i}}n[t>>>0]=0}(e,s(),n,t)}(e,n=Ze(t),t)}return n},array:function(e){var t=Ze(e.length);return function(e,t){n().set(e,t>>>0)}(e,t),t}};function o(e){return"string"===t?(n=e,(n>>>=0)?Q(s(),n,a):""):"boolean"===t?Boolean(e):e;var n,a}var d=We(e),p=[],l=0;if(r)for(var c=0;c>>0,n>>>0,n+t>>>0)},emscripten_num_logical_cores:function(){return M?u.cpus().length:navigator.hardwareConcurrency},emscripten_receive_on_main_thread_js:function(e,n,t){Fe.length=n;for(var a=t>>3,r=0;r>>0];return(e<0?le[-e-1]:Te[e]).apply(null,Fe)},emscripten_resize_heap:function(e){var n=s().length;if((e>>>=0)<=n)return!1;var t=4294901760;if(e>t)return!1;for(var a,r,u=1;u<=4;u*=2){var i=n*(1+.2/u);if(i=Math.min(i,e+100663296),Ne(Math.min(t,(a=Math.max(e,i))+((r=65536)-a%r)%r)))return!0}return!1},emscripten_unwind_to_js_event_loop:function(){throw"unwind"},exit:be,fd_close:De,fd_seek:Re,fd_write:Ce,memory:T||y.wasmMemory};!function(){var e={env:ze,wasi_snapshot_preview1:ze};function n(e,n){var t,a,r=e.exports;if(y.asm=r,t=y.asm._emscripten_tls_init,ye.tlsInitFunctions.push(t),Z=y.asm.__indirect_function_table,a=y.asm.__wasm_call_ctors,ee.unshift(a),z=n,!A){var u=ye.unusedWorkers.length;ye.unusedWorkers.forEach((function(e){ye.loadWasmModuleToWorker(e,(function(){--u||function(e){if(ue--,y.monitorRunDependencies&&y.monitorRunDependencies(ue),0==ue&&ie){var n=ie;ie=null,n()}}()}))}))}}function t(e){n(e.instance,e.module)}function a(n){return function(){if(!C&&(w||S)){if("function"==typeof fetch&&!de(re))return fetch(re,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+re+"'";return e.arrayBuffer()})).catch((function(){return pe(re)}));if(g)return new Promise((function(e,n){g(re,(function(n){e(new Uint8Array(n))}),n)}))}return Promise.resolve().then((function(){return pe(re)}))}().then((function(n){return WebAssembly.instantiate(n,e)})).then((function(e){return e})).then(n,(function(e){O("failed to asynchronously prepare wasm: "+e),se(e)}))}if(A||(ue++,y.monitorRunDependencies&&y.monitorRunDependencies(ue)),y.instantiateWasm)try{return y.instantiateWasm(e,n)}catch(e){O("Module.instantiateWasm callback failed with error: "+e),c(e)}(C||"function"!=typeof WebAssembly.instantiateStreaming||oe(re)||de(re)||M||"function"!=typeof fetch?a(t):fetch(re,{credentials:"same-origin"}).then((function(n){return WebAssembly.instantiateStreaming(n,e).then(t,(function(e){return O("wasm streaming compile failed: "+e),O("falling back to ArrayBuffer instantiation"),a(t)}))}))).catch(c)}(),y.___wasm_call_ctors=function(){return(y.___wasm_call_ctors=y.asm.__wasm_call_ctors).apply(null,arguments)},y._init=function(){return(y._init=y.asm.init).apply(null,arguments)},y._init_with_threads_count=function(){return(y._init_with_threads_count=y.asm.init_with_threads_count).apply(null,arguments)},y._get_threads_count=function(){return(y._get_threads_count=y.asm.get_threads_count).apply(null,arguments)},y._register_tensor=function(){return(y._register_tensor=y.asm.register_tensor).apply(null,arguments)},y._dispose_data=function(){return(y._dispose_data=y.asm.dispose_data).apply(null,arguments)},y._dispose=function(){return(y._dispose=y.asm.dispose).apply(null,arguments)},y._Abs=function(){return(y._Abs=y.asm.Abs).apply(null,arguments)},y._Acos=function(){return(y._Acos=y.asm.Acos).apply(null,arguments)},y._Acosh=function(){return(y._Acosh=y.asm.Acosh).apply(null,arguments)},y._Add=function(){return(y._Add=y.asm.Add).apply(null,arguments)},y._AddN=function(){return(y._AddN=y.asm.AddN).apply(null,arguments)},y._All=function(){return(y._All=y.asm.All).apply(null,arguments)},y._Any=function(){return(y._Any=y.asm.Any).apply(null,arguments)},y._ArgMax=function(){return(y._ArgMax=y.asm.ArgMax).apply(null,arguments)},y._ArgMin=function(){return(y._ArgMin=y.asm.ArgMin).apply(null,arguments)},y._Asin=function(){return(y._Asin=y.asm.Asin).apply(null,arguments)},y._Asinh=function(){return(y._Asinh=y.asm.Asinh).apply(null,arguments)},y._Atan=function(){return(y._Atan=y.asm.Atan).apply(null,arguments)},y._Atan2=function(){return(y._Atan2=y.asm.Atan2).apply(null,arguments)},y._Atanh=function(){return(y._Atanh=y.asm.Atanh).apply(null,arguments)},y._AvgPool=function(){return(y._AvgPool=y.asm.AvgPool).apply(null,arguments)},y._AvgPool3D=function(){return(y._AvgPool3D=y.asm.AvgPool3D).apply(null,arguments)},y._AvgPool3DGrad=function(){return(y._AvgPool3DGrad=y.asm.AvgPool3DGrad).apply(null,arguments)},y._AvgPoolGrad=function(){return(y._AvgPoolGrad=y.asm.AvgPoolGrad).apply(null,arguments)},y._BatchMatMul=function(){return(y._BatchMatMul=y.asm.BatchMatMul).apply(null,arguments)},y._Bincount=function(){return(y._Bincount=y.asm.Bincount).apply(null,arguments)},y._BitwiseAnd=function(){return(y._BitwiseAnd=y.asm.BitwiseAnd).apply(null,arguments)},y._Ceil=function(){return(y._Ceil=y.asm.Ceil).apply(null,arguments)},y._ClipByValue=function(){return(y._ClipByValue=y.asm.ClipByValue).apply(null,arguments)},y._Conv2D=function(){return(y._Conv2D=y.asm.Conv2D).apply(null,arguments)},y._Conv2DBackpropInput=function(){return(y._Conv2DBackpropInput=y.asm.Conv2DBackpropInput).apply(null,arguments)},y._Conv3D=function(){return(y._Conv3D=y.asm.Conv3D).apply(null,arguments)},y._Conv3DBackpropFilterV2=function(){return(y._Conv3DBackpropFilterV2=y.asm.Conv3DBackpropFilterV2).apply(null,arguments)},y._Conv3DBackpropInputV2=function(){return(y._Conv3DBackpropInputV2=y.asm.Conv3DBackpropInputV2).apply(null,arguments)},y._Cos=function(){return(y._Cos=y.asm.Cos).apply(null,arguments)},y._Cosh=function(){return(y._Cosh=y.asm.Cosh).apply(null,arguments)},y._CropAndResize=function(){return(y._CropAndResize=y.asm.CropAndResize).apply(null,arguments)},y._Cumprod=function(){return(y._Cumprod=y.asm.Cumprod).apply(null,arguments)},y._Cumsum=function(){return(y._Cumsum=y.asm.Cumsum).apply(null,arguments)},y._DenseBincount=function(){return(y._DenseBincount=y.asm.DenseBincount).apply(null,arguments)},y._DepthToSpace=function(){return(y._DepthToSpace=y.asm.DepthToSpace).apply(null,arguments)},y._DepthwiseConv2dNative=function(){return(y._DepthwiseConv2dNative=y.asm.DepthwiseConv2dNative).apply(null,arguments)},y._Diag=function(){return(y._Diag=y.asm.Diag).apply(null,arguments)},y._Dilation2D=function(){return(y._Dilation2D=y.asm.Dilation2D).apply(null,arguments)},y._Dilation2DBackpropFilter=function(){return(y._Dilation2DBackpropFilter=y.asm.Dilation2DBackpropFilter).apply(null,arguments)},y._Dilation2DBackpropInput=function(){return(y._Dilation2DBackpropInput=y.asm.Dilation2DBackpropInput).apply(null,arguments)},y._Elu=function(){return(y._Elu=y.asm.Elu).apply(null,arguments)},y._EluGrad=function(){return(y._EluGrad=y.asm.EluGrad).apply(null,arguments)},y._Equal=function(){return(y._Equal=y.asm.Equal).apply(null,arguments)},y._Erf=function(){return(y._Erf=y.asm.Erf).apply(null,arguments)},y._Exp=function(){return(y._Exp=y.asm.Exp).apply(null,arguments)},y._Expm1=function(){return(y._Expm1=y.asm.Expm1).apply(null,arguments)},y._FlipLeftRight=function(){return(y._FlipLeftRight=y.asm.FlipLeftRight).apply(null,arguments)},y._Floor=function(){return(y._Floor=y.asm.Floor).apply(null,arguments)},y._FloorDiv=function(){return(y._FloorDiv=y.asm.FloorDiv).apply(null,arguments)},y._FusedBatchNorm=function(){return(y._FusedBatchNorm=y.asm.FusedBatchNorm).apply(null,arguments)},y._FusedConv2D=function(){return(y._FusedConv2D=y.asm.FusedConv2D).apply(null,arguments)},y._FusedDepthwiseConv2D=function(){return(y._FusedDepthwiseConv2D=y.asm.FusedDepthwiseConv2D).apply(null,arguments)},y._Gather=function(){return(y._Gather=y.asm.Gather).apply(null,arguments)},y._GatherNd=function(){return(y._GatherNd=y.asm.GatherNd).apply(null,arguments)},y._Greater=function(){return(y._Greater=y.asm.Greater).apply(null,arguments)},y._GreaterEqual=function(){return(y._GreaterEqual=y.asm.GreaterEqual).apply(null,arguments)},y._IsFinite=function(){return(y._IsFinite=y.asm.IsFinite).apply(null,arguments)},y._IsInf=function(){return(y._IsInf=y.asm.IsInf).apply(null,arguments)},y._IsNan=function(){return(y._IsNan=y.asm.IsNan).apply(null,arguments)},y._LRN=function(){return(y._LRN=y.asm.LRN).apply(null,arguments)},y._LRNGrad=function(){return(y._LRNGrad=y.asm.LRNGrad).apply(null,arguments)},y._LeakyRelu=function(){return(y._LeakyRelu=y.asm.LeakyRelu).apply(null,arguments)},y._Less=function(){return(y._Less=y.asm.Less).apply(null,arguments)},y._LessEqual=function(){return(y._LessEqual=y.asm.LessEqual).apply(null,arguments)},y._LinSpace=function(){return(y._LinSpace=y.asm.LinSpace).apply(null,arguments)},y._Log=function(){return(y._Log=y.asm.Log).apply(null,arguments)},y._Log1p=function(){return(y._Log1p=y.asm.Log1p).apply(null,arguments)},y._LogicalAnd=function(){return(y._LogicalAnd=y.asm.LogicalAnd).apply(null,arguments)},y._LogicalNot=function(){return(y._LogicalNot=y.asm.LogicalNot).apply(null,arguments)},y._LogicalOr=function(){return(y._LogicalOr=y.asm.LogicalOr).apply(null,arguments)},y._LogicalXor=function(){return(y._LogicalXor=y.asm.LogicalXor).apply(null,arguments)},y._Max=function(){return(y._Max=y.asm.Max).apply(null,arguments)},y._MaxPool=function(){return(y._MaxPool=y.asm.MaxPool).apply(null,arguments)},y._MaxPool3D=function(){return(y._MaxPool3D=y.asm.MaxPool3D).apply(null,arguments)},y._MaxPool3DGrad=function(){return(y._MaxPool3DGrad=y.asm.MaxPool3DGrad).apply(null,arguments)},y._MaxPoolGrad=function(){return(y._MaxPoolGrad=y.asm.MaxPoolGrad).apply(null,arguments)},y._MaxPoolWithArgmax=function(){return(y._MaxPoolWithArgmax=y.asm.MaxPoolWithArgmax).apply(null,arguments)},y._Maximum=function(){return(y._Maximum=y.asm.Maximum).apply(null,arguments)},y._Mean=function(){return(y._Mean=y.asm.Mean).apply(null,arguments)},y._Min=function(){return(y._Min=y.asm.Min).apply(null,arguments)},y._Minimum=function(){return(y._Minimum=y.asm.Minimum).apply(null,arguments)},y._MirrorPad=function(){return(y._MirrorPad=y.asm.MirrorPad).apply(null,arguments)},y._Mod=function(){return(y._Mod=y.asm.Mod).apply(null,arguments)},y._Multinomial=function(){return(y._Multinomial=y.asm.Multinomial).apply(null,arguments)},y._Multiply=function(){return(y._Multiply=y.asm.Multiply).apply(null,arguments)},y._Neg=function(){return(y._Neg=y.asm.Neg).apply(null,arguments)},y._NonMaxSuppressionV3=function(){return(y._NonMaxSuppressionV3=y.asm.NonMaxSuppressionV3).apply(null,arguments)},y._NonMaxSuppressionV4=function(){return(y._NonMaxSuppressionV4=y.asm.NonMaxSuppressionV4).apply(null,arguments)},y._NonMaxSuppressionV5=function(){return(y._NonMaxSuppressionV5=y.asm.NonMaxSuppressionV5).apply(null,arguments)},y._NotEqual=function(){return(y._NotEqual=y.asm.NotEqual).apply(null,arguments)},y._OneHot=function(){return(y._OneHot=y.asm.OneHot).apply(null,arguments)},y._PadV2=function(){return(y._PadV2=y.asm.PadV2).apply(null,arguments)},y._Pow=function(){return(y._Pow=y.asm.Pow).apply(null,arguments)},y._Prelu=function(){return(y._Prelu=y.asm.Prelu).apply(null,arguments)},y._Prod=function(){return(y._Prod=y.asm.Prod).apply(null,arguments)},y._RealDiv=function(){return(y._RealDiv=y.asm.RealDiv).apply(null,arguments)},y._Reciprocal=function(){return(y._Reciprocal=y.asm.Reciprocal).apply(null,arguments)},y._Relu=function(){return(y._Relu=y.asm.Relu).apply(null,arguments)},y._Relu6=function(){return(y._Relu6=y.asm.Relu6).apply(null,arguments)},y._ResizeBilinear=function(){return(y._ResizeBilinear=y.asm.ResizeBilinear).apply(null,arguments)},y._ResizeBilinearGrad=function(){return(y._ResizeBilinearGrad=y.asm.ResizeBilinearGrad).apply(null,arguments)},y._ResizeNearestNeighbor=function(){return(y._ResizeNearestNeighbor=y.asm.ResizeNearestNeighbor).apply(null,arguments)},y._ResizeNearestNeighborGrad=function(){return(y._ResizeNearestNeighborGrad=y.asm.ResizeNearestNeighborGrad).apply(null,arguments)},y._Reverse=function(){return(y._Reverse=y.asm.Reverse).apply(null,arguments)},y._RotateWithOffset=function(){return(y._RotateWithOffset=y.asm.RotateWithOffset).apply(null,arguments)},y._Round=function(){return(y._Round=y.asm.Round).apply(null,arguments)},y._Rsqrt=function(){return(y._Rsqrt=y.asm.Rsqrt).apply(null,arguments)},y._ScatterNd=function(){return(y._ScatterNd=y.asm.ScatterNd).apply(null,arguments)},y._SearchSorted=function(){return(y._SearchSorted=y.asm.SearchSorted).apply(null,arguments)},y._SelectV2=function(){return(y._SelectV2=y.asm.SelectV2).apply(null,arguments)},y._Selu=function(){return(y._Selu=y.asm.Selu).apply(null,arguments)},y._Sigmoid=function(){return(y._Sigmoid=y.asm.Sigmoid).apply(null,arguments)},y._Sign=function(){return(y._Sign=y.asm.Sign).apply(null,arguments)},y._Sin=function(){return(y._Sin=y.asm.Sin).apply(null,arguments)},y._Sinh=function(){return(y._Sinh=y.asm.Sinh).apply(null,arguments)},y._Softmax=function(){return(y._Softmax=y.asm.Softmax).apply(null,arguments)},y._Softplus=function(){return(y._Softplus=y.asm.Softplus).apply(null,arguments)},y._SparseFillEmptyRows=function(){return(y._SparseFillEmptyRows=y.asm.SparseFillEmptyRows).apply(null,arguments)},y._SparseReshape=function(){return(y._SparseReshape=y.asm.SparseReshape).apply(null,arguments)},y._SparseSegmentReduction=function(){return(y._SparseSegmentReduction=y.asm.SparseSegmentReduction).apply(null,arguments)},y._SparseToDense=function(){return(y._SparseToDense=y.asm.SparseToDense).apply(null,arguments)},y._Sqrt=function(){return(y._Sqrt=y.asm.Sqrt).apply(null,arguments)},y._Square=function(){return(y._Square=y.asm.Square).apply(null,arguments)},y._SquaredDifference=function(){return(y._SquaredDifference=y.asm.SquaredDifference).apply(null,arguments)},y._Step=function(){return(y._Step=y.asm.Step).apply(null,arguments)},y._StridedSlice=function(){return(y._StridedSlice=y.asm.StridedSlice).apply(null,arguments)},y._Sub=function(){return(y._Sub=y.asm.Sub).apply(null,arguments)},y._Sum=function(){return(y._Sum=y.asm.Sum).apply(null,arguments)},y._Tan=function(){return(y._Tan=y.asm.Tan).apply(null,arguments)},y._Tanh=function(){return(y._Tanh=y.asm.Tanh).apply(null,arguments)},y._TensorScatterUpdate=function(){return(y._TensorScatterUpdate=y.asm.TensorScatterUpdate).apply(null,arguments)},y._Tile=function(){return(y._Tile=y.asm.Tile).apply(null,arguments)},y._TopK=function(){return(y._TopK=y.asm.TopK).apply(null,arguments)},y._Transform=function(){return(y._Transform=y.asm.Transform).apply(null,arguments)},y._Transpose=function(){return(y._Transpose=y.asm.Transpose).apply(null,arguments)},y.__FusedMatMul=function(){return(y.__FusedMatMul=y.asm._FusedMatMul).apply(null,arguments)},y._malloc=function(){return(y._malloc=y.asm.malloc).apply(null,arguments)},y._free=function(){return(y._free=y.asm.free).apply(null,arguments)},y.__emscripten_tls_init=function(){return(y.__emscripten_tls_init=y.asm._emscripten_tls_init).apply(null,arguments)};var Be=y._pthread_self=function(){return(Be=y._pthread_self=y.asm.pthread_self).apply(null,arguments)};y.___errno_location=function(){return(y.___errno_location=y.asm.__errno_location).apply(null,arguments)};var He=y.__emscripten_thread_init=function(){return(He=y.__emscripten_thread_init=y.asm._emscripten_thread_init).apply(null,arguments)};y.__emscripten_thread_crashed=function(){return(y.__emscripten_thread_crashed=y.asm._emscripten_thread_crashed).apply(null,arguments)},y._emscripten_main_thread_process_queued_calls=function(){return(y._emscripten_main_thread_process_queued_calls=y.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},y._emscripten_main_browser_thread_id=function(){return(y._emscripten_main_browser_thread_id=y.asm.emscripten_main_browser_thread_id).apply(null,arguments)};var Le=y._emscripten_run_in_main_runtime_thread_js=function(){return(Le=y._emscripten_run_in_main_runtime_thread_js=y.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)};y._emscripten_dispatch_to_thread_=function(){return(y._emscripten_dispatch_to_thread_=y.asm.emscripten_dispatch_to_thread_).apply(null,arguments)};var Ge,Ue,je,qe=y.__emscripten_proxy_execute_task_queue=function(){return(qe=y.__emscripten_proxy_execute_task_queue=y.asm._emscripten_proxy_execute_task_queue).apply(null,arguments)},Ve=y.__emscripten_thread_free_data=function(){return(Ve=y.__emscripten_thread_free_data=y.asm._emscripten_thread_free_data).apply(null,arguments)},Ke=y.__emscripten_thread_exit=function(){return(Ke=y.__emscripten_thread_exit=y.asm._emscripten_thread_exit).apply(null,arguments)},Xe=y._emscripten_stack_set_limits=function(){return(Xe=y._emscripten_stack_set_limits=y.asm.emscripten_stack_set_limits).apply(null,arguments)},Qe=y.stackSave=function(){return(Qe=y.stackSave=y.asm.stackSave).apply(null,arguments)},Je=y.stackRestore=function(){return(Je=y.stackRestore=y.asm.stackRestore).apply(null,arguments)},Ze=y.stackAlloc=function(){return(Ze=y.stackAlloc=y.asm.stackAlloc).apply(null,arguments)};function Ye(e){if(!(ue>0)){if(A)return l(y),ae(),void startWorker(y);!function(){if(y.preRun)for("function"==typeof y.preRun&&(y.preRun=[y.preRun]);y.preRun.length;)e=y.preRun.shift(),$.unshift(e);var e;_e($)}(),ue>0||(y.setStatus?(y.setStatus("Running..."),setTimeout((function(){setTimeout((function(){y.setStatus("")}),1),n()}),1)):n())}function n(){Ge||(Ge=!0,y.calledRun=!0,K||(ae(),l(y),y.onRuntimeInitialized&&y.onRuntimeInitialized(),function(){if(!A){if(y.postRun)for("function"==typeof y.postRun&&(y.postRun=[y.postRun]);y.postRun.length;)e=y.postRun.shift(),ne.unshift(e);var e;_e(ne)}}()))}}if(y.dynCall_iijjiiii=function(){return(y.dynCall_iijjiiii=y.asm.dynCall_iijjiiii).apply(null,arguments)},y.dynCall_jiji=function(){return(y.dynCall_jiji=y.asm.dynCall_jiji).apply(null,arguments)},y.keepRuntimeAlive=te,y.wasmMemory=T,y.cwrap=function(e,n,t,a){var r=(t=t||[]).every((function(e){return"number"===e||"boolean"===e}));return"string"!==n&&r&&!a?We(e):function(){return Oe(e,n,t,arguments)}},y.ExitStatus=ce,y.PThread=ye,ie=function e(){Ge||Ye(),Ge||(ie=e)},y.preInit)for("function"==typeof y.preInit&&(y.preInit=[y.preInit]);y.preInit.length>0;)y.preInit.pop()();if(Ye(),b&&(Ue={uncaughtException:process.listeners("uncaughtException").filter((function(e){return!b.uncaughtException.indexOf(e)>-1})),unhandledRejection:process.listeners("unhandledRejection").filter((function(e){return!b.unhandledRejection.indexOf(e)>-1}))}),"undefined"!=typeof WasmBackendModule)je=WasmBackendModule;else{if("undefined"==typeof e)throw new Error("Could not find wasm module in post.js");je=e}if(Ue){var $e=je._dispose;je._dispose=function(){$e(),Ue.uncaughtException.forEach((function(e){process.removeListener("uncaughtException",e)})),Ue.unhandledRejection.forEach((function(e){process.removeListener("unhandledRejection",e)}))}}return e.ready});e.exports=s}(pr);var lr=pr.exports,cr=dr(lr),mr=i({__proto__:null,default:cr},[lr]),fr={exports:{}};!function(e,n){var r,u=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(r=r||__filename),function(e){var n,u,i,s="undefined"!=typeof(e=e||{})?e:{};s.ready=new Promise((function(e,t){n=e,u=t})),"undefined"!=typeof process&&process.listeners&&(i={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var o,d,p,l=Object.assign({},s),c="object"==typeof window,m="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";if(f){var b=t,y=a;h=m?y.dirname(h)+"/":__dirname+"/",o=function(e,n){return e=B(e)?new URL(e):y.normalize(e),b.readFileSync(e,n?void 0:"utf8")},p=function(e){var n=o(e,!0);return n.buffer||(n=new Uint8Array(n)),n},d=function(e,n,t){e=B(e)?new URL(e):y.normalize(e),b.readFile(e,(function(e,a){e?t(e):n(a.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof L))throw e})),process.on("unhandledRejection",(function(e){throw e})),s.inspect=function(){return"[Emscripten Module object]"}}else(c||m)&&(m?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},m&&(p=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),d=function(e,n,t){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){200==a.status||0==a.status&&a.response?n(a.response):t()},a.onerror=t,a.send(null)});var _,g,v=s.print||console.log.bind(console),k=s.printErr||console.warn.bind(console);Object.assign(s,l),l=null,s.arguments&&s.arguments,s.thisProgram&&s.thisProgram,s.quit&&s.quit,s.wasmBinary&&(_=s.wasmBinary),s.noExitRuntime,"object"!=typeof WebAssembly&&T("no native wasm support detected");var I,w,S,M,A=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(e,n,t){for(var a=(n>>>=0)+t,r=n;e[r]&&!(r>=a);)++r;if(r-n>16&&e.buffer&&x)return x.decode(e.subarray(n,r));for(var u="";n>10,56320|1023&d)}}else u+=String.fromCharCode((31&i)<<6|s)}else u+=String.fromCharCode(i)}return u}function N(e){I=e,s.HEAP8=w=new Int8Array(e),s.HEAP16=new Int16Array(e),s.HEAP32=new Int32Array(e),s.HEAPU8=S=new Uint8Array(e),s.HEAPU16=new Uint16Array(e),s.HEAPU32=M=new Uint32Array(e),s.HEAPF32=new Float32Array(e),s.HEAPF64=new Float64Array(e)}s.INITIAL_MEMORY;var D,R,E=[],P=[],C=[],W=0,O=null;function T(e){s.onAbort&&s.onAbort(e),k(e="Aborted("+e+")"),A=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw u(n),n}function z(e){return e.startsWith("data:application/octet-stream;base64,")}function B(e){return e.startsWith("file://")}function H(e){try{if(e==D&&_)return new Uint8Array(_);if(p)return p(e);throw"both async and sync fetching of the wasm failed"}catch(e){T(e)}}function L(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function G(e){for(;e.length>0;)e.shift()(s)}function U(e){try{return g.grow(e-I.byteLength+65535>>>16),N(g.buffer),1}catch(e){}}z(D="tfjs-backend-wasm.wasm")||(R=D,D=s.locateFile?s.locateFile(R,h):h+R);var j=[null,[],[]];function q(e,n){var t=j[e];0===n||10===n?((1===e?v:k)(F(t,0)),t.length=0):t.push(n)}function V(e){return s["_"+e]}function K(e,n,t,a,r){var u={string:function(e){var n=0;if(null!=e&&0!==e){var t=1+(e.length<<2);!function(e,n,t){!function(e,n,t,a){if(!(a>0))return 0;t>>>=0;for(var r=t+a-1,u=0;u=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++u)),i<=127){if(t>=r)break;n[t++>>>0]=i}else if(i<=2047){if(t+1>=r)break;n[t++>>>0]=192|i>>6,n[t++>>>0]=128|63&i}else if(i<=65535){if(t+2>=r)break;n[t++>>>0]=224|i>>12,n[t++>>>0]=128|i>>6&63,n[t++>>>0]=128|63&i}else{if(t+3>=r)break;n[t++>>>0]=240|i>>18,n[t++>>>0]=128|i>>12&63,n[t++>>>0]=128|i>>6&63,n[t++>>>0]=128|63&i}}n[t>>>0]=0}(e,S,n,t)}(e,n=ee(t),t)}return n},array:function(e){var n=ee(e.length);return function(e,n){w.set(e,n>>>0)}(e,n),n}};function i(e){return"string"===n?(t=e,(t>>>=0)?F(S,t,a):""):"boolean"===n?Boolean(e):e;var t,a}var s=V(e),o=[],d=0;if(a)for(var p=0;p>>0,n>>>0,n+t>>>0)},emscripten_resize_heap:function(e){var n=S.length,t=4294901760;if((e>>>=0)>t)return!1;for(var a,r,u=1;u<=4;u*=2){var i=n*(1+.2/u);if(i=Math.min(i,e+100663296),U(Math.min(t,(a=Math.max(e,i))+((r=65536)-a%r)%r)))return!0}return!1},fd_close:function(e){return 52},fd_seek:function(e,n,t,a,r){return 70},fd_write:function(e,n,t,a){for(var r=0,u=0;u>>2],s=M[n+4>>>2];n+=8;for(var o=0;o>>0]);r+=s}return M[a>>>2]=r,0}};!function(){var e={env:X,wasi_snapshot_preview1:X};function n(e,n){var t,a=e.exports;s.asm=a,N((g=s.asm.memory).buffer),s.asm.__indirect_function_table,t=s.asm.__wasm_call_ctors,P.unshift(t),function(e){if(W--,s.monitorRunDependencies&&s.monitorRunDependencies(W),0==W&&O){var n=O;O=null,n()}}()}function t(e){n(e.instance)}function a(n){return function(){if(!_&&(c||m)){if("function"==typeof fetch&&!B(D))return fetch(D,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+D+"'";return e.arrayBuffer()})).catch((function(){return H(D)}));if(d)return new Promise((function(e,n){d(D,(function(n){e(new Uint8Array(n))}),n)}))}return Promise.resolve().then((function(){return H(D)}))}().then((function(n){return WebAssembly.instantiate(n,e)})).then((function(e){return e})).then(n,(function(e){k("failed to asynchronously prepare wasm: "+e),T(e)}))}if(W++,s.monitorRunDependencies&&s.monitorRunDependencies(W),s.instantiateWasm)try{return s.instantiateWasm(e,n)}catch(e){k("Module.instantiateWasm callback failed with error: "+e),u(e)}(_||"function"!=typeof WebAssembly.instantiateStreaming||z(D)||B(D)||f||"function"!=typeof fetch?a(t):fetch(D,{credentials:"same-origin"}).then((function(n){return WebAssembly.instantiateStreaming(n,e).then(t,(function(e){return k("wasm streaming compile failed: "+e),k("falling back to ArrayBuffer instantiation"),a(t)}))}))).catch(u)}(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.__wasm_call_ctors).apply(null,arguments)},s._init=function(){return(s._init=s.asm.init).apply(null,arguments)},s._init_with_threads_count=function(){return(s._init_with_threads_count=s.asm.init_with_threads_count).apply(null,arguments)},s._get_threads_count=function(){return(s._get_threads_count=s.asm.get_threads_count).apply(null,arguments)},s._register_tensor=function(){return(s._register_tensor=s.asm.register_tensor).apply(null,arguments)},s._dispose_data=function(){return(s._dispose_data=s.asm.dispose_data).apply(null,arguments)},s._dispose=function(){return(s._dispose=s.asm.dispose).apply(null,arguments)},s._Abs=function(){return(s._Abs=s.asm.Abs).apply(null,arguments)},s._Acos=function(){return(s._Acos=s.asm.Acos).apply(null,arguments)},s._Acosh=function(){return(s._Acosh=s.asm.Acosh).apply(null,arguments)},s._Add=function(){return(s._Add=s.asm.Add).apply(null,arguments)},s._AddN=function(){return(s._AddN=s.asm.AddN).apply(null,arguments)},s._All=function(){return(s._All=s.asm.All).apply(null,arguments)},s._Any=function(){return(s._Any=s.asm.Any).apply(null,arguments)},s._ArgMax=function(){return(s._ArgMax=s.asm.ArgMax).apply(null,arguments)},s._ArgMin=function(){return(s._ArgMin=s.asm.ArgMin).apply(null,arguments)},s._Asin=function(){return(s._Asin=s.asm.Asin).apply(null,arguments)},s._Asinh=function(){return(s._Asinh=s.asm.Asinh).apply(null,arguments)},s._Atan=function(){return(s._Atan=s.asm.Atan).apply(null,arguments)},s._Atan2=function(){return(s._Atan2=s.asm.Atan2).apply(null,arguments)},s._Atanh=function(){return(s._Atanh=s.asm.Atanh).apply(null,arguments)},s._AvgPool=function(){return(s._AvgPool=s.asm.AvgPool).apply(null,arguments)},s._AvgPool3D=function(){return(s._AvgPool3D=s.asm.AvgPool3D).apply(null,arguments)},s._AvgPool3DGrad=function(){return(s._AvgPool3DGrad=s.asm.AvgPool3DGrad).apply(null,arguments)},s._AvgPoolGrad=function(){return(s._AvgPoolGrad=s.asm.AvgPoolGrad).apply(null,arguments)},s._BatchMatMul=function(){return(s._BatchMatMul=s.asm.BatchMatMul).apply(null,arguments)},s._Bincount=function(){return(s._Bincount=s.asm.Bincount).apply(null,arguments)},s._BitwiseAnd=function(){return(s._BitwiseAnd=s.asm.BitwiseAnd).apply(null,arguments)},s._Ceil=function(){return(s._Ceil=s.asm.Ceil).apply(null,arguments)},s._ClipByValue=function(){return(s._ClipByValue=s.asm.ClipByValue).apply(null,arguments)},s._Conv2D=function(){return(s._Conv2D=s.asm.Conv2D).apply(null,arguments)},s._Conv2DBackpropInput=function(){return(s._Conv2DBackpropInput=s.asm.Conv2DBackpropInput).apply(null,arguments)},s._Conv3D=function(){return(s._Conv3D=s.asm.Conv3D).apply(null,arguments)},s._Conv3DBackpropFilterV2=function(){return(s._Conv3DBackpropFilterV2=s.asm.Conv3DBackpropFilterV2).apply(null,arguments)},s._Conv3DBackpropInputV2=function(){return(s._Conv3DBackpropInputV2=s.asm.Conv3DBackpropInputV2).apply(null,arguments)},s._Cos=function(){return(s._Cos=s.asm.Cos).apply(null,arguments)},s._Cosh=function(){return(s._Cosh=s.asm.Cosh).apply(null,arguments)},s._CropAndResize=function(){return(s._CropAndResize=s.asm.CropAndResize).apply(null,arguments)},s._Cumprod=function(){return(s._Cumprod=s.asm.Cumprod).apply(null,arguments)},s._Cumsum=function(){return(s._Cumsum=s.asm.Cumsum).apply(null,arguments)},s._DenseBincount=function(){return(s._DenseBincount=s.asm.DenseBincount).apply(null,arguments)},s._DepthToSpace=function(){return(s._DepthToSpace=s.asm.DepthToSpace).apply(null,arguments)},s._DepthwiseConv2dNative=function(){return(s._DepthwiseConv2dNative=s.asm.DepthwiseConv2dNative).apply(null,arguments)},s._Diag=function(){return(s._Diag=s.asm.Diag).apply(null,arguments)},s._Dilation2D=function(){return(s._Dilation2D=s.asm.Dilation2D).apply(null,arguments)},s._Dilation2DBackpropFilter=function(){return(s._Dilation2DBackpropFilter=s.asm.Dilation2DBackpropFilter).apply(null,arguments)},s._Dilation2DBackpropInput=function(){return(s._Dilation2DBackpropInput=s.asm.Dilation2DBackpropInput).apply(null,arguments)},s._Elu=function(){return(s._Elu=s.asm.Elu).apply(null,arguments)},s._EluGrad=function(){return(s._EluGrad=s.asm.EluGrad).apply(null,arguments)},s._Equal=function(){return(s._Equal=s.asm.Equal).apply(null,arguments)},s._Erf=function(){return(s._Erf=s.asm.Erf).apply(null,arguments)},s._Exp=function(){return(s._Exp=s.asm.Exp).apply(null,arguments)},s._Expm1=function(){return(s._Expm1=s.asm.Expm1).apply(null,arguments)},s._FlipLeftRight=function(){return(s._FlipLeftRight=s.asm.FlipLeftRight).apply(null,arguments)},s._Floor=function(){return(s._Floor=s.asm.Floor).apply(null,arguments)},s._FloorDiv=function(){return(s._FloorDiv=s.asm.FloorDiv).apply(null,arguments)},s._FusedBatchNorm=function(){return(s._FusedBatchNorm=s.asm.FusedBatchNorm).apply(null,arguments)},s._FusedConv2D=function(){return(s._FusedConv2D=s.asm.FusedConv2D).apply(null,arguments)},s._FusedDepthwiseConv2D=function(){return(s._FusedDepthwiseConv2D=s.asm.FusedDepthwiseConv2D).apply(null,arguments)},s._Gather=function(){return(s._Gather=s.asm.Gather).apply(null,arguments)},s._GatherNd=function(){return(s._GatherNd=s.asm.GatherNd).apply(null,arguments)},s._Greater=function(){return(s._Greater=s.asm.Greater).apply(null,arguments)},s._GreaterEqual=function(){return(s._GreaterEqual=s.asm.GreaterEqual).apply(null,arguments)},s._IsFinite=function(){return(s._IsFinite=s.asm.IsFinite).apply(null,arguments)},s._IsInf=function(){return(s._IsInf=s.asm.IsInf).apply(null,arguments)},s._IsNan=function(){return(s._IsNan=s.asm.IsNan).apply(null,arguments)},s._LRN=function(){return(s._LRN=s.asm.LRN).apply(null,arguments)},s._LRNGrad=function(){return(s._LRNGrad=s.asm.LRNGrad).apply(null,arguments)},s._LeakyRelu=function(){return(s._LeakyRelu=s.asm.LeakyRelu).apply(null,arguments)},s._Less=function(){return(s._Less=s.asm.Less).apply(null,arguments)},s._LessEqual=function(){return(s._LessEqual=s.asm.LessEqual).apply(null,arguments)},s._LinSpace=function(){return(s._LinSpace=s.asm.LinSpace).apply(null,arguments)},s._Log=function(){return(s._Log=s.asm.Log).apply(null,arguments)},s._Log1p=function(){return(s._Log1p=s.asm.Log1p).apply(null,arguments)},s._LogicalAnd=function(){return(s._LogicalAnd=s.asm.LogicalAnd).apply(null,arguments)},s._LogicalNot=function(){return(s._LogicalNot=s.asm.LogicalNot).apply(null,arguments)},s._LogicalOr=function(){return(s._LogicalOr=s.asm.LogicalOr).apply(null,arguments)},s._LogicalXor=function(){return(s._LogicalXor=s.asm.LogicalXor).apply(null,arguments)},s._Max=function(){return(s._Max=s.asm.Max).apply(null,arguments)},s._MaxPool=function(){return(s._MaxPool=s.asm.MaxPool).apply(null,arguments)},s._MaxPool3D=function(){return(s._MaxPool3D=s.asm.MaxPool3D).apply(null,arguments)},s._MaxPool3DGrad=function(){return(s._MaxPool3DGrad=s.asm.MaxPool3DGrad).apply(null,arguments)},s._MaxPoolGrad=function(){return(s._MaxPoolGrad=s.asm.MaxPoolGrad).apply(null,arguments)},s._MaxPoolWithArgmax=function(){return(s._MaxPoolWithArgmax=s.asm.MaxPoolWithArgmax).apply(null,arguments)},s._Maximum=function(){return(s._Maximum=s.asm.Maximum).apply(null,arguments)},s._Mean=function(){return(s._Mean=s.asm.Mean).apply(null,arguments)},s._Min=function(){return(s._Min=s.asm.Min).apply(null,arguments)},s._Minimum=function(){return(s._Minimum=s.asm.Minimum).apply(null,arguments)},s._MirrorPad=function(){return(s._MirrorPad=s.asm.MirrorPad).apply(null,arguments)},s._Mod=function(){return(s._Mod=s.asm.Mod).apply(null,arguments)},s._Multinomial=function(){return(s._Multinomial=s.asm.Multinomial).apply(null,arguments)},s._Multiply=function(){return(s._Multiply=s.asm.Multiply).apply(null,arguments)},s._Neg=function(){return(s._Neg=s.asm.Neg).apply(null,arguments)},s._NonMaxSuppressionV3=function(){return(s._NonMaxSuppressionV3=s.asm.NonMaxSuppressionV3).apply(null,arguments)},s._NonMaxSuppressionV4=function(){return(s._NonMaxSuppressionV4=s.asm.NonMaxSuppressionV4).apply(null,arguments)},s._NonMaxSuppressionV5=function(){return(s._NonMaxSuppressionV5=s.asm.NonMaxSuppressionV5).apply(null,arguments)},s._NotEqual=function(){return(s._NotEqual=s.asm.NotEqual).apply(null,arguments)},s._OneHot=function(){return(s._OneHot=s.asm.OneHot).apply(null,arguments)},s._PadV2=function(){return(s._PadV2=s.asm.PadV2).apply(null,arguments)},s._Pow=function(){return(s._Pow=s.asm.Pow).apply(null,arguments)},s._Prelu=function(){return(s._Prelu=s.asm.Prelu).apply(null,arguments)},s._Prod=function(){return(s._Prod=s.asm.Prod).apply(null,arguments)},s._RealDiv=function(){return(s._RealDiv=s.asm.RealDiv).apply(null,arguments)},s._Reciprocal=function(){return(s._Reciprocal=s.asm.Reciprocal).apply(null,arguments)},s._Relu=function(){return(s._Relu=s.asm.Relu).apply(null,arguments)},s._Relu6=function(){return(s._Relu6=s.asm.Relu6).apply(null,arguments)},s._ResizeBilinear=function(){return(s._ResizeBilinear=s.asm.ResizeBilinear).apply(null,arguments)},s._ResizeBilinearGrad=function(){return(s._ResizeBilinearGrad=s.asm.ResizeBilinearGrad).apply(null,arguments)},s._ResizeNearestNeighbor=function(){return(s._ResizeNearestNeighbor=s.asm.ResizeNearestNeighbor).apply(null,arguments)},s._ResizeNearestNeighborGrad=function(){return(s._ResizeNearestNeighborGrad=s.asm.ResizeNearestNeighborGrad).apply(null,arguments)},s._Reverse=function(){return(s._Reverse=s.asm.Reverse).apply(null,arguments)},s._RotateWithOffset=function(){return(s._RotateWithOffset=s.asm.RotateWithOffset).apply(null,arguments)},s._Round=function(){return(s._Round=s.asm.Round).apply(null,arguments)},s._Rsqrt=function(){return(s._Rsqrt=s.asm.Rsqrt).apply(null,arguments)},s._ScatterNd=function(){return(s._ScatterNd=s.asm.ScatterNd).apply(null,arguments)},s._SearchSorted=function(){return(s._SearchSorted=s.asm.SearchSorted).apply(null,arguments)},s._SelectV2=function(){return(s._SelectV2=s.asm.SelectV2).apply(null,arguments)},s._Selu=function(){return(s._Selu=s.asm.Selu).apply(null,arguments)},s._Sigmoid=function(){return(s._Sigmoid=s.asm.Sigmoid).apply(null,arguments)},s._Sign=function(){return(s._Sign=s.asm.Sign).apply(null,arguments)},s._Sin=function(){return(s._Sin=s.asm.Sin).apply(null,arguments)},s._Sinh=function(){return(s._Sinh=s.asm.Sinh).apply(null,arguments)},s._Softmax=function(){return(s._Softmax=s.asm.Softmax).apply(null,arguments)},s._Softplus=function(){return(s._Softplus=s.asm.Softplus).apply(null,arguments)},s._SparseFillEmptyRows=function(){return(s._SparseFillEmptyRows=s.asm.SparseFillEmptyRows).apply(null,arguments)},s._SparseReshape=function(){return(s._SparseReshape=s.asm.SparseReshape).apply(null,arguments)},s._SparseSegmentReduction=function(){return(s._SparseSegmentReduction=s.asm.SparseSegmentReduction).apply(null,arguments)},s._SparseToDense=function(){return(s._SparseToDense=s.asm.SparseToDense).apply(null,arguments)},s._Sqrt=function(){return(s._Sqrt=s.asm.Sqrt).apply(null,arguments)},s._Square=function(){return(s._Square=s.asm.Square).apply(null,arguments)},s._SquaredDifference=function(){return(s._SquaredDifference=s.asm.SquaredDifference).apply(null,arguments)},s._Step=function(){return(s._Step=s.asm.Step).apply(null,arguments)},s._StridedSlice=function(){return(s._StridedSlice=s.asm.StridedSlice).apply(null,arguments)},s._Sub=function(){return(s._Sub=s.asm.Sub).apply(null,arguments)},s._Sum=function(){return(s._Sum=s.asm.Sum).apply(null,arguments)},s._Tan=function(){return(s._Tan=s.asm.Tan).apply(null,arguments)},s._Tanh=function(){return(s._Tanh=s.asm.Tanh).apply(null,arguments)},s._TensorScatterUpdate=function(){return(s._TensorScatterUpdate=s.asm.TensorScatterUpdate).apply(null,arguments)},s._Tile=function(){return(s._Tile=s.asm.Tile).apply(null,arguments)},s._TopK=function(){return(s._TopK=s.asm.TopK).apply(null,arguments)},s._Transform=function(){return(s._Transform=s.asm.Transform).apply(null,arguments)},s._Transpose=function(){return(s._Transpose=s.asm.Transpose).apply(null,arguments)},s.__FusedMatMul=function(){return(s.__FusedMatMul=s.asm._FusedMatMul).apply(null,arguments)},s._malloc=function(){return(s._malloc=s.asm.malloc).apply(null,arguments)},s._free=function(){return(s._free=s.asm.free).apply(null,arguments)},s.___errno_location=function(){return(s.___errno_location=s.asm.__errno_location).apply(null,arguments)};var Q,J,Z,Y=s.stackSave=function(){return(Y=s.stackSave=s.asm.stackSave).apply(null,arguments)},$=s.stackRestore=function(){return($=s.stackRestore=s.asm.stackRestore).apply(null,arguments)},ee=s.stackAlloc=function(){return(ee=s.stackAlloc=s.asm.stackAlloc).apply(null,arguments)};function ne(e){function t(){Q||(Q=!0,s.calledRun=!0,A||(G(P),n(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),function(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)e=s.postRun.shift(),C.unshift(e);var e;G(C)}()))}W>0||(function(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)e=s.preRun.shift(),E.unshift(e);var e;G(E)}(),W>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),t()}),1)):t()))}if(s.dynCall_iijjiiii=function(){return(s.dynCall_iijjiiii=s.asm.dynCall_iijjiiii).apply(null,arguments)},s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.dynCall_jiji).apply(null,arguments)},s.cwrap=function(e,n,t,a){var r=(t=t||[]).every((function(e){return"number"===e||"boolean"===e}));return"string"!==n&&r&&!a?V(e):function(){return K(e,n,t,arguments)}},O=function e(){Q||ne(),Q||(O=e)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();if(ne(),i&&(J={uncaughtException:process.listeners("uncaughtException").filter((function(e){return!i.uncaughtException.indexOf(e)>-1})),unhandledRejection:process.listeners("unhandledRejection").filter((function(e){return!i.unhandledRejection.indexOf(e)>-1}))}),"undefined"!=typeof e)Z=e;else{if("undefined"==typeof WasmBackendModuleThreadedSimd)throw new Error("Could not find wasm module in post.js");Z=WasmBackendModuleThreadedSimd}if(J){var te=Z._dispose;Z._dispose=function(){te(),J.uncaughtException.forEach((function(e){process.removeListener("uncaughtException",e)})),J.unhandledRejection.forEach((function(e){process.removeListener("unhandledRejection",e)}))}}return e.ready});e.exports=u}(fr);var hr=fr.exports,br=dr(hr),yr=cr||mr,_r=br||i({__proto__:null,default:br},[hr]),gr=function(e){function t(t){var a=e.call(this)||this;return a.wasm=t,a.dataIdNextNumber=1,a.wasm.tfjs.initWithThreadsCount(Fr),Nr=a.wasm.tfjs.getThreadsCount(),a.dataIdMap=new n.DataStorage(a,n.engine()),a}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}p(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(t,e),t.prototype.write=function(e,n,t){var a={id:this.dataIdNextNumber++};return this.move(a,e,n,t,1),a},t.prototype.numDataIds=function(){return this.dataIdMap.numDataIds()},t.prototype.time=function(e){return l(this,void 0,void 0,(function(){var t;return c(this,(function(a){return t=n.util.now(),e(),[2,{kernelMs:n.util.now()-t}]}))}))},t.prototype.move=function(e,t,a,r,u){var i=this.dataIdNextNumber++;if("string"!==r){var s=n.util.sizeFromShape(a),o=s*n.util.bytesPerElement(r),d=this.wasm._malloc(o)>>>0;this.dataIdMap.set(e,{id:i,memoryOffset:d,shape:a,dtype:r,refCount:u}),this.wasm.tfjs.registerTensor(i,s,d),null!=t&&this.wasm.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,o),d)}else{var p=t;this.dataIdMap.set(e,{id:i,stringBytes:p,shape:a,dtype:r,memoryOffset:null,refCount:u})}},t.prototype.read=function(e){return l(this,void 0,void 0,(function(){return c(this,(function(n){return[2,this.readSync(e)]}))}))},t.prototype.readSync=function(e,t,a){var r=this.dataIdMap.get(e),u=r.memoryOffset,i=r.dtype,s=r.shape,o=r.stringBytes;if("string"===i)return null!=t&&0!==t||!(null==a||a>=o.length)?o.slice(t,a):o;t=t||0,a=a||n.util.sizeFromShape(s);var d=n.util.bytesPerElement(i);return function(e,n){switch(n){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error("Unknown dtype ".concat(n))}}(this.wasm.HEAPU8.slice(u+t*d,u+a*d).buffer,i)},t.prototype.disposeData=function(e,n){if(void 0===n&&(n=!1),this.dataIdMap.has(e)){var t=this.dataIdMap.get(e);if(t.refCount--,!n&&t.refCount>0)return!1;this.wasm._free(t.memoryOffset),this.wasm.tfjs.disposeData(t.id),this.dataIdMap.delete(e)}return!0},t.prototype.refCount=function(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0},t.prototype.incRef=function(e){var n=this.dataIdMap.get(e);null!=n&&n.refCount++},t.prototype.floatPrecision=function(){return 32},t.prototype.getMemoryOffset=function(e){return this.dataIdMap.get(e).memoryOffset},t.prototype.dispose=function(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null},t.prototype.memory=function(){return{unreliable:!1}},t.prototype.makeOutput=function(e,t,a,r){var u;if(null==a)u=this.write(null!=r?r:null,e,t);else{var i=this.dataIdNextNumber++;u={id:i},this.dataIdMap.set(u,{id:i,memoryOffset:a,shape:e,dtype:t,refCount:1});var s=n.util.sizeFromShape(e);this.wasm.tfjs.registerTensor(i,s,a)}return{dataId:u,shape:e,dtype:t}},t.prototype.typedArrayFromHeap=function(e){var t=e.shape,a=e.dtype,r=e.dataId,u=this.wasm.HEAPU8.buffer,i=this.dataIdMap.get(r).memoryOffset,s=n.util.sizeFromShape(t);switch(a){case"float32":return new Float32Array(u,i,s);case"int32":return new Int32Array(u,i,s);case"bool":return new Uint8Array(u,i,s);default:throw new Error("Unknown dtype ".concat(a))}},t}(n.KernelBackend);function vr(e,n,t){if(null!=wr)return wr;var a="tfjs-backend-wasm.wasm";return e&&n?a="tfjs-backend-wasm-threaded-simd.wasm":e&&(a="tfjs-backend-wasm-simd.wasm"),null!=Mr&&null!=Mr[a]?Mr[a]:t+a}function kr(){return l(this,void 0,void 0,(function(){var e,t,a;return c(this,(function(r){switch(r.label){case 0:return[4,Promise.all([n.env().getAsync("WASM_HAS_SIMD_SUPPORT"),n.env().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")])];case 1:return e=f.apply(void 0,[r.sent(),2]),t=e[0],a=e[1],[2,new Promise((function(e,r){var u,i={};i.locateFile=function(e,n){if(e.endsWith(".worker.js")){var r='"use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f)},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"})};self.onmessage=e=>{try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=function(){postMessage({cmd:"callHandler",handler:handler,args:[...arguments]})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}};'.replace(/\n/g,"\\n"),u=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(u)}return e.endsWith(".wasm")?vr(t,a,null!=Sr?Sr:n):n+e},xr&&(i.instantiateWasm=(u=vr(t,a,null!=Sr?Sr:""),function(e,t){return n.util.fetch(u,{credentials:"same-origin"}).then((function(n){n.ok||e.env.a("failed to load wasm binary file at '".concat(u,"'")),n.arrayBuffer().then((function(n){WebAssembly.instantiate(n,e).then((function(e){t(e.instance,e.module)}))}))})),{}}));var s,o=!1;i.onAbort=function(){if(!o&&!Ar){Ar=!0;r({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"})}},a&&t&&null==wr?(i.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+yr.toString()],{type:"text/javascript"}),s=yr(i)):s=_r(i),s.then((function(n){o=!0,Ar=!1;n.tfjs={init:n.cwrap("init",null,[]),initWithThreadsCount:n.cwrap("init_with_threads_count",null,["number"]),getThreadsCount:n.cwrap("get_threads_count","number",[]),registerTensor:n.cwrap("register_tensor",null,["number","number","number"]),disposeData:n.cwrap("dispose_data",null,["number"]),dispose:n.cwrap("dispose",null,[])},e({wasm:n})})).catch(r)}))]}}))}))}var Ir=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],wr=null,Sr=null,Mr={},Ar=!1,xr=!1;var Fr=-1,Nr=-1;n.registerBackend("wasm",(function(){return l(void 0,void 0,void 0,(function(){var e;return c(this,(function(n){switch(n.label){case 0:return[4,kr()];case 1:return e=n.sent().wasm,[2,new gr(e)]}}))}))}),2),e.BackendWasm=gr,e.getThreadsCount=function(){if(-1===Nr)throw new Error("WASM backend not initialized.");return Nr},e.setThreadsCount=function(e){Fr=e},e.setWasmPath=function(e,t){if(void 0===t&&(t=!1),n.deprecationWarn("setWasmPath has been deprecated in favor of setWasmPaths and will be removed in a future release."),Ar)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPath()` before you call `tf.setBackend()` or `tf.ready()`");wr=e,xr=t},e.setWasmPaths=function(e,n){if(void 0===n&&(n=!1),Ar)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if("string"==typeof e)Sr=e;else{Mr=e;var t=Ir.filter((function(e){return null==Mr[e]}));if(t.length>0)throw new Error("There were no entries found for the following binaries: "+"".concat(t.join(","),". Please either call setWasmPaths with a ")+"map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.")}xr=n},e.version_wasm="4.22.0"})); +//# sourceMappingURL=tf-backend-wasm.min.js.map diff --git a/submissions/StudyTracker/libs/tf-core.min.js b/submissions/StudyTracker/libs/tf-core.min.js new file mode 100644 index 00000000..5aac7421 --- /dev/null +++ b/submissions/StudyTracker/libs/tf-core.min.js @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).tf=e.tf||{})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),e}var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function u(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a0;)n=Math.random()*t|0,p(e,--t,n)}function d(e,t,n){return Math.max(e,Math.min(t,n))}function p(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function v(e,t,n){void 0===n&&(n=""),g(w(e,t),(function(){return n+" Shapes ".concat(e," and ").concat(t," must match")}))}function m(e){g(null!=e,(function(){return"The input to the tensor constructor must be a non-null value."}))}function y(e){if(0===e.length)return 1;for(var t=e[0],n=1;n=-n&&es)&&1===e[s]&&(n.push(e[s]),r.push(s)),o[i]<=s&&i++}1!==e[s]&&(n.push(e[s]),r.push(s))}return{newShape:n,keptDims:r}}function A(e,t){return _(e,t)}function _(e,t){var n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error("Unknown data type ".concat(e));n=new Array(t)}return n}function I(e,t){for(var n=0;n=0;--r)n[r]=n[r+1]*e[r+1];return n}function L(e,t,n,r){void 0===r&&(r=!1);var a=new Array;if(1===t.length)for(var o=t[0]*(r?2:1),i=0;i=0,(function(){return"Tensor must have a shape comprised of positive integers but got "+"shape [".concat(e,"].")}))}))}function q(e){return e&&e.then&&"function"==typeof e.then}var K,V="tfjsflags",H=function(){function e(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=j,this.populateURLFlags()}return e.prototype.setPlatform=function(e,t){null!=this.platform&&(Z().getBool("IS_TEST")||Z().getBool("PROD")||console.warn("Platform ".concat(this.platformName," has already been set. ")+"Overwriting the platform with ".concat(e,"."))),this.platformName=e,this.platform=t},e.prototype.registerFlag=function(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){var r=this.urlFlags[e];Z().getBool("IS_TEST")||Z().getBool("PROD")||console.warn("Setting feature override from URL ".concat(e,": ").concat(r,".")),this.set(e,r)}},e.prototype.getAsync=function(e){return a(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return e in this.flags?[2,this.flags[e]]:(t=this.flags,n=e,[4,this.evaluateFlag(e)]);case 1:return t[n]=r.sent(),[2,this.flags[e]]}}))}))},e.prototype.get=function(e){if(e in this.flags)return this.flags[e];var t=this.evaluateFlag(e);if(q(t))throw new Error("Flag ".concat(e," cannot be synchronously evaluated. ")+"Please use getAsync() instead.");return this.flags[e]=t,this.flags[e]},e.prototype.getNumber=function(e){return this.get(e)},e.prototype.getBool=function(e){return this.get(e)},e.prototype.getString=function(e){return this.get(e)},e.prototype.getFlags=function(){return this.flags},Object.defineProperty(e.prototype,"features",{get:function(){return this.flags},enumerable:!1,configurable:!0}),e.prototype.set=function(e,t){if(null==this.flagRegistry[e])throw new Error("Cannot set flag ".concat(e," as it has not been registered."));this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)},e.prototype.evaluateFlag=function(e){if(null==this.flagRegistry[e])throw new Error("Cannot evaluate flag '".concat(e,"': no evaluation function found."));return this.flagRegistry[e].evaluationFn()},e.prototype.setFlags=function(e){this.flags=Object.assign({},e)},e.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},e.prototype.populateURLFlags=function(){var e=this;if("undefined"!=typeof this.global&&"undefined"!=typeof this.global.location&&"undefined"!=typeof this.global.location.search){var t=this.getQueryParams(this.global.location.search);if(V in t)t.tfjsflags.split(",").forEach((function(t){var n=s(t.split(":"),2),r=n[0],a=n[1];e.urlFlags[r]=function(e,t){var n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:"".concat(+n)===n?+n:t}(0,a)}))}},e}();function j(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(function(e){for(var n=[],r=1;r>>=0)&&e<256)&&(r=Zn[e])?r:(n=Qn(e,(0|e)<0?-1:0,!0),a&&(Zn[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=Jn[e])?r:(n=Qn(e,e<0?-1:0,!1),a&&(Jn[e]=n),n)}function Xn(e,t){if(isNaN(e))return t?sr:ir;if(t){if(e<0)return sr;if(e>=rr)return fr}else{if(e<=-ar)return dr;if(e+1>=ar)return hr}return e<0?Xn(-e,t).neg():Qn(e%nr|0,e/nr|0,t)}function Qn(e,t,n){return new Hn(e,t,n)}Hn.fromInt=Yn,Hn.fromNumber=Xn,Hn.fromBits=Qn;var $n=Math.pow;function er(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return ir;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return er(e.substring(1),t,n).neg();for(var a=Xn($n(n,8)),o=ir,i=0;i>>0:this.low},pr.toNumber=function(){return this.unsigned?(this.high>>>0)*nr+(this.low>>>0):this.high*nr+(this.low>>>0)},pr.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=s).isZero())return u+i;for(;u.length<6;)u="0"+u;i=""+u+i}},pr.getHighBits=function(){return this.high},pr.getHighBitsUnsigned=function(){return this.high>>>0},pr.getLowBits=function(){return this.low},pr.getLowBitsUnsigned=function(){return this.low>>>0},pr.getNumBitsAbs=function(){if(this.isNegative())return this.eq(dr)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},pr.isOdd=function(){return 1==(1&this.low)},pr.isEven=function(){return 0==(1&this.low)},pr.equals=function(e){return jn(e)||(e=tr(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},pr.eq=pr.equals,pr.notEquals=function(e){return!this.eq(e)},pr.neq=pr.notEquals,pr.ne=pr.notEquals,pr.lessThan=function(e){return this.comp(e)<0},pr.lt=pr.lessThan,pr.lessThanOrEqual=function(e){return this.comp(e)<=0},pr.lte=pr.lessThanOrEqual,pr.le=pr.lessThanOrEqual,pr.greaterThan=function(e){return this.comp(e)>0},pr.gt=pr.greaterThan,pr.greaterThanOrEqual=function(e){return this.comp(e)>=0},pr.gte=pr.greaterThanOrEqual,pr.ge=pr.greaterThanOrEqual,pr.compare=function(e){if(jn(e)||(e=tr(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},pr.comp=pr.compare,pr.negate=function(){return!this.unsigned&&this.eq(dr)?dr:this.not().add(ur)},pr.neg=pr.negate,pr.add=function(e){jn(e)||(e=tr(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,o=e.high>>>16,i=65535&e.high,s=e.low>>>16,u=0,c=0,l=0,h=0;return l+=(h+=a+(65535&e.low))>>>16,c+=(l+=r+s)>>>16,u+=(c+=n+i)>>>16,u+=t+o,Qn((l&=65535)<<16|(h&=65535),(u&=65535)<<16|(c&=65535),this.unsigned)},pr.subtract=function(e){return jn(e)||(e=tr(e)),this.add(e.neg())},pr.sub=pr.subtract,pr.multiply=function(e){if(this.isZero())return ir;if(jn(e)||(e=tr(e)),Vn)return Qn(Vn.mul(this.low,this.high,e.low,e.high),Vn.get_high(),this.unsigned);if(e.isZero())return ir;if(this.eq(dr))return e.isOdd()?dr:ir;if(e.eq(dr))return this.isOdd()?dr:ir;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(or)&&e.lt(or))return Xn(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,o=e.high>>>16,i=65535&e.high,s=e.low>>>16,u=65535&e.low,c=0,l=0,h=0,f=0;return h+=(f+=a*u)>>>16,l+=(h+=r*u)>>>16,h&=65535,l+=(h+=a*s)>>>16,c+=(l+=n*u)>>>16,l&=65535,c+=(l+=r*s)>>>16,l&=65535,c+=(l+=a*i)>>>16,c+=t*u+n*s+r*i+a*o,Qn((h&=65535)<<16|(f&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},pr.mul=pr.multiply,pr.divide=function(e){if(jn(e)||(e=tr(e)),e.isZero())throw Error("division by zero");var t,n,r;if(Vn)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?Qn((this.unsigned?Vn.div_u:Vn.div_s)(this.low,this.high,e.low,e.high),Vn.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?sr:ir;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return sr;if(e.gt(this.shru(1)))return cr;r=sr}else{if(this.eq(dr))return e.eq(ur)||e.eq(lr)?dr:e.eq(dr)?ur:(t=this.shr(1).div(e).shl(1)).eq(ir)?e.isNegative()?ur:lr:(n=this.sub(e.mul(t)),r=t.add(n.div(e)));if(e.eq(dr))return this.unsigned?sr:ir;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=ir}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),o=a<=48?1:$n(2,a-48),i=Xn(t),s=i.mul(e);s.isNegative()||s.gt(n);)s=(i=Xn(t-=o,this.unsigned)).mul(e);i.isZero()&&(i=ur),r=r.add(i),n=n.sub(s)}return r},pr.div=pr.divide,pr.modulo=function(e){return jn(e)||(e=tr(e)),Vn?Qn((this.unsigned?Vn.rem_u:Vn.rem_s)(this.low,this.high,e.low,e.high),Vn.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},pr.mod=pr.modulo,pr.rem=pr.modulo,pr.not=function(){return Qn(~this.low,~this.high,this.unsigned)},pr.and=function(e){return jn(e)||(e=tr(e)),Qn(this.low&e.low,this.high&e.high,this.unsigned)},pr.or=function(e){return jn(e)||(e=tr(e)),Qn(this.low|e.low,this.high|e.high,this.unsigned)},pr.xor=function(e){return jn(e)||(e=tr(e)),Qn(this.low^e.low,this.high^e.high,this.unsigned)},pr.shiftLeft=function(e){return jn(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Qn(this.low<>>32-e,this.unsigned):Qn(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):Qn(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},pr.shr=pr.shiftRight,pr.shiftRightUnsigned=function(e){if(jn(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?Qn(this.low>>>e|t<<32-e,t>>>e,this.unsigned):Qn(32===e?t:t>>>e-32,0,this.unsigned)},pr.shru=pr.shiftRightUnsigned,pr.shr_u=pr.shiftRightUnsigned,pr.toSigned=function(){return this.unsigned?Qn(this.low,this.high,!1):this},pr.toUnsigned=function(){return this.unsigned?this:Qn(this.low,this.high,!0)},pr.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},pr.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},pr.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Hn.fromBytes=function(e,t,n){return n?Hn.fromBytesLE(e,t):Hn.fromBytesBE(e,t)},Hn.fromBytesLE=function(e,t){return new Hn(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Hn.fromBytesBE=function(e,t){return new Hn(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var gr=qn(Kn),vr=gr||t({__proto__:null,default:gr},[Kn]);function mr(e){return vr.fromString(e,!0,16)}var yr=mr("c3a5c85c97cb3127"),br=mr("b492b66fbe98f273"),wr=mr("9ae16a3b2f90404f");function kr(e){return e.xor(e.shru(47))}function xr(e,t,n){var r=e.slice(t,t+n);return vr.fromBytes(Array.from(r),!0,!0)}function Er(e,t){return xr(e,t,8)}function Sr(e,t){return xr(e,t,4)}function Ar(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function _r(e,t,n){void 0===n&&(n=mr("9ddfea08eb382d69"));var r=e.xor(t).mul(n);r=r.xor(r.shru(47));var a=t.xor(r).mul(n);return a=(a=a.xor(a.shru(47))).mul(n)}function Ir(e,t,n,r){return function(e,t,n,r,a,o){a=a.add(e),o=Ar(o.add(a).add(r),21);var i=a;return a=(a=a.add(t)).add(n),o=o.add(Ar(a,44)),[a.add(r),o.add(i)]}(Er(e,t),Er(e,t+8),Er(e,t+16),Er(e,t+24),n,r)}function Nr(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=Br(e)),Z().getBool("DEBUG")&&I(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){for(var n=new Uint8Array(e.length),r=0;r=8){var n=wr.add(2*t),r=Er(e,0).add(wr);return _r(Ar(a=Er(e,t-8),37).mul(n).add(r),Ar(r,25).add(a).mul(n),n)}if(t>=4)return n=wr.add(2*t),_r((r=Sr(e,0)).shl(3).add(t),Sr(e,t-4),n);if(t>0){var a,o=(r=e[0])+((a=e[t>>1])<<8),i=t+(e[t-1]<<2);return kr(wr.mul(o).xor(yr.mul(i))).mul(wr)}return wr}(e,t):function(e,t){void 0===t&&(t=e.length);var n=wr.add(2*t),r=Er(e,0).mul(br),a=Er(e,8),o=Er(e,t-8).mul(n),i=Er(e,t-16).mul(wr);return _r(Ar(r.add(a),43).add(Ar(o,30)).add(i),r.add(Ar(a.add(wr),18)).add(o),n)}(e,t);if(t<=64)return function(e,t){void 0===t&&(t=e.length);var n=wr.add(2*t),r=Er(e,0).mul(wr),a=Er(e,8),o=Er(e,t-8).mul(n),i=Er(e,t-16).mul(wr),s=Ar(r.add(a),43).add(Ar(o,30)).add(i),u=_r(s,r.add(Ar(a.add(wr),18)).add(o),n),c=Er(e,16).mul(n),l=Er(e,24),h=s.add(Er(e,t-32)).mul(n),f=u.add(Er(e,t-24)).mul(n);return _r(Ar(c.add(l),43).add(Ar(h,30)).add(f),c.add(Ar(l.add(r),18)).add(h),n)}(e,t);var o=a,i=a.mul(br).add(113),u=kr(i.mul(wr).add(113)).mul(wr),c=[vr.UZERO,vr.UZERO],l=[vr.UZERO,vr.UZERO];o=o.mul(wr).add(Er(e,0));var h=0,f=64*(t-1>>6),d=f+(t-1&63)-63;do{o=Ar(o.add(i).add(c[0]).add(Er(e,h+8)),37).mul(br),i=Ar(i.add(c[1]).add(Er(e,h+48)),42).mul(br),o=o.xor(l[1]),i=i.add(c[0]).add(Er(e,h+40)),u=Ar(u.add(l[0]),33).mul(br),c=Ir(e,h,c[1].mul(br),o.add(l[0])),l=Ir(e,h+32,u.add(l[1]),i.add(Er(e,h+16))),u=(n=s([o,u],2))[0],o=n[1],h+=64}while(h!==f);var p=br.add(u.and(255).shl(1));return h=d,l[0]=l[0].add(t-1&63),c[0]=c[0].add(l[0]),l[0]=l[0].add(c[0]),o=Ar(o.add(i).add(c[0]).add(Er(e,h+8)),37).mul(p),i=Ar(i.add(c[1]).add(Er(e,h+48)),42).mul(p),o=o.xor(l[1].mul(9)),i=i.add(c[0].mul(9).add(Er(e,h+40))),u=Ar(u.add(l[0]),33).mul(p),c=Ir(e,h,c[1].mul(p),o.add(l[0])),l=Ir(e,h+32,u.add(l[1]),i.add(Er(e,h+16))),u=(r=s([o,u],2))[0],o=r[1],_r(_r(c[0],l[0],p).add(kr(i).mul(yr)).add(u),_r(c[1],l[1],p).add(o),p)},flatten:Br,getArrayFromDType:_,getTypedArrayFromDType:A,hasEncodingLoss:function(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))},hexToLong:mr,indexToLoc:function(e,t,n){if(0===t)return[];if(1===t)return[e];for(var r=new Array(t),a=0;a=0)n*=e[a];else if(-1===e[a]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. "+"Found -1 at dim ".concat(r," and dim ").concat(a));r=a}else if(e[a]<0)throw Error("Shapes can not be < 0. Found ".concat(e[a]," at dim ").concat(a));if(-1===r){if(t>0&&t!==n)throw Error("Size(".concat(t,") must match the product of shape ").concat(e));return e}if(0===n)throw Error("Cannot infer the missing size in [".concat(e,"] when ")+"there are 0 elements");if(t%n!=0)throw Error("The implicit shape can't be a fractional number. "+"Got ".concat(t," / ").concat(n));var o=e.slice();return o[r]=t/n,o},isBoolean:R,isFunction:C,isInt:k,isNumber:B,isPromise:q,isScalarShape:function(e){return 0===e.length},isString:D,isTypedArray:Rr,isValidDtype:N,locToIndex:function(e,t,n){if(0===t)return 0;if(1===t)return e[0];for(var r=e[e.length-1],a=0;a=n?o():null!=r?r(s,u):setTimeout(s,u)}};s()}))},rightPad:x,shuffle:f,shuffleCombo:function(e,t){if(e.length!==t.length)throw new Error("Array sizes must match to be shuffled together "+"First array length was ".concat(e.length)+"Second array length was ".concat(t.length));for(var n=e.length,r=0;n>0;)r=Math.random()*n|0,p(e,--n,r),p(t,n,r)},sizeFromShape:y,sizeToSquarishShape:function(e){var t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]},squeezeShape:S,sum:function(e){for(var t=0,n=0;n0?p:""," ")}}console.log("%c".concat(s,"\t%c").concat(i,"\t%c").concat(u,"D ").concat(l,"\t%c").concat(c,"\t%c").concat(h,"\t%c").concat(o),"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},e}();function Or(e,t,n,r){var a=O(t),o=function(e,t,n,r){var a=y(t),o=r[r.length-1],i=new Array(o).fill(0),s=t.length,u="complex64"===n?Wr(e):e;if(s>1)for(var c=0;c20){var h=3*i,f=Array.from(e.slice(0,h)),d=Array.from(e.slice((c-3)*i,c*i));return"complex64"===n&&(f=Wr(f),d=Wr(d)),["["+f.map((function(e,t){return Lr(e,a[t],n)})).join(", ")+", ..., "+d.map((function(e,t){return Lr(e,a[c-3+t],n)})).join(", ")+"]"]}return["["+("complex64"===n?Wr(e):Array.from(e)).map((function(e,t){return Lr(e,a[t],n)})).join(", ")+"]"]}var p=t.slice(1),g=r.slice(1),v=r[0]*i,m=[];if(c>20){for(var y=0;y<3;y++){var b=(w=y*v)+v;m.push.apply(m,u([],s(Ur(e.slice(w,b),p,n,g,a,!1)),!1))}m.push("...");for(y=c-3;y0?m[0]+k:"");for(y=1;y=this.shape[a]){var c="Requested out of range element at ".concat(n,". ")+" Buffer shape=".concat(this.shape);throw new Error(c)}a++}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}for(var l=n[n.length-1],h=0;h0)throw new Error("Backend '".concat(this.backendName,"' has an internal memory leak ")+"(".concat(i," data ids) after running '").concat(e,"'"))},e.prototype.runKernelFunc=function(e){var t,n,r,a=this,o=[],i=this.isTapeOn(),s=this.state.numBytes,u=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;var c=ua(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(ua(e)){var l=e.kernelName,h=e.inputs,f=e.attrs;null==this.backendName&&this.backend;var d=Pn(l,this.backendName);g(null!=d,(function(){return"Cannot find registered kernel '".concat(l,"' for backend '").concat(a.backendName,"'")})),n=function(){var e=a.backend.numDataIds();r=d.kernelFunc({inputs:h,attrs:f,backend:a.backend});var t=Array.isArray(r)?r:[r];a.shouldCheckForMemLeaks()&&a.checkKernelForMemLeak(l,e,t);var n=t.map((function(e){return null!=e.rank?e:a.makeTensorFromTensorInfo(e)}));if(i){var s=a.getTensorsForGradient(l,h,n);o=a.saveTensorsForBackwardMode(s)}return n}}else{var p=e.forwardFunc,v=function(e){i&&(o=e.map((function(e){return a.keep(a.clone(e))})))};n=function(){var e=a.backend.numDataIds();r=a.tidy((function(){return p(a.backend,v)}));var t=Array.isArray(r)?r:[r];return a.shouldCheckForMemLeaks()&&a.checkKernelForMemLeak(c,e,t),t}}var m,y=e.inputs,b=e.attrs,w=ua(e)?null:e.backwardsFunc;return this.scopedRun((function(){return a.state.kernelDepth++}),(function(){return a.state.kernelDepth--}),(function(){a.ENV.getBool("DEBUG")||a.state.profiling?(m=a.profiler.profileKernel(c,y,(function(){return n()})),a.ENV.getBool("DEBUG")&&a.profiler.logKernelProfile(m),t=m.outputs):t=n()})),i&&this.addTapeNode(c,y,t,w,o,b),this.state.profiling&&this.state.activeProfile.kernels.push({name:c,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-u,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(y).map((function(e){return null!=y[e]?y[e].shape:null})),outputShapes:t.map((function(e){return e.shape})),kernelTimeMs:m.timeMs,extraInfo:m.extraInfo}),Array.isArray(r)?t:t[0]},e.prototype.saveTensorsForBackwardMode=function(e){var t=this,n=e.map((function(e){return t.keep(t.clone(e))}));return n},e.prototype.getTensorsForGradient=function(e,t,n){var r=On(e);if(null!=r){var a=r.inputsToSave||[],o=r.outputsToSave||[],i=void 0;r.saveAllInputs?(g(Array.isArray(t),(function(){return"saveAllInputs is true, expected inputs to be an array."})),i=Object.keys(t).map((function(e){return t[e]}))):i=a.map((function(e){return t[e]}));var s=n.filter((function(e,t){return o[t]}));return i.concat(s)}return[]},e.prototype.makeTensor=function(e,t,n,r){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;var a=e;"string"===n&&D(e[0])&&(a=e.map((function(e){return Tr(e)})));var o=r.write(a,t,n),i=new Vr(t,n,o,this.nextTensorId());if(this.trackTensor(i,r),"string"===n){var s=this.state.tensorInfo.get(o),u=T(a);this.state.numBytes+=u-s.bytes,s.bytes=u}return i},e.prototype.makeTensorFromDataId=function(e,t,n,r){var a={dataId:e,shape:t,dtype:n=n||"float32"};return this.makeTensorFromTensorInfo(a,r)},e.prototype.makeTensorFromTensorInfo=function(e,t){var n=e.dataId,r=e.shape,a=e.dtype,o=new Vr(r,a,n,this.nextTensorId());return this.trackTensor(o,t),o},e.prototype.makeVariable=function(e,t,n,r){void 0===t&&(t=!0),n=n||this.nextVariableId().toString(),null!=r&&r!==e.dtype&&(e=e.cast(r));var a=new Qr(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[a.name])throw new Error("Variable with name ".concat(a.name," was already registered"));return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a},e.prototype.trackTensor=function(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;var n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*M(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof Qr||this.track(e)},e.prototype.incRef=function(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)},e.prototype.removeDataId=function(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)},e.prototype.disposeTensor=function(e){if(this.state.tensorInfo.has(e.dataId)){var t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){var n=e.size*M(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}},e.prototype.disposeVariables=function(){for(var e in this.state.registeredVariables){var t=this.state.registeredVariables[e];this.disposeVariable(t)}},e.prototype.disposeVariable=function(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]},e.prototype.memory=function(){var e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e},e.prototype.profile=function(e){return a(this,void 0,void 0,(function(){var t,n,r,a,c,l,h,f,d,p,g;return o(this,(function(o){switch(o.label){case 0:return this.state.profiling=!0,t=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],r=this.state.activeProfile,[4,e()];case 1:r.result=o.sent(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,u([],s(this.state.activeProfile.kernels.map((function(e){return e.totalBytesSnapshot}))),!1)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n,o.label=2;case 2:o.trys.push([2,8,9,10]),a=i(this.state.activeProfile.kernels),c=a.next(),o.label=3;case 3:return c.done?[3,7]:(l=c.value,h=l,[4,l.kernelTimeMs]);case 4:return h.kernelTimeMs=o.sent(),f=l,[4,l.extraInfo];case 5:f.extraInfo=o.sent(),o.label=6;case 6:return c=a.next(),[3,3];case 7:return[3,10];case 8:return d=o.sent(),p={error:d},[3,10];case 9:try{c&&!c.done&&(g=a.return)&&g.call(a)}finally{if(p)throw p.error}return[7];case 10:return[2,this.state.activeProfile]}}))}))},e.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth},e.prototype.addTapeNode=function(e,t,n,r,a,o){var i=this,s={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:a},u=On(e);null!=u&&(r=u.gradFunc),null!=r&&(s.gradient=function(e){return e=e.map((function(e,t){if(null==e){var r=n[t],a=W(r.size,r.dtype);return i.makeTensor(a,r.shape,r.dtype)}return e})),r(e.length>1?e:e[0],a,o)}),this.state.activeTape.push(s)},e.prototype.keep=function(e){return e.kept=!0,e},e.prototype.startTape=function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++},e.prototype.endTape=function(){this.state.gradientDepth--},e.prototype.startScope=function(e){var t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t},e.prototype.endScope=function(e){for(var t=this,n=oa(e),r=new Set(n.map((function(e){return e.id}))),a=0;a0,(function(){return"gradients() received an empty list of xs."})),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '".concat(n.dtype,"'"));var o=this.scopedRun((function(){return a.startTape()}),(function(){return a.endTape()}),(function(){return a.tidy("forward",e)}));g(o instanceof Vr,(function(){return"The result y returned by f() must be a tensor."}));var s=function(e,t,n){for(var r={},a={},o=0;o=0;o--)for(i=(p=e[o]).inputs,l=0;l0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",(function(){var e,r,u={};u[o.id]=null==n?(e=o.shape,r=U(y(e),"float32"),da.makeTensor(r,e,"float32")):n,function(e,t,n,r){for(var a=function(a){var o=t[a],i=[];if(o.outputs.forEach((function(t){var n=e[t.id];null!=n?i.push(n):i.push(null)})),null==o.gradient)throw new Error("Cannot compute gradient: gradient function not found "+"for ".concat(o.kernelName,"."));var s=o.gradient(i),u=function(t){if(!(t in s))throw new Error("Cannot backprop through input ".concat(t,". ")+"Available gradients found: ".concat(Object.keys(s),"."));var a=n((function(){return s[t]()}));if("float32"!==a.dtype)throw new Error("Error in gradient for op ".concat(o.kernelName,". The gradient of input ")+"".concat(t," must have 'float32' dtype, but has '").concat(a.dtype,"'"));var i=o.inputs[t];if(!w(a.shape,i.shape))throw new Error("Error in gradient for op ".concat(o.kernelName,". The gradient of input ")+"'".concat(t,"' has shape '").concat(a.shape,"', which does not match ")+"the shape of the input '".concat(i.shape,"'"));if(null==e[i.id])e[i.id]=a;else{var u=e[i.id];e[i.id]=r(u,a),u.dispose()}};for(var c in o.inputs)u(c)},o=t.length-1;o>=0;o--)a(o)}(u,s,(function(e){return a.tidy(e)}),pa);var c=t.map((function(e){return u[e.id]}));return 0===a.state.gradientDepth&&(a.state.activeTape.forEach((function(e){var t,n;try{for(var r=i(e.saved),a=r.next();!a.done;a=r.next()){a.value.dispose()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}})),a.state.activeTape=null),{value:o,grads:c}}))},e.prototype.customGrad=function(e){var t=this;return g(C(e),(function(){return"The f passed in customGrad(f) must be a function."})),function(){for(var n,r=[],a=0;a0,(function(){return"Element arr[".concat(n.join("]["),"] should be a primitive, ")+"but is an array of ".concat(e.length," elements")})),g(e.length===t[0],(function(){return"Element arr[".concat(n.join("]["),"] should have ").concat(t[0]," ")+"elements, but has ".concat(e.length," elements")}));for(var r=t.slice(1),a=0;a=0&&(a=r),wa(r,a,t,n),null==e||!Rr(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){var o=null==e?"null":e.constructor.name;throw new Error("Argument '".concat(t,"' passed to '").concat(n,"' must be a ")+"Tensor or TensorLike, but got '".concat(o,"'"))}var i=ya(e,a);Rr(e)||Array.isArray(e)||(e=[e]);var s="string"!==a?Nr(e,a):Br(e,[],!0);return da.makeTensor(s,i,a)}function xa(e,t,n,r){if(void 0===r&&(r="numeric"),!Array.isArray(e))throw new Error("Argument ".concat(t," passed to ").concat(n," must be a ")+"`Tensor[]` or `TensorLike[]`");return e.map((function(e,a){return ka(e,"".concat(t,"[").concat(a,"]"),n,r)}))}ma.registerFlag("DEBUG",(function(){return!1}),(function(e){e&&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.")})),ma.registerFlag("IS_BROWSER",(function(){return ga()})),ma.registerFlag("IS_NODE",(function(){return"undefined"!=typeof process&&"undefined"!=typeof process.versions&&"undefined"!=typeof process.versions.node})),ma.registerFlag("IS_CHROME",(function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)})),ma.registerFlag("IS_SAFARI",(function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)})),ma.registerFlag("PROD",(function(){return!1})),ma.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(function(){return ma.getBool("DEBUG")})),ma.registerFlag("DEPRECATION_WARNINGS_ENABLED",(function(){return!0})),ma.registerFlag("IS_TEST",(function(){return!1})),ma.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(function(){return ma.getBool("DEBUG")})),ma.registerFlag("WRAP_TO_IMAGEBITMAP",(function(){return!1})),ma.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(function(){return!1})),ma.registerFlag("USE_SETTIMEOUTCUSTOM",(function(){return!1}));var Ea="__op";function Sa(e){var t=Object.keys(e);if(1!==t.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+"".concat(t.length," keys."));var n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+=Ea;var a=function(){for(var e=[],t=0;t=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;var n=function(e,t){var n=0,r=e.length;for(;n<=r;){var a=Math.floor((r-n)/2)+n,o=t(e[a]);if(0===o)return a;o<0?r=a:n=a+1}return-1}(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)},e}();function Ta(e,t){return da.tidy(e,t)}function Da(e){oa(e).forEach((function(e){return e.dispose()}))}function Ra(e){return da.keep(e)}function Ba(){return da.backendName}function Fa(){return da.backend}function Ca(e,t){var n,r,a=new Ma(e),o={},s=0;try{for(var u=i(t),c=u.next();!c.done;c=u.next()){var l=c.value,h=Pa(l,(function(e,t){return a.slice(s+e,s+t)}));o[l.name]=La(l,a.slice(s,s+h)),s+=h}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return o}function Pa(e,t){var n,r=y(e.shape);if("quantization"in e){var a=e.quantization;n=Na[a.dtype]}else{if("string"===e.dtype){for(var o=0,i=0;i>10]+(1023&s)]+a[s>>10];n[i]=u}return new Float32Array(t)});n=v(d)}else{if("int32"!==s)throw new Error("Unsupported dtype in weight '".concat(i,"': ").concat(s));if("uint8"!==h.dtype&&"uint16"!==h.dtype)throw new Error("Unsupported quantization type ".concat(h.dtype," ")+"for weight type int32.");n=new Int32Array(d.length);for(p=0;p0,(function(){return"scheme must not be an empty string."}));var r=e.getInstance();g(null==r.managers[t],(function(){return"A model store manager is already registered for scheme '".concat(t,"'.")})),r.managers[t]=n},e.getManager=function(t){var n=e.getInstance().managers[t];if(null==n)throw new Error("Cannot find model manager for scheme '".concat(t,"'"));return n},e.getSchemes=function(){return Object.keys(e.getInstance().managers)},e}();function wo(e){if(-1===e.indexOf(yo))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+"".concat(bo.getSchemes().join(",")));return{scheme:e.split(yo)[0],path:e.split(yo)[1]}}function ko(e,t,n){return void 0===n&&(n=!1),a(this,void 0,void 0,(function(){var r,a,i,s,u,c,l,h,f;return o(this,(function(o){switch(o.label){case 0:return g(e!==t,(function(){return"Old path and new path are the same: '".concat(e,"'")})),g((r=Za.getLoadHandlers(e)).length>0,(function(){return"Copying failed because no load handler is found for source URL ".concat(e,".")})),g(r.length<2,(function(){return"Copying failed because more than one (".concat(r.length,") ")+"load handlers for source URL ".concat(e,".")})),a=r[0],g((i=Za.getSaveHandlers(t)).length>0,(function(){return"Copying failed because no save handler is found for destination "+"URL ".concat(t,".")})),g(i.length<2,(function(){return"Copying failed because more than one (".concat(r.length,") ")+"save handlers for destination URL ".concat(t,".")})),s=i[0],u=wo(e).scheme,c=wo(e).path,l=u===wo(e).scheme,[4,a.load()];case 1:return h=o.sent(),n&&l?[4,bo.getManager(u).removeModel(c)]:[3,3];case 2:o.sent(),o.label=3;case 3:return[4,s.save(h)];case 4:return f=o.sent(),!n||l?[3,6]:[4,bo.getManager(u).removeModel(c)];case 5:o.sent(),o.label=6;case 6:return[2,f.modelArtifactsInfo]}}))}))}var xo=function(){function e(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}return e.prototype.fetch=function(e,t){return fetch(e,t)},e.prototype.now=function(){return performance.now()},e.prototype.encode=function(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Browser's encoder only supports utf-8, but got ".concat(t));return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)},e.prototype.decode=function(e,t){return new TextDecoder(t).decode(e)},e.prototype.setTimeoutCustom=function(e,t){var n=this;"undefined"!=typeof window&&Z().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((function(){window.postMessage({name:n.messageName,index:n.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(function(e){e.source===window&&e.data.name===n.messageName&&(e.stopPropagation(),(0,n.functionRefs[e.data.index])(),n.handledMessageCount++,n.handledMessageCount===n.functionRefs.length&&(n.functionRefs=[],n.handledMessageCount=0))}),!0))):setTimeout(e,t)},e.prototype.isTypedArray=function(e){return Wn(e)},e}();if(Z().get("IS_BROWSER")){Z().setPlatform("browser",new xo);try{bo.registerManager(go.URL_SCHEME,new mo)}catch(e){}try{bo.registerManager(to.URL_SCHEME,new ro)}catch(e){}}var Eo,So=function(){return require("node-fetch")},Ao=function(){function e(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}return e.prototype.fetch=function(e,t){return null!=Z().global.fetch?Z().global.fetch(e,t):(null==Eo&&(Eo=So()),Eo(e,t))},e.prototype.now=function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6},e.prototype.encode=function(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Node built-in encoder only supports utf-8, but got ".concat(t));return this.textEncoder.encode(e)},e.prototype.decode=function(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)},e.prototype.isTypedArray=function(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)},e}();function _o(e,t,n){return void 0===t&&(t="float32"),t=t||"float32",G(e),new Gr(e,t,n)}Z().get("IS_NODE")&&!Z().get("IS_BROWSER")&&Z().setPlatform("node",new Ao);var Io=Sa({cast_:function(e,t){var n=ka(e,"x","cast");if(!N(t))throw new Error("Failed to cast to unknown dtype ".concat(t));if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");var r={x:n},a={dtype:t};return da.runKernel(ve,r,a)}});var No=Sa({clone_:function(e){var t={x:ka(e,"x","clone","string_or_numeric")};return da.runKernel($e,t)}});function Mo(e,t){void 0===t&&(t=!1),console.log(e.toString(t))}ha(),Kr={buffer:_o,cast:Io,clone:No,print:Mo};var To=Sa({add_:function(e,t){var n,r=ka(e,"a","add"),a=ka(t,"b","add"),o={a:r=(n=s(ra(r,a),2))[0],b:a=n[1]};return da.runKernel(ee,o)}});var Do=Sa({floorDiv_:function(e,t){var n,r=ka(e,"a","floorDiv"),a=ka(t,"b","floorDiv"),o={a:r=(n=s(ra(r,a),2))[0],b:a=n[1]};return da.runKernel(je,o)}});var Ro=Sa({div_:function(e,t){var n,r=ka(e,"a","div"),a=ka(t,"b","div");if(r=(n=s(ra(r,a),2))[0],a=n[1],"int32"===r.dtype&&"int32"===a.dtype)return Do(r,a);var o={a:r,b:a};return da.runKernel(ze,o,{})}});var Bo=Sa({mul_:function(e,t){var n,r=ka(e,"a","mul"),a=ka(t,"b","mul"),o={a:r=(n=s(ra(r,a),2))[0],b:a=n[1]};return da.runKernel(kt,o)}});var Fo=Sa({abs_:function(e){var t=ka(e,"x","abs");if("complex64"===t.dtype){var n={x:t};return da.runKernel(we,n)}return n={x:t},da.runKernel("Abs",n)}});var Co=Sa({acos_:function(e){var t={x:ka(e,"x","acos")};return da.runKernel(Q,t)}});var Po=Sa({acosh_:function(e){var t={x:ka(e,"x","acosh")};return da.runKernel($,t)}});var Oo=Sa({addN_:function(e){g(Array.isArray(e),(function(){return"The argument passed to tf.addN() must be a list of tensors"})),g(e.length>=1,(function(){return"Must pass at least one tensor to tf.addN(), but got "+"".concat(e.length)}));var t=e.map((function(e,t){return ka(e,"tensors".concat(t),"addN")})),n=t[0];t.forEach((function(e){if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),t.forEach((function(e){if(!w(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));var r=t;return da.runKernel(te,r)}});var Lo=Sa({all_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r={x:ka(e,"x","all","bool")},a={axis:t,keepDims:n};return da.runKernel("All",r,a)}});var zo=Sa({any_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r={x:ka(e,"x","any","bool")},a={axis:t,keepDims:n};return da.runKernel("Any",r,a)}});var Uo=Sa({argMax_:function(e,t){void 0===t&&(t=0);var n={x:ka(e,"x","argMax")},r={axis:t};return da.runKernel(ne,n,r)}});var Wo=Sa({argMin_:function(e,t){void 0===t&&(t=0);var n={x:ka(e,"x","argMin")},r={axis:t};return da.runKernel(re,n,r)}});var Go=Sa({asin_:function(e){var t={x:ka(e,"x","asin")};return da.runKernel(ae,t)}});var qo=Sa({asinh_:function(e){var t={x:ka(e,"x","asinh")};return da.runKernel(oe,t)}});var Ko=Sa({atan_:function(e){var t={x:ka(e,"x","atan")};return da.runKernel(ie,t)}});var Vo=Sa({atan2_:function(e,t){var n,r=ka(e,"a","atan2"),a=ka(t,"b","atan2"),o={a:r=(n=s(ra(r,a),2))[0],b:a=n[1]};return da.runKernel(ue,o)}});var Ho=Sa({atanh_:function(e){var t={x:ka(e,"x","atanh")};return da.runKernel(se,t)}});function jo(e,t,n,r,a,o,i){void 0===i&&(i="channelsLast");var u,c=s(Xo(t),2),l=c[0],h=c[1];if("channelsLast"===i)u=[l,h,e[3],e[3]];else{if("channelsFirst"!==i)throw new Error("Unknown dataFormat ".concat(i));u=[l,h,e[1],e[1]]}return Jo(e,u,n,r,a,o,!1,i)}function Jo(e,t,n,r,a,o,i,u){var c,l;void 0===i&&(i=!1),void 0===u&&(u="channelsLast");var h=s([-1,-1,-1,-1],4),f=h[0],d=h[1],p=h[2],g=h[3];if("channelsLast"===u)f=(c=s(e,4))[0],d=c[1],p=c[2],g=c[3];else{if("channelsFirst"!==u)throw new Error("Unknown dataFormat ".concat(u));f=(l=s(e,4))[0],g=l[1],d=l[2],p=l[3]}var v,m=s(t,4),y=m[0],b=m[1],w=m[3],k=s(Xo(n),2),x=k[0],E=k[1],S=s(Xo(r),2),A=S[0],_=S[1],I=$o(y,A),N=$o(b,_),M=function(e,t,n,r,a,o,i,s,u){var c,l,h;if("number"==typeof e){c={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};var f=function(e,t,n,r,a){null==r&&(r=Yo(e,t,n));var o=e[0],i=e[1],s=ei((o-t+2*r)/n+1,a),u=ei((i-t+2*r)/n+1,a);return[s,u]}([t,n],o,r,e,s);l=f[0],h=f[1]}else if("same"===e){l=Math.ceil(t/r),h=Math.ceil(n/a);var d=Math.max(0,(l-1)*r+o-t),p=Math.max(0,(h-1)*a+i-n);c={top:g=Math.floor(d/2),bottom:v=d-g,left:m=Math.floor(p/2),right:y=p-m,type:"SAME"}}else if("valid"===e)c={top:0,bottom:0,left:0,right:0,type:"VALID"},l=Math.ceil((t-o+1)/r),h=Math.ceil((n-i+1)/a);else{if("object"!=typeof e)throw Error("Unknown padding parameter: ".concat(e));var g,v,m,y;c={top:g="channelsLast"===u?e[1][0]:e[2][0],bottom:v="channelsLast"===u?e[1][1]:e[2][1],left:m="channelsLast"===u?e[2][0]:e[3][0],right:y="channelsLast"===u?e[2][1]:e[3][1],type:0===g&&0===v&&0===m&&0===y?"VALID":"EXPLICIT"},l=ei((t-o+g+v)/r+1,s),h=ei((n-i+m+y)/a+1,s)}return{padInfo:c,outHeight:l,outWidth:h}}(a,d,p,x,E,I,N,o,u),T=M.padInfo,D=M.outHeight,R=M.outWidth,B=i?w*g:w;return"channelsFirst"===u?v=[f,B,D,R]:"channelsLast"===u&&(v=[f,D,R,B]),{batchSize:f,dataFormat:u,inHeight:d,inWidth:p,inChannels:g,outHeight:D,outWidth:R,outChannels:B,padInfo:T,strideHeight:x,strideWidth:E,filterHeight:y,filterWidth:b,effectiveFilterHeight:I,effectiveFilterWidth:N,dilationHeight:A,dilationWidth:_,inShape:e,outShape:v,filterShape:t}}function Zo(e,t,n,r,a,o,i,u){var c,l;void 0===o&&(o=!1),void 0===i&&(i="channelsLast");var h=s([-1,-1,-1,-1,-1],5),f=h[0],d=h[1],p=h[2],g=h[3],v=h[4];if("channelsLast"===i)f=(c=s(e,5))[0],d=c[1],p=c[2],g=c[3],v=c[4];else{if("channelsFirst"!==i)throw new Error("Unknown dataFormat ".concat(i));f=(l=s(e,5))[0],v=l[1],d=l[2],p=l[3],g=l[4]}var m,y=s(t,5),b=y[0],w=y[1],k=y[2],x=y[4],E=s(Qo(n),3),S=E[0],A=E[1],_=E[2],I=s(Qo(r),3),N=I[0],M=I[1],T=I[2],D=$o(b,N),R=$o(w,M),B=$o(k,T),F=function(e,t,n,r,a,o,i,s,u,c,l){var h,f,d,p;"valid"===e&&(e=0);if("number"==typeof e){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};var g=function(e,t,n,r,a,o){null==a&&(a=Yo(e,t[0],r[0]));for(var i=[0,0,0,n],s=0;s<3;s++)e[s]+2*a>=t[s]&&(i[s]=ei((e[s]-t[s]+2*a)/r[s]+1,o));return i}([t,n,r,1],[s,u,c],1,[a,o,i],e,l);f=g[0],d=g[1],p=g[2]}else{if("same"!==e)throw Error("Unknown padding parameter: ".concat(e));var v=((f=Math.ceil(t/a))-1)*a+s-t,m=((d=Math.ceil(n/o))-1)*o+u-n,y=((p=Math.ceil(r/i))-1)*i+c-r,b=Math.floor(v/2),w=v-b,k=Math.floor(m/2),x=m-k,E=Math.floor(y/2);h={top:k,bottom:x,left:E,right:y-E,front:b,back:w,type:"SAME"}}return{padInfo:h,outDepth:f,outHeight:d,outWidth:p}}(a,d,p,g,S,A,_,D,R,B,u),C=F.padInfo,P=F.outDepth,O=F.outHeight,L=F.outWidth,z=o?x*v:x;return"channelsFirst"===i?m=[f,z,P,O,L]:"channelsLast"===i&&(m=[f,P,O,L,z]),{batchSize:f,dataFormat:i,inDepth:d,inHeight:p,inWidth:g,inChannels:v,outDepth:P,outHeight:O,outWidth:L,outChannels:z,padInfo:C,strideDepth:S,strideHeight:A,strideWidth:_,filterDepth:b,filterHeight:w,filterWidth:k,effectiveFilterDepth:D,effectiveFilterHeight:R,effectiveFilterWidth:B,dilationDepth:N,dilationHeight:M,dilationWidth:T,inShape:e,outShape:m,filterShape:t}}function Yo(e,t,n,r){void 0===r&&(r=1);var a=$o(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}function Xo(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function Qo(e){return"number"==typeof e?[e,e,e]:e}function $o(e,t){return t<=1?e:e+(e-1)*(t-1)}function ei(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error("Unknown roundingMode ".concat(t))}}function ti(e){var t=s(Xo(e),3),n=t[0],r=t[1],a=t[2];return 1===n&&1===r&&1===a}function ni(e,t){return ti(e)||ti(t)}function ri(e){return Xo(e).every((function(e){return e>0}))}function ai(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error("Unknown dataFormat ".concat(e))}function oi(e,t,n){if(null!=n){if("string"==typeof t)throw Error("Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,"."));if("number"==typeof t)g(k(t),(function(){return"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")}));else{if("object"!=typeof t)throw Error("Error in ".concat(e,": Unknown padding parameter: ").concat(t));t.forEach((function(t){t.forEach((function(t){g(k(t),(function(){return"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")}))}))}))}}}var ii=Sa({reshape_:function(e,t){var n={x:ka(e,"x","reshape","string_or_numeric")},r={shape:t};return da.runKernel(zt,n,r)}});var si=Sa({avgPool_:function(e,t,n,r,a){var o=ka(e,"x","avgPool","float32");g(ni(n,1),(function(){return"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'")}));var i=o,s=!1;3===o.rank&&(s=!0,i=ii(o,[1,o.shape[0],o.shape[1],o.shape[2]])),g(4===i.rank,(function(){return"Error in avgPool: x must be rank 4 but got rank ".concat(i.rank,".")})),oi("avgPool",r,a);var u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a},l=da.runKernel(ce,u,c);return l=Io(l,o.dtype),s?ii(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var ui=Sa({avgPool3d_:function(e,t,n,r,a,o){void 0===o&&(o="NDHWC");var i=ka(e,"x","avgPool3d","float32"),s=i,u=!1;4===i.rank&&(u=!0,s=ii(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),g(5===s.rank,(function(){return"Error in avgPool3d: x must be rank 5 but got rank ".concat(s.rank,".")})),g("NDHWC"===o,(function(){return"Error in avgPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(o)})),g("number"==typeof n&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,(function(){return"Error in avgPool3d: Stride must be > 0, but got '".concat(n,"'")})),oi("avgPool3d",r,a);var c={x:s},l={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:o},h=da.runKernel(le,c,l);return h=Io(h,s.dtype),u?ii(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});var ci=Sa({concat_:function(e,t){void 0===t&&(t=0),g(e.length>=1,(function(){return"Pass at least one tensor to concat"}));var n=xa(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach((function(e){if("complex64"!==e.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype ".concat(e.dtype,". "))})),1===n.length)return No(n[0]);var r=n,a={axis:t};return da.runKernel(ke,r,a)}});var li=Sa({matMul_:function(e,t,n,r){var a;void 0===n&&(n=!1),void 0===r&&(r=!1);var o=ka(e,"a","matMul"),i=ka(t,"b","matMul"),u={a:o=(a=s(ra(o,i),2))[0],b:i=a[1]},c={transposeA:n,transposeB:r};return da.runKernel(he,u,c)}});var hi=Sa({sigmoid_:function(e){var t={x:ka(e,"x","sigmoid","float32")};return da.runKernel(en,t)}});var fi=Sa({slice_:function(e,t,n){var r=ka(e,"x","slice","string_or_numeric");if(0===r.rank)throw new Error("Slicing scalar is not possible");var a={x:r},o={begin:t,size:n};return da.runKernel(Xt,a,o)}});var di=Sa({tanh_:function(e){var t={x:ka(e,"x","tanh","float32")};return da.runKernel(yn,t)}});var pi=Sa({basicLSTMCell_:function(e,t,n,r,a,o){var i=ka(e,"forgetBias","basicLSTMCell"),s=ka(t,"lstmKernel","basicLSTMCell"),u=ka(n,"lstmBias","basicLSTMCell"),c=ka(r,"data","basicLSTMCell"),l=ka(a,"c","basicLSTMCell"),h=ka(o,"h","basicLSTMCell"),f=ci([c,h],1),d=li(f,s),p=To(d,u),g=p.shape[0],v=p.shape[1]/4,m=[g,v],y=fi(p,[0,0],m),b=fi(p,[0,v],m),w=fi(p,[0,2*v],m),k=fi(p,[0,3*v],m),x=To(Bo(hi(y),di(b)),Bo(l,hi(To(i,w))));return[x,Bo(di(x),hi(k))]}});var gi=Sa({batchToSpaceND_:function(e,t,n){var r=ka(e,"x","batchToSpaceND"),a=t.reduce((function(e,t){return e*t}));g(r.rank>=1+t.length,(function(){return"input rank is ".concat(r.rank," but should be > than blockShape.length ").concat(t.length)})),g(n.length===t.length,(function(){return"crops.length is ".concat(n.length," but should be equal to blockShape.length ").concat(t.length)})),g(r.shape[0]%a==0,(function(){return"input tensor batch is ".concat(r.shape[0]," but is not divisible by the product of ")+"the elements of blockShape ".concat(t.join(" * ")," === ").concat(a)}));var o={x:r},i={blockShape:t,crops:n};return da.runKernel(fe,o,i)}});var vi=Sa({batchNorm_:function(e,t,n,r,a,o){null==o&&(o=.001);var i,s,u=ka(e,"x","batchNorm"),c=ka(t,"mean","batchNorm"),l=ka(n,"variance","batchNorm");null!=a&&(i=ka(a,"scale","batchNorm")),null!=r&&(s=ka(r,"offset","batchNorm")),g(c.rank===l.rank,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),g(null==s||c.rank===s.rank,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),g(null==i||c.rank===i.rank,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}));var h=function(e){return 0===e.rank||1===e.rank?ii(e,[1,1,1,e.size]):2===e.rank?ii(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?ii(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e}(u),f={x:h,scale:i,offset:s,mean:c,variance:l},d={varianceEpsilon:o},p=da.runKernel(Je,f,d);return ii(p,u.shape)}});var mi=Sa({batchNorm2d_:function(e,t,n,r,a,o){var i,s,u=ka(e,"x","batchNorm"),c=ka(t,"mean","batchNorm"),l=ka(n,"variance","batchNorm");return null!=a&&(i=ka(a,"scale","batchNorm")),null!=r&&(s=ka(r,"offset","batchNorm")),g(2===u.rank,(function(){return"Error in batchNorm2D: x must be rank 2 but got rank "+"".concat(u.rank,".")})),g(2===c.rank||1===c.rank,(function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but "+"got rank ".concat(c.rank,".")})),g(2===l.rank||1===l.rank,(function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=i&&g(2===i.rank||1===i.rank,(function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 "+"but got rank ".concat(i.rank,".")})),null!=s&&g(2===s.rank||1===s.rank,(function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 "+"but got rank ".concat(s.rank,".")})),vi(u,c,l,s,i,o)}});var yi=Sa({batchNorm3d_:function(e,t,n,r,a,o){var i,s,u=ka(e,"x","batchNorm"),c=ka(t,"mean","batchNorm"),l=ka(n,"variance","batchNorm");return null!=a&&(i=ka(a,"scale","batchNorm")),null!=r&&(s=ka(r,"offset","batchNorm")),g(3===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+"".concat(u.rank,".")})),g(3===c.rank||1===c.rank,(function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but "+"got rank ".concat(c.rank,".")})),g(3===l.rank||1===l.rank,(function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=i&&g(3===i.rank||1===i.rank,(function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 "+"but got rank ".concat(i.rank,".")})),null!=s&&g(3===s.rank||1===s.rank,(function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 "+"but got rank ".concat(s.rank,".")})),vi(u,c,l,s,i,o)}});var bi=Sa({batchNorm4d_:function(e,t,n,r,a,o){var i,s,u=ka(e,"x","batchNorm"),c=ka(t,"mean","batchNorm"),l=ka(n,"variance","batchNorm");return null!=a&&(i=ka(a,"scale","batchNorm")),null!=r&&(s=ka(r,"offset","batchNorm")),g(4===u.rank,(function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+"".concat(u.rank,".")})),g(4===c.rank||1===c.rank,(function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but "+"got rank ".concat(c.rank,".")})),g(4===l.rank||1===l.rank,(function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=i&&g(4===i.rank||1===i.rank,(function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 "+"but got rank ".concat(i.rank,".")})),null!=s&&g(4===s.rank||1===s.rank,(function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 "+"but got rank ".concat(s.rank,".")})),vi(u,c,l,s,i,o)}});var wi=Sa({bincount_:function(e,t,n){var r=ka(e,"x","bincount"),a=ka(t,"weights","bincount");g("int32"===r.dtype,(function(){return"Error in bincount: input "+"dtype must be int32, but got ".concat(r.dtype)})),g(n>=0,(function(){return"size must be non-negative, but got ".concat(n,".")})),g(a.size===r.size||0===a.size,(function(){return"Error in bincount: weights must have the same size as input or"+"0-length, but got input shape: ".concat(r.shape,", weights shape: ")+"".concat(a.shape,".")}));var o={x:r,weights:a},i={size:n};return da.runKernel(de,o,i)}});var ki=Sa({bitwiseAnd_:function(e,t){var n=ka(e,"x","bitwiseAnd"),r=ka(t,"y","bitwiseAnd");if(!w(n.shape,r.shape))throw new Error("BitwiseAnd: Tensors must have the same shape. x: ".concat(n.shape,", y: ").concat(r.shape));if("int32"!==n.dtype||"int32"!==r.dtype)throw new Error("BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ".concat(n.dtype," and type of y: ").concat(r.dtype));var a={a:n,b:r};return da.runKernel(pe,a)}});var xi=Sa({broadcastArgs_:function(e,t){var n=ka(e,"s0","broadcastArgs","int32"),r=ka(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error("broadcastArgs(): first input must be a vector (rank=1). "+"Has rank ".concat(n.rank));if(1!==r.rank)throw new Error("broadcastArgs(): second input must be a vector (rank=1). "+"Has rank ".concat(r.rank));var a={s0:n,s1:r};return da.runKernel(ge,a)}});var Ei=Sa({broadcastTo_:function(e,t){var n=ka(e,"broadcastTo","x"),r=n.shape;if(G(t),t.lengthn.rank){for(var a=n.shape.slice();a.length=0;s--)if(o[s]===t[s])i[s]=1;else if(1!==n.shape[s])throw new Error("broadcastTo(): [".concat(r,"] cannot be broadcast to [").concat(t,"]."));var u=i.map((function(e,t){return e>1?t:-1})).filter((function(e){return e>=0}));if(0===u.length)return No(n);var c={x:n},l={reps:i};return da.runKernel(bn,c,l)}});var Si=Sa({ceil_:function(e){var t={x:ka(e,"x","ceil","float32")};return da.runKernel(me,t)}});function Ai(e,t,n){G(e);var r={shape:e,value:t,dtype:n=n||F(t)};return da.runKernel(Ke,{},r)}var _i=Sa({clipByValue_:function(e,t,n){var r=ka(e,"x","clipByValue");if(g(t<=n,(function(){return"Error in clip: min (".concat(t,") must be ")+"less than or equal to max (".concat(n,").")})),t===n)return Ai(r.shape,t,r.dtype);var a={x:r},o={clipValueMin:t,clipValueMax:n};return da.runKernel(ye,a,o)}});var Ii=Sa({concat1d_:function(e){return ci(e,0)}});var Ni=Sa({concat2d_:function(e,t){return ci(e,t)}});var Mi=Sa({concat3d_:function(e,t){return ci(e,t)}});var Ti=Sa({concat4d_:function(e,t){return ci(e,t)}});var Di=Sa({conv2d_:function(e,t,n,r,a,o,i){void 0===a&&(a="NHWC"),void 0===o&&(o=[1,1]);var s=ka(e,"x","conv2d","float32"),u=ka(t,"filter","conv2d","float32"),c=s,l=!1;3===s.rank&&(l=!0,c=ii(s,[1,s.shape[0],s.shape[1],s.shape[2]])),g(4===c.rank,(function(){return"Error in conv2d: input must be rank 4, but got rank ".concat(c.rank,".")})),g(4===u.rank,(function(){return"Error in conv2d: filter must be rank 4, but got rank "+"".concat(u.rank,".")})),oi("conv2d",r,i);var h="NHWC"===a?c.shape[3]:c.shape[1];g(h===u.shape[2],(function(){return"Error in conv2d: depth of input (".concat(h,") must match ")+"input depth for filter ".concat(u.shape[2],".")})),g(ni(n,o),(function(){return"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(o,"'")})),g(ri(o),(function(){return"Error in conv2D: Dilated rates should be larger than 0."})),g(ri(n),(function(){return"Error in conv2D: Strides should be larger than 0."}));var f={x:c,filter:u},d={strides:n,pad:r,dataFormat:a,dilations:o,dimRoundingMode:i},p=da.runKernel(xe,f,d);return l?ii(p,[p.shape[1],p.shape[2],p.shape[3]]):p}});var Ri=Sa({conv1d_:function(e,t,n,r,a,o,i){void 0===a&&(a="NWC"),void 0===o&&(o=1);var s=ka(e,"x","conv1d"),u=ka(t,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=ii(s,[1,s.shape[0],s.shape[1]])),g(3===c.rank,(function(){return"Error in conv1d: input must be rank 3, but got rank ".concat(c.rank,".")})),g(3===u.rank,(function(){return"Error in conv1d: filter must be rank 3, but got rank "+"".concat(u.rank,".")})),oi("conv1d",r,i),g(c.shape[2]===u.shape[1],(function(){return"Error in conv1d: depth of input (".concat(c.shape[2],") must match ")+"input depth for filter ".concat(u.shape[1],".")})),g(ni(n,o),(function(){return"Error in conv1D: Either stride or dilation must be 1. "+"Got stride ".concat(n," and dilation '").concat(o,"'")})),g(ri(o),(function(){return"Error in conv1D: Dilated rates should be larger than 0."})),g(ri(n),(function(){return"Error in conv1D: Stride should be larger than 0."})),g("NWC"===a,(function(){return"Error in conv1d: got dataFormat of ".concat(a," but only NWC is currently supported.")}));var h=ii(u,[1,u.shape[0],u.shape[1],u.shape[2]]),f=ii(c,[c.shape[0],1,c.shape[1],c.shape[2]]),d=Di(f,h,[1,n],r,"NHWC",[1,o],i);return ii(d,l?[d.shape[2],d.shape[3]]:[d.shape[0],d.shape[2],d.shape[3]])}});var Bi=Sa({conv2DBackpropInput_:function(e,t,n,r,a,o,i){void 0===o&&(o="NHWC"),g(e.length===t.rank,(function(){return"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")}));var s=e,u=t,c=!1;3===t.rank&&(c=!0,u=ii(t,[1,t.shape[0],t.shape[1],t.shape[2]]),s=[1,e[0],e[1],e[2]]),g(4===s.length,(function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+"".concat(s.length,".")})),g(4===u.rank,(function(){return"Error in conv2dDerInput: dy must be rank 4, but got "+"rank ".concat(u.rank)})),g(4===n.rank,(function(){return"Error in conv2dDerInput: filter must be rank 4, but got "+"rank ".concat(n.rank)}));var l="NHWC"===o?s[3]:s[1],h="NHWC"===o?u.shape[3]:u.shape[1];g(l===n.shape[2],(function(){return"Error in conv2dDerInput: depth of input (".concat(l,") must ")+"match input depth for filter ".concat(n.shape[2],".")})),g(h===n.shape[3],(function(){return"Error in conv2dDerInput: depth of output (".concat(h,") must ")+"match output depth for filter ".concat(n.shape[3],".")})),oi("conv2dDerInput",a,i);var f={dy:u,filter:n},d={strides:r,pad:a,dataFormat:o,dimRoundingMode:i,inputShape:s},p=da.runKernel(Se,f,d);return c?ii(p,[p.shape[1],p.shape[2],p.shape[3]]):p}});var Fi=Sa({conv2dTranspose_:function(e,t,n,r,a,o){var i=ka(e,"x","conv2dTranspose"),s=ka(t,"filter","conv2dTranspose");return Bi(n,i,s,r,a,"NHWC",o)}});var Ci=Sa({conv3d_:function(e,t,n,r,a,o){void 0===a&&(a="NDHWC"),void 0===o&&(o=[1,1,1]);var i=ka(e,"x","conv3d"),s=ka(t,"filter","conv3d"),u=i,c=!1;4===i.rank&&(c=!0,u=ii(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),g(5===u.rank,(function(){return"Error in conv3d: input must be rank 5, but got rank ".concat(u.rank,".")})),g(5===s.rank,(function(){return"Error in conv3d: filter must be rank 5, but got rank "+"".concat(s.rank,".")})),g(u.shape[4]===s.shape[3],(function(){return"Error in conv3d: depth of input (".concat(u.shape[4],") must match ")+"input depth for filter ".concat(s.shape[3],".")})),g(ni(n,o),(function(){return"Error in conv3D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(o,"'")})),g("NDHWC"===a,(function(){return"Error in conv3d: got dataFormat of ".concat(a," but only NDHWC is currently supported.")})),g(ri(o),(function(){return"Error in conv3D: Dilated rates should be larger than 0."})),g(ri(n),(function(){return"Error in conv3D: Strides should be larger than 0."}));var l={x:u,filter:s},h={strides:n,pad:r,dataFormat:a,dilations:o},f=da.runKernel(Ae,l,h);return c?ii(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}});var Pi=Sa({conv3DBackpropInput_:function(e,t,n,r,a){g(e.length===t.rank,(function(){return"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")}));var o=e,i=t,s=!1;4===t.rank&&(s=!0,i=ii(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),o=[1,e[0],e[1],e[2],e[3]]);var u=o[4],c=i.shape[4];g(5===o.length,(function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+"".concat(o.length,".")})),g(5===i.rank,(function(){return"Error in conv3dDerInput: dy must be rank 5, but got "+"rank ".concat(i.rank)})),g(5===n.rank,(function(){return"Error in conv3dDerInput: filter must be rank 5, but got "+"rank ".concat(n.rank)})),g(u===n.shape[3],(function(){return"Error in conv3dDerInput: depth of input (".concat(u,") must ")+"match input depth for filter ".concat(n.shape[3],".")})),g(c===n.shape[4],(function(){return"Error in conv3dDerInput: depth of output (".concat(c,") must ")+"match output depth for filter ".concat(n.shape[4],".")}));var l={dy:i,filter:n},h={pad:a,strides:r,inputShape:o},f=da.runKernel(_e,l,h);return s?ii(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}});var Oi=Sa({conv3dTranspose_:function(e,t,n,r,a){var o=ka(e,"x","conv3dTranspose"),i=ka(t,"filter","conv3dTranspose");return Pi(n,o,i,r,a)}});var Li=Sa({cos_:function(e){var t={x:ka(e,"x","cos","float32")};return da.runKernel("Cos",t)}});var zi=Sa({cosh_:function(e){var t={x:ka(e,"x","cosh","float32")};return da.runKernel(Ie,t)}});var Ui=Sa({cumprod_:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var a={x:ka(e,"x","cumprod")},o={axis:t,exclusive:n,reverse:r};return da.runKernel(Ne,a,o)}});var Wi=Sa({cumsum_:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var a={x:ka(e,"x","cumsum")},o={axis:t,exclusive:n,reverse:r};return da.runKernel(Me,a,o)}});var Gi=Sa({denseBincount_:function(e,t,n,r){void 0===r&&(r=!1);var a=ka(e,"x","denseBincount"),o=ka(t,"weights","denseBincount");g("int32"===a.dtype,(function(){return"Error in denseBincount: input "+"dtype must be int32, but got ".concat(a.dtype)})),g(a.rank<=2,(function(){return"Error in denseBincount: input must be at most rank 2, but got "+"rank ".concat(a.rank,".")})),g(n>=0,(function(){return"size must be non-negative, but got ".concat(n,".")})),g(o.size===a.size||0===o.size,(function(){return"Error in denseBincount: weights must have the same shape as x or "+"0-length, but got x shape: ".concat(a.shape,", weights shape: ")+"".concat(o.shape,".")}));var i={x:a,weights:o},s={size:n,binaryOutput:r};return da.runKernel(De,i,s)}});var qi=Sa({depthToSpace_:function(e,t,n){void 0===n&&(n="NHWC");var r=ka(e,"x","depthToSpace","float32"),a="NHWC"===n?r.shape[1]:r.shape[2],o="NHWC"===n?r.shape[2]:r.shape[3],i="NHWC"===n?r.shape[3]:r.shape[1];g(t>1,(function(){return"blockSize should be > 1 for depthToSpace, but was: ".concat(t)})),g(a*t>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n ".concat(a," and ").concat(t," for depthToSpace with input shape\n ").concat(r.shape)})),g(o*t>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n ".concat(o," and ").concat(t," for depthToSpace with input shape\n ").concat(r.shape)})),g(i%(t*t)==0,(function(){return"Dimension size must be evenly divisible by ".concat(t*t," but is ").concat(i," for depthToSpace with input shape ").concat(r.shape)}));var s={x:r},u={blockSize:t,dataFormat:n};return da.runKernel(Re,s,u)}});var Ki=Sa({depthwiseConv2d_:function(e,t,n,r,a,o,i){void 0===a&&(a="NHWC"),void 0===o&&(o=[1,1]);var s=ka(e,"x","depthwiseConv2d","float32"),u=ka(t,"filter","depthwiseConv2d","float32"),c=s,l=!1;3===s.rank&&(l=!0,c=ii(s,[1,s.shape[0],s.shape[1],s.shape[2]])),g(4===c.rank,(function(){return"Error in depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(c.rank,".")})),g(4===u.rank,(function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+"".concat(u.rank,".")}));var h="NHWC"===a?c.shape[3]:c.shape[1];g(h===u.shape[2],(function(){return"Error in depthwiseConv2d: number of input channels "+"(".concat(h,") must match the inChannels dimension in ")+"filter ".concat(u.shape[2],".")})),oi("depthwiseConv2d",r,i);var f={x:c,filter:u},d={strides:n,pad:r,dataFormat:a,dilations:o,dimRoundingMode:i},p=da.runKernel(Be,f,d);return l?ii(p,[p.shape[1],p.shape[2],p.shape[3]]):p}});var Vi=Sa({diag_:function(e){var t={x:ka(e,"x","diag")};return da.runKernel(Pe,t)}});var Hi=Sa({dilation2d_:function(e,t,n,r,a,o){void 0===a&&(a=[1,1]),void 0===o&&(o="NHWC");var i=ka(e,"x","dilation2d"),s=ka(t,"filter","dilation2d");g(3===i.rank||4===i.rank,(function(){return"Error in dilation2d: input must be rank 3 or 4, but got rank "+"".concat(i.rank,".")})),g(3===s.rank,(function(){return"Error in dilation2d: filter must be rank 3, but got rank "+"".concat(s.rank,".")})),g("NHWC"===o,(function(){return"Error in dilation2d: Only NHWC is currently supported, "+"but got dataFormat of ".concat(o)}));var u=i,c=!1;3===i.rank&&(u=ii(i,[1,i.shape[0],i.shape[1],i.shape[2]]),c=!0),g(u.shape[3]===s.shape[2],(function(){return"Error in dilation2d: input and filter must have the same depth: ".concat(u.shape[3]," vs ").concat(s.shape[2])}));var l={x:u,filter:s},h={strides:n,pad:r,dilations:a},f=da.runKernel(Oe,l,h);return c?ii(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});function ji(e,t){for(var n=e.length,r=[],a=0;a1&&1===i&&r.unshift(o)}return r}function Ji(e,t){for(var n=[],r=0;r1)&&n.unshift(o)}return n}function Zi(e,t){for(var n=Math.max(e.length,t.length),r=new Array(n),a=0;a0,(function(){return"variableGrads() expects at least one of the input variables to "+"be trainable, but none of the ".concat(o," variables is ")+"trainable."}));var i=da.gradients(e,t,null,!0),s=i.value,u=i.grads;g(u.some((function(e){return null!=e})),(function(){return"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()."})),g(0===s.rank,(function(){return"The f passed in variableGrads(f) must return a scalar, but it "+"returned a rank-".concat(s.rank," tensor")}));var c={};return t.forEach((function(e,t){null!=u[t]&&(c[e.name]=u[t])})),null!=a&&a.forEach((function(e){return c[e.name]=null})),{value:s,grads:c}}function zs(e){return da.customGrad(e)}function Us(e){if(e.filter((function(e){return null==e})).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n the f you passed encloses all operations that lead from x to y.")}var Ws=Sa({neg_:function(e){var t={x:ka(e,"x","neg")};return da.runKernel("Neg",t)}});var Gs=Sa({softplus_:function(e){var t={x:ka(e,"x","softplus")};return da.runKernel(tn,t)}});var qs=Sa({logSigmoid_:function(e){var t=ka(e,"x","logSigmoid"),n=zs((function(e){return{value:Ws(Gs(Ws(e))),gradFunc:function(t){return Bo(t,hi(Ws(e)))}}}));return n(t)}});var Ks=Sa({sub_:function(e,t){var n,r=ka(e,"a","sub"),a=ka(t,"b","sub"),o={a:r=(n=s(ra(r,a),2))[0],b:a=n[1]};return da.runKernel("Sub",o)}});var Vs=Sa({logSoftmax_:function(e,t){void 0===t&&(t=-1);var n=ka(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(n.rank," and axis was ").concat(t));var r=zs((function(e,n){var r=cs(e,t,!0),a=Ks(e,r),o=Ks(Io(a,"float32"),Ps(gs(bs(a),t,!0)));n([o]);return{value:o,gradFunc:function(e,n){var r=s(n,1)[0],a=bs(r);return Ks(e,Bo(gs(e,t,!0),a))}}}));return r(n)}});var Hs=Sa({logSumExp_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=ka(e,"x","logSumExp"),a=E(t,r.shape),o=cs(r,a,!0),i=Ks(r,o),s=bs(i),u=gs(s,a),c=Ps(u),l=To(ii(o,c.shape),c);if(n){var h=us(l.shape,a);return ii(l,h)}return l}});var js=Sa({logicalAnd_:function(e,t){var n=ka(e,"a","logicalAnd","bool"),r=ka(t,"b","logicalAnd","bool");Zi(n.shape,r.shape);var a={a:n,b:r};return da.runKernel(lt,a)}});var Js=Sa({logicalNot_:function(e){var t={x:ka(e,"x","logicalNot","bool")};return da.runKernel(ht,t)}});var Zs=Sa({logicalOr_:function(e,t){var n=ka(e,"a","logicalOr","bool"),r=ka(t,"b","logicalOr","bool");Zi(n.shape,r.shape);var a={a:n,b:r};return da.runKernel(ft,a)}});var Ys=Sa({logicalXor_:function(e,t){var n=ka(e,"a","logicalXor","bool"),r=ka(t,"b","logicalXor","bool");return Zi(n.shape,r.shape),js(Zs(e,t),Js(js(e,t)))}}),Xs=2147483648;var Qs=Sa({searchSorted_:function(e,t,n){void 0===n&&(n="left");var r=ka(e,"sortedSequence","searchSorted"),a=ka(t,"values","searchSorted"),o=r.shape[r.shape.length-1],i=a.shape[a.shape.length-1],s=ii(r,[-1,o]),u=ii(a,[-1,i]);if(s.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(s.shape[0]!==u.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(y(u.shape)>=Xs)throw new Error("values tensor size must less than ".concat(Xs));if(s.shape[1]>=Xs)throw new Error("trailing dim_size must less than ".concat(Xs," for int32 output type, was ").concat(s.shape[1]));var c={sortedSequence:s,values:u},l={side:n};return da.runKernel(Jt,c,l)}});var $s=Sa({maxPool_:function(e,t,n,r,a){var o=ka(e,"x","maxPool"),i=o,s=!1;3===o.rank&&(s=!0,i=ii(o,[1,o.shape[0],o.shape[1],o.shape[2]])),g(4===i.rank,(function(){return"Error in maxPool: input must be rank 4 but got rank ".concat(i.rank,".")})),g(ni(n,1),(function(){return"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'")})),oi("maxPool",r,a);var u={x:i},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a},l=da.runKernel(pt,u,c);return s?ii(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var eu=Sa({maxPool3d_:function(e,t,n,r,a,o){void 0===t&&(t=[1,1,1]),void 0===o&&(o="NDHWC");var i=ka(e,"x","maxPool3d"),s=i,u=!1;4===i.rank&&(u=!0,s=ii(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),g(5===s.rank,(function(){return"Error in maxPool3d: x must be rank 5 but got rank ".concat(s.rank,".")})),g("NDHWC"===o,(function(){return"Error in maxPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(o)})),oi("maxPool3d",r,a);var c={x:s},l={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:o},h=da.runKernel(gt,c,l);return u?ii(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});var tu=Sa({maxPoolWithArgmax_:function(e,t,n,r,a){void 0===a&&(a=!1);var o={x:ka(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:r,includeBatchInIndex:a},s=da.runKernel(vt,o,i);return{result:s[0],indexes:s[1]}}});var nu=Sa({maximum_:function(e,t){var n,r=ka(e,"a","maximum"),a=ka(t,"b","maximum");r=(n=s(ra(r,a),2))[0],a=n[1],"bool"===r.dtype&&(r=Io(r,"int32"),a=Io(a,"int32")),Zi(r.shape,a.shape);var o={a:r,b:a};return da.runKernel(dt,o)}});var ru=Sa({mean_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r={x:ka(e,"x","mean")},a={axis:t,keepDims:n};return da.runKernel(mt,r,a)}});function au(e,t){if(void 0===t&&(t="float32"),G(e),"complex64"===t){var n=au(e,"float32"),r=au(e,"float32");return Aa(n,r)}var a=W(y(e),t);return da.makeTensor(a,e,t)}function ou(e,t){if(void 0===t&&(t="float32"),G(e),"complex64"===t){var n=ou(e,"float32"),r=au(e,"float32");return Aa(n,r)}var a=U(y(e),t);return da.makeTensor(a,e,t)}var iu=Sa({minimum_:function(e,t){var n,r=ka(e,"a","minimum"),a=ka(t,"b","minimum");r=(n=s(ra(r,a),2))[0],a=n[1],"bool"===r.dtype&&(r=Io(r,"int32"),a=Io(a,"int32")),Zi(r.shape,a.shape);var o={a:r,b:a};return da.runKernel(yt,o)}});var su=Sa({mirrorPad_:function(e,t,n){g("reflect"===n||"symmetric"===n,(function(){return"Invalid mode. Mode must be either reflect or symmetric. "+"Got ".concat(n,".")}));var r=ka(e,"x","mirrorPad");if(0===r.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");g(t.length===r.rank,(function(){return"Padding doesn't match input. Must be ".concat(r.rank,". ")+"Got ".concat(t.length,".")}));for(var a="reflect"===n?1:0,o=function(e){g(2===t[e].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),g(t[e][0]>=0&&t[e][0]<=r.shape[e]-a&&t[e][1]>=0&&t[e][1]<=r.shape[e]-a,(function(){return"Padding in dimension ".concat(e," cannot be greater than or equal ")+"to ".concat(r.shape[e]-a," or less than 0 for input of ")+"shape ".concat(r.shape)}))},i=0;i2)throw new Error("Rank of probabilities must be 1 or 2, but is ".concat(i));n=n||Math.random();var s={logits:1===i?ii(a,[1,-1]):a},u={numSamples:t,seed:n,normalized:r},c=da.runKernel(wt,s,u);return 1===i?ii(c,[c.size]):c}});var fu=Sa({notEqual_:function(e,t){var n,r=ka(e,"a","notEqual","string_or_numeric"),a=ka(t,"b","notEqual","string_or_numeric");r=(n=s(ra(r,a),2))[0],a=n[1],Zi(r.shape,a.shape);var o={a:r,b:a};return da.runKernel(xt,o)}});var du=Sa({oneHot_:function(e,t,n,r,a){if(void 0===n&&(n=1),void 0===r&&(r=0),void 0===a&&(a="int32"),t<2)throw new Error("Error in oneHot: depth must be >=2, but it is ".concat(t));var o={indices:ka(e,"indices","oneHot","int32")},i={dtype:a,depth:t,onValue:n,offValue:r};return da.runKernel(It,o,i)}});var pu=Sa({onesLike_:function(e){var t={x:ka(e,"x","onesLike")};return da.runKernel(_t,t)}});var gu=Sa({outerProduct_:function(e,t){var n=ka(e,"v1","outerProduct"),r=ka(t,"v2","outerProduct");g(1===n.rank&&1===r.rank,(function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+"".concat(n.rank," and ").concat(r.rank,".")}));var a=ii(n,[-1,1]),o=ii(r,[1,-1]);return li(a,o)}});var vu=Sa({pad_:function(e,t,n){void 0===n&&(n=0);var r=ka(e,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var a={paddings:t,constantValue:n},o={x:r};return da.runKernel(Mt,o,a)}});var mu=Sa({pad1d_:function(e,t,n){return void 0===n&&(n=0),g(2===t.length,(function(){return"Invalid number of paddings. Must be length of 2."})),vu(e,[t],n)}});var yu=Sa({pad2d_:function(e,t,n){return void 0===n&&(n=0),g(2===t.length&&2===t[0].length&&2===t[1].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),vu(e,t,n)}});var bu=Sa({pad3d_:function(e,t,n){return void 0===n&&(n=0),g(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),vu(e,t,n)}});var wu=Sa({pad4d_:function(e,t,n){return void 0===n&&(n=0),g(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),vu(e,t,n)}});var ku=Sa({spaceToBatchND_:function(e,t,n){var r=ka(e,"x","spaceToBatchND");g(r.rank>=1+t.length,(function(){return"input rank ".concat(r.rank," should be > than [blockShape] ").concat(t.length)})),g(n.length===t.length,(function(){return"paddings.shape[0] ".concat(n.length," must be equal to [blockShape] ").concat(t.length)})),g(r.shape.reduce((function(e,r,a){return a>0&&a<=t.length?e&&(r+n[a-1][0]+n[a-1][1])%t[a-1]==0:e}),!0),(function(){return"input spatial dimensions ".concat(r.shape.slice(1)," with paddings ").concat(n.toString()," must be divisible by blockShapes ").concat(t.toString())}));var a={x:r},o={blockShape:t,paddings:n};return da.runKernel(rn,a,o)}});var xu=Sa({pool_:function(e,t,n,r,a,o,i){null==a&&(a=[1,1]),null==o&&(o=1),0===r&&(r="valid");var u=ka(e,"x","maxPool"),c=u,l=!1;3===u.rank&&(l=!0,c=ii(u,[1,u.shape[0],u.shape[1],u.shape[2]])),g(ni(o,a),(function(){return"Error in pool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(a,"'")}));var h,f=jo(c.shape,t,o,a,r),d=[f.dilationHeight,f.dilationWidth];h="same"===r?function(e,t){var n=e.map((function(e,n){return e+(e-1)*(t[n]-1)})).map((function(e){return e-1})),r=n.map((function(e){return Math.floor(e/2)})),a=n.map((function(e,t){return e-r[t]}));return n.map((function(e,t){return[r[t],a[t]]}))}([f.filterHeight,f.filterWidth],d):[[0,0],[0,0]];var p=1===d[0]&&1===d[1],v=s(function(e,t,n){var r=n.map((function(e){return e[0]})),a=n.map((function(e){return e[1]})),o=e.concat(r,a),i=t.map((function(e,t){return(e-o[t]%e)%e})),s=a.map((function(e,t){return e+i[t]})),u=t.map((function(e,t){return[r[t],s[t]]})),c=t.map((function(e,t){return[0,i[t]]}));return[u,c]}([f.inHeight,f.inWidth],d,h),2),m=v[0],y=v[1],b=p?r:"valid",w=p?c:ku(c,d,m),k=("avg"===n?function(){return si(w,t,o,b,i)}:function(){return $s(w,t,o,b,i)})(),x=p?k:gi(k,d,y);return l?ii(x,[x.shape[1],x.shape[2],x.shape[3]]):x}});var Eu=Sa({prelu_:function(e,t){var n={x:ka(e,"x","prelu"),alpha:ka(t,"alpha","prelu")};return da.runKernel(Tt,n)}});var Su=Sa({prod_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=ka(e,"x","prod");"bool"===r.dtype&&(r=Io(r,"int32"));var a={x:r},o={axis:t,keepDims:n};return da.runKernel(Dt,a,o)}});var Au=Sa({raggedGather_:function(e,t,n,r){var a={paramsNestedSplits:e.map((function(e,t){return ka(e,"tensors".concat(t),"raggedGather","int32")})),paramsDenseValues:ka(t,"paramsDenseValues","raggedGather"),indices:ka(n,"indices","raggedGather","int32")},o={outputRaggedRank:r},i=da.runKernel(Rt,a,o);return{outputNestedSplits:i.slice(0,i.length-1),outputDenseValues:i[i.length-1]}}});var _u=Sa({raggedRange_:function(e,t,n){var r=ka(e,"starts","raggedRange"),a={starts:r,limits:ka(t,"limits","raggedRange",r.dtype),deltas:ka(n,"deltas","raggedRange",r.dtype)},o=da.runKernel(Bt,a);return{rtNestedSplits:o[0],rtDenseValues:o[1]}}});var Iu=Sa({raggedTensorToTensor_:function(e,t,n,r,a){var o=ka(e,"shape","raggedTensorToTensor","int32"),i=ka(t,"values","raggedTensorToTensor"),s={shape:o,values:i,defaultValue:ka(n,"defaultValue","raggedTensorToTensor",i.dtype),rowPartitionTensors:r.map((function(e,t){return ka(e,"tensors".concat(t),"raggedTensorToTensor","int32")}))},u={rowPartitionTypes:a};return da.runKernel(Ft,s,u)}});var Nu=Sa({rand_:function(e,t,n){G(e);var r=y(e),a=null;if(null==n||"float32"===n)a=new Float32Array(r);else if("int32"===n)a=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type ".concat(n));a=new Uint8Array(r)}for(var o=0;o>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function o(e,t){var n=new r(e),o=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,o&&("object"==typeof o&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.alea=o}(0,e,!1)}(Mu);var Tu=Mu.exports,Du={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,o&&("object"==typeof o&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor128=o}(0,e,!1)}(Du);var Ru=Du.exports,Bu={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function o(e,t){var n=new r(e),o=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,o&&("object"==typeof o&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorwow=o}(0,e,!1)}(Bu);var Fu=Bu.exports,Cu={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function o(e,t){null==e&&(e=+new Date);var n=new r(e),o=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,o&&(o.x&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xorshift7=o}(0,e,!1)}(Cu);var Pu=Cu.exports,Ou={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,o=t.i;return t.w=r=r+1640531527|0,n=a[o+34&127],e=a[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,a,o,i,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),a=0,o=-32;o>>15,r^=r<<4,r^=r>>>13,o>=0&&(i=i+1640531527|0,a=0==(n=s[127&o]^=r+i)?a+1:0);for(a>=128&&(s[127&(t&&t.length||0)]=-1),a=127,o=512;o>0;--o)r=s[a+34&127],n=s[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[a]=r^n;e.w=i,e.X=s,e.i=a}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function o(e,t){null==e&&(e=+new Date);var n=new r(e),o=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,o&&(o.X&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.xor4096=o}(0,e,!1)}(Ou);var Lu=Ou.exports,zu={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,o&&("object"==typeof o&&a(o,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=o:n&&n.amd?n((function(){return o})):this.tychei=o}(0,e,!1)}(zu);var Uu=zu.exports,Wu={exports:{}};!function(e){!function(t,n,r){var a,o=256,i=r.pow(o,6),s=r.pow(2,52),u=2*s,c=255;function l(e,c,l){var v=[],m=p(d((c=1==c?{entropy:!0}:c||{}).entropy?[e,g(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(o):(e=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(e)),g(e)}catch(e){var r=t.navigator,i=r&&r.plugins;return[+new Date,t,i,t.screen,g(n)]}}():e,3),v),y=new h(v),b=function(){for(var e=y.g(6),t=i,n=0;e=u;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/4294967296},b.double=b,p(g(y.S),n),(c.pass||l||function(e,t,n,a){return a&&(a.S&&f(a,y),e.state=function(){return f(y,{})}),n?(r.random=e,t):e})(b,m,"global"in c?c.global:this==r,c.state)}function h(e){var t,n=e.length,r=this,a=0,i=r.i=r.j=0,s=r.S=[];for(n||(e=[n++]);an)}var $u={__proto__:null,TEST_EPSILON_FLOAT16:.1,createVideoElement:function(e){var t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise((function(e){t.addEventListener("loadeddata",(function(n){return e(t)})),t.load()}))},encodeStrings:function e(t){for(var n=0;nn)throw new Error("Value out of range:".concat(e[r]," low: ").concat(t,", high: ").concat(n))},play:function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,e.play()];case 1:return t.sent(),"requestVideoFrameCallback"in e?[4,new Promise((function(t){e.requestVideoFrameCallback(t)}))]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},testEpsilon:Yu},ec=function(){function e(e,t,n,r,a){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=a||Math.random();this.random=Zu.alea(o.toString())}return e.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var e=this.nextVal;return this.nextVal=NaN,e}for(var t,n,r=!1;!r;){var a=void 0,o=void 0,i=void 0;do{i=(a=2*this.random()-1)*a+(o=2*this.random()-1)*o}while(i>=1||0===i);var s=Math.sqrt(-2*Math.log(i)/i);t=this.mean+this.stdDev*a*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(t)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(t)},e.prototype.convertValue=function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)},e.prototype.isValidTruncated=function(e){return e<=this.upper&&e>=this.lower},e}(),tc=function(){function e(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;var a=r||Math.random();this.randu=Zu.alea(a.toString()),this.randn=new ec(0,1,n,!1,this.randu()),this.d=e<1?e+2/3:e-1/3,this.c=1/Math.sqrt(9*this.d)}return e.prototype.nextValue=function(){for(var e,t,n,r,a,o;;){do{r=this.randn.nextValue(),o=1+this.c*r}while(o<=0);if(o*=o*o,t=1-.331*(e=r*r)*e,n=.5*e+this.d*(1-o+Math.log(o)),(a=this.randu())r){var s=e.shape.map((function(e){return e}));s[e.shape.length-1]=t-r,n=ci([e,au(s)],e.shape.length-1),r=t}else n=e;var u=$i(n),c=ii(Aa(n,u),[a,r]),l=Dc(c),h=Math.floor(r/2)+1,f=cc(l),d=Ns(l),p=Fc(f,[h,r-h],f.shape.length-1),v=Fc(d,[h,r-h],d.shape.length-1),m=n.shape.slice();return m[n.shape.length-1]=h,ii(Aa(p[0],v[0]),m)}});var Pc=Sa({squaredDifference_:function(e,t){var n,r=ka(e,"a","squaredDifference"),a=ka(t,"b","squaredDifference");r=(n=s(ra(r,a),2))[0],a=n[1],Zi(r.shape,a.shape);var o={a:r,b:a};return da.runKernel(fn,o,{})}});var Oc=Sa({squeeze_:function(e,t){var n=ka(e,"x","squeeze","string_or_numeric");return ii(n,S(n.shape,t).newShape)}});var Lc=Sa({stack_:function(e,t){void 0===t&&(t=0);var n=xa(e,"tensors","stack","string_or_numeric");g(n.length>=1,(function(){return"Pass at least one tensor to tf.stack"})),n.length>0&&g(t<=n[0].rank,(function(){return"Axis must be <= rank of the tensor"}));var r=n,a={axis:t};return da.runKernel(Nt,r,a)}});var zc=Sa({step_:function(e,t){void 0===t&&(t=0);var n={x:ka(e,"x","step")},r={alpha:t};return da.runKernel(In,n,r)}});var Uc=Sa({stridedSlice_:function(e,t,n,r,a,o,i,s,u){void 0===a&&(a=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===u&&(u=0);var c={x:ka(e,"x","stridedSlice","string_or_numeric")},l={begin:t,end:n,strides:r,beginMask:a,endMask:o,ellipsisMask:i,newAxisMask:s,shrinkAxisMask:u};return da.runKernel(pn,c,l)}});var Wc=Sa({tan_:function(e){var t={x:ka(e,"x","tan","float32")};return da.runKernel("Tan",t)}});function Gc(e,t){m(e);var n=ya(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return _a(e,null,n,t)}function qc(e,t,n){if(m(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");var r=ya(e,n);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return _a(e,t,r,n)}function Kc(e,t,n){if(m(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");var r=ya(e,n);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return _a(e,t,r,n)}function Vc(e,t,n){var r=t.rank>1?t.shape[t.rank-1]:1,a=t.rank>1?t.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + "+"shape[sliceDim:], got updates.shape: ".concat(n.shape)+", indices.shape: ".concat(t.shape,", shape: ").concat(e)+", sliceDim: ".concat(r,", and batchDim: ").concat(a,".");if(n.rank1?t.shape[r-1]:1,o=n.length,i=1,c=a;c= 0 but got ".concat(t));if(t>a)throw new Error("'k' passed to topk() must be <= the last dimension (".concat(a,") ")+"but got ".concat(t));var o={x:r},i={k:t,sorted:n},u=s(da.runKernel(wn,o,i),2);return{values:u[0],indices:u[1]}}});var Xc=Sa({truncatedNormal_:function(e,t,n,r,a){if(void 0===t&&(t=0),void 0===n&&(n=1),G(e),null!=r&&"bool"===r)throw new Error("Unsupported data type $ { dtype }");for(var o=new ec(t,n,r,!0,a),i=_o(e,r),s=0;s0,(function(){return"The input tensor must be at least 1D"}));var r={x:n},a={axis:t},o=s(da.runKernel(En,r,a),2);return{values:o[0],indices:o[1]}}});var $c=Sa({unsortedSegmentSum_:function(e,t,n){var r=ka(e,"x","unsortedSegmentSum"),a=ka(t,"segmentIds","unsortedSegmentSum","int32");g(k(n),(function(){return"numSegments must be of dtype int"}));var o={x:r,segmentIds:a},i={numSegments:n};return da.runKernel(An,o,i)}});var el=Sa({unstack_:function(e,t){void 0===t&&(t=0);var n=ka(e,"x","unstack","string_or_numeric");g(t>=-n.shape.length&&t0,(function(){return"mask cannot be scalar"})),v(u.slice(i,i+s),a.shape,"mask's shape must match the first K dimensions of tensor's shape,"),c=1,l=i;l=0&&e2)throw new Error("sparseIndices should be a scalar, vector, or matrix,"+" but got shape ".concat(e.shape,"."));var a=e.rank>0?e.shape[0]:1,o=e.rank>1?e.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:,"+" ".concat(n.length,", should be: ").concat(o,"."));var i=t.size;if(0!==t.rank&&(1!==t.rank||i!==a))throw new Error("sparseValues has incorrect shape "+"".concat(t.shape,", should be [] or [").concat(a,"]"));if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(a,o,n,i);var s={sparseIndices:a,sparseValues:o,defaultValue:i},u={outputShape:n};return da.runKernel(hn,s,u)}});var ul=Sa({gatherND_:function(e,t){var n=ka(t,"indices","gatherND","int32"),r={params:ka(e,"x","gatherND","string_or_numeric"),indices:n};return da.runKernel(Ye,r)}});var cl=Sa({dropout_:function(e,t,n,r){var a=ka(e,"x","dropout");if(g("float32"===a.dtype,(function(){return"x has to be a floating point tensor since it's going to be "+"scaled, but got a ".concat(a.dtype," tensor instead.")})),g(t>=0&&t<1,(function(){return"rate must be a float in the range [0, 1), but got ".concat(t,".")})),0===t)return e instanceof Vr?a.clone():a;var o=function(e,t){if(null==t)return e.shape.slice();if(w(e.shape,t))return t;if(e.shape.length===t.length){for(var n=[],r=0;r1,(function(){return"inTopK() expects the predictions to be of rank 2 or higher, "+"but got ".concat(r.rank)})),g(r.rank-1===a.rank,(function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+"".concat(r.rank," and targets rank ").concat(a.rank)})),v(r.shape.slice(0,r.shape.length-1),a.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),i=r.shape[r.shape.length-1],g(n>0&&n<=i,(function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last "+"dimension (".concat(i,"), but got ").concat(n)})),[4,r.data()];case 1:return u=o.sent(),[4,a.data()];case 2:for(c=o.sent(),l=s([u.length/i,i],2),h=l[0],f=l[1],d=A("bool",h),p=0;p0&&(n=gs(n,r)),ii(n,e.shape)}function vl(e,t,n,r){if("linear"===t)return e;if("relu"===t)return hc(e);if("elu"===t)return rs(e);if("relu6"===t)return fc(e);if("prelu"===t)return Eu(e,n);if("leakyrelu"===t)return Rs(e,r);if("sigmoid"===t)return hi(e);throw new Error("Unknown fused activation ".concat(t,"."))}var ml=function(e,t){return!(e>0)||"linear"===t};var yl=Sa({fusedConv2d_:function(e){var t,n=e.x,r=e.filter,a=e.strides,o=e.pad,i=e.dataFormat,u=void 0===i?"NHWC":i,c=e.dilations,l=void 0===c?[1,1]:c,h=e.dimRoundingMode,f=e.bias,d=e.activation,p=void 0===d?"linear":d,v=e.preluActivationWeights,m=e.leakyreluAlpha;if(p=p||"linear",!1===ml(da.state.gradientDepth,p)){g("NHWC"===u,(function(){return"Error in fused conv2d: got dataFormat of ".concat(u," but ")+"only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear."}));var y=Di(n,r,a,o,u,l,h);return null!=f&&(y=To(y,f)),vl(y,p,v,m)}var b=ka(n,"x","conv2d","float32"),w=ka(r,"filter","conv2d","float32"),k=b,x=!1;3===b.rank&&(x=!0,k=ii(b,[1,b.shape[0],b.shape[1],b.shape[2]])),g(4===k.rank,(function(){return"Error in fused conv2d: input must be rank 4, but got rank "+"".concat(k.rank,".")})),g(4===w.rank,(function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+"".concat(w.rank,".")})),oi("fused conv2d",o,h);var E="NHWC"===u?k.shape[3]:k.shape[1];g(w.shape[2]===E,(function(){return"Error in conv2d: depth of input (".concat(E,") must match ")+"input depth for filter ".concat(w.shape[2],".")})),g(ni(a,l),(function(){return"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(a," and dilations '").concat(l,"'")}));var S,A,_=Jo(k.shape,w.shape,a,l,o,h);if(null!=f&&(t=s(ra(S=ka(f,"bias","fused conv2d"),b),1),S=t[0],"NHWC"===u?Zi(_.outShape,S.shape):(g(S.shape.length<=1,(function(){return"Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of "+"rank-".concat(S.shape.length,".")})),g(0===S.shape.length||S.shape[0]===_.outChannels||1===S.shape[0],(function(){return"Error in fused conv2d: bias shape (".concat(S.shape,") is not ")+"compatible with the number of output channels "+"(".concat(_.outChannels,")")})))),null!=v){var I=v.shape;if(g(I.length<=1||3===I.length,(function(){return"Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of "+"rank-".concat(I.length,".")})),1===I.length)g(1===I[0]||I[0]===_.outChannels,(function(){return"Error in fused conv2d: PReLU activation weights "+"(".concat(I,") is not compatible with the number of output ")+"channels (".concat(_.outChannels,").")}));else if(3===I.length)try{Zi(I,_.outShape)}catch(e){var N="Error in fused conv2d: PReLU activation weights (".concat(I,") ")+"is not compatible with the output shape of the conv2d "+"(".concat(_.outShape,").");throw Error(N)}A=ka(v,"prelu weights","fused conv2d")}var M=function(e,t){g("NHWC"===u,(function(){return"Error in gradient of fused conv2D: got dataFormat of ".concat(u," but only NHWC is currently supported.")}));var n=s(t,4),r=n[0],i=n[1],c=n[2],h=n[3],f=pl(e,c,p);g(ti(l),(function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(l,"'")}));var d=[Bi(i.shape,f,r,a,o),dl(i,f,r.shape,a,o)];if(null!=h){var v=gl(h,f);d.push(v)}return d},T={x:k,filter:w,bias:S,preluActivationWeights:A},D={strides:a,pad:o,dataFormat:u,dilations:l,dimRoundingMode:h,activation:p,leakyreluAlpha:m};if(null==f){var R=zs((function(e,t,n){var r=da.runKernel(Dn,T,D);return n([t,e,r]),x&&(r=ii(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:M}}));return R(k,w)}var B=zs((function(e,t,n,r){var a=da.runKernel(Dn,T,D);return r([t,e,a,n]),x&&(a=ii(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:M}}));return B(k,w,S)}});var bl=Sa({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,r,a,o,i){void 0===o&&(o=[1,1]);var s=e;3===e.rank&&(s=ii(e,[1,e.shape[0],e.shape[1],e.shape[2]]));var u=t;3===u.rank&&(u=ii(t,[1,t.shape[0],t.shape[1],t.shape[2]]));var c={x:s,dy:u},l={strides:r,pad:a,dimRoundingMode:i,dilations:o,filterShape:n};return da.runKernel(Fe,c,l)}});var wl=Sa({depthwiseConv2dNativeBackpropInput_:function(e,t,n,r,a,o,i){void 0===o&&(o=[1,1]);var s=t,u=!1;3===t.rank&&(u=!0,s=ii(t,[1,t.shape[0],t.shape[1],t.shape[2]]));var c={dy:s,filter:n},l={strides:r,pad:a,dimRoundingMode:i,dilations:o,inputShape:e},h=da.runKernel(Ce,c,l);return u?ii(h,[h.shape[1],h.shape[2],h.shape[3]]):h}});var kl=Sa({fusedDepthwiseConv2d_:function(e){var t,n=e.x,r=e.filter,a=e.strides,o=e.pad,i=e.dataFormat,u=void 0===i?"NHWC":i,c=e.dilations,l=void 0===c?[1,1]:c,h=e.dimRoundingMode,f=e.bias,d=e.activation,p=void 0===d?"linear":d,v=e.preluActivationWeights,m=e.leakyreluAlpha;if(!1===ml(da.state.gradientDepth,p)){var y=Ki(n,r,a,o,u,l,h);return null!=f&&(y=To(y,f)),vl(y,p,v,m)}var b=ka(n,"x","depthwiseConv2d","float32"),w=ka(r,"filter","depthwiseConv2d","float32"),k=b,x=!1;3===b.rank&&(x=!0,k=ii(b,[1,b.shape[0],b.shape[1],b.shape[2]])),g(4===k.rank,(function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(k.rank,".")})),g(4===w.rank,(function(){return"Error in fused depthwiseConv2d: filter must be rank 4, "+"but got rank ".concat(w.rank,".")})),g(k.shape[3]===w.shape[2],(function(){return"Error in fused depthwiseConv2d: number of input channels "+"(".concat(k.shape[3],") must match the inChannels dimension in ")+"filter ".concat(w.shape[2],".")})),null==l&&(l=[1,1]),g(ni(a,l),(function(){return"Error in fused depthwiseConv2d: Either strides or dilations must "+"be 1. Got strides ".concat(a," and dilations '").concat(l,"'")})),oi("fused depthwiseConv2d",o,h);var E,S,A=Jo(k.shape,w.shape,a,l,o,h,!0);null!=f&&(t=s(ra(E=ka(f,"bias","fused conv2d"),b),1),E=t[0],Zi(A.outShape,E.shape)),null!=v&&(S=ka(v,"prelu weights","fused depthwiseConv2d"));var _=function(e,t){g(ti(l),(function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(l,"'")}));var n=s(t,4),r=n[0],i=n[1],u=n[2],c=n[3],f=pl(e,u,p),d=wl(i.shape,f,r,a,o,l,h),v=bl(i,f,r.shape,a,o,l,h);return null!=c?[d,v,gl(E,f)]:[d,v]},I={x:k,filter:w,bias:E,preluActivationWeights:S},N={strides:a,pad:o,dataFormat:u,dilations:l,dimRoundingMode:h,activation:p,leakyreluAlpha:m};if(null==f){var M=zs((function(e,t,n){var r=da.runKernel(Rn,I,N);return n([t,e,r]),x&&(r=ii(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:_}}));return M(k,w)}var T=zs((function(e,t,n,r){var a=da.runKernel(Rn,I,N);return r([t,e,a,n]),x&&(a=ii(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:_}}));return T(k,w,E)}});var xl=Sa({fusedMatMul_:function(e){var t,n=e.a,r=e.b,a=e.transposeA,o=void 0!==a&&a,i=e.transposeB,u=void 0!==i&&i,c=e.bias,l=e.activation,h=void 0===l?"linear":l,f=e.preluActivationWeights,d=e.leakyreluAlpha,p=void 0===d?.2:d;if(!1===ml(da.state.gradientDepth,h)){var v=li(n,r,o,u);return null!=c&&(v=To(v,c)),vl(v,h,f,p)}var m=ka(n,"a","fused matMul"),b=ka(r,"b","fused matMul");t=s(ra(m,b),2),m=t[0],b=t[1];var w=o?m.shape[m.rank-2]:m.shape[m.rank-1],k=u?b.shape[b.rank-1]:b.shape[b.rank-2],x=o?m.shape[m.rank-1]:m.shape[m.rank-2],E=u?b.shape[b.rank-2]:b.shape[b.rank-1],S=m.shape.slice(0,-2),A=b.shape.slice(0,-2),_=y(S),I=y(A);g(w===k,(function(){return"Error in fused matMul: inner shapes (".concat(w,") and (")+"".concat(k,") of Tensors with shapes ").concat(m.shape," and ")+"".concat(b.shape," and transposeA=").concat(o)+" and transposeB=".concat(u," must match.")}));var N,M,T=Zi(m.shape.slice(0,-2),b.shape.slice(0,-2)).concat([x,E]),D=ii(m,o?[_,w,x]:[_,x,w]),R=ii(b,u?[I,E,k]:[I,k,E]);null!=c&&(N=s(ra(N=ka(c,"bias","fused matMul"),m),1)[0],Zi(T,N.shape)),null!=f&&(M=ka(f,"prelu weights","fused matMul"));var B=function(e,t){var n,r,a=s(t,4),i=a[0],l=a[1],f=a[2],d=a[3],p=pl(ii(e,f.shape),f,h);return o||u?!o&&u?(n=li(p,l,!1,!1),r=li(p,i,!0,!1)):o&&!u?(n=li(l,p,!1,!0),r=li(i,p,!1,!1)):(n=li(l,p,!0,!0),r=li(p,i,!0,!0)):(n=li(p,l,!1,!0),r=li(i,p,!0,!1)),null!=c?[n,r,gl(d,p)]:[n,r]},F={a:D,b:R,bias:N,preluActivationWeights:M},C={transposeA:o,transposeB:u,activation:h,leakyreluAlpha:p};if(null==c){var P=zs((function(e,t,n){var r=da.runKernel(Tn,F,C);return n([e,t,r]),{value:ii(r,T),gradFunc:B}}));return P(D,R)}var O=zs((function(e,t,n,r){var a=da.runKernel(Tn,F,C);return r([e,t,a,n]),{value:ii(a,T),gradFunc:B}}));return O(D,R,N)}}),El={__proto__:null,conv2d:yl,depthwiseConv2d:kl,matMul:xl};var Sl=Sa({hammingWindow_:function(e){return hl(e,.54,.46)}});var Al=Sa({hannWindow_:function(e){return hl(e,.5,.5)}});var _l=Sa({frame_:function(e,t,n,r,a){void 0===r&&(r=!1),void 0===a&&(a=0);for(var o=0,i=[];o+t<=e.size;)i.push(fi(e,o,t)),o+=n;if(r)for(;o=1&&r[1]>=1,(function(){return"cropSize must be atleast [1,1], but was ".concat(r)})),g("bilinear"===a||"nearest"===a,(function(){return"method must be bilinear or nearest, but was ".concat(a)}));var l={image:i,boxes:s,boxInd:u},h={method:a,extrapolationValue:o,cropSize:r};return da.runKernel(Te,l,h)}});var Ml=Sa({flipLeftRight_:function(e){var t=ka(e,"image","flipLeftRight","float32");g(4===t.rank,(function(){return"Error in flipLeftRight: image must be rank 4,"+"but got rank ".concat(t.rank,".")}));var n={image:t};return da.runKernel(Ve,n,{})}});var Tl=Sa({grayscaleToRGB_:function(e){var t=ka(e,"image","grayscaleToRGB"),n=t.rank-1,r=t.shape[n];g(t.rank>=2,(function(){return"Error in grayscaleToRGB: images must be at least rank 2, "+"but got rank ".concat(t.rank,".")})),g(1===r,(function(){return"Error in grayscaleToRGB: last dimension of a grayscale image "+"should be size 1, but got size ".concat(r,".")}));var a=new Array(t.rank);return a.fill(1,0,n),a[n]=3,xs(t,a)}});var Dl=Sa({rgbToGrayscale_:function(e){var t=ka(e,"image","RGBToGrayscale"),n=t.rank-1,r=t.shape[n];g(t.rank>=2,(function(){return"Error in RGBToGrayscale: images must be at least rank 2, "+"but got rank ".concat(t.rank,".")})),g(3===r,(function(){return"Error in RGBToGrayscale: last dimension of an RGB image "+"should be size 3, but got size ".concat(r,".")}));var a,o=t.dtype,i=Io(t,"float32"),s=Gc([.2989,.587,.114]);switch(t.rank){case 2:a=ns("ij,j->i",i,s);break;case 3:a=ns("ijk,k->ij",i,s);break;case 4:a=ns("ijkl,l->ijk",i,s);break;case 5:a=ns("ijklm,m->ijkl",i,s);break;case 6:a=ns("ijklmn,n->ijklm",i,s);break;default:throw new Error("Not a valid tensor rank.")}return a=ws(a,-1),Io(a,o)}});var Rl=Sa({rotateWithOffset_:function(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=.5);var a=ka(e,"image","rotateWithOffset","float32");g(4===a.rank,(function(){return"Error in rotateWithOffset: image must be rank 4,"+"but got rank ".concat(a.rank,".")}));var o={image:a},i={radians:t,fillValue:n,center:r};return da.runKernel(Mn,o,i)}});function Bl(e,t,n,r,a,o){null==r&&(r=.5),null==a&&(a=Number.NEGATIVE_INFINITY),null==o&&(o=0);var i=e.shape[0];return n=Math.min(n,i),g(0<=r&&r<=1,(function(){return"iouThreshold must be in [0, 1], but was '".concat(r,"'")})),g(2===e.rank,(function(){return"boxes must be a 2D tensor, but was of rank '".concat(e.rank,"'")})),g(4===e.shape[1],(function(){return"boxes must have 4 columns, but 2nd dimension was ".concat(e.shape[1])})),g(1===t.rank,(function(){return"scores must be a 1D tensor"})),g(t.shape[0]===i,(function(){return"scores has incompatible shape with boxes. Expected ".concat(i,", ")+"but was ".concat(t.shape[0])})),g(0<=o&&o<=1,(function(){return"softNmsSigma must be in [0, 1], but was '".concat(o,"'")})),{maxOutputSize:n,iouThreshold:r,scoreThreshold:a,softNmsSigma:o}}var Fl=Sa({nonMaxSuppression_:function(e,t,n,r,a){void 0===r&&(r=.5),void 0===a&&(a=Number.NEGATIVE_INFINITY);var o=ka(e,"boxes","nonMaxSuppression","float32"),i=ka(t,"scores","nonMaxSuppression","float32"),s=Bl(o,i,n,r,a),u={maxOutputSize:n=s.maxOutputSize,iouThreshold:r=s.iouThreshold,scoreThreshold:a=s.scoreThreshold};return da.runKernel(Et,{boxes:o,scores:i},u)}});function Cl(e,t,n){var r=function(e,t,n){return function(e,t,n){var r=0,a=e.length,o=0,i=!1;for(;r>>1)]);s>0?r=o+1:(a=o,i=!s)}return i?r:-r-1}(e,t,n||Pl)}(e,t,n),a=r<0?-(r+1):r;e.splice(a,0,t)}function Pl(e,t){return e>t?1:ea&&h.push({score:t[f],boxIndex:f,suppressBeginIndex:0});h.sort(ql);for(var d=o>0?-.5/o:0,p=[],g=[];p.length0;){var v=h.pop(),m=v.score,y=v.boxIndex,b=v.suppressBeginIndex;if(m=b;--k){var x=Wl(e,y,p[k]);if(x>=r){w=!0;break}if(v.score=v.score*Gl(r,d,x),v.score<=a)break}v.suppressBeginIndex=p.length,w||(v.score===m?(p.push(y),g.push(v.score)):v.score>a&&Cl(h,v,ql))}var E=p.length,S=n-E;c&&S>0&&(p.push.apply(p,u([],s(new Array(S).fill(0)),!1)),g.push.apply(g,u([],s(new Array(S).fill(0)),!1)));var A={selectedIndices:p};return i&&(A.selectedScores=g),l&&(A.validOutputs=E),A}function Wl(e,t,n){var r=e.subarray(4*t,4*t+4),a=e.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),i=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(a[0],a[2]),l=Math.min(a[1],a[3]),h=Math.max(a[0],a[2]),f=Math.max(a[1],a[3]),d=(s-o)*(u-i),p=(h-c)*(f-l);if(d<=0||p<=0)return 0;var g=Math.max(o,c),v=Math.max(i,l),m=Math.min(s,h),y=Math.min(u,f),b=Math.max(m-g,0)*Math.max(y-v,0);return b/(d+p-b)}function Gl(e,t,n){var r=Math.exp(t*n*n);return n<=e?r:0}function ql(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}var Kl=function(e,t,n,r,i){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),a(this,void 0,void 0,(function(){var a,s,u,c,l,h,f;return o(this,(function(o){switch(o.label){case 0:return a=ka(e,"boxes","nonMaxSuppressionAsync"),s=ka(t,"scores","nonMaxSuppressionAsync"),u=Bl(a,s,n,r,i),n=u.maxOutputSize,r=u.iouThreshold,i=u.scoreThreshold,[4,Promise.all([a.data(),s.data()])];case 1:return c=o.sent(),l=c[0],h=c[1],f=Ol(l,h,n,r,i).selectedIndices,a!==e&&a.dispose(),s!==t&&s.dispose(),[2,Gc(f,"int32")]}}))}))};var Vl=Sa({nonMaxSuppressionWithScore_:function(e,t,n,r,a,o){void 0===r&&(r=.5),void 0===a&&(a=Number.NEGATIVE_INFINITY),void 0===o&&(o=0);var i=ka(e,"boxes","nonMaxSuppression"),s=ka(t,"scores","nonMaxSuppression"),u=Bl(i,s,n,r,a,o),c={boxes:i,scores:s},l={maxOutputSize:n=u.maxOutputSize,iouThreshold:r=u.iouThreshold,scoreThreshold:a=u.scoreThreshold,softNmsSigma:o=u.softNmsSigma},h=da.runKernel(At,c,l);return{selectedIndices:h[0],selectedScores:h[1]}}});var Hl=function(e,t,n,r,i,s){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),void 0===s&&(s=0),a(this,void 0,void 0,(function(){var a,u,c,l,h,f,d,p,g;return o(this,(function(o){switch(o.label){case 0:return a=ka(e,"boxes","nonMaxSuppressionAsync"),u=ka(t,"scores","nonMaxSuppressionAsync"),c=Bl(a,u,n,r,i,s),n=c.maxOutputSize,r=c.iouThreshold,i=c.scoreThreshold,s=c.softNmsSigma,[4,Promise.all([a.data(),u.data()])];case 1:return l=o.sent(),h=l[0],f=l[1],d=zl(h,f,n,r,i,s),p=d.selectedIndices,g=d.selectedScores,a!==e&&a.dispose(),u!==t&&u.dispose(),[2,{selectedIndices:Gc(p,"int32"),selectedScores:Gc(g)}]}}))}))};var jl=Sa({nonMaxSuppressionPadded_:function(e,t,n,r,a,o){void 0===r&&(r=.5),void 0===a&&(a=Number.NEGATIVE_INFINITY),void 0===o&&(o=!1);var i=ka(e,"boxes","nonMaxSuppression"),s=ka(t,"scores","nonMaxSuppression"),u=Bl(i,s,n,r,a,null),c={boxes:i,scores:s},l={maxOutputSize:u.maxOutputSize,iouThreshold:u.iouThreshold,scoreThreshold:u.scoreThreshold,padToMaxOutputSize:o},h=da.runKernel(St,c,l);return{selectedIndices:h[0],validOutputs:h[1]}}});var Jl=function(e,t,n,r,i,u){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),void 0===u&&(u=!1),a(this,void 0,void 0,(function(){var a,c,l,h,f,d,p,g,v,m,y,b;return o(this,(function(o){switch(o.label){case 0:return a=ka(e,"boxes","nonMaxSuppressionAsync"),c=ka(t,"scores","nonMaxSuppressionAsync"),l=Bl(a,c,n,r,i,null),h=l.maxOutputSize,f=l.iouThreshold,d=l.scoreThreshold,[4,Promise.all([a.data(),c.data()])];case 1:return p=s.apply(void 0,[o.sent(),2]),g=p[0],v=p[1],m=Ll(g,v,h,f,d,u),y=m.selectedIndices,b=m.validOutputs,a!==e&&a.dispose(),c!==t&&c.dispose(),[2,{selectedIndices:Gc(y,"int32"),validOutputs:fs(b,"int32")}]}}))}))};var Zl=Sa({resizeBilinear_:function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var a=ka(e,"images","resizeBilinear");g(3===a.rank||4===a.rank,(function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got "+"rank ".concat(a.rank,".")})),g(2===t.length,(function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+"".concat(t,".")})),g(!1===r||!1===n,(function(){return"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false."}));var o=a,i=!1;3===a.rank&&(i=!0,o=ii(a,[1,a.shape[0],a.shape[1],a.shape[2]])),s(t,0);var u={images:o},c={alignCorners:n,halfPixelCenters:r,size:t},l=da.runKernel(Wt,u,c);return i?ii(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var Yl=Sa({resizeNearestNeighbor_:function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var a=ka(e,"images","resizeNearestNeighbor");g(3===a.rank||4===a.rank,(function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got "+"rank ".concat(a.rank,".")})),g(2===t.length,(function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+"".concat(t,".")})),g("float32"===a.dtype||"int32"===a.dtype,(function(){return"`images` must have `int32` or `float32` as dtype"})),g(!1===r||!1===n,(function(){return"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false."}));var o=a,i=!1;3===a.rank&&(i=!0,o=ii(a,[1,a.shape[0],a.shape[1],a.shape[2]])),s(t,0);var u={images:o},c={alignCorners:n,halfPixelCenters:r,size:t},l=da.runKernel(Ut,u,c);return i?ii(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var Xl=Sa({threshold_:function(e,t,n,r){var a;void 0===t&&(t="binary"),void 0===n&&(n=!1),void 0===r&&(r=.5);var o,i,u,c,l=ka(e,"image","threshold"),h=l.shape[0]*l.shape[1],f=Bo(Gc([r]),255);if(g(3===l.rank,(function(){return"Error in threshold: image must be rank 3,"+"but got rank ".concat(l.rank,".")})),g(3===l.shape[2]||1===l.shape[2],(function(){return"Error in threshold: image color channel must be equal to 3 or 1"+"but got ".concat(l.shape[2],".")})),g("int32"===l.dtype||"float32"===l.dtype,(function(){return"Error in dtype: image dtype must be int32 or float32,"+"but got dtype ".concat(l.dtype,".")})),g("otsu"===t||"binary"===t,(function(){return"Method must be binary or otsu, but was ".concat(t)})),3===l.shape[2]){o=(a=s(Fc(l,[1,1,1],-1),3))[0],i=a[1],u=a[2];var d=Bo(o,.2989),p=Bo(i,.587),v=Bo(u,.114);c=To(To(d,p),v)}else c=e;"otsu"===t&&(f=function(e,t){for(var n,r,a,o,i,s,u=Gc([-1]),c=Gc([0]),l=Gc([0]),h=0;h=2,(function(){return"bandPart(): Rank must be at least 2, got ".concat(r.rank,".")}));var a,o,i=r.shape,u=s(r.shape.slice(-2),2),c=u[0],l=u[1];"number"==typeof t?(g(t%1==0,(function(){return"bandPart(): numLower must be an integer, got ".concat(t,".")})),g(t<=c,(function(){return"bandPart(): numLower (".concat(t,")")+" must not be greater than the number of rows (".concat(c,").")})),a=ka(t<0?c:t,"numLower","bandPart")):(g("int32"===t.dtype,(function(){return"bandPart(): numLower's dtype must be an int32."})),a=Qi(Bs(t,0),c,iu(t,c))),"number"==typeof n?(g(n%1==0,(function(){return"bandPart(): numUpper must be an integer, got ".concat(n,".")})),g(n<=l,(function(){return"bandPart(): numUpper (".concat(n,")")+" must not be greater than the number of columns (".concat(l,").")})),o=ka(n<0?l:n,"numUpper","bandPart")):(g("int32"===n.dtype,(function(){return"bandPart(): numUpper's dtype must be an int32."})),o=Qi(Bs(n,0),l,iu(n,l)));var h=ii(uc(0,c,1,"int32"),[-1,1]),f=uc(0,l,1,"int32"),d=Ks(h,f),p=js(Fs(d,a),Is(d,Ws(o))),v=au([c,l],r.dtype);return ii(Lc(el(ii(r,[-1,c,l])).map((function(e){return Qi(p,e,v)}))),i)}});var eh=Sa({gramSchmidt_:function(e){var t;if(Array.isArray(e)){t=!1,g(null!=e&&e.length>0,(function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"}));for(var n=e[0].shape[0],r=function(t){g(e[t].shape[0]===n,(function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: "+"(".concat(e[t].shape[0]," vs. ").concat(n,")")}))},a=1;a0)for(var n=0;n=r?r:n,l=function(e){var t,c=o,l=u,h=a;t=s(da.tidy((function(){var t=fi(o,[e,e],[n-e,1]),s=ms(t),c=fi(o,[e,e],[1,1]),l=Qi(_s(c,0),qc([[-1]]),qc([[1]])),h=Ks(c,Bo(l,s)),f=Ro(t,h);u=1===f.shape[0]?No(i):ci([i,fi(f,[1,0],[f.shape[0]-1,f.shape[1]])],0);var d=Ws(Ro(li(l,h),s)),p=fi(o,[e,0],[n-e,r]),g=Bo(d,u),v=al(u);if(0===e)o=Ks(p,li(g,li(v,p)));else{var m=Ks(p,li(g,li(v,p)));o=ci([fi(o,[0,0],[e,r]),m],0)}var y=al(g),b=fi(a,[0,e],[n,a.shape[1]-e]);if(0===e)a=Ks(b,li(li(b,u),y));else{var w=Ks(b,li(li(b,u),y));a=ci([fi(a,[0,0],[n,e]),w],1)}return[u,o,a]})),3),u=t[0],o=t[1],a=t[2],Da([c,l,h])},h=0;hr&&(a=fi(a,[0,0],[n,r]),o=fi(o,[0,0],[r,r])),[a,o]}))}var nh,rh=Sa({qr_:function(e,t){if(void 0===t&&(t=!1),g(e.rank>=2,(function(){return"qr() requires input tensor to have a rank >= 2, but got rank ".concat(e.rank)})),2===e.rank)return th(e,t);var n=e.shape.slice(0,e.shape.length-2).reduce((function(e,t){return e*t})),r=el(ii(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],o=[];return r.forEach((function(e){var n=s(th(e,t),2),r=n[0],i=n[1];a.push(r),o.push(i)})),[ii(Lc(a,0),e.shape),ii(Lc(o,0),e.shape)]}});e.Reduction=void 0,(nh=e.Reduction||(e.Reduction={}))[nh.NONE=0]="NONE",nh[nh.MEAN=1]="MEAN",nh[nh.SUM=2]="SUM",nh[nh.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS";var ah=Sa({computeWeightedLoss_:function(t,n,r){void 0===r&&(r=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var a=ka(t,"losses","computeWeightedLoss"),o=null;null!=n&&(o=ka(n,"weights","computeWeightedLoss"));var i=null==o?a:Bo(a,o);if(r===e.Reduction.NONE)return i;if(r===e.Reduction.SUM)return gs(i);if(r===e.Reduction.MEAN){if(null==o)return ru(i);var s=a.size/o.size,u=Ro(gs(i),gs(o));return s>1?Ro(u,fs(s)):u}if(r===e.Reduction.SUM_BY_NONZERO_WEIGHTS){if(null==o)return Ro(gs(i),fs(a.size));var c=Bo(o,ou(a.shape)),l=Io(gs(fu(c,fs(0))),"float32");return Ro(gs(i),l)}throw Error("Unknown reduction: ".concat(r))}});var oh=Sa({absoluteDifference_:function(t,n,r,a){void 0===a&&(a=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=ka(t,"labels","absoluteDifference"),i=ka(n,"predictions","absoluteDifference"),s=null;null!=r&&(s=ka(r,"weights","absoluteDifference")),v(o.shape,i.shape,"Error in absoluteDifference: ");var u=Fo(Ks(o,i));return ah(u,s,a)}});var ih=Sa({cosineDistance_:function(t,n,r,a,o){void 0===o&&(o=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=ka(t,"labels","cosineDistance"),s=ka(n,"predictions","cosineDistance"),u=null;null!=a&&(u=ka(a,"weights","cosineDistance")),v(i.shape,s.shape,"Error in cosineDistance: ");var c=fs(1),l=Ks(c,gs(Bo(i,s),r,!0));return ah(l,u,o)}});var sh=Sa({hingeLoss_:function(t,n,r,a){void 0===a&&(a=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=ka(t,"labels","hingeLoss"),i=ka(n,"predictions","hingeLoss"),s=null;null!=r&&(s=ka(r,"weights","hingeLoss")),v(o.shape,i.shape,"Error in hingeLoss: ");var u=fs(1);o=Ks(Bo(fs(2),o),u);var c=hc(Ks(u,Bo(o,i)));return ah(c,s,a)}});var uh=Sa({huberLoss_:function(t,n,r,a,o){void 0===a&&(a=1),void 0===o&&(o=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=ka(t,"labels","huberLoss"),s=ka(n,"predictions","huberLoss"),u=null;null!=r&&(u=ka(r,"weights","huberLoss")),v(i.shape,s.shape,"Error in huberLoss: ");var c=fs(a),l=Fo(Ks(s,i)),h=iu(l,c),f=Ks(l,h),d=To(Bo(fs(.5),ps(h)),Bo(c,f));return ah(d,u,o)}});var ch=Sa({logLoss_:function(t,n,r,a,o){void 0===a&&(a=1e-7),void 0===o&&(o=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=ka(t,"labels","logLoss"),s=ka(n,"predictions","logLoss"),u=null;null!=r&&(u=ka(r,"weights","logLoss")),v(i.shape,s.shape,"Error in logLoss: ");var c=fs(1),l=fs(a),h=Ws(Bo(i,Ps(To(s,l)))),f=Bo(Ks(c,i),Ps(To(Ks(c,s),l))),d=Ks(h,f);return ah(d,u,o)}});var lh=Sa({meanSquaredError_:function(t,n,r,a){void 0===a&&(a=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var o=ka(t,"labels","meanSquaredError"),i=ka(n,"predictions","meanSquaredError"),s=null;null!=r&&(s=ka(r,"weights","meanSquaredError")),v(o.shape,i.shape,"Error in meanSquaredError: ");var u=Pc(o,i);return ah(u,s,a)}});var hh=Sa({sigmoidCrossEntropy_:function(t,n,r,a,o){void 0===a&&(a=0),void 0===o&&(o=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=ka(t,"multiClassLabels","sigmoidCrossEntropy"),s=ka(n,"logits","sigmoidCrossEntropy"),u=null;if(null!=r&&(u=ka(r,"weights","sigmoidCrossEntropy")),v(i.shape,s.shape,"Error in sigmoidCrossEntropy: "),a>0){var c=fs(a),l=fs(1),h=fs(.5);i=To(Bo(i,Ks(l,c)),Bo(h,c))}var f=function(e,t){var n=ka(e,"labels","sigmoidCrossEntropyWithLogits"),r=ka(t,"logits","sigmoidCrossEntropyWithLogits");v(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var a=hc(r),o=Bo(r,n),i=Os(bs(Ws(Fo(r))));return To(Ks(a,o),i)}(i,s);return ah(f,u,o)}});var fh=Sa({softmaxCrossEntropy_:function(t,n,r,a,o){void 0===a&&(a=0),void 0===o&&(o=e.Reduction.SUM_BY_NONZERO_WEIGHTS);var i=ka(t,"onehotLabels","softmaxCrossEntropy"),u=ka(n,"logits","softmaxCrossEntropy"),c=null;if(null!=r&&(c=ka(r,"weights","softmaxCrossEntropy")),v(i.shape,u.shape,"Error in softmaxCrossEntropy: "),a>0){var l=fs(a),h=fs(1),f=fs(i.shape[1]);i=To(Bo(i,Ks(h,l)),Ro(l,f))}var d=function(e,t,n){if(void 0===n&&(n=-1),-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet "+"supported. Labels / logits was rank ".concat(t.rank," ")+"and dim was ".concat(n));var r=zs((function(e,t,r){var a=Hs(t,[n],!0),o=Ks(Io(t,"float32"),a);r([e,o]);var i=Ws(Bo(o,e));return{value:gs(i,[n]),gradFunc:function(e,t){var r=s(t,2),a=r[0],o=r[1],i=us(e.shape,[n]);return[Bo(ii(e,i),Ks(Io(a,"float32"),bs(o))),Bo(ii(e,i),Ks(bs(o),Io(a,"float32")))]}}}));return r(e,t)}(i,u);return ah(d,c,o)}});var dh=Sa({sparseFillEmptyRows_:function(e,t,n,r){var a=ka(e,"indices","sparseFillEmptyRows","int32"),o=ka(t,"values","sparseFillEmptyRows"),i=ka(n,"denseShape","sparseFillEmptyRows","int32"),s=ka(r,"defaultValue","sparseFillEmptyRows",o.dtype);if(2!==a.rank)throw new Error("Indices should be Tensor2D but received shape\n ".concat(a.shape));if(1!==o.rank)throw new Error("Values should be Tensor1D but received shape ".concat(o.shape));if(1!==i.rank)throw new Error("Dense shape should be Tensor1D but received shape ".concat(i.shape));if(0!==s.rank)throw new Error("Default value should be a scalar but received shape ".concat(s.shape));var u={indices:a,values:o,denseShape:i,defaultValue:s},c=da.runKernel(sn,u);return{outputIndices:c[0],outputValues:c[1],emptyRowIndicator:c[2],reverseIndexMap:c[3]}}});var ph=Sa({sparseReshape_:function(e,t,n){var r=ka(e,"inputIndices","sparseReshape","int32"),a=ka(t,"inputShape","sparseReshape","int32"),o=ka(n,"newShape","sparseReshape","int32");if(2!==r.rank)throw new Error("Input indices should be Tensor2D but received shape\n ".concat(r.shape));if(1!==a.rank)throw new Error("Input shape should be Tensor1D but received shape ".concat(a.shape));if(1!==o.rank)throw new Error("New shape should be Tensor1D but received shape ".concat(o.shape));var i={inputIndices:r,inputShape:a,newShape:o},s=da.runKernel(un,i);return{outputIndices:s[0],outputShape:s[1]}}});var gh=Sa({sparseSegmentMean_:function(e,t,n){var r=ka(e,"data","sparseSegmentMean"),a=ka(t,"indices","sparseSegmentMean","int32"),o=ka(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(a.shape));if(1!==o.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(o.shape));var i={data:r,indices:a,segmentIds:o};return da.runKernel(cn,i)}});var vh=Sa({sparseSegmentSum_:function(e,t,n){var r=ka(e,"data","sparseSegmentSum"),a=ka(t,"indices","sparseSegmentSum","int32"),o=ka(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(a.shape));if(1!==o.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(o.shape));var i={data:r,indices:a,segmentIds:o};return da.runKernel(ln,i)}});var mh=Sa({stringNGrams_:function(e,t,n,r,a,o,i,s){var u=ka(e,"data","stringNGrams","string");if("string"!==u.dtype)throw new Error("Data must be of datatype string");if(1!==u.shape.length)throw new Error("Data must be a vector, saw: ".concat(u.shape));var c=ka(t,"dataSplits","stringNGrams");if("int32"!==c.dtype)throw new Error("Data splits must be of datatype int32");var l={separator:n,nGramWidths:r,leftPad:a,rightPad:o,padWidth:i,preserveShortSequences:s},h={data:u,dataSplits:c},f=da.runKernel(gn,h,l);return{nGrams:f[0],nGramsSplits:f[1]}}});var yh={fft:Dc,ifft:Rc,rfft:Cc,irfft:Bc},bh={hammingWindow:Sl,hannWindow:Al,frame:_l,stft:Il},wh={flipLeftRight:Ml,grayscaleToRGB:Tl,resizeNearestNeighbor:Yl,resizeBilinear:Zl,rgbToGrayscale:Dl,rotateWithOffset:Rl,cropAndResize:Nl,nonMaxSuppression:Fl,nonMaxSuppressionAsync:Kl,nonMaxSuppressionWithScore:Vl,nonMaxSuppressionWithScoreAsync:Hl,nonMaxSuppressionPadded:jl,nonMaxSuppressionPaddedAsync:Jl,threshold:Xl,transform:Ql},kh={bandPart:$l,gramSchmidt:eh,qr:rh},xh={absoluteDifference:oh,computeWeightedLoss:ah,cosineDistance:ih,hingeLoss:sh,huberLoss:uh,logLoss:ch,meanSquaredError:lh,sigmoidCrossEntropy:hh,softmaxCrossEntropy:fh},Eh={sparseFillEmptyRows:dh,sparseReshape:ph,sparseSegmentMean:gh,sparseSegmentSum:vh},Sh={stringNGrams:mh,stringSplit:Sa({stringSplit_:function(e,t,n){void 0===n&&(n=!0);var r=ka(e,"input","stringSplit","string"),a=ka(t,"delimiter","stringSplit","string");if(1!==r.rank)throw new Error("Input should be Tensor1D but received shape ".concat(r.shape));if(0!==a.rank)throw new Error("Delimiter should be a scalar but received shape ".concat(a.shape));var o={skipEmpty:n},i={input:r,delimiter:a},s=da.runKernel(vn,i,o);return{indices:s[0],values:s[1],shape:s[2]}}}),stringToHashBucketFast:Sa({stringToHashBucketFast_:function(e,t){var n=ka(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");var a={input:n};return da.runKernel(mn,a,r)}}),staticRegexReplace:Sa({staticRegexReplace_:function(e,t,n,r){void 0===r&&(r=!0);var a=ka(e,"input","staticRegexReplace","string"),o={pattern:t,rewrite:n,replaceGlobal:r};return da.runKernel(dn,{x:a},o)}})},Ah=new Map,_h=new Map,Ih=function(){function e(){}return e.prototype.getClassName=function(){return this.constructor.className},e.fromConfig=function(e,t){return new e(t)},e}(),Nh=function(){function e(){this.classNameMap={}}return e.getMap=function(){return null==e.instance&&(e.instance=new e),e.instance},e.register=function(t){e.getMap().classNameMap[t.className]=[t,t.fromConfig]},e}();function Mh(e,t,n){g(null!=e.className,(function(){return"Class being registered does not have the static className property defined."})),g("string"==typeof e.className,(function(){return"className is required to be a string, but got type "+typeof e.className})),g(e.className.length>0,(function(){return"Class being registered has an empty-string as its className, which is disallowed."})),"undefined"==typeof t&&(t="Custom"),"undefined"==typeof n&&(n=e.className);var r=t+">"+n;return Nh.register(e),Ah.set(r,e),_h.set(e,r),e}var Th={__proto__:null,Serializable:Ih,SerializationMap:Nh,getRegisteredName:function(e){return _h.has(e)?_h.get(e):e.className},registerClass:Mh},Dh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.minimize=function(e,t,n){void 0===t&&(t=!1);var r=this.computeGradients(e,n),a=r.value,o=r.grads;if(null!=n){var i=n.map((function(e){return{name:e.name,tensor:o[e.name]}}));this.applyGradients(i)}else this.applyGradients(o);return Da(o),t?a:(a.dispose(),null)},Object.defineProperty(t.prototype,"iterations",{get:function(){return null==this.iterations_&&(this.iterations_=0),this.iterations_},enumerable:!1,configurable:!0}),t.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},t.prototype.computeGradients=function(e,t){return Ls(e,t)},t.prototype.dispose=function(){null!=this.iterations_&&Da(this.iterations_)},t.prototype.saveIterations=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){return null==this.iterations_&&(this.iterations_=0),[2,{name:"iter",tensor:fs(this.iterations_,"int32")}]}))}))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){throw new Error("getWeights() is not implemented for this optimizer yet.")}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){return o(this,(function(e){throw new Error("setWeights() is not implemented for this optimizer class "+"".concat(this.getClassName()))}))}))},t.prototype.extractIterations=function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=this,[4,e[0].tensor.data()];case 1:return t.iterations_=n.sent()[0],[2,e.slice(1)]}}))}))},t}(Ih);Object.defineProperty(Dh,Symbol.hasInstance,{value:function(e){return null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients}});var Rh=function(e){function t(t,n,r){void 0===r&&(r=null);var a=e.call(this)||this;return a.learningRate=t,a.rho=n,a.epsilon=r,a.accumulatedGrads=[],a.accumulatedUpdates=[],null==r&&(a.epsilon=da.backend.epsilon()),a}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"Adadelta"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=da.registeredVariables[n];null==t.accumulatedGrads[r]&&(t.accumulatedGrads[r]={originalName:"".concat(n,"/accum_grad"),variable:Ta((function(){return $i(a).variable(false)}))}),null==t.accumulatedUpdates[r]&&(t.accumulatedUpdates[r]={originalName:"".concat(n,"/accum_var"),variable:Ta((function(){return $i(a).variable(false)}))});var o=Array.isArray(e)?e[r].tensor:e[n];if(null!=o){var i=t.accumulatedGrads[r].variable,s=t.accumulatedUpdates[r].variable;Ta((function(){var e=To(Bo(i,t.rho),Bo(ps(o),1-t.rho)),n=Bo(Ro(ds(To(s,t.epsilon)),ds(To(i,t.epsilon))),o),r=To(Bo(s,t.rho),Bo(ps(n),1-t.rho));i.assign(e),s.assign(r);var u=To(Bo(n,-t.learningRate),a);a.assign(u)}))}})),this.incrementIterations()},t.prototype.dispose=function(){null!=this.accumulatedUpdates&&(Da(this.accumulatedGrads.map((function(e){return e.variable}))),Da(this.accumulatedUpdates.map((function(e){return e.variable}))))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=u(u([],s(this.accumulatedGrads),!1),s(this.accumulatedUpdates),!1),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map((function(e){return{name:e.originalName,tensor:e.variable}})))]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.extractIterations(e)];case 1:return e=n.sent(),t=e.length/2,!1,this.accumulatedGrads=e.slice(0,t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),this.accumulatedUpdates=e.slice(t,2*t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},t}(Dh),Bh=function(e){function t(t,n){void 0===n&&(n=.1);var r=e.call(this)||this;return r.learningRate=t,r.initialAccumulatorValue=n,r.accumulatedGrads=[],r}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"Adagrad"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=da.registeredVariables[n];if(null==t.accumulatedGrads[r]){t.accumulatedGrads[r]={originalName:"".concat(n,"/accumulator"),variable:Ta((function(){return Ai(a.shape,t.initialAccumulatorValue).variable(false)}))}}var o=Array.isArray(e)?e[r].tensor:e[n];if(null!=o){var i=t.accumulatedGrads[r].variable;Ta((function(){var e=To(i,ps(o));i.assign(e);var n=To(Bo(Ro(o,ds(To(e,da.backend.epsilon()))),-t.learningRate),a);a.assign(n)}))}})),this.incrementIterations()},t.prototype.dispose=function(){null!=this.accumulatedGrads&&Da(this.accumulatedGrads.map((function(e){return e.variable})))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulatedGrads.map((function(e){return{name:e.originalName,tensor:e.variable}})))]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),!1,this.accumulatedGrads=e.map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},t}(Dh),Fh=function(e){function t(t,n,r,a){void 0===a&&(a=null);var o=e.call(this)||this;return o.learningRate=t,o.beta1=n,o.beta2=r,o.epsilon=a,o.accumulatedFirstMoment=[],o.accumulatedSecondMoment=[],Ta((function(){o.accBeta1=fs(n).variable(),o.accBeta2=fs(r).variable()})),null==a&&(o.epsilon=da.backend.epsilon()),o}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"Adam"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this,n=Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e);Ta((function(){var r=Ks(1,t.accBeta1),a=Ks(1,t.accBeta2);n.forEach((function(n,o){var i=da.registeredVariables[n];null==t.accumulatedFirstMoment[o]&&(t.accumulatedFirstMoment[o]={originalName:"".concat(n,"/m"),variable:Ta((function(){return $i(i).variable(false)}))}),null==t.accumulatedSecondMoment[o]&&(t.accumulatedSecondMoment[o]={originalName:"".concat(n,"/v"),variable:Ta((function(){return $i(i).variable(false)}))});var s=Array.isArray(e)?e[o].tensor:e[n];if(null!=s){var u=t.accumulatedFirstMoment[o].variable,c=t.accumulatedSecondMoment[o].variable,l=To(Bo(u,t.beta1),Bo(s,1-t.beta1)),h=To(Bo(c,t.beta2),Bo(ps(s),1-t.beta2)),f=Ro(l,r),d=Ro(h,a);u.assign(l),c.assign(h);var p=To(Bo(Ro(f,To(ds(d),t.epsilon)),-t.learningRate),i);i.assign(p)}})),t.accBeta1.assign(Bo(t.accBeta1,t.beta1)),t.accBeta2.assign(Bo(t.accBeta2,t.beta2))})),this.incrementIterations()},t.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&Da(this.accumulatedFirstMoment.map((function(e){return e.variable}))),null!=this.accumulatedSecondMoment&&Da(this.accumulatedSecondMoment.map((function(e){return e.variable})))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=u(u([],s(this.accumulatedFirstMoment),!1),s(this.accumulatedSecondMoment),!1),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map((function(e){return{name:e.originalName,tensor:e.variable}})))]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){var t,n=this;return o(this,(function(r){switch(r.label){case 0:return[4,this.extractIterations(e)];case 1:return e=r.sent(),Ta((function(){n.accBeta1.assign(hs(n.beta1,n.iterations_+1)),n.accBeta2.assign(hs(n.beta2,n.iterations_+1))})),t=e.length/2,!1,this.accumulatedFirstMoment=e.slice(0,t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),this.accumulatedSecondMoment=e.slice(t,2*t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},t}(Dh),Ch=function(e){function t(t,n,r,a,o){void 0===a&&(a=null),void 0===o&&(o=0);var i=e.call(this)||this;return i.learningRate=t,i.beta1=n,i.beta2=r,i.epsilon=a,i.decay=o,i.accumulatedFirstMoment=[],i.accumulatedWeightedInfNorm=[],Ta((function(){i.iteration=fs(0).variable(),i.accBeta1=fs(n).variable()})),null==a&&(i.epsilon=da.backend.epsilon()),i}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"Adamax"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this,n=Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e);Ta((function(){var r=Ks(1,t.accBeta1),a=Ro(-t.learningRate,To(Bo(t.iteration,t.decay),1));n.forEach((function(n,o){var i=da.registeredVariables[n];null==t.accumulatedFirstMoment[o]&&(t.accumulatedFirstMoment[o]={originalName:"".concat(n,"/m"),variable:$i(i).variable(false)}),null==t.accumulatedWeightedInfNorm[o]&&(t.accumulatedWeightedInfNorm[o]={originalName:"".concat(n,"/v"),variable:$i(i).variable(false)});var s=Array.isArray(e)?e[o].tensor:e[n];if(null!=s){var u=t.accumulatedFirstMoment[o].variable,c=t.accumulatedWeightedInfNorm[o].variable,l=To(Bo(u,t.beta1),Bo(s,1-t.beta1)),h=Bo(c,t.beta2),f=Fo(s),d=nu(h,f);u.assign(l),c.assign(d);var p=To(Bo(Ro(a,r),Ro(l,To(d,t.epsilon))),i);i.assign(p)}})),t.iteration.assign(To(t.iteration,1)),t.accBeta1.assign(Bo(t.accBeta1,t.beta1))})),this.incrementIterations()},t.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&Da(this.accumulatedFirstMoment.map((function(e){return e.variable}))),null!=this.accumulatedWeightedInfNorm&&Da(this.accumulatedWeightedInfNorm.map((function(e){return e.variable})))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){throw new Error("getWeights() is not implemented for Adamax yet.")}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){return o(this,(function(e){throw new Error("setWeights() is not implemented for Adamax yet.")}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},t}(Dh),Ph=function(e){function t(t){var n=e.call(this)||this;return n.learningRate=t,n.setLearningRate(t),n}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"SGD"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=Array.isArray(e)?e[r].tensor:e[n];if(null!=a){var o=da.registeredVariables[n];Ta((function(){var e=To(Bo(t.c,a),o);o.assign(e)}))}})),this.incrementIterations()},t.prototype.setLearningRate=function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=Ra(fs(-e))},t.prototype.dispose=function(){this.c.dispose()},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()]]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:if(0!==(e=t.sent()).length)throw new Error("SGD optimizer does not have settable weights.");return[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate}},t.fromConfig=function(e,t){return new e(t.learningRate)},t}(Dh),Oh=function(e){function t(t,n,r){void 0===r&&(r=!1);var a=e.call(this,t)||this;return a.learningRate=t,a.momentum=n,a.useNesterov=r,a.accumulations=[],a.m=fs(a.momentum),a}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"Momentum"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=da.registeredVariables[n];if(null==t.accumulations[r]){t.accumulations[r]={originalName:"".concat(n,"/momentum"),variable:Ta((function(){return $i(a).variable(false)}))}}var o=t.accumulations[r].variable,i=Array.isArray(e)?e[r].tensor:e[n];null!=i&&Ta((function(){var e,n=To(Bo(t.m,o),i);e=t.useNesterov?To(Bo(t.c,To(i,Bo(n,t.m))),a):To(Bo(t.c,n),a),o.assign(n),a.assign(e)}))})),this.incrementIterations()},t.prototype.dispose=function(){this.m.dispose(),null!=this.accumulations&&Da(this.accumulations.map((function(e){return e.variable})))},t.prototype.setMomentum=function(e){this.momentum=e},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulations.map((function(e){return{name:e.originalName,tensor:e.variable}})))]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),!1,this.accumulations=e.map((function(e){return{originalName:e.name,variable:e.tensor.variable(false)}})),[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},t}(Ph),Lh=function(e){function t(t,n,r,a,o){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===a&&(a=null),void 0===o&&(o=!1);var i=e.call(this)||this;if(i.learningRate=t,i.decay=n,i.momentum=r,i.epsilon=a,i.accumulatedMeanSquares=[],i.accumulatedMoments=[],i.accumulatedMeanGrads=[],i.centered=o,null==a&&(i.epsilon=da.backend.epsilon()),null==t)throw new Error("learningRate for RMSPropOptimizer must be defined.");return i}return r(t,e),Object.defineProperty(t,"className",{get:function(){return"RMSProp"},enumerable:!1,configurable:!0}),t.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=da.registeredVariables[n],o=!1;null==t.accumulatedMeanSquares[r]&&(t.accumulatedMeanSquares[r]={originalName:"".concat(n,"/rms"),variable:Ta((function(){return $i(a).variable(o)}))}),null==t.accumulatedMoments[r]&&(t.accumulatedMoments[r]={originalName:"".concat(n,"/momentum"),variable:Ta((function(){return $i(a).variable(o)}))}),null==t.accumulatedMeanGrads[r]&&t.centered&&(t.accumulatedMeanGrads[r]={originalName:"".concat(n,"/mg"),variable:Ta((function(){return $i(a).variable(o)}))});var i=Array.isArray(e)?e[r].tensor:e[n];if(null!=i){var s=t.accumulatedMeanSquares[r].variable,u=t.accumulatedMoments[r].variable;Ta((function(){var e=To(Bo(s,t.decay),Bo(ps(i),1-t.decay));if(t.centered){var n=t.accumulatedMeanGrads[r].variable,o=To(Bo(n,t.decay),Bo(i,1-t.decay)),c=Ro(Bo(i,t.learningRate),ds(Ks(e,To(ps(o),t.epsilon)))),l=To(Bo(u,t.momentum),c);s.assign(e),n.assign(o),u.assign(l);var h=Ks(a,l);a.assign(h)}else{var f=To(Bo(s,t.decay),Bo(ps(i),1-t.decay));l=To(Bo(u,t.momentum),Ro(Bo(i,t.learningRate),ds(To(f,t.epsilon))));s.assign(f),u.assign(l);h=Ks(a,l);a.assign(h)}}))}})),this.incrementIterations()},t.prototype.dispose=function(){null!=this.accumulatedMeanSquares&&Da(this.accumulatedMeanSquares.map((function(e){return e.variable}))),null!=this.accumulatedMeanGrads&&this.centered&&Da(this.accumulatedMeanGrads.map((function(e){return e.variable}))),null!=this.accumulatedMoments&&Da(this.accumulatedMoments.map((function(e){return e.variable})))},t.prototype.getWeights=function(){return a(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=u(u([],s(this.accumulatedMeanSquares),!1),s(this.accumulatedMoments),!1),this.centered&&e.push.apply(e,u([],s(this.accumulatedMeanGrads),!1)),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map((function(e){return{name:e.originalName,tensor:e.variable}})))]}}))}))},t.prototype.setWeights=function(e){return a(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this.extractIterations(e)];case 1:return e=r.sent(),t=this.centered?e.length/3:e.length/2,n=!1,this.accumulatedMeanSquares=e.slice(0,t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(n)}})),this.accumulatedMoments=e.slice(t,2*t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(n)}})),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((function(e){return{originalName:e.name,variable:e.tensor.variable(n)}}))),[2]}}))}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},t}(Dh),zh=[Rh,Bh,Fh,Ch,Oh,Lh,Ph];function Uh(e){return new Promise((function(e){return setTimeout(e)})).then(e)}var Wh=function(){function e(t){if(!Z().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(e.URL_SCHEME)&&(t=t.slice(e.URL_SCHEME.length)),null!=t&&0!==t.length||(t="model"),this.modelJsonFileName=t+".json",this.weightDataFileName=t+".weights.bin"}return e.prototype.save=function(e){return a(this,void 0,void 0,(function(){var t,n,r,a,i,s,u;return o(this,(function(o){switch(o.label){case 0:if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(t=Ma.join(e.weightData),n=window.URL.createObjectURL(new Blob([t],{type:"application/octet-stream"})),!(e.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return r=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a=Ka(e,r),i=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),(s=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor).download=this.modelJsonFileName,s.href=i,[4,Uh((function(){return s.dispatchEvent(new MouseEvent("click"))}))];case 2:return o.sent(),null==e.weightData?[3,4]:((u=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,u.href=n,[4,Uh((function(){return u.dispatchEvent(new MouseEvent("click"))}))]);case 3:o.sent(),o.label=4;case 4:return[2,{modelArtifactsInfo:ja(e)}]}}))}))},e}();Wh.URL_SCHEME="downloads://";var Gh=function(){function e(e){if(null==e||e.length<1)throw new Error("When calling browserFiles, at least 1 file is required, "+"but received ".concat(e));this.jsonFile=e[0],this.weightsFiles=e.slice(1)}return e.prototype.load=function(){return a(this,void 0,void 0,(function(){var e=this;return o(this,(function(t){return[2,new Promise((function(t,n){var r=new FileReader;r.onload=function(r){var a=JSON.parse(r.target.result),o=a.modelTopology;if(null!=o)if(null!=a.weightsManifest)if(0!==e.weightsFiles.length){var i=Ha(a,(function(t){return e.loadWeights(t)}));t(i)}else t({modelTopology:o});else n(new Error("weightManifest field is missing from file ".concat(e.jsonFile.name)));else n(new Error("modelTopology field is missing from file ".concat(e.jsonFile.name)))},r.onerror=function(t){return n("Failed to read model topology and weights manifest JSON "+"from file '".concat(e.jsonFile.name,"'. BrowserFiles supports loading ")+"Keras-style tf.Model artifacts only.")},r.readAsText(e.jsonFile)}))]}))}))},e.prototype.loadWeights=function(e){var t,n,r=this,a=[],o=[];try{for(var c=i(e),l=c.next();!l.done;l=c.next()){var h=l.value;a.push.apply(a,u([],s(h.weights),!1)),o.push.apply(o,u([],s(h.paths),!1))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}var f=this.checkManifestAndWeightFiles(e),d=o.map((function(e){return r.loadWeightsFile(e,f[e])}));return Promise.all(d).then((function(e){return[a,e]}))},e.prototype.loadWeightsFile=function(e,t){return new Promise((function(n,r){var a=new FileReader;a.onload=function(e){var t=e.target.result;n(t)},a.onerror=function(t){return r("Failed to weights data from file of path '".concat(e,"'."))},a.readAsArrayBuffer(t)}))},e.prototype.checkManifestAndWeightFiles=function(e){var t,n,r=this,a=[],o=this.weightsFiles.map((function(e){return qa(e.name)})),s={};try{for(var u=i(e),c=u.next();!c.done;c=u.next()){c.value.paths.forEach((function(e){var t=qa(e);if(-1!==a.indexOf(t))throw new Error("Duplicate file basename found in weights manifest: "+"'".concat(t,"'"));if(a.push(t),-1===o.indexOf(t))throw new Error("Weight file with basename '".concat(t,"' is not provided."));s[e]=r.weightsFiles[o.indexOf(t)]}))}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}if(a.length!==this.weightsFiles.length)throw new Error("Mismatch in the number of files in weights manifest "+"(".concat(a.length,") and the number of weight files provided ")+"(".concat(this.weightsFiles.length,")."));return s},e}();function qh(e,t,n,r){!function(e){g(null!=e&&Array.isArray(e)&&e.length>0,(function(){return"promises must be a none empty array"}))}(e),function(e,t){g(e>=0&&e<=1,(function(){return"Progress fraction must be in range [0, 1], but "+"got startFraction ".concat(e)})),g(t>=0&&t<=1,(function(){return"Progress fraction must be in range [0, 1], but "+"got endFraction ".concat(t)})),g(t>=e,(function(){return"startFraction must be no more than endFraction, but "+"got startFraction ".concat(e," and endFraction ")+"".concat(t)}))}(n=null==n?0:n,r=null==r?1:r);var a=0;return Promise.all(e.map((function(o){return o.then((function(o){var i=n+ ++a/e.length*(r-n);return t(i),o})),o})))}function Kh(e,t){return a(this,void 0,void 0,(function(){var n,r,a,i,s,u,c,l,h;return o(this,(function(o){switch(o.label){case 0:return null==t&&(t={}),n=null==t.fetchFunc?Z().platform.fetch:t.fetchFunc,r=e.map((function(e){return n(e,t.requestInit,{isBinary:!0})})),a=0,i=.5,null!=t.onProgress?[3,2]:[4,Promise.all(r)];case 1:return s=o.sent(),[3,4];case 2:return[4,qh(r,t.onProgress,a,i)];case 3:s=o.sent(),o.label=4;case 4:return u=s.map((function(e){return e.arrayBuffer()})),c=.5,l=1,null!=t.onProgress?[3,6]:[4,Promise.all(u)];case 5:return h=o.sent(),[3,8];case 6:return[4,qh(u,t.onProgress,c,l)];case 7:h=o.sent(),o.label=8;case 8:return[2,h]}}))}))}function Vh(e){var t=this;return function(n,r,i){return void 0===r&&(r=""),a(t,void 0,void 0,(function(){var t,a,s,u,c,l,h,f,d,p;return o(this,(function(o){switch(o.label){case 0:if(t=n.map((function(){return!1})),a={},s=null!=i?i.map((function(){return!1})):[],u=[],n.forEach((function(e,n){var r=0;e.weights.forEach((function(e){var o="quantization"in e?e.quantization.dtype:e.dtype,c=Na[o]*y(e.shape),l=function(){t[n]=!0,null==a[n]&&(a[n]=[]),a[n].push({manifestEntry:e,groupOffset:r,sizeBytes:c})};null!=i?i.forEach((function(t,n){t===e.name&&(l(),s[n]=!0)})):l(),u.push(e.name),r+=c}))})),!s.every((function(e){return e})))throw c=i.filter((function(e,t){return!s[t]})),new Error("Could not find weights in manifest with names: "+"".concat(c.join(", "),". \n")+"Manifest JSON has weights with names: "+"".concat(u.join(", "),"."));return l=t.reduce((function(e,t,n){return t&&e.push(n),e}),[]),h=[],l.forEach((function(e){n[e].paths.forEach((function(e){var t=r+(r.endsWith("/")?"":"/")+e;h.push(t)}))})),[4,e(h)];case 1:return f=o.sent(),d={},p=0,l.forEach((function(e){var t=n[e].paths.length,r=new Ma(f.slice(p,p+t));a[e].forEach((function(e){var t=Ca(r.slice(e.groupOffset,e.groupOffset+e.sizeBytes),[e.manifestEntry]);for(var n in t)d[n]=t[n]})),p+=t})),[2,d]}}))}))}}Za.registerSaveRouter((function(e){return Z().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Wh.URL_SCHEME)?function(e){void 0===e&&(e="model");return new Wh(e)}(e.slice(Wh.URL_SCHEME.length)):null}));var Hh=function(){function e(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?(g("function"==typeof t.fetchFunc,(function(){return"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=Z().platform.fetch,g(null!=e&&e.length>0,(function(){return"URL path for http must not be null, undefined or empty."})),Array.isArray(e)&&g(2===e.length,(function(){return"URL paths for http must have a length of 2, "+"(actual length is ".concat(e.length,").")})),this.path=e,null!=t.requestInit&&null!=t.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}return e.prototype.save=function(e){return a(this,void 0,void 0,(function(){var t,n,r,a,i;return o(this,(function(o){switch(o.label){case 0:if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r=Ka(e,n),t.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=e.weightData&&(a=Ma.join(e.weightData),t.body.append("model.weights.bin",new Blob([a],{type:"application/octet-stream"}),"model.weights.bin")),[4,this.fetch(this.path,t)];case 1:if((i=o.sent()).ok)return[2,{modelArtifactsInfo:ja(e),responses:[i]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+"".concat(i.status,"."))}}))}))},e.prototype.loadModelJSON=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,a;return o(this,(function(o){switch(o.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(e=o.sent()).ok)throw new Error("Request to ".concat(this.path," failed with status code ")+"".concat(e.status,". Please verify this URL points to ")+"the model JSON of the model to load.");o.label=2;case 2:return o.trys.push([2,4,,5]),[4,e.json()];case 3:return t=o.sent(),[3,5];case 4:throw o.sent(),n="Failed to parse model JSON of response from ".concat(this.path,"."),this.path.endsWith(".pb")?n+=" 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.":n+=" Please make sure the server is serving valid JSON for this request.",new Error(n);case 5:if(r=t.modelTopology,a=t.weightsManifest,null==r&&null==a)throw new Error("The JSON from HTTP path ".concat(this.path," contains neither model ")+"topology or manifest for weights.");return[2,t]}}))}))},e.prototype.load=function(){return a(this,void 0,void 0,(function(){var e=this;return o(this,(function(t){switch(t.label){case 0:return this.loadOptions.streamWeights?[2,this.loadStream()]:[4,this.loadModelJSON()];case 1:return[2,Ha(t.sent(),(function(t){return e.loadWeights(t)}))]}}))}))},e.prototype.loadStream=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,i=this;return o(this,(function(s){switch(s.label){case 0:return[4,this.loadModelJSON()];case 1:return e=s.sent(),[4,this.getWeightUrls(e.weightsManifest)];case 2:return t=s.sent(),n=Ja(e.weightsManifest),r=function(){return function(e,t){var n,r,i=this,s=null==t.fetchFunc?Z().platform.fetch:t.fetchFunc,u=0;return null===(n=t.onProgress)||void 0===n||n.call(t,0),new ReadableStream({pull:function(n){return a(i,void 0,void 0,(function(){var a,i,c,l,h;return o(this,(function(o){switch(o.label){case 0:return ut?e.substring(n):"";return[r+"/",a]}(t),2),r=n[0],a=n[1],c=this.weightPathPrefix||r,l=[],h=[];try{for(f=i(e),d=f.next();!d.done;d=f.next()){p=d.value;try{for(S=void 0,g=i(p.paths),v=g.next();!v.done;v=g.next())m=v.value,null!=this.weightUrlConverter?h.push(this.weightUrlConverter(m)):l.push(c+m+a)}catch(e){S={error:e}}finally{try{v&&!v.done&&(A=g.return)&&A.call(g)}finally{if(S)throw S.error}}}}catch(e){x={error:e}}finally{try{d&&!d.done&&(E=f.return)&&E.call(f)}finally{if(x)throw x.error}}return this.weightUrlConverter?(b=(y=l.push).apply,w=[l],k=[[]],[4,Promise.all(h)]):[3,2];case 1:b.apply(y,w.concat([u.apply(void 0,k.concat([s.apply(void 0,[o.sent()]),!1]))])),o.label=2;case 2:return[2,l]}}))}))},e.prototype.loadWeights=function(e){return a(this,void 0,void 0,(function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,this.getWeightUrls(e)];case 1:return t=a.sent(),n=Ja(e),[4,Kh(t,this.loadOptions)];case 2:return r=a.sent(),[2,[n,r]]}}))}))},e}();function jh(e){return null!=e.match(Hh.URL_SCHEME_REGEX)}Hh.URL_SCHEME_REGEX=/^https?:\/\//;var Jh=function(e,t){if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;return(Array.isArray(e)?e.every((function(e){return jh(e)})):jh(e))?Zh(e,t):null};function Zh(e,t){return new Hh(e,t)}Za.registerSaveRouter(Jh),Za.registerLoadRouter(Jh);var Yh=function(){function e(e){this.modelArtifacts=e}return e.prototype.load=function(){return this.modelArtifacts},e}(),Xh=function(){function e(e){this.saveHandler=e}return e.prototype.save=function(e){return this.saveHandler(e)},e}(),Qh=function(e){e.load&&(this.load=function(){return Promise.resolve(e.load())}),e.save&&(this.save=function(t){return Promise.resolve(e.save(t))})};function $h(e,t,n,r){if(1===arguments.length){var a=null!=e.modelTopology||null!=e.weightSpecs;return a?new Yh(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Yh({modelTopology:e}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Yh({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r})}var ef={__proto__:null,CompositeArrayBuffer:Ma,browserFiles:function(e){return new Gh(e)},browserHTTPRequest:function(e,t){return Zh(e,t)},concatenateArrayBuffers:function(e){return Ma.join(e)},copyModel:function(e,t){return a(this,void 0,void 0,(function(){return o(this,(function(n){return!1,[2,ko(e,t,false)]}))}))},decodeWeights:Ca,decodeWeightsStream:function(e,t){return a(this,void 0,void 0,(function(){var n,r,s,u,c,l,h,f,d,p,g,v,m,b=this;return o(this,(function(w){switch(w.label){case 0:n={},r=e.getReader(),s=new ArrayBuffer(0),w.label=1;case 1:w.trys.push([1,7,8,9]),u=i(t),c=u.next(),w.label=2;case 2:return c.done?[3,6]:[4,Oa(l=c.value,(function(e,t){return a(b,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,za(r,s,t)];case 1:return[2,(s=n.sent()).slice(e,t)]}}))}))}))];case 3:return h=w.sent(),[4,za(r,s,h)];case 4:s=w.sent(),f=s.slice(0,h),s=s.slice(h),d=La(l,f),n[l.name]=d,"webgpu"===Ba()&&"uploadToGPU"in(p=Fa())&&y(d.shape)>=Z().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&p.uploadToGPU(d.dataId),w.label=5;case 5:return c=u.next(),[3,2];case 6:return[3,9];case 7:return g=w.sent(),v={error:g},[3,9];case 8:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(v)throw v.error}return[7];case 9:return[2,n]}}))}))},encodeWeights:function(e,t){return a(this,void 0,void 0,(function(){var n,r,i,s,u,c=this;return o(this,(function(l){switch(l.label){case 0:for(n=[],r=[],i=Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e),s=function(s){var u=i[s],l=Array.isArray(e)?e[s].tensor:e[u];if("float32"!==l.dtype&&"int32"!==l.dtype&&"bool"!==l.dtype&&"string"!==l.dtype&&"complex64"!==l.dtype)throw new Error("Unsupported dtype in weight '".concat(u,"': ").concat(l.dtype));var h={name:u,shape:l.shape,dtype:l.dtype};if("string"===l.dtype){var f=new Promise((function(e){return a(c,void 0,void 0,(function(){var t,n,r,a,i,s,u;return o(this,(function(o){switch(o.label){case 0:return[4,l.bytes()];case 1:for(t=o.sent(),n=t.reduce((function(e,t){return e+t.length}),0)+4*t.length,r=new Uint8Array(n),a=0,i=0;i0&&Number.isInteger(n),(function(){return"If provided, numClasses must be a positive integer, "+"but got ".concat(n)})),g(1===r.rank,(function(){return"Expected the rank of labels to be 1, but got ".concat(r.rank)})),g(1===a.rank,(function(){return"Expected the rank of predictions to be 1, "+"but got ".concat(a.rank)})),g(r.shape[0]===a.shape[0],(function(){return"Mismatch in the number of examples: "+"".concat(r.shape[0]," vs. ").concat(a.shape[0],". ")+"Labels and predictions should have the same number of elements."})),g(n>0&&Number.isInteger(n),(function(){return"numClasses is required to be a positive integer, but got "+"".concat(n)}));var o=du(Io(r,"int32"),n),i=du(Io(a,"int32"),n),s=al(o),u=li(s,i);return Io(u,"int32")}})},rf=!1;function af(e,t){if(void 0===t&&(t=3),t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=!1,r=!1,a=!1,o=!1,i=!1,u=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)a=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)o=!0;else if(null!=e.getContext)i=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, "+"but was ".concat(e.constructor.name));u=!0}if(null!=Pn(Nn,da.backendName)){var c={pixels:e},l={numChannels:t};return da.runKernel(Nn,c,l)}var h,f,d=s(a?[e.videoWidth,e.videoHeight]:[e.width,e.height],2),p=d[0],g=d[1];if(i)h=e.getContext("2d").getImageData(0,0,p,g).data;else if(r||n)h=e.data;else if(o||a||u){if(null==tf)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");tf=new OffscreenCanvas(1,1).getContext("2d")}else tf=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});tf.canvas.width=p,tf.canvas.height=g,tf.drawImage(e,0,0,p,g),h=tf.getImageData(0,0,p,g).data}if(4===t)f=new Int32Array(h);else{var v=p*g;f=new Int32Array(v*t);for(var m=0;m4||2===t)throw new Error("toPixels only supports depth of size "+"1, 3 or 4 but got ".concat(t));if("float32"!==e.dtype&&"int32"!==e.dtype)throw new Error("Unsupported type for toPixels: ".concat(e.dtype,".")+" Please use float32 or int32 tensors.")}var uf={__proto__:null,draw:function(e,t,n){var r=ka(e,"img","draw");if(!(e instanceof Vr)){var a=r;r=Io(a,"int32"),a.dispose()}sf(r),function(e){var t=(null==e?void 0:e.alpha)||1;if(t>1||t<0)throw new Error("Alpha value ".concat(t," is suppoed to be in range [0 - 1]."))}(null==n?void 0:n.imageOptions);var o={image:r},i={canvas:t,options:n};da.runKernel(Le,o,i)},fromPixels:Sa({fromPixels_:af}),fromPixelsAsync:function(e,t){return void 0===t&&(t=3),a(this,void 0,void 0,(function(){var n,r;return o(this,(function(a){switch(a.label){case 0:if(n=null,!Z().getBool("WRAP_TO_IMAGEBITMAP")||!of(e))return[3,5];r=void 0,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,createImageBitmap(e,{premultiplyAlpha:"none"})];case 2:return r=a.sent(),[3,4];case 3:return a.sent(),r=null,[3,4];case 4:return n=null!=r&&r.width===e.width&&r.height===e.height?r:e,[3,6];case 5:n=e,a.label=6;case 6:return[2,af(n,t)]}}))}))},toPixels:function(e,t){return a(this,void 0,void 0,(function(){var n,r,a,i,u,c,l,h,f,d,p,g,v,m,y,b;return o(this,(function(o){switch(o.label){case 0:return n=ka(e,"img","toPixels"),e instanceof Vr||(n=Io(r=n,"int32"),r.dispose()),sf(n),a=s(n.shape.slice(0,2),2),i=a[0],u=a[1],c=2===n.rank?1:n.shape[2],[4,n.data()];case 1:for(l=o.sent(),h="float32"===n.dtype?255:1,f=new Uint8ClampedArray(u*i*4),d=0;d1)throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(v,"."))}else if("int32"===n.dtype&&(v<0||v>255))throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(v,"."));1===c?(p[0]=v*h,p[1]=v*h,p[2]=v*h):p[g]=v*h}f[(m=4*d)+0]=Math.round(p[0]),f[m+1]=Math.round(p[1]),f[m+2]=Math.round(p[2]),f[m+3]=Math.round(p[3])}return null!=t&&(rf||null!=Pn(Le,da.backendName)&&(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),rf=!0),t.width=u,t.height=i,y=t.getContext("2d"),b=new ImageData(f,u,i),y.putImageData(b,0,0)),n!==e&&n.dispose(),[2,f]}}))}))}};function cf(e,t){var n=e.shape.length,r=t.shape.length;if(n<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher,"+" but the rank was ".concat(n,"."));if(r<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(r,"."));if("int32"!==t.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type,"+" but the dtype was ".concat(t.dtype,"."));if(t.shape[r-1]>n)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+"".concat(t.shape[r-1]," vs. ").concat(n));if(0===y(e.shape))throw new Error("Requested more than 0 entries, but input is empty."+" Input shape: ".concat(e.shape,"."));for(var a=t.shape,o=a[a.length-1],i=1,c=0;c-1)o[c]=0;else{var l=ff(t,n,c),h=r[l];e&1<-1)o[c]=Number.MAX_SAFE_INTEGER;else{var l=ff(t,n,c),h=r[l];e&1<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var u=r[a];return i<0&&(i+=u),i=d(0,i,u-1)}function yf(e,t,n,r,a,o){var i=t[a],s=n[a]||1;(e&1<0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var u=r[a];return i<0&&(i+=u),i=s>0?d(0,i,u):d(-1,i,u-1)}function bf(e,t,n,r,a,o){if(a[t])return n>0?o[t]:o[t+1&1];var i=e<0?r+e:e;return io[1]?o[1]:i}var wf,kf={__proto__:null,assertParamsValid:function(e,t,n){var r=e.shape.length;g(r===t.length,(function(){return"Error in slice".concat(r,"D: Length of begin ").concat(t," must ")+"match the rank of the array (".concat(r,").")})),g(r===n.length,(function(){return"Error in slice".concat(r,"D: Length of size ").concat(n," must ")+"match the rank of the array (".concat(r,").")}));for(var a=function(a){g(t[a]+n[a]<=e.shape[a],(function(){return"Error in slice".concat(r,"D: begin[").concat(a,"] + size[").concat(a,"] ")+"(".concat(t[a]+n[a],") would overflow input.shape[").concat(a,"] (").concat(e.shape[a],")")}))},o=0;o0?e[e.length-1]:1,r=0;r0){var d=t[0],p=n+1;l=pf(i,d,p,r,e),h=gf(s,d,p,a,e),f=hf(o,d,p,e)}else for(var g=0;g1){r=a;break}for(a=r+1;a0||n[a]!==e[a])return!1;return!0},maskToAxes:function(e){for(var t=[],n=0;e>0;)1&e&&t.push(n),e/=2,n++;return t},parseSliceParams:function(e,t,n){var r,a,o=e.shape.length;return(r="number"==typeof t?u([t],s(new Array(o-1).fill(0)),!1):t.length=0?t:(g(-1===t,(function(){return"Negative size values should be exactly -1 but got "+"".concat(t," for the slice() size at index ").concat(n,".")})),e.shape[n]-r[n])})),[r,a]},sliceInfo:function(e,t,n,r,a,o,i,s,u){var c;if(null==r?(c=new Array(t.length)).fill(1):c=r,null!=i&&0!=(i&i-1))throw new Error("Multiple ellipses in slice is not allowed.");for(var l=!1,h={dims:c.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:c.slice(),beginMask:a,endMask:o,ellipsisMask:i,newAxisMask:s,shrinkAxisMask:u},f=0;f0?0:-1,d.strides[f]>0?w:w-1];if(b&&d.strides[f]<=0)throw Error("only stride 1 allowed on non-range indexing.");v=v&&1===d.strides[f];var E=!!(d.beginMask&1<=w)throw Error("slice index ".concat(d.begin[f]," of dimension ").concat(f," out of bounds."))}else d.begin[f]=bf(d.begin[f],0,d.strides[f],w,k,x),d.end[f]=bf(d.end[f],1,d.strides[f],w,k,x);var A=1===d.strides[f]&&0===d.begin[f]&&d.end[f]===w;p=p&&A,g=g&&(0===f&&1===d.strides[f]||A)}else p=p&&1===d.strides[f]&&E,g=g&&(0===f&&1===d.strides[f]||E);var _=void 0,I=!1;if(d.beginValid&&d.endValid?(_=d.end[f]-d.begin[f],I=!0):b?(_=1,I=!0):E&&w>=0&&(_=d.strides[f]<0?-w:w,I=!0),I){var N=void 0;N=0===_||_<0!=d.strides[f]<0?0:Math.trunc(_/d.strides[f])+(_%d.strides[f]!=0?1:0),m.push(N)}else m.push(-1)}else m.push(b?1:-1)}for(var M=0;M=0?y.push(m[T]):-2===T&&y.push(1)}var D=y.filter((function(e,t){return-2!==d.finalShapeGatherIndices[t]}));return{finalShapeSparse:D,finalShape:y,isIdentity:p,sliceDim0:g,isSimpleSlice:v,begin:d.begin,end:d.end,strides:d.strides}},startForAxis:mf,startIndicesWithElidedDims:pf,stopForAxis:yf,stopIndicesWithElidedDims:gf,stridesForAxis:vf,stridesWithElidedDims:hf},xf=function(){function e(){}return e.sgd=function(e){return new Ph(e)},e.momentum=function(e,t,n){return void 0===n&&(n=!1),new Oh(e,t,n)},e.rmsprop=function(e,t,n,r,a){return void 0===t&&(t=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===a&&(a=!1),new Lh(e,t,n,r,a)},e.adam=function(e,t,n,r){return void 0===e&&(e=.001),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new Fh(e,t,n,r)},e.adadelta=function(e,t,n){return void 0===e&&(e=.001),void 0===t&&(t=.95),void 0===n&&(n=null),new Rh(e,t,n)},e.adamax=function(e,t,n,r,a){return void 0===e&&(e=.002),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===a&&(a=0),new Ch(e,t,n,r,a)},e.adagrad=function(e,t){return void 0===t&&(t=.1),new Bh(e,t)},e}(),Ef=xf,Sf="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:function(e){return e()};!function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"}(wf||(wf={}));var Af="->",_f=/->/g;function If(e,t){for(var n=[],r=0;r=0&&t1)throw new Error('Equation must contain exactly one arrow ("'.concat(Af,'").'));var r=s(e.split(Af),2),a=r[0],o=r[1];g(-1===a.indexOf("..."),(function(){return'The ellipsis notation ("'.concat("...",'") is not supported yet.')}));var i=a.split(","),u=i.length;if(t!==u)throw new Error("Expected ".concat(u," input tensors, received ").concat(t));if(u>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");for(var c=[],l=function(e){var t=o[e];if(!i.some((function(e){return-1!==e.indexOf(t)})))throw new Error("Output subscripts contain the label ".concat(t," ")+"not present in the input subscripts.");-1===c.indexOf(t)&&c.push(t)},h=0;h=2*t+1||a%2==1?i.push(a):o.push(a);r.push.apply(r,u([],s(o),!1)),r.push(0),r.push.apply(r,u([],s(i),!1))}return r},getRaggedRank:function(e){return 0===e.length?0:e[0]===wf.FIRST_DIM_SIZE?e.length-1:e.length},getReductionAxes:Ji,getReshaped:function(e,t,n,r){void 0===r&&(r=!0);var a=[];if(r)(a=a.concat(t.slice(0))).push(e[0]/n),a=a.concat(e.slice(1));else{a=a.concat(e[0]);for(var o=t.length,i=0;i= ").concat(n)},getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:function(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"},getSparseReshapeInputOutputMismatchErrorMessage:function(e,t){var n=y(e),r=y(t);return"Input to reshape is a tensor with ".concat(n," dense values, but the requested shape has ").concat(r,". inputShape=").concat(e," outputShape=").concat(t)},getSparseReshapeInputOutputMultipleErrorMessage:function(e,t){var n=y(e),r=y(t);return"Input to reshape is a SparseTensor with ".concat(n,"\n dense values, but the requested shape requires a multiple of ").concat(r,". inputShape=").concat(e," outputShape= ").concat(t)},getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:function(e,t){return"only one output dimension may be -1, not both ".concat(e," and ").concat(t)},getSparseReshapeNegativeOutputDimErrorMessage:function(e,t){return"size ".concat(e," must be non-negative, not ").concat(t)},getSparseSegmentReductionIndicesOutOfRangeErrorMessage:function(e,t,n){return"Bad: indices[".concat(e,"] == ").concat(t," out of range [0, ").concat(n,")")},getSparseSegmentReductionNegativeSegmentIdsErrorMessage:function(){return"segment ids must be >= 0"},getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:function(){return"segment ids are not increasing"},getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:function(e,t){return"Segment id ".concat(e," out of range [0, ").concat(t,"), possibly because segmentIds input is not sorted.")},getUndoAxesPermutation:function(e){return e.map((function(e,t){return[t,e]})).sort((function(e,t){return e[1]-t[1]})).map((function(e){return e[0]}))},isIdentityPermutation:function(e){return e.every((function(e,t){return e===t}))},log:function(){for(var e=[],t=0;t0?e+t:e}));t[a]=e.shape[n]-o}g(e.shape[n]===t.reduce((function(e,t){return e+t})),(function(){return"The sum of sizes must match the size of the axis dimension."})),r=t}return r},segment_util:{__proto__:null,collectGatherOpShapeInfo:function(e,t,n,r){var a=t.shape.length,o=e.shape.length;if(0!==r&&(r<-a||r>a))throw new Error("Expect batchDims in the range of [-".concat(a,", ").concat(a,"], but got ").concat(r));if(r<0&&(r+=a),r>o)throw new Error("batchDims (".concat(r,") must be less than rank(x) (\n ").concat(o,")."));if(nt||n===e?r=!0:n=P(e,n+1);return n}},shouldFuse:ml,slice_util:kf,splitRealAndImagArrays:function(e){for(var t=new Float32Array(e.length/2),n=new Float32Array(e.length/2),r=0;r=r)throw new Error("defaultValue.shape=".concat(e," and ragged tensor flatValues.shape=").concat(t,", are incompatible: defaultValue.rank = ").concat(n," must be less than ragged tensor input flatValues.rank = ").concat(r,")"));for(var a=0;a=0&&i>=0&&1!==o&&o!==i)throw new Error("defaultValue.shape=".concat(e,", and ragged tensor input flatValues.shape=").concat(t," are incompatible: defaultValue.shape[").concat(a-e.length,"] = ").concat(o," but ragged tensor input.flatValues.shape[").concat(a-e.length,"] = ").concat(i))}}},validateInput:Hc,validateUpdateShape:Vc,warn:Bn},Mf={__proto__:null,nonMaxSuppressionV3Impl:Ol,nonMaxSuppressionV4Impl:Ll,nonMaxSuppressionV5Impl:zl,whereImpl:tl};!function(){var e,t;try{for(var n=i(zh),r=n.next();!r.done;r=n.next()){Mh(r.value)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}}(),e.Abs="Abs",e.Acos=Q,e.Acosh=$,e.AdadeltaOptimizer=Rh,e.AdagradOptimizer=Bh,e.AdamOptimizer=Fh,e.AdamaxOptimizer=Ch,e.Add=ee,e.AddN=te,e.All="All",e.Any="Any",e.ArgMax=ne,e.ArgMin=re,e.Asin=ae,e.Asinh=oe,e.Atan=ie,e.Atan2=ue,e.Atanh=se,e.AvgPool=ce,e.AvgPool3D=le,e.AvgPool3DGrad="AvgPool3DGrad",e.AvgPoolGrad="AvgPoolGrad",e.BatchMatMul=he,e.BatchToSpaceND=fe,e.Bincount=de,e.BitwiseAnd=pe,e.BroadcastArgs=ge,e.BroadcastTo="BroadcastTo",e.Cast=ve,e.Ceil=me,e.ClipByValue=ye,e.Complex=be,e.ComplexAbs=we,e.Concat=ke,e.Conv2D=xe,e.Conv2DBackpropFilter=Ee,e.Conv2DBackpropInput=Se,e.Conv3D=Ae,e.Conv3DBackpropFilterV2="Conv3DBackpropFilterV2",e.Conv3DBackpropInputV2=_e,e.Cos="Cos",e.Cosh=Ie,e.CropAndResize=Te,e.Cumprod=Ne,e.Cumsum=Me,e.DataStorage=c,e.DenseBincount=De,e.DepthToSpace=Re,e.DepthwiseConv2dNative=Be,e.DepthwiseConv2dNativeBackpropFilter=Fe,e.DepthwiseConv2dNativeBackpropInput=Ce,e.Diag=Pe,e.Dilation2D=Oe,e.Dilation2DBackpropFilter="Dilation2DBackpropFilter",e.Dilation2DBackpropInput="Dilation2DBackpropInput",e.Draw=Le,e.Einsum=Ue,e.Elu="Elu",e.EluGrad="EluGrad",e.Environment=H,e.Equal=We,e.Erf="Erf",e.Exp="Exp",e.ExpandDims=Ge,e.Expm1=qe,e.FFT="FFT",e.Fill=Ke,e.FlipLeftRight=Ve,e.Floor=He,e.FloorDiv=je,e.FromPixels=Nn,e.FusedBatchNorm=Je,e.FusedConv2D=Dn,e.FusedDepthwiseConv2D=Rn,e.GatherNd=Ye,e.GatherV2=Ze,e.Greater=Xe,e.GreaterEqual=Qe,e.IFFT=et,e.Identity=$e,e.Imag=tt,e.IsFinite=nt,e.IsInf=rt,e.IsNan=at,e.KernelBackend=l,e.LRN="LRN",e.LRNGrad="LRNGrad",e.LeakyRelu=ot,e.Less=it,e.LessEqual=st,e.LinSpace=ut,e.Log="Log",e.Log1p=ct,e.LogSoftmax="LogSoftmax",e.LogicalAnd=lt,e.LogicalNot=ht,e.LogicalOr=ft,e.LogicalXor="LogicalXor",e.LowerBound="LowerBound",e.MatrixBandPart="MatrixBandPart",e.Max="Max",e.MaxPool=pt,e.MaxPool3D=gt,e.MaxPool3DGrad="MaxPool3DGrad",e.MaxPoolGrad="MaxPoolGrad",e.MaxPoolWithArgmax=vt,e.Maximum=dt,e.Mean=mt,e.Min="Min",e.Minimum=yt,e.MirrorPad=bt,e.Mod="Mod",e.MomentumOptimizer=Oh,e.Multinomial=wt,e.Multiply=kt,e.Neg="Neg",e.NonMaxSuppressionV3=Et,e.NonMaxSuppressionV4=St,e.NonMaxSuppressionV5=At,e.NotEqual=xt,e.OP_SCOPE_SUFFIX=Ea,e.OneHot=It,e.OnesLike=_t,e.Optimizer=Dh,e.OptimizerConstructors=xf,e.Pack=Nt,e.PadV2=Mt,e.Pool="Pool",e.Pow="Pow",e.Prelu=Tt,e.Prod=Dt,e.RMSPropOptimizer=Lh,e.RaggedGather=Rt,e.RaggedRange=Bt,e.RaggedTensorToTensor=Ft,e.Range=Ct,e.Real=Pt,e.RealDiv=ze,e.Reciprocal=Ot,e.Relu=Lt,e.Relu6=Gt,e.Reshape=zt,e.ResizeBilinear=Wt,e.ResizeBilinearGrad="ResizeBilinearGrad",e.ResizeNearestNeighbor=Ut,e.ResizeNearestNeighborGrad="ResizeNearestNeighborGrad",e.Reverse=qt,e.RotateWithOffset=Mn,e.Round=Kt,e.Rsqrt=Vt,e.SGDOptimizer=Ph,e.ScatterNd=Ht,e.SearchSorted=Jt,e.Select=Zt,e.Selu=Yt,e.Sigmoid=en,e.Sign=$t,e.Sin="Sin",e.Sinh=Qt,e.Slice=Xt,e.Softmax=on,e.Softplus=tn,e.SpaceToBatchND=rn,e.SparseFillEmptyRows=sn,e.SparseReshape=un,e.SparseSegmentMean=cn,e.SparseSegmentSum=ln,e.SparseToDense=hn,e.SplitV=an,e.Sqrt=nn,e.Square="Square",e.SquaredDifference=fn,e.StaticRegexReplace=dn,e.Step=In,e.StridedSlice=pn,e.StringNGrams=gn,e.StringSplit=vn,e.StringToHashBucketFast=mn,e.Sub="Sub",e.Sum="Sum",e.Tan="Tan",e.Tanh=yn,e.Tensor=Vr,e.TensorBuffer=Gr,e.TensorScatterUpdate=jt,e.Tile=bn,e.TopK=wn,e.Transform=kn,e.Transpose=xn,e.Unique=En,e.Unpack=Sn,e.UnsortedSegmentSum=An,e.UpperBound="UpperBound",e.Variable=Qr,e.ZerosLike=_n,e._FusedMatMul=Tn,e.abs=Fo,e.acos=Co,e.acosh=Po,e.add=To,e.addN=Oo,e.all=Lo,e.any=zo,e.argMax=Uo,e.argMin=Wo,e.asin=Go,e.asinh=qo,e.atan=Ko,e.atan2=Vo,e.atanh=Ho,e.avgPool=si,e.avgPool3d=ui,e.backend=Fa,e.backend_util=Nf,e.basicLSTMCell=pi,e.batchNorm=vi,e.batchNorm2d=mi,e.batchNorm3d=yi,e.batchNorm4d=bi,e.batchToSpaceND=gi,e.bincount=wi,e.bitwiseAnd=ki,e.booleanMaskAsync=rl,e.broadcastArgs=xi,e.broadcastTo=Ei,e.broadcast_util=Yi,e.browser=uf,e.buffer=_o,e.cast=Io,e.ceil=Si,e.clipByValue=_i,e.clone=No,e.complex=Aa,e.concat=ci,e.concat1d=Ii,e.concat2d=Ni,e.concat3d=Mi,e.concat4d=Ti,e.conv1d=Ri,e.conv2d=Di,e.conv2dTranspose=Fi,e.conv3d=Ci,e.conv3dTranspose=Oi,e.copyRegisteredKernels=function(e,t){Ln(e).forEach((function(e){zn(Object.assign({},e,{backendName:t}))}))},e.cos=Li,e.cosh=zi,e.cosineWindow=hl,e.cumprod=Ui,e.cumsum=Wi,e.customGrad=zs,e.denseBincount=Gi,e.deprecationWarn=function(e){Z().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")},e.depthToSpace=qi,e.depthwiseConv2d=Ki,e.device_util=va,e.diag=Vi,e.dilation2d=Hi,e.disableDeprecationWarnings=function(){Z().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")},e.dispose=Da,e.disposeVariables=function(){da.disposeVariables()},e.div=Ro,e.divNoNan=es,e.dot=ts,e.dropout=cl,e.einsum=ns,e.elu=rs,e.enableDebugMode=function(){Z().set("DEBUG",!0)},e.enableProdMode=function(){Z().set("PROD",!0)},e.enclosingPowerOfTwo=ll,e.engine=function(){return da},e.ensureShape=as,e.env=Z,e.equal=Xi,e.erf=os,e.euclideanNorm=ys,e.exp=bs,e.expandDims=ws,e.expm1=ks,e.eye=Es,e.fft=Dc,e.fill=Ai,e.findBackend=function(e){return da.findBackend(e)},e.findBackendFactory=function(e){return da.findBackendFactory(e)},e.floor=Ss,e.floorDiv=Do,e.fused=El,e.gather=As,e.gatherND=ul,e.gather_util=lf,e.getBackend=Ba,e.getGradient=On,e.getKernel=Pn,e.getKernelsForBackend=Ln,e.grad=function(e){return g(C(e),(function(){return"The f passed in grad(f) must be a function"})),function(t,n){var r=ka(t,"x","tf.grad","string_or_numeric"),a=null!=n?ka(n,"dy","tf.grad"):null;return da.tidy((function(){var t=da.gradients((function(){return e(r)}),[r],a),n=t.value,o=t.grads;return null!=a&&v(n.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Us(o),o[0]}))}},e.grads=function(e){return g(C(e),(function(){return"The f passed in grads(f) must be a function"})),function(t,n){g(Array.isArray(t),(function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"}));var r=xa(t,"args","tf.grads","string_or_numeric"),a=null!=n?ka(n,"dy","tf.grads"):null;return da.tidy((function(){var t=da.gradients((function(){return e.apply(void 0,u([],s(r),!1))}),r,a),n=t.value,o=t.grads;return null!=a&&v(n.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Us(o),o}))}},e.greater=_s,e.greaterEqual=Is,e.ifft=Rc,e.imag=Ns,e.image=wh,e.inTopKAsync=fl,e.io=ef,e.irfft=Bc,e.isFinite=Ms,e.isInf=Ts,e.isNaN=Ds,e.keep=Ra,e.kernel_impls=Mf,e.leakyRelu=Rs,e.less=Bs,e.lessEqual=Fs,e.linalg=kh,e.linspace=function(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");var r={start:e,stop:t,num:n};return da.runKernel(ut,{},r)},e.localResponseNormalization=Cs,e.log=Ps,e.log1p=Os,e.logSigmoid=qs,e.logSoftmax=Vs,e.logSumExp=Hs,e.logicalAnd=js,e.logicalNot=Js,e.logicalOr=Zs,e.logicalXor=Ys,e.losses=xh,e.lowerBound=function(e,t){return Qs(e,t,"left")},e.matMul=li,e.math=nf,e.max=cs,e.maxPool=$s,e.maxPool3d=eu,e.maxPoolWithArgmax=tu,e.maximum=nu,e.mean=ru,e.memory=function(){return da.memory()},e.meshgrid=function(e,t,n){var r=(void 0===n?{}:n).indexing,a=void 0===r?"xy":r;if("xy"!==a&&"ij"!==a)throw new TypeError("".concat(a," is not a valid third argument to meshgrid"));if(void 0===e)return[];var o=ka(e,"x","meshgrid",e instanceof Vr?e.dtype:"float32");if(void 0===t)return[o];var i=ka(t,"y","meshgrid",t instanceof Vr?t.dtype:"float32"),s=y(o.shape),u=y(i.shape);return"xy"===a?(o=ii(o,[1,-1]),i=ii(i,[-1,1]),[li(ou([u,1],o.dtype),o),li(i,ou([1,s],i.dtype))]):(o=ii(o,[-1,1]),i=ii(i,[1,-1]),[li(o,ou([1,u],o.dtype)),li(ou([s,1],i.dtype),i)])},e.min=ls,e.minimum=iu,e.mirrorPad=su,e.mod=uu,e.moments=cu,e.movingAverage=ol,e.mul=Bo,e.multiRNNCell=lu,e.multinomial=hu,e.neg=Ws,e.nextFrame=function(){return new Promise((function(e){return Sf((function(){return e()}))}))},e.norm=ms,e.notEqual=fu,e.oneHot=du,e.ones=ou,e.onesLike=pu,e.op=Sa,e.outerProduct=gu,e.pad=vu,e.pad1d=mu,e.pad2d=yu,e.pad3d=bu,e.pad4d=wu,e.pool=xu,e.pow=hs,e.prelu=Eu,e.print=Mo,e.prod=Su,e.profile=function(e){return da.profile(e)},e.raggedGather=Au,e.raggedRange=_u,e.raggedTensorToTensor=Iu,e.rand=Nu,e.randomGamma=rc,e.randomNormal=ac,e.randomStandardNormal=oc,e.randomUniform=ic,e.randomUniformInt=sc,e.range=uc,e.ready=function(){return da.ready()},e.real=cc,e.reciprocal=lc,e.registerBackend=function(e,t,n){return void 0===n&&(n=1),da.registerBackend(e,t,n)},e.registerGradient=function(e){var t=e.kernelName;Cn.has(t)&&Z().getBool("DEBUG")&&Bn("Overriding the gradient for '".concat(t,"'")),Cn.set(t,e)},e.registerKernel=zn,e.relu=hc,e.relu6=fc,e.removeBackend=function(e){da.removeBackend(e)},e.reshape=ii,e.reverse=dc,e.reverse1d=pc,e.reverse2d=gc,e.reverse3d=vc,e.reverse4d=mc,e.rfft=Cc,e.round=yc,e.rsqrt=bc,e.scalar=fs,e.scatterND=il,e.scatter_util=Jc,e.searchSorted=Qs,e.selu=wc,e.separableConv2d=kc,e.serialization=Th,e.setBackend=function(e){return da.setBackend(e)},e.setPlatform=function(e,t){Z().setPlatform(e,t)},e.setdiff1dAsync=xc,e.sigmoid=hi,e.sign=Ec,e.signal=bh,e.sin=Sc,e.sinh=Ac,e.slice=fi,e.slice1d=_c,e.slice2d=Ic,e.slice3d=Nc,e.slice4d=Mc,e.slice_util=kf,e.softmax=Tc,e.softplus=Gs,e.spaceToBatchND=ku,e.sparse=Eh,e.sparseToDense=sl,e.spectral=yh,e.split=Fc,e.sqrt=ds,e.square=ps,e.squaredDifference=Pc,e.squeeze=Oc,e.stack=Lc,e.step=zc,e.stridedSlice=Uc,e.string=Sh,e.sub=Ks,e.sum=gs,e.sumOutType=function(e){return ea(e,"int32")},e.tan=Wc,e.tanh=di,e.tensor=Ia,e.tensor1d=Gc,e.tensor2d=qc,e.tensor3d=Kc,e.tensor4d=function(e,t,n){if(m(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");var r=ya(e,n);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return _a(e,t,r,n)},e.tensor5d=function(e,t,n){if(m(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");var r=ya(e,n);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return _a(e,t,r,n)},e.tensor6d=function(e,t,n){if(m(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");var r=ya(e,n);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return _a(e,t=t||r,r,n)},e.tensorScatterUpdate=Zc,e.tensor_util=sa,e.test_util=$u,e.tidy=Ta,e.tile=xs,e.time=function(e){return da.time(e)},e.topk=Yc,e.train=Ef,e.transpose=al,e.truncatedNormal=Xc,e.unique=Qc,e.unregisterGradient=function(e){if(!Cn.has(e))throw new Error("The gradient '".concat(e,"' for backend is not registered"));Cn.delete(e)},e.unregisterKernel=function(e,t){var n=Un(e,t);if(!Fn.has(n))throw new Error("The kernel '".concat(e,"' for backend ")+"'".concat(t,"' is not registered"));Fn.delete(n)},e.unsortedSegmentSum=$c,e.unstack=el,e.upcastType=ea,e.upperBound=function(e,t){return Qs(e,t,"right")},e.util=Fr,e.valueAndGrad=function(e){return g(C(e),(function(){return"The f passed in valueAndGrad(f) must be a function"})),function(t,n){g(t instanceof Vr,(function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"})),g(null==n||n instanceof Vr,(function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"}));var r=da.gradients((function(){return e(t)}),[t],n),a=r.grads,o=r.value;return Us(a),{grad:a[0],value:o}}},e.valueAndGrads=function(e){return g(C(e),(function(){return"The f passed in valueAndGrads(f) must be a function"})),function(t,n){g(Array.isArray(t)&&t.every((function(e){return e instanceof Vr})),(function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"})),g(null==n||n instanceof Vr,(function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"}));var r=da.gradients((function(){return e.apply(void 0,u([],s(t),!1))}),t,n);return null!=n&&v(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Us(r.grads),r}},e.variable=function(e,t,n,r){return void 0===t&&(t=!0),da.makeVariable(e,t,n,r)},e.variableGrads=Ls,e.version_core="4.22.0",e.where=Qi,e.whereAsync=nl,e.zeros=au,e.zerosLike=$i})); +//# sourceMappingURL=tf-core.min.js.map diff --git a/submissions/StudyTracker/libs/tf.min.js b/submissions/StudyTracker/libs/tf.min.js new file mode 100644 index 00000000..6e834f9d --- /dev/null +++ b/submissions/StudyTracker/libs/tf.min.js @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).tf=e.tf||{})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),e}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){var t,n;function r(t,n){try{var o=e[t](n),s=o.value,u=s instanceof i;Promise.resolve(u?s.v:s).then((function(n){if(u){var i="return"===t?"return":"next";if(!s.k||n.done)return r(i,n);n=e[i](n).value}a(o.done?"return":"normal",n)}),(function(e){r("throw",e)}))}catch(e){a("throw",e)}}function a(e,a){switch(e){case"return":t.resolve({value:a,done:!0});break;case"throw":t.reject(a);break;default:t.resolve({value:a,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,a){return new Promise((function(i,o){var s={key:e,arg:a,resolve:i,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,a))}))},"function"!=typeof e.return&&(this.return=void 0)}function i(e,t){this.v=e,this.k=t}function o(){o=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,a){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),s=new T(a||[]);return r(o,"_invoke",{value:w(e,n,s)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var p={};function f(){}function d(){}function v(){}var m={};c(m,i,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(E([])));y&&y!==t&&n.call(y,i)&&(m=y);var b=v.prototype=f.prototype=Object.create(m);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function a(r,i,o,s){var u=h(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,o,s)}),(function(e){a("throw",e,o,s)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return a("throw",e,o,s)}))}s(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function w(e,t,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return C()}for(n.method=a,n.arg=i;;){var o=n.delegate;if(o){var s=I(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=h(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,p;var i=a.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function E(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function u(e,t,n,r,a,i,o){try{var s=e[i](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,a)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){u(i,r,a,o,s,"next",e)}function s(e){u(i,r,a,o,s,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function F(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}a.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(e){return this._invoke("next",e)},a.prototype.throw=function(e){return this._invoke("throw",e)},a.prototype.return=function(e){return this._invoke("return",e)};var D,M,L=function(e){return e&&e.Math==Math&&e},z=L("object"==("undefined"==typeof globalThis?"undefined":s(globalThis))&&globalThis)||L("object"==("undefined"==typeof window?"undefined":s(window))&&window)||L("object"==("undefined"==typeof self?"undefined":s(self))&&self)||L("object"==s(n)&&n)||function(){return this}()||Function("return this")(),P={},B=function(e){try{return!!e()}catch(e){return!0}},W=!B((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),U=!B((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),V=U,G=Function.prototype.call,j=V?G.bind(G):function(){return G.apply(G,arguments)},H={},q={}.propertyIsEnumerable,K=Object.getOwnPropertyDescriptor,X=K&&!q.call({1:2},1),Y=(H.f=X?function(e){var t=K(this,e);return!!t&&t.enumerable}:q,function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}),J=U,Z=Function.prototype,Q=Z.call,$=J&&Z.bind.bind(Q,Q),ee=J?$:function(e){return function(){return Q.apply(e,arguments)}},te=ee,ne=te({}.toString),re=te("".slice),ae=function(e){return re(ne(e),8,-1)},ie=B,oe=ae,se=Object,ue=ee("".split),ce=ie((function(){return!se("z").propertyIsEnumerable(0)}))?function(e){return"String"==oe(e)?ue(e,""):se(e)}:se,le=function(e){return null==e},he=le,pe=TypeError,fe=function(e){if(he(e))throw pe("Can't call method on "+e);return e},de=ce,ve=fe,me=function(e){return de(ve(e))},ge="object"==("undefined"==typeof document?"undefined":s(document))&&document.all,ye={all:ge,IS_HTMLDDA:void 0===ge&&void 0!==ge},be=ye.all,xe=ye.IS_HTMLDDA?function(e){return"function"==typeof e||e===be}:function(e){return"function"==typeof e},ke=xe,we=ye.all,Ie=ye.IS_HTMLDDA?function(e){return"object"==s(e)?null!==e:ke(e)||e===we}:function(e){return"object"==s(e)?null!==e:ke(e)},Ne=z,Se=xe,Te=function(e){return Se(e)?e:void 0},Ee=function(e,t){return arguments.length<2?Te(Ne[e]):Ne[e]&&Ne[e][t]},Ce=ee({}.isPrototypeOf),Ae="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Re=z,_e=Ae,Oe=Re.process,Fe=Re.Deno,De=Oe&&Oe.versions||Fe&&Fe.version,Me=De&&De.v8;Me&&(M=(D=Me.split("."))[0]>0&&D[0]<4?1:+(D[0]+D[1])),!M&&_e&&(!(D=_e.match(/Edge\/(\d+)/))||D[1]>=74)&&(D=_e.match(/Chrome\/(\d+)/))&&(M=+D[1]);var Le=M,ze=Le,Pe=B,Be=!!Object.getOwnPropertySymbols&&!Pe((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ze&&ze<41})),We=Be&&!Symbol.sham&&"symbol"==s(Symbol.iterator),Ue=Ee,Ve=xe,Ge=Ce,je=Object,He=We?function(e){return"symbol"==s(e)}:function(e){var t=Ue("Symbol");return Ve(t)&&Ge(t.prototype,je(e))},qe=String,Ke=function(e){try{return qe(e)}catch(e){return"Object"}},Xe=xe,Ye=Ke,Je=TypeError,Ze=function(e){if(Xe(e))return e;throw Je(Ye(e)+" is not a function")},Qe=Ze,$e=le,et=function(e,t){var n=e[t];return $e(n)?void 0:Qe(n)},tt=j,nt=xe,rt=Ie,at=TypeError,it=function(e,t){var n,r;if("string"===t&&nt(n=e.toString)&&!rt(r=tt(n,e)))return r;if(nt(n=e.valueOf)&&!rt(r=tt(n,e)))return r;if("string"!==t&&nt(n=e.toString)&&!rt(r=tt(n,e)))return r;throw at("Can't convert object to primitive value")},ot={exports:{}},st=!1,ut=z,ct=Object.defineProperty,lt=function(e,t){try{ct(ut,e,{value:t,configurable:!0,writable:!0})}catch(n){ut[e]=t}return t},ht=lt,pt="__core-js_shared__",ft=z[pt]||ht(pt,{}),dt=(ot.exports,ft);(ot.exports=function(e,t){return dt[e]||(dt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.29.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"});var vt=ot.exports,mt=fe,gt=Object,yt=function(e){return gt(mt(e))},bt=yt,xt=ee({}.hasOwnProperty),kt=Object.hasOwn||function(e,t){return xt(bt(e),t)},wt=ee,It=0,Nt=Math.random(),St=wt(1..toString),Tt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+St(++It+Nt,36)},Et=vt,Ct=kt,At=Tt,Rt=Be,_t=We,Ot=z.Symbol,Ft=Et("wks"),Dt=_t?Ot.for||Ot:Ot&&Ot.withoutSetter||At,Mt=function(e){return Ct(Ft,e)||(Ft[e]=Rt&&Ct(Ot,e)?Ot[e]:Dt("Symbol."+e)),Ft[e]},Lt=j,zt=Ie,Pt=He,Bt=et,Wt=it,Ut=TypeError,Vt=Mt("toPrimitive"),Gt=function(e,t){if(!zt(e)||Pt(e))return e;var n,r=Bt(e,Vt);if(r){if(void 0===t&&(t="default"),n=Lt(r,e,t),!zt(n)||Pt(n))return n;throw Ut("Can't convert object to primitive value")}return void 0===t&&(t="number"),Wt(e,t)},jt=Gt,Ht=He,qt=function(e){var t=jt(e,"string");return Ht(t)?t:t+""},Kt=Ie,Xt=z.document,Yt=Kt(Xt)&&Kt(Xt.createElement),Jt=function(e){return Yt?Xt.createElement(e):{}},Zt=Jt,Qt=!W&&!B((function(){return 7!=Object.defineProperty(Zt("div"),"a",{get:function(){return 7}}).a})),$t=W,en=j,tn=H,nn=Y,rn=me,an=qt,on=kt,sn=Qt,un=Object.getOwnPropertyDescriptor,cn=(P.f=$t?un:function(e,t){if(e=rn(e),t=an(t),sn)try{return un(e,t)}catch(e){}if(on(e,t))return nn(!en(tn.f,e,t),e[t])},{}),ln=W&&B((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),hn=Ie,pn=String,fn=TypeError,dn=function(e){if(hn(e))return e;throw fn(pn(e)+" is not an object")},vn=W,mn=Qt,gn=ln,yn=dn,bn=qt,xn=TypeError,kn=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,In="enumerable",Nn="configurable",Sn="writable",Tn=(cn.f=vn?gn?function(e,t,n){if(yn(e),t=bn(t),yn(n),"function"==typeof e&&"prototype"===t&&"value"in n&&Sn in n&&!n.writable){var r=wn(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:Nn in n?n.configurable:r.configurable,enumerable:In in n?n.enumerable:r.enumerable,writable:!1})}return kn(e,t,n)}:kn:function(e,t,n){if(yn(e),t=bn(t),yn(n),mn)try{return kn(e,t,n)}catch(e){}if("get"in n||"set"in n)throw xn("Accessors not supported");return"value"in n&&(e[t]=n.value),e},cn),En=Y,Cn=W?function(e,t,n){return Tn.f(e,t,En(1,n))}:function(e,t,n){return e[t]=n,e},An={exports:{}},Rn=W,_n=kt,On=Function.prototype,Fn=Rn&&Object.getOwnPropertyDescriptor,Dn=_n(On,"name"),Mn={EXISTS:Dn,PROPER:Dn&&"something"===function(){}.name,CONFIGURABLE:Dn&&(!Rn||Rn&&Fn(On,"name").configurable)},Ln=xe,zn=ft,Pn=ee(Function.toString);Ln(zn.inspectSource)||(zn.inspectSource=function(e){return Pn(e)});var Bn,Wn,Un,Vn=zn.inspectSource,Gn=xe,jn=z.WeakMap,Hn=Gn(jn)&&/native code/.test(String(jn)),qn=Tt,Kn=vt("keys"),Xn=function(e){return Kn[e]||(Kn[e]=qn(e))},Yn={},Jn=Hn,Zn=z,Qn=Ie,$n=Cn,er=kt,tr=ft,nr=Xn,rr=Yn,ar="Object already initialized",ir=Zn.TypeError,or=Zn.WeakMap;if(Jn||tr.state){var sr=tr.state||(tr.state=new or);sr.get=sr.get,sr.has=sr.has,sr.set=sr.set,Bn=function(e,t){if(sr.has(e))throw ir(ar);return t.facade=e,sr.set(e,t),t},Wn=function(e){return sr.get(e)||{}},Un=function(e){return sr.has(e)}}else{var ur=nr("state");rr[ur]=!0,Bn=function(e,t){if(er(e,ur))throw ir(ar);return t.facade=e,$n(e,ur,t),t},Wn=function(e){return er(e,ur)?e[ur]:{}},Un=function(e){return er(e,ur)}}var cr={set:Bn,get:Wn,has:Un,enforce:function(e){return Un(e)?Wn(e):Bn(e,{})},getterFor:function(e){return function(t){var n;if(!Qn(t)||(n=Wn(t)).type!==e)throw ir("Incompatible receiver, "+e+" required");return n}}},lr=(An.exports,ee),hr=B,pr=xe,fr=kt,dr=W,vr=Mn.CONFIGURABLE,mr=Vn,gr=cr.enforce,yr=cr.get,br=String,xr=Object.defineProperty,kr=lr("".slice),wr=lr("".replace),Ir=lr([].join),Nr=dr&&!hr((function(){return 8!==xr((function(){}),"length",{value:8}).length})),Sr=String(String).split("String"),Tr=An.exports=function(e,t,n){"Symbol("===kr(br(t),0,7)&&(t="["+wr(br(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!fr(e,"name")||vr&&e.name!==t)&&(dr?xr(e,"name",{value:t,configurable:!0}):e.name=t),Nr&&n&&fr(n,"arity")&&e.length!==n.arity&&xr(e,"length",{value:n.arity});try{n&&fr(n,"constructor")&&n.constructor?dr&&xr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=gr(e);return fr(r,"source")||(r.source=Ir(Sr,"string"==typeof t?t:"")),e};Function.prototype.toString=Tr((function(){return pr(this)&&yr(this).source||mr(this)}),"toString");var Er=An.exports,Cr=xe,Ar=cn,Rr=Er,_r=lt,Or=function(e,t,n,r){r||(r={});var a=r.enumerable,i=void 0!==r.name?r.name:t;if(Cr(n)&&Rr(n,i,r),r.global)a?e[t]=n:_r(t,n);else{try{r.unsafe?e[t]&&(a=!0):delete e[t]}catch(e){}a?e[t]=n:Ar.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Fr={},Dr=Math.ceil,Mr=Math.floor,Lr=Math.trunc||function(e){var t=+e;return(t>0?Mr:Dr)(t)},zr=Lr,Pr=function(e){var t=+e;return t!=t||0===t?0:zr(t)},Br=Pr,Wr=Math.max,Ur=Math.min,Vr=function(e,t){var n=Br(e);return n<0?Wr(n+t,0):Ur(n,t)},Gr=Pr,jr=Math.min,Hr=function(e){return e>0?jr(Gr(e),9007199254740991):0},qr=Hr,Kr=function(e){return qr(e.length)},Xr=me,Yr=Vr,Jr=Kr,Zr=function(e){return function(t,n,r){var a,i=Xr(t),o=Jr(i),s=Yr(r,o);if(e&&n!=n){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},Qr={includes:Zr(!0),indexOf:Zr(!1)},$r=kt,ea=me,ta=Qr.indexOf,na=Yn,ra=ee([].push),aa=function(e,t){var n,r=ea(e),a=0,i=[];for(n in r)!$r(na,n)&&$r(r,n)&&ra(i,n);for(;t.length>a;)$r(r,n=t[a++])&&(~ta(i,n)||ra(i,n));return i},ia=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oa=aa,sa=ia.concat("length","prototype"),ua=(Fr.f=Object.getOwnPropertyNames||function(e){return oa(e,sa)},{}),ca=(ua.f=Object.getOwnPropertySymbols,Ee),la=Fr,ha=ua,pa=dn,fa=ee([].concat),da=ca("Reflect","ownKeys")||function(e){var t=la.f(pa(e)),n=ha.f;return n?fa(t,n(e)):t},va=kt,ma=da,ga=P,ya=cn,ba=function(e,t,n){for(var r=ma(t),a=ya.f,i=ga.f,o=0;oo;)ni.f(e,n=a[o++],r[n]);return e},Ee("document","documentElement")),si=dn,ui=Ja,ci=ia,li=Yn,hi=oi,pi=Jt,fi=Xn("IE_PROTO"),di=function(){},vi=function(e){return" + + + + + + + + + +
+ + +

Study Tracker

+ + +
+ + +
+ + +
+ Looking for face... +
+ + +
+ Total Study Time: 0 mins +
+ + + + + +
+
7-Day Study History
+
N/A
+
+ +
+ + + + \ No newline at end of file diff --git a/submissions/StudyTracker/popup.js b/submissions/StudyTracker/popup.js new file mode 100644 index 00000000..4bbb9ef6 --- /dev/null +++ b/submissions/StudyTracker/popup.js @@ -0,0 +1,278 @@ +const video = document.getElementById('video'); +const statusElement = document.getElementById('status'); +const studyTimeElement = document.getElementById('study-time'); +const historyElement = document.getElementById('history'); +const toggleLandmarksButton = document.getElementById('toggleLandmarks'); + +// Audio alert (ensure alert.mp3 is in your extension folder) +const alertSound = new Audio('alert.mp3'); + +// Daily study data is stored per day in localStorage. +let dailyStudyData = JSON.parse(localStorage.getItem('dailyStudyData')) || {}; +let showLandmarks = true; +let studying = false; +let lastDetectionTime = Date.now(); +let noFaceStart = null; // time when face is no longer detected + +// Helper to get the dominant expression from a given expressions object +function getAverageExpression(expressions) { + const expressionValues = Object.values(expressions); + const maxExpressionValue = Math.max(...expressionValues); + const dominantExpression = Object.keys(expressions).find( + expression => expressions[expression] === maxExpressionValue + ); + return dominantExpression; +} + +// Use mediaDevices.getUserMedia to automatically trigger the browser's camera permission prompt. +function startVideo() { + navigator.mediaDevices.getUserMedia({ video: true }) + .then(stream => { + video.srcObject = stream; + statusElement.textContent = 'Camera access granted.'; + removeCameraOverlay(); // Remove overlay if present + }) + .catch(err => { + console.error(err); + statusElement.textContent = "Camera access is required."; + showCameraOverlay(); // Show custom overlay prompting user to enable camera access. + }); +} + +// Creates an overlay with a prompt and a retry button. +function showCameraOverlay() { + if (!document.getElementById('cameraOverlay')) { + const overlay = document.createElement('div'); + overlay.id = 'cameraOverlay'; + overlay.style.position = 'fixed'; + overlay.style.top = '0'; + overlay.style.left = '0'; + overlay.style.width = '100%'; + overlay.style.height = '94%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.9)'; + overlay.style.color = '#fff'; + overlay.style.display = 'flex'; + overlay.style.flexDirection = 'column'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + overlay.style.zIndex = '9999'; + overlay.style.textAlign = 'center'; + overlay.style.padding = '20px'; + + overlay.innerHTML = ` +
+

📷 Camera Access Required

+

To track your study time, this extension needs camera access.

+

+ If you have denied access, follow these steps to enable it: +

+
+
    +
  1. 🔗 Open + chrome://extensions/ + + +
  2. +
  3. 🔍 Find this extension and click Details
  4. +
  5. ⚙️ Scroll down and go to Site Settings
  6. +
  7. 🎥 Find "Camera" and set it to Allow
  8. +
  9. 🔄 Reload this page and click "Retry" below
  10. +
+
+ +
+ `; + + document.body.appendChild(overlay); + + // Copy to clipboard functionality + document.getElementById('copyLink').addEventListener('click', () => { + navigator.clipboard.writeText('chrome://extensions/').then(() => { + document.getElementById('copyMessage').style.display = 'inline'; + setTimeout(() => { + document.getElementById('copyMessage').style.display = 'none'; + }, 2000); + }); + }); + + document.getElementById('retryCameraAccess').addEventListener('click', () => { + overlay.remove(); + startVideo(); + }); + } +} + +// Removes the camera access overlay if it exists. +function removeCameraOverlay() { + const overlay = document.getElementById('cameraOverlay'); + if (overlay) { + overlay.remove(); + } +} + +Promise.all([ + faceapi.nets.tinyFaceDetector.loadFromUri('/models'), + faceapi.nets.faceLandmark68Net.loadFromUri('/models'), + faceapi.nets.faceRecognitionNet.loadFromUri('/models'), + faceapi.nets.faceExpressionNet.loadFromUri('/models') +]).then(startVideo); + +video.addEventListener('play', () => { + const canvas = faceapi.createCanvasFromMedia(video); + document.body.append(canvas); + const displaySize = { width: video.width, height: video.height }; + faceapi.matchDimensions(canvas, displaySize); + + // Adjust canvas position + canvas.style.position = 'absolute'; + canvas.style.top = '130px'; // Shift canvas 30px upwards + canvas.style.left = '0'; + + let lastDetectionTime = 0; +let studying = false; +let studyStartTime = null; // Start time of the current study session +let noFaceStart = null; + +// Load previous study data from localStorage +const storedData = JSON.parse(localStorage.getItem('dailyStudyData')) || {}; +const today = new Date().toLocaleDateString(); + +if (!storedData[today]) { + storedData[today] = { timeSpent: 0, expressionCounts: {} }; +} + +let totalStudyTime = storedData[today].timeSpent; // Load today's stored time + +function detectFace() { + const now = Date.now(); + + if (now - lastDetectionTime > 100) { // Run every ~100ms + lastDetectionTime = now; + + faceapi + .detectAllFaces(video, new faceapi.TinyFaceDetectorOptions()) + .withFaceLandmarks() + .withFaceExpressions() + .then(detections => { + const resizedDetections = faceapi.resizeResults(detections, displaySize); + const ctx = canvas.getContext('2d'); + ctx.clearRect(0, 0, canvas.width, canvas.height); + + if (showLandmarks) { + faceapi.draw.drawDetections(canvas, resizedDetections); + faceapi.draw.drawFaceLandmarks(canvas, resizedDetections); + faceapi.draw.drawFaceExpressions(canvas, resizedDetections); + } + + if (detections.length > 0) { + // Reset face lost timer + noFaceStart = null; + + const expressions = detections[0].expressions; + const dominantExpression = getAverageExpression(expressions) || "None"; + + if (!studying) { + studying = true; + studyStartTime = now; + statusElement.textContent = 'I am studying...'; + } + + // Calculate elapsed time and update study duration + if (studyStartTime) { + let elapsed = (now - studyStartTime) / 1000; // Convert to seconds + totalStudyTime += elapsed; + storedData[today].timeSpent = totalStudyTime; + studyStartTime = now; // Reset start time + } + + // Update expression count + if (!storedData[today].expressionCounts[dominantExpression]) { + storedData[today].expressionCounts[dominantExpression] = 0; + } + storedData[today].expressionCounts[dominantExpression]++; + + // Save updated data to localStorage + localStorage.setItem('dailyStudyData', JSON.stringify(storedData)); + + // Convert study time to hrs, mins, secs + const hrs = Math.floor(totalStudyTime / 3600); + const mins = Math.floor((totalStudyTime % 3600) / 60); + const secs = Math.floor(totalStudyTime % 60); + + // Find the most frequent expression today + let todayDominant = 'None'; + let maxCount = 0; + for (let expr in storedData[today].expressionCounts) { + if (storedData[today].expressionCounts[expr] > maxCount) { + maxCount = storedData[today].expressionCounts[expr]; + todayDominant = expr; + } + } + + studyTimeElement.textContent = `Study Time: ${hrs} hrs ${mins} mins ${secs} sec | Expression: ${dominantExpression}`; + } else { + if (studying) { + studying = false; + studyStartTime = null; + statusElement.textContent = 'No face detected. Pausing...'; + } + + if (noFaceStart === null) { + noFaceStart = now; + } else if (now - noFaceStart >= 30000) { + alertSound.play(); + noFaceStart = now; + } + } + }); + } + requestAnimationFrame(detectFace); +} + + detectFace(); +}); + +// Update the history view to show the last 7 days. +function updateHistory() { + const entries = []; + for (let date in dailyStudyData) { + entries.push({ date, data: dailyStudyData[date] }); + } + // Sort entries by date (oldest first) + entries.sort((a, b) => new Date(a.date) - new Date(b.date)); + // Get the last 7 days. + const last7 = entries.slice(-7); + const historyText = last7 + .map(entry => { + const total = entry.data.timeSpent; + const hrs = Math.floor(total / 3600); + const mins = Math.floor((total % 3600) / 60); + // Determine the dominant expression for the day. + const counts = entry.data.expressionCounts; + let dominant = 'None'; + let maxCount = 0; + for (let expr in counts) { + if (counts[expr] > maxCount) { + maxCount = counts[expr]; + dominant = expr; + } + } + return `${entry.date}: ${hrs} hrs ${mins} mins (Expression: ${dominant})`; + }) + .join('
'); + historyElement.innerHTML = `7-Day Study History:
${historyText}`; +} + +// Call updateHistory on page load to display stored history. +updateHistory(); + +// Toggle landmarks visibility. +toggleLandmarksButton.addEventListener('click', () => { + showLandmarks = !showLandmarks; + toggleLandmarksButton.textContent = showLandmarks ? 'Hide Landmarks' : 'Show Landmarks'; +}); diff --git a/submissions/StudyTracker/styles.css b/submissions/StudyTracker/styles.css new file mode 100644 index 00000000..f93bb945 --- /dev/null +++ b/submissions/StudyTracker/styles.css @@ -0,0 +1,14 @@ +body { + margin: 0; + padding: 0; + width: 100vw; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + } + + canvas { + position: absolute; + } + \ No newline at end of file diff --git a/submissions/StudyTracker/tailwind.js b/submissions/StudyTracker/tailwind.js new file mode 100644 index 00000000..e4d106fd --- /dev/null +++ b/submissions/StudyTracker/tailwind.js @@ -0,0 +1,8 @@ +/** + * Minified by jsDelivr using Terser v5.37.0. + * Original file: /npm/@tailwindcss/browser@4.0.14/dist/index.global.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +"use strict";(()=>{var e=10;function t(t){"\ufeff"===t[0]&&(t=t.slice(1)),t=t.replaceAll("\r\n","\n");let o,i=[],l=[],a=[],s=null,c=null,u="",d="";for(let f=0;f0&&t[n]===e[e.length-1]&&(e=e.slice(0,-1))}}let a=n(u,l);if(!a)throw new Error("Invalid custom property, expected a value");s?s.nodes.push(a):i.push(a),u=""}else if(59===h&&64===u.charCodeAt(0))c=r(u),s?s.nodes.push(c):i.push(c),u="",c=null;else if(59===h&&")"!==d[d.length-1]){let e=n(u);if(!e)throw 0===u.length?new Error("Unexpected semicolon"):new Error(`Invalid declaration: \`${u.trim()}\``);s?s.nodes.push(e):i.push(e),u=""}else if(123===h&&")"!==d[d.length-1])d+="}",c=k(u.trim()),s&&s.nodes.push(c),a.push(s),s=c,u="",c=null;else if(125===h&&")"!==d[d.length-1]){if(""===d)throw new Error("Missing opening {");if(d=d.slice(0,-1),u.length>0)if(64===u.charCodeAt(0))c=r(u),s?s.nodes.push(c):i.push(c),u="",c=null;else{let e=u.indexOf(":");if(s){let t=n(u,e);if(!t)throw new Error(`Invalid declaration: \`${u.trim()}\``);s.nodes.push(t)}}let e=a.pop()??null;null===e&&s&&i.push(s),s=e,u="",c=null}else if(40===h)d+=")",u+="(";else if(41===h){if(")"!==d[d.length-1])throw new Error("Missing opening (");d=d.slice(0,-1),u+=")"}else{if(0===u.length&&(32===h||h===e||9===h))continue;u+=String.fromCharCode(h)}}}if(64===u.charCodeAt(0)&&i.push(r(u)),d.length>0&&s){if("rule"===s.kind)throw new Error(`Missing closing } at ${s.selector}`);if("at-rule"===s.kind)throw new Error(`Missing closing } at ${s.name} ${s.params}`)}return l.length>0?l.concat(i):i}function r(e,t=[]){for(let r=5;r=1&&t<=31||127===t||0===o&&t>=48&&t<=57||1===o&&t>=48&&t<=57&&45===l?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?r.charAt(o):"\\"+r.charAt(o):"�";return i}function i(e){return e.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,(e=>e.length>2?String.fromCodePoint(Number.parseInt(e.slice(1).trim(),16)):e[1]))}var l=new Map([["--font",["--font-weight","--font-size"]],["--inset",["--inset-shadow","--inset-ring"]],["--text",["--text-color","--text-underline-offset","--text-indent","--text-decoration-thickness","--text-decoration-color"]]]);function a(e,t){return(l.get(t)??[]).some((t=>e===t||e.startsWith(`${t}-`)))}var s=class{constructor(e=new Map,t=new Set([])){this.values=e,this.keyframes=t}prefix=null;add(e,t,r=0){if(e.endsWith("-*")){if("initial"!==t)throw new Error(`Invalid theme value \`${t}\` for namespace \`${e}\``);"--*"===e?this.values.clear():this.clearNamespace(e.slice(0,-2),0)}if(4&r){let t=this.values.get(e);if(t&&!(4&t.options))return}"initial"===t?this.values.delete(e):this.values.set(e,{value:t,options:r})}keysInNamespaces(e){let t=[];for(let r of e){let e=`${r}-`;for(let n of this.values.keys())n.startsWith(e)&&-1===n.indexOf("--",2)&&(a(n,r)||t.push(n.slice(e.length)))}return t}get(e){for(let t of e){let e=this.values.get(t);if(e)return e.value}return null}hasDefault(e){return!(4&~this.getOptions(e))}getOptions(e){return e=i(this.#e(e)),this.values.get(e)?.options??0}entries(){return this.prefix?Array.from(this.values,(e=>(e[0]=this.prefixKey(e[0]),e))):this.values.entries()}prefixKey(e){return this.prefix?`--${this.prefix}-${e.slice(2)}`:e}#e(e){return this.prefix?`--${e.slice(3+this.prefix.length)}`:e}clearNamespace(e,t){let r=l.get(e)??[];e:for(let n of this.values.keys())if(n.startsWith(e)){if(0!==t&&(this.getOptions(n)&t)!==t)continue;for(let e of r)if(n.startsWith(e))continue e;this.values.delete(n)}}#t(e,t){for(let r of t){let t=null!==e?`${r}-${e}`:r;if(!this.values.has(t)){if(null===e||!e.includes("."))continue;if(t=`${r}-${e.replaceAll(".","_")}`,!this.values.has(t))continue}if(!a(t,r))return t}return null}#r(e){let t=this.values.get(e);if(!t)return null;let r=null;return 2&t.options&&(r=t.value),`var(${o(this.prefixKey(e))}${r?`, ${r}`:""})`}markUsedVariable(e){let t=i(this.#e(e)),r=this.values.get(t);r&&(r.options|=16)}resolve(e,t){let r=this.#t(e,t);if(!r)return null;let n=this.values.get(r);return 1&n.options?n.value:this.#r(r)}resolveValue(e,t){let r=this.#t(e,t);return r?this.values.get(r).value:null}resolveWith(e,t,r=[]){let n=this.#t(e,t);if(!n)return null;let o={};for(let e of r){let t=`${n}${e}`,r=this.values.get(t);r&&(1&r.options?o[e]=r.value:o[e]=this.#r(t))}let i=this.values.get(n);return 1&i.options?[i.value,o]:[this.#r(n),o]}namespace(e){let t=new Map,r=`${e}-`;for(let[n,o]of this.values)n===e?t.set(null,o.value):n.startsWith(`${r}-`)?t.set(n.slice(e.length),o.value):n.startsWith(r)&&t.set(n.slice(r.length),o.value);return t}addKeyframes(e){this.keyframes.add(e)}getKeyframes(){return Array.from(this.keyframes)}},c=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e,this),this.set(e,t)),t}};function u(e){return{kind:"word",value:e}}function d(e,t){return{kind:"function",value:e,nodes:t}}function f(e){return{kind:"separator",value:e}}function h(e,t,r=null){for(let n=0;n0){let e=u(i);o?o.nodes.push(e):r.push(e),i=""}let n=l,a=l+1;for(;a0){let t=u(i);e.nodes.push(t),i=""}o=n.length>0?n[n.length-1]:null;break}default:i+=String.fromCharCode(a)}}return i.length>0&&r.push(u(i)),r}function g(e){let t=[];return h(m(e),(e=>{if("function"===e.kind&&"var"===e.value)return h(e.nodes,(e=>{"word"!==e.kind||"-"!==e.value[0]||"-"!==e.value[1]||t.push(e.value)})),1})),t}var v=64;function b(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function w(e,t="",r=[]){return{kind:"at-rule",name:e,params:t,nodes:r}}function k(e,t=[]){return e.charCodeAt(0)===v?r(e,t):b(e,t)}function y(e,t,r=!1){return{kind:"declaration",property:e,value:t,important:r}}function x(e){return{kind:"comment",value:e}}function $(e,t){return{kind:"context",context:e,nodes:t}}function A(e){return{kind:"at-root",nodes:e}}function z(e,t,r=[],n={}){for(let o=0;onew Set)),i=new Set,l=new Set,a=new c((()=>new Set));function s(e,c,u={},d=0){if("declaration"===e.kind){if("--tw-sort"===e.property||void 0===e.value||null===e.value)return;if(u.theme&&"-"===e.property[0]&&"-"===e.property[1]&&(u.keyframes||o.get(c).add(e)),e.value.includes("var("))if(u.theme&&"-"===e.property[0]&&"-"===e.property[1])for(let t of g(e.value))a.get(t).add(e.property);else t.trackUsedVariables(e.value);if("animation"===e.property){let t=e.value.split(/\s+/);for(let e of t)l.add(e)}c.push(e)}else if("rule"===e.kind)if("&"===e.selector)for(let t of e.nodes){let e=[];s(t,e,u,d+1),e.length>0&&c.push(...e)}else{let t={...e,nodes:[]};for(let r of e.nodes)s(r,t.nodes,u,d+1);t.nodes.length>0&&c.push(t)}else if("at-rule"===e.kind&&"@property"===e.name&&0===d){if(n.has(e.params))return;n.add(e.params);let t={...e,nodes:[]};for(let r of e.nodes)s(r,t.nodes,u,d+1);c.push(t)}else if("at-rule"===e.kind){"@keyframes"===e.name&&(u={...u,keyframes:!0});let t={...e,nodes:[]};for(let r of e.nodes)s(r,t.nodes,u,d+1);"@keyframes"===e.name&&u.theme&&i.add(t),(t.nodes.length>0||"@layer"===t.name||"@charset"===t.name||"@custom-media"===t.name||"@namespace"===t.name||"@import"===t.name)&&c.push(t)}else if("at-root"===e.kind)for(let t of e.nodes){let e=[];s(t,e,u,0);for(let t of e)r.push(t)}else if("context"===e.kind){if(e.context.reference)return;for(let t of e.nodes)s(t,c,{...u,...e.context},d)}else"comment"===e.kind&&c.push(e)}let u=[];for(let t of e)s(t,u,{},0);e:for(let[e,r]of o)for(let n of r){if(S(n.property,t.theme,a)){if(n.property.startsWith(t.theme.prefixKey("--animate-"))){let e=n.value.split(/\s+/);for(let t of e)l.add(t)}continue}let r=e.indexOf(n);if(e.splice(r,1),0===e.length){let t=K(u,(t=>"rule"===t.kind&&t.nodes===e));if(!t||0===t.length)continue e;for(t.unshift({kind:"at-root",nodes:u});;){let e=t.pop();if(!e)break;let r=t[t.length-1];if(!r||"at-root"!==r.kind&&"at-rule"!==r.kind)break;let n=r.nodes.indexOf(e);if(-1===n)break;r.nodes.splice(n,1)}continue e}}for(let e of i)if(!l.has(e.params)){let t=r.indexOf(e);r.splice(t,1)}return u.concat(r)}function j(e){function t(e,r=0){let n="",o=" ".repeat(r);if("declaration"===e.kind)n+=`${o}${e.property}: ${e.value}${e.important?" !important":""};\n`;else if("rule"===e.kind){n+=`${o}${e.selector} {\n`;for(let o of e.nodes)n+=t(o,r+1);n+=`${o}}\n`}else if("at-rule"===e.kind){if(0===e.nodes.length)return`${o}${e.name} ${e.params};\n`;n+=`${o}${e.name}${e.params?` ${e.params} `:" "}{\n`;for(let o of e.nodes)n+=t(o,r+1);n+=`${o}}\n`}else if("comment"===e.kind)n+=`${o}/*${e.value}*/\n`;else if("context"===e.kind||"at-root"===e.kind)return"";return n}let r="";for(let n of e){let e=t(n);""!==e&&(r+=e)}return r}function K(e,t){let r=[];return z(e,((e,{path:n})=>{if(t(e))return r=[...n],2})),r}function S(e,t,r,n=new Set){if(n.has(e)||(n.add(e),24&t.getOptions(e)))return!0;{let o=r.get(e)??[];for(let e of o)if(S(e,t,r,n))return!0}return!1}var E=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],V=["anchor-size"],N=new RegExp(`(${V.join("|")})\\(`,"g");function O(e){return-1!==e.indexOf("(")&&E.some((t=>e.includes(`${t}(`)))}function F(e){if(-1===e.indexOf("("))return U(e);let t=m(e);return W(t),e=function(e){if(!E.some((t=>e.includes(t))))return e;let t=!1;V.some((t=>e.includes(t)))&&(N.lastIndex=0,e=e.replace(N,((e,r)=>(t=!0,`$${V.indexOf(r)}$(`))));let r="",n=[];for(let t=0;t=0;r--){let t=e.charCodeAt(r);if(t>=48&&t<=57)i=r;else{if(!(t>=97&&t<=122))break;i=r}}let l=e.slice(i,t);if(E.includes(l)){n.unshift(!0);continue}if(n[0]&&""===l){n.unshift(!0);continue}n.unshift(!1)}}return t?r.replace(/\$(\d+)\$/g,((e,t)=>V[t]??e)):r}(e=p(t)),e}function U(e,t=!1){let r="";for(let n=0;n0&&a===_[r-1]&&r--}else n.push(e.slice(o,t)),o=t+1}return n.push(e.slice(o)),n}function L(e){if("["===e[0]&&"]"===e[e.length-1]){let t=F(e.slice(1,-1));return 0===t.length||0===t.trim().length?null:{kind:"arbitrary",value:t}}if("("===e[0]&&")"===e[e.length-1]){let t=F(e.slice(1,-1));return 0===t.length||0===t.trim().length||"-"!==t[0]&&"-"!==t[1]?null:{kind:"arbitrary",value:`var(${t})`}}return{kind:"named",value:e}}function*M(e,t){t(e)&&(yield[e,null]);let r=e.lastIndexOf("-");if(-1!==r)do{let n=e.slice(0,r);if(t(n)){let t=[n,e.slice(r+1)];if(""===t[1])break;yield t}r=e.lastIndexOf("-",r-1)}while(r>0);else"@"===e[0]&&t("@")&&(yield["@",e.slice(1)])}function R(e,t,r){if(e===t)return 0;let n=e.indexOf("("),o=t.indexOf("("),i=-1===n?e.replace(/[\d.]+/g,""):e.slice(0,n),l=-1===o?t.replace(/[\d.]+/g,""):t.slice(0,o),a=(i===l?0:i0},"bg-size":function(e){let t=0;for(let r of B(e,",")){if("cover"===r||"contain"===r){t+=1;continue}let e=B(r," ");if(1!==e.length&&2!==e.length)return!1;e.every((e=>"auto"===e||oe(e)||te(e)))&&(t+=1)}return t>0},"line-width":function(e){return"thin"===e||"medium"===e||"thick"===e},image:function(e){let t=0;for(let r of B(e,","))if(!r.startsWith("var(")){if(Z(r)){t+=1;continue}if(X.test(r)){t+=1;continue}if(G.test(r)){t+=1;continue}return!1}return t>0},"family-name":function(e){let t=0;for(let r of B(e,",")){let e=r.charCodeAt(0);if(e>=48&&e<=57)return!1;r.startsWith("var(")||(t+=1)}return t>0},"generic-name":function(e){return"serif"===e||"sans-serif"===e||"monospace"===e||"cursive"===e||"fantasy"===e||"system-ui"===e||"ui-serif"===e||"ui-sans-serif"===e||"ui-monospace"===e||"ui-rounded"===e||"math"===e||"emoji"===e||"fangsong"===e},"absolute-size":function(e){return"xx-small"===e||"x-small"===e||"small"===e||"medium"===e||"large"===e||"x-large"===e||"xx-large"===e||"xxx-large"===e},"relative-size":function(e){return"larger"===e||"smaller"===e},angle:function(e){return ie.test(e)},vector:function(e){return le.test(e)}};function H(e,t){if(e.startsWith("var("))return null;for(let r of t)if(P[r]?.(e))return r;return null}var Y=/^url\(.*\)$/;function Z(e){return Y.test(e)}var G=/^(?:element|image|cross-fade|image-set)\(/,X=/^(repeating-)?(conic|linear|radial)-gradient\(/;var J=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Q=new RegExp(`^${J.source}$`);var ee=new RegExp(`^${J.source}%$`);function te(e){return ee.test(e)||O(e)}var re=new RegExp(`^${J.source}s*/s*${J.source}$`);var ne=new RegExp(`^${J.source}(${["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"].join("|")})$`);function oe(e){return ne.test(e)||O(e)}var ie=new RegExp(`^${J.source}(${["deg","rad","grad","turn"].join("|")})$`);var le=new RegExp(`^${J.source} +${J.source} +${J.source}$`);function ae(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===String(e)}function se(e){let t=Number(e);return Number.isInteger(t)&&t>0&&String(t)===String(e)}function ce(e){return de(e,.25)}function ue(e){return de(e,.25)}function de(e,t){let r=Number(e);return r>=0&&r%t==0&&String(r)===String(e)}var fe=new Set(["inset","inherit","initial","revert","unset"]),he=/^-?(\d+|\.\d+)(.*?)$/g;function pe(e,t){return B(e,",").map((e=>{let r=B(e=e.trim()," ").filter((e=>""!==e.trim())),n=null,o=null,i=null;for(let e of r)fe.has(e)||(he.test(e)?(null===o?o=e:null===i&&(i=e),he.lastIndex=0):null===n&&(n=e));if(null===o||null===i)return e;let l=t(n??"currentcolor");return null!==n?e.replace(n,l):`${e} ${l}`})).join(", ")}var me=/^-?[a-z][a-zA-Z0-9/%._-]*$/,ge=/^-?[a-z][a-zA-Z0-9/%._-]*-\*$/,ve=class{utilities=new c((()=>[]));completions=new Map;static(e,t){this.utilities.get(e).push({kind:"static",compileFn:t})}functional(e,t,r){this.utilities.get(e).push({kind:"functional",compileFn:t,options:r})}has(e,t){return this.utilities.has(e)&&this.utilities.get(e).some((e=>e.kind===t))}get(e){return this.utilities.has(e)?this.utilities.get(e):[]}getCompletions(e){return this.completions.get(e)?.()??[]}suggest(e,t){this.completions.set(e,t)}keys(e){let t=[];for(let[r,n]of this.utilities.entries())for(let o of n)if(o.kind===e){t.push(r);break}return t}};function be(e,t,r){return w("@property",e,[y("syntax",r?`"${r}"`:'"*"'),y("inherits","false"),...t?[y("initial-value",t)]:[]])}function we(e,t){if(null===t)return e;let r=Number(t);return Number.isNaN(r)||(t=100*r+"%"),`color-mix(in oklab, ${e} ${t}, transparent)`}function ke(e,t,r){if(!t)return e;if("arbitrary"===t.kind)return we(e,t.value);let n=r.resolve(t.value,["--opacity"]);return n?we(e,n):ue(t.value)?we(e,`${t.value}%`):null}function ye(e,t,r){let n=null;switch(e.value.value){case"inherit":n="inherit";break;case"transparent":n="transparent";break;case"current":n="currentColor";break;default:n=t.resolve(e.value.value,r)}return n?ke(n,e.modifier,t):null}function xe(e,t,r){for(let n of t.nodes)if("named"===e.kind&&"word"===n.kind&&"-"===n.value[0]&&"-"===n.value[1]){let t=n.value;if(t.endsWith("-*")){t=t.slice(0,-2);let n=r.theme.resolve(e.value,[t]);if(n)return{nodes:m(n)}}else{let n=t.split("-*");if(n.length<=1)continue;let o=[n.shift()],i=r.theme.resolveWith(e.value,o,n);if(i){let[,e={}]=i;{let t=e[n.pop()];if(t)return{nodes:m(t)}}}}}else{if("named"===e.kind&&"word"===n.kind){if("number"!==n.value&&"integer"!==n.value&&"ratio"!==n.value&&"percentage"!==n.value)continue;let t="ratio"===n.value&&"fraction"in e?e.fraction:e.value;if(!t)continue;let r=H(t,[n.value]);if(null===r)continue;if("ratio"===r){let[e,r]=B(t,"/");if(!ae(e)||!ae(r))continue}else{if("number"===r&&!ce(t))continue;if("percentage"===r&&!ae(t.slice(0,-1)))continue}return{nodes:m(t),ratio:"ratio"===r}}if("arbitrary"===e.kind&&"word"===n.kind&&"["===n.value[0]&&"]"===n.value[n.value.length-1]){let t=n.value.slice(1,-1);if("*"===t)return{nodes:m(e.value)};if("dataType"in e&&e.dataType&&e.dataType!==t)continue;if("dataType"in e&&e.dataType)return{nodes:m(e.value)};if(null!==H(e.value,[t]))return{nodes:m(e.value)}}}}var $e={"--alpha":function(e,t,...r){let[n,o]=B(t,"/").map((e=>e.trim()));if(!n||!o)throw new Error(`The --alpha(…) function requires a color and an alpha value, e.g.: \`--alpha(${n||"var(--my-color)"} / ${o||"50%"})\``);if(r.length>0)throw new Error(`The --alpha(…) function only accepts one argument, e.g.: \`--alpha(${n||"var(--my-color)"} / ${o||"50%"})\``);return we(n,o)},"--spacing":function(e,t,...r){if(!t)throw new Error("The --spacing(…) function requires an argument, but received none.");if(r.length>0)throw new Error(`The --spacing(…) function only accepts a single argument, but received ${r.length+1}.`);let n=e.theme.resolve(null,["--spacing"]);if(!n)throw new Error("The --spacing(…) function requires that the `--spacing` theme variable exists, but it was not found.");return`calc(${n} * ${t})`},"--theme":function(e,t,...r){if(!t.startsWith("--"))throw new Error("The --theme(…) function can only be used with CSS variables from your theme.");return Ae(e,t,...r)},theme:Ae};function Ae(e,t,...r){t=function(e){if("'"!==e[0]&&'"'!==e[0])return e;let t="",r=e[0];for(let n=1;n0)return r.join(", ");if(!n)throw new Error(`Could not resolve value for theme function: \`theme(${t})\`. Consider checking if the path is correct or provide a fallback value to silence this error.`);return n}var ze=new RegExp(Object.keys($e).map((e=>`${e}\\(`)).join("|"));function Ce(e,t){let r=0;return z(e,(e=>{if("declaration"===e.kind&&e.value&&ze.test(e.value))return r|=8,void(e.value=Te(e.value,t));"at-rule"===e.kind&&("@media"===e.name||"@custom-media"===e.name||"@container"===e.name||"@supports"===e.name)&&ze.test(e.params)&&(r|=8,e.params=Te(e.params,t))})),r}function Te(e,t){let r=m(e);return h(r,((e,{replaceWith:r})=>{if("function"===e.kind&&e.value in $e){let n=B(p(e.nodes).trim(),",").map((e=>e.trim()));return r(m($e[e.value](t,...n)))}})),p(r)}function je(e,t){let r=e.length,n=t.length,o=r=48&&n<=57&&o>=48&&o<=57){let i=r,l=r+1,a=r,s=r+1;for(n=e.charCodeAt(l);n>=48&&n<=57;)n=e.charCodeAt(++l);for(o=t.charCodeAt(s);o>=48&&o<=57;)o=t.charCodeAt(++s);let c=e.slice(i,l),u=t.slice(a,s),d=Number(c)-Number(u);if(d)return d;if(cu)return 1}else if(n!==o)return n-o}return e.length-t.length}var Ke=/^\d+\/\d+$/;function Se(e){let t=[];for(let r of e.utilities.keys("static"))t.push({name:r,utility:r,fraction:!1,modifiers:[]});for(let r of e.utilities.keys("functional")){let n=e.utilities.getCompletions(r);for(let e of n)for(let n of e.values){let o=null!==n&&Ke.test(n),i=null===n?r:`${r}-${n}`;t.push({name:i,utility:r,fraction:o,modifiers:e.modifiers}),e.supportsNegative&&t.push({name:`-${i}`,utility:`-${r}`,fraction:o,modifiers:e.modifiers})}}return 0===t.length?[]:(t.sort(((e,t)=>je(e.name,t.name))),function(e){let t=[],r=null,n=new Map,o=new c((()=>[]));for(let i of e){let{utility:e,fraction:l}=i;r||(r={utility:e,items:[]},n.set(e,r)),e!==r.utility&&(t.push(r),r={utility:e,items:[]},n.set(e,r)),l?o.get(e).push(i):r.items.push(i)}r&&t[t.length-1]!==r&&t.push(r);for(let[e,t]of o){let r=n.get(e);r&&r.items.push(...t)}let i=[];for(let e of t)for(let t of e.items)i.push([t.name,{modifiers:t.modifiers}]);return i}(t))}var Ee=/^@?[a-zA-Z0-9_-]*$/,Ve=class{compareFns=new Map;variants=new Map;completions=new Map;groupOrder=null;lastOrder=0;static(e,t,{compounds:r,order:n}={}){this.set(e,{kind:"static",applyFn:t,compoundsWith:0,compounds:r??2,order:n})}fromAst(e,t){let r=[];z(t,(e=>{"rule"===e.kind?r.push(e.selector):"at-rule"===e.kind&&"@slot"!==e.name&&r.push(`${e.name} ${e.params}`)})),this.static(e,(e=>{let r=structuredClone(t);Fe(r,e.nodes),e.nodes=r}),{compounds:Ne(r)})}functional(e,t,{compounds:r,order:n}={}){this.set(e,{kind:"functional",applyFn:t,compoundsWith:0,compounds:r??2,order:n})}compound(e,t,r,{compounds:n,order:o}={}){this.set(e,{kind:"compound",applyFn:r,compoundsWith:t,compounds:n??2,order:o})}group(e,t){this.groupOrder=this.nextOrder(),t&&this.compareFns.set(this.groupOrder,t),e(),this.groupOrder=null}has(e){return this.variants.has(e)}get(e){return this.variants.get(e)}kind(e){return this.variants.get(e)?.kind}compoundsWith(e,t){let r=this.variants.get(e),n="string"==typeof t?this.variants.get(t):"arbitrary"===t.kind?{compounds:Ne([t.selector])}:this.variants.get(t.root);return!!(r&&n&&"compound"===r.kind&&0!==n.compounds&&0!==r.compoundsWith&&r.compoundsWith&n.compounds)}suggest(e,t){this.completions.set(e,t)}getCompletions(e){return this.completions.get(e)?.()??[]}compare(e,t){if(e===t)return 0;if(null===e)return-1;if(null===t)return 1;if("arbitrary"===e.kind&&"arbitrary"===t.kind)return e.selector1){let e=n[n.length-1];if(" "===n[n.length-2]&&("i"===e||"I"===e||"s"===e||"S"===e))return`${t}="${n.slice(0,-2)}" ${e}`}return`${t}="${n}"`}return e}function Fe(e,t){z(e,((e,{replaceWith:r})=>{if("at-rule"===e.kind&&"@slot"===e.name)r(t);else if("at-rule"===e.kind&&("@keyframes"===e.name||"@property"===e.name))return Object.assign(e,A([w(e.name,e.params,e.nodes)])),1}))}function Ue(e){let t=function(e){let t=new ve;function r(r,n){let o=/(\d+)_(\d+)/g;function*i(t){for(let r of e.keysInNamespaces(t))yield r.replace(o,((e,t,r)=>`${t}.${r}`))}let l=["1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12"];t.suggest(r,(()=>{let e=[];for(let t of n()){if("string"==typeof t){e.push({values:[t],modifiers:[]});continue}let r=[...t.values??[],...i(t.valueThemeKeys??[])],n=[...t.modifiers??[],...i(t.modifierThemeKeys??[])];t.supportsFractions&&r.push(...l),t.hasDefaultValue&&r.unshift(null),e.push({supportsNegative:t.supportsNegative,values:r,modifiers:n})}return e}))}function n(e,r){t.static(e,(()=>r.map((e=>"function"==typeof e?e():y(e[0],e[1])))))}function o(n,o){function i({negative:t}){return r=>{let n=null;if(r.value)if("arbitrary"===r.value.kind){if(r.modifier)return;n=r.value.value}else{if(n=e.resolve(r.value.fraction??r.value.value,o.themeKeys??[]),null===n&&o.supportsFractions&&r.value.fraction){let[e,t]=B(r.value.fraction,"/");if(!ae(e)||!ae(t))return;n=`calc(${r.value.fraction} * 100%)`}if(null===n&&t&&o.handleNegativeBareValue){if(n=o.handleNegativeBareValue(r.value),!n?.includes("/")&&r.modifier)return;if(null!==n)return o.handle(n)}if(null===n&&o.handleBareValue&&(n=o.handleBareValue(r.value),!n?.includes("/")&&r.modifier))return}else{if(r.modifier)return;n=void 0!==o.defaultValue?o.defaultValue:e.resolve(null,o.themeKeys??[])}if(null!==n)return o.handle(t?`calc(${n} * -1)`:n)}}o.supportsNegative&&t.functional(`-${n}`,i({negative:!0})),t.functional(n,i({negative:!1})),r(n,(()=>[{supportsNegative:o.supportsNegative,valueThemeKeys:o.themeKeys??[],hasDefaultValue:void 0!==o.defaultValue&&null!==o.defaultValue,supportsFractions:o.supportsFractions}]))}function i(n,o){t.functional(n,(t=>{if(!t.value)return;let r=null;return"arbitrary"===t.value.kind?(r=t.value.value,r=ke(r,t.modifier,e)):r=ye(t,e,o.themeKeys),null!==r?o.handle(r):void 0})),r(n,(()=>[{values:["current","inherit","transparent"],valueThemeKeys:o.themeKeys,modifiers:Array.from({length:21},((e,t)=>""+5*t))}]))}function l(n,i,l,{supportsNegative:a=!1,supportsFractions:s=!1}={}){a&&t.static(`-${n}-px`,(()=>l("-1px"))),t.static(`${n}-px`,(()=>l("1px"))),o(n,{themeKeys:i,supportsFractions:s,supportsNegative:a,defaultValue:null,handleBareValue:({value:t})=>{let r=e.resolve(null,["--spacing"]);return r&&ce(t)?`calc(${r} * ${t})`:null},handleNegativeBareValue:({value:t})=>{let r=e.resolve(null,["--spacing"]);return r&&ce(t)?`calc(${r} * -${t})`:null},handle:l}),r(n,(()=>[{values:e.get(["--spacing"])?["0","0.5","1","1.5","2","2.5","3","3.5","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96"]:[],supportsNegative:a,supportsFractions:s,valueThemeKeys:i}]))}n("sr-only",[["position","absolute"],["width","1px"],["height","1px"],["padding","0"],["margin","-1px"],["overflow","hidden"],["clip","rect(0, 0, 0, 0)"],["white-space","nowrap"],["border-width","0"]]),n("not-sr-only",[["position","static"],["width","auto"],["height","auto"],["padding","0"],["margin","0"],["overflow","visible"],["clip","auto"],["white-space","normal"]]),n("pointer-events-none",[["pointer-events","none"]]),n("pointer-events-auto",[["pointer-events","auto"]]),n("visible",[["visibility","visible"]]),n("invisible",[["visibility","hidden"]]),n("collapse",[["visibility","collapse"]]),n("static",[["position","static"]]),n("fixed",[["position","fixed"]]),n("absolute",[["position","absolute"]]),n("relative",[["position","relative"]]),n("sticky",[["position","sticky"]]);for(let[e,t]of[["inset","inset"],["inset-x","inset-inline"],["inset-y","inset-block"],["start","inset-inline-start"],["end","inset-inline-end"],["top","top"],["right","right"],["bottom","bottom"],["left","left"]])n(`${e}-auto`,[[t,"auto"]]),n(`${e}-full`,[[t,"100%"]]),n(`-${e}-full`,[[t,"-100%"]]),l(e,["--inset","--spacing"],(e=>[y(t,e)]),{supportsNegative:!0,supportsFractions:!0});n("isolate",[["isolation","isolate"]]),n("isolation-auto",[["isolation","auto"]]),n("z-auto",[["z-index","auto"]]),o("z",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--z-index"],handle:e=>[y("z-index",e)]}),r("z",(()=>[{supportsNegative:!0,values:["0","10","20","30","40","50"],valueThemeKeys:["--z-index"]}])),n("order-first",[["order","-9999"]]),n("order-last",[["order","9999"]]),n("order-none",[["order","0"]]),o("order",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--order"],handle:e=>[y("order",e)]}),r("order",(()=>[{supportsNegative:!0,values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:["--order"]}])),n("col-auto",[["grid-column","auto"]]),o("col",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-column"],handle:e=>[y("grid-column",e)]}),n("col-span-full",[["grid-column","1 / -1"]]),o("col-span",{handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("grid-column",`span ${e} / span ${e}`)]}),n("col-start-auto",[["grid-column-start","auto"]]),o("col-start",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-column-start"],handle:e=>[y("grid-column-start",e)]}),n("col-end-auto",[["grid-column-end","auto"]]),o("col-end",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-column-end"],handle:e=>[y("grid-column-end",e)]}),r("col-span",(()=>[{values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:[]}])),r("col-start",(()=>[{supportsNegative:!0,values:Array.from({length:13},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-column-start"]}])),r("col-end",(()=>[{supportsNegative:!0,values:Array.from({length:13},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-column-end"]}])),n("row-auto",[["grid-row","auto"]]),o("row",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-row"],handle:e=>[y("grid-row",e)]}),n("row-span-full",[["grid-row","1 / -1"]]),o("row-span",{themeKeys:[],handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("grid-row",`span ${e} / span ${e}`)]}),n("row-start-auto",[["grid-row-start","auto"]]),o("row-start",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-row-start"],handle:e=>[y("grid-row-start",e)]}),n("row-end-auto",[["grid-row-end","auto"]]),o("row-end",{supportsNegative:!0,handleBareValue:({value:e})=>ae(e)?e:null,themeKeys:["--grid-row-end"],handle:e=>[y("grid-row-end",e)]}),r("row-span",(()=>[{values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:[]}])),r("row-start",(()=>[{supportsNegative:!0,values:Array.from({length:13},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-row-start"]}])),r("row-end",(()=>[{supportsNegative:!0,values:Array.from({length:13},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-row-end"]}])),n("float-start",[["float","inline-start"]]),n("float-end",[["float","inline-end"]]),n("float-right",[["float","right"]]),n("float-left",[["float","left"]]),n("float-none",[["float","none"]]),n("clear-start",[["clear","inline-start"]]),n("clear-end",[["clear","inline-end"]]),n("clear-right",[["clear","right"]]),n("clear-left",[["clear","left"]]),n("clear-both",[["clear","both"]]),n("clear-none",[["clear","none"]]);for(let[e,t]of[["m","margin"],["mx","margin-inline"],["my","margin-block"],["ms","margin-inline-start"],["me","margin-inline-end"],["mt","margin-top"],["mr","margin-right"],["mb","margin-bottom"],["ml","margin-left"]])n(`${e}-auto`,[[t,"auto"]]),l(e,["--margin","--spacing"],(e=>[y(t,e)]),{supportsNegative:!0});n("box-border",[["box-sizing","border-box"]]),n("box-content",[["box-sizing","content-box"]]),n("line-clamp-none",[["overflow","visible"],["display","block"],["-webkit-box-orient","horizontal"],["-webkit-line-clamp","unset"]]),o("line-clamp",{themeKeys:["--line-clamp"],handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("overflow","hidden"),y("display","-webkit-box"),y("-webkit-box-orient","vertical"),y("-webkit-line-clamp",e)]}),r("line-clamp",(()=>[{values:["1","2","3","4","5","6"],valueThemeKeys:["--line-clamp"]}])),n("block",[["display","block"]]),n("inline-block",[["display","inline-block"]]),n("inline",[["display","inline"]]),n("hidden",[["display","none"]]),n("inline-flex",[["display","inline-flex"]]),n("table",[["display","table"]]),n("inline-table",[["display","inline-table"]]),n("table-caption",[["display","table-caption"]]),n("table-cell",[["display","table-cell"]]),n("table-column",[["display","table-column"]]),n("table-column-group",[["display","table-column-group"]]),n("table-footer-group",[["display","table-footer-group"]]),n("table-header-group",[["display","table-header-group"]]),n("table-row-group",[["display","table-row-group"]]),n("table-row",[["display","table-row"]]),n("flow-root",[["display","flow-root"]]),n("flex",[["display","flex"]]),n("grid",[["display","grid"]]),n("inline-grid",[["display","inline-grid"]]),n("contents",[["display","contents"]]),n("list-item",[["display","list-item"]]),n("field-sizing-content",[["field-sizing","content"]]),n("field-sizing-fixed",[["field-sizing","fixed"]]),n("aspect-auto",[["aspect-ratio","auto"]]),n("aspect-square",[["aspect-ratio","1 / 1"]]),o("aspect",{themeKeys:["--aspect"],handleBareValue:({fraction:e})=>{if(null===e)return null;let[t,r]=B(e,"/");return ae(t)&&ae(r)?e:null},handle:e=>[y("aspect-ratio",e)]});for(let[e,t]of[["auto","auto"],["full","100%"],["svw","100svw"],["lvw","100lvw"],["dvw","100dvw"],["svh","100svh"],["lvh","100lvh"],["dvh","100dvh"],["min","min-content"],["max","max-content"],["fit","fit-content"]])n(`size-${e}`,[["--tw-sort","size"],["width",t],["height",t]]),n(`w-${e}`,[["width",t]]),n(`h-${e}`,[["height",t]]),n(`min-w-${e}`,[["min-width",t]]),n(`min-h-${e}`,[["min-height",t]]),"auto"!==e&&(n(`max-w-${e}`,[["max-width",t]]),n(`max-h-${e}`,[["max-height",t]]));n("w-screen",[["width","100vw"]]),n("min-w-screen",[["min-width","100vw"]]),n("max-w-screen",[["max-width","100vw"]]),n("h-screen",[["height","100vh"]]),n("min-h-screen",[["min-height","100vh"]]),n("max-h-screen",[["max-height","100vh"]]),n("max-w-none",[["max-width","none"]]),n("max-h-none",[["max-height","none"]]),l("size",["--size","--spacing"],(e=>[y("--tw-sort","size"),y("width",e),y("height",e)]),{supportsFractions:!0});for(let[e,t,r]of[["w",["--width","--spacing","--container"],"width"],["min-w",["--min-width","--spacing","--container"],"min-width"],["max-w",["--max-width","--spacing","--container"],"max-width"],["h",["--height","--spacing"],"height"],["min-h",["--min-height","--height","--spacing"],"min-height"],["max-h",["--max-height","--height","--spacing"],"max-height"]])l(e,t,(e=>[y(r,e)]),{supportsFractions:!0});t.static("container",(()=>{let t=[...e.namespace("--breakpoint").values()];t.sort(((e,t)=>R(e,t,"asc")));let r=[y("--tw-sort","--tw-container-component"),y("width","100%")];for(let e of t)r.push(w("@media",`(width >= ${e})`,[y("max-width",e)]));return r})),n("flex-auto",[["flex","auto"]]),n("flex-initial",[["flex","0 auto"]]),n("flex-none",[["flex","none"]]),t.functional("flex",(e=>{if(e.value){if("arbitrary"===e.value.kind)return e.modifier?void 0:[y("flex",e.value.value)];if(e.value.fraction){let[t,r]=B(e.value.fraction,"/");return ae(t)&&ae(r)?[y("flex",`calc(${e.value.fraction} * 100%)`)]:void 0}if(ae(e.value.value))return e.modifier?void 0:[y("flex",e.value.value)]}})),r("flex",(()=>[{supportsFractions:!0}])),o("shrink",{defaultValue:"1",handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("flex-shrink",e)]}),o("grow",{defaultValue:"1",handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("flex-grow",e)]}),r("shrink",(()=>[{values:["0"],valueThemeKeys:[],hasDefaultValue:!0}])),r("grow",(()=>[{values:["0"],valueThemeKeys:[],hasDefaultValue:!0}])),n("basis-auto",[["flex-basis","auto"]]),n("basis-full",[["flex-basis","100%"]]),l("basis",["--flex-basis","--spacing","--container"],(e=>[y("flex-basis",e)]),{supportsFractions:!0}),n("table-auto",[["table-layout","auto"]]),n("table-fixed",[["table-layout","fixed"]]),n("caption-top",[["caption-side","top"]]),n("caption-bottom",[["caption-side","bottom"]]),n("border-collapse",[["border-collapse","collapse"]]),n("border-separate",[["border-collapse","separate"]]);let a=()=>A([be("--tw-border-spacing-x","0",""),be("--tw-border-spacing-y","0","")]);l("border-spacing",["--border-spacing","--spacing"],(e=>[a(),y("--tw-border-spacing-x",e),y("--tw-border-spacing-y",e),y("border-spacing","var(--tw-border-spacing-x) var(--tw-border-spacing-y)")])),l("border-spacing-x",["--border-spacing","--spacing"],(e=>[a(),y("--tw-border-spacing-x",e),y("border-spacing","var(--tw-border-spacing-x) var(--tw-border-spacing-y)")])),l("border-spacing-y",["--border-spacing","--spacing"],(e=>[a(),y("--tw-border-spacing-y",e),y("border-spacing","var(--tw-border-spacing-x) var(--tw-border-spacing-y)")])),n("origin-center",[["transform-origin","center"]]),n("origin-top",[["transform-origin","top"]]),n("origin-top-right",[["transform-origin","top right"]]),n("origin-right",[["transform-origin","right"]]),n("origin-bottom-right",[["transform-origin","bottom right"]]),n("origin-bottom",[["transform-origin","bottom"]]),n("origin-bottom-left",[["transform-origin","bottom left"]]),n("origin-left",[["transform-origin","left"]]),n("origin-top-left",[["transform-origin","top left"]]),o("origin",{themeKeys:["--transform-origin"],handle:e=>[y("transform-origin",e)]}),n("perspective-origin-center",[["perspective-origin","center"]]),n("perspective-origin-top",[["perspective-origin","top"]]),n("perspective-origin-top-right",[["perspective-origin","top right"]]),n("perspective-origin-right",[["perspective-origin","right"]]),n("perspective-origin-bottom-right",[["perspective-origin","bottom right"]]),n("perspective-origin-bottom",[["perspective-origin","bottom"]]),n("perspective-origin-bottom-left",[["perspective-origin","bottom left"]]),n("perspective-origin-left",[["perspective-origin","left"]]),n("perspective-origin-top-left",[["perspective-origin","top left"]]),o("perspective-origin",{themeKeys:["--perspective-origin"],handle:e=>[y("perspective-origin",e)]}),n("perspective-none",[["perspective","none"]]),o("perspective",{themeKeys:["--perspective"],handle:e=>[y("perspective",e)]});let s=()=>A([be("--tw-translate-x","0"),be("--tw-translate-y","0"),be("--tw-translate-z","0")]);n("translate-none",[["translate","none"]]),n("-translate-full",[s,["--tw-translate-x","-100%"],["--tw-translate-y","-100%"],["translate","var(--tw-translate-x) var(--tw-translate-y)"]]),n("translate-full",[s,["--tw-translate-x","100%"],["--tw-translate-y","100%"],["translate","var(--tw-translate-x) var(--tw-translate-y)"]]),l("translate",["--translate","--spacing"],(e=>[s(),y("--tw-translate-x",e),y("--tw-translate-y",e),y("translate","var(--tw-translate-x) var(--tw-translate-y)")]),{supportsNegative:!0,supportsFractions:!0});for(let e of["x","y"])n(`-translate-${e}-full`,[s,[`--tw-translate-${e}`,"-100%"],["translate","var(--tw-translate-x) var(--tw-translate-y)"]]),n(`translate-${e}-full`,[s,[`--tw-translate-${e}`,"100%"],["translate","var(--tw-translate-x) var(--tw-translate-y)"]]),l(`translate-${e}`,["--translate","--spacing"],(t=>[s(),y(`--tw-translate-${e}`,t),y("translate","var(--tw-translate-x) var(--tw-translate-y)")]),{supportsNegative:!0,supportsFractions:!0});l("translate-z",["--translate","--spacing"],(e=>[s(),y("--tw-translate-z",e),y("translate","var(--tw-translate-x) var(--tw-translate-y) var(--tw-translate-z)")]),{supportsNegative:!0}),n("translate-3d",[s,["translate","var(--tw-translate-x) var(--tw-translate-y) var(--tw-translate-z)"]]);let c=()=>A([be("--tw-scale-x","1"),be("--tw-scale-y","1"),be("--tw-scale-z","1")]);function u({negative:t}){return r=>{if(!r.value||r.modifier)return;let n;return"arbitrary"===r.value.kind?(n=r.value.value,[y("scale",n)]):(n=e.resolve(r.value.value,["--scale"]),!n&&ae(r.value.value)&&(n=`${r.value.value}%`),n?(n=t?`calc(${n} * -1)`:n,[c(),y("--tw-scale-x",n),y("--tw-scale-y",n),y("--tw-scale-z",n),y("scale","var(--tw-scale-x) var(--tw-scale-y)")]):void 0)}}n("scale-none",[["scale","none"]]),t.functional("-scale",u({negative:!0})),t.functional("scale",u({negative:!1})),r("scale",(()=>[{supportsNegative:!0,values:["0","50","75","90","95","100","105","110","125","150","200"],valueThemeKeys:["--scale"]}]));for(let e of["x","y","z"])o(`scale-${e}`,{supportsNegative:!0,themeKeys:["--scale"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:t=>[c(),y(`--tw-scale-${e}`,t),y("scale","var(--tw-scale-x) var(--tw-scale-y)"+("z"===e?" var(--tw-scale-z)":""))]}),r(`scale-${e}`,(()=>[{supportsNegative:!0,values:["0","50","75","90","95","100","105","110","125","150","200"],valueThemeKeys:["--scale"]}]));function d({negative:t}){return r=>{if(!r.value||r.modifier)return;let n;if("arbitrary"===r.value.kind){n=r.value.value;let e=r.value.dataType??H(n,["angle","vector"]);if("vector"===e)return[y("rotate",`${n} var(--tw-rotate)`)];if("angle"!==e)return[y("rotate",n)]}else if(n=e.resolve(r.value.value,["--rotate"]),!n&&ae(r.value.value)&&(n=`${r.value.value}deg`),!n)return;return[y("rotate",t?`calc(${n} * -1)`:n)]}}n("scale-3d",[c,["scale","var(--tw-scale-x) var(--tw-scale-y) var(--tw-scale-z)"]]),n("rotate-none",[["rotate","none"]]),t.functional("-rotate",d({negative:!0})),t.functional("rotate",d({negative:!1})),r("rotate",(()=>[{supportsNegative:!0,values:["0","1","2","3","6","12","45","90","180"],valueThemeKeys:["--rotate"]}]));{let e=["var(--tw-rotate-x)","var(--tw-rotate-y)","var(--tw-rotate-z)","var(--tw-skew-x)","var(--tw-skew-y)"].join(" "),i=()=>A([be("--tw-rotate-x","rotateX(0)"),be("--tw-rotate-y","rotateY(0)"),be("--tw-rotate-z","rotateZ(0)"),be("--tw-skew-x","skewX(0)"),be("--tw-skew-y","skewY(0)")]);for(let t of["x","y","z"])o(`rotate-${t}`,{supportsNegative:!0,themeKeys:["--rotate"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:r=>[i(),y(`--tw-rotate-${t}`,`rotate${t.toUpperCase()}(${r})`),y("transform",e)]}),r(`rotate-${t}`,(()=>[{supportsNegative:!0,values:["0","1","2","3","6","12","45","90","180"],valueThemeKeys:["--rotate"]}]));o("skew",{supportsNegative:!0,themeKeys:["--skew"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:t=>[i(),y("--tw-skew-x",`skewX(${t})`),y("--tw-skew-y",`skewY(${t})`),y("transform",e)]}),o("skew-x",{supportsNegative:!0,themeKeys:["--skew"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:t=>[i(),y("--tw-skew-x",`skewX(${t})`),y("transform",e)]}),o("skew-y",{supportsNegative:!0,themeKeys:["--skew"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:t=>[i(),y("--tw-skew-y",`skewY(${t})`),y("transform",e)]}),r("skew",(()=>[{supportsNegative:!0,values:["0","1","2","3","6","12"],valueThemeKeys:["--skew"]}])),r("skew-x",(()=>[{supportsNegative:!0,values:["0","1","2","3","6","12"],valueThemeKeys:["--skew"]}])),r("skew-y",(()=>[{supportsNegative:!0,values:["0","1","2","3","6","12"],valueThemeKeys:["--skew"]}])),t.functional("transform",(t=>{if(t.modifier)return;let r=null;return t.value?"arbitrary"===t.value.kind&&(r=t.value.value):r=e,null!==r?[i(),y("transform",r)]:void 0})),r("transform",(()=>[{hasDefaultValue:!0}])),n("transform-cpu",[["transform",e]]),n("transform-gpu",[["transform",`translateZ(0) ${e}`]]),n("transform-none",[["transform","none"]])}n("transform-flat",[["transform-style","flat"]]),n("transform-3d",[["transform-style","preserve-3d"]]),n("transform-content",[["transform-box","content-box"]]),n("transform-border",[["transform-box","border-box"]]),n("transform-fill",[["transform-box","fill-box"]]),n("transform-stroke",[["transform-box","stroke-box"]]),n("transform-view",[["transform-box","view-box"]]),n("backface-visible",[["backface-visibility","visible"]]),n("backface-hidden",[["backface-visibility","hidden"]]);for(let e of["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out"])n(`cursor-${e}`,[["cursor",e]]);o("cursor",{themeKeys:["--cursor"],handle:e=>[y("cursor",e)]});for(let e of["auto","none","manipulation"])n(`touch-${e}`,[["touch-action",e]]);let f=()=>A([be("--tw-pan-x"),be("--tw-pan-y"),be("--tw-pinch-zoom")]);for(let e of["x","left","right"])n(`touch-pan-${e}`,[f,["--tw-pan-x",`pan-${e}`],["touch-action","var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]]);for(let e of["y","up","down"])n(`touch-pan-${e}`,[f,["--tw-pan-y",`pan-${e}`],["touch-action","var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]]);n("touch-pinch-zoom",[f,["--tw-pinch-zoom","pinch-zoom"],["touch-action","var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)"]]);for(let e of["none","text","all","auto"])n(`select-${e}`,[["-webkit-user-select",e],["user-select",e]]);n("resize-none",[["resize","none"]]),n("resize-x",[["resize","horizontal"]]),n("resize-y",[["resize","vertical"]]),n("resize",[["resize","both"]]),n("snap-none",[["scroll-snap-type","none"]]);let h=()=>A([be("--tw-scroll-snap-strictness","proximity","*")]);for(let e of["x","y","both"])n(`snap-${e}`,[h,["scroll-snap-type",`${e} var(--tw-scroll-snap-strictness)`]]);n("snap-mandatory",[h,["--tw-scroll-snap-strictness","mandatory"]]),n("snap-proximity",[h,["--tw-scroll-snap-strictness","proximity"]]),n("snap-align-none",[["scroll-snap-align","none"]]),n("snap-start",[["scroll-snap-align","start"]]),n("snap-end",[["scroll-snap-align","end"]]),n("snap-center",[["scroll-snap-align","center"]]),n("snap-normal",[["scroll-snap-stop","normal"]]),n("snap-always",[["scroll-snap-stop","always"]]);for(let[e,t]of[["scroll-m","scroll-margin"],["scroll-mx","scroll-margin-inline"],["scroll-my","scroll-margin-block"],["scroll-ms","scroll-margin-inline-start"],["scroll-me","scroll-margin-inline-end"],["scroll-mt","scroll-margin-top"],["scroll-mr","scroll-margin-right"],["scroll-mb","scroll-margin-bottom"],["scroll-ml","scroll-margin-left"]])l(e,["--scroll-margin","--spacing"],(e=>[y(t,e)]),{supportsNegative:!0});for(let[e,t]of[["scroll-p","scroll-padding"],["scroll-px","scroll-padding-inline"],["scroll-py","scroll-padding-block"],["scroll-ps","scroll-padding-inline-start"],["scroll-pe","scroll-padding-inline-end"],["scroll-pt","scroll-padding-top"],["scroll-pr","scroll-padding-right"],["scroll-pb","scroll-padding-bottom"],["scroll-pl","scroll-padding-left"]])l(e,["--scroll-padding","--spacing"],(e=>[y(t,e)]));n("list-inside",[["list-style-position","inside"]]),n("list-outside",[["list-style-position","outside"]]),n("list-none",[["list-style-type","none"]]),n("list-disc",[["list-style-type","disc"]]),n("list-decimal",[["list-style-type","decimal"]]),o("list",{themeKeys:["--list-style-type"],handle:e=>[y("list-style-type",e)]}),n("list-image-none",[["list-style-image","none"]]),o("list-image",{themeKeys:["--list-style-image"],handle:e=>[y("list-style-image",e)]}),n("appearance-none",[["appearance","none"]]),n("appearance-auto",[["appearance","auto"]]),n("scheme-normal",[["color-scheme","normal"]]),n("scheme-dark",[["color-scheme","dark"]]),n("scheme-light",[["color-scheme","light"]]),n("scheme-light-dark",[["color-scheme","light dark"]]),n("scheme-only-dark",[["color-scheme","only dark"]]),n("scheme-only-light",[["color-scheme","only light"]]),n("columns-auto",[["columns","auto"]]),o("columns",{themeKeys:["--columns","--container"],handleBareValue:({value:e})=>ae(e)?e:null,handle:e=>[y("columns",e)]}),r("columns",(()=>[{values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:["--columns","--container"]}]));for(let e of["auto","avoid","all","avoid-page","page","left","right","column"])n(`break-before-${e}`,[["break-before",e]]);for(let e of["auto","avoid","avoid-page","avoid-column"])n(`break-inside-${e}`,[["break-inside",e]]);for(let e of["auto","avoid","all","avoid-page","page","left","right","column"])n(`break-after-${e}`,[["break-after",e]]);n("grid-flow-row",[["grid-auto-flow","row"]]),n("grid-flow-col",[["grid-auto-flow","column"]]),n("grid-flow-dense",[["grid-auto-flow","dense"]]),n("grid-flow-row-dense",[["grid-auto-flow","row dense"]]),n("grid-flow-col-dense",[["grid-auto-flow","column dense"]]),n("auto-cols-auto",[["grid-auto-columns","auto"]]),n("auto-cols-min",[["grid-auto-columns","min-content"]]),n("auto-cols-max",[["grid-auto-columns","max-content"]]),n("auto-cols-fr",[["grid-auto-columns","minmax(0, 1fr)"]]),o("auto-cols",{themeKeys:["--grid-auto-columns"],handle:e=>[y("grid-auto-columns",e)]}),n("auto-rows-auto",[["grid-auto-rows","auto"]]),n("auto-rows-min",[["grid-auto-rows","min-content"]]),n("auto-rows-max",[["grid-auto-rows","max-content"]]),n("auto-rows-fr",[["grid-auto-rows","minmax(0, 1fr)"]]),o("auto-rows",{themeKeys:["--grid-auto-rows"],handle:e=>[y("grid-auto-rows",e)]}),n("grid-cols-none",[["grid-template-columns","none"]]),n("grid-cols-subgrid",[["grid-template-columns","subgrid"]]),o("grid-cols",{themeKeys:["--grid-template-columns"],handleBareValue:({value:e})=>se(e)?`repeat(${e}, minmax(0, 1fr))`:null,handle:e=>[y("grid-template-columns",e)]}),n("grid-rows-none",[["grid-template-rows","none"]]),n("grid-rows-subgrid",[["grid-template-rows","subgrid"]]),o("grid-rows",{themeKeys:["--grid-template-rows"],handleBareValue:({value:e})=>se(e)?`repeat(${e}, minmax(0, 1fr))`:null,handle:e=>[y("grid-template-rows",e)]}),r("grid-cols",(()=>[{values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-template-columns"]}])),r("grid-rows",(()=>[{values:Array.from({length:12},((e,t)=>`${t+1}`)),valueThemeKeys:["--grid-template-rows"]}])),n("flex-row",[["flex-direction","row"]]),n("flex-row-reverse",[["flex-direction","row-reverse"]]),n("flex-col",[["flex-direction","column"]]),n("flex-col-reverse",[["flex-direction","column-reverse"]]),n("flex-wrap",[["flex-wrap","wrap"]]),n("flex-nowrap",[["flex-wrap","nowrap"]]),n("flex-wrap-reverse",[["flex-wrap","wrap-reverse"]]),n("place-content-center",[["place-content","center"]]),n("place-content-start",[["place-content","start"]]),n("place-content-end",[["place-content","end"]]),n("place-content-between",[["place-content","space-between"]]),n("place-content-around",[["place-content","space-around"]]),n("place-content-evenly",[["place-content","space-evenly"]]),n("place-content-baseline",[["place-content","baseline"]]),n("place-content-stretch",[["place-content","stretch"]]),n("place-items-center",[["place-items","center"]]),n("place-items-start",[["place-items","start"]]),n("place-items-end",[["place-items","end"]]),n("place-items-baseline",[["place-items","baseline"]]),n("place-items-stretch",[["place-items","stretch"]]),n("content-normal",[["align-content","normal"]]),n("content-center",[["align-content","center"]]),n("content-start",[["align-content","flex-start"]]),n("content-end",[["align-content","flex-end"]]),n("content-between",[["align-content","space-between"]]),n("content-around",[["align-content","space-around"]]),n("content-evenly",[["align-content","space-evenly"]]),n("content-baseline",[["align-content","baseline"]]),n("content-stretch",[["align-content","stretch"]]),n("items-center",[["align-items","center"]]),n("items-start",[["align-items","flex-start"]]),n("items-end",[["align-items","flex-end"]]),n("items-baseline",[["align-items","baseline"]]),n("items-stretch",[["align-items","stretch"]]),n("justify-normal",[["justify-content","normal"]]),n("justify-center",[["justify-content","center"]]),n("justify-start",[["justify-content","flex-start"]]),n("justify-end",[["justify-content","flex-end"]]),n("justify-between",[["justify-content","space-between"]]),n("justify-around",[["justify-content","space-around"]]),n("justify-evenly",[["justify-content","space-evenly"]]),n("justify-baseline",[["justify-content","baseline"]]),n("justify-stretch",[["justify-content","stretch"]]),n("justify-items-normal",[["justify-items","normal"]]),n("justify-items-center",[["justify-items","center"]]),n("justify-items-start",[["justify-items","start"]]),n("justify-items-end",[["justify-items","end"]]),n("justify-items-stretch",[["justify-items","stretch"]]),l("gap",["--gap","--spacing"],(e=>[y("gap",e)])),l("gap-x",["--gap","--spacing"],(e=>[y("column-gap",e)])),l("gap-y",["--gap","--spacing"],(e=>[y("row-gap",e)])),l("space-x",["--space","--spacing"],(e=>[A([be("--tw-space-x-reverse","0")]),b(":where(& > :not(:last-child))",[y("--tw-sort","row-gap"),y("--tw-space-x-reverse","0"),y("margin-inline-start",`calc(${e} * var(--tw-space-x-reverse))`),y("margin-inline-end",`calc(${e} * calc(1 - var(--tw-space-x-reverse)))`)])]),{supportsNegative:!0}),l("space-y",["--space","--spacing"],(e=>[A([be("--tw-space-y-reverse","0")]),b(":where(& > :not(:last-child))",[y("--tw-sort","column-gap"),y("--tw-space-y-reverse","0"),y("margin-block-start",`calc(${e} * var(--tw-space-y-reverse))`),y("margin-block-end",`calc(${e} * calc(1 - var(--tw-space-y-reverse)))`)])]),{supportsNegative:!0}),n("space-x-reverse",[()=>A([be("--tw-space-x-reverse","0")]),()=>b(":where(& > :not(:last-child))",[y("--tw-sort","row-gap"),y("--tw-space-x-reverse","1")])]),n("space-y-reverse",[()=>A([be("--tw-space-y-reverse","0")]),()=>b(":where(& > :not(:last-child))",[y("--tw-sort","column-gap"),y("--tw-space-y-reverse","1")])]),n("accent-auto",[["accent-color","auto"]]),i("accent",{themeKeys:["--accent-color","--color"],handle:e=>[y("accent-color",e)]}),i("caret",{themeKeys:["--caret-color","--color"],handle:e=>[y("caret-color",e)]}),i("divide",{themeKeys:["--divide-color","--color"],handle:e=>[b(":where(& > :not(:last-child))",[y("--tw-sort","divide-color"),y("border-color",e)])]}),n("place-self-auto",[["place-self","auto"]]),n("place-self-start",[["place-self","start"]]),n("place-self-end",[["place-self","end"]]),n("place-self-center",[["place-self","center"]]),n("place-self-stretch",[["place-self","stretch"]]),n("self-auto",[["align-self","auto"]]),n("self-start",[["align-self","flex-start"]]),n("self-end",[["align-self","flex-end"]]),n("self-center",[["align-self","center"]]),n("self-stretch",[["align-self","stretch"]]),n("self-baseline",[["align-self","baseline"]]),n("justify-self-auto",[["justify-self","auto"]]),n("justify-self-start",[["justify-self","flex-start"]]),n("justify-self-end",[["justify-self","flex-end"]]),n("justify-self-center",[["justify-self","center"]]),n("justify-self-stretch",[["justify-self","stretch"]]);for(let e of["auto","hidden","clip","visible","scroll"])n(`overflow-${e}`,[["overflow",e]]),n(`overflow-x-${e}`,[["overflow-x",e]]),n(`overflow-y-${e}`,[["overflow-y",e]]);for(let e of["auto","contain","none"])n(`overscroll-${e}`,[["overscroll-behavior",e]]),n(`overscroll-x-${e}`,[["overscroll-behavior-x",e]]),n(`overscroll-y-${e}`,[["overscroll-behavior-y",e]]);n("scroll-auto",[["scroll-behavior","auto"]]),n("scroll-smooth",[["scroll-behavior","smooth"]]),n("truncate",[["overflow","hidden"],["text-overflow","ellipsis"],["white-space","nowrap"]]),n("text-ellipsis",[["text-overflow","ellipsis"]]),n("text-clip",[["text-overflow","clip"]]),n("hyphens-none",[["-webkit-hyphens","none"],["hyphens","none"]]),n("hyphens-manual",[["-webkit-hyphens","manual"],["hyphens","manual"]]),n("hyphens-auto",[["-webkit-hyphens","auto"],["hyphens","auto"]]),n("whitespace-normal",[["white-space","normal"]]),n("whitespace-nowrap",[["white-space","nowrap"]]),n("whitespace-pre",[["white-space","pre"]]),n("whitespace-pre-line",[["white-space","pre-line"]]),n("whitespace-pre-wrap",[["white-space","pre-wrap"]]),n("whitespace-break-spaces",[["white-space","break-spaces"]]),n("text-wrap",[["text-wrap","wrap"]]),n("text-nowrap",[["text-wrap","nowrap"]]),n("text-balance",[["text-wrap","balance"]]),n("text-pretty",[["text-wrap","pretty"]]),n("break-normal",[["overflow-wrap","normal"],["word-break","normal"]]),n("break-words",[["overflow-wrap","break-word"]]),n("break-all",[["word-break","break-all"]]),n("break-keep",[["word-break","keep-all"]]);for(let[e,t]of[["rounded",["border-radius"]],["rounded-s",["border-start-start-radius","border-end-start-radius"]],["rounded-e",["border-start-end-radius","border-end-end-radius"]],["rounded-t",["border-top-left-radius","border-top-right-radius"]],["rounded-r",["border-top-right-radius","border-bottom-right-radius"]],["rounded-b",["border-bottom-right-radius","border-bottom-left-radius"]],["rounded-l",["border-top-left-radius","border-bottom-left-radius"]],["rounded-ss",["border-start-start-radius"]],["rounded-se",["border-start-end-radius"]],["rounded-ee",["border-end-end-radius"]],["rounded-es",["border-end-start-radius"]],["rounded-tl",["border-top-left-radius"]],["rounded-tr",["border-top-right-radius"]],["rounded-br",["border-bottom-right-radius"]],["rounded-bl",["border-bottom-left-radius"]]])n(`${e}-none`,t.map((e=>[e,"0"]))),n(`${e}-full`,t.map((e=>[e,"calc(infinity * 1px)"]))),o(e,{themeKeys:["--radius"],handle:e=>t.map((t=>y(t,e)))});n("border-solid",[["--tw-border-style","solid"],["border-style","solid"]]),n("border-dashed",[["--tw-border-style","dashed"],["border-style","dashed"]]),n("border-dotted",[["--tw-border-style","dotted"],["border-style","dotted"]]),n("border-double",[["--tw-border-style","double"],["border-style","double"]]),n("border-hidden",[["--tw-border-style","hidden"],["border-style","hidden"]]),n("border-none",[["--tw-border-style","none"],["border-style","none"]]);{let i=function(n,o){t.functional(n,(t=>{if(!t.value){if(t.modifier)return;let r=e.get(["--default-border-width"])??"1px",n=o.width(r);return n?[l(),...n]:void 0}if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","line-width","length"])){case"line-width":case"length":{if(t.modifier)return;let e=o.width(r);return e?[l(),...e]:void 0}default:return r=ke(r,t.modifier,e),null===r?void 0:o.color(r)}}{let r=ye(t,e,["--border-color","--color"]);if(r)return o.color(r)}{if(t.modifier)return;let r=e.resolve(t.value.value,["--border-width"]);if(r){let e=o.width(r);return e?[l(),...e]:void 0}if(ae(t.value.value)){let e=o.width(`${t.value.value}px`);return e?[l(),...e]:void 0}}})),r(n,(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--border-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t)),hasDefaultValue:!0},{values:["0","2","4","8"],valueThemeKeys:["--border-width"]}]))},l=()=>A([be("--tw-border-style","solid")]);i("border",{width:e=>[y("border-style","var(--tw-border-style)"),y("border-width",e)],color:e=>[y("border-color",e)]}),i("border-x",{width:e=>[y("border-inline-style","var(--tw-border-style)"),y("border-inline-width",e)],color:e=>[y("border-inline-color",e)]}),i("border-y",{width:e=>[y("border-block-style","var(--tw-border-style)"),y("border-block-width",e)],color:e=>[y("border-block-color",e)]}),i("border-s",{width:e=>[y("border-inline-start-style","var(--tw-border-style)"),y("border-inline-start-width",e)],color:e=>[y("border-inline-start-color",e)]}),i("border-e",{width:e=>[y("border-inline-end-style","var(--tw-border-style)"),y("border-inline-end-width",e)],color:e=>[y("border-inline-end-color",e)]}),i("border-t",{width:e=>[y("border-top-style","var(--tw-border-style)"),y("border-top-width",e)],color:e=>[y("border-top-color",e)]}),i("border-r",{width:e=>[y("border-right-style","var(--tw-border-style)"),y("border-right-width",e)],color:e=>[y("border-right-color",e)]}),i("border-b",{width:e=>[y("border-bottom-style","var(--tw-border-style)"),y("border-bottom-width",e)],color:e=>[y("border-bottom-color",e)]}),i("border-l",{width:e=>[y("border-left-style","var(--tw-border-style)"),y("border-left-width",e)],color:e=>[y("border-left-color",e)]}),o("divide-x",{defaultValue:e.get(["--default-border-width"])??"1px",themeKeys:["--divide-width","--border-width"],handleBareValue:({value:e})=>ae(e)?`${e}px`:null,handle:e=>[A([be("--tw-divide-x-reverse","0")]),b(":where(& > :not(:last-child))",[y("--tw-sort","divide-x-width"),l(),y("--tw-divide-x-reverse","0"),y("border-inline-style","var(--tw-border-style)"),y("border-inline-start-width",`calc(${e} * var(--tw-divide-x-reverse))`),y("border-inline-end-width",`calc(${e} * calc(1 - var(--tw-divide-x-reverse)))`)])]}),o("divide-y",{defaultValue:e.get(["--default-border-width"])??"1px",themeKeys:["--divide-width","--border-width"],handleBareValue:({value:e})=>ae(e)?`${e}px`:null,handle:e=>[A([be("--tw-divide-y-reverse","0")]),b(":where(& > :not(:last-child))",[y("--tw-sort","divide-y-width"),l(),y("--tw-divide-y-reverse","0"),y("border-bottom-style","var(--tw-border-style)"),y("border-top-style","var(--tw-border-style)"),y("border-top-width",`calc(${e} * var(--tw-divide-y-reverse))`),y("border-bottom-width",`calc(${e} * calc(1 - var(--tw-divide-y-reverse)))`)])]}),r("divide-x",(()=>[{values:["0","2","4","8"],valueThemeKeys:["--divide-width","--border-width"],hasDefaultValue:!0}])),r("divide-y",(()=>[{values:["0","2","4","8"],valueThemeKeys:["--divide-width","--border-width"],hasDefaultValue:!0}])),n("divide-x-reverse",[()=>A([be("--tw-divide-x-reverse","0")]),()=>b(":where(& > :not(:last-child))",[y("--tw-divide-x-reverse","1")])]),n("divide-y-reverse",[()=>A([be("--tw-divide-y-reverse","0")]),()=>b(":where(& > :not(:last-child))",[y("--tw-divide-y-reverse","1")])]);for(let e of["solid","dashed","dotted","double","none"])n(`divide-${e}`,[()=>b(":where(& > :not(:last-child))",[y("--tw-sort","divide-style"),y("--tw-border-style",e),y("border-style",e)])])}n("bg-auto",[["background-size","auto"]]),n("bg-cover",[["background-size","cover"]]),n("bg-contain",[["background-size","contain"]]),n("bg-fixed",[["background-attachment","fixed"]]),n("bg-local",[["background-attachment","local"]]),n("bg-scroll",[["background-attachment","scroll"]]),n("bg-center",[["background-position","center"]]),n("bg-top",[["background-position","top"]]),n("bg-right-top",[["background-position","right top"]]),n("bg-right",[["background-position","right"]]),n("bg-right-bottom",[["background-position","right bottom"]]),n("bg-bottom",[["background-position","bottom"]]),n("bg-left-bottom",[["background-position","left bottom"]]),n("bg-left",[["background-position","left"]]),n("bg-left-top",[["background-position","left top"]]),n("bg-repeat",[["background-repeat","repeat"]]),n("bg-no-repeat",[["background-repeat","no-repeat"]]),n("bg-repeat-x",[["background-repeat","repeat-x"]]),n("bg-repeat-y",[["background-repeat","repeat-y"]]),n("bg-repeat-round",[["background-repeat","round"]]),n("bg-repeat-space",[["background-repeat","space"]]),n("bg-none",[["background-image","none"]]);{let e=function(e){let t="in oklab";if("named"===e?.kind)switch(e.value){case"longer":case"shorter":case"increasing":case"decreasing":t=`in oklch ${e.value} hue`;break;default:t=`in ${e.value}`}else"arbitrary"===e?.kind&&(t=e.value);return t},n=function({negative:t}){return r=>{if(!r.value)return;if("arbitrary"===r.value.kind){if(r.modifier)return;let e=r.value.value;return"angle"===(r.value.dataType??H(e,["angle"]))?(e=t?`calc(${e} * -1)`:`${e}`,[y("--tw-gradient-position",e),y("background-image",`linear-gradient(var(--tw-gradient-stops,${e}))`)]):t?void 0:[y("--tw-gradient-position",e),y("background-image",`linear-gradient(var(--tw-gradient-stops,${e}))`)]}let n=r.value.value;if(!t&&l.has(n))n=l.get(n);else{if(!ae(n))return;n=t?`calc(${n}deg * -1)`:`${n}deg`}return[y("--tw-gradient-position",`${n} ${e(r.modifier)}`),y("background-image","linear-gradient(var(--tw-gradient-stops))")]}},o=function({negative:t}){return r=>{if("arbitrary"===r.value?.kind){if(r.modifier)return;let e=r.value.value;return[y("--tw-gradient-position",e),y("background-image",`conic-gradient(var(--tw-gradient-stops,${e}))`)]}let n=e(r.modifier);if(!r.value)return[y("--tw-gradient-position",n),y("background-image","conic-gradient(var(--tw-gradient-stops))")];let o=r.value.value;return ae(o)?(o=t?`calc(${o} * -1)`:`${o}deg`,[y("--tw-gradient-position",`from ${o} ${n}`),y("background-image","conic-gradient(var(--tw-gradient-stops))")]):void 0}},i=["oklab","oklch","srgb","hsl","longer","shorter","increasing","decreasing"],l=new Map([["to-t","to top"],["to-tr","to top right"],["to-r","to right"],["to-br","to bottom right"],["to-b","to bottom"],["to-bl","to bottom left"],["to-l","to left"],["to-tl","to top left"]]);t.functional("-bg-linear",n({negative:!0})),t.functional("bg-linear",n({negative:!1})),r("bg-linear",(()=>[{values:[...l.keys()],modifiers:i},{values:["0","30","60","90","120","150","180","210","240","270","300","330"],supportsNegative:!0,modifiers:i}])),t.functional("-bg-conic",o({negative:!0})),t.functional("bg-conic",o({negative:!1})),r("bg-conic",(()=>[{hasDefaultValue:!0,modifiers:i},{values:["0","30","60","90","120","150","180","210","240","270","300","330"],supportsNegative:!0,modifiers:i}])),t.functional("bg-radial",(t=>{if(!t.value)return[y("--tw-gradient-position",e(t.modifier)),y("background-image","radial-gradient(var(--tw-gradient-stops))")];if("arbitrary"===t.value.kind){if(t.modifier)return;let e=t.value.value;return[y("--tw-gradient-position",e),y("background-image",`radial-gradient(var(--tw-gradient-stops,${e}))`)]}})),r("bg-radial",(()=>[{hasDefaultValue:!0,modifiers:i}]))}t.functional("bg",(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["image","color","percentage","position","bg-size","length","url"])){case"percentage":case"position":return t.modifier?void 0:[y("background-position",r)];case"bg-size":case"length":case"size":return t.modifier?void 0:[y("background-size",r)];case"image":case"url":return t.modifier?void 0:[y("background-image",r)];default:return r=ke(r,t.modifier,e),null===r?void 0:[y("background-color",r)]}}{let r=ye(t,e,["--background-color","--color"]);if(r)return[y("background-color",r)]}{if(t.modifier)return;let r=e.resolve(t.value.value,["--background-image"]);if(r)return[y("background-image",r)]}}})),r("bg",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--background-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:[],valueThemeKeys:["--background-image"]}]));let p=()=>A([be("--tw-gradient-position"),be("--tw-gradient-from","#0000",""),be("--tw-gradient-via","#0000",""),be("--tw-gradient-to","#0000",""),be("--tw-gradient-stops"),be("--tw-gradient-via-stops"),be("--tw-gradient-from-position","0%",""),be("--tw-gradient-via-position","50%",""),be("--tw-gradient-to-position","100%","")]);function m(n,o){t.functional(n,(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","length","percentage"])){case"length":case"percentage":return t.modifier?void 0:o.position(r);default:return r=ke(r,t.modifier,e),null===r?void 0:o.color(r)}}{let r=ye(t,e,["--background-color","--color"]);if(r)return o.color(r)}{if(t.modifier)return;let r=e.resolve(t.value.value,["--gradient-color-stop-positions"]);if(r)return o.position(r);if("%"===t.value.value[t.value.value.length-1]&&ae(t.value.value.slice(0,-1)))return o.position(t.value.value)}}})),r(n,(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--background-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:Array.from({length:21},((e,t)=>5*t+"%")),valueThemeKeys:["--gradient-color-stop-positions"]}]))}m("from",{color:e=>[p(),y("--tw-sort","--tw-gradient-from"),y("--tw-gradient-from",e),y("--tw-gradient-stops","var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))")],position:e=>[p(),y("--tw-gradient-from-position",e)]}),n("via-none",[["--tw-gradient-via-stops","initial"]]),m("via",{color:e=>[p(),y("--tw-sort","--tw-gradient-via"),y("--tw-gradient-via",e),y("--tw-gradient-via-stops","var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)"),y("--tw-gradient-stops","var(--tw-gradient-via-stops)")],position:e=>[p(),y("--tw-gradient-via-position",e)]}),m("to",{color:e=>[p(),y("--tw-sort","--tw-gradient-to"),y("--tw-gradient-to",e),y("--tw-gradient-stops","var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))")],position:e=>[p(),y("--tw-gradient-to-position",e)]}),n("box-decoration-slice",[["-webkit-box-decoration-break","slice"],["box-decoration-break","slice"]]),n("box-decoration-clone",[["-webkit-box-decoration-break","clone"],["box-decoration-break","clone"]]),n("bg-clip-text",[["background-clip","text"]]),n("bg-clip-border",[["background-clip","border-box"]]),n("bg-clip-padding",[["background-clip","padding-box"]]),n("bg-clip-content",[["background-clip","content-box"]]),n("bg-origin-border",[["background-origin","border-box"]]),n("bg-origin-padding",[["background-origin","padding-box"]]),n("bg-origin-content",[["background-origin","content-box"]]);for(let e of["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"])n(`bg-blend-${e}`,[["background-blend-mode",e]]),n(`mix-blend-${e}`,[["mix-blend-mode",e]]);n("mix-blend-plus-darker",[["mix-blend-mode","plus-darker"]]),n("mix-blend-plus-lighter",[["mix-blend-mode","plus-lighter"]]),n("fill-none",[["fill","none"]]),t.functional("fill",(t=>{if(!t.value)return;if("arbitrary"===t.value.kind){let r=ke(t.value.value,t.modifier,e);return null===r?void 0:[y("fill",r)]}let r=ye(t,e,["--fill","--color"]);return r?[y("fill",r)]:void 0})),r("fill",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--fill","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))}])),n("stroke-none",[["stroke","none"]]),t.functional("stroke",(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","number","length","percentage"])){case"number":case"length":case"percentage":return t.modifier?void 0:[y("stroke-width",r)];default:return r=ke(t.value.value,t.modifier,e),null===r?void 0:[y("stroke",r)]}}{let r=ye(t,e,["--stroke","--color"]);if(r)return[y("stroke",r)]}{let r=e.resolve(t.value.value,["--stroke-width"]);if(r)return[y("stroke-width",r)];if(ae(t.value.value))return[y("stroke-width",t.value.value)]}}})),r("stroke",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--stroke","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["0","1","2","3"],valueThemeKeys:["--stroke-width"]}])),n("object-contain",[["object-fit","contain"]]),n("object-cover",[["object-fit","cover"]]),n("object-fill",[["object-fit","fill"]]),n("object-none",[["object-fit","none"]]),n("object-scale-down",[["object-fit","scale-down"]]),n("object-bottom",[["object-position","bottom"]]),n("object-center",[["object-position","center"]]),n("object-left",[["object-position","left"]]),n("object-left-bottom",[["object-position","left bottom"]]),n("object-left-top",[["object-position","left top"]]),n("object-right",[["object-position","right"]]),n("object-right-bottom",[["object-position","right bottom"]]),n("object-right-top",[["object-position","right top"]]),n("object-top",[["object-position","top"]]),o("object",{themeKeys:["--object-position"],handle:e=>[y("object-position",e)]});for(let[e,t]of[["p","padding"],["px","padding-inline"],["py","padding-block"],["ps","padding-inline-start"],["pe","padding-inline-end"],["pt","padding-top"],["pr","padding-right"],["pb","padding-bottom"],["pl","padding-left"]])l(e,["--padding","--spacing"],(e=>[y(t,e)]));n("text-left",[["text-align","left"]]),n("text-center",[["text-align","center"]]),n("text-right",[["text-align","right"]]),n("text-justify",[["text-align","justify"]]),n("text-start",[["text-align","start"]]),n("text-end",[["text-align","end"]]),l("indent",["--text-indent","--spacing"],(e=>[y("text-indent",e)]),{supportsNegative:!0}),n("align-baseline",[["vertical-align","baseline"]]),n("align-top",[["vertical-align","top"]]),n("align-middle",[["vertical-align","middle"]]),n("align-bottom",[["vertical-align","bottom"]]),n("align-text-top",[["vertical-align","text-top"]]),n("align-text-bottom",[["vertical-align","text-bottom"]]),n("align-sub",[["vertical-align","sub"]]),n("align-super",[["vertical-align","super"]]),o("align",{themeKeys:[],handle:e=>[y("vertical-align",e)]}),t.functional("font",(t=>{if(t.value&&!t.modifier){if("arbitrary"===t.value.kind){let e=t.value.value;switch(t.value.dataType??H(e,["number","generic-name","family-name"])){case"generic-name":case"family-name":return[y("font-family",e)];default:return[A([be("--tw-font-weight")]),y("--tw-font-weight",e),y("font-weight",e)]}}{let r=e.resolveWith(t.value.value,["--font"],["--font-feature-settings","--font-variation-settings"]);if(r){let[e,t={}]=r;return[y("font-family",e),y("font-feature-settings",t["--font-feature-settings"]),y("font-variation-settings",t["--font-variation-settings"])]}}{let r=e.resolve(t.value.value,["--font-weight"]);if(r)return[A([be("--tw-font-weight")]),y("--tw-font-weight",r),y("font-weight",r)]}}})),r("font",(()=>[{values:[],valueThemeKeys:["--font"]},{values:[],valueThemeKeys:["--font-weight"]}])),n("uppercase",[["text-transform","uppercase"]]),n("lowercase",[["text-transform","lowercase"]]),n("capitalize",[["text-transform","capitalize"]]),n("normal-case",[["text-transform","none"]]),n("italic",[["font-style","italic"]]),n("not-italic",[["font-style","normal"]]),n("underline",[["text-decoration-line","underline"]]),n("overline",[["text-decoration-line","overline"]]),n("line-through",[["text-decoration-line","line-through"]]),n("no-underline",[["text-decoration-line","none"]]),n("font-stretch-normal",[["font-stretch","normal"]]),n("font-stretch-ultra-condensed",[["font-stretch","ultra-condensed"]]),n("font-stretch-extra-condensed",[["font-stretch","extra-condensed"]]),n("font-stretch-condensed",[["font-stretch","condensed"]]),n("font-stretch-semi-condensed",[["font-stretch","semi-condensed"]]),n("font-stretch-semi-expanded",[["font-stretch","semi-expanded"]]),n("font-stretch-expanded",[["font-stretch","expanded"]]),n("font-stretch-extra-expanded",[["font-stretch","extra-expanded"]]),n("font-stretch-ultra-expanded",[["font-stretch","ultra-expanded"]]),o("font-stretch",{handleBareValue:({value:e})=>{if(!e.endsWith("%"))return null;let t=Number(e.slice(0,-1));return!ae(t)||Number.isNaN(t)||t<50||t>200?null:e},handle:e=>[y("font-stretch",e)]}),r("font-stretch",(()=>[{values:["50%","75%","90%","95%","100%","105%","110%","125%","150%","200%"]}])),i("placeholder",{themeKeys:["--background-color","--color"],handle:e=>[b("&::placeholder",[y("--tw-sort","placeholder-color"),y("color",e)])]}),n("decoration-solid",[["text-decoration-style","solid"]]),n("decoration-double",[["text-decoration-style","double"]]),n("decoration-dotted",[["text-decoration-style","dotted"]]),n("decoration-dashed",[["text-decoration-style","dashed"]]),n("decoration-wavy",[["text-decoration-style","wavy"]]),n("decoration-auto",[["text-decoration-thickness","auto"]]),n("decoration-from-font",[["text-decoration-thickness","from-font"]]),t.functional("decoration",(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","length","percentage"])){case"length":case"percentage":return t.modifier?void 0:[y("text-decoration-thickness",r)];default:return r=ke(r,t.modifier,e),null===r?void 0:[y("text-decoration-color",r)]}}{let r=e.resolve(t.value.value,["--text-decoration-thickness"]);if(r)return t.modifier?void 0:[y("text-decoration-thickness",r)];if(ae(t.value.value))return t.modifier?void 0:[y("text-decoration-thickness",`${t.value.value}px`)]}{let r=ye(t,e,["--text-decoration-color","--color"]);if(r)return[y("text-decoration-color",r)]}}})),r("decoration",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--text-decoration-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["0","1","2"],valueThemeKeys:["--text-decoration-thickness"]}])),n("animate-none",[["animation","none"]]),o("animate",{themeKeys:["--animate"],handle:e=>[y("animation",e)]});{let e=["var(--tw-blur,)","var(--tw-brightness,)","var(--tw-contrast,)","var(--tw-grayscale,)","var(--tw-hue-rotate,)","var(--tw-invert,)","var(--tw-saturate,)","var(--tw-sepia,)","var(--tw-drop-shadow,)"].join(" "),i=["var(--tw-backdrop-blur,)","var(--tw-backdrop-brightness,)","var(--tw-backdrop-contrast,)","var(--tw-backdrop-grayscale,)","var(--tw-backdrop-hue-rotate,)","var(--tw-backdrop-invert,)","var(--tw-backdrop-opacity,)","var(--tw-backdrop-saturate,)","var(--tw-backdrop-sepia,)"].join(" "),l=()=>A([be("--tw-blur"),be("--tw-brightness"),be("--tw-contrast"),be("--tw-grayscale"),be("--tw-hue-rotate"),be("--tw-invert"),be("--tw-opacity"),be("--tw-saturate"),be("--tw-sepia"),be("--tw-drop-shadow")]),a=()=>A([be("--tw-backdrop-blur"),be("--tw-backdrop-brightness"),be("--tw-backdrop-contrast"),be("--tw-backdrop-grayscale"),be("--tw-backdrop-hue-rotate"),be("--tw-backdrop-invert"),be("--tw-backdrop-opacity"),be("--tw-backdrop-saturate"),be("--tw-backdrop-sepia")]);t.functional("filter",(t=>{if(!t.modifier){if(null===t.value)return[l(),y("filter",e)];if("arbitrary"===t.value.kind)return[y("filter",t.value.value)];if("none"===t.value.value)return[y("filter","none")]}})),t.functional("backdrop-filter",(e=>{if(!e.modifier){if(null===e.value)return[a(),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)];if("arbitrary"===e.value.kind)return[y("-webkit-backdrop-filter",e.value.value),y("backdrop-filter",e.value.value)];if("none"===e.value.value)return[y("-webkit-backdrop-filter","none"),y("backdrop-filter","none")]}})),o("blur",{themeKeys:["--blur"],handle:t=>[l(),y("--tw-blur",`blur(${t})`),y("filter",e)]}),n("blur-none",[l,["--tw-blur"," "],["filter",e]]),o("backdrop-blur",{themeKeys:["--backdrop-blur","--blur"],handle:e=>[a(),y("--tw-backdrop-blur",`blur(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),n("backdrop-blur-none",[a,["--tw-backdrop-blur"," "],["-webkit-backdrop-filter",i],["backdrop-filter",i]]),o("brightness",{themeKeys:["--brightness"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:t=>[l(),y("--tw-brightness",`brightness(${t})`),y("filter",e)]}),o("backdrop-brightness",{themeKeys:["--backdrop-brightness","--brightness"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:e=>[a(),y("--tw-backdrop-brightness",`brightness(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("brightness",(()=>[{values:["0","50","75","90","95","100","105","110","125","150","200"],valueThemeKeys:["--brightness"]}])),r("backdrop-brightness",(()=>[{values:["0","50","75","90","95","100","105","110","125","150","200"],valueThemeKeys:["--backdrop-brightness","--brightness"]}])),o("contrast",{themeKeys:["--contrast"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:t=>[l(),y("--tw-contrast",`contrast(${t})`),y("filter",e)]}),o("backdrop-contrast",{themeKeys:["--backdrop-contrast","--contrast"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:e=>[a(),y("--tw-backdrop-contrast",`contrast(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("contrast",(()=>[{values:["0","50","75","100","125","150","200"],valueThemeKeys:["--contrast"]}])),r("backdrop-contrast",(()=>[{values:["0","50","75","100","125","150","200"],valueThemeKeys:["--backdrop-contrast","--contrast"]}])),o("grayscale",{themeKeys:["--grayscale"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:t=>[l(),y("--tw-grayscale",`grayscale(${t})`),y("filter",e)]}),o("backdrop-grayscale",{themeKeys:["--backdrop-grayscale","--grayscale"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:e=>[a(),y("--tw-backdrop-grayscale",`grayscale(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("grayscale",(()=>[{values:["0","25","50","75","100"],valueThemeKeys:["--grayscale"],hasDefaultValue:!0}])),r("backdrop-grayscale",(()=>[{values:["0","25","50","75","100"],valueThemeKeys:["--backdrop-grayscale","--grayscale"],hasDefaultValue:!0}])),o("hue-rotate",{supportsNegative:!0,themeKeys:["--hue-rotate"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:t=>[l(),y("--tw-hue-rotate",`hue-rotate(${t})`),y("filter",e)]}),o("backdrop-hue-rotate",{supportsNegative:!0,themeKeys:["--backdrop-hue-rotate","--hue-rotate"],handleBareValue:({value:e})=>ae(e)?`${e}deg`:null,handle:e=>[a(),y("--tw-backdrop-hue-rotate",`hue-rotate(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("hue-rotate",(()=>[{values:["0","15","30","60","90","180"],valueThemeKeys:["--hue-rotate"]}])),r("backdrop-hue-rotate",(()=>[{values:["0","15","30","60","90","180"],valueThemeKeys:["--backdrop-hue-rotate","--hue-rotate"]}])),o("invert",{themeKeys:["--invert"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:t=>[l(),y("--tw-invert",`invert(${t})`),y("filter",e)]}),o("backdrop-invert",{themeKeys:["--backdrop-invert","--invert"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:e=>[a(),y("--tw-backdrop-invert",`invert(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("invert",(()=>[{values:["0","25","50","75","100"],valueThemeKeys:["--invert"],hasDefaultValue:!0}])),r("backdrop-invert",(()=>[{values:["0","25","50","75","100"],valueThemeKeys:["--backdrop-invert","--invert"],hasDefaultValue:!0}])),o("saturate",{themeKeys:["--saturate"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:t=>[l(),y("--tw-saturate",`saturate(${t})`),y("filter",e)]}),o("backdrop-saturate",{themeKeys:["--backdrop-saturate","--saturate"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,handle:e=>[a(),y("--tw-backdrop-saturate",`saturate(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("saturate",(()=>[{values:["0","50","100","150","200"],valueThemeKeys:["--saturate"]}])),r("backdrop-saturate",(()=>[{values:["0","50","100","150","200"],valueThemeKeys:["--backdrop-saturate","--saturate"]}])),o("sepia",{themeKeys:["--sepia"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:t=>[l(),y("--tw-sepia",`sepia(${t})`),y("filter",e)]}),o("backdrop-sepia",{themeKeys:["--backdrop-sepia","--sepia"],handleBareValue:({value:e})=>ae(e)?`${e}%`:null,defaultValue:"100%",handle:e=>[a(),y("--tw-backdrop-sepia",`sepia(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("sepia",(()=>[{values:["0","50","100"],valueThemeKeys:["--sepia"],hasDefaultValue:!0}])),r("backdrop-sepia",(()=>[{values:["0","50","100"],valueThemeKeys:["--backdrop-sepia","--sepia"],hasDefaultValue:!0}])),n("drop-shadow-none",[l,["--tw-drop-shadow"," "],["filter",e]]),o("drop-shadow",{themeKeys:["--drop-shadow"],handle:t=>[l(),y("--tw-drop-shadow",B(t,",").map((e=>`drop-shadow(${e})`)).join(" ")),y("filter",e)]}),o("backdrop-opacity",{themeKeys:["--backdrop-opacity","--opacity"],handleBareValue:({value:e})=>ue(e)?`${e}%`:null,handle:e=>[a(),y("--tw-backdrop-opacity",`opacity(${e})`),y("-webkit-backdrop-filter",i),y("backdrop-filter",i)]}),r("backdrop-opacity",(()=>[{values:Array.from({length:21},((e,t)=>""+5*t)),valueThemeKeys:["--backdrop-opacity","--opacity"]}]))}{let i=`var(--tw-ease, ${e.resolve(null,["--default-transition-timing-function"])??"ease"})`,l=`var(--tw-duration, ${e.resolve(null,["--default-transition-duration"])??"0s"})`;n("transition-none",[["transition-property","none"]]),n("transition-all",[["transition-property","all"],["transition-timing-function",i],["transition-duration",l]]),n("transition-colors",[["transition-property","color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to"],["transition-timing-function",i],["transition-duration",l]]),n("transition-opacity",[["transition-property","opacity"],["transition-timing-function",i],["transition-duration",l]]),n("transition-shadow",[["transition-property","box-shadow"],["transition-timing-function",i],["transition-duration",l]]),n("transition-transform",[["transition-property","transform, translate, scale, rotate"],["transition-timing-function",i],["transition-duration",l]]),o("transition",{defaultValue:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter",themeKeys:["--transition-property"],handle:e=>[y("transition-property",e),y("transition-timing-function",i),y("transition-duration",l)]}),n("transition-discrete",[["transition-behavior","allow-discrete"]]),n("transition-normal",[["transition-behavior","normal"]]),o("delay",{handleBareValue:({value:e})=>ae(e)?`${e}ms`:null,themeKeys:["--transition-delay"],handle:e=>[y("transition-delay",e)]});{let r=()=>A([be("--tw-duration")]);n("duration-initial",[r,["--tw-duration","initial"]]),t.functional("duration",(t=>{if(t.modifier||!t.value)return;let n=null;return"arbitrary"===t.value.kind?n=t.value.value:(n=e.resolve(t.value.fraction??t.value.value,["--transition-duration"]),null===n&&ae(t.value.value)&&(n=`${t.value.value}ms`)),null!==n?[r(),y("--tw-duration",n),y("transition-duration",n)]:void 0}))}r("delay",(()=>[{values:["75","100","150","200","300","500","700","1000"],valueThemeKeys:["--transition-delay"]}])),r("duration",(()=>[{values:["75","100","150","200","300","500","700","1000"],valueThemeKeys:["--transition-duration"]}]))}{let e=()=>A([be("--tw-ease")]);n("ease-initial",[e,["--tw-ease","initial"]]),n("ease-linear",[e,["--tw-ease","linear"],["transition-timing-function","linear"]]),o("ease",{themeKeys:["--ease"],handle:t=>[e(),y("--tw-ease",t),y("transition-timing-function",t)]})}n("will-change-auto",[["will-change","auto"]]),n("will-change-scroll",[["will-change","scroll-position"]]),n("will-change-contents",[["will-change","contents"]]),n("will-change-transform",[["will-change","transform"]]),o("will-change",{themeKeys:[],handle:e=>[y("will-change",e)]}),n("content-none",[["--tw-content","none"],["content","none"]]),o("content",{themeKeys:[],handle:e=>[A([be("--tw-content",'""')]),y("--tw-content",e),y("content","var(--tw-content)")]});{let e="var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)",t=()=>A([be("--tw-contain-size"),be("--tw-contain-layout"),be("--tw-contain-paint"),be("--tw-contain-style")]);n("contain-none",[["contain","none"]]),n("contain-content",[["contain","content"]]),n("contain-strict",[["contain","strict"]]),n("contain-size",[t,["--tw-contain-size","size"],["contain",e]]),n("contain-inline-size",[t,["--tw-contain-size","inline-size"],["contain",e]]),n("contain-layout",[t,["--tw-contain-layout","layout"],["contain",e]]),n("contain-paint",[t,["--tw-contain-paint","paint"],["contain",e]]),n("contain-style",[t,["--tw-contain-style","style"],["contain",e]]),o("contain",{themeKeys:[],handle:e=>[y("contain",e)]})}n("forced-color-adjust-none",[["forced-color-adjust","none"]]),n("forced-color-adjust-auto",[["forced-color-adjust","auto"]]),n("leading-none",[()=>A([be("--tw-leading")]),["--tw-leading","1"],["line-height","1"]]),l("leading",["--leading","--spacing"],(e=>[A([be("--tw-leading")]),y("--tw-leading",e),y("line-height",e)])),o("tracking",{supportsNegative:!0,themeKeys:["--tracking"],handle:e=>[A([be("--tw-tracking")]),y("--tw-tracking",e),y("letter-spacing",e)]}),n("antialiased",[["-webkit-font-smoothing","antialiased"],["-moz-osx-font-smoothing","grayscale"]]),n("subpixel-antialiased",[["-webkit-font-smoothing","auto"],["-moz-osx-font-smoothing","auto"]]);{let e="var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)",t=()=>A([be("--tw-ordinal"),be("--tw-slashed-zero"),be("--tw-numeric-figure"),be("--tw-numeric-spacing"),be("--tw-numeric-fraction")]);n("normal-nums",[["font-variant-numeric","normal"]]),n("ordinal",[t,["--tw-ordinal","ordinal"],["font-variant-numeric",e]]),n("slashed-zero",[t,["--tw-slashed-zero","slashed-zero"],["font-variant-numeric",e]]),n("lining-nums",[t,["--tw-numeric-figure","lining-nums"],["font-variant-numeric",e]]),n("oldstyle-nums",[t,["--tw-numeric-figure","oldstyle-nums"],["font-variant-numeric",e]]),n("proportional-nums",[t,["--tw-numeric-spacing","proportional-nums"],["font-variant-numeric",e]]),n("tabular-nums",[t,["--tw-numeric-spacing","tabular-nums"],["font-variant-numeric",e]]),n("diagonal-fractions",[t,["--tw-numeric-fraction","diagonal-fractions"],["font-variant-numeric",e]]),n("stacked-fractions",[t,["--tw-numeric-fraction","stacked-fractions"],["font-variant-numeric",e]])}{let i=()=>A([be("--tw-outline-style","solid")]);t.static("outline-hidden",(()=>[y("--tw-outline-style","none"),y("outline-style","none"),w("@media","(forced-colors: active)",[y("outline","2px solid transparent"),y("outline-offset","2px")])])),n("outline-none",[["--tw-outline-style","none"],["outline-style","none"]]),n("outline-solid",[["--tw-outline-style","solid"],["outline-style","solid"]]),n("outline-dashed",[["--tw-outline-style","dashed"],["outline-style","dashed"]]),n("outline-dotted",[["--tw-outline-style","dotted"],["outline-style","dotted"]]),n("outline-double",[["--tw-outline-style","double"],["outline-style","double"]]),t.functional("outline",(t=>{if(null===t.value){if(t.modifier)return;let r=e.get(["--default-outline-width"])??"1px";return[i(),y("outline-style","var(--tw-outline-style)"),y("outline-width",r)]}if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","length","number","percentage"])){case"length":case"number":case"percentage":return t.modifier?void 0:[i(),y("outline-style","var(--tw-outline-style)"),y("outline-width",r)];default:return r=ke(r,t.modifier,e),null===r?void 0:[y("outline-color",r)]}}{let r=ye(t,e,["--outline-color","--color"]);if(r)return[y("outline-color",r)]}{if(t.modifier)return;let r=e.resolve(t.value.value,["--outline-width"]);if(r)return[i(),y("outline-style","var(--tw-outline-style)"),y("outline-width",r)];if(ae(t.value.value))return[i(),y("outline-style","var(--tw-outline-style)"),y("outline-width",`${t.value.value}px`)]}})),r("outline",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--outline-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t)),hasDefaultValue:!0},{values:["0","1","2","4","8"],valueThemeKeys:["--outline-width"]}])),o("outline-offset",{supportsNegative:!0,themeKeys:["--outline-offset"],handleBareValue:({value:e})=>ae(e)?`${e}px`:null,handle:e=>[y("outline-offset",e)]}),r("outline-offset",(()=>[{supportsNegative:!0,values:["0","1","2","4","8"],valueThemeKeys:["--outline-offset"]}]))}o("opacity",{themeKeys:["--opacity"],handleBareValue:({value:e})=>ue(e)?`${e}%`:null,handle:e=>[y("opacity",e)]}),r("opacity",(()=>[{values:Array.from({length:21},((e,t)=>""+5*t)),valueThemeKeys:["--opacity"]}])),n("underline-offset-auto",[["text-underline-offset","auto"]]),o("underline-offset",{supportsNegative:!0,themeKeys:["--text-underline-offset"],handleBareValue:({value:e})=>ae(e)?`${e}px`:null,handle:e=>[y("text-underline-offset",e)]}),r("underline-offset",(()=>[{supportsNegative:!0,values:["0","1","2","4","8"],valueThemeKeys:["--text-underline-offset"]}])),t.functional("text",(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;switch(t.value.dataType??H(r,["color","length","percentage","absolute-size","relative-size"])){case"size":case"length":case"percentage":case"absolute-size":case"relative-size":if(t.modifier){let n="arbitrary"===t.modifier.kind?t.modifier.value:e.resolve(t.modifier.value,["--leading"]);if(!n&&ce(t.modifier.value)){let r=e.resolve(null,["--spacing"]);if(!r)return null;n=`calc(${r} * ${t.modifier.value})`}return!n&&"none"===t.modifier.value&&(n="1"),n?[y("font-size",r),y("line-height",n)]:null}return[y("font-size",r)];default:return r=ke(r,t.modifier,e),null===r?void 0:[y("color",r)]}}{let r=ye(t,e,["--text-color","--color"]);if(r)return[y("color",r)]}{let r=e.resolveWith(t.value.value,["--text"],["--line-height","--letter-spacing","--font-weight"]);if(r){let[n,o={}]=Array.isArray(r)?r:[r];if(t.modifier){let r="arbitrary"===t.modifier.kind?t.modifier.value:e.resolve(t.modifier.value,["--leading"]);if(!r&&ce(t.modifier.value)){let n=e.resolve(null,["--spacing"]);if(!n)return null;r=`calc(${n} * ${t.modifier.value})`}if(!r&&"none"===t.modifier.value&&(r="1"),!r)return null;let o=[y("font-size",n)];return r&&o.push(y("line-height",r)),o}return"string"==typeof o?[y("font-size",n),y("line-height",o)]:[y("font-size",n),y("line-height",o["--line-height"]?`var(--tw-leading, ${o["--line-height"]})`:void 0),y("letter-spacing",o["--letter-spacing"]?`var(--tw-tracking, ${o["--letter-spacing"]})`:void 0),y("font-weight",o["--font-weight"]?`var(--tw-font-weight, ${o["--font-weight"]})`:void 0)]}}}})),r("text",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--text-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:[],valueThemeKeys:["--text"],modifiers:[],modifierThemeKeys:["--leading"]}]));{let o=function(e){return`var(--tw-ring-inset,) 0 0 0 calc(${e} + var(--tw-ring-offset-width)) var(--tw-ring-color, ${c})`},i=function(e){return`inset 0 0 0 ${e} var(--tw-inset-ring-color, currentColor)`},l=["var(--tw-inset-shadow)","var(--tw-inset-ring-shadow)","var(--tw-ring-offset-shadow)","var(--tw-ring-shadow)","var(--tw-shadow)"].join(", "),a="0 0 #0000",s=()=>A([be("--tw-shadow",a),be("--tw-shadow-color"),be("--tw-inset-shadow",a),be("--tw-inset-shadow-color"),be("--tw-ring-color"),be("--tw-ring-shadow",a),be("--tw-inset-ring-color"),be("--tw-inset-ring-shadow",a),be("--tw-ring-inset"),be("--tw-ring-offset-width","0px",""),be("--tw-ring-offset-color","#fff"),be("--tw-ring-offset-shadow",a)]);n("shadow-initial",[s,["--tw-shadow-color","initial"]]),t.functional("shadow",(t=>{if(!t.value){let t=e.get(["--shadow"]);return null===t?void 0:[s(),y("--tw-shadow",pe(t,(e=>`var(--tw-shadow-color, ${e})`))),y("box-shadow",l)]}if("arbitrary"===t.value.kind){let r=t.value.value;return"color"===(t.value.dataType??H(r,["color"]))?(r=ke(r,t.modifier,e),null===r?void 0:[s(),y("--tw-shadow-color",r)]):[s(),y("--tw-shadow",pe(r,(e=>`var(--tw-shadow-color, ${e})`))),y("box-shadow",l)]}if("none"===t.value.value)return t.modifier?void 0:[s(),y("--tw-shadow",a),y("box-shadow",l)];{let r=e.get([`--shadow-${t.value.value}`]);if(r)return t.modifier?void 0:[s(),y("--tw-shadow",pe(r,(e=>`var(--tw-shadow-color, ${e})`))),y("box-shadow",l)]}{let r=ye(t,e,["--box-shadow-color","--color"]);if(r)return[s(),y("--tw-shadow-color",r)]}})),r("shadow",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--box-shadow-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["none"],valueThemeKeys:["--shadow"],hasDefaultValue:!0}])),n("inset-shadow-initial",[s,["--tw-inset-shadow-color","initial"]]),t.functional("inset-shadow",(t=>{if(!t.value){let t=e.get(["--inset-shadow"]);return null===t?void 0:[s(),y("--tw-inset-shadow",pe(t,(e=>`var(--tw-inset-shadow-color, ${e})`))),y("box-shadow",l)]}if("arbitrary"===t.value.kind){let r=t.value.value;return"color"===(t.value.dataType??H(r,["color"]))?(r=ke(r,t.modifier,e),null===r?void 0:[s(),y("--tw-inset-shadow-color",r)]):[s(),y("--tw-inset-shadow",`inset ${pe(r,(e=>`var(--tw-inset-shadow-color, ${e})`))}`),y("box-shadow",l)]}if("none"===t.value.value)return t.modifier?void 0:[s(),y("--tw-inset-shadow",a),y("box-shadow",l)];{let r=e.get([`--inset-shadow-${t.value.value}`]);if(r)return t.modifier?void 0:[s(),y("--tw-inset-shadow",pe(r,(e=>`var(--tw-inset-shadow-color, ${e})`))),y("box-shadow",l)]}{let r=ye(t,e,["--box-shadow-color","--color"]);if(r)return[s(),y("--tw-inset-shadow-color",r)]}})),r("inset-shadow",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--box-shadow-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:[],valueThemeKeys:["--inset-shadow"],hasDefaultValue:!0}])),n("ring-inset",[s,["--tw-ring-inset","inset"]]);let c=e.get(["--default-ring-color"])??"currentColor";t.functional("ring",(t=>{if(!t.value){if(t.modifier)return;let r=e.get(["--default-ring-width"])??"1px";return[s(),y("--tw-ring-shadow",o(r)),y("box-shadow",l)]}if("arbitrary"===t.value.kind){let r=t.value.value;return"length"===(t.value.dataType??H(r,["color","length"]))?t.modifier?void 0:[s(),y("--tw-ring-shadow",o(r)),y("box-shadow",l)]:(r=ke(r,t.modifier,e),null===r?void 0:[y("--tw-ring-color",r)])}{let r=ye(t,e,["--ring-color","--color"]);if(r)return[y("--tw-ring-color",r)]}{if(t.modifier)return;let r=e.resolve(t.value.value,["--ring-width"]);if(null===r&&ae(t.value.value)&&(r=`${t.value.value}px`),r)return[s(),y("--tw-ring-shadow",o(r)),y("box-shadow",l)]}})),r("ring",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--ring-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["0","1","2","4","8"],valueThemeKeys:["--ring-width"],hasDefaultValue:!0}])),t.functional("inset-ring",(t=>{if(!t.value)return t.modifier?void 0:[s(),y("--tw-inset-ring-shadow",i("1px")),y("box-shadow",l)];if("arbitrary"===t.value.kind){let r=t.value.value;return"length"===(t.value.dataType??H(r,["color","length"]))?t.modifier?void 0:[s(),y("--tw-inset-ring-shadow",i(r)),y("box-shadow",l)]:(r=ke(r,t.modifier,e),null===r?void 0:[y("--tw-inset-ring-color",r)])}{let r=ye(t,e,["--ring-color","--color"]);if(r)return[y("--tw-inset-ring-color",r)]}{if(t.modifier)return;let r=e.resolve(t.value.value,["--ring-width"]);if(null===r&&ae(t.value.value)&&(r=`${t.value.value}px`),r)return[s(),y("--tw-inset-ring-shadow",i(r)),y("box-shadow",l)]}})),r("inset-ring",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--ring-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["0","1","2","4","8"],valueThemeKeys:["--ring-width"],hasDefaultValue:!0}]));let u="var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)";t.functional("ring-offset",(t=>{if(t.value){if("arbitrary"===t.value.kind){let r=t.value.value;return"length"===(t.value.dataType??H(r,["color","length"]))?t.modifier?void 0:[y("--tw-ring-offset-width",r),y("--tw-ring-offset-shadow",u)]:(r=ke(r,t.modifier,e),null===r?void 0:[y("--tw-ring-offset-color",r)])}{let r=e.resolve(t.value.value,["--ring-offset-width"]);if(r)return t.modifier?void 0:[y("--tw-ring-offset-width",r),y("--tw-ring-offset-shadow",u)];if(ae(t.value.value))return t.modifier?void 0:[y("--tw-ring-offset-width",`${t.value.value}px`),y("--tw-ring-offset-shadow",u)]}{let r=ye(t,e,["--ring-offset-color","--color"]);if(r)return[y("--tw-ring-offset-color",r)]}}}))}return r("ring-offset",(()=>[{values:["current","inherit","transparent"],valueThemeKeys:["--ring-offset-color","--color"],modifiers:Array.from({length:21},((e,t)=>""+5*t))},{values:["0","1","2","4","8"],valueThemeKeys:["--ring-offset-width"]}])),t.functional("@container",(e=>{let t=null;if(null===e.value?t="inline-size":"arbitrary"===e.value.kind?t=e.value.value:"named"===e.value.kind&&"normal"===e.value.value&&(t="normal"),null!==t)return e.modifier?[y("container-type",t),y("container-name",e.modifier.value)]:[y("container-type",t)]})),r("@container",(()=>[{values:["normal"],valueThemeKeys:[],hasDefaultValue:!0}])),t}(e),r=function(e){let t=new Ve;function r(e,r,{compounds:n}={}){n=n??Ne(r),t.static(e,(e=>{e.nodes=r.map((t=>k(t,e.nodes)))}),{compounds:n})}function n(e,t){return t.map((t=>{let r=B(t=t.trim()," ");return"not"===r[0]?r.slice(1).join(" "):"@container"===e?"("===r[0][0]?`not ${t}`:"not"===r[1]?`${r[0]} ${r.slice(2).join(" ")}`:`${r[0]} not ${r.slice(1).join(" ")}`:`not ${t}`}))}r("*",[":is(& > *)"],{compounds:0}),r("**",[":is(& *)"],{compounds:0});let o=["@media","@supports","@container"];function i(e){for(let t of o){if(t!==e.name)continue;let r=B(e.params,",");return r.length>1?null:(r=n(e.name,r),w(e.name,r.join(", ")))}return null}function l(e){return e.includes("::")?null:`&:not(${B(e,",").map((e=>e.replaceAll("&","*"))).join(", ")})`}t.compound("not",3,((e,t)=>{if("arbitrary"===t.variant.kind&&t.variant.relative||t.modifier)return null;let r=!1;return z([e],((t,{path:n})=>{if("rule"!==t.kind&&"at-rule"!==t.kind)return 0;if(t.nodes.length>0)return 0;let o=[],a=[];for(let e of n)"at-rule"===e.kind?o.push(e):"rule"===e.kind&&a.push(e);if(o.length>1)return 2;if(a.length>1)return 2;let s=[];for(let e of a){let t=l(e.selector);if(!t)return r=!1,2;s.push(b(t,[]))}for(let e of o){let t=i(e);if(!t)return r=!1,2;s.push(t)}return Object.assign(e,b("&",s)),r=!0,1})),"rule"===e.kind&&"&"===e.selector&&1===e.nodes.length&&Object.assign(e,e.nodes[0]),r?void 0:null})),t.suggest("not",(()=>Array.from(t.keys()).filter((e=>t.compoundsWith("not",e))))),t.compound("group",2,((t,r)=>{if("arbitrary"===r.variant.kind&&r.variant.relative)return null;let n=r.modifier?`:where(.${e.prefix?`${e.prefix}\\:`:""}group\\/${r.modifier.value})`:`:where(.${e.prefix?`${e.prefix}\\:`:""}group)`,o=!1;return z([t],((e,{path:t})=>{if("rule"!==e.kind)return 0;for(let e of t.slice(0,-1))if("rule"===e.kind)return o=!1,2;let r=e.selector.replaceAll("&",n);B(r,",").length>1&&(r=`:is(${r})`),e.selector=`&:is(${r} *)`,o=!0})),o?void 0:null})),t.suggest("group",(()=>Array.from(t.keys()).filter((e=>t.compoundsWith("group",e))))),t.compound("peer",2,((t,r)=>{if("arbitrary"===r.variant.kind&&r.variant.relative)return null;let n=r.modifier?`:where(.${e.prefix?`${e.prefix}\\:`:""}peer\\/${r.modifier.value})`:`:where(.${e.prefix?`${e.prefix}\\:`:""}peer)`,o=!1;return z([t],((e,{path:t})=>{if("rule"!==e.kind)return 0;for(let e of t.slice(0,-1))if("rule"===e.kind)return o=!1,2;let r=e.selector.replaceAll("&",n);B(r,",").length>1&&(r=`:is(${r})`),e.selector=`&:is(${r} ~ *)`,o=!0})),o?void 0:null})),t.suggest("peer",(()=>Array.from(t.keys()).filter((e=>t.compoundsWith("peer",e))))),r("first-letter",["&::first-letter"]),r("first-line",["&::first-line"]),r("marker",["& *::marker","&::marker"]),r("selection",["& *::selection","&::selection"]),r("file",["&::file-selector-button"]),r("placeholder",["&::placeholder"]),r("backdrop",["&::backdrop"]);{let e=function(){return A([w("@property","--tw-content",[y("syntax",'"*"'),y("initial-value",'""'),y("inherits","false")])])};t.static("before",(t=>{t.nodes=[b("&::before",[e(),y("content","var(--tw-content)"),...t.nodes])]}),{compounds:0}),t.static("after",(t=>{t.nodes=[b("&::after",[e(),y("content","var(--tw-content)"),...t.nodes])]}),{compounds:0})}r("first",["&:first-child"]),r("last",["&:last-child"]),r("only",["&:only-child"]),r("odd",["&:nth-child(odd)"]),r("even",["&:nth-child(even)"]),r("first-of-type",["&:first-of-type"]),r("last-of-type",["&:last-of-type"]),r("only-of-type",["&:only-of-type"]),r("visited",["&:visited"]),r("target",["&:target"]),r("open",["&:is([open], :popover-open, :open)"]),r("default",["&:default"]),r("checked",["&:checked"]),r("indeterminate",["&:indeterminate"]),r("placeholder-shown",["&:placeholder-shown"]),r("autofill",["&:autofill"]),r("optional",["&:optional"]),r("required",["&:required"]),r("valid",["&:valid"]),r("invalid",["&:invalid"]),r("in-range",["&:in-range"]),r("out-of-range",["&:out-of-range"]),r("read-only",["&:read-only"]),r("empty",["&:empty"]),r("focus-within",["&:focus-within"]),t.static("hover",(e=>{e.nodes=[b("&:hover",[w("@media","(hover: hover)",e.nodes)])]})),r("focus",["&:focus"]),r("focus-visible",["&:focus-visible"]),r("active",["&:active"]),r("enabled",["&:enabled"]),r("disabled",["&:disabled"]),r("inert",["&:is([inert], [inert] *)"]),t.compound("in",2,((e,t)=>{if(t.modifier)return null;let r=!1;return z([e],((e,{path:t})=>{if("rule"!==e.kind)return 0;for(let e of t.slice(0,-1))if("rule"===e.kind)return r=!1,2;e.selector=`:where(${e.selector.replaceAll("&","*")}) &`,r=!0})),r?void 0:null})),t.suggest("in",(()=>Array.from(t.keys()).filter((e=>t.compoundsWith("in",e))))),t.compound("has",2,((e,t)=>{if(t.modifier)return null;let r=!1;return z([e],((e,{path:t})=>{if("rule"!==e.kind)return 0;for(let e of t.slice(0,-1))if("rule"===e.kind)return r=!1,2;e.selector=`&:has(${e.selector.replaceAll("&","*")})`,r=!0})),r?void 0:null})),t.suggest("has",(()=>Array.from(t.keys()).filter((e=>t.compoundsWith("has",e))))),t.functional("aria",((e,t)=>{if(!t.value||t.modifier)return null;"arbitrary"===t.value.kind?e.nodes=[b(`&[aria-${Oe(t.value.value)}]`,e.nodes)]:e.nodes=[b(`&[aria-${t.value.value}="true"]`,e.nodes)]})),t.suggest("aria",(()=>["busy","checked","disabled","expanded","hidden","pressed","readonly","required","selected"])),t.functional("data",((e,t)=>{if(!t.value||t.modifier)return null;e.nodes=[b(`&[data-${Oe(t.value.value)}]`,e.nodes)]})),t.functional("nth",((e,t)=>{if(!t.value||t.modifier||"named"===t.value.kind&&!ae(t.value.value))return null;e.nodes=[b(`&:nth-child(${t.value.value})`,e.nodes)]})),t.functional("nth-last",((e,t)=>{if(!t.value||t.modifier||"named"===t.value.kind&&!ae(t.value.value))return null;e.nodes=[b(`&:nth-last-child(${t.value.value})`,e.nodes)]})),t.functional("nth-of-type",((e,t)=>{if(!t.value||t.modifier||"named"===t.value.kind&&!ae(t.value.value))return null;e.nodes=[b(`&:nth-of-type(${t.value.value})`,e.nodes)]})),t.functional("nth-last-of-type",((e,t)=>{if(!t.value||t.modifier||"named"===t.value.kind&&!ae(t.value.value))return null;e.nodes=[b(`&:nth-last-of-type(${t.value.value})`,e.nodes)]})),t.functional("supports",((e,t)=>{if(!t.value||t.modifier)return null;let r=t.value.value;if(null===r)return null;if(/^[\w-]*\s*\(/.test(r)){let t=r.replace(/\b(and|or|not)\b/g," $1 ");e.nodes=[w("@supports",t,e.nodes)]}else r.includes(":")||(r=`${r}: var(--tw)`),("("!==r[0]||")"!==r[r.length-1])&&(r=`(${r})`),e.nodes=[w("@supports",r,e.nodes)]}),{compounds:1}),r("motion-safe",["@media (prefers-reduced-motion: no-preference)"]),r("motion-reduce",["@media (prefers-reduced-motion: reduce)"]),r("contrast-more",["@media (prefers-contrast: more)"]),r("contrast-less",["@media (prefers-contrast: less)"]);{let r=function(e,t,r,n){if(e===t)return 0;let o=n.get(e);if(null===o)return"asc"===r?-1:1;let i=n.get(t);return null===i?"asc"===r?1:-1:R(o,i,r)};{let n=e.namespace("--breakpoint"),o=new c((t=>{switch(t.kind){case"static":return e.resolveValue(t.root,["--breakpoint"])??null;case"functional":{if(!t.value||t.modifier)return null;let r=null;return"arbitrary"===t.value.kind?r=t.value.value:"named"===t.value.kind&&(r=e.resolveValue(t.value.value,["--breakpoint"])),!r||r.includes("var(")?null:r}case"arbitrary":case"compound":return null}}));t.group((()=>{t.functional("max",((e,t)=>{if(t.modifier)return null;let r=o.get(t);if(null===r)return null;e.nodes=[w("@media",`(width < ${r})`,e.nodes)]}),{compounds:1})}),((e,t)=>r(e,t,"desc",o))),t.suggest("max",(()=>Array.from(n.keys()).filter((e=>null!==e)))),t.group((()=>{for(let[r,n]of e.namespace("--breakpoint"))null!==r&&t.static(r,(e=>{e.nodes=[w("@media",`(width >= ${n})`,e.nodes)]}),{compounds:1});t.functional("min",((e,t)=>{if(t.modifier)return null;let r=o.get(t);if(null===r)return null;e.nodes=[w("@media",`(width >= ${r})`,e.nodes)]}),{compounds:1})}),((e,t)=>r(e,t,"asc",o))),t.suggest("min",(()=>Array.from(n.keys()).filter((e=>null!==e))))}{let n=e.namespace("--container"),o=new c((t=>{switch(t.kind){case"functional":{if(null===t.value)return null;let r=null;return"arbitrary"===t.value.kind?r=t.value.value:"named"===t.value.kind&&(r=e.resolveValue(t.value.value,["--container"])),!r||r.includes("var(")?null:r}case"static":case"arbitrary":case"compound":return null}}));t.group((()=>{t.functional("@max",((e,t)=>{let r=o.get(t);if(null===r)return null;e.nodes=[w("@container",t.modifier?`${t.modifier.value} (width < ${r})`:`(width < ${r})`,e.nodes)]}),{compounds:1})}),((e,t)=>r(e,t,"desc",o))),t.suggest("@max",(()=>Array.from(n.keys()).filter((e=>null!==e)))),t.group((()=>{t.functional("@",((e,t)=>{let r=o.get(t);if(null===r)return null;e.nodes=[w("@container",t.modifier?`${t.modifier.value} (width >= ${r})`:`(width >= ${r})`,e.nodes)]}),{compounds:1}),t.functional("@min",((e,t)=>{let r=o.get(t);if(null===r)return null;e.nodes=[w("@container",t.modifier?`${t.modifier.value} (width >= ${r})`:`(width >= ${r})`,e.nodes)]}),{compounds:1})}),((e,t)=>r(e,t,"asc",o))),t.suggest("@min",(()=>Array.from(n.keys()).filter((e=>null!==e)))),t.suggest("@",(()=>Array.from(n.keys()).filter((e=>null!==e))))}}return r("portrait",["@media (orientation: portrait)"]),r("landscape",["@media (orientation: landscape)"]),r("ltr",['&:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *)']),r("rtl",['&:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)']),r("dark",["@media (prefers-color-scheme: dark)"]),r("starting",["@starting-style"]),r("print",["@media print"]),r("forced-colors",["@media (forced-colors: active)"]),t}(e),n=new c((e=>function(e,t){if("["===e[0]&&"]"===e[e.length-1]){if("@"===e[1]&&e.includes("&"))return null;let t=F(e.slice(1,-1));if(0===t.length||0===t.trim().length)return null;let r=">"===t[0]||"+"===t[0]||"~"===t[0];return!r&&"@"!==t[0]&&!t.includes("&")&&(t=`&:is(${t})`),{kind:"arbitrary",selector:t,relative:r}}{let[r,n=null,o]=B(e,"/");if(o)return null;let i=M(r,(e=>t.variants.has(e)));for(let[e,r]of i)switch(t.variants.kind(e)){case"static":return null!==r||null!==n?null:{kind:"static",root:e};case"functional":{let t=null===n?null:L(n);if(null!==n&&null===t)return null;if(null===r)return{kind:"functional",root:e,modifier:t,value:null};if("]"===r[r.length-1]){if("["!==r[0])continue;let n=F(r.slice(1,-1));return 0===n.length||0===n.trim().length?null:{kind:"functional",root:e,modifier:t,value:{kind:"arbitrary",value:n}}}if(")"===r[r.length-1]){if("("!==r[0])continue;let n=F(r.slice(1,-1));return 0===n.length||0===n.trim().length||"-"!==n[0]&&"-"!==n[1]?null:{kind:"functional",root:e,modifier:t,value:{kind:"arbitrary",value:`var(${n})`}}}return{kind:"functional",root:e,modifier:t,value:{kind:"named",value:r}}}case"compound":{if(null===r)return null;let o=t.parseVariant(r);if(null===o||!t.variants.compoundsWith(e,o))return null;let i=null===n?null:L(n);return null!==n&&null===i?null:{kind:"compound",root:e,modifier:i,variant:o}}}}return null}(e,s))),i=new c((e=>Array.from(function*(e,t){let r=B(e,":");if(t.theme.prefix){if(1===r.length||r[0]!==t.theme.prefix)return null;r.shift()}let n=r.pop(),o=[];for(let e=r.length-1;e>=0;--e){let n=t.parseVariant(r[e]);if(null===n)return;o.push(n)}let i=!1;"!"===n[n.length-1]?(i=!0,n=n.slice(0,-1)):"!"===n[0]&&(i=!0,n=n.slice(1)),t.utilities.has(n,"static")&&!n.includes("[")&&(yield{kind:"static",root:n,variants:o,important:i,raw:e});let[l,a=null,s]=B(n,"/");if(s)return;let c,u=null===a?null:L(a);if(null===a||null!==u)if("["!==l[0]){if("]"===l[l.length-1]){let e=l.indexOf("-[");if(-1===e)return;let r=l.slice(0,e);if(!t.utilities.has(r,"functional"))return;c=[[r,l.slice(e+1)]]}else if(")"===l[l.length-1]){let e=l.indexOf("-(");if(-1===e)return;let r=l.slice(0,e);if(!t.utilities.has(r,"functional"))return;let n=l.slice(e+2,-1),o=B(n,":"),i=null;if(2===o.length&&(i=o[0],n=o[1]),"-"!==n[0]&&"-"!==n[1])return;c=[[r,null===i?`[var(${n})]`:`[${i}:var(${n})]`]]}else c=M(l,(e=>t.utilities.has(e,"functional")));for(let[t,r]of c){let n={kind:"functional",root:t,modifier:u,value:null,variants:o,important:i,raw:e};if(null!==r){{let e=r.indexOf("[");if(-1!==e){if("]"!==r[r.length-1])return;let t=F(r.slice(e+1,-1)),o="";for(let e=0;e=97&&r<=122))break}if(0===t.length||0===t.trim().length)continue;n.value={kind:"arbitrary",dataType:o||null,value:t}}else{let e=null===a||"arbitrary"===n.modifier?.kind?null:`${r}/${a}`;n.value={kind:"named",value:r,fraction:e}}}yield n}else yield n}}else{if("]"!==l[l.length-1])return;let t=l.charCodeAt(1);if(45!==t&&!(t>=97&&t<=122))return;l=l.slice(1,-1);let r=l.indexOf(":");if(-1===r||0===r||r===l.length-1)return;let n=l.slice(0,r),a=F(l.slice(r+1));yield{kind:"arbitrary",property:n,value:a,modifier:u,variants:o,important:i,raw:e}}}(e,s)))),l=new c((e=>{let t=function(e,t){let r=function(e,t){if("arbitrary"===e.kind){let r=e.value;return e.modifier&&(r=ke(r,e.modifier,t.theme)),null===r?[]:[[y(e.property,r)]]}let r=t.utilities.get(e.root)??[],n=[],o=r.filter((e=>!Be(e)));for(let t of o){if(t.kind!==e.kind)continue;let r=t.compileFn(e);if(void 0!==r){if(null===r)return n;n.push(r)}}if(n.length>0)return n;let i=r.filter((e=>Be(e)));for(let t of i){if(t.kind!==e.kind)continue;let r=t.compileFn(e);if(void 0!==r){if(null===r)return n;n.push(r)}}return n}(e,t);if(0===r.length)return[];let n=[],i=`.${o(e.raw)}`;for(let o of r){let r=Me(o);(e.important||t.important)&&Le(o);let l={kind:"rule",selector:i,nodes:o};for(let r of e.variants)if(null===_e(l,r,t.variants))return[];n.push({node:l,propertySort:r})}return n}(e,s);try{Ce(t.map((({node:e})=>e)),s)}catch{return[]}return t})),a=new c((t=>{for(let r of g(t))e.markUsedVariable(r)})),s={theme:e,utilities:t,variants:r,invalidCandidates:new Set,important:!1,candidatesToCss(e){let t=[];for(let r of e){let e=!1,{astNodes:n}=De([r],this,{onInvalidCandidate(){e=!0}});n=T(n,s),0===n.length||e?t.push(null):t.push(j(n))}return t},getClassOrder(e){return function(e,t){let{astNodes:r,nodeSorting:n}=De(Array.from(t),e),o=new Map(t.map((e=>[e,null]))),i=0n;for(let e of r){let t=n.get(e)?.candidate;t&&o.set(t,o.get(t)??i++)}return t.map((e=>[e,o.get(e)??null]))}(this,e)},getClassList(){return Se(this)},getVariants(){return function(e){let t=[];for(let[r,n]of e.variants.entries()){let o=function({value:t,modifier:n}={}){let o=r;t&&(o+=i?`-${t}`:t),n&&(o+=`/${n}`);let l=e.parseVariant(o);if(!l)return[];let a=b(".__placeholder__",[]);if(null===_e(a,l,e.variants))return[];let s=[];return C(a.nodes,((e,{path:t})=>{if("rule"!==e.kind&&"at-rule"!==e.kind||e.nodes.length>0)return;t.sort(((e,t)=>{let r="at-rule"===e.kind,n="at-rule"===t.kind;return r&&!n?-1:!r&&n?1:0}));let r=t.flatMap((e=>"rule"===e.kind?"&"===e.selector?[]:[e.selector]:"at-rule"===e.kind?[`${e.name} ${e.params}`]:[])),n="";for(let e=r.length-1;e>=0;e--)n=""===n?r[e]:`${r[e]} { ${n} }`;s.push(n)})),s};if("arbitrary"===n.kind)continue;let i="@"!==r,l=e.variants.getCompletions(r);switch(n.kind){case"static":t.push({name:r,values:l,isArbitrary:!1,hasDash:i,selectors:o});break;case"functional":case"compound":t.push({name:r,values:l,isArbitrary:!0,hasDash:i,selectors:o})}}return t}(this)},parseCandidate:e=>i.get(e),parseVariant:e=>n.get(e),compileAstNodes:e=>l.get(e),getVariantOrder(){let e=Array.from(n.values());e.sort(((e,t)=>this.variants.compare(e,t)));let t,r=new Map,o=0;for(let n of e)null!==n&&(void 0!==t&&0!==this.variants.compare(t,n)&&o++,r.set(n,o),t=n);return r},resolveThemeValue(t){let r=t.lastIndexOf("/"),n=null;-1!==r&&(n=t.slice(r+1).trim(),t=t.slice(0,r).trim());let o=e.get([t])??void 0;return n&&o?we(o,n):o},trackUsedVariables(e){a.get(e)}};return s}var We=["container-type","pointer-events","visibility","position","inset","inset-inline","inset-block","inset-inline-start","inset-inline-end","top","right","bottom","left","isolation","z-index","order","grid-column","grid-column-start","grid-column-end","grid-row","grid-row-start","grid-row-end","float","clear","--tw-container-component","margin","margin-inline","margin-block","margin-inline-start","margin-inline-end","margin-top","margin-right","margin-bottom","margin-left","box-sizing","display","field-sizing","aspect-ratio","height","max-height","min-height","width","max-width","min-width","flex","flex-shrink","flex-grow","flex-basis","table-layout","caption-side","border-collapse","border-spacing","transform-origin","translate","--tw-translate-x","--tw-translate-y","--tw-translate-z","scale","--tw-scale-x","--tw-scale-y","--tw-scale-z","rotate","--tw-rotate-x","--tw-rotate-y","--tw-rotate-z","--tw-skew-x","--tw-skew-y","transform","animation","cursor","touch-action","--tw-pan-x","--tw-pan-y","--tw-pinch-zoom","resize","scroll-snap-type","--tw-scroll-snap-strictness","scroll-snap-align","scroll-snap-stop","scroll-margin","scroll-margin-inline","scroll-margin-block","scroll-margin-inline-start","scroll-margin-inline-end","scroll-margin-top","scroll-margin-right","scroll-margin-bottom","scroll-margin-left","scroll-padding","scroll-padding-inline","scroll-padding-block","scroll-padding-inline-start","scroll-padding-inline-end","scroll-padding-top","scroll-padding-right","scroll-padding-bottom","scroll-padding-left","list-style-position","list-style-type","list-style-image","appearance","columns","break-before","break-inside","break-after","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-template-columns","grid-template-rows","flex-direction","flex-wrap","place-content","place-items","align-content","align-items","justify-content","justify-items","gap","column-gap","row-gap","--tw-space-x-reverse","--tw-space-y-reverse","divide-x-width","divide-y-width","--tw-divide-y-reverse","divide-style","divide-color","place-self","align-self","justify-self","overflow","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","scroll-behavior","border-radius","border-start-radius","border-end-radius","border-top-radius","border-right-radius","border-bottom-radius","border-left-radius","border-start-start-radius","border-start-end-radius","border-end-end-radius","border-end-start-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-width","border-inline-width","border-block-width","border-inline-start-width","border-inline-end-width","border-top-width","border-right-width","border-bottom-width","border-left-width","border-style","border-inline-style","border-block-style","border-inline-start-style","border-inline-end-style","border-top-style","border-right-style","border-bottom-style","border-left-style","border-color","border-inline-color","border-block-color","border-inline-start-color","border-inline-end-color","border-top-color","border-right-color","border-bottom-color","border-left-color","background-color","background-image","--tw-gradient-position","--tw-gradient-stops","--tw-gradient-via-stops","--tw-gradient-from","--tw-gradient-from-position","--tw-gradient-via","--tw-gradient-via-position","--tw-gradient-to","--tw-gradient-to-position","box-decoration-break","background-size","background-attachment","background-clip","background-position","background-repeat","background-origin","fill","stroke","stroke-width","object-fit","object-position","padding","padding-inline","padding-block","padding-inline-start","padding-inline-end","padding-top","padding-right","padding-bottom","padding-left","text-align","text-indent","vertical-align","font-family","font-size","line-height","font-weight","letter-spacing","text-wrap","overflow-wrap","word-break","text-overflow","hyphens","white-space","color","text-transform","font-style","font-stretch","font-variant-numeric","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","-webkit-font-smoothing","placeholder-color","caret-color","accent-color","color-scheme","opacity","background-blend-mode","mix-blend-mode","box-shadow","--tw-shadow","--tw-shadow-color","--tw-ring-shadow","--tw-ring-color","--tw-inset-shadow","--tw-inset-shadow-color","--tw-inset-ring-shadow","--tw-inset-ring-color","--tw-ring-offset-width","--tw-ring-offset-color","outline","outline-width","outline-offset","outline-color","--tw-blur","--tw-brightness","--tw-contrast","--tw-drop-shadow","--tw-grayscale","--tw-hue-rotate","--tw-invert","--tw-saturate","--tw-sepia","filter","--tw-backdrop-blur","--tw-backdrop-brightness","--tw-backdrop-contrast","--tw-backdrop-grayscale","--tw-backdrop-hue-rotate","--tw-backdrop-invert","--tw-backdrop-opacity","--tw-backdrop-saturate","--tw-backdrop-sepia","backdrop-filter","transition-property","transition-behavior","transition-delay","transition-duration","transition-timing-function","will-change","contain","content","forced-color-adjust"];function De(e,t,{onInvalidCandidate:r}={}){let n=new Map,o=[],i=new Map;for(let n of e){if(t.invalidCandidates.has(n)){r?.(n);continue}let e=t.parseCandidate(n);0!==e.length?i.set(n,e):r?.(n)}let l=t.getVariantOrder();for(let[e,a]of i){let i=!1;for(let r of a){let a=t.compileAstNodes(r);if(0!==a.length){i=!0;for(let{node:t,propertySort:i}of a){let a=0n;for(let e of r.variants)a|=1n<{let r=n.get(e),o=n.get(t);if(r.variants-o.variants!==0n)return Number(r.variants-o.variants);let i=0;for(;i1)return null;for(let e of i.nodes)if("rule"!==e.kind&&"at-rule"!==e.kind||null===o(e,t))return null;return z(i.nodes,(t=>{if(("rule"===t.kind||"at-rule"===t.kind)&&t.nodes.length<=0)return t.nodes=e.nodes,1})),void(e.nodes=i.nodes)}return null===o(e,t)?null:void 0}function Be(e){let t=e.options?.types??[];return t.length>1&&t.includes("any")}function Le(e){for(let t of e)"at-root"!==t.kind&&("declaration"===t.kind?t.important=!0:("rule"===t.kind||"at-rule"===t.kind)&&Le(t.nodes))}function Me(e){let t=new Set,r=0,n=e.slice(),o=!1;for(;n.length>0;){let e=n.shift();if("declaration"===e.kind){if(void 0===e.value||(r++,o))continue;if("--tw-sort"===e.property){let r=We.indexOf(e.value??"");if(-1!==r){t.add(r),o=!0;continue}}let n=We.indexOf(e.property);-1!==n&&t.add(n)}else if("rule"===e.kind||"at-rule"===e.kind)for(let t of e.nodes)n.push(t)}return{order:Array.from(t).sort(((e,t)=>e-t)),count:r}}function Re(e,t){let r=0,n=k("&",e),o=new Set,i=new c((()=>new Set)),l=new c((()=>new Set));z([n],((e,{parent:n})=>{if("at-rule"===e.kind){if("@keyframes"===e.name)return z(e.nodes,(e=>{if("at-rule"===e.kind&&"@apply"===e.name)throw new Error("You cannot use `@apply` inside `@keyframes`.")})),1;if("@utility"===e.name){let r=e.params.replace(/-\*$/,"");return l.get(r).add(e),void z(e.nodes,(r=>{if("at-rule"===r.kind&&"@apply"===r.name){o.add(e);for(let n of Ie(r,t))i.get(e).add(n)}}))}if("@apply"===e.name){if(null===n)return;r|=1,o.add(n);for(let r of Ie(e,t))i.get(n).add(r)}}}));let a=new Set,s=[],u=new Set;function d(e,r=[]){if(!a.has(e)){if(u.has(e)){let n=r[(r.indexOf(e)+1)%r.length];throw"at-rule"===e.kind&&"@utility"===e.name&&"at-rule"===n.kind&&"@utility"===n.name&&z(e.nodes,(e=>{if("at-rule"!==e.kind||"@apply"!==e.name)return;let r=e.params.split(/\s+/g);for(let e of r)for(let r of t.parseCandidate(e))switch(r.kind){case"arbitrary":break;case"static":case"functional":if(n.params.replace(/-\*$/,"")===r.root)throw new Error(`You cannot \`@apply\` the \`${e}\` utility here because it creates a circular dependency.`)}})),new Error(`Circular dependency detected:\n\n${j([e])}\nRelies on:\n\n${j([n])}`)}u.add(e);for(let t of i.get(e))for(let n of l.get(t))r.push(e),d(n,r),r.pop();a.add(e),u.delete(e),s.push(e)}}for(let e of o)d(e);for(let e of s)if("nodes"in e)for(let r=0;r{throw new Error(`Cannot apply unknown utility class: ${e}`)}}).astNodes,i=[];for(let e of o)if("rule"===e.kind)for(let t of e.nodes)i.push(t);else i.push(e);e.nodes.splice(r,1,...i)}}return r}function*Ie(e,t){for(let r of e.params.split(/\s+/g))for(let e of t.parseCandidate(r))switch(e.kind){case"arbitrary":break;case"static":case"functional":yield e.root}}async function qe(e,r,n,o=0){let i=0,l=[];return z(e,((e,{replaceWith:a})=>{if("at-rule"===e.kind&&("@import"===e.name||"@reference"===e.name)){let s=function(e){let t,r=null,n=null,o=null;for(let i=0;i{if(o>100)throw new Error(`Exceeded maximum recursion depth while resolving \`${c}\` in \`${r}\`)`);let e=await n(c,r),i=t(e.content);await qe(i,e.base,n,o+1),h.nodes=function(e,t,r,n){let o=e;return null!==t&&(o=[w("@layer",t,o)]),null!==r&&(o=[w("@media",r,o)]),null!==n&&(o=[w("@supports","("===n[0]?n:`(${n})`,o)]),o}([$({base:e.base},i)],u,d,f)})()),a(h),1}})),l.length>0&&await Promise.all(l),i}function Pe(e,t=null){return Array.isArray(e)&&2===e.length&&"object"==typeof e[1]&&null!==typeof e[1]?t?e[1][t]??null:e[0]:Array.isArray(e)&&null===t?e.join(", "):"string"==typeof e&&null===t?e:null}function He(e,{theme:t},r){for(let t of r){let r=Ze([t]);r&&e.theme.clearNamespace(`--${r}`,4)}for(let[r,n]of function(e){let t=[];return Ge(e,[],((e,r)=>{if(function(e){return"number"==typeof e||"string"==typeof e}(e))return t.push([r,e]),1;if(function(e){if(!Array.isArray(e)||2!==e.length||"string"!=typeof e[0]&&"number"!=typeof e[0]||void 0===e[1]||null===e[1]||"object"!=typeof e[1])return!1;for(let t of Reflect.ownKeys(e[1]))if("string"!=typeof t||"string"!=typeof e[1][t]&&"number"!=typeof e[1][t])return!1;return!0}(e)){t.push([r,e[0]]);for(let n of Reflect.ownKeys(e[1]))t.push([[...r,`-${n}`],e[1][n]]);return 1}return Array.isArray(e)&&e.every((e=>"string"==typeof e))?(t.push([r,e.join(", ")]),1):void 0})),t}(t)){if("string"!=typeof n&&"number"!=typeof n)continue;if("string"==typeof n&&(n=n.replace(//g,"1")),"opacity"===r[0]&&("number"==typeof n||"string"==typeof n)){let e="string"==typeof n?parseFloat(n):n;e>=0&&e<=1&&(n=100*e+"%")}let t=Ze(r);t&&e.theme.add(`--${t}`,""+n,7)}if(Object.hasOwn(t,"fontFamily")){let r=5;{let n=Pe(t.fontFamily.sans);n&&e.theme.hasDefault("--font-sans")&&(e.theme.add("--default-font-family",n,r),e.theme.add("--default-font-feature-settings",Pe(t.fontFamily.sans,"fontFeatureSettings")??"normal",r),e.theme.add("--default-font-variation-settings",Pe(t.fontFamily.sans,"fontVariationSettings")??"normal",r))}{let n=Pe(t.fontFamily.mono);n&&e.theme.hasDefault("--font-mono")&&(e.theme.add("--default-mono-font-family",n,r),e.theme.add("--default-mono-font-feature-settings",Pe(t.fontFamily.mono,"fontFeatureSettings")??"normal",r),e.theme.add("--default-mono-font-variation-settings",Pe(t.fontFamily.mono,"fontVariationSettings")??"normal",r))}}return t}var Ye=/^[a-zA-Z0-9-_%/\.]+$/;function Ze(e){if("container"===e[0])return null;"animation"===(e=structuredClone(e))[0]&&(e[0]="animate"),"aspectRatio"===e[0]&&(e[0]="aspect"),"borderRadius"===e[0]&&(e[0]="radius"),"boxShadow"===e[0]&&(e[0]="shadow"),"colors"===e[0]&&(e[0]="color"),"containers"===e[0]&&(e[0]="container"),"fontFamily"===e[0]&&(e[0]="font"),"fontSize"===e[0]&&(e[0]="text"),"letterSpacing"===e[0]&&(e[0]="tracking"),"lineHeight"===e[0]&&(e[0]="leading"),"maxWidth"===e[0]&&(e[0]="container"),"screens"===e[0]&&(e[0]="breakpoint"),"transitionTimingFunction"===e[0]&&(e[0]="ease");for(let t of e)if(!Ye.test(t))return null;return e.map(((e,t,r)=>"1"===e&&t!==r.length-1?"":e)).map((e=>e.replaceAll(".","_").replace(/([a-z])([A-Z])/g,((e,t,r)=>`${t}-${r.toLowerCase()}`)))).filter(((t,r)=>"DEFAULT"!==t||r!==e.length-1)).join("-")}function Ge(e,t=[],r){for(let n of Reflect.ownKeys(e)){let o=e[n];if(null==o)continue;let i=[...t,n],l=r(o,i)??0;if(1!==l){if(2===l)return 2;if((Array.isArray(o)||"object"==typeof o)&&2===Ge(o,i,r))return 2}}}function Xe(e){let t=[];for(let r of B(e,".")){if(!r.includes("[")){t.push(r);continue}let e=0;for(;;){let n=r.indexOf("[",e),o=r.indexOf("]",n);if(-1===n||-1===o)break;n>e&&t.push(r.slice(e,n)),t.push(r.slice(n+1,o)),e=o+1}e<=r.length-1&&t.push(r.slice(e))}return t}function Je(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function Qe(e,t,r,n=[]){for(let o of t)if(null!=o)for(let t of Reflect.ownKeys(o)){n.push(t);let i=r(e[t],o[t],n);void 0!==i?e[t]=i:Je(e[t])&&Je(o[t])?e[t]=Qe({},[e[t],o[t]],r,n):e[t]=o[t],n.pop()}return e}function et(e,t,r){return function(n,o){let l=n.lastIndexOf("/"),a=null;-1!==l&&(a=n.slice(l+1).trim(),n=n.slice(0,l).trim());let s=(()=>{let o=Xe(n),[l,a]=function(e,t){if(1===t.length&&t[0].startsWith("--"))return[e.get([t[0]]),e.getOptions(t[0])];let r=Ze(t),n=new Map,o=new c((()=>new Map)),i=e.namespace(`--${r}`);if(0===i.size)return[null,0];let l=new Map;for(let[t,a]of i){if(!t||!t.includes("--")){n.set(t,a),l.set(t,e.getOptions(t?`--${r}-${t}`:`--${r}`));continue}let i=t.indexOf("--"),s=t.slice(0,i),c=t.slice(i+2);c=c.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),o.get(""===s?null:s).set(c,[a,e.getOptions(`--${r}${t}`)])}let a=e.getOptions(`--${r}`);for(let[e,t]of o){let r=n.get(e);if("string"!=typeof r)continue;let o={},i={};for(let[e,[r,n]]of t)o[e]=r,i[e]=n;n.set(e,[r,o]),l.set(e,[a,i])}let s={},u={};for(let[e,t]of n)rt(s,[e??"DEFAULT"],t);for(let[e,t]of l)rt(u,[e??"DEFAULT"],t);return"DEFAULT"===t[t.length-1]?[s?.DEFAULT??null,u.DEFAULT??0]:"DEFAULT"in s&&1===Object.keys(s).length?[s.DEFAULT,u.DEFAULT??0]:(s.__CSS_VALUES__=u,[s,u])}(e.theme,o),s=r(tt(t()??{},o)??null);if("string"==typeof s&&(s=s.replace("","1")),"object"!=typeof l)return"object"!=typeof a&&4&a?s??l:l;if(null!==s&&"object"==typeof s&&!Array.isArray(s)){let e=Qe({},[s],((e,t)=>t));if(null===l&&Object.hasOwn(s,"__CSS_VALUES__")){let t={};for(let r in s.__CSS_VALUES__)t[r]=s[r],delete e[r];l=t}for(let t in l)"__CSS_VALUES__"!==t&&(4&s?.__CSS_VALUES__?.[t]&&void 0!==tt(e,t.split("-"))||(e[i(t)]=l[t]));return e}if(Array.isArray(l)&&Array.isArray(a)&&Array.isArray(s)){let e=l[0],t=l[1];4&a[0]&&(e=s[0]??e);for(let e of Object.keys(t))4&a[1][e]&&(t[e]=s[1][e]??t[e]);return[e,t]}return l??s})();return a&&"string"==typeof s&&(s=we(s,a)),s??o}}function tt(e,t){for(let r=0;r0){let e=it(i);o?o.nodes.push(e):r.push(e),i=""}let n=l,a=l+1;for(;a0){let t=it(i);e.nodes.push(t),i=""}o=n.length>0?n[n.length-1]:null;break}case 46:case 58:case 35:if(i.length>0){let e=it(i);o?o.nodes.push(e):r.push(e)}i=String.fromCharCode(a);break;case 91:{if(i.length>0){let e=it(i);o?o.nodes.push(e):r.push(e)}i="";let n=l,a=0;for(let r=l+1;r0&&r.push(it(i)),r}var dt=/^[a-z@][a-zA-Z0-9/%._-]*$/;function ft({designSystem:e,ast:t,resolvedConfig:r,featuresRef:n,referenceMode:o}){let i={addBase(r){if(o)return;let i=ht(r);n.current|=Ce(i,e),t.push(w("@layer","base",i))},addVariant(t,r){if(!Ee.test(t))throw new Error(`\`addVariant('${t}')\` defines an invalid variant name. Variants should only contain alphanumeric, dashes or underscore characters.`);"string"==typeof r||Array.isArray(r)?e.variants.static(t,(e=>{e.nodes=pt(r,e.nodes)}),{compounds:Ne("string"==typeof r?[r]:r)}):"object"==typeof r&&e.variants.fromAst(t,ht(r))},matchVariant(t,r,n){function o(e,t,n){return pt(r(e,{modifier:t?.value??null}),n)}let i=Object.keys(n?.values??{});e.variants.group((()=>{e.variants.functional(t,((e,t)=>{if(!t.value)return n?.values&&"DEFAULT"in n.values?void(e.nodes=o(n.values.DEFAULT,t.modifier,e.nodes)):null;if("arbitrary"===t.value.kind)e.nodes=o(t.value.value,t.modifier,e.nodes);else if("named"===t.value.kind&&n?.values){let r=n.values[t.value.value];if("string"!=typeof r)return;e.nodes=o(r,t.modifier,e.nodes)}}))}),((e,t)=>{if("functional"!==e.kind||"functional"!==t.kind)return 0;let r=e.value?e.value.value:"DEFAULT",o=t.value?t.value.value:"DEFAULT",l=n?.values?.[r]??r,a=n?.values?.[o]??o;if(n&&"function"==typeof n.sort)return n.sort({value:l,modifier:e.modifier?.value??null},{value:a,modifier:t.modifier?.value??null});let s=i.indexOf(r),c=i.indexOf(o);return s=-1===s?i.length:s,c=-1===c?i.length:c,s!==c?s-c:lObject.entries(e)));i=i.flatMap((([e,t])=>B(e,",").map((e=>[e.trim(),t]))));let l=new c((()=>[]));for(let[e,r]of i){if(e.startsWith("@keyframes ")){o||t.push(k(e,ht(r)));continue}let n=ut(e),i=!1;if(st(n,(e=>{if("selector"===e.kind&&"."===e.value[0]&&dt.test(e.value.slice(1))){let t=e.value;e.value="&";let o=ct(n),a=t.slice(1),s="&"===o?ht(r):[k(o,ht(r))];return l.get(a).push(...s),i=!0,void(e.value=t)}if("function"===e.kind&&":not"===e.value)return 1})),!i)throw new Error(`\`addUtilities({ '${e}' : … })\` defines an invalid utility selector. Utilities must be a single class name and start with a lowercase letter, eg. \`.scrollbar-none\`.`)}for(let[t,r]of l)e.theme.prefix&&z(r,(t=>{if("rule"===t.kind){let r=ut(t.selector);st(r,(t=>{"selector"===t.kind&&"."===t.value[0]&&(t.value=`.${e.theme.prefix}\\:${t.value.slice(1)}`)})),t.selector=ct(r)}})),e.utilities.static(t,(o=>{let i=structuredClone(r);return mt(i,t,o.raw),n.current|=Re(i,e),i}))},matchUtilities(t,r){let o=r?.type?Array.isArray(r?.type)?r.type:[r.type]:["any"];for(let[i,l]of Object.entries(t)){let t=function({negative:t}){return a=>{if("arbitrary"===a.value?.kind&&o.length>0&&!o.includes("any")&&(a.value.dataType&&!o.includes(a.value.dataType)||!a.value.dataType&&!H(a.value.value,o)))return;let s,c=o.includes("color"),u=null,d=!1;{let e=r?.values??{};c&&(e=Object.assign({inherit:"inherit",transparent:"transparent",current:"currentColor"},e)),a.value?"arbitrary"===a.value.kind?u=a.value.value:a.value.fraction&&e[a.value.fraction]?(u=e[a.value.fraction],d=!0):e[a.value.value]?u=e[a.value.value]:e.__BARE_VALUE__&&(u=e.__BARE_VALUE__(a.value)??null,d=(null!==a.value.fraction&&u?.includes("/"))??!1):u=e.DEFAULT??null}if(null===u)return;{let e=r?.modifiers??null;s=a.modifier?"any"===e||"arbitrary"===a.modifier.kind?a.modifier.value:e?.[a.modifier.value]?e[a.modifier.value]:c&&!Number.isNaN(Number(a.modifier.value))?`${a.modifier.value}%`:null:null}if(a.modifier&&null===s&&!d)return"arbitrary"===a.value?.kind?null:void 0;c&&null!==s&&(u=we(u,s)),t&&(u=`calc(${u} * -1)`);let f=ht(l(u,{modifier:s}));return mt(f,i,a.raw),n.current|=Re(f,e),f}};if(!dt.test(i))throw new Error(`\`matchUtilities({ '${i}' : … })\` defines an invalid utility name. Utilities should be alphanumeric and start with a lowercase letter, eg. \`scrollbar\`.`);r?.supportsNegativeValues&&e.utilities.functional(`-${i}`,t({negative:!0}),{types:o}),e.utilities.functional(i,t({negative:!1}),{types:o}),e.utilities.suggest(i,(()=>{let e=r?.values??{},t=new Set(Object.keys(e));t.delete("__BARE_VALUE__"),t.has("DEFAULT")&&(t.delete("DEFAULT"),t.add(null));let n=r?.modifiers??{},o="any"===n?[]:Object.keys(n);return[{supportsNegative:r?.supportsNegativeValues??!1,values:Array.from(t),modifiers:o}]}))}},addComponents(e,t){this.addUtilities(e,t)},matchComponents(e,t){this.matchUtilities(e,t)},theme:et(e,(()=>r.theme??{}),(e=>e)),prefix:e=>e,config(e,t){let n=r;if(!e)return n;let o=Xe(e);for(let e=0;eObject.entries(e)));for(let[e,n]of r)if("object"!=typeof n){if(!e.startsWith("--")){if("@slot"===n){t.push(k(e,[w("@slot")]));continue}e=e.replace(/([A-Z])/g,"-$1").toLowerCase()}t.push(y(e,String(n)))}else if(Array.isArray(n))for(let r of n)"string"==typeof r?t.push(y(e,r)):t.push(k(e,ht(r)));else null!==n&&t.push(k(e,ht(n)));return t}function pt(e,r){return("string"==typeof e?[e]:e).flatMap((e=>{if(e.trim().endsWith("}")){let n=t(e.replace("}","{@slot}}"));return Fe(n,r),n}return k(e,r)}))}function mt(e,t,r){z(e,(e=>{if("rule"===e.kind){let n=ut(e.selector);st(n,(e=>{"selector"===e.kind&&e.value===`.${t}`&&(e.value=`.${o(r)}`)})),e.selector=ct(n)}}))}function gt(e,t,r){for(let r of function(e){let t=[];if("keyframes"in e.theme)for(let[r,n]of Object.entries(e.theme.keyframes))t.push(w("@keyframes",r,ht(n)));return t}(t))e.theme.addKeyframes(r)}var vt={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"}};function bt(e){return{__BARE_VALUE__:e}}var wt=bt((e=>{if(ae(e.value))return e.value})),kt=bt((e=>{if(ae(e.value))return`${e.value}%`})),yt=bt((e=>{if(ae(e.value))return`${e.value}px`})),xt=bt((e=>{if(ae(e.value))return`${e.value}ms`})),$t=bt((e=>{if(ae(e.value))return`${e.value}deg`})),At=bt((e=>{if(null===e.fraction)return;let[t,r]=B(e.fraction,"/");return ae(t)&&ae(r)?e.fraction:void 0})),zt=bt((e=>{if(ae(Number(e.value)))return`repeat(${e.value}, minmax(0, 1fr))`})),Ct={accentColor:({theme:e})=>e("colors"),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9",...At},backdropBlur:({theme:e})=>e("blur"),backdropBrightness:({theme:e})=>({...e("brightness"),...kt}),backdropContrast:({theme:e})=>({...e("contrast"),...kt}),backdropGrayscale:({theme:e})=>({...e("grayscale"),...kt}),backdropHueRotate:({theme:e})=>({...e("hueRotate"),...$t}),backdropInvert:({theme:e})=>({...e("invert"),...kt}),backdropOpacity:({theme:e})=>({...e("opacity"),...kt}),backdropSaturate:({theme:e})=>({...e("saturate"),...kt}),backdropSepia:({theme:e})=>({...e("sepia"),...kt}),backgroundColor:({theme:e})=>e("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:e})=>e("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:e})=>({DEFAULT:"currentColor",...e("colors")}),borderOpacity:({theme:e})=>e("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:e})=>e("spacing"),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px",...yt},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:e})=>e("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2",...kt},caretColor:({theme:e})=>e("colors"),colors:()=>({...vt}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",...wt},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2",...kt},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:e})=>e("borderColor"),divideOpacity:({theme:e})=>e("borderOpacity"),divideWidth:({theme:e})=>({...e("borderWidth"),...yt}),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:e})=>e("colors"),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",...e("spacing")}),flexGrow:{0:"0",DEFAULT:"1",...wt},flexShrink:{0:"0",DEFAULT:"1",...wt},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:e})=>e("spacing"),gradientColorStops:({theme:e})=>e("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%",...kt},grayscale:{0:"0",DEFAULT:"100%",...kt},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...wt},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...wt},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...wt},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...wt},gridTemplateColumns:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...zt},gridTemplateRows:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...zt},height:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg",...$t},inset:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),invert:{0:"0",DEFAULT:"100%",...kt},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:e})=>({auto:"auto",...e("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",...wt},maxHeight:({theme:e})=>({none:"none",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),maxWidth:({theme:e})=>({none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...e("spacing")}),minHeight:({theme:e})=>({full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),minWidth:({theme:e})=>({full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",15:"0.15",20:"0.2",25:"0.25",30:"0.3",35:"0.35",40:"0.4",45:"0.45",50:"0.5",55:"0.55",60:"0.6",65:"0.65",70:"0.7",75:"0.75",80:"0.8",85:"0.85",90:"0.9",95:"0.95",100:"1",...kt},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",...wt},outlineColor:({theme:e})=>e("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},padding:({theme:e})=>e("spacing"),placeholderColor:({theme:e})=>e("colors"),placeholderOpacity:({theme:e})=>e("opacity"),ringColor:({theme:e})=>({DEFAULT:"currentColor",...e("colors")}),ringOffsetColor:({theme:e})=>e("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},ringOpacity:({theme:e})=>({DEFAULT:"0.5",...e("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg",...$t},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2",...kt},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",...kt},screens:{sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem","2xl":"96rem"},scrollMargin:({theme:e})=>e("spacing"),scrollPadding:({theme:e})=>e("spacing"),sepia:{0:"0",DEFAULT:"100%",...kt},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",...$t},space:({theme:e})=>e("spacing"),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:e})=>({none:"none",...e("colors")}),strokeWidth:{0:"0",1:"1",2:"2",...wt},supports:{},data:{},textColor:({theme:e})=>e("colors"),textDecorationColor:({theme:e})=>e("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},textIndent:({theme:e})=>e("spacing"),textOpacity:({theme:e})=>e("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...yt},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...xt},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...xt},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:e})=>({"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),size:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),width:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",...wt}};function Tt(e){return{theme:{...Ct,colors:({theme:e})=>e("color",{}),extend:{fontSize:({theme:e})=>({...e("text",{})}),boxShadow:({theme:e})=>({...e("shadow",{})}),animation:({theme:e})=>({...e("animate",{})}),aspectRatio:({theme:e})=>({...e("aspect",{})}),borderRadius:({theme:e})=>({...e("radius",{})}),screens:({theme:e})=>({...e("breakpoint",{})}),letterSpacing:({theme:e})=>({...e("tracking",{})}),lineHeight:({theme:e})=>({...e("leading",{})}),transitionDuration:{DEFAULT:e.get(["--default-transition-duration"])??null},transitionTimingFunction:{DEFAULT:e.get(["--default-transition-timing-function"])??null},maxWidth:({theme:e})=>({...e("container",{})})}}}}var jt={blocklist:[],future:{},prefix:"",important:!1,darkMode:null,theme:{},plugins:[],content:{files:[]}};function Kt(e,t){let r={design:e,configs:[],plugins:[],content:{files:[]},theme:{},extend:{},result:structuredClone(jt)};for(let e of t)Et(r,e);for(let e of r.configs)"darkMode"in e&&void 0!==e.darkMode&&(r.result.darkMode=e.darkMode??null),"prefix"in e&&void 0!==e.prefix&&(r.result.prefix=e.prefix??""),"blocklist"in e&&void 0!==e.blocklist&&(r.result.blocklist=e.blocklist??[]),"important"in e&&void 0!==e.important&&(r.result.important=e.important??!1);let n=function(e){let t=new Set,r=et(e.design,(()=>e.theme),o),n=Object.assign(r,{theme:r,colors:vt});function o(e){return"function"==typeof e?e(n)??null:e??null}for(let r of e.configs){let n=r.theme??{},o=n.extend??{};for(let e in n)"extend"!==e&&t.add(e);Object.assign(e.theme,n);for(let t in o)e.extend[t]??=[],e.extend[t].push(o[t])}delete e.theme.extend;for(let t in e.extend){let r=[e.theme[t],...e.extend[t]];e.theme[t]=()=>Qe({},r.map(o),St)}for(let t in e.theme)e.theme[t]=o(e.theme[t]);if(e.theme.screens&&"object"==typeof e.theme.screens)for(let t of Object.keys(e.theme.screens)){let r=e.theme.screens[t];r&&"object"==typeof r&&("raw"in r||"max"in r||"min"in r&&(e.theme.screens[t]=r.min))}return t}(r);return{resolvedConfig:{...r.result,content:r.content,theme:r.theme,plugins:r.plugins},replacedThemeKeys:n}}function St(e,t){return Array.isArray(e)&&Je(e[0])?e.concat(t):Array.isArray(t)&&Je(t[0])&&Je(e)?[e,...t]:Array.isArray(t)?t:void 0}function Et(e,{config:t,base:r,path:n,reference:o}){let i=[];for(let e of t.plugins??[])"__isOptionsFunction"in e?i.push({...e(),reference:o}):"handler"in e?i.push({...e,reference:o}):i.push({handler:e,reference:o});if(Array.isArray(t.presets)&&0===t.presets.length)throw new Error("Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.");for(let i of t.presets??[])Et(e,{path:n,base:r,config:i,reference:o});for(let t of i)e.plugins.push(t),t.config&&Et(e,{path:n,base:r,config:t.config,reference:!!t.reference});let l=t.content??[],a=Array.isArray(l)?l:l.files;for(let t of a)e.content.files.push("object"==typeof t?t:{base:r,pattern:t});e.configs.push(t)}function Vt(e,t){let r=e.theme.container||{};if("object"!=typeof r||null===r)return;let n=function({center:e,padding:t,screens:r},n){let o=[],i=null;if(e&&o.push(y("margin-inline","auto")),("string"==typeof t||"object"==typeof t&&null!==t&&"DEFAULT"in t)&&o.push(y("padding-inline","string"==typeof t?t:t.DEFAULT)),"object"==typeof r&&null!==r){i=new Map;let e=Array.from(n.theme.namespace("--breakpoint").entries());if(e.sort(((e,t)=>R(e[1],t[1],"asc"))),e.length>0){let[t]=e[0];o.push(w("@media",`(width >= --theme(--breakpoint-${t}))`,[y("max-width","none")]))}for(let[e,t]of Object.entries(r)){if("object"==typeof t){if(!("min"in t))continue;t=t.min}i.set(e,w("@media",`(width >= ${t})`,[y("max-width",t)]))}}if("object"==typeof t&&null!==t){let e=Object.entries(t).filter((([e])=>"DEFAULT"!==e)).map((([e,t])=>[e,n.theme.resolveValue(e,["--breakpoint"]),t])).filter(Boolean);e.sort(((e,t)=>R(e[1],t[1],"asc")));for(let[t,,r]of e)if(i&&i.has(t))i.get(t).nodes.push(y("padding-inline",r));else{if(i)continue;o.push(w("@media",`(width >= theme(--breakpoint-${t}))`,[y("padding-inline",r)]))}}if(i)for(let[,e]of i)o.push(e);return o}(r,t);0!==n.length&&t.utilities.static("container",(()=>structuredClone(n)))}function Nt({addVariant:e,config:t}){let r=t("darkMode",null),[n,o=".dark"]=Array.isArray(r)?r:[r];if("variant"===n){let e;if(Array.isArray(o)||"function"==typeof o?e=o:"string"==typeof o&&(e=[o]),Array.isArray(e))for(let t of e)".dark"===t?(n=!1,console.warn('When using `variant` for `darkMode`, you must provide a selector.\nExample: `darkMode: ["variant", ".your-selector &"]`')):t.includes("&")||(n=!1,console.warn('When using `variant` for `darkMode`, your selector must contain `&`.\nExample `darkMode: ["variant", ".your-selector &"]`'));o=e}null===n||("selector"===n?e("dark",`&:where(${o}, ${o} *)`):"media"===n?e("dark","@media (prefers-color-scheme: dark)"):"variant"===n?e("dark",o):"class"===n&&e("dark",`&:is(${o} *)`))}function Ot(e){return(Array.isArray(e)?e:[e]).map((e=>"string"==typeof e?{min:e}:e&&"object"==typeof e?e:null)).map((e=>{if(null===e)return null;if("raw"in e)return e.raw;let t="";return void 0!==e.max&&(t+=`${e.max} >= `),t+="width",void 0!==e.min&&(t+=` >= ${e.min}`),`(${t})`})).filter(Boolean).join(", ")}var Ft=/^[a-z]+$/;async function Ut({designSystem:e,base:t,ast:r,loadModule:n,globs:o}){let i=0,l=[],a=[];z(r,((e,{parent:t,replaceWith:r,context:n})=>{if("at-rule"===e.kind){if("@plugin"===e.name){if(null!==t)throw new Error("`@plugin` cannot be nested.");let o=e.params.slice(1,-1);if(0===o.length)throw new Error("`@plugin` must have a path.");let a={};for(let t of e.nodes??[]){if("declaration"!==t.kind)throw new Error(`Unexpected \`@plugin\` option:\n\n${j([t])}\n\n\`@plugin\` options must be a flat list of declarations.`);if(void 0===t.value)continue;let e=B(t.value,",").map((e=>{if("null"===(e=e.trim()))return null;if("true"===e)return!0;if("false"===e)return!1;if(!Number.isNaN(Number(e)))return Number(e);if('"'===e[0]&&'"'===e[e.length-1]||"'"===e[0]&&"'"===e[e.length-1])return e.slice(1,-1);if("{"===e[0]&&"}"===e[e.length-1])throw new Error(`Unexpected \`@plugin\` option: Value of declaration \`${j([t]).trim()}\` is not supported.\n\nUsing an object as a plugin option is currently only supported in JavaScript configuration files.`);return e}));a[t.property]=1===e.length?e[0]:e}return l.push([{id:o,base:n.base,reference:!!n.reference},Object.keys(a).length>0?a:null]),r([]),void(i|=4)}if("@config"===e.name){if(e.nodes.length>0)throw new Error("`@config` cannot have a body.");if(null!==t)throw new Error("`@config` cannot be nested.");return a.push({id:e.params.slice(1,-1),base:n.base,reference:!!n.reference}),r([]),void(i|=4)}}})),function(e){for(let[t,r]of[["t","top"],["tr","top right"],["r","right"],["br","bottom right"],["b","bottom"],["bl","bottom left"],["l","left"],["tl","top left"]])e.utilities.static(`bg-gradient-to-${t}`,(()=>[y("--tw-gradient-position",`to ${r} in oklab`),y("background-image","linear-gradient(var(--tw-gradient-stops))")]));e.utilities.functional("max-w-screen",(t=>{if(!t.value||"arbitrary"===t.value.kind)return;let r=e.theme.resolve(t.value.value,["--breakpoint"]);return r?[y("max-width",r)]:void 0})),e.utilities.static("overflow-ellipsis",(()=>[y("text-overflow","ellipsis")])),e.utilities.static("decoration-slice",(()=>[y("-webkit-box-decoration-break","slice"),y("box-decoration-break","slice")])),e.utilities.static("decoration-clone",(()=>[y("-webkit-box-decoration-break","clone"),y("box-decoration-break","clone")])),e.utilities.functional("flex-shrink",(e=>{if(!e.modifier){if(!e.value)return[y("flex-shrink","1")];if("arbitrary"===e.value.kind)return[y("flex-shrink",e.value.value)];if(ae(e.value.value))return[y("flex-shrink",e.value.value)]}})),e.utilities.functional("flex-grow",(e=>{if(!e.modifier){if(!e.value)return[y("flex-grow","1")];if("arbitrary"===e.value.kind)return[y("flex-grow",e.value.value)];if(ae(e.value.value))return[y("flex-grow",e.value.value)]}}))}(e);let s=e.resolveThemeValue;if(e.resolveThemeValue=function(n){return n.startsWith("--")?s(n):(i|=Wt({designSystem:e,base:t,ast:r,globs:o,configs:[],pluginDetails:[]}),e.resolveThemeValue(n))},!l.length&&!a.length)return 0;let[c,u]=await Promise.all([Promise.all(a.map((async({id:e,base:t,reference:r})=>{let o=await n(e,t,"config");return{path:e,base:o.base,config:o.module,reference:r}}))),Promise.all(l.map((async([{id:e,base:t,reference:r},o])=>{let i=await n(e,t,"plugin");return{path:e,base:i.base,plugin:i.module,options:o,reference:r}})))]);return i|=Wt({designSystem:e,base:t,ast:r,globs:o,configs:c,pluginDetails:u}),i}function Wt({designSystem:e,base:t,ast:r,globs:n,configs:o,pluginDetails:i}){let l=0,a=[...i.map((e=>{if(!e.options)return{config:{plugins:[e.plugin]},base:e.base,reference:e.reference};if("__isOptionsFunction"in e.plugin)return{config:{plugins:[e.plugin(e.options)]},base:e.base,reference:e.reference};throw new Error(`The plugin "${e.path}" does not accept options`)})),...o],{resolvedConfig:s}=Kt(e,[{config:Tt(e.theme),base:t,reference:!0},...a,{config:{plugins:[Nt]},base:t,reference:!0}]),{resolvedConfig:c,replacedThemeKeys:u}=Kt(e,a);e.resolveThemeValue=function(e,t){let r=h.theme(e,t);return Array.isArray(r)&&2===r.length?r[0]:Array.isArray(r)?r.join(", "):"string"==typeof r?r:void 0};let d,f={designSystem:e,ast:r,resolvedConfig:s,featuresRef:{set current(e){l|=e}}},h=ft({...f,referenceMode:!1});for(let{handler:e,reference:t}of s.plugins)t?(d||=ft({...f,referenceMode:!0}),e(d)):e(h);if(He(e,c,u),gt(e,c),function(e,t){let r=e.theme.aria||{},n=e.theme.supports||{},o=e.theme.data||{};if(Object.keys(r).length>0){let e=t.variants.get("aria"),n=e?.applyFn,o=e?.compounds;t.variants.functional("aria",((e,t)=>{let o=t.value;return o&&"named"===o.kind&&o.value in r?n?.(e,{...t,value:{kind:"arbitrary",value:r[o.value]}}):n?.(e,t)}),{compounds:o})}if(Object.keys(n).length>0){let e=t.variants.get("supports"),r=e?.applyFn,o=e?.compounds;t.variants.functional("supports",((e,t)=>{let o=t.value;return o&&"named"===o.kind&&o.value in n?r?.(e,{...t,value:{kind:"arbitrary",value:n[o.value]}}):r?.(e,t)}),{compounds:o})}if(Object.keys(o).length>0){let e=t.variants.get("data"),r=e?.applyFn,n=e?.compounds;t.variants.functional("data",((e,t)=>{let n=t.value;return n&&"named"===n.kind&&n.value in o?r?.(e,{...t,value:{kind:"arbitrary",value:o[n.value]}}):r?.(e,t)}),{compounds:n})}}(c,e),function(e,t){let r=e.theme.screens||{},n=t.variants.get("min")?.order??0,o=[];for(let[e,i]of Object.entries(r)){let r=function(r){t.variants.static(e,(e=>{e.nodes=[w("@media",c,e.nodes)]}),{order:r})},l=t.variants.get(e),a=t.theme.resolveValue(e,["--breakpoint"]);if(l&&a&&!t.theme.hasDefault(`--breakpoint-${e}`))continue;let s=!0;"string"==typeof i&&(s=!1);let c=Ot(i);s?o.push(r):r(n)}if(0!==o.length){for(let[,e]of t.variants.variants)e.order>n&&(e.order+=o.length);t.variants.compareFns=new Map(Array.from(t.variants.compareFns).map((([e,t])=>(e>n&&(e+=o.length),[e,t]))));for(let[e,t]of o.entries())t(n+e+1)}}(c,e),Vt(c,e),!e.theme.prefix&&s.prefix){if(s.prefix.endsWith("-")&&(s.prefix=s.prefix.slice(0,-1),console.warn(`The prefix "${s.prefix}" is invalid. Prefixes must be lowercase ASCII letters (a-z) only and is written as a variant before all utilities. We have fixed up the prefix for you. Remove the trailing \`-\` to silence this warning.`)),!Ft.test(s.prefix))throw new Error(`The prefix "${s.prefix}" is invalid. Prefixes must be lowercase ASCII letters (a-z) only.`);e.theme.prefix=s.prefix}if(!e.important&&!0===s.important&&(e.important=!0),"string"==typeof s.important){let e=s.important;z(r,((t,{replaceWith:r,parent:n})=>{if("at-rule"===t.kind&&"@tailwind"===t.name&&"utilities"===t.params)return"rule"===n?.kind&&n.selector===e||r(b(e,[t])),2}))}for(let t of s.blocklist)e.invalidCandidates.add(t);for(let e of s.content.files){if("raw"in e)throw new Error(`Error in the config file/plugin/preset. The \`content\` key contains a \`raw\` entry:\n\n${JSON.stringify(e,null,2)}\n\nThis feature is not currently supported.`);n.push(e)}return l}var Dt=/^[a-z]+$/;function _t(){throw new Error("No `loadModule` function provided to `compile`")}function Bt(){throw new Error("No `loadStylesheet` function provided to `compile`")}async function Lt(e,{base:t="",loadModule:r=_t,loadStylesheet:n=Bt}={}){let l=0;e=[$({base:t},e)],l|=await qe(e,t,n);let a=null,c=new s,u=[],d=[],f=null,g=null,v=[],x=[],C=[],T=[],K=null;z(e,((e,{parent:t,replaceWith:r,context:n})=>{if("at-rule"===e.kind){if("@tailwind"===e.name&&("utilities"===e.params||e.params.startsWith("utilities"))){if(null!==g)return void r([]);let t=B(e.params," ");for(let e of t)if(e.startsWith("source(")){let t=e.slice(7,-1);if("none"===t){K=t;continue}if('"'===t[0]&&'"'!==t[t.length-1]||"'"===t[0]&&"'"!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0])throw new Error("`source(…)` paths must be quoted.");K={base:n.sourceBase??n.base,pattern:t.slice(1,-1)}}g=e,l|=16}if("@utility"===e.name){if(null!==t)throw new Error("`@utility` cannot be nested.");if(0===e.nodes.length)throw new Error(`\`@utility ${e.params}\` is empty. Utilities should include at least one property.`);let r=function(e){let t=e.params;return ge.test(t)?r=>{let n=new Set,o=new Set;z(e.nodes,(e=>{if("declaration"!==e.kind||!e.value||!e.value.includes("--value(")&&!e.value.includes("--modifier("))return;let t=m(e.value);h(t,(e=>{if("function"!==e.kind||"--value"!==e.value&&"--modifier"!==e.value)return;let t=B(p(e.nodes),",");for(let[e,r]of t.entries())r=r.replace(/\\\*/g,"*"),r=r.replace(/--(.*?)\s--(.*?)/g,"--$1-*--$2"),r=r.replace(/\s+/g,""),r=r.replace(/(-\*){2,}/g,"-*"),"-"===r[0]&&"-"===r[1]&&!r.includes("-*")&&(r+="-*"),t[e]=r;e.nodes=m(t.join(","));for(let t of e.nodes)if("word"===t.kind&&"-"===t.value[0]&&"-"===t.value[1]){let r=t.value.replace(/-\*.*$/g,"");"--value"===e.value?n.add(r):"--modifier"===e.value&&o.add(r)}})),e.value=p(t)})),r.utilities.functional(t.slice(0,-2),(t=>{let n=structuredClone(e),o=t.value,i=t.modifier;if(null===o)return;let l=!1,a=!1,s=!1,c=!1,u=new Map,d=!1;if(z([n],((e,{parent:t,replaceWith:n})=>{if("rule"!==t?.kind&&"at-rule"!==t?.kind||"declaration"!==e.kind||!e.value)return;let f=m(e.value);0===(h(f,((f,{replaceWith:h})=>{if("function"===f.kind){if("--value"===f.value){l=!0;let i=xe(o,f,r);return i?(a=!0,i.ratio?d=!0:u.set(e,t),h(i.nodes),1):(l||=!1,n([]),2)}if("--modifier"===f.value){if(null===i)return n([]),1;s=!0;let e=xe(i,f,r);return e?(c=!0,h(e.nodes),1):(s||=!1,n([]),2)}}}))??0)&&(e.value=p(f))})),l&&!a||s&&!c||d&&c||i&&!d&&!c)return null;if(d)for(let[e,t]of u){let r=t.nodes.indexOf(e);-1!==r&&t.nodes.splice(r,1)}return n.nodes})),r.utilities.suggest(t.slice(0,-2),(()=>[{values:r.theme.keysInNamespaces(n).map((e=>e.replaceAll("_","."))),modifiers:r.theme.keysInNamespaces(o).map((e=>e.replaceAll("_",".")))}]))}:me.test(t)?r=>{r.utilities.static(t,(()=>structuredClone(e.nodes)))}:null}(e);if(null===r)throw new Error(`\`@utility ${e.params}\` defines an invalid utility name. Utilities should be alphanumeric and start with a lowercase letter.`);d.push(r)}if("@source"===e.name){if(e.nodes.length>0)throw new Error("`@source` cannot have a body.");if(null!==t)throw new Error("`@source` cannot be nested.");let o=e.params;if('"'===o[0]&&'"'!==o[o.length-1]||"'"===o[0]&&"'"!==o[o.length-1]||"'"!==o[0]&&'"'!==o[0])throw new Error("`@source` paths must be quoted.");let i=o.slice(1,-1);return x.push({base:n.base,pattern:i}),void r([])}if("@variant"===e.name&&(null===t?0===e.nodes.length?e.name="@custom-variant":(z(e.nodes,(t=>{if("at-rule"===t.kind&&"@slot"===t.name)return e.name="@custom-variant",2})),"@variant"===e.name&&v.push(e)):v.push(e)),"@custom-variant"===e.name){if(null!==t)throw new Error("`@custom-variant` cannot be nested.");r([]);let[n,o]=B(e.params," ");if(!Ee.test(n))throw new Error(`\`@custom-variant ${n}\` defines an invalid variant name. Variants should only contain alphanumeric, dashes or underscore characters.`);if(e.nodes.length>0&&o)throw new Error(`\`@custom-variant ${n}\` cannot have both a selector and a body.`);if(0===e.nodes.length){if(!o)throw new Error(`\`@custom-variant ${n}\` has no selector or body.`);let e=B(o.slice(1,-1),",");if(0===e.length||e.some((e=>""===e.trim())))throw new Error(`\`@custom-variant ${n} (${e.join(",")})\` selector is invalid.`);let t=[],r=[];for(let n of e)n=n.trim(),"@"===n[0]?t.push(n):r.push(n);return void u.push((e=>{e.variants.static(n,(e=>{let n=[];r.length>0&&n.push(b(r.join(", "),e.nodes));for(let r of t)n.push(k(r,e.nodes));e.nodes=n}),{compounds:Ne([...r,...t])})}))}return void u.push((t=>{t.variants.fromAst(n,e.nodes)}))}if("@media"===e.name){let t=B(e.params," "),o=[];for(let r of t)if(r.startsWith("source(")){let t=r.slice(7,-1);z(e.nodes,((e,{replaceWith:r})=>{if("at-rule"===e.kind&&"@tailwind"===e.name&&"utilities"===e.params)return e.params+=` source(${t})`,r([$({sourceBase:n.base},[e])]),2}))}else if(r.startsWith("theme(")){let t=r.slice(6,-1),n=t.includes("reference");z(e.nodes,(e=>{if("at-rule"!==e.kind){if(n)throw new Error('Files imported with `@import "…" theme(reference)` must only contain `@theme` blocks.\nUse `@reference "…";` instead.');return 0}if("@theme"===e.name)return e.params+=" "+t,1}))}else if(r.startsWith("prefix(")){let t=r.slice(7,-1);z(e.nodes,(e=>{if("at-rule"===e.kind&&"@theme"===e.name)return e.params+=` prefix(${t})`,1}))}else"important"===r?a=!0:"reference"===r?e.nodes=[$({reference:!0},e.nodes)]:o.push(r);o.length>0?e.params=o.join(" "):t.length>0&&r(e.nodes)}if("@theme"===e.name){let[t,o]=function(e){let t=0,r=null;for(let n of B(e," "))"reference"===n?t|=2:"inline"===n?t|=1:"default"===n?t|=4:"static"===n?t|=8:n.startsWith("prefix(")&&n.endsWith(")")&&(r=n.slice(7,-1));return[t,r]}(e.params);if(n.reference&&(t|=2),o){if(!Dt.test(o))throw new Error(`The prefix "${o}" is invalid. Prefixes must be lowercase ASCII letters (a-z) only.`);c.prefix=o}return z(e.nodes,(r=>{if("at-rule"===r.kind&&"@keyframes"===r.name)return c.addKeyframes(r),1;if("comment"===r.kind)return;if("declaration"===r.kind&&r.property.startsWith("--"))return void c.add(i(r.property),r.value??"",t);let n=j([w(e.name,e.params,[r])]).split("\n").map(((e,t,r)=>`${0===t||t>=r.length-2?" ":">"} ${e}`)).join("\n");throw new Error(`\`@theme\` blocks must only contain custom properties or \`@keyframes\`.\n\n${n}`)})),f?r([]):(f=b(":root, :host",[]),r([f])),1}}}));let S=Ue(c);if(a&&(S.important=a),T.length>0)for(let e of T)S.invalidCandidates.add(e);l|=await Ut({designSystem:S,base:t,ast:e,loadModule:r,globs:x});for(let e of u)e(S);for(let e of d)e(S);if(f){let t=[];for(let[e,r]of S.theme.entries())2&r.options||t.push(y(o(e),r.value));let r=S.theme.getKeyframes();for(let t of r)e.push($({theme:!0},[A([t])]));f.nodes=[$({theme:!0},t)]}if(g){let e=g;e.kind="context",e.context={}}if(v.length>0){for(let e of v){let t=b("&",e.nodes),r=e.params,n=S.parseVariant(r);if(null===n)throw new Error(`Cannot use \`@variant\` with unknown variant: ${r}`);if(null===_e(t,n,S.variants))throw new Error(`Cannot use \`@variant\` with variant: ${r}`);Object.assign(e,t)}l|=32}return l|=Ce(e,S),l|=Re(e,S),z(e,((e,{replaceWith:t})=>{if("at-rule"===e.kind)return"@utility"===e.name&&t([]),1})),{designSystem:S,ast:e,globs:x,root:K,utilitiesNode:g,features:l,inlineCandidates:C}}async function Mt(e,r={}){let n=t(e),o=await async function(e,t={}){let{designSystem:r,ast:n,globs:o,root:i,utilitiesNode:l,features:a,inlineCandidates:s}=await Lt(e,t);function c(e){r.invalidCandidates.add(e)}n.unshift(x("! tailwindcss v4.0.14 | MIT License | https://tailwindcss.com "));let u=new Set,d=null,f=0,h=!1;for(let e of s)r.invalidCandidates.has(e)||(u.add(e),h=!0);return{globs:o,root:i,features:a,build(t){if(0===a)return e;if(!l)return d??=T(n,r),d;let o=h;h=!1;let i=u.size;for(let e of t)r.invalidCandidates.has(e)||("-"===e[0]&&"-"===e[1]?r.theme.markUsedVariable(e):u.add(e),o||=u.size!==i);if(!o)return d??=T(n,r),d;let s=De(u,r,{onInvalidCandidate:c}).astNodes;return f===s.length?(d??=T(n,r),d):(f=s.length,l.nodes=s,d=T(n,r),d)}}}(n,r),i=n,l=e;return{...o,build(e){let t=o.build(e);return t===i||(l=j(t),i=t),l}}}var Rt={index:"@layer theme, base, components, utilities;\n\n@import './theme.css' layer(theme);\n@import './preflight.css' layer(base);\n@import './utilities.css' layer(utilities);\n",preflight:"/*\n 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n 2. Remove default margins and padding\n 3. Reset all borders.\n*/\n\n*,\n::after,\n::before,\n::backdrop,\n::file-selector-button {\n box-sizing: border-box; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 2 */\n border: 0 solid; /* 3 */\n}\n\n/*\n 1. Use a consistent sensible line-height in all browsers.\n 2. Prevent adjustments of font size after orientation changes in iOS.\n 3. Use a more readable tab size.\n 4. Use the user's configured `sans` font-family by default.\n 5. Use the user's configured `sans` font-feature-settings by default.\n 6. Use the user's configured `sans` font-variation-settings by default.\n 7. Disable tap highlights on iOS.\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n tab-size: 4; /* 3 */\n font-family: var(\n --default-font-family,\n ui-sans-serif,\n system-ui,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol',\n 'Noto Color Emoji'\n ); /* 4 */\n font-feature-settings: var(--default-font-feature-settings, normal); /* 5 */\n font-variation-settings: var(--default-font-variation-settings, normal); /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n line-height: inherit;\n}\n\n/*\n 1. Add the correct height in Firefox.\n 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n 3. Reset the default border style to a 1px solid border.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\n Add the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\n Remove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\n Reset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n}\n\n/*\n Add the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n 1. Use the user's configured `mono` font-family by default.\n 2. Use the user's configured `mono` font-feature-settings by default.\n 3. Use the user's configured `mono` font-variation-settings by default.\n 4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: var(\n --default-mono-font-family,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n 'Liberation Mono',\n 'Courier New',\n monospace\n ); /* 1 */\n font-feature-settings: var(--default-mono-font-feature-settings, normal); /* 2 */\n font-variation-settings: var(--default-mono-font-variation-settings, normal); /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\n Add the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\n Prevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n 3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n Use the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\n Add the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\n Add the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\n Make lists unstyled by default.\n*/\n\nol,\nul,\nmenu {\n list-style: none;\n}\n\n/*\n 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\n Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\n 1. Inherit font styles in all browsers.\n 2. Remove border radius in all browsers.\n 3. Remove background color in all browsers.\n 4. Ensure consistent opacity for disabled states in all browsers.\n*/\n\nbutton,\ninput,\nselect,\noptgroup,\ntextarea,\n::file-selector-button {\n font: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n border-radius: 0; /* 2 */\n background-color: transparent; /* 3 */\n opacity: 1; /* 4 */\n}\n\n/*\n Restore default font weight.\n*/\n\n:where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n}\n\n/*\n Restore indentation.\n*/\n\n:where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n}\n\n/*\n Restore space after button.\n*/\n\n::file-selector-button {\n margin-inline-end: 4px;\n}\n\n/*\n 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n 2. Set the default placeholder color to a semi-transparent version of the current text color.\n*/\n\n::placeholder {\n opacity: 1; /* 1 */\n color: color-mix(in oklab, currentColor 50%, transparent); /* 2 */\n}\n\n/*\n Prevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n Remove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n 1. Ensure date/time inputs have the same height when empty in iOS Safari.\n 2. Ensure text alignment can be changed on date/time inputs in iOS Safari.\n*/\n\n::-webkit-date-and-time-value {\n min-height: 1lh; /* 1 */\n text-align: inherit; /* 2 */\n}\n\n/*\n Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.\n*/\n\n::-webkit-datetime-edit {\n display: inline-flex;\n}\n\n/*\n Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.\n*/\n\n::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n}\n\n::-webkit-datetime-edit,\n::-webkit-datetime-edit-year-field,\n::-webkit-datetime-edit-month-field,\n::-webkit-datetime-edit-day-field,\n::-webkit-datetime-edit-hour-field,\n::-webkit-datetime-edit-minute-field,\n::-webkit-datetime-edit-second-field,\n::-webkit-datetime-edit-millisecond-field,\n::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n}\n\n/*\n Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\n Correct the inability to style the border radius in iOS Safari.\n*/\n\nbutton,\ninput:where([type='button'], [type='reset'], [type='submit']),\n::file-selector-button {\n appearance: button;\n}\n\n/*\n Correct the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n Make elements with the HTML hidden attribute stay hidden by default.\n*/\n\n[hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n}\n",theme:"@theme default {\n --font-sans:\n ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n 'Noto Color Emoji';\n --font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;\n --font-mono:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n\n --color-red-50: oklch(0.971 0.013 17.38);\n --color-red-100: oklch(0.936 0.032 17.717);\n --color-red-200: oklch(0.885 0.062 18.334);\n --color-red-300: oklch(0.808 0.114 19.571);\n --color-red-400: oklch(0.704 0.191 22.216);\n --color-red-500: oklch(0.637 0.237 25.331);\n --color-red-600: oklch(0.577 0.245 27.325);\n --color-red-700: oklch(0.505 0.213 27.518);\n --color-red-800: oklch(0.444 0.177 26.899);\n --color-red-900: oklch(0.396 0.141 25.723);\n --color-red-950: oklch(0.258 0.092 26.042);\n\n --color-orange-50: oklch(0.98 0.016 73.684);\n --color-orange-100: oklch(0.954 0.038 75.164);\n --color-orange-200: oklch(0.901 0.076 70.697);\n --color-orange-300: oklch(0.837 0.128 66.29);\n --color-orange-400: oklch(0.75 0.183 55.934);\n --color-orange-500: oklch(0.705 0.213 47.604);\n --color-orange-600: oklch(0.646 0.222 41.116);\n --color-orange-700: oklch(0.553 0.195 38.402);\n --color-orange-800: oklch(0.47 0.157 37.304);\n --color-orange-900: oklch(0.408 0.123 38.172);\n --color-orange-950: oklch(0.266 0.079 36.259);\n\n --color-amber-50: oklch(0.987 0.022 95.277);\n --color-amber-100: oklch(0.962 0.059 95.617);\n --color-amber-200: oklch(0.924 0.12 95.746);\n --color-amber-300: oklch(0.879 0.169 91.605);\n --color-amber-400: oklch(0.828 0.189 84.429);\n --color-amber-500: oklch(0.769 0.188 70.08);\n --color-amber-600: oklch(0.666 0.179 58.318);\n --color-amber-700: oklch(0.555 0.163 48.998);\n --color-amber-800: oklch(0.473 0.137 46.201);\n --color-amber-900: oklch(0.414 0.112 45.904);\n --color-amber-950: oklch(0.279 0.077 45.635);\n\n --color-yellow-50: oklch(0.987 0.026 102.212);\n --color-yellow-100: oklch(0.973 0.071 103.193);\n --color-yellow-200: oklch(0.945 0.129 101.54);\n --color-yellow-300: oklch(0.905 0.182 98.111);\n --color-yellow-400: oklch(0.852 0.199 91.936);\n --color-yellow-500: oklch(0.795 0.184 86.047);\n --color-yellow-600: oklch(0.681 0.162 75.834);\n --color-yellow-700: oklch(0.554 0.135 66.442);\n --color-yellow-800: oklch(0.476 0.114 61.907);\n --color-yellow-900: oklch(0.421 0.095 57.708);\n --color-yellow-950: oklch(0.286 0.066 53.813);\n\n --color-lime-50: oklch(0.986 0.031 120.757);\n --color-lime-100: oklch(0.967 0.067 122.328);\n --color-lime-200: oklch(0.938 0.127 124.321);\n --color-lime-300: oklch(0.897 0.196 126.665);\n --color-lime-400: oklch(0.841 0.238 128.85);\n --color-lime-500: oklch(0.768 0.233 130.85);\n --color-lime-600: oklch(0.648 0.2 131.684);\n --color-lime-700: oklch(0.532 0.157 131.589);\n --color-lime-800: oklch(0.453 0.124 130.933);\n --color-lime-900: oklch(0.405 0.101 131.063);\n --color-lime-950: oklch(0.274 0.072 132.109);\n\n --color-green-50: oklch(0.982 0.018 155.826);\n --color-green-100: oklch(0.962 0.044 156.743);\n --color-green-200: oklch(0.925 0.084 155.995);\n --color-green-300: oklch(0.871 0.15 154.449);\n --color-green-400: oklch(0.792 0.209 151.711);\n --color-green-500: oklch(0.723 0.219 149.579);\n --color-green-600: oklch(0.627 0.194 149.214);\n --color-green-700: oklch(0.527 0.154 150.069);\n --color-green-800: oklch(0.448 0.119 151.328);\n --color-green-900: oklch(0.393 0.095 152.535);\n --color-green-950: oklch(0.266 0.065 152.934);\n\n --color-emerald-50: oklch(0.979 0.021 166.113);\n --color-emerald-100: oklch(0.95 0.052 163.051);\n --color-emerald-200: oklch(0.905 0.093 164.15);\n --color-emerald-300: oklch(0.845 0.143 164.978);\n --color-emerald-400: oklch(0.765 0.177 163.223);\n --color-emerald-500: oklch(0.696 0.17 162.48);\n --color-emerald-600: oklch(0.596 0.145 163.225);\n --color-emerald-700: oklch(0.508 0.118 165.612);\n --color-emerald-800: oklch(0.432 0.095 166.913);\n --color-emerald-900: oklch(0.378 0.077 168.94);\n --color-emerald-950: oklch(0.262 0.051 172.552);\n\n --color-teal-50: oklch(0.984 0.014 180.72);\n --color-teal-100: oklch(0.953 0.051 180.801);\n --color-teal-200: oklch(0.91 0.096 180.426);\n --color-teal-300: oklch(0.855 0.138 181.071);\n --color-teal-400: oklch(0.777 0.152 181.912);\n --color-teal-500: oklch(0.704 0.14 182.503);\n --color-teal-600: oklch(0.6 0.118 184.704);\n --color-teal-700: oklch(0.511 0.096 186.391);\n --color-teal-800: oklch(0.437 0.078 188.216);\n --color-teal-900: oklch(0.386 0.063 188.416);\n --color-teal-950: oklch(0.277 0.046 192.524);\n\n --color-cyan-50: oklch(0.984 0.019 200.873);\n --color-cyan-100: oklch(0.956 0.045 203.388);\n --color-cyan-200: oklch(0.917 0.08 205.041);\n --color-cyan-300: oklch(0.865 0.127 207.078);\n --color-cyan-400: oklch(0.789 0.154 211.53);\n --color-cyan-500: oklch(0.715 0.143 215.221);\n --color-cyan-600: oklch(0.609 0.126 221.723);\n --color-cyan-700: oklch(0.52 0.105 223.128);\n --color-cyan-800: oklch(0.45 0.085 224.283);\n --color-cyan-900: oklch(0.398 0.07 227.392);\n --color-cyan-950: oklch(0.302 0.056 229.695);\n\n --color-sky-50: oklch(0.977 0.013 236.62);\n --color-sky-100: oklch(0.951 0.026 236.824);\n --color-sky-200: oklch(0.901 0.058 230.902);\n --color-sky-300: oklch(0.828 0.111 230.318);\n --color-sky-400: oklch(0.746 0.16 232.661);\n --color-sky-500: oklch(0.685 0.169 237.323);\n --color-sky-600: oklch(0.588 0.158 241.966);\n --color-sky-700: oklch(0.5 0.134 242.749);\n --color-sky-800: oklch(0.443 0.11 240.79);\n --color-sky-900: oklch(0.391 0.09 240.876);\n --color-sky-950: oklch(0.293 0.066 243.157);\n\n --color-blue-50: oklch(0.97 0.014 254.604);\n --color-blue-100: oklch(0.932 0.032 255.585);\n --color-blue-200: oklch(0.882 0.059 254.128);\n --color-blue-300: oklch(0.809 0.105 251.813);\n --color-blue-400: oklch(0.707 0.165 254.624);\n --color-blue-500: oklch(0.623 0.214 259.815);\n --color-blue-600: oklch(0.546 0.245 262.881);\n --color-blue-700: oklch(0.488 0.243 264.376);\n --color-blue-800: oklch(0.424 0.199 265.638);\n --color-blue-900: oklch(0.379 0.146 265.522);\n --color-blue-950: oklch(0.282 0.091 267.935);\n\n --color-indigo-50: oklch(0.962 0.018 272.314);\n --color-indigo-100: oklch(0.93 0.034 272.788);\n --color-indigo-200: oklch(0.87 0.065 274.039);\n --color-indigo-300: oklch(0.785 0.115 274.713);\n --color-indigo-400: oklch(0.673 0.182 276.935);\n --color-indigo-500: oklch(0.585 0.233 277.117);\n --color-indigo-600: oklch(0.511 0.262 276.966);\n --color-indigo-700: oklch(0.457 0.24 277.023);\n --color-indigo-800: oklch(0.398 0.195 277.366);\n --color-indigo-900: oklch(0.359 0.144 278.697);\n --color-indigo-950: oklch(0.257 0.09 281.288);\n\n --color-violet-50: oklch(0.969 0.016 293.756);\n --color-violet-100: oklch(0.943 0.029 294.588);\n --color-violet-200: oklch(0.894 0.057 293.283);\n --color-violet-300: oklch(0.811 0.111 293.571);\n --color-violet-400: oklch(0.702 0.183 293.541);\n --color-violet-500: oklch(0.606 0.25 292.717);\n --color-violet-600: oklch(0.541 0.281 293.009);\n --color-violet-700: oklch(0.491 0.27 292.581);\n --color-violet-800: oklch(0.432 0.232 292.759);\n --color-violet-900: oklch(0.38 0.189 293.745);\n --color-violet-950: oklch(0.283 0.141 291.089);\n\n --color-purple-50: oklch(0.977 0.014 308.299);\n --color-purple-100: oklch(0.946 0.033 307.174);\n --color-purple-200: oklch(0.902 0.063 306.703);\n --color-purple-300: oklch(0.827 0.119 306.383);\n --color-purple-400: oklch(0.714 0.203 305.504);\n --color-purple-500: oklch(0.627 0.265 303.9);\n --color-purple-600: oklch(0.558 0.288 302.321);\n --color-purple-700: oklch(0.496 0.265 301.924);\n --color-purple-800: oklch(0.438 0.218 303.724);\n --color-purple-900: oklch(0.381 0.176 304.987);\n --color-purple-950: oklch(0.291 0.149 302.717);\n\n --color-fuchsia-50: oklch(0.977 0.017 320.058);\n --color-fuchsia-100: oklch(0.952 0.037 318.852);\n --color-fuchsia-200: oklch(0.903 0.076 319.62);\n --color-fuchsia-300: oklch(0.833 0.145 321.434);\n --color-fuchsia-400: oklch(0.74 0.238 322.16);\n --color-fuchsia-500: oklch(0.667 0.295 322.15);\n --color-fuchsia-600: oklch(0.591 0.293 322.896);\n --color-fuchsia-700: oklch(0.518 0.253 323.949);\n --color-fuchsia-800: oklch(0.452 0.211 324.591);\n --color-fuchsia-900: oklch(0.401 0.17 325.612);\n --color-fuchsia-950: oklch(0.293 0.136 325.661);\n\n --color-pink-50: oklch(0.971 0.014 343.198);\n --color-pink-100: oklch(0.948 0.028 342.258);\n --color-pink-200: oklch(0.899 0.061 343.231);\n --color-pink-300: oklch(0.823 0.12 346.018);\n --color-pink-400: oklch(0.718 0.202 349.761);\n --color-pink-500: oklch(0.656 0.241 354.308);\n --color-pink-600: oklch(0.592 0.249 0.584);\n --color-pink-700: oklch(0.525 0.223 3.958);\n --color-pink-800: oklch(0.459 0.187 3.815);\n --color-pink-900: oklch(0.408 0.153 2.432);\n --color-pink-950: oklch(0.284 0.109 3.907);\n\n --color-rose-50: oklch(0.969 0.015 12.422);\n --color-rose-100: oklch(0.941 0.03 12.58);\n --color-rose-200: oklch(0.892 0.058 10.001);\n --color-rose-300: oklch(0.81 0.117 11.638);\n --color-rose-400: oklch(0.712 0.194 13.428);\n --color-rose-500: oklch(0.645 0.246 16.439);\n --color-rose-600: oklch(0.586 0.253 17.585);\n --color-rose-700: oklch(0.514 0.222 16.935);\n --color-rose-800: oklch(0.455 0.188 13.697);\n --color-rose-900: oklch(0.41 0.159 10.272);\n --color-rose-950: oklch(0.271 0.105 12.094);\n\n --color-slate-50: oklch(0.984 0.003 247.858);\n --color-slate-100: oklch(0.968 0.007 247.896);\n --color-slate-200: oklch(0.929 0.013 255.508);\n --color-slate-300: oklch(0.869 0.022 252.894);\n --color-slate-400: oklch(0.704 0.04 256.788);\n --color-slate-500: oklch(0.554 0.046 257.417);\n --color-slate-600: oklch(0.446 0.043 257.281);\n --color-slate-700: oklch(0.372 0.044 257.287);\n --color-slate-800: oklch(0.279 0.041 260.031);\n --color-slate-900: oklch(0.208 0.042 265.755);\n --color-slate-950: oklch(0.129 0.042 264.695);\n\n --color-gray-50: oklch(0.985 0.002 247.839);\n --color-gray-100: oklch(0.967 0.003 264.542);\n --color-gray-200: oklch(0.928 0.006 264.531);\n --color-gray-300: oklch(0.872 0.01 258.338);\n --color-gray-400: oklch(0.707 0.022 261.325);\n --color-gray-500: oklch(0.551 0.027 264.364);\n --color-gray-600: oklch(0.446 0.03 256.802);\n --color-gray-700: oklch(0.373 0.034 259.733);\n --color-gray-800: oklch(0.278 0.033 256.848);\n --color-gray-900: oklch(0.21 0.034 264.665);\n --color-gray-950: oklch(0.13 0.028 261.692);\n\n --color-zinc-50: oklch(0.985 0 0);\n --color-zinc-100: oklch(0.967 0.001 286.375);\n --color-zinc-200: oklch(0.92 0.004 286.32);\n --color-zinc-300: oklch(0.871 0.006 286.286);\n --color-zinc-400: oklch(0.705 0.015 286.067);\n --color-zinc-500: oklch(0.552 0.016 285.938);\n --color-zinc-600: oklch(0.442 0.017 285.786);\n --color-zinc-700: oklch(0.37 0.013 285.805);\n --color-zinc-800: oklch(0.274 0.006 286.033);\n --color-zinc-900: oklch(0.21 0.006 285.885);\n --color-zinc-950: oklch(0.141 0.005 285.823);\n\n --color-neutral-50: oklch(0.985 0 0);\n --color-neutral-100: oklch(0.97 0 0);\n --color-neutral-200: oklch(0.922 0 0);\n --color-neutral-300: oklch(0.87 0 0);\n --color-neutral-400: oklch(0.708 0 0);\n --color-neutral-500: oklch(0.556 0 0);\n --color-neutral-600: oklch(0.439 0 0);\n --color-neutral-700: oklch(0.371 0 0);\n --color-neutral-800: oklch(0.269 0 0);\n --color-neutral-900: oklch(0.205 0 0);\n --color-neutral-950: oklch(0.145 0 0);\n\n --color-stone-50: oklch(0.985 0.001 106.423);\n --color-stone-100: oklch(0.97 0.001 106.424);\n --color-stone-200: oklch(0.923 0.003 48.717);\n --color-stone-300: oklch(0.869 0.005 56.366);\n --color-stone-400: oklch(0.709 0.01 56.259);\n --color-stone-500: oklch(0.553 0.013 58.071);\n --color-stone-600: oklch(0.444 0.011 73.639);\n --color-stone-700: oklch(0.374 0.01 67.558);\n --color-stone-800: oklch(0.268 0.007 34.298);\n --color-stone-900: oklch(0.216 0.006 56.043);\n --color-stone-950: oklch(0.147 0.004 49.25);\n\n --color-black: #000;\n --color-white: #fff;\n\n --spacing: 0.25rem;\n\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n @keyframes ping {\n 75%,\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n }\n\n @keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n }\n\n @keyframes bounce {\n 0%,\n 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n }\n\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n\n --aspect-video: 16 / 9;\n\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-font-feature-settings: var(--font-sans--font-feature-settings);\n --default-font-variation-settings: var(--font-sans--font-variation-settings);\n --default-mono-font-family: var(--font-mono);\n --default-mono-font-feature-settings: var(--font-mono--font-feature-settings);\n --default-mono-font-variation-settings: var(--font-mono--font-variation-settings);\n}\n\n/* Deprecated */\n@theme default inline reference {\n --blur: 8px;\n --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);\n --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);\n --radius: 0.25rem;\n --max-width-prose: 65ch;\n}\n",utilities:"@tailwind utilities;\n"};console.warn("The browser build of Tailwind CSS should not be used in production. To use Tailwind CSS in production, use the Tailwind CLI, Vite plugin, or PostCSS plugin: https://tailwindcss.com/docs/installation");var It,qt="text/tailwindcss",Pt=new Set,Ht="",Yt=document.createElement("style"),Zt=Promise.resolve(),Gt=1,Xt=new class{start(e){performance.mark(`${e} (start)`)}end(e,t){performance.mark(`${e} (end)`),performance.measure(e,{start:`${e} (start)`,end:`${e} (end)`,detail:t})}hit(e,t){performance.mark(e,{detail:t})}error(e){throw performance.mark("(error)",{detail:{error:`${e}`}}),e}};async function Jt(e,t){try{let r=function(){if("tailwindcss"===e)return{base:t,content:Rt.index};if("tailwindcss/preflight"===e||"tailwindcss/preflight.css"===e||"./preflight.css"===e)return{base:t,content:Rt.preflight};if("tailwindcss/theme"===e||"tailwindcss/theme.css"===e||"./theme.css"===e)return{base:t,content:Rt.theme};if("tailwindcss/utilities"===e||"tailwindcss/utilities.css"===e||"./utilities.css"===e)return{base:t,content:Rt.utilities};throw new Error(`The browser build does not support @import for "${e}"`)}();return Xt.hit("Loaded stylesheet",{id:e,base:t,size:r.content.length}),r}catch(r){throw Xt.hit("Failed to load stylesheet",{id:e,base:t,error:r.message??r}),r}}async function Qt(){throw new Error("The browser build does not support plugins or config files.")}function er(e){Zt=Zt.then((async function(){if(!It&&"full"!==e)return;let t=Gt++;Xt.start(`Build #${t} (${e})`),"full"===e&&await async function(){Xt.start("Create compiler"),Xt.start("Reading Stylesheets");let e=document.querySelectorAll(`style[type="${qt}"]`),t="";for(let r of e)rr(r),t+=r.textContent+"\n";if(t.includes("@import")||(t=`@import "tailwindcss";${t}`),Xt.end("Reading Stylesheets",{size:t.length,changed:Ht!==t}),Ht!==t){Ht=t,Xt.start("Compile CSS");try{It=await Mt(t,{base:"/",loadStylesheet:Jt,loadModule:Qt})}finally{Xt.end("Compile CSS"),Xt.end("Create compiler")}Pt.clear()}}(),Xt.start("Build"),await async function(e){if(!It)return;let t=new Set;Xt.start("Collect classes");for(let e of document.querySelectorAll("[class]"))for(let r of e.classList)Pt.has(r)||(Pt.add(r),t.add(r));Xt.end("Collect classes",{count:t.size}),(0!==t.size||"incremental"!==e)&&(Xt.start("Build utilities"),Yt.textContent=It.build(Array.from(t)),Xt.end("Build utilities"))}(e),Xt.end("Build"),Xt.end(`Build #${t} (${e})`)})).catch((e=>Xt.error(e)))}var tr=new MutationObserver((()=>er("full")));function rr(e){tr.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,subtree:!0,childList:!0})}new MutationObserver((e=>{let t=0,r=0;for(let n of e){for(let e of n.addedNodes)e.nodeType===Node.ELEMENT_NODE&&"STYLE"===e.tagName&&e.getAttribute("type")===qt&&(rr(e),t++);for(let e of n.addedNodes)1===e.nodeType&&e!==Yt&&r++;"attributes"===n.type&&r++}return t>0?er("full"):r>0?er("incremental"):void 0})).observe(document.documentElement,{attributes:!0,attributeFilter:["class"],childList:!0,subtree:!0}),er("full"),document.head.append(Yt)})(); +//# sourceMappingURL=/sm/e5c39dde32e56be6278cb204398164cc1624bfd96861cfe1885d8d15d22507c1.map \ No newline at end of file diff --git a/submissions/StudyTracker/testing/index.html b/submissions/StudyTracker/testing/index.html new file mode 100644 index 00000000..6dc4c33e --- /dev/null +++ b/submissions/StudyTracker/testing/index.html @@ -0,0 +1,176 @@ + + + + + + + Study Tracker + + + + + + + + + +

Study Time Tracker 📚

+ + +
+ + +
+ + + +
+

Study Time Today:

+ 00:00:00 +
+ +
+

Last 7 Days:

+
    +
    + + + + + + \ No newline at end of file diff --git a/submissions/StudyTracker/testing/manifest.json b/submissions/StudyTracker/testing/manifest.json new file mode 100644 index 00000000..0346dfa6 --- /dev/null +++ b/submissions/StudyTracker/testing/manifest.json @@ -0,0 +1,27 @@ +{ + "manifest_version": 3, + "name": "Study Time Tracker", + "version": "1.0", + "description": "Controls YouTube video playback based on study time", + "permissions": [ + "activeTab", + "storage" + ], + "background": { + "service_worker": "background.js" + }, + "content_scripts": [ + { + "matches": ["*://www.youtube.com/*"], + "js": ["content.js"] + } + ], + "action": { + "default_popup": "popup.html" + }, + "host_permissions": [ + "http://*/*", + "https://*/*" + ] + } + \ No newline at end of file