/** * @license * Copyright 2021 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,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("@tensorflow/tfjs-converter"),require("@tensorflow/tfjs-core")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs-converter","@tensorflow/tfjs-core"],a):a((e=e||self).cocoSsd=e.cocoSsd||{},e.tf,e.tf)}(this,(function(e,a,i){"use strict";function n(e,a,i,n){return new(i||(i=Promise))((function(m,t){function d(e){try{o(n.next(e))}catch(e){t(e)}}function s(e){try{o(n.throw(e))}catch(e){t(e)}}function o(e){var a;e.done?m(e.value):(a=e.value,a instanceof i?a:new i((function(e){e(a)}))).then(d,s)}o((n=n.apply(e,a||[])).next())}))}function m(e,a){var i,n,m,t,d={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return t={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function s(t){return function(s){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;d;)try{if(i=1,n&&(m=2&t[0]?n.return:t[0]?n.throw||((m=n.return)&&m.call(n),0):n.next)&&!(m=m.call(n,t[1])).done)return m;switch(n=0,m&&(t=[2&t[0],m.value]),t[0]){case 0:case 1:m=t;break;case 4:return d.label++,{value:t[1],done:!1};case 5:d.label++,n=t[1],t=[0];continue;case 7:t=d.ops.pop(),d.trys.pop();continue;default:if(!(m=d.trys,(m=m.length>0&&m[m.length-1])||6!==t[0]&&2!==t[0])){d=0;continue}if(3===t[0]&&(!m||t[1]>m[0]&&t[1]d&&(d=e[t*i+o],s=o);n[t]=d,m[t]=s}return[n,m]},e.prototype.detect=function(e,a,i){return void 0===a&&(a=20),void 0===i&&(i=.5),n(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this.infer(e,a,i)]}))}))},e.prototype.dispose=function(){null!=this.model&&this.model.dispose()},e}();e.ObjectDetection=d,e.load=function(e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var a,n,t;return m(this,(function(m){switch(m.label){case 0:if(null==i)throw new Error("Cannot find TensorFlow.js. If you are using a