1var Ey=Object.freeze,Ty=Object.defineProperty;var u3=(t,e,n)=>e in t?Ty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var U=(t,e,n)=>(u3(t,typeof e!="symbol"?e+"":e,n),n);var Cy=(t,e)=>Ey(Ty(t,"raw",{value:Ey(e||t.slice())}));import{aB as d3,aC as f3,r as G,aD as O0,aE as Nu,aF as cr,aG as p3,aH as At,aI as xe,aJ as h3,aK as m3,j as ko,ao as Se,u as g3,K as y3}from"./vendor-4e86cbe6.js";import{cl as v3,c as b3,cm as Ny,cn as w3,co as ul,E as bo,cp as fp,M as S3,cq as pp,cr as Ay,cs as $y,ct as x3,cu as _3,cv as I3}from"./index-37dfafe8.js";function dm(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const k3="Logging",E3="NoHubcallbackProvidedException";var ar;(function(t){t.DEBUG="DEBUG",t.ERROR="ERROR",t.INFO="INFO",t.WARN="WARN",t.VERBOSE="VERBOSE",t.NONE="NONE"})(ar||(ar={}));const Ry={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class es{constructor(e,n=ar.WARN){this.name=e,this.level=n,this._pluggables=[]}_padding(e){return e<10?"0"+e:""+e}_ts(){const e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()}configure(e){return e?(this._config=e,this._config):this._config}_log(e,...n){let r=this.level;es.LOG_LEVEL&&(r=es.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(r=window.LOG_LEVEL);const s=Ry[r];if(!(Ry[e]>=s))return;let o=console.log.bind(console);e===ar.ERROR&&console.error&&(o=console.error.bind(console)),e===ar.WARN&&console.warn&&(o=console.warn.bind(console)),es.BIND_ALL_LOG_LEVELS&&(e===ar.INFO&&console.info&&(o=console.info.bind(console)),e===ar.DEBUG&&console.debug&&(o=console.debug.bind(console)));const i="[".concat(e,"] ").concat(this._ts()," ").concat(this.name);let l="";if(n.length===1&&typeof n[0]=="string")l="".concat(i," - ").concat(n[0]),o(l);else if(n.length===1)l="".concat(i," ").concat(n[0]),o(i,n[0]);else if(typeof n[0]=="string"){let u=n.slice(1);u.length===1&&(u=u[0]),l="".concat(i," - ").concat(n[0]," ").concat(u),o("".concat(i," - ").concat(n[0]),u)}else l="".concat(i," ").concat(n),o(i,n);for(const u of this._pluggables){const c={message:l,timestamp:Date.now()};u.pushLogs([c])}}log(...e){this._log(ar.INFO,...e)}info(...e){this._log(ar.INFO,...e)}warn(...e){this._log(ar.WARN,...e)}error(...e){this._log(ar.ERROR,...e)}debug(...e){this._log(ar.DEBUG,...e)}verbose(...e){this._log(ar.VERBOSE,...e)}addPluggable(e){e&&e.getCategoryName()===k3&&(this._pluggables.push(e),e.configure(this._config))}listPluggables(){return this._pluggables}}es.LOG_LEVEL=null;es.BIND_ALL_LOG_LEVELS=!1;class lc extends Error{constructor({message:e,name:n,recoverySuggestion:r,underlyingError:s,metadata:a}){if(super(e),this.name=n,this.underlyingError=s,this.recoverySuggestion=r,a){const{extendedRequestId:o,httpStatusCode:i,requestId:l}=a;this.metadata={extendedRequestId:o,httpStatusCode:i,requestId:l}}this.constructor=lc,Object.setPrototypeOf(this,lc.prototype)}}const P0=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",Ti=new es("Hub");class T3{constructor(e){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}_remove(e,n){const r=this.listeners.get(e);if(!r){Ti.warn("No listeners for ".concat(e));return}this.listeners.set(e,[...r.filter(({callback:s})=>s!==n)])}dispatch(e,n,r,s){typeof e=="string"&&this.protectedChannels.indexOf(e)>-1&&(s===P0||Ti.warn("WARNING: ".concat(e," is protected and dispatching on it can have unintended consequences")));const a={channel:e,payload:{...n},source:r,patternInfo:[]};try{this._toListeners(a)}catch(o){Ti.error(o)}}listen(e,n,r="noname"){let s;if(typeof n!="function")throw new lc({name:E3,message:"No callback supplied to Hub"});s=n;let a=this.listeners.get(e);return a||(a=[],this.listeners.set(e,a)),a.push({name:r,callback:s}),()=>{this._remove(e,s)}}_toListeners(e){const{channel:n,payload:r}=e,s=this.listeners.get(n);
1s&&s.forEach(a=>{Ti.debug("Dispatching to ".concat(n," with "),r);try{a.callback(e)}catch(o){Ti.error(o)}})}}const C3=new T3("__default__"),N3=t=>t&&t["nonRetryable"],dl=new es("retryUtil");async function A3(t,e,n,r){if(typeof t!="function")throw Error("functionToRetry must be a function");return new Promise(async(s,a)=>{let o=0,i=!1,l,u=()=>{},c;for(r&&r.then(()=>{i=!0,clearTimeout(l),u()});!i;){o++,dl.debug("".concat(t.name," attempt #").concat(o," with this vars: ").concat(JSON.stringify(e)));try{s(await t(...e));return}catch(d){if(c=d,dl.debug("error on ".concat(t.name),d),N3(d)){dl.debug("".concat(t.name," non retryable error"),d),a(d);return}const f=n(o,e,d);if(dl.debug("".concat(t.name," retrying in ").concat(f," ms")),f===!1||i){a(d);return}else await new Promise(p=>{u=p,l=setTimeout(u,f)})}}a(c)})}const B0=t=>{const e=Reflect.ownKeys(t);for(const n of e){const r=t[n];(r&&typeof r=="object"||typeof r=="function")&&B0(r)}return Object.freeze(t)},$3=new es("parseAWSExports"),R3={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},D3=(t={})=>{var oe,ie,pe,ve,fe,be,$e,Re,De,Pe,je,Ue,Ce,Ze,Ke;if(!Object.prototype.hasOwnProperty.call(t,"aws_project_region"))throw new lc({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:e,aws_appsync_authenticationType:n,aws_appsync_graphqlEndpoint:r,aws_appsync_region:s,aws_bots_config:a,aws_cognito_identity_pool_id:o,aws_cognito_sign_up_verification_method:i,aws_cognito_mfa_configuration:l,aws_cognito_mfa_types:u,aws_cognito_password_protection_settings:c,aws_cognito_verification_mechanisms:d,aws_cognito_signup_attributes:f,aws_cognito_social_providers:p,aws_cognito_username_attributes:h,aws_mandatory_sign_in:m,aws_mobile_analytics_app_id:g,aws_mobile_analytics_app_region:v,aws_user_files_s3_bucket:b,aws_user_files_s3_bucket_region:w,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:S,aws_user_pools_id:I,aws_user_pools_web_client_id:E,geo:T,oauth:D,predictions:R,aws_cloud_logic_custom:$,Notifications:M,modelIntrospection:B}=t,z={};g&&(z.Analytics={Pinpoint:{appId:g,region:v}});const{InAppMessaging:H,Push:V}=M!=null?M:{};if(H!=null&&H.AWSPinpoint||V!=null&&V.AWSPinpoint){if(H!=null&&H.AWSPinpoint){const{appId:Ne,region:Ge}=H.AWSPinpoint;z.Notifications={InAppMessaging:{Pinpoint:{appId:Ne,region:Ge}}}}if(V!=null&&V.AWSPinpoint){const{appId:Ne,region:Ge}=V.AWSPinpoint;z.Notifications={...z.Notifications,PushNotification:{Pinpoint:{appId:Ne,region:Ge}}}}}if(Array.isArray(a)&&(z.Interactions={LexV1:Object.fromEntries(a.map(Ne=>[Ne.name,Ne]))}),r){const Ne=R3[n];Ne||$3.debug("Invalid authentication type ".concat(n,". Falling back to IAM.")),z.API={GraphQL:{endpoint:r,apiKey:e,region:s,defaultAuthMode:Ne!=null?Ne:"iam"}},B&&(z.API.GraphQL.modelIntrospection=B)}const X=l?{status:l&&l.toLowerCase(),totpEnabled:(oe=u==null?void 0:u.includes("TOTP"))!=null?oe:!1,smsEnabled:(ie=u==null?void 0:u.includes("SMS"))!=null?ie:!1}:void 0,Q=c?{minLength:c.passwordPolicyMinLength,requireLowercase:(ve=(pe=c.passwordPolicyCharacters)==null?void 0:pe.includes("REQUIRES_LOWERCASE"))!=null?ve:!1,requireUppercase:(be=(fe=c.passwordPolicyCharacters)==null?void 0:fe.includes("REQUIRES_UPPERCASE"))!=null?be:!1,requireNumbers:(Re=($e=c.passwordPolicyCharacters)==null?void 0:$e.includes("REQUIRES_NUMBERS"))!=null?Re:!1,requireSpecialCharacters:(Pe=(De=c.passwordPolicyCharacters)==null?void 0:De.includes("REQUIRES_SYMBOLS"))!=null?Pe:!1}:void 0,ee=Array.from(new Set([...d!=null?d:[],...f!=null?f:[]])).reduce((Ne,Ge)=>({...Ne,[Ge.toLowerCase()]:{required:!0}}),{}),ae=(je=h==null?void 0:h.includes("EMAIL"))!=null?je:!1,ne=(Ue=h==null?void 0:h.includes("PHONE_NUMBER"))!=null?Ue:!1;(o||I)&&(z.Auth={Cognito:{identityPoolId:o,allowGuestAccess:m!=="enable",signUpVerificationMethod:i,userAttributes:ee,userPoolClientId:E,userPoolId:I,mfa:X,passwordFormat:Q,loginWith:{username:!(ae||ne),email:ae,phone:ne}}});const ce=D?Object.keys(D).length>0:!1,se=p?p.length>0:!1;
1if(z.Auth&&ce&&(z.Auth.Cognito.loginWith={...z.Auth.Cognito.loginWith,oauth:{...F3(D),...se&&{providers:M3(p)}}}),b&&(z.Storage={S3:{bucket:b,region:w,dangerouslyConnectToHttpEndpointForTesting:S}}),T){const{amazon_location_service:Ne}=T;z.Geo={LocationService:{maps:Ne.maps,geofenceCollections:Ne.geofenceCollections,searchIndices:Ne.search_indices,region:Ne.region}}}if($&&(z.API={...z.API,REST:$.reduce((Ne,Ge)=>{const{name:jt,endpoint:gt,region:It,service:yt}=Ge;return{...Ne,[jt]:{endpoint:gt,...yt?{service:yt}:void 0,...It?{region:It}:void 0}}},{})}),R){const{VoiceId:Ne}=(Ke=(Ze=(Ce=R==null?void 0:R.convert)==null?void 0:Ce.speechGenerator)==null?void 0:Ze.defaults)!=null?Ke:{};z.Predictions=Ne?{...R,convert:{...R.convert,speechGenerator:{...R.convert.speechGenerator,defaults:{voiceId:Ne}}}}:R}return z},Dy=t=>{var e;return(e=t==null?void 0:t.split(","))!=null?e:[]},F3=({domain:t,scope:e,redirectSignIn:n,redirectSignOut:r,responseType:s})=>({domain:t,scopes:e,redirectSignIn:Dy(n),redirectSignOut:Dy(r),responseType:s}),M3=t=>t.map(e=>{const n=e.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}),O3=Symbol("oauth-listener"),bn=[];for(let t=0;t<256;++t)bn.push((t+256).toString(16).slice(1));function P3(t,e=0){return(bn[t[e+0]]+bn[t[e+1]]+bn[t[e+2]]+bn[t[e+3]]+"-"+bn[t[e+4]]+bn[t[e+5]]+"-"+bn[t[e+6]]+bn[t[e+7]]+"-"+bn[t[e+8]]+bn[t[e+9]]+"-"+bn[t[e+10]]+bn[t[e+11]]+bn[t[e+12]]+bn[t[e+13]]+bn[t[e+14]]+bn[t[e+15]]).toLowerCase()}let hp;const B3=new Uint8Array(16);function L3(){if(!hp){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");hp=crypto.getRandomValues.bind(crypto)}return hp(B3)}const W3=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Fy={randomUUID:W3};function My(t,e,n){var s,a,o;if(Fy.randomUUID&&!e&&!t)return Fy.randomUUID();t=t||{};const r=(o=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?o:L3();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(n=n||0,n<0||n+16>e.length)throw new RangeError("UUID byte range ".concat(n,":").concat(n+15," is out of buffer bounds"));for(let i=0;i<16;++i)e[n+i]=r[i];return e}return P3(r)}function z3(t){const{version:e}=t;return e?e.startsWith("1"):!1}function H3(t){if(!t)return;const{bucket_name:e,aws_region:n,buckets:r}=t;return{S3:{bucket:e,region:n,buckets:r&&Z3(r)}}}function U3(t){var h;if(!t)return;const{user_pool_id:e,user_pool_client_id:n,identity_pool_id:r,password_policy:s,mfa_configuration:a,mfa_methods:o,unauthenticated_identities_enabled:i,oauth:l,username_attributes:u,standard_required_attributes:c,groups:d,passwordless:f}=t,p={Cognito:{userPoolId:e,userPoolClientId:n,groups:d}};return r&&(p.Cognito={...p.Cognito,identityPoolId:r}),s&&(p.Cognito.passwordFormat={requireLowercase:s.require_lowercase,requireNumbers:s.require_numbers,requireUppercase:s.require_uppercase,requireSpecialCharacters:s.require_symbols,minLength:(h=s.min_length)!=null?h:6}),a&&(p.Cognito.mfa={status:Q3(a),smsEnabled:o==null?void 0:o.includes("SMS"),totpEnabled:o==null?void 0:o.includes("TOTP")}),i&&(p.Cognito.allowGuestAccess=i),l&&(p.Cognito.loginWith={oauth:{domain:l.domain,redirectSignIn:l.redirect_sign_in_uri,redirectSignOut:l.redirect_sign_out_uri,responseType:l.response_type==="token"?"token":"code",scopes:l.scopes,providers:J3(l.identity_providers)}}),u&&(p.Cognito.loginWith={...p.Cognito.loginWith,email:u.includes("email"),phone:u.includes("phone_number"),username:u.includes("username")}),c&&(p.Cognito.userAttributes=c.reduce((m,g)=>({...m,[g]:{required:!0}}),{})),f&&(p.Cognito.passwordless={emailOtpEnabled:f.email_otp_enabled,smsOtpEnabled:f.sms_otp_enabled,webAuthn:f.web_authn?{relyingPartyId:f.web_authn.relying_party_id,userVerification:f.web_authn.user_verification}:void 0,preferredChallenge:f.preferred_challenge}),p}function V3(t){if(!(t!=null&&t.amazon_pinpoint))return;const{amazon_pinpoint:e}=t;return{Pinpoint:{appId:e.app_id,region:e.aws_region}}}function j3(t){if(!t)return;const{aws_region:e,geofence_collections:n,maps:r,search_indices:s}=t;return{LocationService:{region:e,searchIndices:s,geofenceCollections:n,maps:r}}}function G3(t){if(!t)return;const{aws_region:e,default_authorization_type:n,url:r,api_key:s,model_introspection:a}=t;return{GraphQL:{endpoint:r,defaultAuthMode:L0(n),region:e,apiKey:s,modelIntrospection:a}}}function q3(t){if(!(t!=null&&t.events))return;const{url:e,aws_region:n,api_key:r,default_authorization_type:s}=t.events;return{Events:{endpoint:e,defaultAuthMode:L0(s),region:n,apiKey:r}}}function K3(t){if(!t)return;const{aws_region:e,channels:n,amazon_pinpoint_app_id:r}=t,s=n.includes("IN_APP_MESSAGING"),a=n.includes("APNS")||n.includes("FCM");if(!(s||a))return;const o={};return s&&(o.InAppMessaging={Pinpoint:{appId:r,region:e}}),a&&(o.PushNotification={Pinpoint:{appId:r,region:e}}),o}function X3(t){const e={};if(t.storage&&(e.Storage=H3(t.storage)),t.auth&&(e.Auth=U3(t.auth)),t.analytics&&(e.Analytics=V3(t.analytics)),t.geo&&(e.Geo=j3(t.geo)),t.data&&(e.API=G3(t.data)),t.custom){const n=q3(t.custom);
1n&&"Events"in n&&(e.API={...e.API,...n})}return t.notifications&&(e.Notifications=K3(t.notifications)),e}const Y3={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function L0(t){return Y3[t]}const Oy={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function J3(t=[]){return t.reduce((e,n)=>(Oy[n]!==void 0&&e.push(Oy[n]),e),[])}function Q3(t){return t==="OPTIONAL"?"optional":t==="REQUIRED"?"on":"off"}function Z3(t){const e={};return t.forEach(({name:n,bucket_name:r,aws_region:s,paths:a})=>{if(n in e)throw new Error("Duplicate friendly name found: ".concat(n,". Name must be unique."));const o=a?Object.entries(a).reduce((i,[l,u])=>(u!==void 0&&(i[l]=u),i),{}):void 0;e[n]={bucketName:r,region:s,paths:o}}),e}const eE=t=>Object.keys(t).some(e=>e.startsWith("aws_"))?D3(t):z3(t)?X3(t):t;var yr=64,tE=32,nE=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),rE=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],sE=Math.pow(2,53)-1,El=function(){function t(){this.state=Int32Array.from(rE),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return t.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>sE)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===yr&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%yr>=yr-8){for(var s=this.bufferLength;s<yr;s++)n.setUint8(s,0);this.hashBuffer(),this.bufferLength=0}for(var s=this.bufferLength;s<yr-8;s++)n.setUint8(s,0);n.setUint32(yr-8,Math.floor(e/4294967296),!0),n.setUint32(yr-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(tE),s=0;s<8;s++)a[s*4]=this.state[s]>>>24&255,a[s*4+1]=this.state[s]>>>16&255,a[s*4+2]=this.state[s]>>>8&255,a[s*4+3]=this.state[s]>>>0&255;return a},t.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,s=r[0],a=r[1],o=r[2],i=r[3],l=r[4],u=r[5],c=r[6],d=r[7],f=0;f<yr;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var m=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(m+this.temp[f-16]|0)}var g=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&c)|0)+(d+(nE[f]+this.temp[f]|0)|0)|0,v=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&o^a&o)|0;d=c,c=u,u=l,l=i+g|0,i=o,o=a,a=s,s=g+v|0}r[0]+=s,r[1]+=a,r[2]+=o,r[3]+=i,r[4]+=l,r[5]+=u,r[6]+=c,r[7]+=d},t}();const aE=t=>new TextEncoder().encode(t);var oE=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:aE;function uc(t){return t instanceof Uint8Array?t:typeof t=="string"?oE(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}function eh(t){return typeof t=="string"?t.length===0:t.byteLength===0}function iE(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),n=0;n<t.length;)e[n]=t[n],n+=1;return e}return Uint32Array.from(t)}var cE=function(){function t(e){this.secret=e,this.hash=new El,this.reset()}return t.prototype.update=function(e){if(!(eh(e)||this.error))try{this.hash.update(uc(e))}catch(n){this.error=n}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return d3(this,void 0,void 0,function(){return f3(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new El,this.secret){this.outer=new El;var e=lE(this.secret),n=new Uint8Array(yr);n.set(e);for(var r=0;r<yr;r++)e[r]^=54,n[r]^=92;this.hash.update(e),this.outer.update(n);for(var r=0;r<e.byteLength;r++)e[r]=0}},t}();function lE(t){var e=uc(t);if(e.byteLength>yr){var n=new El;n.update(e),e=n.digest()}
1var r=new Uint8Array(yr);return r.set(e),r}for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e="0".concat(e))}var Jt;(function(t){t.WebUnknown="0",t.React="1",t.NextJs="2",t.Angular="3",t.VueJs="4",t.Nuxt="5",t.Svelte="6",t.ServerSideUnknown="100",t.ReactSSR="101",t.NextJsSSR="102",t.AngularSSR="103",t.VueJsSSR="104",t.NuxtSSR="105",t.SvelteSSR="106",t.ReactNative="201",t.Expo="202"})(Jt||(Jt={}));var Py;(function(t){t.AI="ai",t.API="api",t.Auth="auth",t.Analytics="analytics",t.DataStore="datastore",t.Geo="geo",t.InAppMessaging="inappmessaging",t.Interactions="interactions",t.Predictions="predictions",t.PubSub="pubsub",t.PushNotification="pushnotification",t.Storage="storage"})(Py||(Py={}));var By;(function(t){t.CreateConversation="1",t.GetConversation="2",t.ListConversations="3",t.DeleteConversation="4",t.SendMessage="5",t.ListMessages="6",t.OnMessage="7",t.Generation="8",t.UpdateConversation="9"})(By||(By={}));var Ly;(function(t){t.Record="1",t.IdentifyUser="2"})(Ly||(Ly={}));var Wy;(function(t){t.GraphQl="1",t.Get="2",t.Post="3",t.Put="4",t.Patch="5",t.Del="6",t.Head="7"})(Wy||(Wy={}));var zy;(function(t){t.SignUp="1",t.ConfirmSignUp="2",t.ResendSignUpCode="3",t.SignIn="4",t.FetchMFAPreference="6",t.UpdateMFAPreference="7",t.SetUpTOTP="10",t.VerifyTOTPSetup="11",t.ConfirmSignIn="12",t.DeleteUserAttributes="15",t.DeleteUser="16",t.UpdateUserAttributes="17",t.FetchUserAttributes="18",t.ConfirmUserAttribute="22",t.SignOut="26",t.UpdatePassword="27",t.ResetPassword="28",t.ConfirmResetPassword="29",t.FederatedSignIn="30",t.RememberDevice="32",t.ForgetDevice="33",t.FetchDevices="34",t.SendUserAttributeVerificationCode="35",t.SignInWithRedirect="36",t.StartWebAuthnRegistration="37",t.CompleteWebAuthnRegistration="38",t.ListWebAuthnCredentials="39",t.DeleteWebAuthnCredential="40"})(zy||(zy={}));var Hy;(function(t){t.Subscribe="1",t.GraphQl="2"})(Hy||(Hy={}));var Uy;(function(t){t.SearchByText="0",t.SearchByCoordinates="1",t.SearchForSuggestions="2",t.SearchByPlaceId="3",t.SaveGeofences="4",t.GetGeofence="5",t.ListGeofences="6",t.DeleteGeofences="7"})(Uy||(Uy={}));var Vy;(function(t){t.SyncMessages="1",t.IdentifyUser="2",t.NotifyMessageInteraction="3"})(Vy||(Vy={}));var jy;(function(t){t.None="0"})(jy||(jy={}));var Gy;(function(t){t.Convert="1",t.Identify="2",t.Interpret="3"})(Gy||(Gy={}));var qy;(function(t){t.Subscribe="1"})(qy||(qy={}));var Ky;(function(t){t.InitializePushNotifications="1",t.IdentifyUser="2"})(Ky||(Ky={}));var Xy;(function(t){t.UploadData="1",t.DownloadData="2",t.List="3",t.Copy="4",t.Remove="5",t.GetProperties="6",t.GetUrl="7",t.GetDataAccess="8",t.ListCallerAccessGrants="9"})(Xy||(Xy={}));const W0="6.18.0",Au=()=>typeof global<"u",si=()=>typeof window<"u",z0=()=>typeof document<"u",fm=()=>typeof process<"u",dc=(t,e)=>!!Object.keys(t).find(n=>n.startsWith(e));function uE(){const t=r=>r.startsWith("_react")||r.startsWith("__react"),e=r=>Object.keys(r).find(t),n=()=>Array.from(document.querySelectorAll("[id]"));return z0()&&n().some(e)}function dE(){return fm()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("react"))}function fE(){return si()&&dc(window,"__VUE")}function pE(){return Au()&&dc(global,"__VUE")}function hE(){return si()&&dc(window,"__SVELTE")}function mE(){return fm()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("svelte"))}function gE(){return si()&&window.next&&typeof window.next=="object"}function yE(){return Au()&&(dc(global,"__next")||dc(global,"__NEXT"))}function vE(){return si()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function bE(){return Au()&&typeof global.__NUXT_PATHS__<"u"}function wE(){const t=!!(z0()&&document.querySelector("[ng-version]")),e=!!(si()&&typeof window.ng<"u");return t||e}function SE(){var t;return fm()&&typeof process.env=="object"&&((t={}.npm_lifecycle_script)==null?void 0:t.startsWith("ng "))||!1}function xE(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function _E(){return Au()&&typeof global.expo<"u"}function IE(){return si()}const kE=[{platform:Jt.Expo,detectionMethod:_E},{platform:Jt.ReactNative,detectionMethod:xE},{platform:Jt.NextJs,detectionMethod:gE},{platform:Jt.Nuxt,detectionMethod:vE},{platform:Jt.Angular,detectionMethod:wE},{platform:Jt.React,detectionMethod:uE},{platform:Jt.VueJs,detectionMethod:fE},{platform:Jt.Svelte,detectionMethod:hE},{platform:Jt.WebUnknown,detectionMethod:IE},{platform:Jt.NextJsSSR,detectionMethod:yE},{platform:Jt.NuxtSSR,detectionMethod:bE},{platform:Jt.ReactSSR,detectionMethod:dE},{platform:Jt.VueJsSSR,detectionMethod:pE},{platform:Jt.AngularSSR,detectionMethod:SE},{platform:Jt.SvelteSSR,detectionMethod:mE}];function EE(){var t;return((t=kE.find(e=>e.detectionMethod()))==null?void 0:t.platform)||Jt.ServerSideUnknown}let Yi;const Tl=[];let jl=!1;
1const TE=10,CE=10,NE=1e3,pm=()=>{var t;if(!Yi){if(Yi=EE(),jl)for(;Tl.length;)(t=Tl.pop())==null||t();else Tl.forEach(e=>{e()});Yy(Jt.ServerSideUnknown,TE),Yy(Jt.WebUnknown,CE)}return Yi},AE=t=>{jl||Tl.push(t)};function $E(){Yi=void 0}function Yy(t,e){Yi===t&&!jl&&setTimeout(()=>{$E(),jl=!0,setTimeout(pm,NE)},e)}const RE={},DE=(t,e)=>{var n,r;return(r=(n=RE[t])==null?void 0:n[e])==null?void 0:r.additionalDetails},H0="aws-amplify",U0=t=>t.replace(/\+.*/,"");class FE{constructor(){this.userAgent="".concat(H0,"/").concat(U0(W0))}get framework(){return pm()}get isReactNative(){return this.framework===Jt.ReactNative||this.framework===Jt.Expo}observeFrameworkChanges(e){AE(e)}}new FE;const ME=({category:t,action:e}={})=>{const n=[[H0,U0(W0)]];if(t&&n.push([t,e]),n.push(["framework",pm()]),t&&e){const r=DE(t,e);r&&r.forEach(s=>{n.push(s)})}return n},OE=t=>ME(t).map(([r,s])=>r&&s?"".concat(r,"/").concat(s):r).join(" "),Jy=new es("Auth");class PE{configure(e,n){var r,s;this.authConfig=e,this.authOptions=n,e&&((r=e.Cognito)!=null&&r.userPoolEndpoint)&&Jy.warn(Qy("Amazon Cognito User Pool")),e&&((s=e.Cognito)!=null&&s.identityPoolEndpoint)&&Jy.warn(Qy("Amazon Cognito Identity Pool"))}async fetchAuthSession(e={}){var a,o,i,l,u,c;let n,r;const s=await this.getTokens(e);return s?(r=(o=(a=s.accessToken)==null?void 0:a.payload)==null?void 0:o.sub,n=await((l=(i=this.authOptions)==null?void 0:i.credentialsProvider)==null?void 0:l.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:s,authenticated:!0,forceRefresh:e.forceRefresh}))):n=await((c=(u=this.authOptions)==null?void 0:u.credentialsProvider)==null?void 0:c.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:e.forceRefresh})),{tokens:s,credentials:n==null?void 0:n.credentials,identityId:n==null?void 0:n.identityId,userSub:r}}async clearCredentials(){var e,n;await((n=(e=this.authOptions)==null?void 0:e.credentialsProvider)==null?void 0:n.clearCredentialsAndIdentityId())}async getTokens(e){var n,r,s;return(s=await((r=(n=this.authOptions)==null?void 0:n.tokenProvider)==null?void 0:r.getTokens(e)))!=null?s:void 0}}const Qy=t=>"You are using a custom Amazon ".concat(t," endpoint, ensure the endpoint is correct.");class BE{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new PE}configure(e,n){var s,a,o,i,l;const r=eE(e);this.resourcesConfig=r,n&&(this.libraryOptions=n),this.resourcesConfig=B0(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),((s=this.resourcesConfig.Analytics)!=null&&s.Pinpoint||(o=(a=this.resourcesConfig.Notifications)==null?void 0:a.InAppMessaging)!=null&&o.Pinpoint||(l=(i=this.resourcesConfig.Notifications)==null?void 0:i.PushNotification)!=null&&l.Pinpoint)&&console.warn("AWS will end support for Amazon Pinpoint on October 30, 2026. The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics."),C3.dis
1patch("core",{event:"configure",data:this.resourcesConfig},"Configure",P0),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[O3](e){var n,r,s;(r=(n=this.resourcesConfig.Auth)==null?void 0:n.Cognito.loginWith)!=null&&r.oauth?e((s=this.resourcesConfig.Auth)==null?void 0:s.Cognito):this.oAuthListener=e}notifyOAuthListener(){var e,n,r;!((n=(e=this.resourcesConfig.Auth)==null?void 0:e.Cognito.loginWith)!=null&&n.oauth)||!this.oAuthListener||(this.oAuthListener((r=this.resourcesConfig.Auth)==null?void 0:r.Cognito),this.oAuthListener=void 0)}}const LE=new BE,WE=(t,e)=>t.Auth.fetchAuthSession(e),zE=t=>WE(LE,t),V0=5*60*1e3;function HE(t=V0){return r=>{const s=2**r*100+100*Math.random();return s>t?!1:s}}const UE=(t,e,n=V0,r)=>A3(t,e,HE(n),r);var j0={exports:{}},G0={},q0={exports:{}},K0={};/** 2 * @license React 3 * use-sync-external-store-shim.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var jo=G;function VE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var jE=typeof Object.is=="function"?Object.is:VE,GE=jo.useState,qE=jo.useEffect,KE=jo.useLayoutEffect,XE=jo.useDebugValue;function YE(t,e){var n=e(),r=GE({inst:{value:n,getSnapshot:e}}),s=r[0].inst,a=r[1];return KE(function(){s.value=n,s.getSnapshot=e,mp(s)&&a({inst:s})},[t,n,e]),qE(function(){return mp(s)&&a({inst:s}),t(function(){mp(s)&&a({inst:s})})},[t]),XE(n),n}function mp(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!jE(t,n)}catch(r){return!0}}function JE(t,e){return e()}var QE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?JE:YE;K0.useSyncExternalStore=jo.useSyncExternalStore!==void 0?jo.useSyncExternalStore:QE;q0.exports=K0;var ZE=q0.exports;/** 10 * @license React 11 * use-sync-external-store-shim/with-selector.production.min.js 12 * 13 * Copyright (c) Facebook, Inc. and its affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var $u=G,eT=ZE;function tT(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var nT=typeof Object.is=="function"?Object.is:tT,rT=eT.useSyncExternalStore,sT=$u.useRef,aT=$u.useEffect,oT=$u.useMemo,iT=$u.useDebugValue;G0.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var a=sT(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=oT(function(){function l(p){if(!u){if(u=!0,c=p,p=r(p),s!==void 0&&o.hasValue){var h=o.value;if(s(h,p))return d=h}return d=p}if(h=d,nT(c,p))return h;var m=r(p);return s!==void 0&&s(h,m)?h:(c=p,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,s]);var i=rT(t,a[0],a[1]);return aT(function(){o.hasValue=!0,o.value=i},[i]),iT(i),i};j0.exports=G0;var X0=j0.exports;/*! ***************************************************************************** 18Copyright (c) Microsoft Corporation. 19 20Permission to use, copy, modify, and/or distribute this software for any 21purpose with or without fee is hereby granted. 22 23THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 24REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 25AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 26INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 27LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 28OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 29PERFORMANCE OF THIS SOFTWARE. 30***************************************************************************** */var me=function(){return me=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},me.apply(this,arguments)};function hm(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function at(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ut(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(i){o={error:i}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Lt(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,a;r<s;
vendor: 21,765 bytes, line 30
30r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}var Et;(function(t){t.Start="xstate.start",t.Stop="xstate.stop",t.Raise="xstate.raise",t.Send="xstate.send",t.Cancel="xstate.cancel",t.NullEvent="",t.Assign="xstate.assign",t.After="xstate.after",t.DoneState="done.state",t.DoneInvoke="done.invoke",t.Log="xstate.log",t.Init="xstate.init",t.Invoke="xstate.invoke",t.ErrorExecution="error.execution",t.ErrorCommunication="error.communication",t.ErrorPlatform="error.platform",t.ErrorCustom="xstate.error",t.Update="xstate.update",t.Pure="xstate.pure",t.Choose="xstate.choose"})(Et||(Et={}));var Go;(function(t){t.Parent="#_parent",t.Internal="#_internal"})(Go||(Go={}));var th=Et.Start,mm=Et.Stop,Oc=Et.Raise,Ru=Et.Send,Y0=Et.Cancel,cT=Et.NullEvent,gm=Et.Assign;Et.After;Et.DoneState;var J0=Et.Log,lT=Et.Init,nh=Et.Invoke;Et.ErrorExecution;var Zy=Et.ErrorPlatform,uT=Et.ErrorCustom,Q0=Et.Update,dT=Et.Choose,fT=Et.Pure,Z0=".",ev={},rh="xstate.guard",pT="",fl;function ym(t,e,n){n===void 0&&(n=Z0);var r=Ji(t,n),s=Ji(e,n);return pt(s)?pt(r)?s===r:!1:pt(r)?r in s:Object.keys(r).every(function(a){return a in s?ym(r[a],s[a]):!1})}function e1(t){try{return pt(t)||typeof t=="number"?"".concat(t):t.type}catch(e){throw new Error("Events must be strings or objects with a string event.type property.")}}function sh(t,e){try{return ai(t)?t:t.toString().split(e)}catch(n){throw new Error("'".concat(t,"' is not a valid state path."))}}function hT(t){return typeof t=="object"&&"value"in t&&"context"in t&&"event"in t&&"_event"in t}function Ji(t,e){if(hT(t))return t.value;if(ai(t))return Gl(t);if(typeof t!="string")return t;var n=sh(t,e);return Gl(n)}function Gl(t){if(t.length===1)return t[0];for(var e={},n=e,r=0;r<t.length-1;r++)r===t.length-2?n[t[r]]=t[r+1]:(n[t[r]]={},n=n[t[r]]);return e}function Bi(t,e){for(var n={},r=Object.keys(t),s=0;s<r.length;s++){var a=r[s];n[a]=e(t[a],a,t,s)}return n}function tv(t,e,n){var r,s,a={};try{for(var o=at(Object.keys(t)),i=o.next();!i.done;i=o.next()){var l=i.value,u=t[l];n(u)&&(a[l]=e(u,l,t))}}catch(c){r={error:c}}finally{try{i&&!i.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}return a}var mT=function(t){return function(e){var n,r,s=e;try{for(var a=at(t),o=a.next();!o.done;o=a.next()){var i=o.value;s=s[i]}}catch(l){n={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return s}};function gT(t,e){return function(n){var r,s,a=n;try{for(var o=at(t),i=o.next();!i.done;i=o.next()){var l=i.value;a=a[e][l]}}catch(u){r={error:u}}finally{try{i&&!i.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}return a}}function Cl(t){if(!t)return[[]];if(pt(t))return[[t]];var e=qt(Object.keys(t).map(function(n){var r=t[n];return typeof r!="string"&&(!r||!Object.keys(r).length)?[[n]]:Cl(t[n]).map(function(s){return[n].concat(s)})}));return e}function qt(t){var e;return(e=[]).concat.apply(e,Lt([],ut(t),!1))}function t1(t){return ai(t)?t:[t]}function Ar(t){return t===void 0?[]:t1(t)}function ql(t,e,n){var r,s;if(ht(t))return t(e,n.data);var a={};try{for(var o=at(Object.keys(t)),i=o.next();!i.done;i=o.next()){var l=i.value,u=t[l];ht(u)?a[l]=u(e,n.data):a[l]=u}}catch(c){r={error:c}}finally{try{i&&!i.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}return a}function yT(t){return/^(done|error)\./.test(t)}function nv(t){return!!(t instanceof Promise||t!==null&&(ht(t)||typeof t=="object")&&ht(t.then))}function vT(t){return t!==null&&typeof t=="object"&&"transition"in t&&typeof t.transition=="function"}function bT(t,e){var n,r,s=ut([[],[]],2),a=s[0],o=s[1];try{for(var i=at(t),l=i.next();!l.done;l=i.next()){var u=l.value;e(u)?a.push(u):o.push(u)}}catch(c){n={error:c}}finally{try{l&&!l.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return[a,o]}function n1(t,e){return Bi(t.states,function(n,r){if(n){var s=(pt(e)?void 0:e[r])||(n?n.current:void 0);if(s)return{current:s,states:n1(n,s)}}})}function wT(t,e){return{current:e,states:n1(t,e)}}function rv(t,e,n,r){var s=t&&n.reduce(function(a,o){var i,l,u=o.assignment,c={state:r,action:o,_event:e},d={};if(ht(u))d=u(a,e.data,c);else try{for(var f=at(Object.keys(u)),p=f.next();!p.done;p=f.next()){var h=p.value,m=u[h];d[h]=ht(m)?m(a,e.data,c):m}}catch(g){i={error:g}}finally{try{p&&!p.done&&(l=f.return)&&l.call(f)}finally{if(i)throw i.error}}return Object.assign({},a,d)},t);return s}var ST=function(){};function ai(t){return Array.isArray(t)}function ht(t){return typeof t=="function"}function pt(t){return typeof t=="string"}function r1(t,e){if(t)return pt(t)?{type:rh,name:t,predicate:e?e[t]:void 0}:ht(t)?{type:rh,name:t.name,predicate:t}:t}function xT(t){try{return"subscribe"in t&&ht(t.subscribe)}catch(e){return!1}}var Hs=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();fl={},fl[Hs]=function(){return this},fl[Symbol.observable]=function(){return this};function qo(t){return!!t&&"__xstatenode"in t}function _T(t){return!!t&&typeof t.send=="function"}var IT=function(){var t=0;return function(){return t++,t.toString(16)}}();function Du(t,e){return pt(t)||typeof t=="number"?me({type:t},e):t}function wn(t,e){if(!pt(t)&&"$$type"in t&&t.$$type==="scxml")return t;var n=Du(t);return me({name:n.type,data:n,$$type:"scxml",type:"external"},e)}function wo(t,e){var n=t1(e).map(function(r){return typeof r>"u"||typeof r=="string"||qo(r)?{target:r,event:t}:me(me({},r),{event:t})});return n}function kT(t){if(!(t===void 0||t===pT))return Ar(t)}function s1(t,e,n,r,s){var a=t.options.guards,o={state:s,cond:e,_event:r};if(e.type===rh)return((a==null?void 0:a[e.name])||e.predicate)(n,r.data,o);var i=a==null?void 0:a[e.type];if(!i)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(t.id,"'."));return i(n,r.data,o)}function a1(t){return typeof t=="string"?{type:t}:t}function Qi(t,e,n){var r=function(){},s=typeof t=="object",a=s?t:null;return{next:((s?t.next:t)||r).bind(a),error:((s?t.error:e)||r).bind(a),complete:((s?t.complete:n)||r).bind(a)}}function pl(t,e){return"".concat(t,":invocation[").concat(e,"]")}function ah(t){return(t.type===Oc||t.type===Ru&&t.to===Go.Internal)&&typeof t.delay!="number"}var Bo=wn({type:lT});function oh(t,e){return e&&e[t]||void 0}function fc(t,e){var n;if(pt(t)||typeof t=="number"){var r=oh(t,e);ht(r)?n={type:t,exec:r}:r?n=r:n={type:t,exec:void 0}}else if(ht(t))n={type:t.name||t.toString(),exec:t};else{var r=oh(t.type,e);if(ht(r))n=me(me({},t),{exec:r});else if(r){var s=r.type||t.type;n=me(me(me({},r),t),{type:s})}else n=t}return n}var Us=function(t,e){if(!t)return[];var n=ai(t)?t:[t];return n.map(function(r){return fc(r,e)})};function vm(t){var e=fc(t);return me(me({id:pt(t)?t:e.id},e),{type:e.type})}function ET(t,e){return{type:Oc,event:typeof t=="function"?t:Du(t),delay:e?e.delay:void 0,id:e==null?void 0:e.id}}function TT(t,e,n,r){var s={_event:n},a=wn(ht(t.event)?t.event(e,n.data,s):t.event),o;if(pt(t.delay)){var i=r&&r[t.delay];o=ht(i)?i(e,n.data,s):i}else o=ht(t.delay)?t.delay(e,n.data,s):t.delay;return me(me({},t),{type:Oc,_event:a,delay:o})}function Nl(t,e){return{to:e?e.to:void 0,type:Ru,event:ht(t)?t:Du(t),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:ht(t)?t.name:e1(t)}}function CT(t,e,n,r){var s={_event:n},a=wn(ht(t.event)?t.event(e,n.data,s):t.event),o;if(pt(t.delay)){var i=r&&r[t.delay];o=ht(i)?i(e,n.data,s):i}else o=ht(t.delay)?t.delay(e,n.data,s):t.delay;var l=ht(t.to)?t.to(e,n.data,s):t.to;return me(me({},t),{to:l,_event:a,event:a.data,delay:o})}var NT=function(t,e,n){return me(me({},t),{value:pt(t.expr)?t.expr:t.expr(e,n.data,{_event:n})})},Al=function(t){return{type:Y0,sendId:t}};function AT(t){var e=vm(t);return{type:Et.Start,activity:e,exec:void 0}}function $T(t){var e=ht(t)?t:vm(t);return{type:Et.Stop,activity:e,exec:void 0}}function RT(t,e,n){var r=ht(t.activity)?t.activity(e,n.data):t.activity,s=typeof r=="string"?{id:r}:r,a={type:Et.Stop,activity:s};return a}var DT=function(t){return{type:gm,assignment:t}};function FT(t,e){var n=e?"#".concat(e):"";return"".concat(Et.After,"(").concat(t,")").concat(n)}function hl(t,e){var n="".concat(Et.DoneState,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function $l(t,e){var n="".concat(Et.DoneInvoke,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}function Li(t,e){var n="".concat(Et.ErrorPlatform,".").concat(t),r={type:n,data:e};return r.toString=function(){return n},r}var MT=function(t){var e,n,r=[];try{for(var s=at(t),a=s.next();!a.done;a=s.next())for(var o=a.value,i=0;i<o.actions.length;){if(o.actions[i].type===gm){r.push(o.actions[i]),o.actions.splice(i,1);continue}i++}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r};function Kl(t,e,n,r,s,a,o){o===void 0&&(o=!1);var i=o?[]:MT(s),l=i.length?rv(n,r,i,e):n,u=o?[n]:void 0,c=[];function d(h,m){var g;switch(m.type){case Oc:{var v=TT(m,l,r,t.options.delays);return a&&typeof v.delay=="number"&&a(v,l,r),v}case Ru:var b=CT(m,l,r,t.options.delays);return a&&b.to!==Go.Internal&&(h==="entry"?c.push(b):a(b,l,r)),b;case J0:{var w=NT(m,l,r);return a==null||a(w,l,r),w}case dT:{var S=m,I=(g=S.conds.find(function(X){var Q=r1(X.cond,t.options.guards);return!Q||s1(t,Q,l,r,a?void 0:e)}))===null||g===void 0?void 0:g.actions;if(!I)return[];var E=ut(Kl(t,e,l,r,[{type:h,actions:Us(Ar(I),t.options.actions)}],a,o),2),T=E[0],D=E[1];return l=D,u==null||u.push(l),T}case fT:{var I=m.get(l,r.data);if(!I)return[];var R=ut(Kl(t,e,l,r,[{type:h,actions:Us(Ar(I),t.options.actions)}],a,o),2),$=R[0],M=R[1];return l=M,u==null||u.push(l),$}case mm:{var w=RT(m,l,r);return a==null||a(w,n,r),w}case gm:{l=rv(l,r,[m],a?void 0:e),u==null||u.push(l);break}default:var B=fc(m,t.options.actions),z=B.exec;if(a)a(B,l,r);else if(z&&u){var H=u.length-1,V=me(me({},B),{exec:function(X){for(var Q=[],K=1;K<arguments.length;K++)Q[K-1]=arguments[K];z.apply(void 0,Lt([u[H]],ut(Q),!1))}});B=V}return B}}function f(h){var m,g,v=[];try{for(var b=at(h.actions),w=b.next();!w.done;w=b.next()){var S=w.value,I=d(h.type,S);I&&(v=v.concat(I))}}catch(E){m={error:E}}finally{try{w&&!w.done&&(g=b.return)&&g.call(b)}finally{if(m)throw m.error}}return c.forEach(function(E){a(E,l,r)}),c.length=0,v}var p=qt(s.map(f));return[p,l]}var Xl=[],Eo=function(t,e){Xl.push(t);var n=e(t);return Xl.pop(),n},OT=function(t){return t(Xl[Xl.length-1])};function o1(t){var e;return e={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:t}}},e[Hs]=function(){return this},e}function PT(t,e,n,r){var s,a=a1(t.src),o=(s=e==null?void 0:e.options.services)===null||s===void 0?void 0:s[a.type],i=t.data?ql(t.data,n,r):void 0,l=o?bm(o,t.id,i):o1(t.id);return l.meta=t,l}function bm(t,e,n){var r=o1(e);if(r.deferred=!0,qo(t)){var s=r.state=Eo(void 0,function(){return(n?t.withContext(n):t).initialState});r.getSnapshot=function(){return s}}return r}function BT(t){try{return typeof t.send=="function"}catch(e){return!1}}function LT(t){return BT(t)&&"id"in t}function WT(t){var e;return me((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[Hs]=function(){return this},e),t)}var Yl=function(t){return t.type==="atomic"||t.type==="final"};function i1(t){return Object.keys(t.states).map(function(e){return t.states[e]})}function pc(t){return i1(t).filter(function(e){return e.type!=="history"})}function c1(t){var e=[t];return Yl(t)?e:e.concat(qt(pc(t).map(c1)))}function Wi(t,e){var n,r,s,a,o,i,l,u,c=new Set(t),d=ih(c),f=new Set(e);try{for(var p=at(f),h=p.next();!h.done;h=p.next())for(var m=h.value,g=m.parent;g&&!f.has(g);)f.add(g),g=g.parent}catch(R){n={error:R}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}var v=ih(f);try{for(var b=at(f),w=b.next();!w.done;w=b.next()){var m=w.value;if(m.type==="compound"&&(!v.get(m)||!v.get(m).length))d.get(m)?d.get(m).forEach(function($){return f.add($)}):m.initialStateNodes.forEach(function($){return f.add($)});else if(m.type==="parallel")try{for(var S=(o=void 0,at(pc(m))),I=S.next();!I.done;I=S.next()){var E=I.value;f.has(E)||(f.add(E),d.get(E)?d.get(E).forEach(function($){return f.add($)}):E.initialStateNodes.forEach(function($){return f.add($)}))}}catch($){o={error:$}}finally{try{I&&!I.done&&(i=S.return)&&i.call(S)}finally{if(o)throw o.error}}}}catch(R){s={error:R}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}try{for(var T=at(f),D=T.next();!D.done;D=T.next())for(var m=D.value,g=m.parent;g&&!f.has(g);)f.add(g),g=g.parent}catch(R){l={error:R}}finally{try{D&&!D.done&&(u=T.return)&&u.call(T)}finally{if(l)throw l.error}}return f}function l1(t,e){var n=e.get(t);if(!n)return{};if(t.type==="compound"){var r=n[0];if(r){if(Yl(r))return r.key}else return{}}var s={};return n.forEach(function(a){s[a.key]=l1(a,e)}),s}function ih(t){var e,n,r=new Map;try{for(var s=at(t),a=s.next();!a.done;a=s.next()){var o=a.value;r.has(o)||r.set(o,[]),o.parent&&(r.has(o.parent)||r.set(o.parent,[]),r.get(o.parent).push(o))}}catch(i){e={error:i}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}function zT(t,e){var n=Wi([t],e);return l1(t,ih(n))}function zi(t,e){return Array.isArray(t)?t.some(function(n){return n===e}):t instanceof Set?t.has(e):!1}function HT(t){return Lt([],ut(new Set(qt(Lt([],ut(t.map(function(e){return e.ownEvents})),!1)))),!1)}function Rl(t,e){return e.type==="compound"?pc(e).some(function(n){return n.type==="final"&&zi(t,n)}):e.type==="parallel"?pc(e).every(function(n){return Rl(t,n)}):!1}function UT(t){return t===void 0&&(t=[]),t.reduce(function(e,n){return n.meta!==void 0&&(e[n.id]=n.meta),e},{})}function sv(t){return new Set(qt(t.map(function(e){return e.tags})))}function u1(t,e){if(t===e)return!0;if(t===void 0||e===void 0)return!1;if(pt(t)||pt(e))return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(s){return u1(t[s],e[s])})}function VT(t){return typeof t!="object"||t===null?!1:"value"in t&&"_event"in t}function jT(t,e){var n=t.exec,r=me(me({},t),{exec:n!==void 0?function(){return n(e.context,e.event,{action:t,state:e,_event:e._event})}:void 0});return r}var $r=function(){function t(e){var n=this,r;this.actions=[],this.activities=ev,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||ev,this.meta=UT(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(r=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&r!==void 0?r:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return HT(n.configuration)}})}return t.from=function(e,n){if(e instanceof t)return e.context!==n?new t({value:e.value,context:n,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var r=Bo;return new t({value:e,context:n,_event:r,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},t.create=function(e){return new t(e)},t.inert=function(e,n){if(e instanceof t){if(!e.actions.length)return e;var r=Bo;return new t({value:e.value,context:n,_event:r,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return t.from(e,n)},t.prototype.toStrings=function(e,n){var r=this;if(e===void 0&&(e=this.value),n===void 0&&(n="."),pt(e))return[e];var s=Object.keys(e);return s.concat.apply(s,Lt([],ut(s.map(function(a){return r.toStrings(e[a],n).map(function(o){return a+n+o})})),!1))},t.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var n=e.tags;e.machine;var r=hm(e,["configuration","transitions","tags","machine"]);return me(me({},r),{tags:Array.from(n)})},t.prototype.matches=function(e){return ym(e,this.value)},t.prototype.hasTag=function(e){return this.tags.has(e)},t.prototype.can=function(e){var n;ST(!!this.machine);var r=(n=this.machine)===null||n===void 0?void 0:n.getTransitionData(this,e);return!!(r!=null&&r.transitions.length)&&r.transitions.some(function(s){return s.target!==void 0||s.actions.length})},t}(),GT={deferEvents:!1},av=function(){function t(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=me(me({},GT),e)}return t.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},t.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},t.prototype.clear=function(){this.queue=[]},t.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},t.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(n){throw this.clear(),n}finally{this.processingEvent=!1}},t}(),gp=new Map,qT=0,Ci={bookId:function(){return"x:".concat(qT++)},register:function(t,e){return gp.set(t,e),t},get:function(t){return gp.get(t)},free:function(t){gp.delete(t)}};function wm(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function KT(){var t=wm();if(t&&"__xstate__"in t)return t.__xstate__}function XT(t){if(wm()){var e=KT();e&&e.register(t)}}function YT(t,e){e===void 0&&(e={});var n=t.initialState,r=new Set,s=[],a=!1,o=function(){if(!a){for(a=!0;s.length>0;){var u=s.shift();n=t.transition(n,u,l),r.forEach(function(c){return c.next(n)})}a=!1}},i=WT({id:e.id,send:function(u){s.push(u),o()},getSnapshot:function(){return n},subscribe:function(u,c,d){var f=Qi(u,c,d);return r.add(f),f.next(n),{unsubscribe:function(){r.delete(f)}}}}),l={parent:e.parent,self:i,id:e.id||"anonymous",observers:r};return n=t.start?t.start(l):n,i}var ch={sync:!1,autoForward:!1},an;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(an||(an={}));var JT=function(){function t(e,n){n===void 0&&(n=t.defaultOptions);var r=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=an.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(c,d){if(ai(c))return r.batch(c),r.state;var f=wn(Du(c,d));if(r.status===an.Stopped)return r.state;if(r.status!==an.Running&&!r.options.deferEvents)throw new Error('Event "'.concat(f.name,'" was sent to uninitialized service "').concat(r.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(f.data)));return r.scheduler.schedule(function(){r.forward(f);var p=r._nextState(f);r.update(p,f)}),r._state},this.sendTo=function(c,d,f){var p=r.parent&&(d===Go.Parent||r.parent.id===d),h=p?r.parent:pt(d)?d===Go.Internal?r:r.children.get(d)||Ci.get(d):_T(d)?d:void 0;if(!h){if(!p)throw new Error("Unable to send event to child '".concat(d,"' from service '").concat(r.id,"'."));return}if("machine"in h){if(r.status!==an.Stopped||r.parent!==h||r.state.done){var m=me(me({},c),{name:c.name===uT?"".concat(Li(r.id)):c.name,origin:r.sessionId});!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([h,m]):h.send(m)}}else!f&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([h,c.data]):h.send(c.data)},this._exec=function(c,d,f,p){p===void 0&&(p=r.machine.options.actions);var h=c.exec||oh(c.type,p),m=ht(h)?h:h?h.exec:c.exec;if(m)try{return m(d,f.data,r.machine.config.predictableActionArguments?{action:c,_event:f}:{action:c,state:r.state,_event:f})}catch(H){throw r.parent&&r.parent.send({type:"xstate.error",data:H}),H}switch(c.type){case Oc:{var g=c;r.defer(g);break}case Ru:var v=c;if(typeof v.delay=="number"){r.defer(v);return}else v.to?r.sendTo(v._event,v.to,f===Bo):r.send(v._event);break;case Y0:r.cancel(c.sendId);break;case th:{if(r.status!==an.Running)return;var b=c.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[b.id||b.type])break;if(b.type===Et.Invoke){var w=a1(b.src),S=r.machine.options.services?r.machine.options.services[w.type]:void 0,I=b.id,E=b.data,T="autoForward"in b?b.autoForward:!!b.forward;if(!S)return;var D=E?ql(E,d,f):void 0;if(typeof S=="string")return;var R=ht(S)?S(d,f.data,{data:D,src:w,meta:b.meta}):S;if(!R)return;var $=void 0;qo(R)&&(R=D?R.withContext(D):R,$={autoForward:T}),r.spawn(R,I,$)}else r.spawnActivity(b);break}case mm:{r.stopChild(c.activity.id);break}case J0:var M=c,B=M.label,z=M.value;B?r.logger(B,z):r.logger(z);break}};var s=me(me({},t.defaultOptions),n),a=s.clock,o=s.logger,i=s.parent,l=s.id,u=l!==void 0?l:e.id;this.id=u,this.logger=o,this.clock=a,this.parent=i,this.options=s,this.scheduler=new av({deferEvents:this.options.deferEvents}),this.sessionId=Ci.bookId()}return Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:Eo(this,function(){return e._initialState=e.machine.initialState,e._initialState})}
30,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.execute=function(e,n){var r,s;try{for(var a=at(e.actions),o=a.next();!o.done;o=a.next()){var i=o.value;this.exec(i,e,n)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(e,n){var r,s,a,o,i,l,u,c,d=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||n===Bo)&&this.options.execute)this.execute(this.state);else for(var f=void 0;f=this._outgoingQueue.shift();)f[0].send(f[1]);if(this.children.forEach(function(R){d.state.children[R.id]=R}),this.devTools&&this.devTools.send(n.data,e),e.event)try{for(var p=at(this.eventListeners),h=p.next();!h.done;h=p.next()){var m=h.value;m(e.event)}}catch(R){r={error:R}}finally{try{h&&!h.done&&(s=p.return)&&s.call(p)}finally{if(r)throw r.error}}try{for(var g=at(this.listeners),v=g.next();!v.done;v=g.next()){var m=v.value;m(e,e.event)}}catch(R){a={error:R}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}try{for(var b=at(this.contextListeners),w=b.next();!w.done;w=b.next()){var S=w.value;S(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(R){i={error:R}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(i)throw i.error}}if(this.state.done){var I=e.configuration.find(function(R){return R.type==="final"&&R.parent===d.machine}),E=I&&I.doneData?ql(I.doneData,e.context,n):void 0;this._doneEvent=$l(this.id,E);try{for(var T=at(this.doneListeners),D=T.next();!D.done;D=T.next()){var m=D.value;m(this._doneEvent)}}catch(R){u={error:R}}finally{try{D&&!D.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}this._stop(),this._stopChildren(),Ci.free(this.sessionId)}},t.prototype.onTransition=function(e){return this.listeners.add(e),this.status===an.Running&&e(this.state,this.state.event),this},t.prototype.subscribe=function(e,n,r){var s=this,a=Qi(e,n,r);this.listeners.add(a.next),this.status!==an.NotStarted&&a.next(this.state);var o=function(){s.doneListeners.delete(o),s.stopListeners.delete(o),a.complete()};return this.status===an.Stopped?a.complete():(this.onDone(o),this.onStop(o)),{unsubscribe:function(){s.listeners.delete(a.next),s.doneListeners.delete(o),s.stopListeners.delete(o)}}},t.prototype.onEvent=function(e){return this.eventListeners.add(e),this},t.prototype.onSend=function(e){return this.sendListeners.add(e),this},t.prototype.onChange=function(e){return this.contextListeners.add(e),this},t.prototype.onStop=function(e){return this.stopListeners.add(e),this},t.prototype.onDone=function(e){return this.status===an.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},t.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},t.prototype.start=function(e){var n=this;if(this.status===an.Running)return this;this.machine._init(),Ci.register(this.sessionId,this),this.initialized=!0,this.status=an.Running;var r=e===void 0?this.initialState:Eo(this,function(){return VT(e)?n.machine.resolveState(e):n.machine.resolveState($r.from(e,n.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){n.update(r,Bo)}),this},t.prototype._stopChildren=function(){this.children.forEach(function(e){ht(e.stop)&&e.stop()}),this.children.clear()},t.prototype._stop=function(){var e,n,r,s,a,o,i,l,u,c;try{for(var d=at(this.listeners),f=d.next();!f.done;f=d.next()){var p=f.value;this.listeners.delete(p)}}catch(T){e={error:T}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}try{for(var h=at(this.stopListeners),m=h.next();!m.done;m=h.next()){var p=m.value;p(),this.stopListeners.delete(p)}}catch(T){r={error:T}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}try{for(var g=at(this.contextListeners),v=g.next();!v.done;v=g.next()){var p=v.value;this.contextListeners.delete(p)}}catch(T){a={error:T}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}try{for(var b=at(this.doneListeners),w=b.next();!w.done;w=b.next()){var p=w.value;this.doneListeners.delete(p)}}catch(T){i={error:T}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(i)throw i.error}}if(!this.initialized)return this;this.initialized=!1,this.status=an.Stopped,this._initialState=void 0;try{for(var S=at(Object.keys(this.delayedEventsMap)),I=S.next();!I.done;I=S.next()){var E=I.value;this.clock.clearTimeout(this.delayedEventsMap[E])}}catch(T){u={error:T}}finally{try{I&&!I.done&&(c=S.return)&&c.call(S)}finally{if(u)throw u.error}}
30this.scheduler.clear(),this.scheduler=new av({deferEvents:this.options.deferEvents})},t.prototype.stop=function(){var e=this,n=this.scheduler;return this._stop(),n.schedule(function(){var r;if(!(!((r=e._state)===null||r===void 0)&&r.done)){var s=wn({type:"xstate.stop"}),a=Eo(e,function(){var o=qt(Lt([],ut(e.state.configuration),!1).sort(function(d,f){return f.order-d.order}).map(function(d){return Us(d.onExit,e.machine.options.actions)})),i=ut(Kl(e.machine,e.state,e.state.context,s,[{type:"exit",actions:o}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),l=i[0],u=i[1],c=new $r({value:e.state.value,context:u,_event:s,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:l.filter(function(d){return!ah(d)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return c.changed=!0,c});e.update(a,s),e._stopChildren(),Ci.free(e.sessionId)}}),this},t.prototype.batch=function(e){var n=this;if(!(this.status===an.NotStarted&&this.options.deferEvents)){if(this.status!==an.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'))}if(e.length){var r=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var s,a,o=n.state,i=!1,l=[],u=function(p){var h=wn(p);n.forward(h),o=Eo(n,function(){return n.machine.transition(o,h,void 0,r||void 0)}),l.push.apply(l,Lt([],ut(n.machine.config.predictableActionArguments?o.actions:o.actions.map(function(m){return jT(m,o)})),!1)),i=i||!!o.changed};try{for(var c=at(e),d=c.next();!d.done;d=c.next()){var f=d.value;u(f)}}catch(p){s={error:p}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(s)throw s.error}}o.changed=i,o.actions=l,n.update(o,wn(e[e.length-1]))})}},t.prototype.sender=function(e){return this.send.bind(this,e)},t.prototype._nextState=function(e,n){var r=this;n===void 0&&(n=!!this.machine.config.predictableActionArguments&&this._exec);var s=wn(e);if(s.name.indexOf(Zy)===0&&!this.state.nextEvents.some(function(o){return o.indexOf(Zy)===0}))throw s.data.data;var a=Eo(this,function(){return r.machine.transition(r.state,s,void 0,n||void 0)});return a},t.prototype.nextState=function(e){return this._nextState(e,!1)},t.prototype.forward=function(e){var n,r;try{for(var s=at(this.forwardTo),a=s.next();!a.done;a=s.next()){var o=a.value,i=this.children.get(o);if(!i)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));i.send(e)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},t.prototype.defer=function(e){var n=this,r=this.clock.setTimeout(function(){"to"in e&&e.to?n.sendTo(e._event,e.to,!0):n.send(e._event)},e.delay);e.id&&(this.delayedEventsMap[e.id]=r)},t.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},t.prototype.exec=function(e,n,r){r===void 0&&(r=this.machine.options.actions),this._exec(e,n.context,n._event,r)},t.prototype.removeChild=function(e){var n;this.children.delete(e),this.forwardTo.delete(e),(n=this.state)===null||n===void 0||delete n.children[e]},t.prototype.stopChild=function(e){var n=this.children.get(e);n&&(this.removeChild(e),ht(n.stop)&&n.stop())},t.prototype.spawn=function(e,n,r){if(this.status!==an.Running)return bm(e,n);if(nv(e))return this.spawnPromise(Promise.resolve(e),n);if(ht(e))return this.spawnCallback(e,n);if(LT(e))return this.spawnActor(e,n);if(xT(e))return this.spawnObservable(e,n);if(qo(e))return this.spawnMachine(e,me(me({},r),{id:n}));if(vT(e))return this.spawnBehavior(e,n);throw new Error('Unable to spawn entity "'.concat(n,'" of type "').concat(typeof e,'".'))},t.prototype.spawnMachine=function(e,n){var r=this;n===void 0&&(n={});var s=new t(e,me(me({},this.options),{parent:this,id:n.id||e.id})),a=me(me({},ch),n);a.sync&&s.onTransition(function(i){r.send(Q0,{state:i,id:s.id})});var o=s;return this.children.set(s.id,o),a.autoForward&&this.forwardTo.add(s.id),s.onDone(function(i){r.removeChild(s.id),r.send(wn(i,{origin:s.id}))}).start(),o},t.prototype.spawnBehavior=function(e,n){var r=YT(e,{id:n,parent:this});return this.children.set(n,r),r}
30,t.prototype.spawnPromise=function(e,n){var r,s=this,a=!1,o;e.then(function(l){a||(o=l,s.removeChild(n),s.send(wn($l(n,l),{origin:n})))},function(l){if(!a){s.removeChild(n);var u=Li(n,l);try{s.send(wn(u,{origin:n}))}catch(c){s.devTools&&s.devTools.send(u,s.state),s.machine.strict&&s.stop()}}});var i=(r={id:n,send:function(){},subscribe:function(l,u,c){var d=Qi(l,u,c),f=!1;return e.then(function(p){f||(d.next(p),!f&&d.complete())},function(p){f||d.error(p)}),{unsubscribe:function(){return f=!0}}},stop:function(){a=!0},toJSON:function(){return{id:n}},getSnapshot:function(){return o}},r[Hs]=function(){return this},r);return this.children.set(n,i),i},t.prototype.spawnCallback=function(e,n){var r,s=this,a=!1,o=new Set,i=new Set,l,u=function(f){l=f,i.forEach(function(p){return p(f)}),!a&&s.send(wn(f,{origin:n}))},c;try{c=e(u,function(f){o.add(f)})}catch(f){this.send(Li(n,f))}if(nv(c))return this.spawnPromise(c,n);var d=(r={id:n,send:function(f){return o.forEach(function(p){return p(f)})},subscribe:function(f){var p=Qi(f);return i.add(p.next),{unsubscribe:function(){i.delete(p.next)}}},stop:function(){a=!0,ht(c)&&c()},toJSON:function(){return{id:n}},getSnapshot:function(){return l}},r[Hs]=function(){return this},r);return this.children.set(n,d),d},t.prototype.spawnObservable=function(e,n){var r,s=this,a,o=e.subscribe(function(l){a=l,s.send(wn(l,{origin:n}))},function(l){s.removeChild(n),s.send(wn(Li(n,l),{origin:n}))},function(){s.removeChild(n),s.send(wn($l(n),{origin:n}))}),i=(r={id:n,send:function(){},subscribe:function(l,u,c){return e.subscribe(l,u,c)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return a},toJSON:function(){return{id:n}}},r[Hs]=function(){return this},r);return this.children.set(n,i),i},t.prototype.spawnActor=function(e,n){return this.children.set(n,e),e},t.prototype.spawnActivity=function(e){var n=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(n){var r=n(this.state.context,e);this.spawnEffect(e.id,r)}},t.prototype.spawnEffect=function(e,n){var r;this.children.set(e,(r={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:n||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},r[Hs]=function(){return this},r))},t.prototype.attachDev=function(){var e=wm();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var n=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(me(me({name:this.id,autoPause:!0,stateSanitizer:function(r){return{value:r.value,context:r.context,actions:r.actions}}},n),{features:me({jump:!1,skip:!1},n?n.features:void 0)}),this.machine),this.devTools.init(this.state)}XT(this)}},t.prototype.toJSON=function(){return{id:this.id}},t.prototype[Hs]=function(){return this},t.prototype.getSnapshot=function(){return this.status===an.NotStarted?this.initialState:this._state},t.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,n){return setTimeout(e,n)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},t.interpret=d1,t}(),QT=function(t){return pt(t)?me(me({},ch),{name:t}):me(me(me({},ch),{name:IT()}),t)};function ZT(t,e){var n=QT(e);return OT(function(r){return r?r.spawn(t,n.name,n):bm(t,n.name)})}function d1(t,e){var n=new JT(t,e);return n}function eC(t){if(typeof t=="string"){var e={type:t};return e.toString=function(){return t},e}return t}function ml(t){return me(me({type:nh},t),{toJSON:function(){t.onDone,t.onError;var e=hm(t,["onDone","onError"]);return me(me({},e),{type:nh,src:eC(t.src)})}})}var gl="",lh="#",yp="*",So={},xo=function(t){return t[0]===lh},tC=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},nC=function(){function t(e,n,r,s){r===void 0&&(r="context"in e?e.context:void 0);var a=this,o;this.config=e,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(tC(),n),this.parent=s==null?void 0:s.parent,this.key=this.config.key||(s==null?void 0:s.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Z0),this.id=this.config.id||Lt([this.machine.key],ut(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,this.initial=this.config.initial,this.states=this.config.states?Bi(this.config.states,function(u,c){var d,f=new t(u,{},void 0,{parent:a,key:c});return Object.assign(a.idMap,me((d={},d[f.id]=f,d),f.idMap)),f}):So;var i=0;function l(u){var c,d;u.order=i++;try{for(var f=at(i1(u)),p=f.next();!p.done;p=f.next()){var h=p.value;l(h)}}catch(m){c={error:m}}finally{try{p&&!p.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}}l(this),this.history=this.config.history===!0?"shallow":this.config.history||
vendor: 18,750 bytes, line 30
30!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(u){var c=u.event;return c===gl}):gl in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=Ar(this.config.entry||this.config.onEntry).map(function(u){return fc(u)}),this.onExit=Ar(this.config.exit||this.config.onExit).map(function(u){return fc(u)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=Ar(this.config.invoke).map(function(u,c){var d,f;if(qo(u)){var p=pl(a.id,c);return a.machine.options.services=me((d={},d[p]=u,d),a.machine.options.services),ml({src:p,id:p})}else if(pt(u.src)){var p=u.id||pl(a.id,c);return ml(me(me({},u),{id:p,src:u.src}))}else if(qo(u.src)||ht(u.src)){var p=u.id||pl(a.id,c);return a.machine.options.services=me((f={},f[p]=u.src,f),a.machine.options.services),ml(me(me({id:p},u),{src:p}))}else{var h=u.src;return ml(me(me({id:pl(a.id,c)},u),{src:h}))}}),this.activities=Ar(this.config.activities).concat(this.invoke).map(function(u){return vm(u)}),this.transition=this.transition.bind(this),this.tags=Ar(this.config.tags)}return t.prototype._init=function(){this.__cache.transitions||c1(this).forEach(function(e){return e.on})},t.prototype.withConfig=function(e,n){var r=this.options,s=r.actions,a=r.activities,o=r.guards,i=r.services,l=r.delays;return new t(this.config,{actions:me(me({},s),e.actions),activities:me(me({},a),e.activities),guards:me(me({},o),e.guards),services:me(me({},i),e.services),delays:me(me({},l),e.delays)},n!=null?n:this.context)},t.prototype.withContext=function(e){return new t(this.config,this.options,e)},Object.defineProperty(t.prototype,"context",{get:function(){return ht(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Bi(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return this.definition},Object.defineProperty(t.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(n,r){return n[r.eventType]=n[r.eventType]||[],n[r.eventType].push(r),n},{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),t.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var n=e===gl,r=this.transitions.filter(function(s){var a=s.eventType===e;return n?a:a||s.eventType===yp});return this.__cache.candidates[e]=r,r},t.prototype.getDelayedTransitions=function(){var e=this,n=this.config.after;if(!n)return[];var r=function(a,o){var i=ht(a)?"".concat(e.id,":delay[").concat(o,"]"):a,l=FT(i,e.id);return e.onEntry.push(Nl(l,{delay:a})),e.onExit.push(Al(l)),l},s=ai(n)?n.map(function(a,o){var i=r(a.delay,o);return me(me({},a),{event:i})}):qt(Object.keys(n).map(function(a,o){var i=n[a],l=pt(i)?{target:i}:i,u=isNaN(+a)?a:+a,c=r(u,o);return Ar(l).map(function(d){return me(me({},d),{event:c,delay:u})})}));return s.map(function(a){var o=a.delay;return me(me({},e.formatTransition(a)),{delay:o})})},t.prototype.getStateNodes=function(e){var n,r=this;if(!e)return[];var s=e instanceof $r?e.value:Ji(e,this.delimiter);if(pt(s)){var a=this.getStateNode(s).initial;return a!==void 0?this.getStateNodes((n={},n[s]=a,n)):[this,this.states[s]]}var o=Object.keys(s),i=[this];return i.push.apply(i,Lt([],ut(qt(o.map(function(l){return r.getStateNode(l).getStateNodes(s[l])}))),!1)),i},t.prototype.handles=function(e){var n=e1(e);return this.events.includes(n)},t.prototype.resolveState=function(e){var n=e instanceof $r?e:$r.create(e),r=Array.from(Wi([],this.getStateNodes(n.value)));return new $r(me(me({},n),{value:this.resolve(n.value),configuration:r,done:Rl(r,this),tags:sv(r),machine:this.machine}))},t.prototype.transitionLeafNode=function(e,n,r){var s=this.getStateNode(e),a=s.next(n,r);return!a||!a.transitions.length?this.next(n,r):a},t.prototype.transitionCompoundNode=function(e,n,r){var s=Object.keys(e),a=this.getStateNode(s[0]),o=a._transition(e[s[0]],n,r);return!o||!o.transitions.length?this.next(n,r):o},t.prototype.transitionParallelNode=function(e,n,r){var s,a,o={};try{for(var i=at(Object.keys(e)),l=i.next();!l.done;l=i.next()){var u=l.value,c=e[u];if(c){var d=this.getStateNode(u),f=d._transition(c,n,r);f&&(o[u]=f)}}}catch(v){s={error:v}}finally{try{l&&!l.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}var p=Object.keys(o).map(function(v){return o[v]}),h=qt(p.map(function(v){return v.transitions})),m=p.some(function(v){return v.transitions.length>0});if(!m)return this.next(n,r);var g=qt(Object.keys(o).map(function(v){return o[v].configuration}));return{transitions:h,exitSet:qt(p.map(function(v){return v.exitSet})),configuration:g,source:n,actions:qt(Object.keys(o).map(function(v){return o[v].actions}))}},t.prototype._transition=function(e,n,r){return pt(e)?this.transitionLeafNode(e,n,r):Object.keys(e).length===1?this.transitionCompoundNode(e,n,r):this.transitionParallelNode(e,n,r)},t.prototype.getTransitionData=function(e,n){return this._transition(e.value,e,wn(n))},t.prototype.next=function(e,n){var r,s,a=this,o=n.name,i=[],l=[],u;try{for(var c=at(this.getCandidates(o)),d=c.next();!d.done;d=c.next()){var f=d.value,p=f.cond,h=f.in,m=e.context,g=h?pt(h)&&xo(h)?e.matches(Ji(this.getStateNodeById(h).path,this.delimiter)):ym(Ji(h,this.delimiter),mT(this.path.slice(0,-2))(e.value)):!0,v=!1;try{v=!p||s1(this.machine,p,m,n,e)}catch(S){throw new Error("Unable to evaluate guard '".concat(p.name||p.type,"' in transition for event '").concat(o,"' in state node '").concat(this.id,"':\n").concat(S.message))}if(v&&g){f.target!==void 0&&(l=f.target),i.push.apply(i,Lt([],ut(f.actions),!1)),u=f;break}}}catch(S){r={error:S}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}if(u){if(!l.length)return{transitions:[u],exitSet:[],configuration:e.value?[this]:[],source:e,actions:i};var b=qt(l.map(function(S){return a.getRelativeStateNodes(S,e.historyValue)})),w=!!u.internal;return{transitions:[u],exitSet:w?[]:qt(l.map(function(S){return a.getPotentiallyReenteringNodes(S)})),configuration:b,source:e,actions:i}}},t.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var n=[],r=this,s=e;r&&r!==s;)n.push(r),r=r.parent;return r!==s?[]:(n.push(s),n)},t.prototype.getActions=function(e,n,r,s,a,o,i){var l,u,c,d,f=this,p=o?Wi([],this.getStateNodes(o.value)):[],h=new Set;try{for(var m=at(Array.from(e).sort(function(M,B){return M.order-B.order})),g=m.next();!g.done;g=m.next()){var v=g.value;(!zi(p,v)||zi(r.exitSet,v)||v.parent&&h.has(v.parent))&&h.add(v)}}catch(M){l={error:M}}finally{try{g&&!g.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}try{for(var b=at(p),w=b.next();!w.done;w=b.next()){var v=w.value;(!zi(e,v)||zi(r.exitSet,v.parent))&&r.exitSet.push(v)}}catch(M){c={error:M}}finally{try{w&&!w.done&&(d=b.return)&&d.call(b)}finally{if(c)throw c.error}}r.exitSet.sort(function(M,B){return B.order-M.order});var S=Array.from(h).sort(function(M,B){return M.order-B.order}),I=new Set(r.exitSet),E=qt(S.map(function(M){var B=[];if(M.type!=="final")return B;var z=M.parent;if(!z.parent)return B;B.push(hl(M.id,M.doneData),hl(z.id,M.doneData?ql(M.doneData,s,a):void 0));var H=z.parent;return H.type==="parallel"&&pc(H).every(function(V){return Rl(r.configuration,V)})&&B.push(hl(H.id)),B})),T=S.map(function(M){var B=M.onEntry,z=M.activities.map(function(H){return AT(H)});return{type:"entry",actions:Us(i?Lt(Lt([],ut(B),!1),ut(z),!1):Lt(Lt([],ut(z),!1),ut(B),!1),f.machine.options.actions)}}).concat({type:"state_done",actions:E.map(function(M){return ET(M)})}),D=Array.from(I).map(function(M){return{type:"exit",actions:Us(Lt(Lt([],ut(M.onExit),!1),ut(M.activities.map(function(B){return $T(B)})),!1),f.machine.options.actions)}}),R=D.concat({type:"transition",actions:Us(r.actions,this.machine.options.actions)}).concat(T);if(n){var $=Us(qt(Lt([],ut(e),!1).sort(function(M,B){return B.order-M.order}).map(function(M){return M.onExit})),this.machine.options.actions).filter(function(M){return!ah(M)});return R.concat({type:"stop",actions:$})}return R},t.prototype.transition=function(e,n,r,s){e===void 0&&(e=this.initialState);var a=wn(n),o;if(e instanceof $r)o=r===void 0?e:this.resolveState($r.from(e,r));else{var i=pt(e)?this.resolve(Gl(this.getResolvedPath(e))):this.resolve(e),l=r!=null?r:this.machine.context;o=this.resolveState($r.from(i,l))}if(this.strict&&!this.events.includes(a.name)&&!yT(a.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(a.name,"'"));var u=this._transition(o.value,o,a)||{transitions:[],configuration:[],exitSet:[],source:o,actions:[]},c=Wi([],this.getStateNodes(o.value)),d=u.configuration.length?Wi(c,u.configuration):c;return u.configuration=Lt([],ut(d),!1),this.resolveTransition(u,o,o.context,s,a)},t.prototype.resolveRaisedTransition=function(e,n,r,s){var a,o=e.actions;return e=this.transition(e,n,void 0,s),e._event=r,e.event=r.data,(a=e.actions).unshift.apply(a,Lt([],ut(o),!1)),e},t.prototype.resolveTransition=function(e,n,r,s,a){var o,i,l,u,c=this;a===void 0&&(a=Bo);var d=e.configuration,f=!n||e.transitions.length>0,p=f?e.configuration:n?n.configuration:[],h=Rl(p,this),m=f?zT(this.machine,d):void 0,g=n?n.historyValue?n.historyValue:e.source?this.machine.historyValue(n.value):void 0:void 0,v=this.getActions(new Set(p),h,e,r,a,n,s),b=n?me({},n.activities):{};try{for(var w=at(v),S=w.next();!S.done;S=w.next()){var I=S.value;try{for(var E=(l=void 0,at(I.actions)),T=E.next();!T.done;T=E.next()){var D=T.value;D.type===th?b[D.activity.id||D.activity.type]=D:D.type===mm&&(b[D.activity.id||D.activity.type]=!1)}}catch(oe){l={error:oe}}finally{try{T&&!T.done&&(u=E.return)&&u.call(E)}finally{if(l)throw l.error}}}}catch(oe){o={error:oe}}finally{try{S&&!S.done&&(i=w.return)&&i.call(w)}finally{if(o)throw o.error}}var R=ut(Kl(this,n,r,a,v,s,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),$=R[0],M=R[1],B=ut(bT($,ah),2),z=B[0],H=B[1],V=$.filter(function(oe){var ie;return oe.type===th&&((ie=oe.activity)===null||ie===void 0?void 0:ie.type)===nh}),X=V.reduce(function(oe,ie){return oe[ie.activity.id]=PT(ie.activity,c.machine,M,a),oe},n?me({},n.children):{}),Q=new $r({value:m||n.value,context:M,_event:a,_sessionid:n?n._sessionid:null,historyValue:m?g?wT(g,m):void 0:n?n.historyValue:void 0,history:!m||e.source?n:void 0,actions:m?H:[],activities:m?b:n?n.activities:{},events:[],configuration:p,transitions:e.transitions,children:X,done:h,tags:sv(p),machine:this}),K=r!==M;Q.changed=a.name===Q0||K;var ee=Q.history;ee&&delete ee.history;var ae=!h&&(this._transient||d.some(function(oe){return oe._transient}));if(!f&&(!ae||a.name===gl))return Q;var ne=Q;if(!h)for(ae&&(ne=this.resolveRaisedTransition(ne,{type:cT},a,s));z.length;){var ce=z.shift();ne=this.resolveRaisedTransition(ne,ce._event,a,s)}var se=ne.changed||(ee?!!ne.actions.length||K||typeof ee.value!=typeof ne.value||!u1(ne.value,ee.value):void 0);return ne.changed=se,ne.history=ee,ne},t.prototype.getStateNode=function(e){if(xo(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var n=this.states[e];if(!n)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return n},t.prototype.getStateNodeById=function(e){var n=xo(e)?e.slice(lh.length):e;if(n===this.id)return this;var r=this.machine.idMap[n];if(!r)throw new Error("Child state node '#".concat(n,"' does not exist on machine '").concat(this.id,"'"));return r},t.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&xo(e))try{return this.getStateNodeById(e.slice(1))}catch(a){}for(var n=sh(e,this.delimiter).slice(),r=this;n.length;){var s=n.shift();if(!s.length)break;r=r.getStateNode(s)}return r},t.prototype.resolve=function(e){var n,r=this;if(!e)return this.initialStateValue||So;switch(this.type){case"parallel":return Bi(this.initialStateValue,function(a,o){return a?r.getStateNode(o).resolve(e[o]||a):So});case"compound":if(pt(e)){var s=this.getStateNode(e);return s.type==="parallel"||s.type==="compound"?(n={},n[e]=s.initialStateValue,n):e}return Object.keys(e).length?Bi(e,function(a,o){return a?r.getStateNode(o).resolve(a):So}):this.initialStateValue||{};default:return e||So}},t.prototype.getResolvedPath=function(e){if(xo(e)){var n=this.machine.idMap[e.slice(lh.length)];if(!n)throw new Error("Unable to find state node '".concat(e,"'"));return n.path}return sh(e,this.delimiter)},Object.defineProperty(t.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var n;if(this.type==="parallel")n=tv(this.states,function(r){return r.initialStateValue||So},function(r){return r.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));n=Yl(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else n={};return this.__cache.initialStateValue=n,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),t.prototype.getInitialState=function(e,n){this._init();var r=this.getStateNodes(e);return this.resolveTransition({configuration:r,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,n!=null?n:this.machine.context,void 0)},Object.defineProperty(t.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){var e;if(this.type==="history"){var n=this.config;pt(n.target)?e=xo(n.target)?Gl(this.machine.getStateNodeById(n.target).path.slice(this.path.length-1)):n.target:e=n.target}return e},enumerable:!1,configurable:!0}),t.prototype.getRelativeStateNodes=function(e,n,r){return r===void 0&&(r=!0),r?e.type==="history"?e.resolveHistory(n):e.initialStateNodes:[e]},Object.defineProperty(t.prototype,"initialStateNodes",{get:function(){var e=this;if(Yl(this))return[this];if(this.type==="compound"&&!this.initial)return[this];var n=Cl(this.initialStateValue);return qt(n.map(function(r){return e.getFromRelativePath(r)}))},enumerable:!1,configurable:!0}),t.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var n=ut(e),r=n[0],s=n.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(r,"' from node with no states"));var a=this.getStateNode(r);if(a.type==="history")return a.resolveHistory();if(!this.states[r])throw new Error("Child state '".concat(r,"' does not exist on '").concat(this.id,"'"));return this.states[r].getFromRelativePath(s)},t.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:tv(this.states,function(n,r){if(!e)return n.historyValue();var s=pt(e)?void 0:e[r];return n.historyValue(s||n.initialStateValue)},function(n){return!n.history})}},t.prototype.resolveHistory=function(e){var n=this;if(this.type!=="history")return[this];var r=this.parent;if(!e){var s=this.target;return s?qt(Cl(s).map(function(o){return r.getFromRelativePath(o)})):r.initialStateNodes}var a=gT(r.path,"states")(e).current;return pt(a)?[r.getStateNode(a)]:qt(Cl(a).map(function(o){return n.history==="deep"?r.getFromRelativePath(o):[r.states[o[0]]]}))},Object.defineProperty(t.prototype,"stateIds",{get:function(){var e=this,n=qt(Object.keys(this.states).map(function(r){return e.states[r].stateIds}));return[this.id].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"events",{get:function(){var e,n,r,s;if(this.__cache.events)return this.__cache.events;var a=this.states,o=new Set(this.ownEvents);if(a)try{for(var i=at(Object.keys(a)),l=i.next();!l.done;l=i.next()){var u=l.value,c=a[u];if(c.states)try{for(var d=(r=void 0,at(c.events)),f=d.next();!f.done;f=d.next()){var p=f.value;o.add("".concat(p))}}catch(h){r={error:h}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}}catch(h){e={error:h}}finally{try{l&&!l.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(n){return!(!n.target&&!n.actions.length&&n.internal)}).map(function(n){return n.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),t.prototype.resolveTarget=function(e){var n=this;if(e!==void 0)return e.map(function(r){if(!pt(r))return r;var s=r[0]===n.delimiter;if(s&&!n.parent)return n.getStateNodeByPath(r.slice(1));var a=s?n.key+r:r;if(n.parent)try{var o=n.parent.getStateNodeByPath(a);return o}catch(i){throw new Error("Invalid transition definition for state node '".concat(n.id,"':\n").concat(i.message))}else return n.getStateNodeByPath(a)})},t.prototype.formatTransition=function(e){var n=this,r=kT(e.target),s="internal"in e?e.internal:r?r.some(function(l){return pt(l)&&l[0]===n.delimiter}):!0,a=this.machine.options.guards,o=this.resolveTarget(r),i=me(me({},e),{actions:Us(Ar(e.actions)),cond:r1(e.cond,a),target:o,source:this,internal:s,eventType:e.event,toJSON:function(){return me(me({},i),{target:i.target?i.target.map(function(l){return"#".concat(l.id)}):void 0,source:"#".concat(n.id)})}});return i},t.prototype.formatTransitions=function(){var e,n,r=this,s;if(!this.config.on)s=[];else if(Array.isArray(this.config.on))s=this.config.on;else{var a=this.config.on,o=yp,i=a[o],l=i===void 0?[]:i,u=hm(a,[typeof o=="symbol"?o:o+""]);s=qt(Object.keys(u).map(function(b){var w=wo(b,u[b]);return w}).concat(wo(yp,l)))}var c=this.config.always?wo("",this.config.always):[],d=this.config.onDone?wo(String(hl(this.id
30)),this.config.onDone):[],f=qt(this.invoke.map(function(b){var w=[];return b.onDone&&w.push.apply(w,Lt([],ut(wo(String($l(b.id)),b.onDone)),!1)),b.onError&&w.push.apply(w,Lt([],ut(wo(String(Li(b.id)),b.onError)),!1)),w})),p=this.after,h=qt(Lt(Lt(Lt(Lt([],ut(d),!1),ut(f),!1),ut(s),!1),ut(c),!1).map(function(b){return Ar(b).map(function(w){return r.formatTransition(w)})}));try{for(var m=at(p),g=m.next();!g.done;g=m.next()){var v=g.value;h.push(v)}}catch(b){e={error:b}}finally{try{g&&!g.done&&(n=m.return)&&n.call(m)}finally{if(e)throw e.error}}return h},t}();function rC(t,e){return new nC(t,e)}var wt=DT;function uh(t){var e=G.useRef();return e.current||(e.current={v:t()}),e.current.v}var Jl=globalThis&&globalThis.__assign||function(){return Jl=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Jl.apply(this,arguments)},sC=globalThis&&globalThis.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n},aC=globalThis&&globalThis.__read||function(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(i){o={error:i}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a};function oC(t,e){var n=uh(function(){return typeof t=="function"?t():t}),r=e.context,s=e.guards,a=e.actions,o=e.activities,i=e.services,l=e.delays;e.state;var u=sC(e,["context","guards","actions","activities","services","delays","state"]),c=uh(function(){var d={context:r,guards:s,actions:a,activities:o,services:i,delays:l},f=n.withConfig(d,function(){return Jl(Jl({},n.context),r)});return d1(f,u)});return O0(function(){Object.assign(c.machine.options.actions,a),Object.assign(c.machine.options.guards,s),Object.assign(c.machine.options.activities,o),Object.assign(c.machine.options.services,i),Object.assign(c.machine.options.delays,l)},[a,s,o,i,l]),c}function iC(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=aC(e,2),s=r[0],a=s===void 0?{}:s,o=r[1],i=oC(t,a);return G.useEffect(function(){if(o){var l=i.subscribe(Qi(o));return function(){l.unsubscribe()}}},[o]),G.useEffect(function(){var l=a.state;return i.start(l?$r.create(l):void 0),function(){i.stop(),i.status=an.NotStarted}},[]),i}globalThis&&globalThis.__read;globalThis&&globalThis.__values;function f1(t){return t.status!==0?t.getSnapshot():t.machine.initialState}function Sm(t){return"state"in t&&"machine"in t}function cC(t,e,n){if(t.status===an.NotStarted)return!0;var r=n.changed===void 0&&(Object.keys(n.children).length>0||typeof e.changed=="boolean");return!(n.changed||r)}function lC(t){return t}function p1(t){return"state"in t}function uC(t){return"deferred"in t}function dC(t){return"getSnapshot"in t?Sm(t)?f1(t):t.getSnapshot():p1(t)?t.state:void 0}function fC(t,e){e===void 0&&(e=dC);var n=G.useRef(t),r=G.useRef([]),s=G.useCallback(function(u){var c=t.subscribe(u).unsubscribe;return c},[t]),a=G.useCallback(function(){return e(t)},[t,e]),o=G.useCallback(function(u,c){return Sm(t)?cC(t,u,c):u===c},[t]),i=X0.useSyncExternalStoreWithSelector(s,a,a,lC,o),l=uh(function(){return function(){for(var u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];var d=u[0],f=n.current;uC(f)&&f.deferred?r.current.push(d):f.send(d)}});return O0(function(){for(n.current=t;r.current.length>0;){var u=r.current.shift();t.send(u)}},[t]),[i,l]}var pC=function(t,e){return t===e},hC=function(t,e){if(Sm(t)){if(t.status===0&&e.current)return e.current;var n=f1(t);return e.current=t.status===0?n:null,n}return p1(t)?t.state:void 0};function mC(t,e,n,r){n===void 0&&(n=pC);var s=G.useRef(null),a=G.useCallback(function(l){var u=t.subscribe(l).unsubscribe;return u},[t]),o=G.useCallback(function(){return r?r(t):hC(t,s)},[t,r]),i=X0.useSyncExternalStoreWithSelector(a,o,o,e,n);return i}const dh=2,h1=1.8,gC=0,yC=1,vC=.25,bC=.75,m1=1.618,ka={SUCCESS_CODE:1e3,DEFAULT_ERROR_CODE:4e3,FACE_FIT_TIMEOUT:4001,USER_CANCEL:4003,RUNTIME_ERROR:4005,USER_ERROR_DURING_CONNECTION:4007},wC=1e3,SC=10,xC=299,g1=1e4,xm={type:"FaceMovementAndLightChallenge",version:"2.0.0"},Fu={type:"FaceMovementChallenge",version:"1.0.0"},_C=[xm,Fu],IC=_C.map(t=>"".concat(t.type,"_").concat(t.version)).join(",");var bs;(function(t){t.DARK="dark",t.BRIGHT="bright",t.NORMAL="normal"})(bs||(bs={}));var dt;(function(t){t.MATCHED="MATCHED",t.TOO_FAR="TOO FAR",t.CANT_IDENTIFY="CANNOT IDENTIFY",t.FACE_IDENTIFIED="ONE FACE IDENTIFIED",t.TOO_MANY="TOO MANY FACES",t.OFF_CENT
30ER="OFF CENTER"})(dt||(dt={}));const St={CONNECTION_TIMEOUT:"CONNECTION_TIMEOUT",TIMEOUT:"TIMEOUT",RUNTIME_ERROR:"RUNTIME_ERROR",SERVER_ERROR:"SERVER_ERROR",CAMERA_FRAMERATE_ERROR:"CAMERA_FRAMERATE_ERROR",CAMERA_ACCESS_ERROR:"CAMERA_ACCESS_ERROR",FACE_DISTANCE_ERROR:"FACE_DISTANCE_ERROR",MOBILE_LANDSCAPE_ERROR:"MOBILE_LANDSCAPE_ERROR",MULTIPLE_FACES_ERROR:"MULTIPLE_FACES_ERROR",DEFAULT_CAMERA_NOT_FOUND_ERROR:"DEFAULT_CAMERA_NOT_FOUND_ERROR"};function ov(t,e,n){return t*(n-e)+e}function y1(t){const e=t.flippedCenterX-t.width/2,n=t.flippedCenterX+t.width/2,r=t.centerY-t.height/2,s=t.centerY+t.height/2;return{ovalBoundingBox:{left:e,top:r,right:n,bottom:s},minOvalX:e,maxOvalX:n,minOvalY:r,maxOvalY:s}}function v1(t,e){const n=Math.max(t.left,e.left),r=Math.max(t.top,e.top),s=Math.min(t.right,e.right),a=Math.min(t.bottom,e.bottom),o=Math.abs(Math.max(0,s-n)*Math.max(0,a-r));if(o===0)return 0;const i=Math.abs((t.right-t.left)*(t.bottom-t.top)),l=Math.abs((e.right-e.left)*(e.bottom-e.top));return o/(i+l-o)}function kC({parsedSessionInformation:t,videoWidth:e}){const n=t.Challenge.OvalParameters;if(!n||!n.CenterX||!n.CenterY||!n.Width||!n.Height)throw new Error("Oval parameters not returned from session information.");return{flippedCenterX:e-n.CenterX,centerX:n.CenterX,centerY:n.CenterY,width:n.Width,height:n.Height}}function b1({width:t,height:e,widthSeed:n=1,centerXSeed:r=.5,centerYSeed:s=.5,ratioMultiplier:a=.8,ovalHeightWidthRatio:o=m1}){const i=e;let l=t;const u=n*a,c=Math.floor(7*t/16),d=Math.floor(9*t/16),f=Math.floor(7*e/16),p=Math.floor(9*e/16),h=ov(r,c,d),m=ov(s,f,p);t>=e&&(l=3/4*i);const g=u*l,v=o*g;return{flippedCenterX:Math.floor(l-h),centerX:Math.floor(h),centerY:Math.floor(m),width:Math.floor(g),height:Math.floor(v)}}function w1({canvas:t,oval:e,scaleFactor:n,videoEl:r,isStartScreen:s}){const{flippedCenterX:a,centerY:o,width:i,height:l}=e,{width:u,height:c}=t.getBoundingClientRect(),d=t.getContext("2d");if(d){d.restore(),d.clearRect(0,0,u,c),d.fillStyle=s?getComputedStyle(t).getPropertyValue("--amplify-colors-background-primary"):"#fff",d.fillRect(0,0,u,c);const f={width:r.videoWidth,height:r.videoHeight},p={x:(u-f.width*n)/2,y:(c-f.height*n)/2};d.setTransform(n,0,0,n,p.x,p.y),d.beginPath(),d.ellipse(a,o,i/2,l/2,0,0,2*Math.PI),d.strokeStyle=getComputedStyle(t).getPropertyValue("--amplify-colors-border-secondary"),d.lineWidth=3,d.stroke(),d.save(),d.clip(),d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,c)}else throw new Error("Cannot find Canvas.")}function iv(t,e,n){const{width:r,height:s}=n.getTracks()[0].getSettings(),{width:a,height:o}=e.getBoundingClientRect();t.width=Math.ceil(a),t.height=Math.ceil(o);const i=b1({width:r,height:s,ratioMultiplier:.5});i.flippedCenterX=r-i.centerX;const l=a/e.videoWidth;w1({canvas:t,oval:i,scaleFactor:l,videoEl:e,isStartScreen:!0})}function EC({canvas:t}){const e=t.getContext("2d");if(e)e.restore(),e.clearRect(0,0,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);else throw new Error("Cannot find Canvas.")}function S1(t){const{leftEye:e,rightEye:n,mouth:r}=t,s=[];s[0]=(e[0]+n[0])/2,s[1]=(e[1]+n[1])/2;const a=Math.sqrt((e[0]-n[0])**2+(e[1]-n[1])**2),o=Math.sqrt((s[0]-r[0])**2+(s[1]-r[1])**2);return{pupilDistance:a,faceHeight:o}}function fh({ovalHeightWidthRatio:t=m1,face:e,oval:n,frameHeight:r}){const{leftEye:s,rightEye:a,nose:o,leftEar:i,rightEar:l}=e,{height:u,centerY:c}=n,d=c-u/2,f=[];f[0]=(s[0]+a[0])/2,f[1]=(s[1]+a[1])/2;const{pupilDistance:p,faceHeight:h}=S1(e),m=(dh*p+h1*h)/2;let g,v;f[1]<=(d+u)/2?(g=(f[0]+o[0])/2,v=(f[1]+o[1])/2):(g=f[0],v=f[1]);const w=t*m,S=Math.max(v-w/2,0),I=Math.min(v+w/2,r),E=Math.min(g-m/2,l[0]),T=Math.max(g+m/2,i[0]);return{bottom:I,left:E,right:T,top:S}}function cv(t){const e=document.createElement("canvas");e.width=t.videoWidth,e.height=t.videoHeight;const n=e.getContext("2d");if(n){n.drawImage(t,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height).data,s=8,a=new Array(s).fill(0);for(let l=0;l<r.length;l++){const u=Math.round(r[l++]*.2126+r[l++]*.7152+r[l++]*.0722);a[u%32]++}let o=-1,i=0;for(let l=0;l<s;l++)a[l]>i&&(i=a[l],o=l);return e.remove(),o===0?bs.DARK:o===s?bs.BRIGHT:bs.NORMAL}else throw new Error("Cannot find Video Element.")}function TC(t){return t.label.toLowerCase().includes("virtual")}const CC=.9,NC=.75;function vp({ctx:t,prevColor:e,nextColor:n,fraction:r}){const s=t.canvas.width,a=t.canvas.height;t.fillStyle=n,t.fillRect(0,0,s,a*r),r!==1&&(t.fillStyle=e,t.fillRect(0,a*r,s,a*(1-r)))}function AC({overlayCanvas:t,prevColor:e,nextColor:n,videoEl:r,ovalDetails:s,heightFraction:a,scaleFactor:o}){const{x:i,y:l}=r.getBoundingClientRect(),{flippedCenterX:u,centerY:c,width:d,height:f}=s,p=u*o+i,h=c*o+l,m=t.width,g=t.height,v=t.getContext("2d");if(v)v.canvas.width=window.innerWidth,v.canvas.height=window.innerHeight,v.clearRect(0,0,m,g),vp({ctx:v,prevColor:e,nextColor:n,fraction:a}),v.save(),v.beginPath(),v.rect(0,0,m,g),v.clip(),v.clearRect(0,0,m,g),v.globalAlpha=CC,vp({ctx:v,prevColor:e,nextColor:n,fraction:a}),v.beginPath(),v.ellipse(p,h,d*o/2,f*o/2,0,0,2*Math.PI),v.strokeStyle="white",v.lineWidth=8,v.stroke(),v.clip(),v.clearRect(0,0,m,g),v.globalAlpha=NC,vp({ctx:v,prevColor:e,nextColor:n,fraction:a}
30),v.restore();else throw new Error("Cannot find Overlay Canvas.")}const $C=t=>!!t;function RC(t){var r;return((r=t.Challenge.ColorSequences)!=null?r:[]).map(({FreshnessColor:s,DownscrollDuration:a,FlatDisplayDuration:o})=>{const i=s.RGB,l="rgb(".concat(i[0],",").concat(i[1],",").concat(i[2],")");return typeof l<"u"&&typeof a<"u"&&typeof o<"u"?{color:l,downscrollDuration:a,flatDisplayDuration:o}:void 0}).filter($C)}async function DC(t,e){const n=await t.detectFaces(e);let r;switch(n.length){case 0:{r=dt.CANT_IDENTIFY;break}case 1:{r=dt.FACE_IDENTIFIED;break}default:{r=dt.TOO_MANY;break}}return r}async function FC({parsedSessionInformation:t,faceDetector:e,videoEl:n,ovalDetails:r,reduceThreshold:s=!1}){const a=t.Challenge.ChallengeConfig,{FaceDistanceThresholdMin:o,FaceDistanceThreshold:i}=a,l=await e.detectFaces(n);let u,c=!1,d;switch(l.length){case 0:{d=St.FACE_DISTANCE_ERROR;break}case 1:{u=l[0];const{width:f}=r,{pupilDistance:p,faceHeight:h}=S1(u),m=(dh*p+h1*h)/2/dh;f&&(c=m/f<(s?i:o),c||(d=St.FACE_DISTANCE_ERROR));break}default:{d=St.MULTIPLE_FACES_ERROR;break}}return{isDistanceBelowThreshold:c,error:d}}/** 31 * @license 32 * Copyright 2020 Google LLC. All Rights Reserved. 33 * Licensed under the Apache License, Version 2.0 (the "License"); 34 * you may not use this file except in compliance with the License. 35 * You may obtain a copy of the License at 36 * 37 * http://www.apache.org/licenses/LICENSE-2.0 38 * 39 * Unless required by applicable law or agreed to in writing, software 40 * distributed under the License is distributed on an "AS IS" BASIS, 41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 * See the License for the specific language governing permissions and 43 * limitations under the License. 44 * ============================================================================= 45 */const MC=1e-7,OC=1e-4;class x1{constructor(e,n){this.backend=e,this.dataMover=n,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,n){this.dataIdsCount++,this.data.set(e,n)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class _m{refCount(e){return Yn("refCount")}incRef(e){return Yn("incRef")}timerAvailable(){return!0}time(e){return Yn("time")}read(e){return Yn("read")}readSync(e){return Yn("readSync")}readToGPU(e,n){return Yn("readToGPU")}numDataIds(){return Yn("numDataIds")}disposeData(e,n){return Yn("disposeData")}write(e,n,r){return Yn("write")}move(e,n,r,s,a){return Yn("move")}createTensorFromGPUData(e,n,r){return Yn("createTensorFromGPUData")}memory(){return Yn("memory")}floatPrecision(){return Yn("floatPrecision")}epsilon(){return this.floatPrecision()===32?MC:OC}dispose(){return Yn("dispose")}}function Yn(t){throw new Error("'".concat(t,"' not yet implemented or not found in the registry. ")+"This kernel may not be supported by the tfjs backend you have chosen")}/** 46 * @license 47 * Copyright 2020 Google LLC. All Rights Reserved. 48 * Licensed under the Apache License, Version 2.0 (the "License"); 49 * you may not use this file except in compliance with the License. 50 * You may obtain a copy of the License at 51 * 52 * http://www.apache.org/licenses/LICENSE-2.0 53 * 54 * Unless required by applicable law or agreed to in writing, software 55 * distributed under the License is distributed on an "AS IS" BASIS, 56 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 57 * See the License for the specific language governing permissions and 58 * limitations under the License. 59 * ============================================================================= 60 */function Im(t,e,n){return Math.max(t,Math.min(e,n))}function Ni(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function A(t,e){if(!t)throw new Error(typeof e=="string"?e:e())}function tr(t,e,n=""){A(Ir(t,e),()=>n+" Shapes ".concat(t," and ").concat(e," must match"))}function oi(t){A(t!=null,()=>"The input to the tensor constructor must be a non-null value.")}function J(t){if(t.length===0)return 1;let e=t[0];for(let n=1;n<t.length;n++)e*=t[n];return e}function PC(t,e){if(t===e)return!0;
60if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==null&&e[n]!==null&&t[n]!==e[n])return!1;return!0}function Ir(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function hc(t){return t%1===0}function Dl(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function _1(t,e){let n=1,r=-1;for(let a=0;a<t.length;++a)if(t[a]>=0)n*=t[a];else if(t[a]===-1){if(r!==-1)throw Error("Shapes can only have 1 implicit size. "+"Found -1 at dim ".concat(r," and dim ").concat(a));r=a}else if(t[a]<0)throw Error("Shapes can not be < 0. Found ".concat(t[a]," at dim ").concat(a));if(r===-1){if(e>0&&e!==n)throw Error("Size(".concat(e,") must match the product of shape ").concat(t));return t}if(n===0)throw Error("Cannot infer the missing size in [".concat(t,"] when ")+"there are 0 elements");if(e%n!==0)throw Error("The implicit shape can't be a fractional number. "+"Got ".concat(e," / ").concat(n));const s=t.slice();return s[r]=e/n,s}function Vt(t,e){const n=e.length;return t=t==null?e.map((r,s)=>s):[].concat(t),A(t.every(r=>r>=-n&&r<n),()=>"All values in axis param must be in range [-".concat(n,", ").concat(n,") but ")+"got axis ".concat(t)),A(t.every(r=>hc(r)),()=>"All values in axis param must be integers but "+"got axis ".concat(t)),t.map(r=>r<0?n+r:r)}function BC(t,e){const n=[],r=[],s=e!=null&&Array.isArray(e)&&e.length===0,a=e==null||s?null:Vt(e,t).sort();let o=0;for(let i=0;i<t.length;++i){if(a!=null){if(a[o]===i&&t[i]!==1)throw new Error("Can't squeeze axis ".concat(i," since its dim '").concat(t[i],"' is not 1"));(a[o]==null||a[o]>i)&&t[i]===1&&(n.push(t[i]),r.push(i)),a[o]<=i&&o++}t[i]!==1&&(n.push(t[i]),r.push(i))}return{newShape:n,keptDims:r}}function $n(t,e){return tn(t,e)}function tn(t,e){let n=null;if(t==null||t==="float32")n=new Float32Array(e);else if(t==="int32")n=new Int32Array(e);else if(t==="bool")n=new Uint8Array(e);else if(t==="string")n=new Array(e);else throw new Error("Unknown data type ".concat(t));return n}function LC(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type ".concat(e," being uploaded contains ").concat(r,"."))}}function WC(t){return t==="bool"||t==="complex64"||t==="float32"||t==="int32"||t==="string"}function zC(t,e){return!(e==="complex64"||e==="float32"&&t!=="complex64"||e==="int32"&&t!=="float32"&&t!=="complex64"||e==="bool"&&t==="bool")}function mc(t){if(t==="float32"||t==="int32")return 4;if(t==="complex64")return 8;if(t==="bool")return 1;throw new Error("Unknown dtype ".concat(t))}function HC(t){if(t==null)return 0;let e=0;return t.forEach(n=>e+=n.length),e}function Mu(t){return typeof t=="string"||t instanceof String}function UC(t){return typeof t=="boolean"}function VC(t){return typeof t=="number"}function Pc(t){return Array.isArray(t)?Pc(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray?"int32":VC(t)?"float32":Mu(t)?"string":UC(t)?"bool":"float32"}function ph(t){return!!(t&&t.constructor&&t.call&&t.apply)}function Ie(t){const e=t.length;if(e<2)return[];const n=new Array(e-1);n[e-2]=t[e-1];for(let r=e-3;r>=0;--r)n[r]=n[r+1]*t[r+1];return n}function I1(t,e,n,r=!1){const s=new Array;if(e.length===1){const a=e[0]*(r?2:1);for(let o=0;o<a;o++)s[o]=n[t+o]}else{const a=e[0],o=e.slice(1),i=o.reduce((l,u)=>l*u)*(r?2:1);for(let l=0;l<a;l++)s[l]=I1(t+l*i,o,n,r)}return s}function _r(t,e,n=!1){if(t.length===0)return e[0];const r=t.reduce((s,a)=>s*a)*(n?2:1);if(r===0)return[];if(r!==e.length)throw new Error("[".concat(t,"] does not match the input size ").concat(e.length).concat(n?" for a complex tensor":"","."));return I1(0,t,e,n)}function jC(t,e){if(Array.isArray(t))return t;if(e==="float32")return t instanceof Float32Array?t:new Float32Array(t);if(e==="int32")return t instanceof Int32Array?t:new Int32Array(t);if(e==="bool"||e==="string")return Uint8Array.from(new Int32Array(t));throw new Error("Unknown dtype ".concat(e))}function km(t,e){const n=xn(t,e);for(let r=0;r<n.length;r++)n[r]=1;return n}function xn(t,e){if(e==null||e==="float32"||e==="complex64")return new Float32Array(t);if(e==="int32")return new Int32Array(t);if(e==="bool")return new Uint8Array(t);throw new Error("Unknown data type ".concat(e))}function k1(t,e){const n=t.reduce((r,s)=>r*s,1);if(e==null||e==="float32")return _r(t,new Float32Array(n));if(e==="int32")return _r(t,new Int32Array(n));if(e==="bool")return _r(t,new Uint8Array(n));throw new Error("Unknown data type ".concat(e))}
60function dr(t){t.forEach(e=>{A(Number.isInteger(e)&&e>=0,()=>"Tensor must have a shape comprised of positive integers but got "+"shape [".concat(t,"]."))})}function ts(t,e,n){if(e===0)return 0;if(e===1)return t[0];let r=t[t.length-1];for(let s=0;s<t.length-1;++s)r+=n[s]*t[s];return r}function ii(t,e,n){if(e===0)return[];if(e===1)return[t];const r=new Array(e);for(let s=0;s<r.length-1;++s)r[s]=Math.floor(t/n[s]),t-=r[s]*n[s];return r[r.length-1]=t,r}function za(t){return t&&t.then&&typeof t.then=="function"}/** 61 * @license 62 * Copyright 2017 Google LLC. All Rights Reserved. 63 * Licensed under the Apache License, Version 2.0 (the "License"); 64 * you may not use this file except in compliance with the License. 65 * You may obtain a copy of the License at 66 * 67 * http://www.apache.org/licenses/LICENSE-2.0 68 * 69 * Unless required by applicable law or agreed to in writing, software 70 * distributed under the License is distributed on an "AS IS" BASIS, 71 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 72 * See the License for the specific language governing permissions and 73 * limitations under the License. 74 * ============================================================================= 75 */const lv="tfjsflags";class GC{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=qC,this.populateURLFlags()}setPlatform(e,n){this.platform!=null&&(Qe().getBool("IS_TEST")||Qe().getBool("PROD")||console.warn("Platform ".concat(this.platformName," has already been set. ")+"Overwriting the platform with ".concat(e,"."))),this.platformName=e,this.platform=n}registerFlag(e,n,r){if(this.flagRegistry[e]={evaluationFn:n,setHook:r},this.urlFlags[e]!=null){const s=this.urlFlags[e];Qe().getBool("IS_TEST")||Qe().getBool("PROD")||console.warn("Setting feature override from URL ".concat(e,": ").concat(s,".")),this.set(e,s)}}async getAsync(e){return e in this.flags?this.flags[e]:(this.flags[e]=await this.evaluateFlag(e),this.flags[e])}get(e){if(e in this.flags)return this.flags[e];const n=this.evaluateFlag(e);if(za(n))throw new Error("Flag ".concat(e," cannot be synchronously evaluated. ")+"Please use getAsync() instead.");return this.flags[e]=n,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,n){if(this.flagRegistry[e]==null)throw new Error("Cannot set flag ".concat(e," as it has not been registered."));this.flags[e]=n,this.flagRegistry[e].setHook!=null&&this.flagRegistry[e].setHook(n)}evaluateFlag(e){if(this.flagRegistry[e]==null)throw new Error("Cannot evaluate flag '".concat(e,"': no evaluation function found."));return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(typeof this.global>"u"||typeof this.global.location>"u"||typeof this.global.location.search>"u")return;const e=this.getQueryParams(this.global.location.search);lv in e&&e[lv].split(",").forEach(r=>{const[s,a]=r.split(":");this.urlFlags[s]=XC(s,a)})}}function qC(t){const e={};return t.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(n,...r)=>(KC(e,r[0],r[1]),r.join("="))),e}function KC(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}function XC(t,e){const n=e.toLowerCase();return n==="true"||n==="false"?n==="true":"".concat(+n)===n?+n:e}function Qe(){return E1}let E1=null;function YC(t){E1=t}/** 76 * @license 77 * Copyright 2020 Google LLC. All Rights Reserved. 78 * Licensed under the Apache License, Version 2.0 (the "License"); 79 * you may not use this file except in compliance with the License. 80 * You may obtain a copy of the License at 81 * 82 * http://www.apache.org/licenses/LICENSE-2.0 83 * 84 * Unless required by applicable law or agreed to in writing, software 85 * distributed under the License is distributed on an "AS IS" BASIS, 86 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 87 * See the License for the specific language governing permissions and 88 * limitations under the License. 89 * ============================================================================= 90 */let bp;function T1(){if(bp==null){let t;if(typeof window<"u")t=window;else if(typeof global<"u")t=global;else if(typeof process<"u")t=process;else if(typeof self<"u")t=self;else throw new Error("Could not find a global object");bp=t}return bp}function JC(){const t=T1();return t._tfGlobals==null&&(t._tfGlobals=new Map),t._tfGlobals}function Em(t,e){const n=JC();if(n.has(t))return n.get(t);{const r=e();return n.set(t,r),n.get(t)}}const Tm="Abs",Ou="Acos",Pu="Acosh",Bc="Add",Bu="AddN",Lu="All",Wu="Any",Cm="ArgMax",Nm="ArgMin",zu="Asin",Hu="Asinh",Uu="Atan",Vu="Atanh",ju="Atan2",Gu="AvgPool",C1="AvgPoolGrad",Am="AvgPool3D",N1="AvgPool3DGrad",qu="BatchMatMul",$m="BatchToSpaceND",Ku="Bincount",Xu="BitwiseAnd",Rm="BroadcastArgs",Yu="Cast",Ju="Ceil",Lc="ClipByValue",A1="Complex",$1="ComplexAbs",Dm="Concat",Qu="Conv2D",R1="Conv2DBackpropFilter",Zu="Conv2DBackpropInput",ed="Conv3D",Fm="Conv3DBackpropFilterV2",td="Conv3DBackpropInputV2",nd="Cos",rd="Cosh",sd="Cumprod",ad="Cumsum",od="CropAndResize",Mm="DenseBincount",id="DepthToSpace",cd="DepthwiseConv2dNative",D1="DepthwiseConv2dNativeBackpropFilter",F1="DepthwiseConv2dNativeBackpropInput",Om="Diag",ld="Dilation2D",Ql="Dilation2DBackpropInput",Zl="Dilation2DBackpropFilter",M1="Draw",ud="RealDiv",O1="Einsum",dd="Elu",Pm="EluGrad",fd="Erf",pd="Equal",hd="Exp",Bm="ExpandDims",md="Expm1",P1="FFT",Lm="Fill",gd="FlipLeftRight",yd="Floor",vd="FloorDiv",bd="FusedBatchNorm",Wm="GatherV2",wd="GatherNd",Sd="Greater",xd="GreaterEqual",_d="Identity",B1="IFFT",L1="Imag",Id="IsFinite",kd="IsInf",Ed="IsNan",Td="LeakyRelu",Cd="Less",Nd="LessEqual",Ad="LinSpace",$d="Log",Rd="Log1p",Dd="LogicalAnd",Fd="LogicalNot",Md="LogicalOr",QC="LogicalXor",Od="LRN",zm="LRNGrad",Pd="Max",Bd="Maximum",Ld="MaxPool",W1="MaxPoolGrad",Hm="MaxPool3D",z1="MaxPool3DGrad",Um="MaxPoolWithArgmax",Wd="Mean",zd="Min",Hd="Minimum",Ud="MirrorPad",Vd="Mod",jd="Multinomial",Gd="Multiply",Vm="Neg",qd="NotEqual",Kd="NonMaxSuppressionV3",Xd="NonMaxSuppressionV4",Yd="NonMaxSuppressionV5",jm="OnesLike",Jd="O
90neHot",Gm="Pack",Qd="PadV2",Zd="Pow",ef="Prelu",tf="Prod",H1="RaggedGather",U1="RaggedRange",V1="RaggedTensorToTensor",qm="Range",j1="Real",nf="Reciprocal",rf="Relu",Km="Reshape",sf="ResizeNearestNeighbor",Xm="ResizeNearestNeighborGrad",af="ResizeBilinear",Ym="ResizeBilinearGrad",of="Relu6",cf="Reverse",lf="Round",uf="Rsqrt",df="ScatterNd",ff="TensorScatterUpdate",pf="SearchSorted",Jm="Select",hf="Selu",Qm="Slice",mf="Sin",gf="Sinh",yf="Sign",vf="Sigmoid",bf="Softplus",wf="Sqrt",Sf="Sum",Zm="SpaceToBatchND",eg="SplitV",xf="Softmax",tg="SparseFillEmptyRows",_f="SparseReshape",ng="SparseSegmentMean",rg="SparseSegmentSum",If="SparseToDense",kf="SquaredDifference",G1="Square",sg="StaticRegexReplace",Ef="StridedSlice",ag="StringNGrams",og="StringSplit",ig="StringToHashBucketFast",Tf="Sub",Cf="Tan",Nf="Tanh",Wc="Tile",Af="TopK",$f="Transform",Lo="Transpose",cg="Unique",lg="Unpack",q1="UnsortedSegmentSum",ug="ZerosLike",zc="Step",uv="FromPixels",Rf="RotateWithOffset",gc="_FusedMatMul",yc="FusedConv2D",vc="FusedDepthwiseConv2D";/** 91 * @license 92 * Copyright 2018 Google LLC. All Rights Reserved. 93 * Licensed under the Apache License, Version 2.0 (the "License"); 94 * you may not use this file except in compliance with the License. 95 * You may obtain a copy of the License at 96 * 97 * http://www.apache.org/licenses/LICENSE-2.0 98 * 99 * Unless required by applicable law or agreed to in writing, software 100 * distributed under the License is distributed on an "AS IS" BASIS, 101 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 102 * See the License for the specific language governing permissions and 103 * limitations under the License. 104 * ============================================================================= 105 */function Ea(...t){Qe().getBool("IS_TEST")||Qe().getBool("PROD")||console.warn(...t)}/** 106 * @license 107 * Copyright 2019 Google LLC. All Rights Reserved. 108 * Licensed under the Apache License, Version 2.0 (the "License"); 109 * you may not use this file except in compliance with the License. 110 * You may obtain a copy of the License at 111 * 112 * http://www.apache.org/licenses/LICENSE-2.0 113 * 114 * Unless required by applicable law or agreed to in writing, software 115 * distributed under the License is distributed on an "AS IS" BASIS, 116 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 117 * See the License for the specific language governing permissions and 118 * limitations under the License. 119 * ============================================================================= 120 */const eu=Em("kernelRegistry",()=>new Map),ZC=Em("gradRegistry",()=>new Map);function tu(t,e){const n=X1(t,e);return eu.get(n)}function dv(t){return ZC.get(t)}function fv(t){const e=eu.entries(),n=[];for(;;){const{done:r,value:s}=e.next();if(r)break;const[a,o]=s,[i]=a.split("_");i===t&&n.push(o)}return n}function K1(t){const{kernelName:e,backendName:n}=t,r=X1(e,n);eu.has(r)&&Ea("The kernel '".concat(e,"' for backend ")+"'".concat(n,"' is already registered")),eu.set(r,t)}function X1(t,e){return"".concat(e,"_").concat(t)}/** 121 * @license 122 * Copyright 2023 Google LLC. 123 * Licensed under the Apache License, Version 2.0 (the "License"); 124 * you may not use this file except in compliance with the License. 125 * You may obtain a copy of the License at 126 * 127 * http://www.apache.org/licenses/LICENSE-2.0 128 * 129 * Unless required by applicable law or agreed to in writing, software 130 * distributed under the License is distributed on an "AS IS" BASIS, 131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132 * See the License for the specific language governing permissions and 133 * limitations under the License. 134 * ============================================================================= 135 */function Y1(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray}var J1=Ot,wr=null;try{wr=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function Ot(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}Ot.prototype.__isLong__;Object.defineProperty(Ot.prototype,"__isLong__",{value:!0});function nr(t){return(t&&t.__isLong__)===!0}Ot.isLong=nr;var pv={},hv={};function eo(t,e){var n,r,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(r=hv[t],r)?r:(n=Pt(t,(t|0)<0?-1:0,!0),s&&(hv[t]=n),n)):(t|=0,
vendor: 11,643 bytes, lines 135-153
135(s=-128<=t&&t<128)&&(r=pv[t],r)?r:(n=Pt(t,t<0?-1:0,!1),s&&(pv[t]=n),n))}Ot.fromInt=eo;function Sr(t,e){if(isNaN(t))return e?Ra:xr;if(e){if(t<0)return Ra;if(t>=Q1)return tw}else{if(t<=-gv)return Zn;if(t+1>=gv)return ew}return t<0?Sr(-t,e).neg():Pt(t%Ko|0,t/Ko|0,e)}Ot.fromNumber=Sr;function Pt(t,e,n){return new Ot(t,e,n)}Ot.fromBits=Pt;var nu=Math.pow;function dg(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return xr;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return dg(t.substring(1),e,n).neg();for(var s=Sr(nu(n,8)),a=xr,o=0;o<t.length;o+=8){var i=Math.min(8,t.length-o),l=parseInt(t.substring(o,o+i),n);if(i<8){var u=Sr(nu(n,i));a=a.mul(u).add(Sr(l))}else a=a.mul(s),a=a.add(Sr(l))}return a.unsigned=e,a}Ot.fromString=dg;function Br(t,e){return typeof t=="number"?Sr(t,e):typeof t=="string"?dg(t,e):Pt(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}Ot.fromValue=Br;var mv=65536,eN=1<<24,Ko=mv*mv,Q1=Ko*Ko,gv=Q1/2,yv=eo(eN),xr=eo(0);Ot.ZERO=xr;var Ra=eo(0,!0);Ot.UZERO=Ra;var Do=eo(1);Ot.ONE=Do;var Z1=eo(1,!0);Ot.UONE=Z1;var hh=eo(-1);Ot.NEG_ONE=hh;var ew=Pt(-1,2147483647,!1);Ot.MAX_VALUE=ew;var tw=Pt(-1,-1,!0);Ot.MAX_UNSIGNED_VALUE=tw;var Zn=Pt(0,-2147483648,!1);Ot.MIN_VALUE=Zn;var ge=Ot.prototype;ge.toInt=function(){return this.unsigned?this.low>>>0:this.low};ge.toNumber=function(){return this.unsigned?(this.high>>>0)*Ko+(this.low>>>0):this.high*Ko+(this.low>>>0)};ge.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Zn)){var n=Sr(e),r=this.div(n),s=r.mul(n).sub(this);return r.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var a=Sr(nu(e,6),this.unsigned),o=this,i="";;){var l=o.div(a),u=o.sub(l.mul(a)).toInt()>>>0,c=u.toString(e);if(o=l,o.isZero())return c+i;for(;c.length<6;)c="0"+c;i=""+c+i}};ge.getHighBits=function(){return this.high};ge.getHighBitsUnsigned=function(){return this.high>>>0};ge.getLowBits=function(){return this.low};ge.getLowBitsUnsigned=function(){return this.low>>>0};ge.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Zn)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};ge.isZero=function(){return this.high===0&&this.low===0};ge.eqz=ge.isZero;ge.isNegative=function(){return!this.unsigned&&this.high<0};ge.isPositive=function(){return this.unsigned||this.high>=0};ge.isOdd=function(){return(this.low&1)===1};ge.isEven=function(){return(this.low&1)===0};ge.equals=function(e){return nr(e)||(e=Br(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};ge.eq=ge.equals;ge.notEquals=function(e){return!this.eq(e)};ge.neq=ge.notEquals;ge.ne=ge.notEquals;ge.lessThan=function(e){return this.comp(e)<0};ge.lt=ge.lessThan;ge.lessThanOrEqual=function(e){return this.comp(e)<=0};ge.lte=ge.lessThanOrEqual;ge.le=ge.lessThanOrEqual;ge.greaterThan=function(e){return this.comp(e)>0};ge.gt=ge.greaterThan;ge.greaterThanOrEqual=function(e){return this.comp(e)>=0};ge.gte=ge.greaterThanOrEqual;ge.ge=ge.greaterThanOrEqual;ge.compare=function(e){if(nr(e)||(e=Br(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?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};ge.comp=ge.compare;ge.negate=function(){return!this.unsigned&&this.eq(Zn)?Zn:this.not().add(Do)};ge.neg=ge.negate;ge.add=function(e){nr(e)||(e=Br(e));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,a=this.low&65535,o=e.high>>>16,i=e.high&65535,l=e.low>>>16,u=e.low&65535,c=0,d=0,f=0,p=0;return p+=a+u,f+=p>>>16,p&=65535,f+=s+l,d+=f>>>16,f&=65535,d+=r+i,c+=d>>>16,d&=65535,c+=n+o,c&=65535,Pt(f<<16|p,c<<16|d,this.unsigned)};ge.subtract=function(e){return nr(e)||(e=Br(e)),this.add(e.neg())};ge.sub=ge.subtract;ge.multiply=function(e){if(this.isZero())return xr;if(nr(e)||(e=Br(e)),wr){var n=wr.mul(this.low,this.high,e.low,e.high);return Pt(n,wr.get_high(),this.unsigned)}if(e.isZero())return xr;if(this.eq(Zn))return e.isOdd()?Zn:xr;if(e.eq(Zn))return this.isOdd()?Zn:xr;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(yv)&&e.lt(yv))return Sr(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,a=this.low>>>16,o=this.low&65535,i=e.high>>>16,l=e.high&65535,u=e.low>>>16,c=e.low&65535,d=0,f=0,p=0,h=0;return h+=o*c,p+=h>>>16,h&=65535,p+=a*c,f+=p>>>16,p&=65535,p+=o*u,f+=p>>>16,p&=65535,f+=s*c,d+=f>>>16,f&=65535,f+=a*u,d+=f>>>16,f&=65535,f+=o*l,d+=f>>>16,f&=65535,d+=r*c+s*u+a*l+o*i,d&=65535,Pt(p<<16|h,d<<16|f,this.unsigned)};ge.mul=ge.multiply;ge.divide=function(e){if(nr(e)||(e=Br(e)),e.isZero())throw Error("division by zero");if(wr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?wr.div_u:wr.div_s)(this.low,this.high,e.low,e.high);return Pt(n,wr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ra:xr;var r,s,a;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Ra;if(e.gt(this.shru(1)))return Z1;a=Ra}else{if(this.eq(Zn)){if(e.eq(Do)||e.eq(hh))return Zn;if(e.eq(Zn))return Do;var o=this.shr(1);return r=o.div(e).shl(1),r.eq(xr)?e.isNegative()?Do:hh:(s=this.sub(e.mul(r)),a=r.add(s.div(e)),a)}else if(e.eq(Zn))return this.unsigned?Ra:xr;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();a=xr}for(s=this;s.gte(e);){r=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var i=Math.ceil(Math.log(r)/Math.LN2),l=i<=48?1:nu(2,i-48),u=Sr(r),c=u.mul(e);c.isNegative()||c.gt(s);)r-=l,u=Sr(r,this.unsigned),c=u.mul(e);u.isZero()&&(u=Do),a=a.add(u),s=s.sub(c)}return a};ge.div=ge.divide;ge.modulo=function(e){if(nr(e)||(e=Br(e)),wr){var n=(this.unsigned?wr.rem_u:wr.rem_s)(this.low,this.high,e.low,e.high);return Pt(n,wr.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};ge.mod=ge.modulo;ge.rem=ge.modulo;ge.not=function(){return Pt(~this.low,~this.high,this.unsigned)};ge.and=function(e){return nr(e)||(e=Br(e)),Pt(this.low&e.low,this.high&e.high,this.unsigned)};ge.or=function(e){return nr(e)||(e=Br(e)),Pt(this.low|e.low,this.high|e.high,this.unsigned)};ge.xor=function(e){return nr(e)||(e=Br(e)),Pt(this.low^e.low,this.high^e.high,this.unsigned)};ge.shiftLeft=function(e){return nr(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Pt(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Pt(0,this.low<<e-32,this.unsigned)};ge.shl=ge.shiftLeft;ge.shiftRight=function(e){return nr(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Pt(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Pt(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};ge.shr=ge.shiftRight;ge.shiftRightUnsigned=function(e){if(nr(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return Pt(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?Pt(n,0,this.unsigned):Pt(n>>>e-32,0,this.unsigned)};ge.shru=ge.shiftRightUnsigned;ge.shr_u=ge.shiftRightUnsigned;ge.toSigned=function(){return this.unsigned?Pt(this.low,this.high,!1):this};ge.toUnsigned=function(){return this.unsigned?this:Pt(this.low,this.high,!0)};ge.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};ge.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};ge.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Ot.fromBytes=function(e,n,r){return r?Ot.fromBytesLE(e,n):Ot.fromBytesBE(e,n)};Ot.fromBytesLE=function(e,n){return new Ot(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};Ot.fromBytesBE=function(e,n){return new Ot(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)};const nw=Nu(J1),tN=dm({__proto__:null,default:nw},[J1]);/** 136 * @license 137 * Copyright 2021 Google LLC. All Rights Reserved. 138 * Licensed under the Apache License, Version 2.0 (the "License"); 139 * you may not use this file except in compliance with the License. 140 * You may obtain a copy of the License at 141 * 142 * http://www.apache.org/licenses/LICENSE-2.0 143 * 144 * Unless required by applicable law or agreed to in writing, software 145 * distributed under the License is distributed on an "AS IS" BASIS, 146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 147 * See the License for the specific language governing permissions and 148 * limitations under the License. 149 * ============================================================================= 150 */const Ta=nw||tN;function Df(t){return Ta.fromString(t,!0,16)}const rw=Df("c3a5c85c97cb3127"),_a=Df("b492b66fbe98f273"),An=Df("9ae16a3b2f90404f");function mh(t){return t.xor(t.shru(47))}function sw(t,e,n){const r=t.slice(e,e+n);return Ta.fromBytes(Array.from(r),!0,!0)}function $t(t,e){return sw(t,e,8)}function vv(t,e){return sw(t,e,4)}function dn(t,e){return e===0?t:t.shru(e).or(t.shl(64-e))}function Ks(t,e,n=Df("9ddfea08eb382d69")){let r=t.xor(e).mul(n);r=r.xor(r.shru(47));let s=e.xor(r).mul(n);return s=s.xor(s.shru(47)),s=s.mul(n),s}function nN(t,e,n,r,s,a){s=s.add(t),a=dn(a.add(s).add(r),21);const o=s;return s=s.add(e),s=s.add(n),a=a.add(dn(s,44)),[s.add(r),a.add(o)]}function yl(t,e,n,r){return nN($t(t,e),$t(t,e+8),$t(t,e+16),$t(t,e+24),n,r)}function rN(t,e=t.length){if(e>=8){const n=An.add(e*2),r=$t(t,0).add(An),s=$t(t,e-8),a=dn(s,37).mul(n).add(r),o=dn(r,25).add(s).mul(n);return Ks(a,o,n)}if(e>=4){const n=An.add(e*2),r=vv(t,0);return Ks(r.shl(3).add(e),vv(t,e-4),n)}if(e>0){const n=t[0],r=t[e>>1],s=t[e-1],a=n+(r<<8),o=e+(s<<2);return mh(An.mul(a).xor(rw.mul(o))).mul(An)}return An}function sN(t,e=t.length){const n=An.add(e*2),r=$t(t,0).mul(_a),s=$t(t,8),a=$t(t,e-8).mul(n),o=$t(t,e-16).mul(An);return Ks(dn(r.add(s),43).add(dn(a,30)).add(o),r.add(dn(s.add(An),18)).add(a),n)}function aN(t,e=t.length){const n=An.add(e*2),r=$t(t,0).mul(An),s=$t(t,8),a=$t(t,e-8).mul(n),o=$t(t,e-16).mul(An),i=dn(r.add(s),43).add(dn(a,30)).add(o),l=Ks(i,r.add(dn(s.add(An),18)).add(a),n),u=$t(t,16).mul(n),c=$t(t,24),d=i.add($t(t,e-32)).mul(n),f=l.add($t(t,e-24)).mul(n);return Ks(dn(u.add(c),43).add(dn(d,30)).add(f),u.add(dn(c.add(r),18)).add(d),n)}function oN(t,e=t.length){const n=Ta.fromNumber(81,!0);if(e<=32)return e<=16?rN(t,e):sN(t,e);if(e<=64)return aN(t,e);let r=n,s=n.mul(_a).add(113),a=mh(s.mul(An).add(113)).mul(An),o=[Ta.UZERO,Ta.UZERO],i=[Ta.UZERO,Ta.UZERO];r=r.mul(An).add($t(t,0));let l=0;const u=(e-1>>6)*64,c=u+(e-1&63)-63;do r=dn(r.add(s).add(o[0]).add($t(t,l+8)),37).mul(_a),s=dn(s.add(o[1]).add($t(t,l+48)),42).mul(_a),r=r.xor(i[1]),s=s.add(o[0]).add($t(t,l+40)),a=dn(a.add(i[0]),33).mul(_a),o=yl(t,l,o[1].mul(_a),r.add(i[0])),i=yl(t,l+32,a.add(i[1]),s.add($t(t,l+16))),[a,r]=[r,a],l+=64;while(l!==u);const d=_a.add(a.and(255).shl(1));return l=c,i[0]=i[0].add(e-1&63),o[0]=o[0].add(i[0]),i[0]=i[0].add(o[0]),r=dn(r.add(s).add(o[0]).add($t(t,l+8)),37).mul(d),s=dn(s.add(o[1]).add($t(t,l+48)),42).mul(d),r=r.xor(i[1].mul(9)),s=s.add(o[0].mul(9).add($t(t,l+40))),a=dn(a.add(i[0]),33).mul(d),o=yl(t,l,o[1].mul(d),r.add(i[0])),i=yl(t,l+32,a.add(i[1]),s.add($t(t,l+16))),[a,r]=[r,a],Ks(Ks(o[0],i[0],d).add(mh(s).mul(rw)).add(a),Ks(o[1],i[1],d).add(r),d)}/** 151 * @license 152 * Copyright 2017 Google LLC. All Rights Reserved. 153 * Licensed under the Apache License, Version 2.0 (the "License");
154 * you may not use this file except in compliance with the License. 155 * You may obtain a copy of the License at 156 * 157 * http://www.apache.org/licenses/LICENSE-2.0 158 * 159 * Unless required by applicable law or agreed to in writing, software 160 * distributed under the License is distributed on an "AS IS" BASIS, 161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 162 * See the License for the specific language governing permissions and 163 * limitations under the License. 164 * ============================================================================= 165 */function fg(t,e){return e==="string"?Pa(t):to([t],e)}function iN(t,e){return t instanceof Float32Array&&e==="float32"||t instanceof Int32Array&&e==="int32"||t instanceof Uint8Array&&e==="bool"}function to(t,e){if(e==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=wc(t)),Qe().getBool("DEBUG")&&LC(t,e),iN(t,e))return t;if(e==null||e==="float32"||e==="complex64")return new Float32Array(t);if(e==="int32")return new Int32Array(t);if(e==="bool"){const n=new Uint8Array(t.length);for(let r=0;r<n.length;++r)Math.round(t[r])!==0&&(n[r]=1);return n}else throw new Error("Unknown data type ".concat(e))}function Qs(){return Qe().platform.now()}function cN(t,e){return Qe().platform.fetch(t,e)}function Pa(t,e="utf-8"){return e=e||"utf-8",Qe().platform.encode(t,e)}function bc(t,e="utf-8"){return e=e||"utf-8",Qe().platform.decode(t,e)}function kr(t){return Qe().platform.isTypedArray!=null?Qe().platform.isTypedArray(t):Y1(t)}function wc(t,e=[],n=!1){if(e==null&&(e=[]),typeof t=="boolean"||typeof t=="number"||typeof t=="string"||za(t)||t==null||kr(t)&&n)e.push(t);else if(Array.isArray(t)||kr(t))for(let r=0;r<t.length;++r)wc(t[r],e,n);else{let r=-1;for(const s of Object.keys(t))/^([1-9]+[0-9]*|0)$/.test(s)&&(r=Math.max(r,Number(s)));for(let s=0;s<=r;s++)wc(t[s],e,n)}return e}/** 166 * @license 167 * Copyright 2018 Google LLC. All Rights Reserved. 168 * Licensed under the Apache License, Version 2.0 (the "License"); 169 * you may not use this file except in compliance with the License. 170 * You may obtain a copy of the License at 171 * 172 * http://www.apache.org/licenses/LICENSE-2.0 173 * 174 * Unless required by applicable law or agreed to in writing, software 175 * distributed under the License is distributed on an "AS IS" BASIS, 176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 177 * See the License for the specific language governing permissions and 178 * limitations under the License. 179 * ============================================================================= 180 */class lN{constructor(e,n){this.backendTimer=e,this.logger=n,n==null&&(this.logger=new dN)}profileKernel(e,n,r){let s;const a=()=>{s=r()};let o;const i=Qs();if(this.backendTimer.timerAvailable())o=this.backendTimer.time(a);else{a();for(const u of s)u.dataSync();o=Promise.resolve({kernelMs:Qs()-i})}if(Qe().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let u=0;u<s.length;u++){const c=s[u];c.data().then(d=>{uN(d,c.dtype,e)})}return{kernelName:e,outputs:s,inputs:n,timeMs:o.then(u=>u.kernelMs),extraInfo:o.then(u=>u.getExtraProfileInfo!=null?u.getExtraProfileInfo():"")}}logKernelProfile(e){const{kernelName:n,outputs:r,timeMs:s,inputs:a,extraInfo:o}=e;r.forEach(i=>{Promise.all([i.data(),s,o]).then(l=>{this.logger.logKernelProfile(n,i,l[0],l[1],a,l[2])})})}}function uN(t,e,n){if(e!=="float32")return!1;for(let r=0;r<t.length;r++){const s=t[r];if(isNaN(s)||!isFinite(s))return console.warn("Found ".concat(s," in the result of '").concat(n,"'")),!0}return!1}class dN{logKernelProfile(e,n,r,s,a,o){const i=typeof s=="number"?Dl("".concat(s,"ms"),9):s.error,l=Dl(e,25),u=n.rank,c=n.size,d=Dl(n.shape.toString(),14);let f="";for(const p in a){const h=a[p];if(h!=null){const m=h.shape||n.shape,g=m.length;f+="".concat(p,": ").concat(g,"D ").concat(g>0?m:""," ")}}console.log("%c".concat(l," %c").concat(i," %c").concat(u,"D ").concat(d," %c").concat(c," %c").concat(f," %c").concat(o),"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}/** 181 * @license 182 * Copyright 2017 Google LLC. All Rights Reserved. 183 * Licensed under the Apache License, Version 2.0 (the "License");
184 * you may not use this file except in compliance with the License. 185 * You may obtain a copy of the License at 186 * 187 * http://www.apache.org/licenses/LICENSE-2.0 188 * 189 * Unless required by applicable law or agreed to in writing, software 190 * distributed under the License is distributed on an "AS IS" BASIS, 191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 192 * See the License for the specific language governing permissions and 193 * limitations under the License. 194 * ============================================================================= 195 */function fN(t,e,n){const r={},s={};for(let l=0;l<e.length;l++)r[e[l].id]=!0;for(let l=0;l<t.length;l++){const u=t[l],c=u.inputs;for(const d in c){const f=c[d];let p=!1;for(let h=0;h<e.length;h++)if(r[f.id]){u.outputs.forEach(m=>r[m.id]=!0),p=!0,s[u.id]=!0;break}if(p)break}}const a={};a[n.id]=!0;const o={};for(let l=t.length-1;l>=0;l--){const u=t[l],c=u.inputs;for(let d=0;d<u.outputs.length;d++)if(a[u.outputs[d].id]){for(const f in c)a[c[f].id]=!0,o[u.id]=!0;break}}const i=[];for(let l=0;l<t.length;l++){const u=t[l];if(s[u.id]&&o[u.id]){const c={};for(const f in u.inputs){const p=u.inputs[f];r[p.id]&&(c[f]=p)}const d=Object.assign({},u);d.inputs=c,d.outputs=u.outputs,i.push(d)}}return i}function pN(t,e,n,r){for(let s=e.length-1;s>=0;s--){const a=e[s],o=[];if(a.outputs.forEach(l=>{const u=t[l.id];u!=null?o.push(u):o.push(null)}),a.gradient==null)throw new Error("Cannot compute gradient: gradient function not found "+"for ".concat(a.kernelName,"."));const i=a.gradient(o);for(const l in a.inputs){if(!(l in i))throw new Error("Cannot backprop through input ".concat(l,". ")+"Available gradients found: ".concat(Object.keys(i),"."));const u=n(()=>i[l]());if(u.dtype!=="float32")throw new Error("Error in gradient for op ".concat(a.kernelName,". The gradient of input ")+"".concat(l," must have 'float32' dtype, but has '").concat(u.dtype,"'"));const c=a.inputs[l];if(!Ir(u.shape,c.shape))throw new Error("Error in gradient for op ".concat(a.kernelName,". The gradient of input ")+"'".concat(l,"' has shape '").concat(u.shape,"', which does not match ")+"the shape of the input '".concat(c.shape,"'"));if(t[c.id]==null)t[c.id]=u;else{const d=t[c.id];t[c.id]=r(d,u),d.dispose()}}}}/** 196 * @license 197 * Copyright 2018 Google LLC. All Rights Reserved. 198 * Licensed under the Apache License, Version 2.0 (the "License"); 199 * you may not use this file except in compliance with the License. 200 * You may obtain a copy of the License at 201 * 202 * http://www.apache.org/licenses/LICENSE-2.0 203 * 204 * Unless required by applicable law or agreed to in writing, software 205 * distributed under the License is distributed on an "AS IS" BASIS, 206 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 207 * See the License for the specific language governing permissions and 208 * limitations under the License. 209 * ============================================================================= 210 */const bv=20,Ai=3,wp=7;function hN(t,e,n,r){const s=Ie(e),a=mN(t,e,n,s),o=e.length,i=Fl(t,e,n,s,a),l=["Tensor"];return r&&(l.push(" dtype: ".concat(n)),l.push(" rank: ".concat(o)),l.push(" shape: [".concat(e,"]")),l.push(" values:")),l.push(i.map(u=>" "+u).join("\n")),l.join("\n")}function mN(t,e,n,r){const s=J(e),a=r[r.length-1],o=new Array(a).fill(0),i=e.length,l=n==="complex64"?Ui(t):t;if(i>1)for(let u=0;u<s/a;u++){const c=u*a;for(let d=0;d<a;d++)o[d]=Math.max(o[d],Hi(l[c+d],0,n).length)}return o}function Hi(t,e,n){let r;return Array.isArray(t)?r="".concat(parseFloat(t[0].toFixed(wp))," + ")+"".concat(parseFloat(t[1].toFixed(wp)),"j"):Mu(t)?r="'".concat(t,"'"):n==="bool"?r=aw(t):r=parseFloat(t.toFixed(wp)).toString(),Dl(r,e)}function aw(t){return t===0?"false":"true"}function Fl(t,e,n,r,s,a=!0){const o=n==="complex64"?2:1,i=e[0],l=e.length;if(l===0){if(n==="complex64"){const m=Ui(t);return[Hi(m[0],0,n)]}return n==="bool"?[aw(t[0])]:[t[0].toString()]}if(l===1){if(i>bv){const g=Ai*o;let v=Array.from(t.slice(0,g)),b=Array.from(t.slice((i-Ai)*o,i*o));return n==="complex64"&&(v=Ui(v),b=Ui(b)),["["+v.map((w,S)=>
vendor: 5,800 bytes, lines 210-228
210Hi(w,s[S],n)).join(", ")+", ..., "+b.map((w,S)=>Hi(w,s[i-Ai+S],n)).join(", ")+"]"]}return["["+(n==="complex64"?Ui(t):Array.from(t)).map((g,v)=>Hi(g,s[v],n)).join(", ")+"]"]}const u=e.slice(1),c=r.slice(1),d=r[0]*o,f=[];if(i>bv){for(let m=0;m<Ai;m++){const g=m*d,v=g+d;f.push(...Fl(t.slice(g,v),u,n,c,s,!1))}f.push("...");for(let m=i-Ai;m<i;m++){const g=m*d,v=g+d;f.push(...Fl(t.slice(g,v),u,n,c,s,m===i-1))}}else for(let m=0;m<i;m++){const g=m*d,v=g+d;f.push(...Fl(t.slice(g,v),u,n,c,s,m===i-1))}const p=l===2?",":"";f[0]="["+(i>0?f[0]+p:"");for(let m=1;m<f.length-1;m++)f[m]=" "+f[m]+p;let h=",\n";for(let m=2;m<l;m++)h+="\n";return f[f.length-1]=" "+f[f.length-1]+"]"+(a?"":h),f}function Ui(t){const e=[];for(let n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}/** 211 * @license 212 * Copyright 2017 Google LLC. All Rights Reserved. 213 * Licensed under the Apache License, Version 2.0 (the "License"); 214 * you may not use this file except in compliance with the License. 215 * You may obtain a copy of the License at 216 * 217 * http://www.apache.org/licenses/LICENSE-2.0 218 * 219 * Unless required by applicable law or agreed to in writing, software 220 * distributed under the License is distributed on an "AS IS" BASIS, 221 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 222 * See the License for the specific language governing permissions and 223 * limitations under the License. 224 * ============================================================================= 225 */class on{constructor(e,n,r){if(this.dtype=n,this.shape=e.slice(),this.size=J(e),r!=null){const s=r.length;A(s===this.size,()=>"Length of values '".concat(s,"' does not match the size ")+"inferred by the shape '".concat(this.size,"'."))}if(n==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=r||tn(n,this.size),this.strides=Ie(e)}set(e,...n){n.length===0&&(n=[0]),A(n.length===this.rank,()=>"The number of provided coordinates (".concat(n.length,") must ")+"match the rank (".concat(this.rank,")"));const r=this.locToIndex(n);this.values[r]=e}get(...e){e.length===0&&(e=[0]);let n=0;for(const s of e){if(s<0||s>=this.shape[n]){const a="Requested out of range element at ".concat(e,". ")+" Buffer shape=".concat(this.shape);throw new Error(a)}n++}let r=e[e.length-1];for(let s=0;s<e.length-1;++s)r+=this.strides[s]*e[s];return this.values[r]}locToIndex(e){if(this.rank===0)return 0;if(this.rank===1)return e[0];let n=e[e.length-1];for(let r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return n}indexToLoc(e){if(this.rank===0)return[];if(this.rank===1)return[e];const n=new Array(this.shape.length);for(let r=0;r<n.length-1;++r)n[r]=Math.floor(e/this.strides[r]),e-=n[r]*this.strides[r];return n[n.length-1]=e,n}get rank(){return this.shape.length}toTensor(){return Rr().makeTensor(this.values,this.shape,this.dtype)}}let Rr=null,To=null;function gN(t){Rr=t}function yN(t){To=t}class Zt{constructor(e,n,r,s){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=n||"float32",this.size=J(e),this.strides=Ie(e),this.dataId=r,this.id=s,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return To.buffer(this.shape,this.dtype,e)}bufferSync(){return To.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return _r(this.shape,e,this.dtype==="complex64")}arraySync(){return _r(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();const e=Rr().read(this.dataId);if(this.dtype==="string"){const n=await e;try{return n.map(r=>bc(r))}catch(r){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),Rr().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=Rr().readSync(this.dataId);if(this.dtype==="string")try{return e.map(n=>bc(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await Rr().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),Rr().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return To.print(this,e)}clone(){return this.throwIfDisposed(),To.clone(this)}toString(e=!1){const n=this.dataSync();return hN(n,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),To.cast(this,e)}variable(e=!0,n,r){return this.throwIfDisposed(),Rr().makeVariable(this,e,n,r)}}Object.defineProperty(Zt,Symbol.hasInstance,{value:t=>!!t&&t.data!=null&&t.dataSync!=null&&t.throwIfDisposed!=null});function vN(){return Em("Tensor",()=>Zt)}vN();class ru extends Zt{constructor(e,n,r,s){super(e.shape,e.dtype,e.dataId,s),this.trainable=n,this.name=r}assign(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value (".concat(e.dtype,") and ")+"previous value (".concat(this.dtype,") must match"));if(!Ir(e.shape,this.shape))throw new Error("shape of the new value (".concat(e.shape,") and ")+"previous value (".concat(this.shape,") must match"));Rr().disposeTensor(this),this.dataId=e.dataId,Rr().incRef(this,null)}dispose(){Rr().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(ru,Symbol.hasInstance,{value:t=>t instanceof Zt&&t.assign!=null&&t.assign instanceof Function});/** 226 * @license 227 * Copyright 2017 Google LLC. All Rights Reserved. 228 * Licensed under the Apache License, Version 2.0 (the "License");
229 * you may not use this file except in compliance with the License. 230 * You may obtain a copy of the License at 231 * 232 * http://www.apache.org/licenses/LICENSE-2.0 233 * 234 * Unless required by applicable law or agreed to in writing, software 235 * distributed under the License is distributed on an "AS IS" BASIS, 236 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 237 * See the License for the specific language governing permissions and 238 * limitations under the License. 239 * ============================================================================= 240 */var wv;(function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"})(wv||(wv={}));var gh;(function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"})(gh||(gh={}));var yh;(function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"})(yh||(yh={}));var vh;(function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"})(vh||(vh={}));var bh;(function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"})(bh||(bh={}));const bN={float32:vh,int32:gh,bool:yh,complex64:bh};function ci(t,e){if(t==="string"||e==="string"){if(t==="string"&&e==="string")return"string";throw new Error("Can not upcast ".concat(t," with ").concat(e))}return bN[t][e]}function ow(t){return t!=null&&typeof t=="object"&&"texture"in t&&t.texture instanceof WebGLTexture}function iw(t){return typeof GPUBuffer<"u"&&t!=null&&typeof t=="object"&&"buffer"in t&&t.buffer instanceof GPUBuffer}/** 241 * @license 242 * Copyright 2018 Google LLC. All Rights Reserved. 243 * Licensed under the Apache License, Version 2.0 (the "License"); 244 * you may not use this file except in compliance with the License. 245 * You may obtain a copy of the License at 246 * 247 * http://www.apache.org/licenses/LICENSE-2.0 248 * 249 * Unless required by applicable law or agreed to in writing, software 250 * distributed under the License is distributed on an "AS IS" BASIS, 251 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 252 * See the License for the specific language governing permissions and 253 * limitations under the License. 254 * ============================================================================= 255 */function Xt(t,e){if(t.dtype===e.dtype)return[t,e];const n=ci(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function wN(t,e){A(t.dtype===e.dtype,()=>"The dtypes of the first(".concat(t.dtype,") and")+" second(".concat(e.dtype,") input must match"))}function cw(t){const e=[];return lw(t,e,new Set),e}function lw(t,e,n){if(t==null)return;if(t instanceof Zt){e.push(t);return}if(!SN(t))return;const r=t;for(const s in r){const a=r[s];n.has(a)||(n.add(a),lw(a,e,n))}}function SN(t){return Array.isArray(t)||typeof t=="object"}/** 256 * @license 257 * Copyright 2018 Google LLC. All Rights Reserved. 258 * Licensed under the Apache License, Version 2.0 (the "License"); 259 * you may not use this file except in compliance with the License. 260 * You may obtain a copy of the License at 261 * 262 * http://www.apache.org/licenses/LICENSE-2.0 263 * 264 * Unless required by applicable law or agreed to in writing, software 265 * distributed under the License is distributed on an "AS IS" BASIS, 266 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 267 * See the License for the specific language governing permissions and 268 * limitations under the License. 269 * ============================================================================= 270 */function Sp(t){return t.kernelName!=null}class Sv{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class Xo{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Sv}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;const e=this.getSortedBackends();for(let n=0;n<e.length;n++){const r=e[n];if(await this.initializeBackend(r).success){await this.setBackend(r);return}}throw new Error("Could not initialize any backends, all backend initializations failed.")}
270get backend(){if(this.pendingBackendInit!=null)throw new Error("Backend '".concat(this.backendName,"' has not yet been initialized. Make ")+"sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){const{name:e,asyncInit:n}=this.initializeBackendsAndReturnBest();if(n)throw new Error("The highest priority backend '".concat(e,"' has not yet been ")+"initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry))if(e in this.registryFactory){const{asyncInit:n}=this.initializeBackend(e);if(n)return null}else return null;return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,n,r=1){return e in this.registryFactory?(Ea("".concat(e," backend was already registered. ")+"Reusing existing backend factory."),!1):(this.registryFactory[e]={factory:n,priority:r},!0)}async setBackend(e){if(this.registryFactory[e]==null)throw new Error("Backend name '".concat(e,"' not found in registry"));if(this.backendName=e,this.registry[e]==null){this.backendInstance=null;const{success:n,asyncInit:r}=this.initializeBackend(e);if(!(r?await n:n))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new lN(this.backendInstance),!0}setupRegisteredKernels(){fv(this.backendName).forEach(n=>{n.setupFunc!=null&&n.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){fv(e).forEach(r=>{r.disposeFunc!=null&&r.disposeFunc(this.registry[e])})}initializeBackend(e){const n=this.registryFactory[e];if(n==null)throw new Error("Cannot initialize backend ".concat(e,", no registration found."));try{const r=n.factory();if(r&&!(r instanceof _m)&&typeof r.then=="function"){const s=++this.pendingBackendInitId,a=r.then(o=>s<this.pendingBackendInitId?!1:(this.registry[e]=o,this.pendingBackendInit=null,!0)).catch(o=>(s<this.pendingBackendInitId||(this.pendingBackendInit=null,Ea("Initialization of backend ".concat(e," failed")),Ea(o.stack||o.message)),!1));return this.pendingBackendInit=a,{success:a,asyncInit:!0}}else return this.registry[e]=r,{success:!0,asyncInit:!1}}catch(r){return Ea("Initialization of backend ".concat(e," failed")),Ea(r.stack||r.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error("".concat(e," backend not found in registry"));this.backendName===e&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((e,n)=>this.registryFactory[n].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let n=0;n<e.length;n++){const r=e[n],{success:s,asyncInit:a}=this.initializeBackend(r);if(a||s)return{name:r,asyncInit:a}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,n){const r=this.state.tensorInfo.get(n),s=r.backend,a=this.readSync(n),o=s.refCount(n);s.disposeData(n,!0),r.backend=e,e.move(n,a,r.shape,r.dtype,o),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,n){let r=null;if(n==null){if(typeof e!="function")throw new Error("Please provide a function to tidy()");n=e}else{if(typeof e!="string"&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof n!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=e}let s;return this.scopedRun(()=>this.startScope(r),()=>this.endScope(s),()=>(s=n(),s instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),s))}scopedRun(e,n,r){e();try{const s=r();return n(),s}catch(s){throw n(),s}}nextTensorId(){return Xo.nextTensorId++}nextVariableId(){return Xo.nextVariableId++}clone(e){const n=W.runKernel(_d,{x:e}),r={x:e},s=o=>({x:()=>{const i="float32",l={x:o},u={dtype:i};return W.runKernel(Yu,l,u)}}),a=[];return this.addTapeNode(this.state.activeScope.name,r,[n],s,a,{}),n}runKernel(e,n,r){if(this.backendName==null&&this.backend,!(tu(e,this.backendName)!=null))throw new Error("Kernel '".concat(e,"' not registered for backend '").concat(this.backendName,"'"));return this.runKernelFunc({kernelName:e,inputs:n,attrs:r})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}
vendor: 9,987 bytes, lines 270-273
270checkKernelForMemLeak(e,n,r){const s=this.backend.numDataIds();let a=0;r.forEach(l=>{a+=l.dtype==="complex64"?3:1});const o=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=s-n-a-o;if(i>0)throw new Error("Backend '".concat(this.backendName,"' has an internal memory leak ")+"(".concat(i," data ids) after running '").concat(e,"'"))}runKernelFunc(e){let n,r=[];const s=this.isTapeOn(),a=this.state.numBytes,o=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let l;const u=Sp(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Sp(e)){const{kernelName:h,inputs:m,attrs:g}=e;this.backendName==null&&this.backend;const v=tu(h,this.backendName);A(v!=null,()=>"Cannot find registered kernel '".concat(h,"' for backend '").concat(this.backendName,"'")),i=()=>{const b=this.backend.numDataIds();l=v.kernelFunc({inputs:m,attrs:g,backend:this.backend});const w=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(h,b,w);const S=w.map(I=>I.rank!=null?I:this.makeTensorFromTensorInfo(I));if(s){const I=this.getTensorsForGradient(h,m,S);r=this.saveTensorsForBackwardMode(I)}return S}}else{const{forwardFunc:h}=e,m=g=>{s&&(r=g.map(v=>this.keep(this.clone(v))))};i=()=>{const g=this.backend.numDataIds();l=this.tidy(()=>h(this.backend,m));const v=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(u,g,v),v}}const{inputs:c,attrs:d}=e,f=Sp(e)?null:e.backwardsFunc;let p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?n=i():(p=this.profiler.profileKernel(u,c,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),n=p.outputs)}),s&&this.addTapeNode(u,c,n,f,r,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:u,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-o,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(c).map(h=>c[h]!=null?c[h].shape:null),outputShapes:n.map(h=>h.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(l)?n:n[0]}saveTensorsForBackwardMode(e){return e.map(r=>this.keep(this.clone(r)))}getTensorsForGradient(e,n,r){const s=dv(e);if(s!=null){const a=s.inputsToSave||[],o=s.outputsToSave||[];let i;s.saveAllInputs?(A(Array.isArray(n),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(n).map(u=>n[u])):i=a.map(u=>n[u]);const l=r.filter((u,c)=>o[c]);return i.concat(l)}return[]}makeTensor(e,n,r,s){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");r=r||"float32",s=s||this.backend;let a=e;r==="string"&&Mu(e[0])&&(a=e.map(l=>Pa(l)));const o=s.write(a,n,r),i=new Zt(n,r,o,this.nextTensorId());if(this.trackTensor(i,s),r==="string"){const l=this.state.tensorInfo.get(o),u=HC(a);this.state.numBytes+=u-l.bytes,l.bytes=u}return i}makeTensorFromDataId(e,n,r,s){r=r||"float32";const a={dataId:e,shape:n,dtype:r};return this.makeTensorFromTensorInfo(a,s)}makeTensorFromTensorInfo(e,n){const{dataId:r,shape:s,dtype:a}=e,o=new Zt(s,a,r,this.nextTensorId());return this.trackTensor(o,n),o}makeVariable(e,n=!0,r,s){r=r||this.nextVariableId().toString(),s!=null&&s!==e.dtype&&(e=e.cast(s));const a=new ru(e,n,r,this.nextTensorId());if(this.state.registeredVariables[a.name]!=null)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}trackTensor(e,n){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let r=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(r=e.size*mc(e.dtype)),this.state.numBytes+=r,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:n||this.backend,dtype:e.dtype,shape:e.shape,bytes:r})),e instanceof ru||this.track(e)}incRef(e,n){this.trackTensor(e,n),this.backend.incRef(e.dataId)}removeDataId(e,n){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===n&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const n=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=n.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){const r=e.size*mc(e.dtype);this.state.numBytes-=r}n.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,n.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const n=this.state.registeredVariables[e];this.disposeVariable(n)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){const 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,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const n=this.state.numBytes,r=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(s=>s.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-n,this.state.activeProfile.newTensors=this.state.numTensors-r;for(const s of this.state.activeProfile.kernels)s.kernelTimeMs=await s.kernelTimeMs,s.extraInfo=await s.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,n,r,s,a,o){const i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:n,outputs:r,saved:a},l=dv(e);l!=null&&(s=l.gradFunc),s!=null&&(i.gradient=u=>(u=u.map((c,d)=>{if(c==null){const f=r[d],p=xn(f.size,f.dtype);return this.makeTensor(p,f.shape,f.dtype)}return c}),s(u.length>1?u:u[0],a,o))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const n={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(n.name=e),this.state.scopeStack.push(n),this.state.activeScope=n}endScope(e){const n=cw(e),r=new Set(n.map(a=>a.id));for(let a=0;a<this.state.activeScope.track.length;a++){const o=this.state.activeScope.track[a];!o.kept&&!r.has(o.id)&&o.dispose()}const s=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(a=>{!a.kept&&a.scopeId===s.id&&this.track(a)})}gradients(e,n,r,s=!1){if(A(n.length>0,()=>"gradients() received an empty list of xs."),r!=null&&r.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '".concat(r.dtype,"'"));const a=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));A(a instanceof Zt,()=>"The result y returned by f() must be a tensor.");const o=fN(this.state.activeTape,n,a);if(!s&&o.length===0&&n.length>0)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",()=>{const i={};i[a.id]=r==null?xN(a.shape):r,pN(i,o,u=>this.tidy(u),_N);const l=n.map(u=>i[u.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(u=>{for(const c of u.saved)c.dispose()}),this.state.activeTape=null),{value:a,grads:l}})}customGrad(e){return A(ph(e),()=>"The f passed in customGrad(f) must be a function."),(...n)=>{A(n.every(i=>i instanceof Zt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let r;const s={};n.forEach((i,l)=>{s[l]=i});const a=(i,l)=>(r=e(...n,l),A(r.value instanceof Zt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),A(ph(r.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),r.value),o=(i,l)=>{const u=r.gradFunc(i,l),c=Array.isArray(u)?u:[u];A(c.length===n.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),A(c.every(f=>f instanceof Zt),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const d={};return c.forEach((f,p)=>{d[p]=()=>f}),d};return this.runKernelFunc({forwardFunc:a,backwardsFunc:o,inputs:s})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,n){return this.state.tensorInfo.get(e).backend.readToGPU(e,n)}async time(e){const n=Qs(),r=await this.backend.time(e);return r.wallMs=Qs()-n,r}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Sv;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}Xo.nextTensorId=0;Xo.nextVariableId=0;function xN(t){const e=km(J(t),"float32");return W.makeTensor(e,t,"float32")}function uw(){const t=T1();if(t._tfengine==null){const e=new GC(t);t._tfengine=new Xo(e)}return YC(t._tfengine.ENV),gN(()=>t._tfengine),t._tfengine}const W=uw();function _N(t,e){const n={a:t,b:e};return W.runKernel(Bc,n)}/** 271 * @license 272 * Copyright 2017 Google LLC. All Rights Reserved. 273 * Licensed under the Apache License, Version 2.0 (the "License");
274 * you may not use this file except in compliance with the License. 275 * You may obtain a copy of the License at 276 * 277 * http://www.apache.org/licenses/LICENSE-2.0 278 * 279 * Unless required by applicable law or agreed to in writing, software 280 * distributed under the License is distributed on an "AS IS" BASIS, 281 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 282 * See the License for the specific language governing permissions and 283 * limitations under the License. 284 * ============================================================================= 285 */function IN(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}/** 286 * @license 287 * Copyright 2019 Google LLC. All Rights Reserved. 288 * Licensed under the Apache License, Version 2.0 (the "License"); 289 * you may not use this file except in compliance with the License. 290 * You may obtain a copy of the License at 291 * 292 * http://www.apache.org/licenses/LICENSE-2.0 293 * 294 * Unless required by applicable law or agreed to in writing, software 295 * distributed under the License is distributed on an "AS IS" BASIS, 296 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 297 * See the License for the specific language governing permissions and 298 * limitations under the License. 299 * ============================================================================= 300 */const Hn=Qe();Hn.registerFlag("DEBUG",()=>!1,t=>{t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});Hn.registerFlag("IS_BROWSER",()=>IN());Hn.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u");Hn.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));Hn.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor));Hn.registerFlag("PROD",()=>!1);Hn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Hn.getBool("DEBUG"));Hn.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);Hn.registerFlag("IS_TEST",()=>!1);Hn.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>Hn.getBool("DEBUG"));Hn.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);Hn.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1);Hn.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);/** 301 * @license 302 * Copyright 2018 Google LLC. All Rights Reserved. 303 * Licensed under the Apache License, Version 2.0 (the "License"); 304 * you may not use this file except in compliance with the License. 305 * You may obtain a copy of the License at 306 * 307 * http://www.apache.org/licenses/LICENSE-2.0 308 * 309 * Unless required by applicable law or agreed to in writing, software 310 * distributed under the License is distributed on an "AS IS" BASIS, 311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 312 * See the License for the specific language governing permissions and 313 * limitations under the License. 314 * ============================================================================= 315 */function aa(t,e){let n=t;if(kr(t))return e==="string"?[]:[t.length];if(ow(t)){const s=t.channels||"RGBA";return[t.height,t.width*s.length]}else if(iw(t))return[t.buffer.size/(e==null?4:mc(e))];if(!Array.isArray(t))return[];const r=[];for(;Array.isArray(n)||kr(n)&&e!=="string";)r.push(n.length),n=n[0];return Array.isArray(t)&&Qe().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&dw(t,r,[]),r}function dw(t,e,n){if(n=n||[],!Array.isArray(t)&&!kr(t)){A(e.length===0,()=>"Element arr[".concat(n.join("]["),"] is a primitive, ")+"but should be an array/TypedArray of ".concat(e[0]," elements"));return}A(e.length>0,()=>"Element arr[".concat(n.join("]["),"] should be a primitive, ")+"but is an array of ".concat(t.length," elements")),A(t.length===e[0],()=>"Element arr[".concat(n.join("]["),"] should have ").concat(e[0]," ")+"elements, but has ".concat(t.length," elements"));const r=e.slice(1);for(let s=0;s<t.length;++s)dw(t[s],r,n.concat(s))}function xv(t,e,n,r){if(t!=="string_or_numeric"){if(t==null)throw new Error("Expected dtype cannot be null.");if(t!=="numeric"&&t!==e||t==="numeric"&&e==="string")throw new Error("Argument '".concat(n,"' passed to '").concat(r,"' must ")+"be ".concat(t," tensor, but got ").concat(e," tensor"))}}function C(t,e,n,r="numeric"){if(t instanceof Zt)return xv(r,t.dtype,e,n),t;let s=Pc(t);
315if(s!=="string"&&["bool","int32","float32"].indexOf(r)>=0&&(s=r),xv(r,s,e,n),t==null||!kr(t)&&!Array.isArray(t)&&typeof t!="number"&&typeof t!="boolean"&&typeof t!="string"){const l=t==null?"null":t.constructor.name;throw new Error("Argument '".concat(e,"' passed to '").concat(n,"' must be a ")+"Tensor or TensorLike, but got '".concat(l,"'"))}const a=aa(t,s);!kr(t)&&!Array.isArray(t)&&(t=[t]);const i=s!=="string"?to(t,s):wc(t,[],!0);return W.makeTensor(i,a,s)}function su(t,e,n,r="numeric"){if(!Array.isArray(t))throw new Error("Argument ".concat(e," passed to ").concat(n," must be a ")+"`Tensor[]` or `TensorLike[]`");return t.map((a,o)=>C(a,"".concat(e,"[").concat(o,"]"),n,r))}/** 316 * @license 317 * Copyright 2018 Google LLC. All Rights Reserved. 318 * Licensed under the Apache License, Version 2.0 (the "License"); 319 * you may not use this file except in compliance with the License. 320 * You may obtain a copy of the License at 321 * 322 * http://www.apache.org/licenses/LICENSE-2.0 323 * 324 * Unless required by applicable law or agreed to in writing, software 325 * distributed under the License is distributed on an "AS IS" BASIS, 326 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 327 * See the License for the specific language governing permissions and 328 * limitations under the License. 329 * ============================================================================= 330 */const fw="__op";function P(t){const e=Object.keys(t);if(e.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+"".concat(e.length," keys."));let n=e[0];const r=t[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n=n+fw;const s=(...a)=>{W.startScope(n);try{const o=r(...a);return za(o)&&console.error("Cannot return a Promise inside of tidy."),W.endScope(o),o}catch(o){throw W.endScope(null),o}};return Object.defineProperty(s,"name",{value:n,configurable:!0}),s}/** 331 * @license 332 * Copyright 2020 Google LLC. All Rights Reserved. 333 * Licensed under the Apache License, Version 2.0 (the "License"); 334 * you may not use this file except in compliance with the License. 335 * You may obtain a copy of the License at 336 * 337 * http://www.apache.org/licenses/LICENSE-2.0 338 * 339 * Unless required by applicable law or agreed to in writing, software 340 * distributed under the License is distributed on an "AS IS" BASIS, 341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 342 * See the License for the specific language governing permissions and 343 * limitations under the License. 344 * ============================================================================= 345 */function kN(t,e){const n=C(t,"real","complex"),r=C(e,"imag","complex");tr(n.shape,r.shape,"real and imag shapes, ".concat(n.shape," and ").concat(r.shape,", ")+"must match in call to tf.complex().");const s={real:n,imag:r};return W.runKernel(A1,s)}const Zs=P({complex_:kN});/** 346 * @license 347 * Copyright 2018 Google LLC. All Rights Reserved. 348 * Licensed under the Apache License, Version 2.0 (the "License"); 349 * you may not use this file except in compliance with the License. 350 * You may obtain a copy of the License at 351 * 352 * http://www.apache.org/licenses/LICENSE-2.0 353 * 354 * Unless required by applicable law or agreed to in writing, software 355 * distributed under the License is distributed on an "AS IS" BASIS, 356 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 357 * See the License for the specific language governing permissions and 358 * limitations under the License. 359 * ============================================================================= 360 */function oa(t,e,n,r){if(r==null)r=Pc(t);else if(r==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(iw(t)||ow(t)){if(r!=="float32"&&r!=="int32")throw new Error("Creating tensor from GPU data only supports "+"'float32'|'int32' dtype, while the dtype is ".concat(r,"."));return W.backend.createTensorFromGPUData(t,e||n,r)}if(!kr(t)&&!Array.isArray(t)&&typeof t!="number"&&typeof t!="boolean"&&typeof t!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(e!=null){dr(e);const s=J(e),a=J(n);A(s===a,()=>"Based on the provided shape, [".concat(e,"], the tensor should have ")+"".concat(s," values but has ").concat(a));for(let o=0;o<n.length;++o){const i=n[o],l=o===n.length-1?i!==J(e.slice(o)):!0;A(n[o]===e[o]||!l,()=>"Error creating a new Tensor. Inferred shape "+"(".concat(n,") does not match the provided ")+"shape (".concat(e,"). "))}}return!kr(t)&&!Array.isArray(t)&&(t=[t]),e=e||n,t=r!=="string"?to(t,r):wc(t,[],!0),W.makeTensor(t,e,r)}/** 361 * @license 362 * Copyright 2018 Google LLC. All Rights Reserved. 363 * Licensed under the Apache License, Version 2.0 (the "License");
364 * you may not use this file except in compliance with the License. 365 * You may obtain a copy of the License at 366 * 367 * http://www.apache.org/licenses/LICENSE-2.0 368 * 369 * Unless required by applicable law or agreed to in writing, software 370 * distributed under the License is distributed on an "AS IS" BASIS, 371 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 372 * See the License for the specific language governing permissions and 373 * limitations under the License. 374 * ============================================================================= 375 */function Fr(t,e,n){const r=aa(t,n);return oa(t,e,r,n)}/** 376 * @license 377 * Copyright 2018 Google LLC. All Rights Reserved. 378 * Licensed under the Apache License, Version 2.0 (the "License"); 379 * you may not use this file except in compliance with the License. 380 * You may obtain a copy of the License at 381 * 382 * http://www.apache.org/licenses/LICENSE-2.0 383 * 384 * Unless required by applicable law or agreed to in writing, software 385 * distributed under the License is distributed on an "AS IS" BASIS, 386 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 387 * See the License for the specific language governing permissions and 388 * limitations under the License. 389 * ============================================================================= 390 */const wh={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class Lr{static join(e){return new Lr(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,e==null||(e instanceof Array||(e=[e]),e=e.map(r=>kr(r)?r.buffer:r),e.length===0))return;this.bufferUniformSize=e[0].byteLength;let n=0;for(let r=0;r<e.length;r++){const s=e[r];r!==e.length-1&&s.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const a=n+s.byteLength;this.shards.push({buffer:s,start:n,end:a}),n=a}this.shards.length===0&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,n=this.byteLength){if(this.shards.length===0)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,n=isNaN(Number(n))?0:n,e=Math.max(0,e),n=Math.min(this.byteLength,n),n<=e)return new ArrayBuffer(0);const r=this.findShardForByte(e);if(r===-1)throw new Error("Could not find start shard for byte ".concat(e));const s=n-e,a=new ArrayBuffer(s),o=new Uint8Array(a);let i=0;for(let l=r;l<this.shards.length;l++){const u=this.shards[l],d=e+i-u.start,f=i,h=Math.min(n,u.end)-u.start,m=new Uint8Array(u.buffer,d,h-d);if(o.set(m,f),i+=m.length,n<u.end)break}return a}findShardForByte(e){if(this.shards.length===0||e<0||e>=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function n(s){return e<s.start?-1:e>=s.end?1:0}
390if(n(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;const r=EN(this.shards,n);return r===-1?-1:(this.previousShardIndex=r,this.previousShardIndex)}}function EN(t,e){let n=0,r=t.length;for(;n<=r;){const s=Math.floor((r-n)/2)+n,a=e(t[s]);if(a===0)return s;a<0?r=s:n=s+1}return-1}/** 391 * @license 392 * Copyright 2018 Google LLC. All Rights Reserved. 393 * Licensed under the Apache License, Version 2.0 (the "License"); 394 * you may not use this file except in compliance with the License. 395 * You may obtain a copy of the License at 396 * 397 * http://www.apache.org/licenses/LICENSE-2.0 398 * 399 * Unless required by applicable law or agreed to in writing, software 400 * distributed under the License is distributed on an "AS IS" BASIS, 401 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 402 * See the License for the specific language governing permissions and 403 * limitations under the License. 404 * ============================================================================= 405 */const au=4;async function TN(t,e){const n=[],r=[],s=Array.isArray(t)?t.map(o=>o.name):Object.keys(t);for(let o=0;o<s.length;++o){const i=s[o],l=Array.isArray(t)?t[o].tensor:t[i];if(l.dtype!=="float32"&&l.dtype!=="int32"&&l.dtype!=="bool"&&l.dtype!=="string"&&l.dtype!=="complex64")throw new Error("Unsupported dtype in weight '".concat(i,"': ").concat(l.dtype));const u={name:i,shape:l.shape,dtype:l.dtype};if(l.dtype==="string"){const c=new Promise(async d=>{const f=await l.bytes(),p=f.reduce((g,v)=>g+v.length,0)+au*f.length,h=new Uint8Array(p);let m=0;for(let g=0;g<f.length;g++){const v=f[g],b=new Uint8Array(new Uint32Array([v.length]).buffer);h.set(b,m),m+=au,h.set(v,m),m+=v.length}d(h)});r.push(c)}else r.push(l.data());e!=null&&(u.group=e),n.push(u)}const a=await Promise.all(r);return{data:CN(a),specs:n}}function pw(t,e){const n=new Lr(t),r={};let s,a=0;for(const o of e){const i=o.name,l=o.dtype,u=o.shape,c=J(u);let d;if("quantization"in o){const f=o.quantization;if(f.dtype==="uint8"||f.dtype==="uint16"){if(!("min"in f&&"scale"in f))throw new Error("Weight ".concat(o.name," with quantization ").concat(f.dtype," ")+"doesn't have corresponding metadata min and scale.")}else if(f.dtype==="float16"){if(l!=="float32")throw new Error("Weight ".concat(o.name," is quantized with ").concat(f.dtype," ")+"which only supports weights of type float32 not ".concat(l,"."))}else throw new Error("Weight ".concat(o.name," has unknown ")+"quantization dtype ".concat(f.dtype,". ")+"Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.");const p=wh[f.dtype],h=n.slice(a,a+c*p),m=f.dtype==="uint8"?new Uint8Array(h):new Uint16Array(h);if(l==="float32")if(f.dtype==="uint8"||f.dtype==="uint16"){d=new Float32Array(m.length);for(let g=0;g<m.length;g++){const v=m[g];d[g]=v*f.scale+f.min}}else if(f.dtype==="float16")s===void 0&&(s=MN()),d=s(m);else throw new Error("Unsupported quantization type ".concat(f.dtype," ")+"for weight type float32.");else if(l==="int32"){if(f.dtype!=="uint8"&&f.dtype!=="uint16")throw new Error("Unsupported quantization type ".concat(f.dtype," ")+"for weight type int32.");d=new Int32Array(m.length);for(let g=0;g<m.length;g++){const v=m[g];d[g]=Math.round(v*f.scale+f.min)}}else throw new Error("Unsupported dtype in weight '".concat(i,"': ").concat(l));a+=c*p}else if(l==="string"){const f=J(o.shape);d=[];for(let p=0;p<f;p++){const h=new Uint32Array(n.slice(a,a+au))[0];a+=au;const m=new Uint8Array(n.slice(a,a+h));d.push(m),a+=h}}else{const f=wh[l],p=n.slice(a,a+c*f);if(l==="float32")d=new Float32Array(p);else if(l==="int32")d=new Int32Array(p);else if(l==="bool")d=new Uint8Array(p);else if(l==="complex64"){d=new Float32Array(p);const h=new Float32Array(d.length/2),m=new Float32Array(d.length/2);for(let b=0;b<h.length;b++)h[b]=d[b*2],m[b]=d[b*2+1];const g=Fr(h,u,"float32"),v=Fr(m,u,"float32");r[i]=Zs(g,v),g.dispose(),v.dispose()}else throw new Error("Unsupported dtype in weight '".concat(i,"': ").concat(l));a+=c*f}l!=="complex64"&&(r[i]=Fr(d,u,l))}return r}function CN(t){if(t===null)throw new Error("Invalid input value: ".concat(JSON.stringify(t)));let e=0;const n=[];t.forEach(a=>{if(e+=a.byteLength,n.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: ".concat(a.constructor.name))});
405const r=new Uint8Array(e);let s=0;return n.forEach(a=>{r.set(new Uint8Array(a.buffer),s),s+=a.byteLength}),r.buffer}const pg=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function _v(t){return pg?Buffer.byteLength(t,"utf8"):new Blob([t]).size}function NN(t){if(pg)return Buffer.from(t).toString("base64");const e=new Uint8Array(t);let n="";for(let r=0,s=e.length;r<s;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function AN(t){if(pg){const r=Buffer.from(t,"base64");return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;++r)n.set([e.charCodeAt(r)],r);return n.buffer}function $N(t){return Lr.join(t)}function Iv(t){const e="/";for(t=t.trim();t.endsWith(e);)t=t.slice(0,t.length-1);const n=t.split(e);return n[n.length-1]}function hw(t,e){const n={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:e};return t.signature!=null&&(n.signature=t.signature),t.userDefinedMetadata!=null&&(n.userDefinedMetadata=t.userDefinedMetadata),t.modelInitializer!=null&&(n.modelInitializer=t.modelInitializer),t.initializerSignature!=null&&(n.initializerSignature=t.initializerSignature),t.trainingConfig!=null&&(n.trainingConfig=t.trainingConfig),n}function mw(t,e,n){const r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy};if(t.trainingConfig!=null&&(r.trainingConfig=t.trainingConfig),t.weightsManifest!=null){if(!e)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");r.weightSpecs=e,r.weightData=n}return t.signature!=null&&(r.signature=t.signature),t.userDefinedMetadata!=null&&(r.userDefinedMetadata=t.userDefinedMetadata),t.modelInitializer!=null&&(r.modelInitializer=t.modelInitializer),t.initializerSignature!=null&&(r.initializerSignature=t.initializerSignature),r}async function hg(t,e){let n,r;return t.weightsManifest!=null&&([n,r]=await e(t.weightsManifest)),mw(t,n,r)}function Hc(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:t.modelTopology==null?0:_v(JSON.stringify(t.modelTopology)),weightSpecsBytes:t.weightSpecs==null?0:_v(JSON.stringify(t.weightSpecs)),weightDataBytes:t.weightData==null?0:new Lr(t.weightData).byteLength}}function gw(t){const e=[];for(const n of t)e.push(...n.weights);return e}function RN(){const t=n=>{let r=n<<13,s=0;for(;!(r&8388608);)s-=8388608,r<<=1;return r&=-8388609,s+=947912704,r|s},e=new Uint32Array(2048);e[0]=0;for(let n=1;n<1024;n++)e[n]=t(n);for(let n=1024;n<2048;n++)e[n]=939524096+(n-1024<<13);return e}function DN(){const t=new Uint32Array(64);t[0]=0,t[31]=1199570944,t[32]=2147483648,t[63]=3347054592;for(let e=1;e<31;e++)t[e]=e<<23;for(let e=33;e<63;e++)t[e]=2147483648+(e-32<<23);return t}function FN(){const t=new Uint32Array(64);for(let e=0;e<64;e++)t[e]=1024;return t[0]=t[32]=0,t}function MN(){const t=RN(),e=DN(),n=FN();return r=>{const s=new ArrayBuffer(4*r.length),a=new Uint32Array(s);for(let o=0;o<r.length;o++){const i=r[o],l=t[n[i>>10]+(i&1023)]+e[i>>10];a[o]=l}return new Float32Array(s)}}/** 406 * @license 407 * Copyright 2018 Google LLC. All Rights Reserved. 408 * Licensed under the Apache License, Version 2.0 (the "License"); 409 * you may not use this file except in compliance with the License. 410 * You may obtain a copy of the License at 411 * 412 * http://www.apache.org/licenses/LICENSE-2.0 413 * 414 * Unless required by applicable law or agreed to in writing, software 415 * distributed under the License is distributed on an "AS IS" BASIS, 416 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 417 * See the License for the specific language governing permissions and 418 * limitations under the License. 419 * ============================================================================= 420 */class zt{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return zt.instance==null&&(zt.instance=new zt),zt.instance}static registerSaveRouter(e){zt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){zt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return zt.getHandlers(e,"save")}static getLoadHandlers(e,n){return zt.getHandlers(e,"load",n)}static getHandlers(e,n,r){const s=[];return(n==="load"?zt.getInstance().loadRouters:zt.getInstance().saveRouters).forEac
vendor: 4,185 bytes, lines 420-435
420h(o=>{const i=o(e,r);i!==null&&s.push(i)}),s}}const ON=t=>zt.registerSaveRouter(t),PN=t=>zt.registerLoadRouter(t),BN=t=>zt.getSaveHandlers(t),LN=(t,e)=>zt.getLoadHandlers(t,e);/** 421 * @license 422 * Copyright 2018 Google LLC. All Rights Reserved. 423 * Licensed under the Apache License, Version 2.0 (the "License"); 424 * you may not use this file except in compliance with the License. 425 * You may obtain a copy of the License at 426 * 427 * http://www.apache.org/licenses/LICENSE-2.0 428 * 429 * Unless required by applicable law or agreed to in writing, software 430 * distributed under the License is distributed on an "AS IS" BASIS, 431 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 432 * See the License for the specific language governing permissions and 433 * limitations under the License. 434 * ============================================================================= 435 */const Sh="tensorflowjs",xh=1,Da="models_store",qs="model_info_store";function yw(){if(!Qe().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const t=typeof window>"u"?self:window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(e==null)throw new Error("The current browser does not appear to support IndexedDB.");return e}function _h(t){const e=t.result;e.createObjectStore(Da,{keyPath:"modelPath"}),e.createObjectStore(qs,{keyPath:"modelPath"})}class Ha{constructor(e){if(this.indexedDB=yw(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,n){return new Promise((r,s)=>{const a=this.indexedDB.open(Sh,xh);a.onupgradeneeded=()=>_h(a),a.onsuccess=()=>{const o=a.result;if(n==null){const i=o.transaction(Da,"readonly"),u=i.objectStore(Da).get(this.modelPath);u.onsuccess=()=>{if(u.result==null)return o.close(),s(new Error("Cannot find model with path '".concat(this.modelPath,"' ")+"in IndexedDB."));r(u.result.modelArtifacts)},u.onerror=c=>(o.close(),s(u.error)),i.oncomplete=()=>o.close()}else{n.weightData=Lr.join(n.weightData);const i=Hc(n),l=o.transaction(qs,"readwrite");let u=l.objectStore(qs),c;try{c=u.put({modelPath:this.modelPath,modelArtifactsInfo:i})}catch(f){return s(f)}let d;c.onsuccess=()=>{d=o.transaction(Da,"readwrite");const f=d.objectStore(Da);let p;try{p=f.put({modelPath:this.modelPath,modelArtifacts:n,modelArtifactsInfo:i})}catch(h){return s(h)}p.onsuccess=()=>r({modelArtifactsInfo:i}),p.onerror=h=>{u=l.objectStore(qs);const m=u.delete(this.modelPath);m.onsuccess=()=>(o.close(),s(p.error)),m.onerror=g=>(o.close(),s(p.error))}},c.onerror=f=>(o.close(),s(c.error)),l.oncomplete=()=>{d==null?o.close():d.oncomplete=()=>o.close()}}},a.onerror=o=>s(a.error)})}}Ha.URL_SCHEME="indexeddb://";const vw=t=>Qe().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Ha.URL_SCHEME)?WN(t.slice(Ha.URL_SCHEME.length)):null;zt.registerSaveRouter(vw);zt.registerLoadRouter(vw);function WN(t){return new Ha(t)}function zN(t){return t.startsWith(Ha.URL_SCHEME)?t.slice(Ha.URL_SCHEME.length):t}class HN{constructor(){this.indexedDB=yw()}async listModels(){return new Promise((e,n)=>{const r=this.indexedDB.open(Sh,xh);r.onupgradeneeded=()=>_h(r),r.onsuccess=()=>{const s=r.result,a=s.transaction(qs,"readonly"),i=a.objectStore(qs).getAll();i.onsuccess=()=>{const l={};for(const u of i.result)l[u.modelPath]=u.modelArtifactsInfo;e(l)},i.onerror=l=>(s.close(),n(i.error)),a.oncomplete=()=>s.close()},r.onerror=s=>n(r.error)})}async removeModel(e){return e=zN(e),new Promise((n,r)=>{const s=this.indexedDB.open(Sh,xh);s.onupgradeneeded=()=>_h(s),s.onsuccess=()=>{const a=s.result,o=a.transaction(qs,"readwrite"),i=o.objectStore(qs),l=i.get(e);let u;l.onsuccess=()=>{if(l.result==null)return a.close(),r(new Error("Cannot find model with path '".concat(e,"' ")+"in IndexedDB."));{const c=i.delete(e),d=()=>{u=a.transaction(Da,"readwrite");
435const p=u.objectStore(Da).delete(e);p.onsuccess=()=>n(l.result.modelArtifactsInfo),p.onerror=h=>r(l.error)};c.onsuccess=d,c.onerror=f=>(d(),a.close(),r(l.error))}},l.onerror=c=>(a.close(),r(l.error)),o.oncomplete=()=>{u==null?a.close():u.oncomplete=()=>a.close()}},s.onerror=a=>r(s.error)})}}/** 436 * @license 437 * Copyright 2018 Google LLC. All Rights Reserved. 438 * Licensed under the Apache License, Version 2.0 (the "License"); 439 * you may not use this file except in compliance with the License. 440 * You may obtain a copy of the License at 441 * 442 * http://www.apache.org/licenses/LICENSE-2.0 443 * 444 * Unless required by applicable law or agreed to in writing, software 445 * distributed under the License is distributed on an "AS IS" BASIS, 446 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 447 * See the License for the specific language governing permissions and 448 * limitations under the License. 449 * ============================================================================= 450 */const gs="/",Co="tensorflowjs_models",bw="info",UN="model_topology",VN="weight_specs",jN="weight_data",GN="model_metadata";function ww(t){return{info:[Co,t,bw].join(gs),topology:[Co,t,UN].join(gs),weightSpecs:[Co,t,VN].join(gs),weightData:[Co,t,jN].join(gs),modelMetadata:[Co,t,GN].join(gs)}}function Sw(t){for(const e of Object.values(t))window.localStorage.removeItem(e)}function qN(t){const e=t.split(gs);if(e.length<3)throw new Error("Invalid key format: ".concat(t));return e.slice(1,e.length-1).join(gs)}function KN(t){return t.startsWith(Ua.URL_SCHEME)?t.slice(Ua.URL_SCHEME.length):t}class Ua{constructor(e){if(!Qe().getBool("IS_BROWSER")||typeof window>"u"||typeof window.localStorage>"u")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=ww(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const n=JSON.stringify(e.modelTopology),r=JSON.stringify(e.weightSpecs),s=Hc(e),a=Lr.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(s)),this.LS.setItem(this.keys.topology,n),this.LS.setItem(this.keys.weightSpecs,r),this.LS.setItem(this.keys.weightData,NN(a));const o={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:e.signature!=null?e.signature:void 0,userDefinedMetadata:e.userDefinedMetadata!=null?e.userDefinedMetadata:void 0,modelInitializer:e.modelInitializer!=null?e.modelInitializer:void 0,initializerSignature:e.initializerSignature!=null?e.initializerSignature:void 0,trainingConfig:e.trainingConfig!=null?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(o)),{modelArtifactsInfo:s}}catch(o){throw Sw(this.keys),new Error("Failed to save model '".concat(this.modelPath,"' to local storage: ")+"size quota being exceeded is a possible cause of this failure: "+"modelTopologyBytes=".concat(s.modelTopologyBytes,", ")+"weightSpecsBytes=".concat(s.weightSpecsBytes,", ")+"weightDataBytes=".concat(s.weightDataBytes,"."))}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error("In local storage, there is no model with name '".concat(this.modelPath,"'"));if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const n={},r=JSON.parse(this.LS.getItem(this.keys.topology));if(r==null)throw new Error("In local storage, the topology of model '".concat(this.modelPath,"' ")+"is missing.");n.modelTopology=r;const s=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(s==null)throw new Error("In local storage, the weight specs of model '".concat(this.modelPath,"' ")+"are missing.");n.weightSpecs=s;const a=this.LS.getItem(this.keys.modelMetadata);if(a!=null){const i=JSON.parse(a);n.format=i.format,n.generatedBy=i.generatedBy,n.convertedBy=i.convertedBy,i.signature!=null&&(n.signature=i.signature),i.userDefinedMetadata!=null&&(n.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(n.modelInitializer=i.modelInitializer),i.initializerSignature!=null&&(n.initializerSignature=i.initializerSignature),i.trainingConfig!=null&&(n.trainingConfig=i.trainingConfig)}const o=this.LS.getItem(this.keys.weightData);if(o==null)throw new Error("In local storage, the binary weight values of model "+"'".concat(this.modelPath,"' are missing."));return n.weightData=AN(o),n}}Ua.URL_SCHEME="localstorage://";const xw=t=>
450Qe().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Ua.URL_SCHEME)?XN(t.slice(Ua.URL_SCHEME.length)):null;zt.registerSaveRouter(xw);zt.registerLoadRouter(xw);function XN(t){return new Ua(t)}class YN{constructor(){A(Qe().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),A(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const e={},n=Co+gs,r=gs+bw;for(let s=0;s<this.LS.length;++s){const a=this.LS.key(s);if(a.startsWith(n)&&a.endsWith(r)){const o=qN(a);e[o]=JSON.parse(this.LS.getItem(a))}}return e}async removeModel(e){e=KN(e);const n=ww(e);if(this.LS.getItem(n.info)==null)throw new Error("Cannot find model at path '".concat(e,"'"));const r=JSON.parse(this.LS.getItem(n.info));return Sw(n),r}}/** 451 * @license 452 * Copyright 2018 Google LLC. All Rights Reserved. 453 * Licensed under the Apache License, Version 2.0 (the "License"); 454 * you may not use this file except in compliance with the License. 455 * You may obtain a copy of the License at 456 * 457 * http://www.apache.org/licenses/LICENSE-2.0 458 * 459 * Unless required by applicable law or agreed to in writing, software 460 * distributed under the License is distributed on an "AS IS" BASIS, 461 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 462 * See the License for the specific language governing permissions and 463 * limitations under the License. 464 * ============================================================================= 465 */const Wo="://";class Nn{constructor(){this.managers={}}static getInstance(){return Nn.instance==null&&(Nn.instance=new Nn),Nn.instance}static registerManager(e,n){A(e!=null,()=>"scheme must not be undefined or null."),e.endsWith(Wo)&&(e=e.slice(0,e.indexOf(Wo))),A(e.length>0,()=>"scheme must not be an empty string.");const r=Nn.getInstance();A(r.managers[e]==null,()=>"A model store manager is already registered for scheme '".concat(e,"'.")),r.managers[e]=n}static getManager(e){const n=Nn.getInstance().managers[e];if(n==null)throw new Error("Cannot find model manager for scheme '".concat(e,"'"));return n}static getSchemes(){return Object.keys(Nn.getInstance().managers)}}function Ml(t){if(t.indexOf(Wo)===-1)throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+"".concat(Nn.getSchemes().join(",")));return{scheme:t.split(Wo)[0],path:t.split(Wo)[1]}}async function _w(t,e,n=!1){A(t!==e,()=>"Old path and new path are the same: '".concat(t,"'"));const r=zt.getLoadHandlers(t);A(r.length>0,()=>"Copying failed because no load handler is found for source URL ".concat(t,".")),A(r.length<2,()=>"Copying failed because more than one (".concat(r.length,") ")+"load handlers for source URL ".concat(t,"."));const s=r[0],a=zt.getSaveHandlers(e);A(a.length>0,()=>"Copying failed because no save handler is found for destination "+"URL ".concat(e,".")),A(a.length<2,()=>"Copying failed because more than one (".concat(r.length,") ")+"save handlers for destination URL ".concat(e,"."));const o=a[0],i=Ml(t).scheme,l=Ml(t).path,u=i===Ml(t).scheme,c=await s.load();n&&u&&await Nn.getManager(i).removeModel(l);const d=await o.save(c);return n&&!u&&await Nn.getManager(i).removeModel(l),d.modelArtifactsInfo}async function JN(){const t=Nn.getSchemes(),e={};for(const n of t){const r=await Nn.getManager(n).listModels();for(const s in r){const a=n+Wo+s;e[a]=r[s]}}return e}async function QN(t){const e=Ml(t);return Nn.getManager(e.scheme).removeModel(e.path)}async function ZN(t,e){return _w(t,e,!1)}async function eA(t,e){return _w(t,e,!0)}/** 466 * @license 467 * Copyright 2019 Google LLC. All Rights Reserved. 468 * Licensed under the Apache License, Version 2.0 (the "License"); 469 * you may not use this file except in compliance with the License. 470 * You may obtain a copy of the License at 471 * 472 * http://www.apache.org/licenses/LICENSE-2.0 473 * 474 * Unless required by applicable law or agreed to in writing, software 475 * distributed under the License is distributed on an "AS IS" BASIS, 476 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 477 * See the License for the specific language governing permissions and 478 * limitations under the License. 479 * ============================================================================= 480 */class tA{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}
vendor: 4,503 bytes, lines 480-528
480fetch(e,n){return fetch(e,n)}now(){return performance.now()}encode(e,n){if(n!=="utf-8"&&n!=="utf8")throw new Error("Browser's encoder only supports utf-8, but got ".concat(n));return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,n){return new TextDecoder(n).decode(e)}setTimeoutCustom(e,n){if(typeof window>"u"||!Qe().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(e,n);return}this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},n),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",r=>{if(r.source===window&&r.data.name===this.messageName){r.stopPropagation();const s=this.functionRefs[r.data.index];s(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(e){return Y1(e)}}if(Qe().get("IS_BROWSER")){Qe().setPlatform("browser",new tA);try{Nn.registerManager(Ua.URL_SCHEME,new YN)}catch(t){}try{Nn.registerManager(Ha.URL_SCHEME,new HN)}catch(t){}}/** 481 * @license 482 * Copyright 2019 Google LLC. All Rights Reserved. 483 * Licensed under the Apache License, Version 2.0 (the "License"); 484 * you may not use this file except in compliance with the License. 485 * You may obtain a copy of the License at 486 * 487 * http://www.apache.org/licenses/LICENSE-2.0 488 * 489 * Unless required by applicable law or agreed to in writing, software 490 * distributed under the License is distributed on an "AS IS" BASIS, 491 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 492 * See the License for the specific language governing permissions and 493 * limitations under the License. 494 * ============================================================================= 495 */const nA={importFetch:()=>require("node-fetch")};let xp;class rA{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,n){return Qe().global.fetch!=null?Qe().global.fetch(e,n):(xp==null&&(xp=nA.importFetch()),xp(e,n))}now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,n){if(n!=="utf-8"&&n!=="utf8")throw new Error("Node built-in encoder only supports utf-8, but got ".concat(n));return this.textEncoder.encode(e)}decode(e,n){return e.length===0?"":new this.util.TextDecoder(n).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}Qe().get("IS_NODE")&&!Qe().get("IS_BROWSER")&&Qe().setPlatform("node",new rA);/** 496 * @license 497 * Copyright 2020 Google Inc. All Rights Reserved. 498 * Licensed under the Apache License, Version 2.0 (the "License"); 499 * you may not use this file except in compliance with the License. 500 * You may obtain a copy of the License at 501 * 502 * http://www.apache.org/licenses/LICENSE-2.0 503 * 504 * Unless required by applicable law or agreed to in writing, software 505 * distributed under the License is distributed on an "AS IS" BASIS, 506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 507 * See the License for the specific language governing permissions and 508 * limitations under the License. 509 * ============================================================================= 510 */function rt(t,e="float32",n){return e=e||"float32",dr(t),new on(t,e,n)}/** 511 * @license 512 * Copyright 2020 Google Inc. All Rights Reserved. 513 * Licensed under the Apache License, Version 2.0 (the "License"); 514 * you may not use this file except in compliance with the License. 515 * You may obtain a copy of the License at 516 * 517 * http://www.apache.org/licenses/LICENSE-2.0 518 * 519 * Unless required by applicable law or agreed to in writing, software 520 * distributed under the License is distributed on an "AS IS" BASIS, 521 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 522 * See the License for the specific language governing permissions and 523 * limitations under the License. 524 * ============================================================================= 525 */function sA(t,e){const n=C(t,"x","cast");if(!WC(e))throw new Error("Failed to cast to unknown dtype ".concat(e));if(e==="string"&&n.dtype!=="string"||e!=="string"&&n.dtype==="string")throw new Error("Only strings can be casted to strings");const r={x:n},s={dtype:e};return W.runKernel(Yu,r,s)}const Ut=P({cast_:sA});/** 526 * @license 527 * Copyright 2020 Google LLC. All Rights Reserved. 528 * Licensed under the Apache License, Version 2.0 (the "License");
529 * you may not use this file except in compliance with the License. 530 * You may obtain a copy of the License at 531 * 532 * http://www.apache.org/licenses/LICENSE-2.0 533 * 534 * Unless required by applicable law or agreed to in writing, software 535 * distributed under the License is distributed on an "AS IS" BASIS, 536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 537 * See the License for the specific language governing permissions and 538 * limitations under the License. 539 * ============================================================================= 540 */function aA(t){const n={x:C(t,"x","clone","string_or_numeric")};return W.runKernel(_d,n)}const Xs=P({clone_:aA});/** 541 * @license 542 * Copyright 2020 Google Inc. All Rights Reserved. 543 * Licensed under the Apache License, Version 2.0 (the "License"); 544 * you may not use this file except in compliance with the License. 545 * You may obtain a copy of the License at 546 * 547 * http://www.apache.org/licenses/LICENSE-2.0 548 * 549 * Unless required by applicable law or agreed to in writing, software 550 * distributed under the License is distributed on an "AS IS" BASIS, 551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 552 * See the License for the specific language governing permissions and 553 * limitations under the License. 554 * ============================================================================= 555 */function Iw(t,e=!1){console.log(t.toString(e))}/** 556 * @license 557 * Copyright 2020 Google Inc. All Rights Reserved. 558 * Licensed under the Apache License, Version 2.0 (the "License"); 559 * you may not use this file except in compliance with the License. 560 * You may obtain a copy of the License at 561 * 562 * http://www.apache.org/licenses/LICENSE-2.0 563 * 564 * Unless required by applicable law or agreed to in writing, software 565 * distributed under the License is distributed on an "AS IS" BASIS, 566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 567 * See the License for the specific language governing permissions and 568 * limitations under the License. 569 * ============================================================================= 570 */uw();const oA={buffer:rt,cast:Ut,clone:Xs,print:Iw};yN(oA);/** 571 * @license 572 * Copyright 2018 Google LLC. All Rights Reserved. 573 * Licensed under the Apache License, Version 2.0 (the "License"); 574 * you may not use this file except in compliance with the License. 575 * You may obtain a copy of the License at 576 * 577 * http://www.apache.org/licenses/LICENSE-2.0 578 * 579 * Unless required by applicable law or agreed to in writing, software 580 * distributed under the License is distributed on an "AS IS" BASIS, 581 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 582 * See the License for the specific language governing permissions and 583 * limitations under the License. 584 * ============================================================================= 585 */function Ih(){return W}function nt(t,e){return W.tidy(t,e)}function cn(t){cw(t).forEach(n=>n.dispose())}function Qr(t){return W.keep(t)}function kv(t){return W.setBackend(t)}function iA(){return W.ready()}function kw(t,e,n=1){return W.registerBackend(t,e,n)}/** 586 * @license 587 * Copyright 2020 Google LLC. All Rights Reserved. 588 * Licensed under the Apache License, Version 2.0 (the "License"); 589 * you may not use this file except in compliance with the License. 590 * You may obtain a copy of the License at 591 * 592 * http://www.apache.org/licenses/LICENSE-2.0 593 * 594 * Unless required by applicable law or agreed to in writing, software 595 * distributed under the License is distributed on an "AS IS" BASIS, 596 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 597 * See the License for the specific language governing permissions and 598 * limitations under the License. 599 * ============================================================================= 600 */function cA(t,e){let n=C(t,"a","add"),r=C(e,"b","add");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(Bc,s)}const Fe=P({add_:cA});/** 601 * @license 602 * Copyright 2020 Google LLC. All Rights Reserved. 603 * Licensed under the Apache License, Version 2.0 (the "License");
604 * you may not use this file except in compliance with the License. 605 * You may obtain a copy of the License at 606 * 607 * http://www.apache.org/licenses/LICENSE-2.0 608 * 609 * Unless required by applicable law or agreed to in writing, software 610 * distributed under the License is distributed on an "AS IS" BASIS, 611 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 612 * See the License for the specific language governing permissions and 613 * limitations under the License. 614 * ============================================================================= 615 */function lA(t,e){let n=C(t,"a","floorDiv"),r=C(e,"b","floorDiv");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(vd,s)}const Ew=P({floorDiv_:lA});/** 616 * @license 617 * Copyright 2020 Google LLC. All Rights Reserved. 618 * Licensed under the Apache License, Version 2.0 (the "License"); 619 * you may not use this file except in compliance with the License. 620 * You may obtain a copy of the License at 621 * 622 * http://www.apache.org/licenses/LICENSE-2.0 623 * 624 * Unless required by applicable law or agreed to in writing, software 625 * distributed under the License is distributed on an "AS IS" BASIS, 626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 627 * See the License for the specific language governing permissions and 628 * limitations under the License. 629 * ============================================================================= 630 */function uA(t,e){let n=C(t,"a","div"),r=C(e,"b","div");if([n,r]=Xt(n,r),n.dtype==="int32"&&r.dtype==="int32")return Ew(n,r);const s={a:n,b:r},a={};return W.runKernel(ud,s,a)}const tt=P({div_:uA});/** 631 * @license 632 * Copyright 2020 Google LLC. All Rights Reserved. 633 * Licensed under the Apache License, Version 2.0 (the "License"); 634 * you may not use this file except in compliance with the License. 635 * You may obtain a copy of the License at 636 * 637 * http://www.apache.org/licenses/LICENSE-2.0 638 * 639 * Unless required by applicable law or agreed to in writing, software 640 * distributed under the License is distributed on an "AS IS" BASIS, 641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 642 * See the License for the specific language governing permissions and 643 * limitations under the License. 644 * ============================================================================= 645 */function dA(t,e){let n=C(t,"a","mul"),r=C(e,"b","mul");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(Gd,s)}const he=P({mul_:dA});/** 646 * @license 647 * Copyright 2018 Google LLC. All Rights Reserved. 648 * Licensed under the Apache License, Version 2.0 (the "License"); 649 * you may not use this file except in compliance with the License. 650 * You may obtain a copy of the License at 651 * 652 * http://www.apache.org/licenses/LICENSE-2.0 653 * 654 * Unless required by applicable law or agreed to in writing, software 655 * distributed under the License is distributed on an "AS IS" BASIS, 656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 657 * See the License for the specific language governing permissions and 658 * limitations under the License. 659 * ============================================================================= 660 */function fA(t){const e=C(t,"x","abs");if(e.dtype==="complex64"){const n={x:e};return W.runKernel($1,n)}else{const n={x:e};return W.runKernel(Tm,n)}}const ir=P({abs_:fA});/** 661 * @license 662 * Copyright 2018 Google LLC. All Rights Reserved. 663 * Licensed under the Apache License, Version 2.0 (the "License"); 664 * you may not use this file except in compliance with the License. 665 * You may obtain a copy of the License at 666 * 667 * http://www.apache.org/licenses/LICENSE-2.0 668 * 669 * Unless required by applicable law or agreed to in writing, software 670 * distributed under the License is distributed on an "AS IS" BASIS, 671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 672 * See the License for the specific language governing permissions and 673 * limitations under the License. 674 * ============================================================================= 675 */function pA(t){const n={x:C(t,"x","acos")};return W.runKernel(Ou,n)}const hA=P({acos_:pA});/** 676 * @license 677 * Copyright 2018 Google LLC. All Rights Reserved. 678 * Licensed under the Apache License, Version 2.0 (the "License");
679 * you may not use this file except in compliance with the License. 680 * You may obtain a copy of the License at 681 * 682 * http://www.apache.org/licenses/LICENSE-2.0 683 * 684 * Unless required by applicable law or agreed to in writing, software 685 * distributed under the License is distributed on an "AS IS" BASIS, 686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 687 * See the License for the specific language governing permissions and 688 * limitations under the License. 689 * ============================================================================= 690 */function mA(t){const n={x:C(t,"x","acosh")};return W.runKernel(Pu,n)}const gA=P({acosh_:mA});/** 691 * @license 692 * Copyright 2020 Google LLC. All Rights Reserved. 693 * Licensed under the Apache License, Version 2.0 (the "License"); 694 * you may not use this file except in compliance with the License. 695 * You may obtain a copy of the License at 696 * 697 * http://www.apache.org/licenses/LICENSE-2.0 698 * 699 * Unless required by applicable law or agreed to in writing, software 700 * distributed under the License is distributed on an "AS IS" BASIS, 701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 702 * See the License for the specific language governing permissions and 703 * limitations under the License. 704 * ============================================================================= 705 */function yA(t){A(Array.isArray(t),()=>"The argument passed to tf.addN() must be a list of tensors"),A(t.length>=1,()=>"Must pass at least one tensor to tf.addN(), but got "+"".concat(t.length));const e=t.map((s,a)=>C(s,"tensors".concat(a),"addN")),n=e[0];e.forEach(s=>{if(s.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),e.forEach(s=>{if(!Ir(s.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});const r=e;return W.runKernel(Bu,r)}const vA=P({addN_:yA});/** 706 * @license 707 * Copyright 2020 Google LLC. All Rights Reserved. 708 * Licensed under the Apache License, Version 2.0 (the "License"); 709 * you may not use this file except in compliance with the License. 710 * You may obtain a copy of the License at 711 * 712 * http://www.apache.org/licenses/LICENSE-2.0 713 * 714 * Unless required by applicable law or agreed to in writing, software 715 * distributed under the License is distributed on an "AS IS" BASIS, 716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 717 * See the License for the specific language governing permissions and 718 * limitations under the License. 719 * ============================================================================= 720 */function bA(t,e=null,n=!1){const s={x:C(t,"x","all","bool")},a={axis:e,keepDims:n};return W.runKernel(Lu,s,a)}const wA=P({all_:bA});/** 721 * @license 722 * Copyright 2020 Google LLC. All Rights Reserved. 723 * Licensed under the Apache License, Version 2.0 (the "License"); 724 * you may not use this file except in compliance with the License. 725 * You may obtain a copy of the License at 726 * 727 * http://www.apache.org/licenses/LICENSE-2.0 728 * 729 * Unless required by applicable law or agreed to in writing, software 730 * distributed under the License is distributed on an "AS IS" BASIS, 731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 732 * See the License for the specific language governing permissions and 733 * limitations under the License. 734 * ============================================================================= 735 */function SA(t,e=null,n=!1){const s={x:C(t,"x","any","bool")},a={axis:e,keepDims:n};return W.runKernel(Wu,s,a)}const xA=P({any_:SA});/** 736 * @license 737 * Copyright 2020 Google Inc. All Rights Reserved. 738 * Licensed under the Apache License, Version 2.0 (the "License"); 739 * you may not use this file except in compliance with the License. 740 * You may obtain a copy of the License at 741 * 742 * http://www.apache.org/licenses/LICENSE-2.0 743 * 744 * Unless required by applicable law or agreed to in writing, software 745 * distributed under the License is distributed on an "AS IS" BASIS, 746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 747 * See the License for the specific language governing permissions and 748 * limitations under the License. 749 * ============================================================================= 750 */function _A(t,e=0){const r={x:C(t,"x","argMax")},s={axis:e};return W.runKernel(Cm,r,s)}const IA=P({argMax_:_A});/** 751 * @license 752 * Copyright 2020 Google Inc. All Rights Reserved. 753 * Licensed under the Apache License, Version 2.0 (the "License");
754 * you may not use this file except in compliance with the License. 755 * You may obtain a copy of the License at 756 * 757 * http://www.apache.org/licenses/LICENSE-2.0 758 * 759 * Unless required by applicable law or agreed to in writing, software 760 * distributed under the License is distributed on an "AS IS" BASIS, 761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 762 * See the License for the specific language governing permissions and 763 * limitations under the License. 764 * ============================================================================= 765 */function kA(t,e=0){const r={x:C(t,"x","argMin")},s={axis:e};return W.runKernel(Nm,r,s)}const EA=P({argMin_:kA});/** 766 * @license 767 * Copyright 2018 Google LLC. All Rights Reserved. 768 * Licensed under the Apache License, Version 2.0 (the "License"); 769 * you may not use this file except in compliance with the License. 770 * You may obtain a copy of the License at 771 * 772 * http://www.apache.org/licenses/LICENSE-2.0 773 * 774 * Unless required by applicable law or agreed to in writing, software 775 * distributed under the License is distributed on an "AS IS" BASIS, 776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 777 * See the License for the specific language governing permissions and 778 * limitations under the License. 779 * ============================================================================= 780 */function TA(t){const n={x:C(t,"x","asin")};return W.runKernel(zu,n)}const CA=P({asin_:TA});/** 781 * @license 782 * Copyright 2018 Google LLC. All Rights Reserved. 783 * Licensed under the Apache License, Version 2.0 (the "License"); 784 * you may not use this file except in compliance with the License. 785 * You may obtain a copy of the License at 786 * 787 * http://www.apache.org/licenses/LICENSE-2.0 788 * 789 * Unless required by applicable law or agreed to in writing, software 790 * distributed under the License is distributed on an "AS IS" BASIS, 791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 792 * See the License for the specific language governing permissions and 793 * limitations under the License. 794 * ============================================================================= 795 */function NA(t){const n={x:C(t,"x","asinh")};return W.runKernel(Hu,n)}const AA=P({asinh_:NA});/** 796 * @license 797 * Copyright 2018 Google LLC. All Rights Reserved. 798 * Licensed under the Apache License, Version 2.0 (the "License"); 799 * you may not use this file except in compliance with the License. 800 * You may obtain a copy of the License at 801 * 802 * http://www.apache.org/licenses/LICENSE-2.0 803 * 804 * Unless required by applicable law or agreed to in writing, software 805 * distributed under the License is distributed on an "AS IS" BASIS, 806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 807 * See the License for the specific language governing permissions and 808 * limitations under the License. 809 * ============================================================================= 810 */function $A(t){const n={x:C(t,"x","atan")};return W.runKernel(Uu,n)}const RA=P({atan_:$A});/** 811 * @license 812 * Copyright 2020 Google LLC. All Rights Reserved. 813 * Licensed under the Apache License, Version 2.0 (the "License"); 814 * you may not use this file except in compliance with the License. 815 * You may obtain a copy of the License at 816 * 817 * http://www.apache.org/licenses/LICENSE-2.0 818 * 819 * Unless required by applicable law or agreed to in writing, software 820 * distributed under the License is distributed on an "AS IS" BASIS, 821 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 822 * See the License for the specific language governing permissions and 823 * limitations under the License. 824 * ============================================================================= 825 */function DA(t,e){let n=C(t,"a","atan2"),r=C(e,"b","atan2");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(ju,s)}const FA=P({atan2_:DA});/** 826 * @license 827 * Copyright 2018 Google LLC. All Rights Reserved. 828 * Licensed under the Apache License, Version 2.0 (the "License"); 829 * you may not use this file except in compliance with the License. 830 * You may obtain a copy of the License at 831 * 832 * http://www.apache.org/licenses/LICENSE-2.0 833 * 834 * Unless required by applicable law or agreed to in writing, softw
834are 835 * distributed under the License is distributed on an "AS IS" BASIS, 836 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 837 * See the License for the specific language governing permissions and 838 * limitations under the License. 839 * ============================================================================= 840 */function MA(t){const n={x:C(t,"x","atanh")};return W.runKernel(Vu,n)}const OA=P({atanh_:MA});/** 841 * @license 842 * Copyright 2020 Google LLC. All Rights Reserved. 843 * Licensed under the Apache License, Version 2.0 (the "License"); 844 * you may not use this file except in compliance with the License. 845 * You may obtain a copy of the License at 846 * 847 * http://www.apache.org/licenses/LICENSE-2.0 848 * 849 * Unless required by applicable law or agreed to in writing, software 850 * distributed under the License is distributed on an "AS IS" BASIS, 851 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 852 * See the License for the specific language governing permissions and 853 * limitations under the License. 854 * ============================================================================= 855 */function li(t,e,n,r,s="NHWC",a){const o=t[3],i=[...e,o],l=ui(s);return Vn(t,i,n,a,r,null,null,l)}function Wr(t,e,n,r,s,a,o="channelsLast"){const[i,l]=Sc(e);let u;if(o==="channelsLast")u=[i,l,t[3],t[3]];else if(o==="channelsFirst")u=[i,l,t[1],t[1]];else throw new Error("Unknown dataFormat ".concat(o));return Vn(t,u,n,r,s,a,!1,o)}function ia(t,e,n,r,s,a,o="NDHWC"){const[i,l,u]=kh(e);let c,d;if(o==="NDHWC")d="channelsLast",c=[i,l,u,t[4],t[4]];else if(o==="NCDHW")d="channelsFirst",c=[i,l,u,t[1],t[1]];else throw new Error("Unknown dataFormat ".concat(o));return no(t,c,n,r,s,!1,d,a)}function Vn(t,e,n,r,s,a,o=!1,i="channelsLast"){let[l,u,c,d]=[-1,-1,-1,-1];if(i==="channelsLast")[l,u,c,d]=t;else if(i==="channelsFirst")[l,d,u,c]=t;else throw new Error("Unknown dataFormat ".concat(i));const[f,p,,h]=e,[m,g]=Sc(n),[v,b]=Sc(r),w=zo(f,v),S=zo(p,b),{padInfo:I,outHeight:E,outWidth:T}=LA(s,u,c,m,g,w,S,a,i),D=o?h*d:h;let R;return i==="channelsFirst"?R=[l,D,E,T]:i==="channelsLast"&&(R=[l,E,T,D]),{batchSize:l,dataFormat:i,inHeight:u,inWidth:c,inChannels:d,outHeight:E,outWidth:T,outChannels:D,padInfo:I,str
855ideHeight:m,strideWidth:g,filterHeight:f,filterWidth:p,effectiveFilterHeight:w,effectiveFilterWidth:S,dilationHeight:v,dilationWidth:b,inShape:t,outShape:R,filterShape:e}}function no(t,e,n,r,s,a=!1,o="channelsLast",i){let[l,u,c,d,f]=[-1,-1,-1,-1,-1];if(o==="channelsLast")[l,u,c,d,f]=t;else if(o==="channelsFirst")[l,f,u,c,d]=t;else throw new Error("Unknown dataFormat ".concat(o));const[p,h,m,,g]=e,[v,b,w]=kh(n),[S,I,E]=kh(r),T=zo(p,S),D=zo(h,I),R=zo(m,E),{padInfo:$,outDepth:M,outHeight:B,outWidth:z}=WA(s,u,c,d,v,b,w,T,D,R,i),H=a?g*f:g;let V;return o==="channelsFirst"?V=[l,H,M,B,z]:o==="channelsLast"&&(V=[l,M,B,z,H]),{batchSize:l,dataFormat:o,inDepth:u,inHeight:c,inWidth:d,inChannels:f,outDepth:M,outHeight:B,outWidth:z,outChannels:H,padInfo:$,strideDepth:v,strideHeight:b,strideWidth:w,filterDepth:p,filterHeight:h,filterWidth:m,effectiveFilterDepth:T,effectiveFilterHeight:D,effectiveFilterWidth:R,dilationDepth:S,dilationHeight:I,dilationWidth:E,inShape:t,outShape:V,filterShape:e}}function PA(t,e,n,r,s){r==null&&(r=Tw(t,e,n));const a=t[0],o=t[1],i=xc((a-e+2*r)/n+1,s),l=xc((o-e+2*r)/n+1,s);return[i,l]}function BA(t,e,n,r,s,a){s==null&&(s=Tw(t,e[0],r[0]));const o=[0,0,0,n];for(let i=0;i<3;i++)t[i]+2*s>=e[i]&&(o[i]=xc((t[i]-e[i]+2*s)/r[i]+1,a));return o}function Tw(t,e,n,r=1){const s=zo(e,r);return Math.floor((t[0]*(n-1)-n+s)/2)}function Sc(t){return typeof t=="number"?[t,t,t]:t.length===2?[t[0],t[1],1]:t}function kh(t){return typeof t=="number"?[t,t,t]:t}function zo(t,e){return e<=1?t:t+(t-1)*(e-1)}function LA(t,e,n,r,s,a,o,i,l){let u,c,d;if(typeof t=="number"){u={top:t,bottom:t,left:t,right:t,type:t===0?"VALID":"NUMBER"};const p=PA([e,n],a,r,t,i);c=p[0],d=p[1]}else if(t==="same"){c=Math.ceil(e/r),d=Math.ceil(n/s);const f=Math.max(0,(c-1)*r+a-e),p=Math.max(0,(d-1)*s+o-n),h=Math.floor(f/2),m=f-h,g=Math.floor(p/2),v=p-g;u={top:h,bottom:m,left:g,right:v,type:"SAME"}}else if(t==="valid")u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((e-a+1)/r),d=Math.ceil((n-o+1)/s);else if(typeof t=="object"){const f=l==="channelsLast"?t[1][0]:t[2][0],p=l==="channelsLast"?t[1][1]:t[2][1],h=l==="channelsLast"?t[2][0]:t[3][0],m=l==="channelsLast"?t[2][1]:t[3][1];u={top:f,bottom:p,left:h,right:m,type:f===0&&p===0&&h===0&&m===0?"VALID":"EXPLICIT"},c=xc((e-a+f+p)/r+1,i),d=xc((n-o+h+m)/s+1,i)}else throw Error("Unknown padding parameter: ".concat(t));return{padInfo:u,outHeight:c,outWidth:d}}function WA(t,e,n,r,s,a,o,i,l,u,c){let d,f,p,h;if(t==="valid"&&(t=0),typeof t=="number"){d={top:t,bottom:t,left:t,right:t,front:t,back:t,type:t===0?"VALID":"NUMBER"};const g=BA([e,n,r,1],[i,l,u],1,[s,a,o],t,c);f=g[0],p=g[1],h=g[2]}else if(t==="same"){f=Math.ceil(e/s),p=Math.ceil(n/a),h=Math.ceil(r/o);const m=(f-1)*s+i-e,g=(p-1)*a+l-n,v=(h-1)*o+u-r,b=Math.floor(m/2),w=m-b,S=Math.floor(g/2),I=g-S,E=Math.floor(v/2),T=v-E;d={top:S,bottom:I,left:E,right:T,front:b,back:w,type:"SAME"}}else throw Error("Unknown padding parameter: ".concat(t));return{padInfo:d,outDepth:f,outHeight:p,outWidth:h}}function xc(t,e){if(!e)return Math.trunc(t);switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error("Unknown roundingMode ".concat(e))}}function ou(t){const[e,n,r]=Sc(t);return e===1&&n===1&&r===1}function Tr(t,e){return ou(t)||ou(e)}function Yo(t){return Sc(t).every(e=>e>0)}function ui(t){if(t==="NHWC")return"channelsLast";if(t==="NCHW")return"channelsFirst";throw new Error("Unknown dataFormat ".concat(t))}function zr(t,e,n){if(n!=null){if(typeof e=="string")throw Error("Error in ".concat(t,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(e,"."));if(typeof e=="number")A(hc(e),()=>"Error in ".concat(t,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(e,"."));else if(typeof e=="object")e.forEach(r=>{r.forEach(s=>{A(hc(s),()=>"Error in ".concat(t,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(s,"."))})});else throw Error("Error in ".concat(t,": Unknown padding parameter: ").concat(e))}}/** 856 * @license 857 * Copyright 2020 Google LLC. All Rights Reserved. 858 * Licensed under the Apache License, Version 2.0 (the "License");
859 * you may not use this file except in compliance with the License. 860 * You may obtain a copy of the License at 861 * 862 * http://www.apache.org/licenses/LICENSE-2.0 863 * 864 * Unless required by applicable law or agreed to in writing, software 865 * distributed under the License is distributed on an "AS IS" BASIS, 866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 867 * See the License for the specific language governing permissions and 868 * limitations under the License. 869 * ============================================================================= 870 */function zA(t,e){const r={x:C(t,"x","reshape","string_or_numeric")},s={shape:e};return W.runKernel(Km,r,s)}const re=P({reshape_:zA});/** 871 * @license 872 * Copyright 2020 Google LLC. All Rights Reserved. 873 * Licensed under the Apache License, Version 2.0 (the "License"); 874 * you may not use this file except in compliance with the License. 875 * You may obtain a copy of the License at 876 * 877 * http://www.apache.org/licenses/LICENSE-2.0 878 * 879 * Unless required by applicable law or agreed to in writing, software 880 * distributed under the License is distributed on an "AS IS" BASIS, 881 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 882 * See the License for the specific language governing permissions and 883 * limitations under the License. 884 * ============================================================================= 885 */function HA(t,e,n,r,s){const a=C(t,"x","avgPool","float32"),o=1;A(Tr(n,o),()=>"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(o,"'"));let i=a,l=!1;a.rank===3&&(l=!0,i=re(a,[1,a.shape[0],a.shape[1],a.shape[2]])),A(i.rank===4,()=>"Error in avgPool: x must be rank 4 but got rank ".concat(i.rank,".")),zr("avgPool",r,s);const u={x:i},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s};let d=W.runKernel(Gu,u,c);return d=Ut(d,a.dtype),l?re(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const Cw=P({avgPool_:HA});/** 886 * @license 887 * Copyright 2020 Google LLC. All Rights Reserved. 888 * Licensed under the Apache License, Version 2.0 (the "License"); 889 * you may not use this file except in compliance with the License. 890 * You may obtain a copy of the License at 891 * 892 * http://www.apache.org/licenses/LICENSE-2.0 893 * 894 * Unless required by applicable law or agreed to in writing, software 895 * distributed under the License is distributed on an "AS IS" BASIS, 896 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 897 * See the License for the specific language governing permissions and 898 * limitations under the License. 899 * ============================================================================= 900 */function UA(t,e,n,r,s,a="NDHWC"){const o=C(t,"x","avgPool3d","float32");let i=o,l=!1;o.rank===4&&(l=!0,i=re(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(i.rank===5,()=>"Error in avgPool3d: x must be rank 5 but got rank ".concat(i.rank,".")),A(a==="NDHWC",()=>"Error in avgPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(a)),A(typeof n=="number"&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,()=>"Error in avgPool3d: Stride must be > 0, but got '".concat(n,"'")),zr("avgPool3d",r,s);const u={x:i},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s,dataFormat:a};let d=W.runKernel(Am,u,c);return d=Ut(d,i.dtype),l?re(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const VA=P({avgPool3d_:UA});/** 901 * @license 902 * Copyright 2020 Google LLC. All Rights Reserved. 903 * Licensed under the Apache License, Version 2.0 (the "License"); 904 * you may not use this file except in compliance with the License. 905 * You may obtain a copy of the License at 906 * 907 * http://www.apache.org/licenses/LICENSE-2.0 908 * 909 * Unless required by applicable law or agreed to in writing, software 910 * distributed under the License is distributed on an "AS IS" BASIS, 911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 912 * See the License for the specific language governing permissions and 913 * limitations under the License. 914 * ============================================================================= 915 */function jA(t,e=0){A(t.length>=1,()=>"Pass at least one tensor to concat");const n=su(t,"tensors","concat","string_or_numeric");
915if(n[0].dtype==="complex64"&&n.forEach(a=>{if(a.dtype!=="complex64")throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype ".concat(a.dtype,". "))}),n.length===1)return Xs(n[0]);const r=n,s={axis:e};return W.runKernel(Dm,r,s)}const mn=P({concat_:jA});/** 916 * @license 917 * Copyright 2020 Google LLC. All Rights Reserved. 918 * Licensed under the Apache License, Version 2.0 (the "License"); 919 * you may not use this file except in compliance with the License. 920 * You may obtain a copy of the License at 921 * 922 * http://www.apache.org/licenses/LICENSE-2.0 923 * 924 * Unless required by applicable law or agreed to in writing, software 925 * distributed under the License is distributed on an "AS IS" BASIS, 926 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 927 * See the License for the specific language governing permissions and 928 * limitations under the License. 929 * ============================================================================= 930 */function GA(t,e,n=!1,r=!1){let s=C(t,"a","matMul"),a=C(e,"b","matMul");[s,a]=Xt(s,a);const o={a:s,b:a},i={transposeA:n,transposeB:r};return W.runKernel(qu,o,i)}const xt=P({matMul_:GA});/** 931 * @license 932 * Copyright 2018 Google LLC. All Rights Reserved. 933 * Licensed under the Apache License, Version 2.0 (the "License"); 934 * you may not use this file except in compliance with the License. 935 * You may obtain a copy of the License at 936 * 937 * http://www.apache.org/licenses/LICENSE-2.0 938 * 939 * Unless required by applicable law or agreed to in writing, software 940 * distributed under the License is distributed on an "AS IS" BASIS, 941 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 942 * See the License for the specific language governing permissions and 943 * limitations under the License. 944 * ============================================================================= 945 */function qA(t){const n={x:C(t,"x","sigmoid","float32")};return W.runKernel(vf,n)}const Ba=P({sigmoid_:qA});/** 946 * @license 947 * Copyright 2018 Google LLC. All Rights Reserved. 948 * Licensed under the Apache License, Version 2.0 (the "License"); 949 * you may not use this file except in compliance with the License. 950 * You may obtain a copy of the License at 951 * 952 * http://www.apache.org/licenses/LICENSE-2.0 953 * 954 * Unless required by applicable law or agreed to in writing, software 955 * distributed under the License is distributed on an "AS IS" BASIS, 956 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 957 * See the License for the specific language governing permissions and 958 * limitations under the License. 959 * ============================================================================= 960 */function KA(t,e,n){const r=C(t,"x","slice","string_or_numeric");if(r.rank===0)throw new Error("Slicing scalar is not possible");const s={x:r},a={begin:e,size:n};return W.runKernel(Qm,s,a)}const Ye=P({slice_:KA});/** 961 * @license 962 * Copyright 2018 Google LLC. All Rights Reserved. 963 * Licensed under the Apache License, Version 2.0 (the "License"); 964 * you may not use this file except in compliance with the License. 965 * You may obtain a copy of the License at 966 * 967 * http://www.apache.org/licenses/LICENSE-2.0 968 * 969 * Unless required by applicable law or agreed to in writing, software 970 * distributed under the License is distributed on an "AS IS" BASIS, 971 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 972 * See the License for the specific language governing permissions and 973 * limitations under the License. 974 * ============================================================================= 975 */function XA(t){const n={x:C(t,"x","tanh","float32")};return W.runKernel(Nf,n)}const Eh=P({tanh_:XA});/** 976 * @license 977 * Copyright 2020 Google LLC. All Rights Reserved. 978 * Licensed under the Apache License, Version 2.0 (the "License"); 979 * you may not use this file except in compliance with the License. 980 * You may obtain a copy of the License at 981 * 982 * http://www.apache.org/licenses/LICENSE-2.0 983 * 984 * Unless required by applicable law or agreed to in writing, software 985 * distributed under the License is distributed on an "AS IS" BASIS, 986 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 987 * See the License for the specific language governing permissions and 988 * limitations under the License. 989 * ============================================================================= 990 */function YA(t,e,n,r,s,a){const o=C(t,"forgetBias","basicLSTMCell"),i=C(e,"lstmKernel","basicLSTMCell"),l=C(n,"lstmBias","basicLSTMCell"),u=C(r,"data","basicLSTMCell"),c=C(s,"c","basicLSTMCell"),d=C(a,"h","basicLSTMCell"),f=mn([u,d],1),p=xt(f,
990i),h=Fe(p,l),m=h.shape[0],g=h.shape[1]/4,v=[m,g],b=Ye(h,[0,0],v),w=Ye(h,[0,g],v),S=Ye(h,[0,g*2],v),I=Ye(h,[0,g*3],v),E=Fe(he(Ba(b),Eh(w)),he(c,Ba(Fe(o,S)))),T=he(Eh(E),Ba(I));return[E,T]}const JA=P({basicLSTMCell_:YA});/** 991 * @license 992 * Copyright 2020 Google LLC. All Rights Reserved. 993 * Licensed under the Apache License, Version 2.0 (the "License"); 994 * you may not use this file except in compliance with the License. 995 * You may obtain a copy of the License at 996 * 997 * http://www.apache.org/licenses/LICENSE-2.0 998 * 999 * Unless required by applicable law or agreed to in writing, software 1000 * distributed under the License is distributed on an "AS IS" BASIS, 1001 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1002 * See the License for the specific language governing permissions and 1003 * limitations under the License. 1004 * ============================================================================= 1005 */function QA(t,e,n){const r=C(t,"x","batchToSpaceND"),s=e.reduce((i,l)=>i*l);A(r.rank>=1+e.length,()=>"input rank is ".concat(r.rank," but should be > than blockShape.length ").concat(e.length)),A(n.length===e.length,()=>"crops.length is ".concat(n.length," but should be equal to blockShape.length ").concat(e.length)),A(r.shape[0]%s===0,()=>"input tensor batch is ".concat(r.shape[0]," but is not divisible by the product of ")+"the elements of blockShape ".concat(e.join(" * ")," === ").concat(s));const a={x:r},o={blockShape:e,crops:n};return W.runKernel($m,a,o)}const Nw=P({batchToSpaceND_:QA});function ZA(t){let e;return t.rank===0||t.rank===1?e=re(t,[1,1,1,t.size]):t.rank===2?e=re(t,[1,1,t.shape[0],t.shape[1]]):t.rank===3?e=re(t,[1,t.shape[0],t.shape[1],t.shape[2]]):e=t,e}/** 1006 * @license 1007 * Copyright 2020 Google LLC. All Rights Reserved. 1008 * Licensed under the Apache License, Version 2.0 (the "License"); 1009 * you may not use this file except in compliance with the License. 1010 * You may obtain a copy of the License at 1011 * 1012 * http://www.apache.org/licenses/LICENSE-2.0 1013 * 1014 * Unless required by applicable law or agreed to in writing, software 1015 * distributed under the License is distributed on an "AS IS" BASIS, 1016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1017 * See the License for the specific language governing permissions and 1018 * limitations under the License. 1019 * ============================================================================= 1020 */function e4(t,e,n,r,s,a){a==null&&(a=.001);const o=C(t,"x","batchNorm"),i=C(e,"mean","batchNorm"),l=C(n,"variance","batchNorm");let u;s!=null&&(u=C(s,"scale","batchNorm"));let c;r!=null&&(c=C(r,"offset","batchNorm")),A(i.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),A(c==null||i.rank===c.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),A(u==null||i.rank===u.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");const f={x:ZA(o),scale:u,offset:c,mean:i,variance:l},p={varianceEpsilon:a},h=W.runKernel(bd,f,p);return re(h,o.shape)}const Ff=P({batchNorm_:e4});function t4(t,e,n,r,s,a){const o=C(t,"x","batchNorm"),i=C(e,"mean","batchNorm"),l=C(n,"variance","batchNorm");let u;s!=null&&(u=C(s,"scale","batchNorm"));let c;return r!=null&&(c=C(r,"offset","batchNorm")),A(o.rank===2,()=>"Error in batchNorm2D: x must be rank 2 but got rank "+"".concat(o.rank,".")),A(i.rank===2||i.rank===1,()=>"Error in batchNorm2D: mean must be rank 2 or rank 1 but "+"got rank ".concat(i.rank,".")),A(l.rank===2||l.rank===1,()=>"Error in batchNorm2D: variance must be rank 2 or rank 1 "+"but got rank ".concat(l.rank,".")),u!=null&&A(u.rank===2||u.rank===1,()=>"Error in batchNorm2D: scale must be rank 2 or rank 1 "+"but got rank ".concat(u.rank,".")),c!=null&&A(c.rank===2||c.rank===1,()=>"Error in batchNorm2D: offset must be rank 2 or rank 1 "+"but got rank ".concat(c.rank,".")),Ff(o,i,l,c,u,a)}const n4=P({batchNorm2d_:t4});function r4(t,e,n,r,s,a){const o=C(t,"x","batchNorm"),i=C(e,"mean","batchNorm"),l=C(n,"variance","batchNorm");let u;s!=null&&(u=C(s,"scale","batchNorm"));let c;return r!=null&&(c=C(r,"offset","batchNorm")),A(o.rank===3,()=>"Error in batchNorm3D: x must be rank 3 but got rank "+"".concat(o.rank,".")),A(i.rank===3||i.rank===1,()=>"Error in batchNorm3D: mean must be rank 3 or rank 1 but "+"got rank ".concat(i.rank,".")),A(l.rank===3||l.rank===1,()=>"Error in batchNorm3D: variance must be rank 3 or rank 1 "+"but got rank ".concat(l.rank,".")),u!=null&&A(u.rank===3||u.rank===1,()=>"Error in batchNorm3D: scale must be rank 3 or rank 1 "+"but got rank ".concat(u.rank,".")),c!=null&&A(c.rank===3||c.rank===1,()=>"Error in batchNorm3D: offset must be rank 3 or rank 1 "+"but got rank ".concat(c.rank,".")),Ff(o,i,l,c,u,a)}const s4=P({batchNorm3d_:r4});function a4(t,e,n,r,s,a){const o=C(t,"x","batchNorm"),i=C(e,"mean","batchNorm"),l=C(n,"variance","batchNorm");let u;s!=null&&(u=C(s,"scale","batchNorm"));let c;return r!=null&&(c=C(r,"offset","batchNorm")),A(o.rank===4,()=>"Error in batchNorm4D: x must be rank 4 but got rank "+"".concat(o.rank,".")),A(i.rank===4||i.rank===1,()=>"Error in batchNorm4D: mean must be rank 4 or rank 1 but "+"got rank ".concat(i.rank,".")),A(l.rank===4||l.rank===1,()=>"Error in batchNorm4D: variance must be rank 4 or rank 1 "+"but got rank ".concat(l.rank,".")),u!=null&&A(u.rank===4||u.rank===1,()=>"Error in batchNorm4D: scale must be rank 4 or rank 1 "+"but got rank ".concat(u.rank,".")),c!=null&&A(c.rank===4||c.rank===1,()=>"Error in batchNorm4D: offset must be rank 4 or rank 1 "+"but got rank ".concat(c.rank,".")),Ff(o,i,l,c,u,a)}const o4=P({batchNorm4d_:a4});/** 1021 * @license 1022 * Copyright 2020 Google LLC. All Rights Reserved. 1023 * Licensed under the Apache License, Version 2.0 (the "License");
1024 * you may not use this file except in compliance with the License. 1025 * You may obtain a copy of the License at 1026 * 1027 * http://www.apache.org/licenses/LICENSE-2.0 1028 * 1029 * Unless required by applicable law or agreed to in writing, software 1030 * distributed under the License is distributed on an "AS IS" BASIS, 1031 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1032 * See the License for the specific language governing permissions and 1033 * limitations under the License. 1034 * ============================================================================= 1035 */function i4(t,e,n){const r=C(t,"x","bincount"),s=C(e,"weights","bincount");A(r.dtype==="int32",()=>"Error in bincount: input "+"dtype must be int32, but got ".concat(r.dtype)),A(n>=0,()=>"size must be non-negative, but got ".concat(n,".")),A(s.size===r.size||s.size===0,()=>"Error in bincount: weights must have the same size as input or"+"0-length, but got input shape: ".concat(r.shape,", weights shape: ")+"".concat(s.shape,"."));const a={x:r,weights:s},o={size:n};return W.runKernel(Ku,a,o)}const Aw=P({bincount_:i4});/** 1036 * @license 1037 * Copyright 2023 Google LLC. 1038 * Licensed under the Apache License, Version 2.0 (the "License"); 1039 * you may not use this file except in compliance with the License. 1040 * You may obtain a copy of the License at 1041 * 1042 * http://www.apache.org/licenses/LICENSE-2.0 1043 * 1044 * Unless required by applicable law or agreed to in writing, software 1045 * distributed under the License is distributed on an "AS IS" BASIS, 1046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1047 * See the License for the specific language governing permissions and 1048 * limitations under the License. 1049 * ============================================================================= 1050 */function c4(t,e){const n=C(t,"x","bitwiseAnd"),r=C(e,"y","bitwiseAnd");if(!Ir(n.shape,r.shape))throw new Error("BitwiseAnd: Tensors must have the same shape. x: ".concat(n.shape,", y: ").concat(r.shape));if(n.dtype!=="int32"||r.dtype!=="int32")throw new Error("BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ".concat(n.dtype," and type of y: ").concat(r.dtype));const s={a:n,b:r};return W.runKernel(Xu,s)}const l4=P({bitwiseAnd_:c4});/** 1051 * @license 1052 * Copyright 2021 Google LLC. All Rights Reserved. 1053 * Licensed under the Apache License, Version 2.0 (the "License"); 1054 * you may not use this file except in compliance with the License. 1055 * You may obtain a copy of the License at 1056 * 1057 * http://www.apache.org/licenses/LICENSE-2.0 1058 * 1059 * Unless required by applicable law or agreed to in writing, software 1060 * distributed under the License is distributed on an "AS IS" BASIS, 1061 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1062 * See the License for the specific language governing permissions and 1063 * limitations under the License. 1064 * ============================================================================= 1065 */function u4(t,e){const n=C(t,"s0","broadcastArgs","int32"),r=C(e,"s1","broadcastArgs","int32");if(n.rank!==1)throw new Error("broadcastArgs(): first input must be a vector (rank=1). "+"Has rank ".concat(n.rank));if(r.rank!==1)throw new Error("broadcastArgs(): second input must be a vector (rank=1). "+"Has rank ".concat(r.rank));const s={s0:n,s1:r};return W.runKernel(Rm,s)}const d4=P({broadcastArgs_:u4});/** 1066 * @license 1067 * Copyright 2020 Google LLC. All Rights Reserved. 1068 * Licensed under the Apache License, Version 2.0 (the "License"); 1069 * you may not use this file except in compliance with the License. 1070 * You may obtain a copy of the License at 1071 * 1072 * http://www.apache.org/licenses/LICENSE-2.0 1073 * 1074 * Unless required by applicable law or agreed to in writing, software 1075 * distributed under the License is distributed on an "AS IS" BASIS, 1076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1077 * See the License for the specific language governing permissions and 1078 * limitations under the License. 1079 * ============================================================================= 1080 */function f4(t,e){let n=C(t,"broadcastTo","x");const r=n.shape;if(dr(e),e.length<n.rank)throw new Error("broadcastTo(): shape.length=".concat(e.length," < input.rank=").concat(n.rank,"."));if(e.length>n.rank){const u=n.shape.slice();for(;u.length<e.length;)u.unshift(1);n=re(n,u)}const s=n.shape,a=Array.from(e);for(let u=e.length-1;u>=0;u--)if(s[u]===e[u])a[u]=1;else if(n.shape[u]!==1)throw new Error("broadcastTo(): [".concat(r,"] cannot be broadcast to [").concat(e,"]."));if(a.map((u,c)=>u>1?c:-1).filter(u=>u>=0).length===0)return Xs(n);const i={x:n},l={reps:a};return W.runKernel(Wc,i,l)}const Zi=P({broadcastTo_:f4});/** 1081 * @license 1082 * Copyright 2018 Google LLC. All Rights Reserved. 1083 * Licensed under the Apache License, Version 2.0 (the "License");
1084 * you may not use this file except in compliance with the License. 1085 * You may obtain a copy of the License at 1086 * 1087 * http://www.apache.org/licenses/LICENSE-2.0 1088 * 1089 * Unless required by applicable law or agreed to in writing, software 1090 * distributed under the License is distributed on an "AS IS" BASIS, 1091 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1092 * See the License for the specific language governing permissions and 1093 * limitations under the License. 1094 * ============================================================================= 1095 */function p4(t){const n={x:C(t,"x","ceil","float32")};return W.runKernel(Ju,n)}const h4=P({ceil_:p4});/** 1096 * @license 1097 * Copyright 2020 Google LLC. All Rights Reserved. 1098 * Licensed under the Apache License, Version 2.0 (the "License"); 1099 * you may not use this file except in compliance with the License. 1100 * You may obtain a copy of the License at 1101 * 1102 * http://www.apache.org/licenses/LICENSE-2.0 1103 * 1104 * Unless required by applicable law or agreed to in writing, software 1105 * distributed under the License is distributed on an "AS IS" BASIS, 1106 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1107 * See the License for the specific language governing permissions and 1108 * limitations under the License. 1109 * ============================================================================= 1110 */function Uc(t,e,n){dr(t),n=n||Pc(e);const r={shape:t,value:e,dtype:n};return W.runKernel(Lm,{},r)}/** 1111 * @license 1112 * Copyright 2018 Google LLC. All Rights Reserved. 1113 * Licensed under the Apache License, Version 2.0 (the "License"); 1114 * you may not use this file except in compliance with the License. 1115 * You may obtain a copy of the License at 1116 * 1117 * http://www.apache.org/licenses/LICENSE-2.0 1118 * 1119 * Unless required by applicable law or agreed to in writing, software 1120 * distributed under the License is distributed on an "AS IS" BASIS, 1121 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1122 * See the License for the specific language governing permissions and 1123 * limitations under the License. 1124 * ============================================================================= 1125 */function m4(t,e,n){const r=C(t,"x","clipByValue");if(A(e<=n,()=>"Error in clip: min (".concat(e,") must be ")+"less than or equal to max (".concat(n,").")),e===n)return Uc(r.shape,e,r.dtype);const s={x:r},a={clipValueMin:e,clipValueMax:n};return W.runKernel(Lc,s,a)}const $w=P({clipByValue_:m4});function g4(t){return mn(t,0)}const y4=P({concat1d_:g4});function v4(t,e){return mn(t,e)}const b4=P({concat2d_:v4});function w4(t,e){return mn(t,e)}const S4=P({concat3d_:w4});function x4(t,e){return mn(t,e)}const _4=P({concat4d_:x4});/** 1126 * @license 1127 * Copyright 2020 Google LLC. All Rights Reserved. 1128 * Licensed under the Apache License, Version 2.0 (the "License"); 1129 * you may not use this file except in compliance with the License. 1130 * You may obtain a copy of the License at 1131 * 1132 * http://www.apache.org/licenses/LICENSE-2.0 1133 * 1134 * Unless required by applicable law or agreed to in writing, software 1135 * distributed under the License is distributed on an "AS IS" BASIS, 1136 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1137 * See the License for the specific language governing permissions and 1138 * limitations under the License. 1139 * ============================================================================= 1140 */function I4(t,e,n,r,s="NHWC",a=[1,1],o){const i=C(t,"x","conv2d","float32"),l=C(e,"filter","conv2d","float32");let u=i,c=!1;i.rank===3&&(c=!0,u=re(i,[1,i.shape[0],i.shape[1],i.shape[2]])),A(u.rank===4,()=>"Error in conv2d: input must be rank 4, but got rank ".concat(u.rank,".")),A(l.rank===4,()=>"Error in conv2d: filter must be rank 4, but got rank "+"".concat(l.rank,".")),zr("conv2d",r,o);const d=s==="NHWC"?u.shape[3]:u.shape[1];A(d===l.shape[2],()=>"Error in conv2d: depth of input (".concat(d,") must match ")+"input depth for filter ".concat(l.shape[2],".")),A(Tr(n,a),()=>"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(a,"'")),A(Yo(a),()=>"Error in conv2D: Dilated rates should be larger than 0."),A(Yo(n),()=>"Error in conv2D: Strides should be larger than 0.");const f={x:u,filter:l},p={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},h=W.runKernel(Qu,f,p);return c?re(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const Mf=P({conv2d_:I4});function k4(t,e,n,r,s="NWC",a=1,o){const i=C(t,"x","conv1d"),l=C(e,"filter","conv1d");let u=i,c=!1;i.rank===2&&(c=!0,u=re(i,[1,i.shape[0],i.shape[1]])),A(u.rank===3,()=>"Error in conv1d: input must be rank 3, but got rank ".concat(u.rank,".")),A(l.rank===3,()=>"Error in conv1d: filter must be rank 3, but got rank "+"".concat(l.rank,".")),zr("conv1d",r,o),A(u.shape[2]===l.shape[1],()=>"Error in conv1d: depth of input (".concat(u.shape[2],") must match ")+"input depth for filter ".concat(l.shape[1],".")),A(Tr(n,a),()=>"Error in conv1D: Either stride or dilation must be 1. "+"Got stride ".concat(n," and dilation '").concat(a,"'")),A(Yo(a),()=>"Error in conv1D: Dilated rates should be larger than 0."),A(Yo(n),()=>"Error in conv1D: Stride should be larger than 0."),A(s==="NWC",()=>"Error in conv1d: got dataFormat of ".concat(s," but only NWC is currently supported."));const d=re(l,[1,l.shape[0],l.shape[1],l.shape[2]]),f=re(u,[u.shape[0],1,u.shape[1],u.shape[2]]),g=Mf(f,d,[1,n],r,"NHWC",[1,a],o);return c?re(g,[g.shape[2],g.shape[3]]):re(g,[g.shape[0],g.shape[2],g.shape[3]])}const E4=P({conv1d_:k4});/** 1141 * @license 1142 * Copyright 2020 Google LLC. All Rights Reserved. 1143 * Licensed under the Apache License, Version 2.0 (the "License");
1144 * you may not use this file except in compliance with the License. 1145 * You may obtain a copy of the License at 1146 * 1147 * http://www.apache.org/licenses/LICENSE-2.0 1148 * 1149 * Unless required by applicable law or agreed to in writing, software 1150 * distributed under the License is distributed on an "AS IS" BASIS, 1151 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1152 * See the License for the specific language governing permissions and 1153 * limitations under the License. 1154 * ============================================================================= 1155 */function T4(t,e,n,r,s,a="NHWC",o){A(t.length===e.rank,()=>"Length of inShape "+"(".concat(t.length,") and rank of dy (").concat(e.rank,") must match"));let i=t,l=e,u=!1;e.rank===3&&(u=!0,l=re(e,[1,e.shape[0],e.shape[1],e.shape[2]]),i=[1,t[0],t[1],t[2]]),A(i.length===4,()=>"Error in conv2dDerInput: inShape must be length 4, but got length "+"".concat(i.length,".")),A(l.rank===4,()=>"Error in conv2dDerInput: dy must be rank 4, but got "+"rank ".concat(l.rank)),A(n.rank===4,()=>"Error in conv2dDerInput: filter must be rank 4, but got "+"rank ".concat(n.rank));const c=a==="NHWC"?i[3]:i[1],d=a==="NHWC"?l.shape[3]:l.shape[1];A(c===n.shape[2],()=>"Error in conv2dDerInput: depth of input (".concat(c,") must ")+"match input depth for filter ".concat(n.shape[2],".")),A(d===n.shape[3],()=>"Error in conv2dDerInput: depth of output (".concat(d,") must ")+"match output depth for filter ".concat(n.shape[3],".")),zr("conv2dDerInput",s,o);const f={dy:l,filter:n},p={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,inputShape:i},h=W.runKernel(Zu,f,p);return u?re(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const Rw=P({conv2DBackpropInput_:T4});function C4(t,e,n,r,s,a){const o=C(t,"x","conv2dTranspose"),i=C(e,"filter","conv2dTranspose");return Rw(n,o,i,r,s,"NHWC",a)}const N4=P({conv2dTranspose_:C4});/** 1156 * @license 1157 * Copyright 2020 Google LLC. All Rights Reserved. 1158 * Licensed under the Apache License, Version 2.0 (the "License"); 1159 * you may not use this file except in compliance with the License. 1160 * You may obtain a copy of the License at 1161 * 1162 * http://www.apache.org/licenses/LICENSE-2.0 1163 * 1164 * Unless required by applicable law or agreed to in writing, software 1165 * distributed under the License is distributed on an "AS IS" BASIS, 1166 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1167 * See the License for the specific language governing permissions and 1168 * limitations under the License. 1169 * ============================================================================= 1170 */function A4(t,e,n,r,s="NDHWC",a=[1,1,1]){const o=C(t,"x","conv3d"),i=C(e,"filter","conv3d");let l=o,u=!1;o.rank===4&&(u=!0,l=re(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(l.rank===5,()=>"Error in conv3d: input must be rank 5, but got rank ".concat(l.rank,".")),A(i.rank===5,()=>"Error in conv3d: filter must be rank 5, but got rank "+"".concat(i.rank,".")),A(l.shape[4]===i.shape[3],()=>"Error in conv3d: depth of input (".concat(l.shape[4],") must match ")+"input depth for filter ".concat(i.shape[3],".")),A(Tr(n,a),()=>"Error in conv3D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(a,"'")),A(s==="NDHWC",()=>"Error in conv3d: got dataFormat of ".concat(s," but only NDHWC is currently supported.")),A(Yo(a),()=>"Error in conv3D: Dilated rates should be larger than 0."),A(Yo(n),()=>"Error in conv3D: Strides should be larger than 0.");const c={x:l,filter:i},d={strides:n,pad:r,dataFormat:s,dilations:a},f=W.runKernel(ed,c,d);return u?re(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}const $4=P({conv3d_:A4});/** 1171 * @license 1172 * Copyright 2020 Google LLC. All Rights Reserved. 1173 * Licensed under the Apache License, Version 2.0 (the "License"); 1174 * you may not use this file except in compliance with the License. 1175 * You may obtain a copy of the License at 1176 * 1177 * http://www.apache.org/licenses/LICENSE-2.0 1178 * 1179 * Unless required by applicable law or agreed to in writing, software 1180 * distributed under the License is distributed on an "AS IS" BASIS, 1181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1182 * See the License for the specific language governing permissions and 1183 * limitations under the License. 1184 * ============================================================================= 1185 */function R4(t,e,n,r,s){A(t.length===e.rank,()=>"Length of inShape "+"(".concat(t.length,") and rank of dy (").concat(e.rank,") must match"));let a=t,o=e,i=!1;e.rank===4&&(i=!0,o=re(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]),a=[1,t[0],t[1],t[2],t[3]]);const l=a[4],u=o.shape[4];A(a.length===5,()=>"Error in conv3dDerInput: inShape must be length 5, but got length "+"".concat(a.length,".")),A(o.rank===5,()=>"Error in conv3dDerInput: dy must be rank 5, but got "+"rank ".concat(o.rank)),A(n.rank===5,()=>"Error in conv3dDerInput: filter must be rank 5, but got "+"rank ".concat(n.rank)),A(l===n.shape[3],()=>"Error in conv3dDerInput: depth of input (".concat(l,") must ")+"match input depth for filter ".concat(n.shape[3],".")),A(u===n.shape[4],()=>"Error in conv3dDerInput: depth of output (".concat(u,") must ")+"match output depth for filter ".concat(n.shape[4],"."));const c={dy:o,filter:n},d={pad:s,strides:r,inputShape:a},f=W.runKernel(td,c,d);return i?re(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}const D4=P({conv3DBackpropInput_:R4});
1185function F4(t,e,n,r,s){const a=C(t,"x","conv3dTranspose"),o=C(e,"filter","conv3dTranspose");return D4(n,a,o,r,s)}const M4=P({conv3dTranspose_:F4});/** 1186 * @license 1187 * Copyright 2018 Google LLC. All Rights Reserved. 1188 * Licensed under the Apache License, Version 2.0 (the "License"); 1189 * you may not use this file except in compliance with the License. 1190 * You may obtain a copy of the License at 1191 * 1192 * http://www.apache.org/licenses/LICENSE-2.0 1193 * 1194 * Unless required by applicable law or agreed to in writing, software 1195 * distributed under the License is distributed on an "AS IS" BASIS, 1196 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1197 * See the License for the specific language governing permissions and 1198 * limitations under the License. 1199 * ============================================================================= 1200 */function O4(t){const n={x:C(t,"x","cos","float32")};return W.runKernel(nd,n)}const P4=P({cos_:O4});/** 1201 * @license 1202 * Copyright 2018 Google LLC. All Rights Reserved. 1203 * Licensed under the Apache License, Version 2.0 (the "License"); 1204 * you may not use this file except in compliance with the License. 1205 * You may obtain a copy of the License at 1206 * 1207 * http://www.apache.org/licenses/LICENSE-2.0 1208 * 1209 * Unless required by applicable law or agreed to in writing, software 1210 * distributed under the License is distributed on an "AS IS" BASIS, 1211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1212 * See the License for the specific language governing permissions and 1213 * limitations under the License. 1214 * ============================================================================= 1215 */function B4(t){const n={x:C(t,"x","cosh","float32")};return W.runKernel(rd,n)}const L4=P({cosh_:B4});/** 1216 * @license 1217 * Copyright 2022 Google LLC. All Rights Reserved. 1218 * Licensed under the Apache License, Version 2.0 (the 'License'); 1219 * you may not use this file except in compliance with the License. 1220 * You may obtain a copy of the License at 1221 * 1222 * http://www.apache.org/licenses/LICENSE-2.0 1223 * 1224 * Unless required by applicable law or agreed to in writing, software 1225 * distributed under the License is distributed on an 'AS IS' BASIS, 1226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1227 * See the License for the specific language governing permissions and 1228 * limitations under the License. 1229 * ============================================================================= 1230 */function W4(t,e=0,n=!1,r=!1){const a={x:C(t,"x","cumprod")},o={axis:e,exclusive:n,reverse:r};return W.runKernel(sd,a,o)}const z4=P({cumprod_:W4});/** 1231 * @license 1232 * Copyright 2018 Google LLC. All Rights Reserved. 1233 * Licensed under the Apache License, Version 2.0 (the "License"); 1234 * you may not use this file except in compliance with the License. 1235 * You may obtain a copy of the License at 1236 * 1237 * http://www.apache.org/licenses/LICENSE-2.0 1238 * 1239 * Unless required by applicable law or agreed to in writing, software 1240 * distributed under the License is distributed on an "AS IS" BASIS, 1241 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1242 * See the License for the specific language governing permissions and 1243 * limitations under the License. 1244 * ============================================================================= 1245 */function H4(t,e=0,n=!1,r=!1){const a={x:C(t,"x","cumsum")},o={axis:e,exclusive:n,reverse:r};return W.runKernel(ad,a,o)}const U4=P({cumsum_:H4});/** 1246 * @license 1247 * Copyright 2020 Google LLC. All Rights Reserved. 1248 * Licensed under the Apache License, Version 2.0 (the "License"); 1249 * you may not use this file except in compliance with the License. 1250 * You may obtain a copy of the License at 1251 * 1252 * http://www.apache.org/licenses/LICENSE-2.0 1253 * 1254 * Unless required by applicable law or agreed to in writing, software 1255 * distributed under the License is distributed on an "AS IS" BASIS, 1256 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1257 * See the License for the specific language governing permissions and 1258 * limitations under the License. 1259 * ============================================================================= 1260 */function V4(t,e,n,r=!1){const s=C(t,"x","denseBincount"),a=C(e,"weights","denseBincount");A(s.dtype==="int32",()=>"Error in denseBincount: input "+"dtype must be int32, but got ".concat(s.dtype)),A(s.rank<=2,()=>"Error in denseBincount: input must be at most rank 2, but got "+"rank ".concat(s.rank,".")),A(n>=0,()=>"size must be non-negative, but got ".concat(n,".")),A(a.size===s.size||a.size===0,()=>"Error in denseBincount: weights must have the same shape as x or "+"0-length, but got x shape: ".concat(s.shape,", weights shape: ")+"".concat(a.shape,"."));const o={x:s,weights:a},i={size:n,binaryOutput:r};return W.runKernel(Mm,o,i)}const j4=P({denseBincount_:V4});/** 1261 * @license 1262 * Copyright 2020 Google LLC. All Rights Reserved. 1263 * Licensed under the Apache License, Version 2.0 (the "License");
1264 * you may not use this file except in compliance with the License. 1265 * You may obtain a copy of the License at 1266 * 1267 * http://www.apache.org/licenses/LICENSE-2.0 1268 * 1269 * Unless required by applicable law or agreed to in writing, software 1270 * distributed under the License is distributed on an "AS IS" BASIS, 1271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1272 * See the License for the specific language governing permissions and 1273 * limitations under the License. 1274 * ============================================================================= 1275 */function G4(t,e,n="NHWC"){const r=C(t,"x","depthToSpace","float32"),s=n==="NHWC"?r.shape[1]:r.shape[2],a=n==="NHWC"?r.shape[2]:r.shape[3],o=n==="NHWC"?r.shape[3]:r.shape[1];A(e>1,()=>"blockSize should be > 1 for depthToSpace, but was: ".concat(e)),A(s*e>=0,()=>"Negative dimension size caused by overflow when multiplying\n ".concat(s," and ").concat(e," for depthToSpace with input shape\n ").concat(r.shape)),A(a*e>=0,()=>"Negative dimension size caused by overflow when multiplying\n ".concat(a," and ").concat(e," for depthToSpace with input shape\n ").concat(r.shape)),A(o%(e*e)===0,()=>"Dimension size must be evenly divisible by ".concat(e*e," but is ").concat(o," for depthToSpace with input shape ").concat(r.shape));const i={x:r},l={blockSize:e,dataFormat:n};return W.runKernel(id,i,l)}const q4=P({depthToSpace_:G4});/** 1276 * @license 1277 * Copyright 2020 Google LLC. All Rights Reserved. 1278 * Licensed under the Apache License, Version 2.0 (the "License"); 1279 * you may not use this file except in compliance with the License. 1280 * You may obtain a copy of the License at 1281 * 1282 * http://www.apache.org/licenses/LICENSE-2.0 1283 * 1284 * Unless required by applicable law or agreed to in writing, software 1285 * distributed under the License is distributed on an "AS IS" BASIS, 1286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1287 * See the License for the specific language governing permissions and 1288 * limitations under the License. 1289 * ============================================================================= 1290 */function K4(t,e,n,r,s="NHWC",a=[1,1],o){const i=C(t,"x","depthwiseConv2d","float32"),l=C(e,"filter","depthwiseConv2d","float32");let u=i,c=!1;i.rank===3&&(c=!0,u=re(i,[1,i.shape[0],i.shape[1],i.shape[2]])),A(u.rank===4,()=>"Error in depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(u.rank,".")),A(l.rank===4,()=>"Error in depthwiseConv2d: filter must be rank 4, but got rank "+"".concat(l.rank,"."));const d=s==="NHWC"?u.shape[3]:u.shape[1];A(d===l.shape[2],()=>"Error in depthwiseConv2d: number of input channels "+"(".concat(d,") must match the inChannels dimension in ")+"filter ".concat(l.shape[2],".")),zr("depthwiseConv2d",r,o);const f={x:u,filter:l},p={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o},h=W.runKernel(cd,f,p);return c?re(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const mg=P({depthwiseConv2d_:K4});/** 1291 * @license 1292 * Copyright 2020 Google LLC. All Rights Reserved. 1293 * Licensed under the Apache License, Version 2.0 (the "License"); 1294 * you may not use this file except in compliance with the License. 1295 * You may obtain a copy of the License at 1296 * 1297 * http://www.apache.org/licenses/LICENSE-2.0 1298 * 1299 * Unless required by applicable law or agreed to in writing, software 1300 * distributed under the License is distributed on an "AS IS" BASIS, 1301 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1302 * See the License for the specific language governing permissions and 1303 * limitations under the License. 1304 * ============================================================================= 1305 */function X4(t){const n={x:C(t,"x","diag")};return W.runKernel(Om,n)}const Y4=P({diag_:X4});/** 1306 * @license 1307 * Copyright 2020 Google LLC. All Rights Reserved. 1308 * Licensed under the Apache License, Version 2.0 (the "License"); 1309 * you may not use this file except in compliance with the License. 1310 * You may obtain a copy of the License at 1311 * 1312 * http://www.apache.org/licenses/LICENSE-2.0 1313 * 1314 * Unless required by applicable law or agreed to in writing, softw
1314are 1315 * distributed under the License is distributed on an "AS IS" BASIS, 1316 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1317 * See the License for the specific language governing permissions and 1318 * limitations under the License. 1319 * ============================================================================= 1320 */function J4(t,e,n,r,s=[1,1],a="NHWC"){const o=C(t,"x","dilation2d"),i=C(e,"filter","dilation2d");A(o.rank===3||o.rank===4,()=>"Error in dilation2d: input must be rank 3 or 4, but got rank "+"".concat(o.rank,".")),A(i.rank===3,()=>"Error in dilation2d: filter must be rank 3, but got rank "+"".concat(i.rank,".")),A(a==="NHWC",()=>"Error in dilation2d: Only NHWC is currently supported, "+"but got dataFormat of ".concat(a));let l=o,u=!1;o.rank===3&&(l=re(o,[1,o.shape[0],o.shape[1],o.shape[2]]),u=!0),A(l.shape[3]===i.shape[2],()=>"Error in dilation2d: input and filter must have the same depth: ".concat(l.shape[3]," vs ").concat(i.shape[2]));const c={x:l,filter:i},d={strides:n,pad:r,dilations:s},f=W.runKernel(ld,c,d);return u?re(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const Q4=P({dilation2d_:J4});/** 1321 * @license 1322 * Copyright 2017 Google LLC. All Rights Reserved. 1323 * Licensed under the Apache License, Version 2.0 (the "License"); 1324 * you may not use this file except in compliance with the License. 1325 * You may obtain a copy of the License at 1326 * 1327 * http://www.apache.org/licenses/LICENSE-2.0 1328 * 1329 * Unless required by applicable law or agreed to in writing, software 1330 * distributed under the License is distributed on an "AS IS" BASIS, 1331 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1332 * See the License for the specific language governing permissions and 1333 * limitations under the License. 1334 * ============================================================================= 1335 */function iu(t,e){const n=t.length,r=[];for(let s=0;s<n;s++){const a=n-1-s,o=t[a]||1;(e[e.length-1-s]||1)>1&&o===1&&r.unshift(a)}return r}function Z4(t,e){const n=[];for(let r=0;r<e.length;r++){const s=t[t.length-r-1],a=e.length-r-1,o=e[a];(s==null||s===1&&o>1)&&n.unshift(a)}return n}function Rt(t,e){const n=Math.max(t.length,e.length),r=new Array(n);for(let s=0;s<n;s++){let a=t[t.length-s-1];a==null&&(a=1);let o=e[e.length-s-1];if(o==null&&(o=1),a===1)r[n-s-1]=o;else if(o===1)r[n-s-1]=a;else if(a!==o){const i="Operands could not be broadcast together with shapes "+"".concat(t," and ").concat(e,".");throw Error(i)}else r[n-s-1]=a}return r}/** 1336 * @license 1337 * Copyright 2020 Google LLC. All Rights Reserved. 1338 * Licensed under the Apache License, Version 2.0 (the "License"); 1339 * you may not use this file except in compliance with the License. 1340 * You may obtain a copy of the License at 1341 * 1342 * http://www.apache.org/licenses/LICENSE-2.0 1343 * 1344 * Unless required by applicable law or agreed to in writing, software 1345 * distributed under the License is distributed on an "AS IS" BASIS, 1346 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1347 * See the License for the specific language governing permissions and 1348 * limitations under the License. 1349 * ============================================================================= 1350 */function e$(t,e){let n=C(t,"a","equal","string_or_numeric"),r=C(e,"b","equal","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(pd,s)}const Dw=P({equal_:e$});/** 1351 * @license 1352 * Copyright 2020 Google LLC. All Rights Reserved. 1353 * Licensed under the Apache License, Version 2.0 (the "License"); 1354 * you may not use this file except in compliance with the License. 1355 * You may obtain a copy of the License at 1356 * 1357 * http://www.apache.org/licenses/LICENSE-2.0 1358 * 1359 * Unless required by applicable law or agreed to in writing, software 1360 * distributed under the License is distributed on an "AS IS" BASIS, 1361 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1362 * See the License for the specific language governing permissions and 1363 * limitations under the License. 1364 * ============================================================================= 1365 */function t$(t,e,n){const r=C(e,"a","where"),s=C(n,"b","where"),a=C(t,"condition","where","bool"),o=Rt(Rt(a.shape,r.shape),s.shape),i=Zi(a,o),l=Zi(r,o),u=Zi(s,o),c={condition:i,t:l,e:u};return W.runKernel(Jm,c)}const Ys=P({where_:t$});/** 1366 * @license 1367 * Copyright 2018 Google LLC. All Rights Reserved. 1368 * Licensed under the Apache License, Version 2.0 (the "License");
1369 * you may not use this file except in compliance with the License. 1370 * You may obtain a copy of the License at 1371 * 1372 * http://www.apache.org/licenses/LICENSE-2.0 1373 * 1374 * Unless required by applicable law or agreed to in writing, software 1375 * distributed under the License is distributed on an "AS IS" BASIS, 1376 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1377 * See the License for the specific language governing permissions and 1378 * limitations under the License. 1379 * ============================================================================= 1380 */function n$(t){const n={x:C(t,"x","zerosLike")};return W.runKernel(ug,n)}const lr=P({zerosLike_:n$});/** 1381 * @license 1382 * Copyright 2020 Google LLC. All Rights Reserved. 1383 * Licensed under the Apache License, Version 2.0 (the "License"); 1384 * you may not use this file except in compliance with the License. 1385 * You may obtain a copy of the License at 1386 * 1387 * http://www.apache.org/licenses/LICENSE-2.0 1388 * 1389 * Unless required by applicable law or agreed to in writing, software 1390 * distributed under the License is distributed on an "AS IS" BASIS, 1391 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1392 * See the License for the specific language governing permissions and 1393 * limitations under the License. 1394 * ============================================================================= 1395 */function r$(t,e){let n=C(t,"a","div"),r=C(e,"b","div");[n,r]=Xt(n,r);const s=tt(n,r),a=lr(s),o=Dw(r,a);return Ys(o,a,s)}const s$=P({divNoNan_:r$});/** 1396 * @license 1397 * Copyright 2020 Google LLC. All Rights Reserved. 1398 * Licensed under the Apache License, Version 2.0 (the "License"); 1399 * you may not use this file except in compliance with the License. 1400 * You may obtain a copy of the License at 1401 * 1402 * http://www.apache.org/licenses/LICENSE-2.0 1403 * 1404 * Unless required by applicable law or agreed to in writing, software 1405 * distributed under the License is distributed on an "AS IS" BASIS, 1406 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1407 * See the License for the specific language governing permissions and 1408 * limitations under the License. 1409 * ============================================================================= 1410 */function a$(t,e){const n=C(t,"t1","dot"),r=C(e,"t2","dot");A((n.rank===1||n.rank===2)&&(r.rank===1||r.rank===2),()=>"Error in dot: inputs must all be rank 1 or 2, but got ranks "+"".concat(n.rank," and ").concat(r.rank,"."));const s=n.rank===1?n.size:n.shape[1],a=r.rank===1?r.size:r.shape[0];if(A(s===a,()=>"Error in dot: inner dimensions of inputs must match, but got "+"".concat(s," and ").concat(a,".")),n.rank===1&&r.rank===1){const o=re(n,[1,-1]),i=re(r,[-1,1]),l=xt(o,i);return re(l,[])}else if(n.rank===1&&r.rank===2){const o=re(n,[1,-1]),i=re(r,[r.shape[0],r.shape[1]]),l=xt(o,i);return re(l,[l.size])}else if(n.rank===2&&r.rank===1){const o=re(r,[-1,1]),i=xt(n,o);return re(i,[i.size])}else{const o=re(r,[r.shape[0],r.shape[1]]);return xt(n,o)}}const o$=P({dot_:a$});/** 1411 * @license 1412 * Copyright 2021 Google LLC. All Rights Reserved. 1413 * Licensed under the Apache License, Version 2.0 (the "License"); 1414 * you may not use this file except in compliance with the License. 1415 * You may obtain a copy of the License at 1416 * 1417 * http://www.apache.org/licenses/LICENSE-2.0 1418 * 1419 * Unless required by applicable law or agreed to in writing, software 1420 * distributed under the License is distributed on an "AS IS" BASIS, 1421 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1422 * See the License for the specific language governing permissions and 1423 * limitations under the License. 1424 * ============================================================================= 1425 */function i$(t,...e){const n=e.map((s,a)=>C(s,"tensors".concat(a),"einsum")),r={equation:t};return W.runKernel(O1,n,r)}const No=P({einsum_:i$});/** 1426 * @license 1427 * Copyright 2020 Google LLC. All Rights Reserved. 1428 * Licensed under the Apache License, Version 2.0 (the "License"); 1429 * you may not use this file except in compliance with the License. 1430 * You may obtain a copy of the License at 1431 * 1432 * http://www.apache.org/licenses/LICENSE-2.0 1433 * 1434 * Unless required by applicable law or agreed to in writing, softw
1434are 1435 * distributed under the License is distributed on an "AS IS" BASIS, 1436 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1437 * See the License for the specific language governing permissions and 1438 * limitations under the License. 1439 * ============================================================================= 1440 */function c$(t){const n={x:C(t,"x","elu","float32")};return W.runKernel(dd,n)}const Fw=P({elu_:c$});/** 1441 * @license 1442 * Copyright 2023 Google LLC. 1443 * Licensed under the Apache License, Version 2.0 (the "License"); 1444 * you may not use this file except in compliance with the License. 1445 * You may obtain a copy of the License at 1446 * 1447 * http://www.apache.org/licenses/LICENSE-2.0 1448 * 1449 * Unless required by applicable law or agreed to in writing, software 1450 * distributed under the License is distributed on an "AS IS" BASIS, 1451 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1452 * See the License for the specific language governing permissions and 1453 * limitations under the License. 1454 * ============================================================================= 1455 */function l$(t,e){const n=C(t,"x","ensureShape","string_or_numeric");if(!PC(n.shape,e))throw new Error("EnsureShape: Shape of tensor ".concat(n.shape," is not compatible with expected shape ").concat(e));return t}const u$=P({ensureShape_:l$});/** 1456 * @license 1457 * Copyright 2018 Google LLC. All Rights Reserved. 1458 * Licensed under the Apache License, Version 2.0 (the "License"); 1459 * you may not use this file except in compliance with the License. 1460 * You may obtain a copy of the License at 1461 * 1462 * http://www.apache.org/licenses/LICENSE-2.0 1463 * 1464 * Unless required by applicable law or agreed to in writing, software 1465 * distributed under the License is distributed on an "AS IS" BASIS, 1466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1467 * See the License for the specific language governing permissions and 1468 * limitations under the License. 1469 * ============================================================================= 1470 */function d$(t){let e=C(t,"x","erf");A(e.dtype==="int32"||e.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),e.dtype==="int32"&&(e=Ut(e,"float32"));const n={x:e};return W.runKernel(fd,n)}const f$=P({erf_:d$});/** 1471 * @license 1472 * Copyright 2017 Google LLC. All Rights Reserved. 1473 * Licensed under the Apache License, Version 2.0 (the "License"); 1474 * you may not use this file except in compliance with the License. 1475 * You may obtain a copy of the License at 1476 * 1477 * http://www.apache.org/licenses/LICENSE-2.0 1478 * 1479 * Unless required by applicable law or agreed to in writing, software 1480 * distributed under the License is distributed on an "AS IS" BASIS, 1481 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1482 * See the License for the specific language governing permissions and 1483 * limitations under the License. 1484 * ============================================================================= 1485 */function Mw(t,e){for(let n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function p$(t,e,n){const r=t.length+e.length,s=[];let a=0,o=0;for(let i=0;i<r;i++)n.indexOf(i)===-1?s.push(t[a++]):s.push(e[o++]);return s}function Rn(t,e){const n=[],r=t.length;for(let a=0;a<r;a++)e.indexOf(a)===-1&&n.push(t[a]);const s=e.map(a=>t[a]);return[n,s]}function gn(t,e){const n=e.map(r=>1);return p$(t,n,e)}function Dn(t,e,n){A(Mw(e,n),()=>"".concat(t," supports only inner-most axes for now. ")+"Got axes ".concat(e," and rank-").concat(n," input."))}function fr(t,e){if(Mw(t,e))return null;const n=[];for(let r=0;r<e;++r)t.indexOf(r)===-1&&n.push(r);return t.forEach(r=>n.push(r)),n}function Of(t){return t.map((e,n)=>[n,e]).sort((e,n)=>e[1]-n[1]).map(e=>e[0])}function Fn(t,e){const n=[];for(let r=e-t;r<e;++r)n.push(r);return n}/** 1486 * @license 1487 * Copyright 2020 Google LLC. All Rights Reserved. 1488 * Licensed under the Apache License, Version 2.0 (the "License"); 1489 * you may not use this file except in compliance with the License. 1490 * You may obtain a copy of the License at 1491 * 1492 * http://www.apache.org/licenses/LICENSE-2.0 1493 * 1494 * Unless required by applicable law or agreed to in writing, softw
1494are 1495 * distributed under the License is distributed on an "AS IS" BASIS, 1496 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1497 * See the License for the specific language governing permissions and 1498 * limitations under the License. 1499 * ============================================================================= 1500 */function h$(t,e=null,n=!1){const s={x:C(t,"x","max")},a={reductionIndices:e,keepDims:n};return W.runKernel(Pd,s,a)}const Ho=P({max_:h$});/** 1501 * @license 1502 * Copyright 2020 Google Inc. All Rights Reserved. 1503 * Licensed under the Apache License, Version 2.0 (the "License"); 1504 * you may not use this file except in compliance with the License. 1505 * You may obtain a copy of the License at 1506 * 1507 * http://www.apache.org/licenses/LICENSE-2.0 1508 * 1509 * Unless required by applicable law or agreed to in writing, software 1510 * distributed under the License is distributed on an "AS IS" BASIS, 1511 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1512 * See the License for the specific language governing permissions and 1513 * limitations under the License. 1514 * ============================================================================= 1515 */function m$(t,e=null,n=!1){const s={x:C(t,"x","min")},a={axis:e,keepDims:n};return W.runKernel(zd,s,a)}const Th=P({min_:m$});/** 1516 * @license 1517 * Copyright 2020 Google LLC. All Rights Reserved. 1518 * Licensed under the Apache License, Version 2.0 (the "License"); 1519 * you may not use this file except in compliance with the License. 1520 * You may obtain a copy of the License at 1521 * 1522 * http://www.apache.org/licenses/LICENSE-2.0 1523 * 1524 * Unless required by applicable law or agreed to in writing, software 1525 * distributed under the License is distributed on an "AS IS" BASIS, 1526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1527 * See the License for the specific language governing permissions and 1528 * limitations under the License. 1529 * ============================================================================= 1530 */function g$(t,e){let n=C(t,"base","pow"),r=C(e,"exp","pow");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(Zd,s)}const _c=P({pow_:g$});/** 1531 * @license 1532 * Copyright 2018 Google LLC. All Rights Reserved. 1533 * Licensed under the Apache License, Version 2.0 (the "License"); 1534 * you may not use this file except in compliance with the License. 1535 * You may obtain a copy of the License at 1536 * 1537 * http://www.apache.org/licenses/LICENSE-2.0 1538 * 1539 * Unless required by applicable law or agreed to in writing, software 1540 * distributed under the License is distributed on an "AS IS" BASIS, 1541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1542 * See the License for the specific language governing permissions and 1543 * limitations under the License. 1544 * ============================================================================= 1545 */function ot(t,e){if((kr(t)&&e!=="string"||Array.isArray(t))&&e!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(e==="string"&&kr(t)&&!(t instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return oa(t,[],[],e)}/** 1546 * @license 1547 * Copyright 2018 Google LLC. All Rights Reserved. 1548 * Licensed under the Apache License, Version 2.0 (the "License"); 1549 * you may not use this file except in compliance with the License. 1550 * You may obtain a copy of the License at 1551 * 1552 * http://www.apache.org/licenses/LICENSE-2.0 1553 * 1554 * Unless required by applicable law or agreed to in writing, software 1555 * distributed under the License is distributed on an "AS IS" BASIS, 1556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1557 * See the License for the specific language governing permissions and 1558 * limitations under the License. 1559 * ============================================================================= 1560 */function y$(t){const n={x:C(t,"x","sqrt","float32")};return W.runKernel(wf,n)}const ws=P({sqrt_:y$});/** 1561 * @license 1562 * Copyright 2019 Google LLC. All Rights Reserved. 1563 * Licensed under the Apache License, Version 2.0 (the "License");
1564 * you may not use this file except in compliance with the License. 1565 * You may obtain a copy of the License at 1566 * 1567 * http://www.apache.org/licenses/LICENSE-2.0 1568 * 1569 * Unless required by applicable law or agreed to in writing, software 1570 * distributed under the License is distributed on an "AS IS" BASIS, 1571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1572 * See the License for the specific language governing permissions and 1573 * limitations under the License. 1574 * ============================================================================= 1575 */function v$(t){const e=C(t,"x","square"),n={};return W.runKernel("Square",{x:e},n)}const Mr=P({square_:v$});/** 1576 * @license 1577 * Copyright 2018 Google LLC. All Rights Reserved. 1578 * Licensed under the Apache License, Version 2.0 (the "License"); 1579 * you may not use this file except in compliance with the License. 1580 * You may obtain a copy of the License at 1581 * 1582 * http://www.apache.org/licenses/LICENSE-2.0 1583 * 1584 * Unless required by applicable law or agreed to in writing, software 1585 * distributed under the License is distributed on an "AS IS" BASIS, 1586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1587 * See the License for the specific language governing permissions and 1588 * limitations under the License. 1589 * ============================================================================= 1590 */function b$(t,e=null,n=!1){let r=C(t,"x","sum");r.dtype==="bool"&&(r=Ut(r,"int32"));const s={x:r},a={axis:e,keepDims:n};return W.runKernel(Sf,s,a)}const Mt=P({sum_:b$});/** 1591 * @license 1592 * Copyright 2018 Google LLC. All Rights Reserved. 1593 * Licensed under the Apache License, Version 2.0 (the "License"); 1594 * you may not use this file except in compliance with the License. 1595 * You may obtain a copy of the License at 1596 * 1597 * http://www.apache.org/licenses/LICENSE-2.0 1598 * 1599 * Unless required by applicable law or agreed to in writing, software 1600 * distributed under the License is distributed on an "AS IS" BASIS, 1601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1602 * See the License for the specific language governing permissions and 1603 * limitations under the License. 1604 * ============================================================================= 1605 */function w$(t,e="euclidean",n=null,r=!1){t=C(t,"x","norm");const s=Ow(t,e,n);let a=s.shape;if(r){const o=Vt(n,t.shape);a=gn(s.shape,o)}return re(s,a)}function Ow(t,e,n=null){if(t.rank===0)return ir(t);if(t.rank!==1&&n===null)return Ow(re(t,[-1]),e,n);if(t.rank===1||typeof n=="number"||Array.isArray(n)&&n.length===1){if(e===1)return Mt(ir(t),n);if(e===1/0)return Ho(ir(t),n);if(e===-1/0)return Th(ir(t),n);if(e==="euclidean"||e===2)return ws(Mt(_c(ir(t),ot(2,"int32")),n));throw new Error("Error in norm: invalid ord value: ".concat(e))}if(Array.isArray(n)&&n.length===2){if(e===1)return Ho(Mt(ir(t),n[0]),n[1]-1);if(e===1/0)return Ho(Mt(ir(t),n[1]),n[0]);if(e===-1/0)return Th(Mt(ir(t),n[1]),n[0]);if(e==="fro"||e==="euclidean")return ws(Mt(Mr(t),n));throw new Error("Error in norm: invalid ord value: ".concat(e))}throw new Error("Error in norm: invalid axis: ".concat(n))}const Pf=P({norm_:w$});/** 1606 * @license 1607 * Copyright 2022 Google LLC. All Rights Reserved. 1608 * Licensed under the Apache License, Version 2.0 (the "License"); 1609 * you may not use this file except in compliance with the License. 1610 * You may obtain a copy of the License at 1611 * 1612 * http://www.apache.org/licenses/LICENSE-2.0 1613 * 1614 * Unless required by applicable law or agreed to in writing, software 1615 * distributed under the License is distributed on an "AS IS" BASIS, 1616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1617 * See the License for the specific language governing permissions and 1618 * limitations under the License. 1619 * ============================================================================= 1620 */function S$(t,e=null,n=!1){return Pf(t,"euclidean",e,n)}const x$=P({euclideanNorm_:S$});/** 1621 * @license 1622 * Copyright 2018 Google LLC. All Rights Reserved. 1623 * Licensed under the Apache License, Version 2.0 (the "License"); 1624 * you may not use this file except in compliance with the License. 1625 * You may obtain a copy of the License at 1626 * 1627 * http://www.apache.org/licenses/LICENSE-2.0 1628 * 1629 * Unless required by applicable law or agreed to in writing, softw
1629are 1630 * distributed under the License is distributed on an "AS IS" BASIS, 1631 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1632 * See the License for the specific language governing permissions and 1633 * limitations under the License. 1634 * ============================================================================= 1635 */function _$(t){const n={x:C(t,"x","exp")};return W.runKernel(hd,n)}const Ss=P({exp_:_$});/** 1636 * @license 1637 * Copyright 2020 Google LLC. All Rights Reserved. 1638 * Licensed under the Apache License, Version 2.0 (the "License"); 1639 * you may not use this file except in compliance with the License. 1640 * You may obtain a copy of the License at 1641 * 1642 * http://www.apache.org/licenses/LICENSE-2.0 1643 * 1644 * Unless required by applicable law or agreed to in writing, software 1645 * distributed under the License is distributed on an "AS IS" BASIS, 1646 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1647 * See the License for the specific language governing permissions and 1648 * limitations under the License. 1649 * ============================================================================= 1650 */function I$(t,e=0){const n=C(t,"x","expandDims","string_or_numeric");A(e<=n.rank,()=>"Axis must be <= rank of the tensor");const r={input:n},s={dim:e};return W.runKernel(Bm,r,s)}const Kr=P({expandDims_:I$});/** 1651 * @license 1652 * Copyright 2018 Google LLC. All Rights Reserved. 1653 * Licensed under the Apache License, Version 2.0 (the "License"); 1654 * you may not use this file except in compliance with the License. 1655 * You may obtain a copy of the License at 1656 * 1657 * http://www.apache.org/licenses/LICENSE-2.0 1658 * 1659 * Unless required by applicable law or agreed to in writing, software 1660 * distributed under the License is distributed on an "AS IS" BASIS, 1661 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1662 * See the License for the specific language governing permissions and 1663 * limitations under the License. 1664 * ============================================================================= 1665 */function k$(t){const n={x:C(t,"x","expm1")};return W.runKernel(md,n)}const E$=P({expm1_:k$});/** 1666 * @license 1667 * Copyright 2020 Google LLC. All Rights Reserved. 1668 * Licensed under the Apache License, Version 2.0 (the "License"); 1669 * you may not use this file except in compliance with the License. 1670 * You may obtain a copy of the License at 1671 * 1672 * http://www.apache.org/licenses/LICENSE-2.0 1673 * 1674 * Unless required by applicable law or agreed to in writing, software 1675 * distributed under the License is distributed on an "AS IS" BASIS, 1676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1677 * See the License for the specific language governing permissions and 1678 * limitations under the License. 1679 * ============================================================================= 1680 */function T$(t,e){const n=C(t,"x","tile","string_or_numeric");A(n.rank===e.length,()=>"Error in transpose: rank of input ".concat(n.rank," ")+"must match length of reps ".concat(e,"."));const r={x:n},s={reps:e};return W.runKernel(Wc,r,s)}const ec=P({tile_:T$});/** 1681 * @license 1682 * Copyright 2020 Google LLC. All Rights Reserved. 1683 * Licensed under the Apache License, Version 2.0 (the "License"); 1684 * you may not use this file except in compliance with the License. 1685 * You may obtain a copy of the License at 1686 * 1687 * http://www.apache.org/licenses/LICENSE-2.0 1688 * 1689 * Unless required by applicable law or agreed to in writing, software 1690 * distributed under the License is distributed on an "AS IS" BASIS, 1691 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1692 * See the License for the specific language governing permissions and 1693 * limitations under the License. 1694 * ============================================================================= 1695 */function C$(t,e,n,r="float32"){e==null&&(e=t);const s=rt([t,e],r),a=t<=e?t:e;for(let i=0;i<a;++i)s.set(1,i,i);const o=re(s.toTensor(),[t,e]);if(n==null)return o;if(n.length===1)return ec(Kr(o,0),[n[0],1,1]);if(n.length===2)return ec(Kr(Kr(o,0),0),[n[0],n[1],1,1]);
1695if(n.length===3)return ec(Kr(Kr(Kr(o,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D "+"batchShapes, but received ".concat(n.length,"D."))}const Pw=P({eye_:C$});/** 1696 * @license 1697 * Copyright 2018 Google LLC. All Rights Reserved. 1698 * Licensed under the Apache License, Version 2.0 (the "License"); 1699 * you may not use this file except in compliance with the License. 1700 * You may obtain a copy of the License at 1701 * 1702 * http://www.apache.org/licenses/LICENSE-2.0 1703 * 1704 * Unless required by applicable law or agreed to in writing, software 1705 * distributed under the License is distributed on an "AS IS" BASIS, 1706 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1707 * See the License for the specific language governing permissions and 1708 * limitations under the License. 1709 * ============================================================================= 1710 */function N$(t){const n={x:C(t,"x","floor","float32")};return W.runKernel(yd,n)}const Bw=P({floor_:N$});/** 1711 * @license 1712 * Copyright 2018 Google LLC. All Rights Reserved. 1713 * Licensed under the Apache License, Version 2.0 (the "License"); 1714 * you may not use this file except in compliance with the License. 1715 * You may obtain a copy of the License at 1716 * 1717 * http://www.apache.org/licenses/LICENSE-2.0 1718 * 1719 * Unless required by applicable law or agreed to in writing, software 1720 * distributed under the License is distributed on an "AS IS" BASIS, 1721 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1722 * See the License for the specific language governing permissions and 1723 * limitations under the License. 1724 * ============================================================================= 1725 */function A$(t,e,n=0,r=0){const s=C(t,"x","gather"),a=C(e,"indices","gather","int32"),o={x:s,indices:a},i={axis:n,batchDims:r};return W.runKernel(Wm,o,i)}const Lw=P({gather_:A$});/** 1726 * @license 1727 * Copyright 2020 Google LLC. All Rights Reserved. 1728 * Licensed under the Apache License, Version 2.0 (the "License"); 1729 * you may not use this file except in compliance with the License. 1730 * You may obtain a copy of the License at 1731 * 1732 * http://www.apache.org/licenses/LICENSE-2.0 1733 * 1734 * Unless required by applicable law or agreed to in writing, software 1735 * distributed under the License is distributed on an "AS IS" BASIS, 1736 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1737 * See the License for the specific language governing permissions and 1738 * limitations under the License. 1739 * ============================================================================= 1740 */function $$(t,e){let n=C(t,"a","greater","string_or_numeric"),r=C(e,"b","greater","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Sd,s)}const Bf=P({greater_:$$});/** 1741 * @license 1742 * Copyright 2020 Google LLC. All Rights Reserved. 1743 * Licensed under the Apache License, Version 2.0 (the "License"); 1744 * you may not use this file except in compliance with the License. 1745 * You may obtain a copy of the License at 1746 * 1747 * http://www.apache.org/licenses/LICENSE-2.0 1748 * 1749 * Unless required by applicable law or agreed to in writing, software 1750 * distributed under the License is distributed on an "AS IS" BASIS, 1751 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1752 * See the License for the specific language governing permissions and 1753 * limitations under the License. 1754 * ============================================================================= 1755 */function R$(t,e){let n=C(t,"a","greaterEqual","string_or_numeric"),r=C(e,"b","greaterEqual","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(xd,s)}const Ww=P({greaterEqual_:R$});/** 1756 * @license 1757 * Copyright 2020 Google LLC. All Rights Reserved. 1758 * Licensed under the Apache License, Version 2.0 (the "License"); 1759 * you may not use this file except in compliance with the License. 1760 * You may obtain a copy of the License at 1761 * 1762 * http://www.apache.org/licenses/LICENSE-2.0 1763 * 1764 * Unless required by applicable law or agreed to in writing, software 1765 * distributed under the License is distributed on an "AS IS" BASIS, 1766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1767 * See the License for the specific language governing permissions and 1768 * limitations under the License. 1769 * ============================================================================= 1770 */function D$(t){const n={input:C(t,"input","imag")};return W.runKernel(L1,n)}const Lf=P({imag_:D$});/** 1771 * @license 1772 * Copyright 2018 Google LLC. All Rights Reserved. 1773 * Licensed under the Apache License, Version 2.0 (the "License");
1774 * you may not use this file except in compliance with the License. 1775 * You may obtain a copy of the License at 1776 * 1777 * http://www.apache.org/licenses/LICENSE-2.0 1778 * 1779 * Unless required by applicable law or agreed to in writing, software 1780 * distributed under the License is distributed on an "AS IS" BASIS, 1781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1782 * See the License for the specific language governing permissions and 1783 * limitations under the License. 1784 * ============================================================================= 1785 */function F$(t){const n={x:C(t,"x","isFinite")};return W.runKernel(Id,n)}const M$=P({isFinite_:F$});/** 1786 * @license 1787 * Copyright 2018 Google LLC. All Rights Reserved. 1788 * Licensed under the Apache License, Version 2.0 (the "License"); 1789 * you may not use this file except in compliance with the License. 1790 * You may obtain a copy of the License at 1791 * 1792 * http://www.apache.org/licenses/LICENSE-2.0 1793 * 1794 * Unless required by applicable law or agreed to in writing, software 1795 * distributed under the License is distributed on an "AS IS" BASIS, 1796 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1797 * See the License for the specific language governing permissions and 1798 * limitations under the License. 1799 * ============================================================================= 1800 */function O$(t){const n={x:C(t,"x","isInf")};return W.runKernel(kd,n)}const P$=P({isInf_:O$});/** 1801 * @license 1802 * Copyright 2018 Google LLC. All Rights Reserved. 1803 * Licensed under the Apache License, Version 2.0 (the "License"); 1804 * you may not use this file except in compliance with the License. 1805 * You may obtain a copy of the License at 1806 * 1807 * http://www.apache.org/licenses/LICENSE-2.0 1808 * 1809 * Unless required by applicable law or agreed to in writing, software 1810 * distributed under the License is distributed on an "AS IS" BASIS, 1811 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1812 * See the License for the specific language governing permissions and 1813 * limitations under the License. 1814 * ============================================================================= 1815 */function B$(t){const n={x:C(t,"x","isNaN")};return W.runKernel(Ed,n)}const L$=P({isNaN_:B$});/** 1816 * @license 1817 * Copyright 2020 Google LLC. All Rights Reserved. 1818 * Licensed under the Apache License, Version 2.0 (the "License"); 1819 * you may not use this file except in compliance with the License. 1820 * You may obtain a copy of the License at 1821 * 1822 * http://www.apache.org/licenses/LICENSE-2.0 1823 * 1824 * Unless required by applicable law or agreed to in writing, software 1825 * distributed under the License is distributed on an "AS IS" BASIS, 1826 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1827 * See the License for the specific language governing permissions and 1828 * limitations under the License. 1829 * ============================================================================= 1830 */function W$(t,e=.2){const r={x:C(t,"x","leakyRelu")},s={alpha:e};return W.runKernel(Td,r,s)}const zw=P({leakyRelu_:W$});/** 1831 * @license 1832 * Copyright 2020 Google LLC. All Rights Reserved. 1833 * Licensed under the Apache License, Version 2.0 (the "License"); 1834 * you may not use this file except in compliance with the License. 1835 * You may obtain a copy of the License at 1836 * 1837 * http://www.apache.org/licenses/LICENSE-2.0 1838 * 1839 * Unless required by applicable law or agreed to in writing, software 1840 * distributed under the License is distributed on an "AS IS" BASIS, 1841 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1842 * See the License for the specific language governing permissions and 1843 * limitations under the License. 1844 * ============================================================================= 1845 */function z$(t,e){let n=C(t,"a","less","string_or_numeric"),r=C(e,"b","less","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Cd,s)}const Ch=P({less_:z$});/** 1846 * @license 1847 * Copyright 2020 Google LLC. All Rights Reserved. 1848 * Licensed under the Apache License, Version 2.0 (the "License");
1849 * you may not use this file except in compliance with the License. 1850 * You may obtain a copy of the License at 1851 * 1852 * http://www.apache.org/licenses/LICENSE-2.0 1853 * 1854 * Unless required by applicable law or agreed to in writing, software 1855 * distributed under the License is distributed on an "AS IS" BASIS, 1856 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1857 * See the License for the specific language governing permissions and 1858 * limitations under the License. 1859 * ============================================================================= 1860 */function H$(t,e){let n=C(t,"a","lessEqual","string_or_numeric"),r=C(e,"b","lessEqual","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Nd,s)}const gg=P({lessEqual_:H$});/** 1861 * @license 1862 * Copyright 2018 Google LLC. All Rights Reserved. 1863 * Licensed under the Apache License, Version 2.0 (the "License"); 1864 * you may not use this file except in compliance with the License. 1865 * You may obtain a copy of the License at 1866 * 1867 * http://www.apache.org/licenses/LICENSE-2.0 1868 * 1869 * Unless required by applicable law or agreed to in writing, software 1870 * distributed under the License is distributed on an "AS IS" BASIS, 1871 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1872 * See the License for the specific language governing permissions and 1873 * limitations under the License. 1874 * ============================================================================= 1875 */function U$(t,e,n){if(n<=0)throw new Error("The number of values should be positive.");const r={start:t,stop:e,num:n};return W.runKernel(Ad,{},r)}/** 1876 * @license 1877 * Copyright 2020 Google LLC. All Rights Reserved. 1878 * Licensed under the Apache License, Version 2.0 (the "License"); 1879 * you may not use this file except in compliance with the License. 1880 * You may obtain a copy of the License at 1881 * 1882 * http://www.apache.org/licenses/LICENSE-2.0 1883 * 1884 * Unless required by applicable law or agreed to in writing, software 1885 * distributed under the License is distributed on an "AS IS" BASIS, 1886 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1887 * See the License for the specific language governing permissions and 1888 * limitations under the License. 1889 * ============================================================================= 1890 */function V$(t,e=5,n=1,r=1,s=.5){const a=C(t,"x","localResponseNormalization");A(a.rank===4||a.rank===3,()=>"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ".concat(a.rank,".")),A(hc(e),()=>"Error in localResponseNormalization: depthRadius must be an "+"integer but got depthRadius ".concat(e,"."));let o=a,i=!1;a.rank===3&&(i=!0,o=re(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const l={x:o},u={depthRadius:e,bias:n,alpha:r,beta:s},c=W.runKernel(Od,l,u);return i?re(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const j$=P({localResponseNormalization_:V$});/** 1891 * @license 1892 * Copyright 2018 Google LLC. All Rights Reserved. 1893 * Licensed under the Apache License, Version 2.0 (the "License"); 1894 * you may not use this file except in compliance with the License. 1895 * You may obtain a copy of the License at 1896 * 1897 * http://www.apache.org/licenses/LICENSE-2.0 1898 * 1899 * Unless required by applicable law or agreed to in writing, software 1900 * distributed under the License is distributed on an "AS IS" BASIS, 1901 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1902 * See the License for the specific language governing permissions and 1903 * limitations under the License. 1904 * ============================================================================= 1905 */function G$(t){const n={x:C(t,"x","log","float32")};return W.runKernel($d,n)}const Ic=P({log_:G$});/** 1906 * @license 1907 * Copyright 2018 Google LLC. All Rights Reserved. 1908 * Licensed under the Apache License, Version 2.0 (the "License"); 1909 * you may not use this file except in compliance with the License. 1910 * You may obtain a copy of the License at 1911 * 1912 * http://www.apache.org/licenses/LICENSE-2.0 1913 * 1914 * Unless required by applicable law or agreed to in writing, software 1915 * distributed under the License is distributed on an "AS IS" BASIS, 1916 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1917 * See the License for the specific language governing permissions and 1918 * limitations under the License. 1919 * ============================================================================= 1920 */function q$(t){const n={x:C(t,"x","log1p")};return W.runKernel(Rd,n)}const Hw=P({log1p_:q$});/** 1921 * @license 1922 * Copyright 2018 Google LLC. All Rights Reserved. 1923 * Licensed under the Apache License, Version 2.0 (the "License");
1924 * you may not use this file except in compliance with the License. 1925 * You may obtain a copy of the License at 1926 * 1927 * http://www.apache.org/licenses/LICENSE-2.0 1928 * 1929 * Unless required by applicable law or agreed to in writing, software 1930 * distributed under the License is distributed on an "AS IS" BASIS, 1931 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1932 * See the License for the specific language governing permissions and 1933 * limitations under the License. 1934 * ============================================================================= 1935 */function K$(t,e){A(ph(t),()=>"The f passed in variableGrads(f) must be a function"),A(e==null||Array.isArray(e)&&e.every(u=>u instanceof ru),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const n=e!=null;if(!n){e=[];for(const u in W.registeredVariables)e.push(W.registeredVariables[u])}const r=n?e.filter(u=>!u.trainable):null,s=e.length;e=e.filter(u=>u.trainable),A(e.length>0,()=>"variableGrads() expects at least one of the input variables to "+"be trainable, but none of the ".concat(s," variables is ")+"trainable.");const a=!0,{value:o,grads:i}=W.gradients(t,e,null,a);A(i.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),A(o.rank===0,()=>"The f passed in variableGrads(f) must return a scalar, but it "+"returned a rank-".concat(o.rank," tensor"));const l={};return e.forEach((u,c)=>{i[c]!=null&&(l[u.name]=i[c])}),r!=null&&r.forEach(u=>l[u.name]=null),{value:o,grads:l}}function xs(t){return W.customGrad(t)}/** 1936 * @license 1937 * Copyright 2018 Google LLC. All Rights Reserved. 1938 * Licensed under the Apache License, Version 2.0 (the "License"); 1939 * you may not use this file except in compliance with the License. 1940 * You may obtain a copy of the License at 1941 * 1942 * http://www.apache.org/licenses/LICENSE-2.0 1943 * 1944 * Unless required by applicable law or agreed to in writing, software 1945 * distributed under the License is distributed on an "AS IS" BASIS, 1946 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1947 * See the License for the specific language governing permissions and 1948 * limitations under the License. 1949 * ============================================================================= 1950 */function X$(t){const n={x:C(t,"x","neg")};return W.runKernel(Vm,n)}const ns=P({neg_:X$});/** 1951 * @license 1952 * Copyright 2018 Google LLC. All Rights Reserved. 1953 * Licensed under the Apache License, Version 2.0 (the "License"); 1954 * you may not use this file except in compliance with the License. 1955 * You may obtain a copy of the License at 1956 * 1957 * http://www.apache.org/licenses/LICENSE-2.0 1958 * 1959 * Unless required by applicable law or agreed to in writing, software 1960 * distributed under the License is distributed on an "AS IS" BASIS, 1961 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1962 * See the License for the specific language governing permissions and 1963 * limitations under the License. 1964 * ============================================================================= 1965 */function Y$(t){const n={x:C(t,"x","softplus")};return W.runKernel(bf,n)}const Uw=P({softplus_:Y$});/** 1966 * @license 1967 * Copyright 2018 Google LLC. All Rights Reserved. 1968 * Licensed under the Apache License, Version 2.0 (the "License"); 1969 * you may not use this file except in compliance with the License. 1970 * You may obtain a copy of the License at 1971 * 1972 * http://www.apache.org/licenses/LICENSE-2.0 1973 * 1974 * Unless required by applicable law or agreed to in writing, software 1975 * distributed under the License is distributed on an "AS IS" BASIS, 1976 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1977 * See the License for the specific language governing permissions and 1978 * limitations under the License. 1979 * ============================================================================= 1980 */function J$(t){const e=C(t,"x","logSigmoid");return xs(r=>({value:ns(Uw(ns(r))),gradFunc:o=>he(o,Ba(ns(r)))}))(e)}const Q$=P({logSigmoid_:J$});/** 1981 * @license 1982 * Copyright 2020 Google LLC. All Rights Reserved. 1983 * Licensed under the Apache License, Version 2.0 (the "License");
1984 * you may not use this file except in compliance with the License. 1985 * You may obtain a copy of the License at 1986 * 1987 * http://www.apache.org/licenses/LICENSE-2.0 1988 * 1989 * Unless required by applicable law or agreed to in writing, software 1990 * distributed under the License is distributed on an "AS IS" BASIS, 1991 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1992 * See the License for the specific language governing permissions and 1993 * limitations under the License. 1994 * ============================================================================= 1995 */function Z$(t,e){let n=C(t,"a","sub"),r=C(e,"b","sub");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(Tf,s)}const Je=P({sub_:Z$});/** 1996 * @license 1997 * Copyright 2020 Google Inc. All Rights Reserved. 1998 * Licensed under the Apache License, Version 2.0 (the "License"); 1999 * you may not use this file except in compliance with the License. 2000 * You may obtain a copy of the License at 2001 * 2002 * http://www.apache.org/licenses/LICENSE-2.0 2003 * 2004 * Unless required by applicable law or agreed to in writing, software 2005 * distributed under the License is distributed on an "AS IS" BASIS, 2006 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2007 * See the License for the specific language governing permissions and 2008 * limitations under the License. 2009 * ============================================================================= 2010 */function eR(t,e=-1){const n=C(t,"logits","logSoftmax");if(e===-1&&(e=n.rank-1),e!==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(e));return xs((s,a)=>{const i=Ho(s,e,!0),l=Je(s,i),u=Je(Ut(l,"float32"),Ic(Mt(Ss(l),e,!0)));return a([u]),{value:u,gradFunc:(d,f)=>{const[p]=f,h=!0,m=Ss(p);return Je(d,he(Mt(d,e,h),m))}}})(n)}const tR=P({logSoftmax_:eR});/** 2011 * @license 2012 * Copyright 2020 Google LLC. All Rights Reserved. 2013 * Licensed under the Apache License, Version 2.0 (the "License"); 2014 * you may not use this file except in compliance with the License. 2015 * You may obtain a copy of the License at 2016 * 2017 * http://www.apache.org/licenses/LICENSE-2.0 2018 * 2019 * Unless required by applicable law or agreed to in writing, software 2020 * distributed under the License is distributed on an "AS IS" BASIS, 2021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2022 * See the License for the specific language governing permissions and 2023 * limitations under the License. 2024 * ============================================================================= 2025 */function nR(t,e=null,n=!1){const r=C(t,"x","logSumExp"),s=Vt(e,r.shape),a=Ho(r,s,!0),o=Je(r,a),i=Ss(o),l=Mt(i,s),u=
2025Ic(l),c=Fe(re(a,u.shape),u);if(n){const d=gn(c.shape,s);return re(c,d)}return c}const Vw=P({logSumExp_:nR});/** 2026 * @license 2027 * Copyright 2020 Google LLC. All Rights Reserved. 2028 * Licensed under the Apache License, Version 2.0 (the "License"); 2029 * you may not use this file except in compliance with the License. 2030 * You may obtain a copy of the License at 2031 * 2032 * http://www.apache.org/licenses/LICENSE-2.0 2033 * 2034 * Unless required by applicable law or agreed to in writing, software 2035 * distributed under the License is distributed on an "AS IS" BASIS, 2036 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2037 * See the License for the specific language governing permissions and 2038 * limitations under the License. 2039 * ============================================================================= 2040 */function rR(t,e){const n=C(t,"a","logicalAnd","bool"),r=C(e,"b","logicalAnd","bool");Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Dd,s)}const cu=P({logicalAnd_:rR});/** 2041 * @license 2042 * Copyright 2020 Google LLC. All Rights Reserved. 2043 * Licensed under the Apache License, Version 2.0 (the "License"); 2044 * you may not use this file except in compliance with the License. 2045 * You may obtain a copy of the License at 2046 * 2047 * http://www.apache.org/licenses/LICENSE-2.0 2048 * 2049 * Unless required by applicable law or agreed to in writing, software 2050 * distributed under the License is distributed on an "AS IS" BASIS, 2051 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2052 * See the License for the specific language governing permissions and 2053 * limitations under the License. 2054 * ============================================================================= 2055 */function sR(t){const n={x:C(t,"x","logicalNot","bool")};return W.runKernel(Fd,n)}const jw=P({logicalNot_:sR});/** 2056 * @license 2057 * Copyright 2020 Google LLC. All Rights Reserved. 2058 * Licensed under the Apache License, Version 2.0 (the "License"); 2059 * you may not use this file except in compliance with the License. 2060 * You may obtain a copy of the License at 2061 * 2062 * http://www.apache.org/licenses/LICENSE-2.0 2063 * 2064 * Unless required by applicable law or agreed to in writing, software 2065 * distributed under the License is distributed on an "AS IS" BASIS, 2066 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2067 * See the License for the specific language governing permissions and 2068 * limitations under the License. 2069 * ============================================================================= 2070 */function aR(t,e){const n=C(t,"a","logicalOr","bool"),r=C(e,"b","logicalOr","bool");Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Md,s)}const Gw=P({logicalOr_:aR});/** 2071 * @license 2072 * Copyright 2020 Google LLC. All Rights Reserved. 2073 * Licensed under the Apache License, Version 2.0 (the "License"); 2074 * you may not use this file except in compliance with the License. 2075 * You may obtain a copy of the License at 2076 * 2077 * http://www.apache.org/licenses/LICENSE-2.0 2078 * 2079 * Unless required by applicable law or agreed to in writing, software 2080 * distributed under the License is distributed on an "AS IS" BASIS, 2081 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2082 * See the License for the specific language governing permissions and 2083 * limitations under the License. 2084 * ============================================================================= 2085 */function oR(t,e){const n=C(t,"a","logicalXor","bool"),r=C(e,"b","logicalXor","bool");return Rt(n.shape,r.shape),cu(Gw(t,e),jw(cu(t,e)))}const iR=P({logicalXor_:oR});/** 2086 * @license 2087 * Copyright 2022 Google LLC. All Rights Reserved. 2088 * Licensed under the Apache License, Version 2.0 (the "License"); 2089 * you may not use this file except in compliance with the License. 2090 * You may obtain a copy of the License at 2091 * 2092 * http://www.apache.org/licenses/LICENSE-2.0 2093 * 2094 * Unless required by applicable law or agreed to in writing, software 2095 * distributed under the License is distributed on an "AS IS" BASIS, 2096 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2097 * See the License for the specific language governing permissions and 2098 * limitations under the License. 2099 * ============================================================================= 2100 */const vl=2147483648;function cR(t,e,n="left"){const r=C(t,"sortedSequence","searchSorted"),s=C(e,"values","searchSorted"),a=r.shape[r.shape.length-1],o=s.shape[s.shape.length-1],i=re(r,[-1,a]),l=re(s,[-1,o]);if(i.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(i.shape[0]!==l.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(J(l.shape)>=vl)throw new Error("values tensor size must less than ".concat(vl));if(i.shape[1]>=vl)throw new Error("trailing dim_size must less than ".concat(vl," for int32 output type, was ").concat(i.shape[1]));const u={sortedSequence:i,values:l},c={side:n};return W.runKernel(pf,u,c)}const yg=P({searchSorted_:cR});/** 2101 * @license 2102 * Copyright 2022 Google LLC. All Rights Reserved. 2103 * Licensed under the Apache License, Version 2.0 (the "License");
2104 * you may not use this file except in compliance with the License. 2105 * You may obtain a copy of the License at 2106 * 2107 * http://www.apache.org/licenses/LICENSE-2.0 2108 * 2109 * Unless required by applicable law or agreed to in writing, software 2110 * distributed under the License is distributed on an "AS IS" BASIS, 2111 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2112 * See the License for the specific language governing permissions and 2113 * limitations under the License. 2114 * ============================================================================= 2115 */function lR(t,e){return yg(t,e,"left")}/** 2116 * @license 2117 * Copyright 2020 Google LLC. All Rights Reserved. 2118 * Licensed under the Apache License, Version 2.0 (the "License"); 2119 * you may not use this file except in compliance with the License. 2120 * You may obtain a copy of the License at 2121 * 2122 * http://www.apache.org/licenses/LICENSE-2.0 2123 * 2124 * Unless required by applicable law or agreed to in writing, software 2125 * distributed under the License is distributed on an "AS IS" BASIS, 2126 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2127 * See the License for the specific language governing permissions and 2128 * limitations under the License. 2129 * ============================================================================= 2130 */function uR(t,e,n,r,s){const a=C(t,"x","maxPool"),o=1;let i=a,l=!1;a.rank===3&&(l=!0,i=re(a,[1,a.shape[0],a.shape[1],a.shape[2]])),A(i.rank===4,()=>"Error in maxPool: input must be rank 4 but got rank ".concat(i.rank,".")),A(Tr(n,o),()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(o,"'")),zr("maxPool",r,s);const u={x:i},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s},d=W.runKernel(Ld,u,c);return l?re(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const qw=P({maxPool_:uR});/** 2131 * @license 2132 * Copyright 2020 Google LLC. All Rights Reserved. 2133 * Licensed under the Apache License, Version 2.0 (the "License"); 2134 * you may not use this file except in compliance with the License. 2135 * You may obtain a copy of the License at 2136 * 2137 * http://www.apache.org/licenses/LICENSE-2.0 2138 * 2139 * Unless required by applicable law or agreed to in writing, software 2140 * distributed under the License is distributed on an "AS IS" BASIS, 2141 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2142 * See the License for the specific language governing permissions and 2143 * limitations under the License. 2144 * ============================================================================= 2145 */function dR(t,e=[1,1,1],n,r,s,a="NDHWC"){const o=C(t,"x","maxPool3d");let i=o,l=!1;o.rank===4&&(l=!0,i=re(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),A(i.rank===5,()=>"Error in maxPool3d: x must be rank 5 but got rank ".concat(i.rank,".")),A(a==="NDHWC",()=>"Error in maxPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(a)),zr("maxPool3d",r,s);const u={x:i},c={filterSize:e,strides:n,pad:r,dimRoundingMode:s,dataFormat:a},d=W.runKernel(Hm,u,c);return l?re(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const fR=P({maxPool3d_:dR});/** 2146 * @license 2147 * Copyright 2018 Google LLC. All Rights Reserved. 2148 * Licensed under the Apache License, Version 2.0 (the "License"); 2149 * you may not use this file except in compliance with the License. 2150 * You may obtain a copy of the License at 2151 * 2152 * http://www.apache.org/licenses/LICENSE-2.0 2153 * 2154 * Unless required by applicable law or agreed to in writing, software 2155 * distributed under the License is distributed on an "AS IS" BASIS, 2156 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2157 * See the License for the specific language governing permissions and 2158 * limitations under the License. 2159 * ============================================================================= 2160 */function pR(t,e,n,r,s=!1){const o={x:C(t,"x","maxPoolWithArgmax")},i={filterSize:e,strides:n,pad:r,includeBatchInIndex:s},l=W.runKernel(Um,o,i);return{result:l[0],indexes:l[1]}}const hR=P({maxPoolWithArgmax_:pR});/** 2161 * @license 2162 * Copyright 2020 Google LLC. All Rights Reserved. 2163 * Licensed under the Apache License, Version 2.0 (the "License");
2164 * you may not use this file except in compliance with the License. 2165 * You may obtain a copy of the License at 2166 * 2167 * http://www.apache.org/licenses/LICENSE-2.0 2168 * 2169 * Unless required by applicable law or agreed to in writing, software 2170 * distributed under the License is distributed on an "AS IS" BASIS, 2171 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2172 * See the License for the specific language governing permissions and 2173 * limitations under the License. 2174 * ============================================================================= 2175 */function mR(t,e){let n=C(t,"a","maximum"),r=C(e,"b","maximum");[n,r]=Xt(n,r),n.dtype==="bool"&&(n=Ut(n,"int32"),r=Ut(r,"int32")),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Bd,s)}const Kw=P({maximum_:mR});/** 2176 * @license 2177 * Copyright 2020 Google Inc. All Rights Reserved. 2178 * Licensed under the Apache License, Version 2.0 (the "License"); 2179 * you may not use this file except in compliance with the License. 2180 * You may obtain a copy of the License at 2181 * 2182 * http://www.apache.org/licenses/LICENSE-2.0 2183 * 2184 * Unless required by applicable law or agreed to in writing, software 2185 * distributed under the License is distributed on an "AS IS" BASIS, 2186 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2187 * See the License for the specific language governing permissions and 2188 * limitations under the License. 2189 * ============================================================================= 2190 */function gR(t,e=null,n=!1){const s={x:C(t,"x","mean")},a={axis:e,keepDims:n};return W.runKernel(Wd,s,a)}const lu=P({mean_:gR});/** 2191 * @license 2192 * Copyright 2018 Google LLC. All Rights Reserved. 2193 * Licensed under the Apache License, Version 2.0 (the "License"); 2194 * you may not use this file except in compliance with the License. 2195 * You may obtain a copy of the License at 2196 * 2197 * http://www.apache.org/licenses/LICENSE-2.0 2198 * 2199 * Unless required by applicable law or agreed to in writing, software 2200 * distributed under the License is distributed on an "AS IS" BASIS, 2201 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2202 * See the License for the specific language governing permissions and 2203 * limitations under the License. 2204 * ============================================================================= 2205 */function Jo(t,e="float32"){if(dr(t),e==="complex64"){const r=Jo(t,"float32"),s=Jo(t,"float32");return Zs(r,s)}const n=xn(J(t),e);return W.makeTensor(n,t,e)}/** 2206 * @license 2207 * Copyright 2018 Google LLC. All Rights Reserved. 2208 * Licensed under the Apache License, Version 2.0 (the "License"); 2209 * you may not use this file except in compliance with the License. 2210 * You may obtain a copy of the License at 2211 * 2212 * http://www.apache.org/licenses/LICENSE-2.0 2213 * 2214 * Unless required by applicable law or agreed to in writing, software 2215 * distributed under the License is distributed on an "AS IS" BASIS, 2216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2217 * See the License for the specific language governing permissions and 2218 * limitations under the License. 2219 * ============================================================================= 2220 */function Fa(t,e="float32"){if(dr(t),e==="complex64"){const r=Fa(t,"float32"),s=Jo(t,"float32");return Zs(r,s)}const n=km(J(t),e);return W.makeTensor(n,t,e)}/** 2221 * @license 2222 * Copyright 2021 Google LLC. All Rights Reserved. 2223 * Licensed under the Apache License, Version 2.0 (the "License"); 2224 * you may not use this file except in compliance with the License. 2225 * You may obtain a copy of the License at 2226 * 2227 * http://www.apache.org/licenses/LICENSE-2.0 2228 * 2229 * Unless required by applicable law or agreed to in writing, software 2230 * distributed under the License is distributed on an "AS IS" BASIS, 2231 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2232 * See the License for the specific language governing permissions and 2233 * limitations under the License. 2234 * ============================================================================= 2235 */function yR(t,e,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError("".concat(n," is not a valid third argument to meshgrid"));if(t===void 0)return[];let r=C(t,"x","meshgrid",t instanceof Zt?t.dtype:"float32");if(e===void 0)return[r];let s=C(e,"y","meshgrid",e instanceof Zt?e.dtype:"float32");const a=J(r.shape),o=J(s.shape);return n==="xy"?(r=re(r,[1,-1]),s=re(s,[-1,1]),[xt(Fa([o,1],r.dtype),r),xt(s,Fa([1,a],s.dtype))]):(r=re(r,[-1,1]),s=re(s,[1,-1]),[xt(r,Fa([1,o],r.dtype)),xt(Fa([a,1],s.dtype),s)])}/** 2236 * @license 2237 * Copyright 2020 Google LLC. All Rights Reserved. 2238 * Licensed under the Apache License, Version 2.0 (the "License");
2239 * you may not use this file except in compliance with the License. 2240 * You may obtain a copy of the License at 2241 * 2242 * http://www.apache.org/licenses/LICENSE-2.0 2243 * 2244 * Unless required by applicable law or agreed to in writing, software 2245 * distributed under the License is distributed on an "AS IS" BASIS, 2246 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2247 * See the License for the specific language governing permissions and 2248 * limitations under the License. 2249 * ============================================================================= 2250 */function vR(t,e){let n=C(t,"a","minimum"),r=C(e,"b","minimum");[n,r]=Xt(n,r),n.dtype==="bool"&&(n=Ut(n,"int32"),r=Ut(r,"int32")),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(Hd,s)}const uu=P({minimum_:vR});/** 2251 * @license 2252 * Copyright 2020 Google LLC. All Rights Reserved. 2253 * Licensed under the Apache License, Version 2.0 (the "License"); 2254 * you may not use this file except in compliance with the License. 2255 * You may obtain a copy of the License at 2256 * 2257 * http://www.apache.org/licenses/LICENSE-2.0 2258 * 2259 * Unless required by applicable law or agreed to in writing, software 2260 * distributed under the License is distributed on an "AS IS" BASIS, 2261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2262 * See the License for the specific language governing permissions and 2263 * limitations under the License. 2264 * ============================================================================= 2265 */function bR(t,e,n){A(n==="reflect"||n==="symmetric",()=>"Invalid mode. Mode must be either reflect or symmetric. "+"Got ".concat(n,"."));const r=C(t,"x","mirrorPad");if(r.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");A(e.length===r.rank,()=>"Padding doesn't match input. Must be ".concat(r.rank,". ")+"Got ".concat(e.length,"."));const s=n==="reflect"?1:0;for(let i=0;i<r.rank;i++)A(e[i].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),A(e[i][0]>=0&&e[i][0]<=r.shape[i]-s&&e[i][1]>=0&&e[i][1]<=r.shape[i]-s,()=>"Padding in dimension ".concat(i," cannot be greater than or equal ")+"to ".concat(r.shape[i]-s," or less than 0 for input of ")+"shape ".concat(r.shape));const a={paddings:e,mode:n},o={x:r};return W.runKernel(Ud,o,a)}const wR=P({mirrorPad_:bR});/** 2266 * @license 2267 * Copyright 2020 Google LLC. All Rights Reserved. 2268 * Licensed under the Apache License, Version 2.0 (the "License"); 2269 * you may not use this file except in compliance with the License. 2270 * You may obtain a copy of the License at 2271 * 2272 * http://www.apache.org/licenses/LICENSE-2.0 2273 * 2274 * Unless required by applicable law or agreed to in writing, software 2275 * distributed under the License is distributed on an "AS IS" BASIS, 2276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2277 * See the License for the specific language governing permissions and 2278 * limitations under the License. 2279 * ============================================================================= 2280 */function SR(t,e){let n=C(t,"a","mod"),r=C(e,"b","mod");[n,r]=Xt(n,r);const s={a:n,b:r};return W.runKernel(Vd,s)}const xR=P({mod_:SR});/** 2281 * @license 2282 * Copyright 2020 Google LLC. All Rights Reserved. 2283 * Licensed under the Apache License, Version 2.0 (the "License"); 2284 * you may not use this file except in compliance with the License. 2285 * You may obtain a copy of the License at 2286 * 2287 * http://www.apache.org/licenses/LICENSE-2.0 2288 * 2289 * Unless required by applicable law or agreed to in writing, software 2290 * distributed under the License is distributed on an "AS IS" BASIS, 2291 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2292 * See the License for the specific language governing permissions and 2293 * limitations under the License. 2294 * ============================================================================= 2295 */function _R(t,e=null,n=!1){t=C(t,"x","moments");const r=Vt(e,t.shape),s=lu(t,r,n);let a=s.shape;n||(a=gn(s.shape,r));const o=Mr(Je(Ut(t,"float32"),re(s,a))),i=lu(o,r,n);return{mean:s,variance:i}}const IR=P({moments_:_R});function kR(t,e,n,r){const s=C(e,"data","multiRNNCell"),a=su(n,"c","multiRNNCell"),o=su(r,"h","multiRNNCell");let i=s;const l=[];for(let d=0;d<t.length;
2295d++){const f=t[d](i,a[d],o[d]);l.push(f[0]),l.push(f[1]),i=f[1]}const u=[],c=[];for(let d=0;d<l.length;d+=2)u.push(l[d]),c.push(l[d+1]);return[u,c]}const ER=P({multiRNNCell_:kR});/** 2296 * @license 2297 * Copyright 2020 Google LLC. All Rights Reserved. 2298 * Licensed under the Apache License, Version 2.0 (the "License"); 2299 * you may not use this file except in compliance with the License. 2300 * You may obtain a copy of the License at 2301 * 2302 * http://www.apache.org/licenses/LICENSE-2.0 2303 * 2304 * Unless required by applicable law or agreed to in writing, software 2305 * distributed under the License is distributed on an "AS IS" BASIS, 2306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2307 * See the License for the specific language governing permissions and 2308 * limitations under the License. 2309 * ============================================================================= 2310 */function TR(t,e,n,r=!1){const s=C(t,"logits","multinomial"),a=s.size,o=s.rank;if(a<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+"".concat(a,"."));if(o>2)throw new Error("Rank of probabilities must be 1 or 2, but is ".concat(o));n=n||Math.random();const l={logits:o===1?re(s,[1,-1]):s},u={numSamples:e,seed:n,normalized:r},c=W.runKernel(jd,l,u);return o===1?re(c,[c.size]):c}const CR=P({multinomial_:TR});/** 2311 * @license 2312 * Copyright 2020 Google LLC. All Rights Reserved. 2313 * Licensed under the Apache License, Version 2.0 (the "License"); 2314 * you may not use this file except in compliance with the License. 2315 * You may obtain a copy of the License at 2316 * 2317 * http://www.apache.org/licenses/LICENSE-2.0 2318 * 2319 * Unless required by applicable law or agreed to in writing, software 2320 * distributed under the License is distributed on an "AS IS" BASIS, 2321 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2322 * See the License for the specific language governing permissions and 2323 * limitations under the License. 2324 * ============================================================================= 2325 */function NR(t,e){let n=C(t,"a","notEqual","string_or_numeric"),r=C(e,"b","notEqual","string_or_numeric");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r};return W.runKernel(qd,s)}const Xw=P({notEqual_:NR});/** 2326 * @license 2327 * Copyright 2020 Google LLC. All Rights Reserved. 2328 * Licensed under the Apache License, Version 2.0 (the "License"); 2329 * you may not use this file except in compliance with the License. 2330 * You may obtain a copy of the License at 2331 * 2332 * http://www.apache.org/licenses/LICENSE-2.0 2333 * 2334 * Unless required by applicable law or agreed to in writing, software 2335 * distributed under the License is distributed on an "AS IS" BASIS, 2336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2337 * See the License for the specific language governing permissions and 2338 * limitations under the License. 2339 * ============================================================================= 2340 */function AR(t,e,n=1,r=0,s="int32"){if(e<2)throw new Error("Error in oneHot: depth must be >=2, but it is ".concat(e));const o={indices:C(t,"indices","oneHot","int32")},i={dtype:s,depth:e,onValue:n,offValue:r};return W.runKernel(Jd,o,i)}const $R=P({oneHot_:AR});/** 2341 * @license 2342 * Copyright 2018 Google LLC. All Rights Reserved. 2343 * Licensed under the Apache License, Version 2.0 (the "License"); 2344 * you may not use this file except in compliance with the License. 2345 * You may obtain a copy of the License at 2346 * 2347 * http://www.apache.org/licenses/LICENSE-2.0 2348 * 2349 * Unless required by applicable law or agreed to in writing, software 2350 * distributed under the License is distributed on an "AS IS" BASIS, 2351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2352 * See the License for the specific language governing permissions and 2353 * limitations under the License. 2354 * ============================================================================= 2355 */function RR(t){const n={x:C(t,"x","onesLike")};return W.runKernel(jm,n)}const DR=P({onesLike_:RR});function FR(t,e){const n=C(t,"v1","outerProduct"),r=C(e,"v2","outerProduct");A(n.rank===1&&r.rank===1,()=>"Error in outerProduct: inputs must be rank 1, but got ranks "+"".concat(n.rank," and ").concat(r.rank,"."));const s=re(n,[-1,1]),a=re(r,[1,-1]);return xt(s,a)}const MR=P({outerProduct_:FR});/** 2356 * @license 2357 * Copyright 2020 Google LLC. All Rights Reserved. 2358 * Licensed under the Apache License, Version 2.0 (the "License");
2359 * you may not use this file except in compliance with the License. 2360 * You may obtain a copy of the License at 2361 * 2362 * http://www.apache.org/licenses/LICENSE-2.0 2363 * 2364 * Unless required by applicable law or agreed to in writing, software 2365 * distributed under the License is distributed on an "AS IS" BASIS, 2366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2367 * See the License for the specific language governing permissions and 2368 * limitations under the License. 2369 * ============================================================================= 2370 */function OR(t,e,n=0){const r=C(t,"x","pad");if(r.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const s={paddings:e,constantValue:n},a={x:r};return W.runKernel(Qd,a,s)}const Vc=P({pad_:OR});function PR(t,e,n=0){return A(e.length===2,()=>"Invalid number of paddings. Must be length of 2."),Vc(t,[e],n)}const BR=P({pad1d_:PR});function LR(t,e,n=0){return A(e.length===2&&e[0].length===2&&e[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Vc(t,e,n)}const WR=P({pad2d_:LR});function zR(t,e,n=0){return A(e.length===3&&e[0].length===2&&e[1].length===2&&e[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Vc(t,e,n)}const HR=P({pad3d_:zR});function UR(t,e,n=0){return A(e.length===4&&e[0].length===2&&e[1].length===2&&e[2].length===2&&e[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Vc(t,e,n)}const VR=P({pad4d_:UR});/** 2371 * @license 2372 * Copyright 2020 Google LLC. All Rights Reserved. 2373 * Licensed under the Apache License, Version 2.0 (the "License"); 2374 * you may not use this file except in compliance with the License. 2375 * You may obtain a copy of the License at 2376 * 2377 * http://www.apache.org/licenses/LICENSE-2.0 2378 * 2379 * Unless required by applicable law or agreed to in writing, software 2380 * distributed under the License is distributed on an "AS IS" BASIS, 2381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2382 * See the License for the specific language governing permissions and 2383 * limitations under the License. 2384 * ============================================================================= 2385 */function jR(t,e,n){const r=C(t,"x","spaceToBatchND");A(r.rank>=1+e.length,()=>"input rank ".concat(r.rank," should be > than [blockShape] ").concat(e.length)),A(n.length===e.length,()=>"paddings.shape[0] ".concat(n.length," must be equal to [blockShape] ").concat(e.length)),A(r.shape.reduce((o,i,l)=>l>0&&l<=e.length?o&&(i+n[l-1][0]+n[l-1][1])%e[l-1]===0:o,!0),()=>"input spatial dimensions ".concat(r.shape.slice(1)," with paddings ").concat(n.toString()," must be divisible by blockShapes ").concat(e.toString()));const s={x:r},a={blockShape:e,paddings:n};return W.runKernel(Zm,s,a)}const Yw=P({spaceToBatchND_:jR});/** 2386 * @license 2387 * Copyright 2018 Google LLC. All Rights Reserved. 2388 * Licensed under the Apache License, Version 2.0 (the "License"); 2389 * you may not use this file except in compliance with the License. 2390 * You may obtain a copy of the License at 2391 * 2392 * http://www.apache.org/licenses/LICENSE-2.0 2393 * 2394 * Unless required by applicable law or agreed to in writing, software 2395 * distributed under the License is distributed on an "AS IS" BASIS, 2396 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2397 * See the License for the specific language governing permissions and 2398 * limitations under the License. 2399 * ============================================================================= 2400 */function GR(t,e,n,r,s,a,o){s==null&&(s=[1,1]),a==null&&(a=1),r===0&&(r="valid");const i=C(t,"x","maxPool");let l=i,u=!1;i.rank===3&&(u=!0,l=re(i,[1,i.shape[0],i.shape[1],i.shape[2]])),A(Tr(a,s),()=>"Error in pool: Either strides or dilations must be 1. "+"Got strides ".concat(a," and dilations '").concat(s,"'"));const c=Wr(l.shape,e,a,s,r),d=[c.dilationHeight,c.dilationWidth];let f;r==="same"?f=KR([c.filterHeight,c.filterWidth],d):f=[[0,0],[0,0]];const p=d[0]===1&&d[1]===1,[h,m]=qR([c.inHeight,c.inWidth],d,f),g=p?r:"valid",v=p?l:Yw(l,d,h),w=(n==="avg"?()=>Cw(v,e,a,g,o):()=>qw(v,e,a,g,o))(),S=p?w:Nw(w,d,m);return u?re(S,[S.shape[1],S.shape[2],S.shape[3]]):S}function qR(t,e,n){const r=n.map(c=>c[0]),s=n.map(c=>c[1]),a=t.concat(r,s),o=e.map((c,d)=>(c-a[d]%c)%c),i=s.map((c,d)=>c+o[d]),l=e.map((c,d)=>[r[d],i[d]]),u=e.map((c,d)=>[0,o[d]]);return[l,u]}function KR(t,e){const r=t.map((o,i)=>
2400o+(o-1)*(e[i]-1)).map(o=>o-1),s=r.map(o=>Math.floor(o/2)),a=r.map((o,i)=>o-s[i]);return r.map((o,i)=>[s[i],a[i]])}const XR=P({pool_:GR});/** 2401 * @license 2402 * Copyright 2020 Google LLC. All Rights Reserved. 2403 * Licensed under the Apache License, Version 2.0 (the "License"); 2404 * you may not use this file except in compliance with the License. 2405 * You may obtain a copy of the License at 2406 * 2407 * http://www.apache.org/licenses/LICENSE-2.0 2408 * 2409 * Unless required by applicable law or agreed to in writing, software 2410 * distributed under the License is distributed on an "AS IS" BASIS, 2411 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2412 * See the License for the specific language governing permissions and 2413 * limitations under the License. 2414 * ============================================================================= 2415 */function YR(t,e){const n=C(t,"x","prelu"),r=C(e,"alpha","prelu"),s={x:n,alpha:r};return W.runKernel(ef,s)}const Jw=P({prelu_:YR});/** 2416 * @license 2417 * Copyright 2020 Google LLC. All Rights Reserved. 2418 * Licensed under the Apache License, Version 2.0 (the "License"); 2419 * you may not use this file except in compliance with the License. 2420 * You may obtain a copy of the License at 2421 * 2422 * http://www.apache.org/licenses/LICENSE-2.0 2423 * 2424 * Unless required by applicable law or agreed to in writing, software 2425 * distributed under the License is distributed on an "AS IS" BASIS, 2426 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2427 * See the License for the specific language governing permissions and 2428 * limitations under the License. 2429 * ============================================================================= 2430 */function JR(t,e=null,n=!1){let r=C(t,"x","prod");r.dtype==="bool"&&(r=Ut(r,"int32"));const s={x:r},a={axis:e,keepDims:n};return W.runKernel(tf,s,a)}const QR=P({prod_:JR});/** 2431 * @license 2432 * Copyright 2022 Google LLC. All Rights Reserved. 2433 * Licensed under the Apache License, Version 2.0 (the "License"); 2434 * you may not use this file except in compliance with the License. 2435 * You may obtain a copy of the License at 2436 * 2437 * http://www.apache.org/licenses/LICENSE-2.0 2438 * 2439 * Unless required by applicable law or agreed to in writing, software 2440 * distributed under the License is distributed on an "AS IS" BASIS, 2441 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2442 * See the License for the specific language governing permissions and 2443 * limitations under the License. 2444 * ============================================================================= 2445 */function ZR(t,e,n,r){const s=t.map((c,d)=>C(c,"tensors".concat(d),"raggedGather","int32")),a=C(e,"paramsDenseValues","raggedGather"),o=C(n,"indices","raggedGather","int32"),i={paramsNestedSplits:s,paramsDenseValues:a,indices:o},l={outputRaggedRank:r},u=W.runKernel(H1,i,l);return{outputNestedSplits:u.slice(0,u.length-1),outputDenseValues:u[u.length-1]}}const eD=P({raggedGather_:ZR});/** 2446 * @license 2447 * Copyright 2022 Google LLC. 2448 * Licensed under the Apache License, Version 2.0 (the "License"); 2449 * you may not use this file except in compliance with the License. 2450 * You may obtain a copy of the License at 2451 * 2452 * http://www.apache.org/licenses/LICENSE-2.0 2453 * 2454 * Unless required by applicable law or agreed to in writing, software 2455 * distributed under the License is distributed on an "AS IS" BASIS, 2456 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2457 * See the License for the specific language governing permissions and 2458 * limitations under the License. 2459 * ============================================================================= 2460 */function tD(t,e,n){const r=C(t,"starts","raggedRange"),s=C(e,"limits","raggedRange",r.dtype),a=C(n,"deltas","raggedRange",r.dtype),o={starts:r,limits:s,deltas:a},i=W.runKernel(U1,o);return{rtNestedSplits:i[0],rtDenseValues:i[1]}}const nD=P({raggedRange_:tD});/** 2461 * @license 2462 * Copyright 2022 Google LLC. All Rights Reserved. 2463 * Licensed under the Apache License, Version 2.0 (the "License"); 2464 * you may not use this file except in compliance with the License. 2465 * You may obtain a copy of the License at 2466 * 2467 * http://www.apache.org/licenses/LICENSE-2.0 2468 * 2469 * Unless required by applicable law or agreed to in writing, softw
2469are 2470 * distributed under the License is distributed on an "AS IS" BASIS, 2471 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2472 * See the License for the specific language governing permissions and 2473 * limitations under the License. 2474 * ============================================================================= 2475 */function rD(t,e,n,r,s){const a=C(t,"shape","raggedTensorToTensor","int32"),o=C(e,"values","raggedTensorToTensor"),i=C(n,"defaultValue","raggedTensorToTensor",o.dtype),l=r.map((d,f)=>C(d,"tensors".concat(f),"raggedTensorToTensor","int32")),u={shape:a,values:o,defaultValue:i,rowPartitionTensors:l},c={rowPartitionTypes:s};return W.runKernel(V1,u,c)}const sD=P({raggedTensorToTensor_:rD});/** 2476 * @license 2477 * Copyright 2020 Google LLC. All Rights Reserved. 2478 * Licensed under the Apache License, Version 2.0 (the "License"); 2479 * you may not use this file except in compliance with the License. 2480 * You may obtain a copy of the License at 2481 * 2482 * http://www.apache.org/licenses/LICENSE-2.0 2483 * 2484 * Unless required by applicable law or agreed to in writing, software 2485 * distributed under the License is distributed on an "AS IS" BASIS, 2486 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2487 * See the License for the specific language governing permissions and 2488 * limitations under the License. 2489 * ============================================================================= 2490 */function aD(t,e,n){dr(t);const r=J(t);let s=null;if(n==null||n==="float32")s=new Float32Array(r);else if(n==="int32")s=new Int32Array(r);else if(n==="bool")s=new Uint8Array(r);else throw new Error("Unknown data type ".concat(n));for(let a=0;a<r;a++)s[a]=e();return W.makeTensor(s,t,n)}const oD=P({rand_:aD});var vg={exports:{}};vg.exports;(function(t){(function(e,n,r){function s(l){var u=this,c=i();u.next=function(){var d=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=d-(u.c=d|0)},u.c=1,u.s0=c(" "),u.s1=c(" "),u.s2=c(" "),u.s0-=c(l),u.s0<0&&(u.s0+=1),u.s1-=c(l),u.s1<0&&(u.s1+=1),u.s2-=c(l),u.s2<0&&(u.s2+=1),c=null}function a(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function o(l,u){var c=new s(l),d=u&&u.state,f=c.next;return f.int32=function(){return c.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,d&&(typeof d=="object"&&a(d,c),f.state=function(){return a(c,{})}),f}function i(){var l=4022871197,u=function(c){c=String(c);for(var d=0;d<c.length;d++){l+=c.charCodeAt(d);var f=.02519603282416938*l;l=f>>>0,f-=l,f*=l,l=f>>>0,f-=l,l+=f*4294967296}return(l>>>0)*23283064365386963e-26};return u}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}):this.alea=o})(cr,t,!1)})(vg);var iD=vg.exports,bg={exports:{}};bg.exports;(function(t){(function(e,n,r){function s(i){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var d=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^d^d>>>8},i===(i|0)?l.x=i:u+=i;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,l.next()}function a(i,l){return l.x=i.x,l.y=i.y,l.z=i.z,l.w=i.w,l}function o(i,l){var u=new s(i),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,h=(f+p)/(1<<21);while(h===0);return h},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}):this.xor128=o})(cr,t,!1)})(bg);var cD=bg.exports,wg={exports:{}};wg.exports;(function(t){(function(e,n,r){function s(i){var l=this,u="";l.next=function(){var d=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(d^d<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,i===(i|0)?l.x=i:u+=i;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,c==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function a(i,l){return l.x=i.x,l.y=i.y,l.z=i.z,l.w=i.w,l.v=i.v,l.d=i.d,l}function o(i,l){var u=new s(i),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,h=(f+p)/(1<<21);while(h===0);return h},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}
vendor: 5,036 bytes, lines 2490-2493
2490):this.xorwow=o})(cr,t,!1)})(wg);var lD=wg.exports,Sg={exports:{}};Sg.exports;(function(t){(function(e,n,r){function s(i){var l=this;l.next=function(){var c=l.x,d=l.i,f,p;return f=c[d],f^=f>>>7,p=f^f<<24,f=c[d+1&7],p^=f^f>>>10,f=c[d+3&7],p^=f^f>>>3,f=c[d+4&7],p^=f^f<<7,f=c[d+7&7],f=f^f<<13,p^=f^f<<9,c[d]=p,l.i=d+1&7,p};function u(c,d){var f,p=[];if(d===(d|0))p[0]=d;else for(d=""+d,f=0;f<d.length;++f)p[f&7]=p[f&7]<<15^d.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?p[7]=-1:p[f],c.x=p,c.i=0,f=256;f>0;--f)c.next()}u(l,i)}function a(i,l){return l.x=i.x.slice(),l.i=i.i,l}function o(i,l){i==null&&(i=+new Date);var u=new s(i),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,h=(f+p)/(1<<21);while(h===0);return h},d.int32=u.next,d.quick=d,c&&(c.x&&a(c,u),d.state=function(){return a(u,{})}),d}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}):this.xorshift7=o})(cr,t,!1)})(Sg);var uD=Sg.exports,xg={exports:{}};xg.exports;(function(t){(function(e,n,r){function s(i){var l=this;l.next=function(){var c=l.w,d=l.X,f=l.i,p,h;return l.w=c=c+1640531527|0,h=d[f+34&127],p=d[f=f+1&127],h^=h<<13,p^=p<<17,h^=h>>>15,p^=p>>>12,h=d[f]=h^p,l.i=f,h+(c^c>>>16)|0};function u(c,d){var f,p,h,m,g,v=[],b=128;for(d===(d|0)?(p=d,d=null):(d=d+"\0",p=0,b=Math.max(b,d.length)),h=0,m=-32;m<b;++m)d&&(p^=d.charCodeAt((m+32)%d.length)),m===0&&(g=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,m>=0&&(g=g+1640531527|0,f=v[m&127]^=p+g,h=f==0?h+1:0);for(h>=128&&(v[(d&&d.length||0)&127]=-1),h=127,m=4*128;m>0;--m)p=v[h+34&127],f=v[h=h+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,v[h]=p^f;c.w=g,c.X=v,c.i=h}u(l,i)}function a(i,l){return l.i=i.i,l.w=i.w,l.X=i.X.slice(),l}function o(i,l){i==null&&(i=+new Date);var u=new s(i),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,h=(f+p)/(1<<21);while(h===0);return h},d.int32=u.next,d.quick=d,c&&(c.X&&a(c,u),d.state=function(){return a(u,{})}),d}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}):this.xor4096=o})(cr,t,!1)})(xg);var dD=xg.exports,_g={exports:{}};_g.exports;(function(t){(function(e,n,r){function s(i){var l=this,u="";l.next=function(){var d=l.b,f=l.c,p=l.d,h=l.a;return d=d<<25^d>>>7^f,f=f-p|0,p=p<<24^p>>>8^h,h=h-d|0,l.b=d=d<<20^d>>>12^f,l.c=f=f-p|0,l.d=p<<16^f>>>16^h,l.a=h-d|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,i===Math.floor(i)?(l.a=i/4294967296|0,l.b=i|0):u+=i;for(var c=0;c<u.length+20;c++)l.b^=u.charCodeAt(c)|0,l.next()}function a(i,l){return l.a=i.a,l.b=i.b,l.c=i.c,l.d=i.d,l}function o(i,l){var u=new s(i),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,h=(f+p)/(1<<21);while(h===0);return h},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}n&&n.exports?n.exports=o:r&&r.amd?r(function(){return o}):this.tychei=o})(cr,t,!1)})(_g);var fD=_g.exports,Qw={exports:{}};const pD={},hD=Object.freeze(Object.defineProperty({__proto__:null,default:pD},Symbol.toStringTag,{value:"Module"})),Vs=p3(hD);(function(t){(function(e,n,r){var s=256,a=6,o=52,i="random",l=r.pow(s,a),u=r.pow(2,o),c=u*2,d=s-1,f;function p(S,I,E){var T=[];I=I==!0?{entropy:!0}:I||{};var D=v(g(I.entropy?[S,w(n)]:S==null?b():S,3),T),R=new h(T),$=function(){for(var M=R.g(a),B=l,z=0;M<u;)M=(M+z)*s,B*=s,z=R.g(1);for(;M>=c;)M/=2,B/=2,z>>>=1;return(M+z)/B};return $.int32=function(){return R.g(4)|0},$.quick=function(){return R.g(4)/4294967296},$.double=$,v(w(R.S),n),(I.pass||E||function(M,B,z,H){return H&&(H.S&&m(H,R),M.state=function(){return m(R,{})}),z?(r[i]=M,B):M})($,D,"global"in I?I.global:this==r,I.state)}function h(S){var I,E=S.length,T=this,D=0,R=T.i=T.j=0,$=T.S=[];for(E||(S=[E++]);D<s;)$[D]=D++;for(D=0;D<s;D++)$[D]=$[R=d&R+S[D%E]+(I=$[D])],$[R]=I;(T.g=function(M){for(var B,z=0,H=T.i,V=T.j,X=T.S;M--;)B=X[H=d&H+1],z=z*s+X[d&(X[H]=X[V=d&V+B])+(X[V]=B)];return T.i=H,T.j=V,z})(s)}function m(S,I){return I.i=S.i,I.j=S.j,I.S=S.S.slice(),I}function g(S,I){var E=[],T=typeof S,D;if(I&&T=="object")for(D in S)try{E.push(g(S[D],I-1))}catch(R){}return E.length?E:T=="string"?S:S+"\0"}function v(S,I){for(var E=S+"",T,D=0;D<E.length;)I[d&D]=d&(T^=I[d&D]*19)+E.charCodeAt(D++);return w(I)}function b(){try{var S;return f&&(S=f.randomBytes)?S=S(s):(S=new Uint8Array(s),(e.crypto||e.msCrypto).getRandomValues(S)),w(S)}catch(T){var I=e.navigator,E=I&&I.plugins;return[+new Date,e,E,e.screen,w(n)]}}function w(S){return String.fromCharCode.apply(0,S)}if(v(r.random(),n),t.exports){t.exports=p;try{f=Vs}catch(S){}}else r["seed"+i]=p})(typeof self<"u"?self:cr,[],Math)})(Qw);var mD=Qw.exports,gD=iD,yD=cD,vD=lD,bD=uD,wD=dD,SD=fD,ro=mD;ro.alea=gD;ro.xor128=yD;ro.xorwow=vD;ro.xorshift7=bD;ro.xor4096=wD;ro.tychei=SD;var Wf=ro;/** 2491 * @license 2492 * Copyright 2018 Google LLC. All Rights Reserved. 2493 * Licensed under the Apache License, Version 2.0 (the "License");
2494 * you may not use this file except in compliance with the License. 2495 * You may obtain a copy of the License at 2496 * 2497 * http://www.apache.org/licenses/LICENSE-2.0 2498 * 2499 * Unless required by applicable law or agreed to in writing, software 2500 * distributed under the License is distributed on an "AS IS" BASIS, 2501 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2502 * See the License for the specific language governing permissions and 2503 * limitations under the License. 2504 * ============================================================================= 2505 */class Ig{constructor(e,n,r,s,a){this.mean=e,this.stdDev=n,this.dtype=r,this.nextVal=NaN,this.truncated=s,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);const o=a||Math.random();this.random=Wf.alea(o.toString())}nextValue(){if(!isNaN(this.nextVal)){const s=this.nextVal;return this.nextVal=NaN,s}let e,n,r=!1;for(;!r;){let s,a,o;do s=2*this.random()-1,a=2*this.random()-1,o=s*s+a*a;while(o>=1||o===0);const i=Math.sqrt(-2*Math.log(o)/o);e=this.mean+this.stdDev*s*i,n=this.mean+this.stdDev*a*i,(!this.truncated||this.isValidTruncated(e))&&(r=!0)}return(!this.truncated||this.isValidTruncated(n))&&(this.nextVal=this.convertValue(n)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class xD{constructor(e,n,r,s){this.alpha=e,this.beta=1/n,this.dtype=r;const a=s||Math.random();this.randu=Wf.alea(a.toString()),this.randn=new Ig(0,1,r,!1,this.randu()),e<1?this.d=e+2/3:this.d=e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,n,r,s,a,o;for(;;){do s=this.randn.nextValue(),o=1+this.c*s;while(o<=0);if(o*=o*o,e=s*s,n=1-.331*e*e,r=.5*e+this.d*(1-o+Math.log(o)),a=this.randu(),a<n||Math.log(a)<r)break}return o=1/this.beta*this.d*o,this.alpha<1&&(o*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(o)}convertValue(e){return this.dtype==="float32"?e:Math.round(e)}}class _D{constructor(e=0,n=1,r,s){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=n-e,this.dtype=r,s==null&&(s=Math.random()),typeof s=="number"&&(s=s.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between ".concat(e," - ").concat(n," <= 1 and dtype is not float"));this.random=Wf.alea(s)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}/** 2506 * @license 2507 * Copyright 2020 Google LLC. All Rights Reserved. 2508 * Licensed under the Apache License, Version 2.0 (the "License"); 2509 * you may not use this file except in compliance with the License. 2510 * You may obtain a copy of the License at 2511 * 2512 * http://www.apache.org/licenses/LICENSE-2.0 2513 * 2514 * Unless required by applicable law or agreed to in writing, software 2515 * distributed under the License is distributed on an "AS IS" BASIS, 2516 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2517 * See the License for the specific language governing permissions and 2518 * limitations under the License. 2519 * ============================================================================= 2520 */function ID(t,e,n=1,r="float32",s){if(dr(t),n==null&&(n=1),r==null&&(r="float32"),r!=="float32"&&r!=="int32")throw new Error("Unsupported data type ".concat(r));const a=new xD(e,n,r,s),o=rt(t,r);for(let i=0;i<o.values.length;i++)o.values[i]=a.nextValue();return o.toTensor()}const kD=P({randomGamma_:ID});/** 2521 * @license 2522 * Copyright 2020 Google LLC. All Rights Reserved. 2523 * Licensed under the Apache License, Version 2.0 (the "License"); 2524 * you may not use this file except in compliance with the License. 2525 * You may obtain a copy of the License at 2526 * 2527 * http://www.apache.org/licenses/LICENSE-2.0 2528 * 2529 * Unless required by applicable law or agreed to in writing, software 2530 * distributed under the License is distributed on an "AS IS" BASIS, 2531 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2532 * See the License for the specific language governing permissions and 2533 * limitations under the License. 2534 * ============================================================================= 2535 */function ED(t,e=0,n=1,r,s){if(dr(t),r!=null&&r==="bool")throw new Error("Unsupported data type ".concat(r));const a=new Ig(e,n,r,!1,s),o=rt(t,r);for(let i=0;i<o.values.length;i++)o.values[i]=a.nextValue();return o.toTensor()}const Zw=P({randomNormal_:ED});/** 2536 * @license 2537 * Copyright 2022 Google LLC. All Rights Reserved. 2538 * Licensed under the Apache License, Version 2.0 (the "License");
2539 * you may not use this file except in compliance with the License. 2540 * You may obtain a copy of the License at 2541 * 2542 * http://www.apache.org/licenses/LICENSE-2.0 2543 * 2544 * Unless required by applicable law or agreed to in writing, software 2545 * distributed under the License is distributed on an "AS IS" BASIS, 2546 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2547 * See the License for the specific language governing permissions and 2548 * limitations under the License. 2549 * ============================================================================= 2550 */function TD(t,e,n){if(e!=null&&e==="bool")throw new Error("Unsupported data type ".concat(e));return Zw(t,0,1,e,n)}const CD=P({randomStandardNormal_:TD});/** 2551 * @license 2552 * Copyright 2020 Google LLC. All Rights Reserved. 2553 * Licensed under the Apache License, Version 2.0 (the "License"); 2554 * you may not use this file except in compliance with the License. 2555 * You may obtain a copy of the License at 2556 * 2557 * http://www.apache.org/licenses/LICENSE-2.0 2558 * 2559 * Unless required by applicable law or agreed to in writing, software 2560 * distributed under the License is distributed on an "AS IS" BASIS, 2561 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2562 * See the License for the specific language governing permissions and 2563 * limitations under the License. 2564 * ============================================================================= 2565 */function ND(t,e=0,n=1,r="float32",s){dr(t);const a=rt(t,r),o=new _D(e,n,null,s);for(let i=0;i<a.values.length;i++)a.values[i]=o.nextValue();return a.toTensor()}const kg=P({randomUniform_:ND});/** 2566 * @license 2567 * Copyright 2023 Google LLC. 2568 * Licensed under the Apache License, Version 2.0 (the "License"); 2569 * you may not use this file except in compliance with the License. 2570 * You may obtain a copy of the License at 2571 * 2572 * http://www.apache.org/licenses/LICENSE-2.0 2573 * 2574 * Unless required by applicable law or agreed to in writing, software 2575 * distributed under the License is distributed on an "AS IS" BASIS, 2576 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2577 * See the License for the specific language governing permissions and 2578 * limitations under the License. 2579 * ============================================================================= 2580 */function AD(t,e,n,r){return kg(t,e,n,"int32",r)}const $D=P({randomUniformInt_:AD});/** 2581 * @license 2582 * Copyright 2018 Google LLC. All Rights Reserved. 2583 * Licensed under the Apache License, Version 2.0 (the "License"); 2584 * you may not use this file except in compliance with the License. 2585 * You may obtain a copy of the License at 2586 * 2587 * http://www.apache.org/licenses/LICENSE-2.0 2588 * 2589 * Unless required by applicable law or agreed to in writing, software 2590 * distributed under the License is distributed on an "AS IS" BASIS, 2591 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2592 * See the License for the specific language governing permissions and 2593 * limitations under the License. 2594 * ============================================================================= 2595 */function kc(t,e,n=1,r="float32"){if(n===0)throw new Error("Cannot have a step of zero");const s={start:t,stop:e,step:n,dtype:r};return W.runKernel(qm,{},s)}/** 2596 * @license 2597 * Copyright 2020 Google LLC. All Rights Reserved. 2598 * Licensed under the Apache License, Version 2.0 (the "License"); 2599 * you may not use this file except in compliance with the License. 2600 * You may obtain a copy of the License at 2601 * 2602 * http://www.apache.org/licenses/LICENSE-2.0 2603 * 2604 * Unless required by applicable law or agreed to in writing, software 2605 * distributed under the License is distributed on an "AS IS" BASIS, 2606 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2607 * See the License for the specific language governing permissions and 2608 * limitations under the License. 2609 * ============================================================================= 2610 */function RD(t){const n={input:C(t,"input","real")};return W.runKernel(j1,n)}const Ec=P({real_:RD});/** 2611 * @license 2612 * Copyright 2018 Google LLC. All Rights Reserved. 2613 * Licensed under the Apache License, Version 2.0 (the "License");
2614 * you may not use this file except in compliance with the License. 2615 * You may obtain a copy of the License at 2616 * 2617 * http://www.apache.org/licenses/LICENSE-2.0 2618 * 2619 * Unless required by applicable law or agreed to in writing, software 2620 * distributed under the License is distributed on an "AS IS" BASIS, 2621 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2622 * See the License for the specific language governing permissions and 2623 * limitations under the License. 2624 * ============================================================================= 2625 */function DD(t){const n={x:C(t,"x","reciprocal")};return W.runKernel(nf,n)}const FD=P({reciprocal_:DD});/** 2626 * @license 2627 * Copyright 2020 Google LLC. All Rights Reserved. 2628 * Licensed under the Apache License, Version 2.0 (the "License"); 2629 * you may not use this file except in compliance with the License. 2630 * You may obtain a copy of the License at 2631 * 2632 * http://www.apache.org/licenses/LICENSE-2.0 2633 * 2634 * Unless required by applicable law or agreed to in writing, software 2635 * distributed under the License is distributed on an "AS IS" BASIS, 2636 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2637 * See the License for the specific language governing permissions and 2638 * limitations under the License. 2639 * ============================================================================= 2640 */function MD(t){const n={x:C(t,"x","relu")};return W.runKernel(rf,n)}const zf=P({relu_:MD});/** 2641 * @license 2642 * Copyright 2020 Google LLC. All Rights Reserved. 2643 * Licensed under the Apache License, Version 2.0 (the "License"); 2644 * you may not use this file except in compliance with the License. 2645 * You may obtain a copy of the License at 2646 * 2647 * http://www.apache.org/licenses/LICENSE-2.0 2648 * 2649 * Unless required by applicable law or agreed to in writing, software 2650 * distributed under the License is distributed on an "AS IS" BASIS, 2651 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2652 * See the License for the specific language governing permissions and 2653 * limitations under the License. 2654 * ============================================================================= 2655 */function OD(t){const n={x:C(t,"x","relu6")};return W.runKernel(of,n)}const e2=P({relu6_:OD});/** 2656 * @license 2657 * Copyright 2018 Google LLC. All Rights Reserved. 2658 * Licensed under the Apache License, Version 2.0 (the "License"); 2659 * you may not use this file except in compliance with the License. 2660 * You may obtain a copy of the License at 2661 * 2662 * http://www.apache.org/licenses/LICENSE-2.0 2663 * 2664 * Unless required by applicable law or agreed to in writing, software 2665 * distributed under the License is distributed on an "AS IS" BASIS, 2666 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2667 * See the License for the specific language governing permissions and 2668 * limitations under the License. 2669 * ============================================================================= 2670 */function PD(t,e){const r={x:C(t,"x","reverse")},s={dims:e};return W.runKernel(cf,r,s)}const Va=P({reverse_:PD});/** 2671 * @license 2672 * Copyright 2020 Google LLC. All Rights Reserved. 2673 * Licensed under the Apache License, Version 2.0 (the "License"); 2674 * you may not use this file except in compliance with the License. 2675 * You may obtain a copy of the License at 2676 * 2677 * http://www.apache.org/licenses/LICENSE-2.0 2678 * 2679 * Unless required by applicable law or agreed to in writing, software 2680 * distributed under the License is distributed on an "AS IS" BASIS, 2681 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2682 * See the License for the specific language governing permissions and 2683 * limitations under the License. 2684 * ============================================================================= 2685 */function BD(t){const e=C(t,"x","reverse");return A(e.rank===1,()=>"Error in reverse1D: x must be rank 1 but got rank ".concat(e.rank,".")),Va(e,0)}const LD=P({reverse1d_:BD});/** 2686 * @license 2687 * Copyright 2020 Google LLC. All Rights Reserved. 2688 * Licensed under the Apache License, Version 2.0 (the "License"); 2689 * you may not use this file except in compliance with the License. 2690 * You may obtain a copy of the License at 2691 * 2692 * http://www.apache.org/licenses/LICENSE-2.0 2693 * 2694 * Unless required by applicable law or agreed to in writing, softw
2694are 2695 * distributed under the License is distributed on an "AS IS" BASIS, 2696 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2697 * See the License for the specific language governing permissions and 2698 * limitations under the License. 2699 * ============================================================================= 2700 */function WD(t,e){const n=C(t,"x","reverse");return A(n.rank===2,()=>"Error in reverse2D: x must be rank 2 but got rank ".concat(n.rank,".")),Va(n,e)}const zD=P({reverse2d_:WD});/** 2701 * @license 2702 * Copyright 2020 Google LLC. All Rights Reserved. 2703 * Licensed under the Apache License, Version 2.0 (the "License"); 2704 * you may not use this file except in compliance with the License. 2705 * You may obtain a copy of the License at 2706 * 2707 * http://www.apache.org/licenses/LICENSE-2.0 2708 * 2709 * Unless required by applicable law or agreed to in writing, software 2710 * distributed under the License is distributed on an "AS IS" BASIS, 2711 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2712 * See the License for the specific language governing permissions and 2713 * limitations under the License. 2714 * ============================================================================= 2715 */function HD(t,e){const n=C(t,"x","reverse");return A(n.rank===3,()=>"Error in reverse3D: x must be rank 3 but got rank ".concat(n.rank,".")),Va(n,e)}const UD=P({reverse3d_:HD});/** 2716 * @license 2717 * Copyright 2020 Google LLC. All Rights Reserved. 2718 * Licensed under the Apache License, Version 2.0 (the "License"); 2719 * you may not use this file except in compliance with the License. 2720 * You may obtain a copy of the License at 2721 * 2722 * http://www.apache.org/licenses/LICENSE-2.0 2723 * 2724 * Unless required by applicable law or agreed to in writing, software 2725 * distributed under the License is distributed on an "AS IS" BASIS, 2726 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2727 * See the License for the specific language governing permissions and 2728 * limitations under the License. 2729 * ============================================================================= 2730 */function VD(t,e){const n=C(t,"x","reverse");return A(n.rank===4,()=>"Error in reverse4D: x must be rank 4 but got rank ".concat(n.rank,".")),Va(n,e)}const jD=P({reverse4d_:VD});/** 2731 * @license 2732 * Copyright 2018 Google LLC. All Rights Reserved. 2733 * Licensed under the Apache License, Version 2.0 (the "License"); 2734 * you may not use this file except in compliance with the License. 2735 * You may obtain a copy of the License at 2736 * 2737 * http://www.apache.org/licenses/LICENSE-2.0 2738 * 2739 * Unless required by applicable law or agreed to in writing, software 2740 * distributed under the License is distributed on an "AS IS" BASIS, 2741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2742 * See the License for the specific language governing permissions and 2743 * limitations under the License. 2744 * ============================================================================= 2745 */function GD(t){const n={x:C(t,"x","round")};return W.runKernel(lf,n)}const t2=P({round_:GD});/** 2746 * @license 2747 * Copyright 2018 Google LLC. All Rights Reserved. 2748 * Licensed under the Apache License, Version 2.0 (the "License"); 2749 * you may not use this file except in compliance with the License. 2750 * You may obtain a copy of the License at 2751 * 2752 * http://www.apache.org/licenses/LICENSE-2.0 2753 * 2754 * Unless required by applicable law or agreed to in writing, software 2755 * distributed under the License is distributed on an "AS IS" BASIS, 2756 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2757 * See the License for the specific language governing permissions and 2758 * limitations under the License. 2759 * ============================================================================= 2760 */function qD(t){const n={x:C(t,"x","rsqrt","float32")};return W.runKernel(uf,n)}const KD=P({rsqrt_:qD});/** 2761 * @license 2762 * Copyright 2020 Google LLC. All Rights Reserved. 2763 * Licensed under the Apache License, Version 2.0 (the "License"); 2764 * you may not use this file except in compliance with the License. 2765 * You may obtain a copy of the License at 2766 * 2767 * http://www.apache.org/licenses/LICENSE-2.0 2768 * 2769 * Unless required by applicable law or agreed to in writing, softw
2769are 2770 * distributed under the License is distributed on an "AS IS" BASIS, 2771 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2772 * See the License for the specific language governing permissions and 2773 * limitations under the License. 2774 * ============================================================================= 2775 */function XD(t){const n={x:C(t,"x","selu")};return W.runKernel(hf,n)}const YD=P({selu_:XD});function JD(t,e,n,r,s,a=[1,1],o="NHWC"){const i=C(t,"x","separableConv2d"),l=C(e,"depthwiseFilter","separableConv2d"),u=C(n,"pointwiseFilter","separableConv2d");let c=i,d=!1;if(i.rank===3&&(d=!0,c=re(i,[1,i.shape[0],i.shape[1],i.shape[2]])),o==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");A(c.rank===4,()=>"Error in separableConv2d: input must be rank 4, but got "+"rank ".concat(c.rank,".")),A(l.rank===4,()=>"Error in separableConv2d: depthwise filter must be rank 4, but "+"got rank ".concat(l.rank,".")),A(u.rank===4,()=>"Error in separableConv2d: pointwise filter must be rank 4, but "+"got rank ".concat(l.rank,".")),A(u.shape[0]===1,()=>"Error in separableConv2d: the first dimension of pointwise filter "+" must be 1, but got ".concat(u.shape[0],".")),A(u.shape[1]===1,()=>"Error in separableConv2d: the second dimension of pointwise "+"filter must be 1, but got ".concat(u.shape[1],"."));const f=l.shape[2],p=l.shape[3];A(u.shape[2]===f*p,()=>"Error in separableConv2d: the third dimension of pointwise filter "+"must be ".concat(f*p,", ")+"but got ".concat(u.shape[2],"."));const h=mg(c,l,r,s,o,a),g=Mf(h,u,1,"valid",o);return d?re(g,[g.shape[1],g.shape[2],g.shape[3]]):g}const QD=P({separableConv2d_:JD});/** 2776 * @license 2777 * Copyright 2020 Google Inc. All Rights Reserved. 2778 * Licensed under the Apache License, Version 2.0 (the "License"); 2779 * you may not use this file except in compliance with the License. 2780 * You may obtain a copy of the License at 2781 * 2782 * http://www.apache.org/licenses/LICENSE-2.0 2783 * 2784 * Unless required by applicable law or agreed to in writing, software 2785 * distributed under the License is distributed on an "AS IS" BASIS, 2786 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2787 * See the License for the specific language governing permissions and 2788 * limitations under the License. 2789 * ============================================================================= 2790 */async function ZD(t,e){const n=C(t,"x","setdiff1d"),r=C(e,"y","setdiff1d");A(n.dtype===r.dtype,()=>"x and y should have the same dtype, but got x (".concat(n.dtype,") and y (").concat(r.dtype,").")),A(n.rank===1,()=>"x should be 1D tensor, but got x (".concat(n.shape,").")),A(r.rank===1,()=>"y should be 1D tensor, but got y (".concat(r.shape,")."));const s=await n.data(),a=await r.data(),o=new Set(a);let i=0;for(let c=0;c<s.length;c++)o.has(s[c])||i++;const l=new on([i],n.dtype),u=new on([i],"int32");for(let c=0,d=0;c<s.length;c++)o.has(s[c])||(l.values[d]=s[c],u.values[d]=c,d++);return[l.toTensor(),u.toTensor()]}const eF=ZD;/** 2791 * @license 2792 * Copyright 2018 Google LLC. All Rights Reserved. 2793 * Licensed under the Apache License, Version 2.0 (the "License"); 2794 * you may not use this file except in compliance with the License. 2795 * You may obtain a copy of the License at 2796 * 2797 * http://www.apache.org/licenses/LICENSE-2.0 2798 * 2799 * Unless required by applicable law or agreed to in writing, software 2800 * distributed under the License is distributed on an "AS IS" BASIS, 2801 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2802 * See the License for the specific language governing permissions and 2803 * limitations under the License. 2804 * ============================================================================= 2805 */function tF(t){const n={x:C(t,"x","sign")};return W.runKernel(yf,n)}const nF=P({sign_:tF});/** 2806 * @license 2807 * Copyright 2018 Google LLC. All Rights Reserved. 2808 * Licensed under the Apache License, Version 2.0 (the "License"); 2809 * you may not use this file except in compliance with the License. 2810 * You may obtain a copy of the License at 2811 * 2812 * http://www.apache.org/licenses/LICENSE-2.0 2813 * 2814 * Unless required by applicable law or agreed to in writing, softw
2814are 2815 * distributed under the License is distributed on an "AS IS" BASIS, 2816 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2817 * See the License for the specific language governing permissions and 2818 * limitations under the License. 2819 * ============================================================================= 2820 */function rF(t){const n={x:C(t,"x","sin","float32")};return W.runKernel(mf,n)}const sF=P({sin_:rF});/** 2821 * @license 2822 * Copyright 2018 Google LLC. All Rights Reserved. 2823 * Licensed under the Apache License, Version 2.0 (the "License"); 2824 * you may not use this file except in compliance with the License. 2825 * You may obtain a copy of the License at 2826 * 2827 * http://www.apache.org/licenses/LICENSE-2.0 2828 * 2829 * Unless required by applicable law or agreed to in writing, software 2830 * distributed under the License is distributed on an "AS IS" BASIS, 2831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2832 * See the License for the specific language governing permissions and 2833 * limitations under the License. 2834 * ============================================================================= 2835 */function aF(t){const n={x:C(t,"x","sinh")};return W.runKernel(gf,n)}const oF=P({sinh_:aF});/** 2836 * @license 2837 * Copyright 2018 Google LLC. All Rights Reserved. 2838 * Licensed under the Apache License, Version 2.0 (the "License"); 2839 * you may not use this file except in compliance with the License. 2840 * You may obtain a copy of the License at 2841 * 2842 * http://www.apache.org/licenses/LICENSE-2.0 2843 * 2844 * Unless required by applicable law or agreed to in writing, software 2845 * distributed under the License is distributed on an "AS IS" BASIS, 2846 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2847 * See the License for the specific language governing permissions and 2848 * limitations under the License. 2849 * ============================================================================= 2850 */function iF(t,e,n){const r=C(t,"x","slice1d");return A(r.rank===1,()=>"slice1d expects a rank-1 tensor, but got a rank-".concat(r.rank," tensor")),Ye(r,[e],[n])}const cF=P({slice1d_:iF});/** 2851 * @license 2852 * Copyright 2018 Google LLC. All Rights Reserved. 2853 * Licensed under the Apache License, Version 2.0 (the "License"); 2854 * you may not use this file except in compliance with the License. 2855 * You may obtain a copy of the License at 2856 * 2857 * http://www.apache.org/licenses/LICENSE-2.0 2858 * 2859 * Unless required by applicable law or agreed to in writing, software 2860 * distributed under the License is distributed on an "AS IS" BASIS, 2861 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2862 * See the License for the specific language governing permissions and 2863 * limitations under the License. 2864 * ============================================================================= 2865 */function lF(t,e,n){const r=C(t,"x","slice2d");return A(r.rank===2,()=>"slice2d expects a rank-2 tensor, but got a rank-".concat(r.rank," tensor")),Ye(r,e,n)}const uF=P({slice2d_:lF});/** 2866 * @license 2867 * Copyright 2018 Google LLC. All Rights Reserved. 2868 * Licensed under the Apache License, Version 2.0 (the "License"); 2869 * you may not use this file except in compliance with the License. 2870 * You may obtain a copy of the License at 2871 * 2872 * http://www.apache.org/licenses/LICENSE-2.0 2873 * 2874 * Unless required by applicable law or agreed to in writing, software 2875 * distributed under the License is distributed on an "AS IS" BASIS, 2876 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2877 * See the License for the specific language governing permissions and 2878 * limitations under the License. 2879 * ============================================================================= 2880 */function dF(t,e,n){const r=C(t,"x","slice3d");return A(r.rank===3,()=>"slice3d expects a rank-3 tensor, but got a rank-".concat(r.rank," tensor")),Ye(r,e,n)}const fF=P({slice3d_:dF});/** 2881 * @license 2882 * Copyright 2018 Google LLC. All Rights Reserved. 2883 * Licensed under the Apache License, Version 2.0 (the "License"); 2884 * you may not use this file except in compliance with the License. 2885 * You may obtain a copy of the License at 2886 * 2887 * http://www.apache.org/licenses/LICENSE-2.0 2888 * 2889 * Unless required by applicable law or agreed to in writing, softw
2889are 2890 * distributed under the License is distributed on an "AS IS" BASIS, 2891 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2892 * See the License for the specific language governing permissions and 2893 * limitations under the License. 2894 * ============================================================================= 2895 */function pF(t,e,n){const r=C(t,"x","slice4d");return A(r.rank===4,()=>"slice4d expects a rank-4 tensor, but got a rank-".concat(r.rank," tensor")),Ye(r,e,n)}const hF=P({slice4d_:pF});/** 2896 * @license 2897 * Copyright 2018 Google LLC. All Rights Reserved. 2898 * Licensed under the Apache License, Version 2.0 (the "License"); 2899 * you may not use this file except in compliance with the License. 2900 * You may obtain a copy of the License at 2901 * 2902 * http://www.apache.org/licenses/LICENSE-2.0 2903 * 2904 * Unless required by applicable law or agreed to in writing, software 2905 * distributed under the License is distributed on an "AS IS" BASIS, 2906 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2907 * See the License for the specific language governing permissions and 2908 * limitations under the License. 2909 * ============================================================================= 2910 */function mF(t,e=-1){const n=C(t,"logits","softmax","float32");if(e===-1&&(e=n.rank-1),e!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(n.rank," and dim was ").concat(e));const r={logits:n},s={dim:e};return W.runKernel(xf,r,s)}const gF=P({softmax_:mF});/** 2911 * @license 2912 * Copyright 2020 Google LLC. All Rights Reserved. 2913 * Licensed under the Apache License, Version 2.0 (the "License"); 2914 * you may not use this file except in compliance with the License. 2915 * You may obtain a copy of the License at 2916 * 2917 * http://www.apache.org/licenses/LICENSE-2.0 2918 * 2919 * Unless required by applicable law or agreed to in writing, software 2920 * distributed under the License is distributed on an "AS IS" BASIS, 2921 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2922 * See the License for the specific language governing permissions and 2923 * limitations under the License. 2924 * ============================================================================= 2925 */function yF(t){A(t.dtype==="complex64",()=>"The dtype for tf.spectral.fft() must be complex64 "+"but got ".concat(t.dtype,"."));const e={input:t};return W.runKernel(P1,e)}const Eg=P({fft_:yF});/** 2926 * @license 2927 * Copyright 2020 Google LLC. All Rights Reserved. 2928 * Licensed under the Apache License, Version 2.0 (the "License"); 2929 * you may not use this file except in compliance with the License. 2930 * You may obtain a copy of the License at 2931 * 2932 * http://www.apache.org/licenses/LICENSE-2.0 2933 * 2934 * Unless required by applicable law or agreed to in writing, software 2935 * distributed under the License is distributed on an "AS IS" BASIS, 2936 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2937 * See the License for the specific language governing permissions and 2938 * limitations under the License. 2939 * ============================================================================= 2940 */function vF(t){A(t.dtype==="complex64",()=>"The dtype for tf.spectral.ifft() must be complex64 "+"but got ".concat(t.dtype,"."));const e={input:t};return W.runKernel(B1,e)}const du=P({ifft_:vF});/** 2941 * @license 2942 * Copyright 2018 Google LLC. All Rights Reserved. 2943 * Licensed under the Apache License, Version 2.0 (the "License"); 2944 * you may not use this file except in compliance with the License. 2945 * You may obtain a copy of the License at 2946 * 2947 * http://www.apache.org/licenses/LICENSE-2.0 2948 * 2949 * Unless required by applicable law or agreed to in writing, software 2950 * distributed under the License is distributed on an "AS IS" BASIS, 2951 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2952 * See the License for the specific language governing permissions and 2953 * limitations under the License. 2954 * ============================================================================= 2955 */function bF(t){const e=t.shape[t.shape.length-1],n=t.size/e;let r;if(e<=2){const s=re(t,[n,e]);r=du(s)}else{const s=[n,2*(e-1)],a=re(Ec(t),[n,e]),o=re(Lf(t),[n,e]),i=Va(Ye(a,[0,1],[n,e-2]),1),l=he(Va(Ye(o,[0,1],[n,e-2]),1),ot(-1)),u=mn([a,i],1),c=mn([o,l],1),d=re(Zs(u,c),[s[0],s[1]]);r=du(d)}if(r=Ec(r),t.rank===3&&t.shape[0]!==0){const s=r,a=t.shape[0];r=re(r,[a,r.shape[0]/a,r.shape[1]]),s.dispose()}return r}const n2=P({irfft_:bF});/** 2956 * @license 2957 * Copyright 2020 Google LLC. All Rights Reserved. 2958 * Licensed under the Apache License, Version 2.0 (the "License");
2959 * you may not use this file except in compliance with the License. 2960 * You may obtain a copy of the License at 2961 * 2962 * http://www.apache.org/licenses/LICENSE-2.0 2963 * 2964 * Unless required by applicable law or agreed to in writing, software 2965 * distributed under the License is distributed on an "AS IS" BASIS, 2966 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2967 * See the License for the specific language governing permissions and 2968 * limitations under the License. 2969 * ============================================================================= 2970 */function wF(t,e,n=0){const s={x:C(t,"x","split")},a={numOrSizeSplits:e,axis:n};return W.runKernel(eg,s,a)}const Tc=P({split_:wF});/** 2971 * @license 2972 * Copyright 2018 Google LLC. All Rights Reserved. 2973 * Licensed under the Apache License, Version 2.0 (the "License"); 2974 * you may not use this file except in compliance with the License. 2975 * You may obtain a copy of the License at 2976 * 2977 * http://www.apache.org/licenses/LICENSE-2.0 2978 * 2979 * Unless required by applicable law or agreed to in writing, software 2980 * distributed under the License is distributed on an "AS IS" BASIS, 2981 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2982 * See the License for the specific language governing permissions and 2983 * limitations under the License. 2984 * ============================================================================= 2985 */function SF(t,e){A(t.dtype==="float32",()=>"The dtype for rfft() must be real value but got ".concat(t.dtype));let n=t.shape[t.shape.length-1];const r=t.size/n;let s;if(e!=null&&e<n){const h=t.shape.map(g=>0),m=t.shape.map(g=>g);m[t.shape.length-1]=e,s=Ye(t,h,m),n=e}else if(e!=null&&e>n){const h=t.shape.map(m=>m);h[t.shape.length-1]=e-n,s=mn([t,Jo(h)],t.shape.length-1),n=e}else s=t;const a=lr(s),o=re(Zs(s,a),[r,n]),i=Eg(o),l=Math.floor(n/2)+1,u=Ec(i),c=Lf(i),d=Tc(u,[l,n-l],u.shape.length-1),f=Tc(c,[l,n-l],c.shape.length-1),p=s.shape.slice();return p[s.shape.length-1]=l,re(Zs(d[0],f[0]),p)}const Tg=P({rfft_:SF});/** 2986 * @license 2987 * Copyright 2020 Google LLC. All Rights Reserved. 2988 * Licensed under the Apache License, Version 2.0 (the "License"); 2989 * you may not use this file except in compliance with the License. 2990 * You may obtain a copy of the License at 2991 * 2992 * http://www.apache.org/licenses/LICENSE-2.0 2993 * 2994 * Unless required by applicable law or agreed to in writing, software 2995 * distributed under the License is distributed on an "AS IS" BASIS, 2996 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2997 * See the License for the specific language governing permissions and 2998 * limitations under the License. 2999 * ============================================================================= 3000 */function xF(t,e){let n=C(t,"a","squaredDifference"),r=C(e,"b","squaredDifference");[n,r]=Xt(n,r),Rt(n.shape,r.shape);const s={a:n,b:r},a={};return W.runKernel(kf,s,a)}const r2=P({squaredDifference_:xF});/** 3001 * @license 3002 * Copyright 2020 Google LLC. All Rights Reserved. 3003 * Licensed under the Apache License, Version 2.0 (the "License"); 3004 * you may not use this file except in compliance with the License. 3005 * You may obtain a copy of the License at 3006 * 3007 * http://www.apache.org/licenses/LICENSE-2.0 3008 * 3009 * Unless required by applicable law or agreed to in writing, software 3010 * distributed under the License is distributed on an "AS IS" BASIS, 3011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3012 * See the License for the specific language governing permissions and 3013 * limitations under the License. 3014 * ============================================================================= 3015 */function _F(t,e){const n=C(t,"x","squeeze","string_or_numeric");return re(n,BC(n.shape,e).newShape)}const pn=P({squeeze_:_F});/** 3016 * @license 3017 * Copyright 2020 Google LLC. All Rights Reserved. 3018 * Licensed under the Apache License, Version 2.0 (the "License"); 3019 * you may not use this file except in compliance with the License. 3020 * You may obtain a copy of the License at 3021 * 3022 * http://www.apache.org/licenses/LICENSE-2.0 3023 * 3024 * Unless required by applicable law or agreed to in writing, softw
3024are 3025 * distributed under the License is distributed on an "AS IS" BASIS, 3026 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3027 * See the License for the specific language governing permissions and 3028 * limitations under the License. 3029 * ============================================================================= 3030 */function IF(t,e=0){const n=su(t,"tensors","stack","string_or_numeric");A(n.length>=1,()=>"Pass at least one tensor to tf.stack"),n.length>0&&A(e<=n[0].rank,()=>"Axis must be <= rank of the tensor");const r=n,s={axis:e};return W.runKernel(Gm,r,s)}const _s=P({stack_:IF});/** 3031 * @license 3032 * Copyright 2018 Google LLC. All Rights Reserved. 3033 * Licensed under the Apache License, Version 2.0 (the "License"); 3034 * you may not use this file except in compliance with the License. 3035 * You may obtain a copy of the License at 3036 * 3037 * http://www.apache.org/licenses/LICENSE-2.0 3038 * 3039 * Unless required by applicable law or agreed to in writing, software 3040 * distributed under the License is distributed on an "AS IS" BASIS, 3041 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3042 * See the License for the specific language governing permissions and 3043 * limitations under the License. 3044 * ============================================================================= 3045 */function kF(t,e=0){const r={x:C(t,"x","step")},s={alpha:e};return W.runKernel(zc,r,s)}const s2=P({step_:kF});/** 3046 * @license 3047 * Copyright 2018 Google LLC. All Rights Reserved. 3048 * Licensed under the Apache License, Version 2.0 (the "License"); 3049 * you may not use this file except in compliance with the License. 3050 * You may obtain a copy of the License at 3051 * 3052 * http://www.apache.org/licenses/LICENSE-2.0 3053 * 3054 * Unless required by applicable law or agreed to in writing, software 3055 * distributed under the License is distributed on an "AS IS" BASIS, 3056 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3057 * See the License for the specific language governing permissions and 3058 * limitations under the License. 3059 * ============================================================================= 3060 */function EF(t,e,n,r,s=0,a=0,o=0,i=0,l=0){const c={x:C(t,"x","stridedSlice","string_or_numeric")},d={begin:e,end:n,strides:r,beginMask:s,endMask:a,ellipsisMask:o,newAxisMask:i,shrinkAxisMask:l};return W.runKernel(Ef,c,d)}const TF=P({stridedSlice_:EF});/** 3061 * @license 3062 * Copyright 2018 Google LLC. All Rights Reserved. 3063 * Licensed under the Apache License, Version 2.0 (the "License"); 3064 * you may not use this file except in compliance with the License. 3065 * You may obtain a copy of the License at 3066 * 3067 * http://www.apache.org/licenses/LICENSE-2.0 3068 * 3069 * Unless required by applicable law or agreed to in writing, software 3070 * distributed under the License is distributed on an "AS IS" BASIS, 3071 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3072 * See the License for the specific language governing permissions and 3073 * limitations under the License. 3074 * ============================================================================= 3075 */function CF(t){const n={x:C(t,"x","tan","float32")};return W.runKernel(Cf,n)}const NF=P({tan_:CF});/** 3076 * @license 3077 * Copyright 2018 Google LLC. All Rights Reserved. 3078 * Licensed under the Apache License, Version 2.0 (the "License"); 3079 * you may not use this file except in compliance with the License. 3080 * You may obtain a copy of the License at 3081 * 3082 * http://www.apache.org/licenses/LICENSE-2.0 3083 * 3084 * Unless required by applicable law or agreed to in writing, software 3085 * distributed under the License is distributed on an "AS IS" BASIS, 3086 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3087 * See the License for the specific language governing permissions and 3088 * limitations under the License. 3089 * ============================================================================= 3090 */function Sn(t,e){oi(t);const n=aa(t,e);if(n.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return oa(t,null,n,e)}/** 3091 * @license 3092 * Copyright 2018 Google LLC. All Rights Reserved. 3093 * Licensed under the Apache License, Version 2.0 (the "License");
3094 * you may not use this file except in compliance with the License. 3095 * You may obtain a copy of the License at 3096 * 3097 * http://www.apache.org/licenses/LICENSE-2.0 3098 * 3099 * Unless required by applicable law or agreed to in writing, software 3100 * distributed under the License is distributed on an "AS IS" BASIS, 3101 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3102 * See the License for the specific language governing permissions and 3103 * limitations under the License. 3104 * ============================================================================= 3105 */function La(t,e,n){if(oi(t),e!=null&&e.length!==2)throw new Error("tensor2d() requires shape to have two numbers");const r=aa(t,n);if(r.length!==2&&r.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return oa(t,e,r,n)}/** 3106 * @license 3107 * Copyright 2018 Google LLC. All Rights Reserved. 3108 * Licensed under the Apache License, Version 2.0 (the "License"); 3109 * you may not use this file except in compliance with the License. 3110 * You may obtain a copy of the License at 3111 * 3112 * http://www.apache.org/licenses/LICENSE-2.0 3113 * 3114 * Unless required by applicable law or agreed to in writing, software 3115 * distributed under the License is distributed on an "AS IS" BASIS, 3116 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3117 * See the License for the specific language governing permissions and 3118 * limitations under the License. 3119 * ============================================================================= 3120 */function a2(t,e,n){if(oi(t),e!=null&&e.length!==3)throw new Error("tensor3d() requires shape to have three numbers");const r=aa(t,n);if(r.length!==3&&r.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return oa(t,e,r,n)}/** 3121 * @license 3122 * Copyright 2018 Google LLC. All Rights Reserved. 3123 * Licensed under the Apache License, Version 2.0 (the "License"); 3124 * you may not use this file except in compliance with the License. 3125 * You may obtain a copy of the License at 3126 * 3127 * http://www.apache.org/licenses/LICENSE-2.0 3128 * 3129 * Unless required by applicable law or agreed to in writing, software 3130 * distributed under the License is distributed on an "AS IS" BASIS, 3131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3132 * See the License for the specific language governing permissions and 3133 * limitations under the License. 3134 * ============================================================================= 3135 */function AF(t,e,n){if(oi(t),e!=null&&e.length!==4)throw new Error("tensor4d() requires shape to have four numbers");const r=aa(t,n);if(r.length!==4&&r.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return oa(t,e,r,n)}/** 3136 * @license 3137 * Copyright 2018 Google LLC. All Rights Reserved. 3138 * Licensed under the Apache License, Version 2.0 (the "License"); 3139 * you may not use this file except in compliance with the License. 3140 * You may obtain a copy of the License at 3141 * 3142 * http://www.apache.org/licenses/LICENSE-2.0 3143 * 3144 * Unless required by applicable law or agreed to in writing, software 3145 * distributed under the License is distributed on an "AS IS" BASIS, 3146 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3147 * See the License for the specific language governing permissions and 3148 * limitations under the License. 3149 * ============================================================================= 3150 */function $F(t,e,n){if(oi(t),e!=null&&e.length!==5)throw new Error("tensor5d() requires shape to have five numbers");const r=aa(t,n);if(r.length!==5&&r.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return oa(t,e,r,n)}/** 3151 * @license 3152 * Copyright 2018 Google LLC. All Rights Reserved. 3153 * Licensed under the Apache License, Version 2.0 (the "License");
3154 * you may not use this file except in compliance with the License. 3155 * You may obtain a copy of the License at 3156 * 3157 * http://www.apache.org/licenses/LICENSE-2.0 3158 * 3159 * Unless required by applicable law or agreed to in writing, software 3160 * distributed under the License is distributed on an "AS IS" BASIS, 3161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3162 * See the License for the specific language governing permissions and 3163 * limitations under the License. 3164 * ============================================================================= 3165 */function RF(t,e,n){if(oi(t),e!=null&&e.length!==6)throw new Error("tensor6d() requires shape to have six numbers");const r=aa(t,n);if(r.length!==6&&r.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(r.length===1&&e==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return e=e||r,oa(t,e,r,n)}function DF(t,e,n){const r=e.rank>1?e.shape[e.rank-1]:1,s=e.rank>1?e.rank-1:1,a="Must have updates.shape = indices.shape[:batchDim] + "+"shape[sliceDim:], got updates.shape: ".concat(n.shape)+", indices.shape: ".concat(e.shape,", shape: ").concat(t)+", sliceDim: ".concat(r,", and batchDim: ").concat(s,".");if(n.rank<s)throw new Error(a+" update.rank < ".concat(s,". "));if(t.length<r+(n.rank-s))throw new Error(a+" Output shape length < ".concat(r+(n.rank-s)));if(n.rank!==s+t.length-r)throw new Error(a+" update.rank != ".concat(s+t.length-r));for(let o=0;o<s;++o)if(n.shape[o]!==e.shape[o])throw new Error(a+" updates.shape[".concat(o,"] (").concat(n.shape[o],") != indices.shape[").concat(o,"] (").concat(e.shape[o],")."));for(let o=0;o<n.rank-s;++o)if(n.shape[o+s]!==t[o+r])throw new Error(a+" updates.shape[".concat(o+s,"] (").concat(n.shape[o+s],") != shape[").concat(o+s,"] (").concat(t[o+s],")"))}function o2(t,e,n){if(e.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(e.rank,"."));if(t.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher,"+" but the rank was ".concat(t.rank,"."));if(e.dtype!=="int32")throw new Error("The dtype of 'indices' should be int32, but got dtype: ".concat(e.dtype));if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: ".concat(n));if(n.length===0){if(e.size===0)throw new Error("Indices specified for empty output. indices shape: ".concat(e.shape));if(t.size===0)throw new Error("Updates specified for empty output. updates shape: ".concat(t.shape))}DF(n,e,t)}function di(t,e,n){const r=e.shape.length,s=r>1?e.shape[r-1]:1,a=n.length;let o=1;for(let d=s;d<a;++d)o*=n[d];const i=s<1?1:s,l=J(e.shape)/i,u=[...Ie(n.slice(0,s)),1],c=J(n);return{sliceRank:s,numUpdates:l,sliceSize:o,strides:u,outputSize:c}}/** 3166 * @license 3167 * Copyright 2022 Google LLC. All Rights Reserved. 3168 * Licensed under the Apache License, Version 2.0 (the "License"); 3169 * you may not use this file except in compliance with the License. 3170 * You may obtain a copy of the License at 3171 * 3172 * http://www.apache.org/licenses/LICENSE-2.0 3173 * 3174 * Unless required by applicable law or agreed to in writing, software 3175 * distributed under the License is distributed on an "AS IS" BASIS, 3176 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3177 * See the License for the specific language governing permissions and 3178 * limitations under the License. 3179 * ============================================================================= 3180 */function FF(t,e,n){const r=C(t,"tensor","tensorScatterupdate"),s=C(e,"indices","tensorScatterupdate","int32"),a=C(n,"updates","tensorScatterupdate");if(o2(a,s,r.shape),r.dtype!==a.dtype)throw new Error("tensor and updates must have the same dtype, instead they are ".concat(r.dtype," and ").concat(a.dtype,"."));const o={tensor:r,indices:s,updates:a},i={};return W.runKernel(ff,o,i)}const MF=P({tensorScatterUpdate_:FF});/** 3181 * @license 3182 * Copyright 2018 Google LLC. All Rights Reserved. 3183 * Licensed under the Apache License, Version 2.0 (the "License");
3184 * you may not use this file except in compliance with the License. 3185 * You may obtain a copy of the License at 3186 * 3187 * http://www.apache.org/licenses/LICENSE-2.0 3188 * 3189 * Unless required by applicable law or agreed to in writing, software 3190 * distributed under the License is distributed on an "AS IS" BASIS, 3191 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3192 * See the License for the specific language governing permissions and 3193 * limitations under the License. 3194 * ============================================================================= 3195 */function OF(t,e=1,n=!0){const r=C(t,"x","topk");if(r.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");const s=r.shape[r.shape.length-1];if(e<0)throw new Error("'k' passed to topk() must be >= 0 but got ".concat(e));if(e>s)throw new Error("'k' passed to topk() must be <= the last dimension (".concat(s,") ")+"but got ".concat(e));const a={x:r},o={k:e,sorted:n},[i,l]=W.runKernel(Af,a,o);return{values:i,indices:l}}const PF=P({topk_:OF});/** 3196 * @license 3197 * Copyright 2020 Google LLC. All Rights Reserved. 3198 * Licensed under the Apache License, Version 2.0 (the "License"); 3199 * you may not use this file except in compliance with the License. 3200 * You may obtain a copy of the License at 3201 * 3202 * http://www.apache.org/licenses/LICENSE-2.0 3203 * 3204 * Unless required by applicable law or agreed to in writing, software 3205 * distributed under the License is distributed on an "AS IS" BASIS, 3206 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3207 * See the License for the specific language governing permissions and 3208 * limitations under the License. 3209 * ============================================================================= 3210 */function BF(t,e=0,n=1,r,s){if(dr(t),r!=null&&r==="bool")throw new Error("Unsupported data type $ { dtype }");const a=new Ig(e,n,r,!0,s),o=rt(t,r);for(let i=0;i<o.values.length;i++)o.values[i]=a.nextValue();return o.toTensor()}const LF=P({truncatedNormal_:BF});/** 3211 * @license 3212 * Copyright 2020 Google LLC. All Rights Reserved. 3213 * Licensed under the Apache License, Version 2.0 (the "License"); 3214 * you may not use this file except in compliance with the License. 3215 * You may obtain a copy of the License at 3216 * 3217 * http://www.apache.org/licenses/LICENSE-2.0 3218 * 3219 * Unless required by applicable law or agreed to in writing, software 3220 * distributed under the License is distributed on an "AS IS" BASIS, 3221 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3222 * See the License for the specific language governing permissions and 3223 * limitations under the License. 3224 * ============================================================================= 3225 */function WF(t,e=0){const n=C(t,"x","unique","string_or_numeric");A(n.rank>0,()=>"The input tensor must be at least 1D");const r={x:n},s={axis:e},[a,o]=W.runKernel(cg,r,s);return{values:a,indices:o}}const zF=P({unique_:WF});/** 3226 * @license 3227 * Copyright 2020 Google LLC. All Rights Reserved. 3228 * Licensed under the Apache License, Version 2.0 (the "License"); 3229 * you may not use this file except in compliance with the License. 3230 * You may obtain a copy of the License at 3231 * 3232 * http://www.apache.org/licenses/LICENSE-2.0 3233 * 3234 * Unless required by applicable law or agreed to in writing, software 3235 * distributed under the License is distributed on an "AS IS" BASIS, 3236 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3237 * See the License for the specific language governing permissions and 3238 * limitations under the License. 3239 * ============================================================================= 3240 */function HF(t,e,n){const r=C(t,"x","unsortedSegmentSum"),s=C(e,"segmentIds","unsortedSegmentSum","int32");A(hc(n),()=>"numSegments must be of dtype int");const a={x:r,segmentIds:s},o={numSegments:n};return W.runKernel(q1,a,o)}const UF=P({unsortedSegmentSum_:HF});/** 3241 * @license 3242 * Copyright 2020 Google LLC. All Rights Reserved. 3243 * Licensed under the Apache License, Version 2.0 (the "License"); 3244 * you may not use this file except in compliance with the License. 3245 * You may obtain a copy of the License at 3246 * 3247 * http://www.apache.org/licenses/LICENSE-2.0 3248 * 3249 * Unless required by applicable law or agreed to in writing, softw
3249are 3250 * distributed under the License is distributed on an "AS IS" BASIS, 3251 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3252 * See the License for the specific language governing permissions and 3253 * limitations under the License. 3254 * ============================================================================= 3255 */function VF(t,e=0){const n=C(t,"x","unstack","string_or_numeric");A(e>=-n.shape.length&&e<n.shape.length,()=>"Axis = ".concat(e," is not in [-").concat(n.shape.length,", ").concat(n.shape.length,")"));const r={value:n},s={axis:e};return W.runKernel(lg,r,s)}const so=P({unstack_:VF});/** 3256 * @license 3257 * Copyright 2022 Google LLC. All Rights Reserved. 3258 * Licensed under the Apache License, Version 2.0 (the "License"); 3259 * you may not use this file except in compliance with the License. 3260 * You may obtain a copy of the License at 3261 * 3262 * http://www.apache.org/licenses/LICENSE-2.0 3263 * 3264 * Unless required by applicable law or agreed to in writing, software 3265 * distributed under the License is distributed on an "AS IS" BASIS, 3266 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3267 * See the License for the specific language governing permissions and 3268 * limitations under the License. 3269 * ============================================================================= 3270 */function jF(t,e){return yg(t,e,"right")}/** 3271 * @license 3272 * Copyright 2018 Google LLC. All Rights Reserved. 3273 * Licensed under the Apache License, Version 2.0 (the "License"); 3274 * you may not use this file except in compliance with the License. 3275 * You may obtain a copy of the License at 3276 * 3277 * http://www.apache.org/licenses/LICENSE-2.0 3278 * 3279 * Unless required by applicable law or agreed to in writing, software 3280 * distributed under the License is distributed on an "AS IS" BASIS, 3281 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3282 * See the License for the specific language governing permissions and 3283 * limitations under the License. 3284 * ============================================================================= 3285 */function GF(t,e=!0,n,r){return W.makeVariable(t,e,n,r)}/** 3286 * @license 3287 * Copyright 2018 Google LLC. All Rights Reserved. 3288 * Licensed under the Apache License, Version 2.0 (the "License"); 3289 * you may not use this file except in compliance with the License. 3290 * You may obtain a copy of the License at 3291 * 3292 * http://www.apache.org/licenses/LICENSE-2.0 3293 * 3294 * Unless required by applicable law or agreed to in writing, software 3295 * distributed under the License is distributed on an "AS IS" BASIS, 3296 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3297 * See the License for the specific language governing permissions and 3298 * limitations under the License. 3299 * ============================================================================= 3300 */function i2(t,e){const n=[];for(let a=0;a<e.length;a++)e[a]&&n.push(a);const r=rt(t,"int32"),s=rt([n.length,t.length],"int32");for(let a=0;a<n.length;a++){const o=r.indexToLoc(n[a]),i=a*t.length;s.values.set(o,i)}return s.toTensor()}/** 3301 * @license 3302 * Copyright 2020 Google LLC. All Rights Reserved. 3303 * Licensed under the Apache License, Version 2.0 (the "License"); 3304 * you may not use this file except in compliance with the License. 3305 * You may obtain a copy of the License at 3306 * 3307 * http://www.apache.org/licenses/LICENSE-2.0 3308 * 3309 * Unless required by applicable law or agreed to in writing, software 3310 * distributed under the License is distributed on an "AS IS" BASIS, 3311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3312 * See the License for the specific language governing permissions and 3313 * limitations under the License. 3314 * ============================================================================= 3315 */async function qF(t){const e=C(t,"condition","whereAsync","bool"),n=await e.data(),r=i2(e.shape,n);return t!==e&&e.dispose(),r}const c2=qF;/** 3316 * @license 3317 * Copyright 2018 Google LLC. All Rights Reserved. 3318 * Licensed under the Apache License, Version 2.0 (the "License"); 3319 * you may not use this file except in compliance with the License. 3320 * You may obtain a copy of the License at 3321 * 3322 * http://www.apache.org/licenses/LICENSE-2.0 3323 * 3324 * Unless required by applicable law or agreed to in writing, softw
3324are 3325 * distributed under the License is distributed on an "AS IS" BASIS, 3326 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3327 * See the License for the specific language governing permissions and 3328 * limitations under the License. 3329 * ============================================================================= 3330 */async function KF(t,e,n){const r=C(t,"tensor","boolMask"),s=C(e,"mask","boolMask","bool"),a=n==null?0:n,o=s.rank,i=r.shape;A(o>0,()=>"mask cannot be scalar"),tr(i.slice(a,a+o),s.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let m=a;m<a+o;m++)l*=i[m];const u=i.slice(0,a).concat([l],i.slice(a+o)),c=re(r,u),d=re(s,[-1]),f=await c2(d),p=pn(f,[1]),h=Lw(c,p,a);return t!==r&&r.dispose(),e!==s&&s.dispose(),p.dispose(),c.dispose(),d.dispose(),f.dispose(),h}const XF=KF;/** 3331 * @license 3332 * Copyright 2018 Google LLC. All Rights Reserved. 3333 * Licensed under the Apache License, Version 2.0 (the "License"); 3334 * you may not use this file except in compliance with the License. 3335 * You may obtain a copy of the License at 3336 * 3337 * http://www.apache.org/licenses/LICENSE-2.0 3338 * 3339 * Unless required by applicable law or agreed to in writing, software 3340 * distributed under the License is distributed on an "AS IS" BASIS, 3341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3342 * See the License for the specific language governing permissions and 3343 * limitations under the License. 3344 * ============================================================================= 3345 */function YF(t,e,n){const r=C(t,"x","transpose");if(e==null&&(e=r.shape.map((o,i)=>i).reverse()),A(r.rank===e.length,()=>"Error in transpose: rank of input ".concat(r.rank," ")+"must match length of perm ".concat(e,".")),e.forEach(o=>{A(o>=0&&o<r.rank,()=>"All entries in 'perm' must be between 0 and ".concat(r.rank-1)+" but got ".concat(e))}),r.rank<=1)return r.clone();const s={x:r},a={perm:e};return r.dtype==="complex64"?nt(()=>{let o=Ec(r),i=Lf(r);return o=W.runKernel(Lo,{x:o},a),i=W.runKernel(Lo,{x:i},a),n&&(i=ns(i)),Zs(o,i)}):W.runKernel(Lo,s,a)}const Nh=P({transpose_:YF});/** 3346 * @license 3347 * Copyright 2018 Google LLC. All Rights Reserved. 3348 * Licensed under the Apache License, Version 2.0 (the "License"); 3349 * you may not use this file except in compliance with the License. 3350 * You may obtain a copy of the License at 3351 * 3352 * http://www.apache.org/licenses/LICENSE-2.0 3353 * 3354 * Unless required by applicable law or agreed to in writing, software 3355 * distributed under the License is distributed on an "AS IS" BASIS, 3356 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3357 * See the License for the specific language governing permissions and 3358 * limitations under the License. 3359 * ============================================================================= 3360 */function JF(t,e,n,r,s=!0){const a=C(t,"v","movingAverage"),o=C(e,"x","movingAverage"),i=C(n,"decay","movingAverage");wN(a,o),A(Ir(a.shape,o.shape),()=>"Shape mismatch in v and x");const l=ot(1),u=Je(l,i);let c=he(Je(o,a),u);if(s){A(r!=null,()=>"When using zeroDebias: true, step is required.");const d=C(r,"step","movingAverage");c=tt(c,Je(l,_c(i,d)))}return Fe(a,c)}const QF=P({movingAverage_:JF});/** 3361 * @license 3362 * Copyright 2018 Google LLC. All Rights Reserved. 3363 * Licensed under the Apache License, Version 2.0 (the "License"); 3364 * you may not use this file except in compliance with the License. 3365 * You may obtain a copy of the License at 3366 * 3367 * http://www.apache.org/licenses/LICENSE-2.0 3368 * 3369 * Unless required by applicable law or agreed to in writing, software 3370 * distributed under the License is distributed on an "AS IS" BASIS, 3371 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3372 * See the License for the specific language governing permissions and 3373 * limitations under the License. 3374 * ============================================================================= 3375 */function ZF(t,e,n){dr(n);const r=C(t,"indices","scatterND","int32"),s=C(e,"updates","scatterND");o2(s,r,n);const a={indices:r,updates:s},o={shape:n};return W.runKernel(df,a,o)}const eM=P({scatterND_:ZF});function tM(t,e,n,r){if(t.dtype!=="int32")throw new Error("tf.sparseToDense() expects the indices to be int32 type,"+" but the dtype was ".concat(t.dtype,"."));if(t.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix,"+" but got shape ".concat(t.shape,"."));const s=t.rank>0?t.shape[0]:1,a=t.rank>1?t.shape[1]:1;if(n.length!==a)throw new Error("outputShape has incorrect number of elements:,"+" ".concat(n.length,", should be: ").concat(a,"."));const o=e.size;if(!(e.rank===0||e.rank===1&&o===s))throw new Error("sparseValues has incorrect shape "+"".concat(e.shape,", should be [] or [").concat(s,"]"));if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}/** 3376 * @license 3377 * Copyright 2018 Google LLC. All Rights Reserved. 3378 * Licensed under the Apache License, Version 2.0 (the "License");
3379 * you may not use this file except in compliance with the License. 3380 * You may obtain a copy of the License at 3381 * 3382 * http://www.apache.org/licenses/LICENSE-2.0 3383 * 3384 * Unless required by applicable law or agreed to in writing, software 3385 * distributed under the License is distributed on an "AS IS" BASIS, 3386 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3387 * See the License for the specific language governing permissions and 3388 * limitations under the License. 3389 * ============================================================================= 3390 */function nM(t,e,n,r=0){dr(n);const s=C(t,"sparseIndices","sparseToDense","int32"),a=C(e,"sparseValues","sparseToDense","string_or_numeric"),o=C(r,"defaultValue","sparseToDense",a.dtype);tM(s,a,n,o);const i={sparseIndices:s,sparseValues:a,defaultValue:o},l={outputShape:n};return W.runKernel(If,i,l)}const rM=P({sparseToDense_:nM});/** 3391 * @license 3392 * Copyright 2018 Google LLC. All Rights Reserved. 3393 * Licensed under the Apache License, Version 2.0 (the "License"); 3394 * you may not use this file except in compliance with the License. 3395 * You may obtain a copy of the License at 3396 * 3397 * http://www.apache.org/licenses/LICENSE-2.0 3398 * 3399 * Unless required by applicable law or agreed to in writing, software 3400 * distributed under the License is distributed on an "AS IS" BASIS, 3401 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3402 * See the License for the specific language governing permissions and 3403 * limitations under the License. 3404 * ============================================================================= 3405 */function sM(t,e){const n=C(e,"indices","gatherND","int32"),s={params:C(t,"x","gatherND","string_or_numeric"),indices:n};return W.runKernel(wd,s)}const aM=P({gatherND_:sM});/** 3406 * @license 3407 * Copyright 2019 Google LLC. All Rights Reserved. 3408 * Licensed under the Apache License, Version 2.0 (the "License"); 3409 * you may not use this file except in compliance with the License. 3410 * You may obtain a copy of the License at 3411 * 3412 * http://www.apache.org/licenses/LICENSE-2.0 3413 * 3414 * Unless required by applicable law or agreed to in writing, software 3415 * distributed under the License is distributed on an "AS IS" BASIS, 3416 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3417 * See the License for the specific language governing permissions and 3418 * limitations under the License. 3419 * ============================================================================= 3420 */function oM(t,e){if(e==null)return t.shape.slice();if(Ir(t.shape,e))return e;if(t.shape.length===e.length){const n=[];for(let r=0;r<t.shape.length;r++)e[r]==null&&t.shape[r]!=null?n.push(t.shape[r]):n.push(e[r]);return n}return e}/** 3421 * @license 3422 * Copyright 2018 Google LLC. All Rights Reserved. 3423 * Licensed under the Apache License, Version 2.0 (the "License"); 3424 * you may not use this file except in compliance with the License. 3425 * You may obtain a copy of the License at 3426 * 3427 * http://www.apache.org/licenses/LICENSE-2.0 3428 * 3429 * Unless required by applicable law or agreed to in writing, software 3430 * distributed under the License is distributed on an "AS IS" BASIS, 3431 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3432 * See the License for the specific language governing permissions and 3433 * limitations under the License. 3434 * ============================================================================= 3435 */function iM(t,e,n,r){const s=C(t,"x","dropout");if(A(s.dtype==="float32",()=>"x has to be a floating point tensor since it's going to be "+"scaled, but got a ".concat(s.dtype," tensor instead.")),A(e>=0&&e<1,()=>"rate must be a float in the range [0, 1), but got ".concat(e,".")),e===0)return t instanceof Zt?s.clone():s;const a=oM(s,n),o=1-e,i=tt(Bw(Fe(kg(a,0,1,"float32",r),o)),o);return he(s,i)}const cM=P({dropout_:iM});/** 3436 * @license 3437 * Copyright 2019 Google LLC. All Rights Reserved. 3438 * Licensed under the Apache License, Version 2.0 (the "License"); 3439 * you may not use this file except in compliance with the License. 3440 * You may obtain a copy of the License at 3441 * 3442 * http://www.apache.org/licenses/LICENSE-2.0 3443 * 3444 * Unless required by applicable law or agreed to in writing, softw
3444are 3445 * distributed under the License is distributed on an "AS IS" BASIS, 3446 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3447 * See the License for the specific language governing permissions and 3448 * limitations under the License. 3449 * ============================================================================= 3450 */function l2(t){return Math.floor(Math.pow(2,Math.ceil(Math.log(t)/Math.log(2))))}function Cg(t,e,n){const r=1-t%2,s=new Float32Array(t);for(let a=0;a<t;++a){const o=2*Math.PI*a/(t+r-1);s[a]=e-n*Math.cos(o)}return Sn(s,"float32")}/** 3451 * @license 3452 * Copyright 2019 Google LLC. All Rights Reserved. 3453 * Licensed under the Apache License, Version 2.0 (the "License"); 3454 * you may not use this file except in compliance with the License. 3455 * You may obtain a copy of the License at 3456 * 3457 * http://www.apache.org/licenses/LICENSE-2.0 3458 * 3459 * Unless required by applicable law or agreed to in writing, software 3460 * distributed under the License is distributed on an "AS IS" BASIS, 3461 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3462 * See the License for the specific language governing permissions and 3463 * limitations under the License. 3464 * ============================================================================= 3465 */async function lM(t,e,n=1){const r=C(t,"predictions","inTopK"),s=C(e,"targets","inTopK");A(r.rank>1,()=>"inTopK() expects the predictions to be of rank 2 or higher, "+"but got ".concat(r.rank)),A(r.rank-1===s.rank,()=>"predictions rank should be 1 larger than targets rank, but got predictions rank "+"".concat(r.rank," and targets rank ").concat(s.rank)),tr(r.shape.slice(0,r.shape.length-1),s.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const a=r.shape[r.shape.length-1];A(n>0&&n<=a,()=>"'k' passed to inTopK() must be > 0 && <= the predictions last "+"dimension (".concat(a,"), but got ").concat(n));const o=await r.data(),i=await s.data(),[l,u]=[o.length/a,a],c=$n("bool",l);for(let d=0;d<l;d++){const f=d*u,p=o.subarray(f,f+u),h=[];for(let m=0;m<p.length;m++)h.push({value:p[m],index:m});h.sort((m,g)=>g.value-m.value),c[d]=0;for(let m=0;m<n;m++)if(h[m].index===i[d]){c[d]=1;break}}return t!==r&&r.dispose(),e!==s&&s.dispose(),Fr(c,s.shape,"bool")}const uM=lM;/** 3466 * @license 3467 * Copyright 2020 Google LLC. All Rights Reserved. 3468 * Licensed under the Apache License, Version 2.0 (the "License"); 3469 * you may not use this file except in compliance with the License. 3470 * You may obtain a copy of the License at 3471 * 3472 * http://www.apache.org/licenses/LICENSE-2.0 3473 * 3474 * Unless required by applicable law or agreed to in writing, software 3475 * distributed under the License is distributed on an "AS IS" BASIS, 3476 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3477 * See the License for the specific language governing permissions and 3478 * limitations under the License. 3479 * ============================================================================= 3480 */function dM(t,e,n,r,s,a="NHWC",o){let i=t;t.rank===3&&(i=re(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let l=e;l.rank===3&&(l=re(e,[1,e.shape[0],e.shape[1],e.shape[2]])),A(i.rank===4,()=>"Error in conv2dDerFilter: input must be rank 4, but got shape "+"".concat(i.shape,".")),A(l.rank===4,()=>"Error in conv2dDerFilter: dy must be rank 4, but got shape "+"".concat(l.shape,".")),A(n.length===4,()=>"Error in conv2dDerFilter: filterShape must be length 4, but got "+"".concat(n,"."));const u=a==="NHWC"?i.shape[3]:i.shape[1],c=a==="NHWC"?l.shape[3]:l.shape[1];A(u===n[2],()=>"Error in conv2dDerFilter: depth of input ".concat(u,") must ")+"match input depth in filter (".concat(n[2],".")),A(c===n[3],()=>"Error in conv2dDerFilter: depth of dy (".concat(c,") must ")+"match output depth for filter (".concat(n[3],").")),zr("conv2dDerFilter",s,o);const d={x:i,dy:l},f={strides:r,pad:s,dataFormat:a,dimRoundingMode:o,filterShape:n};return W.runKernel(R1,d,f)}const fM=P({conv2DBackpropFilter_:dM});/** 3481 * @license 3482 * Copyright 2019 Google LLC. All Rights Reserved. 3483 * Licensed under the Apache License, Version 2.0 (the "License");
3484 * you may not use this file except in compliance with the License. 3485 * You may obtain a copy of the License at 3486 * 3487 * http://www.apache.org/licenses/LICENSE-2.0 3488 * 3489 * Unless required by applicable law or agreed to in writing, software 3490 * distributed under the License is distributed on an "AS IS" BASIS, 3491 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3492 * See the License for the specific language governing permissions and 3493 * limitations under the License. 3494 * ============================================================================= 3495 */function Ng(t,e,n){if(n==null||n==="linear")return t;if(n==="relu")return he(t,s2(e));throw new Error("Cannot compute gradient for fused activation ".concat(n,"."))}function Ag(t,e){let n=e;const r=Z4(t.shape,e.shape);return r.length>0&&(n=Mt(n,r)),re(n,t.shape)}function $g(t,e,n,r){if(e==="linear")return t;if(e==="relu")return zf(t);if(e==="elu")return Fw(t);if(e==="relu6")return e2(t);if(e==="prelu")return Jw(t,n);if(e==="leakyrelu")return zw(t,r);if(e==="sigmoid")return Ba(t);throw new Error("Unknown fused activation ".concat(e,"."))}const Rg=(t,e)=>!(t>0)||e==="linear";/** 3496 * @license 3497 * Copyright 2019 Google LLC. All Rights Reserved. 3498 * Licensed under the Apache License, Version 2.0 (the "License"); 3499 * you may not use this file except in compliance with the License. 3500 * You may obtain a copy of the License at 3501 * 3502 * http://www.apache.org/licenses/LICENSE-2.0 3503 * 3504 * Unless required by applicable law or agreed to in writing, software 3505 * distributed under the License is distributed on an "AS IS" BASIS, 3506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3507 * See the License for the specific language governing permissions and 3508 * limitations under the License. 3509 * ============================================================================= 3510 */function pM({x:t,filter:e,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(l=l||"linear",Rg(W.state.gradientDepth,l)===!1){A(s==="NHWC",()=>"Error in fused conv2d: got dataFormat of ".concat(s," but ")+"only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.");let E=Mf(t,e,n,r,s,a,o);return i!=null&&(E=Fe(E,i)),$g(E,l,u,c)}const d=C(t,"x","conv2d","float32"),f=C(e,"filter","conv2d","float32");let p=d,h=!1;d.rank===3&&(h=!0,p=re(d,[1,d.shape[0],d.shape[1],d.shape[2]])),A(p.rank===4,()=>"Error in fused conv2d: input must be rank 4, but got rank "+"".concat(p.rank,".")),A(f.rank===4,()=>"Error in fused conv2d: filter must be rank 4, but got rank "+"".concat(f.rank,".")),zr("fused conv2d",r,o);const m=s==="NHWC"?p.shape[3]:p.shape[1];A(f.shape[2]===m,()=>"Error in conv2d: depth of input (".concat(m,") must match ")+"input depth for filter ".concat(f.shape[2],".")),A(Tr(n,a),()=>"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(a,"'"));const g=Vn(p.shape,f.shape,n,a,r,o);let v;i!=null&&(v=C(i,"bias","fused conv2d"),[v]=Xt(v,d),s==="NHWC"?Rt(g.outShape,v.shape):(A(v.shape.length<=1,()=>"Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of "+"rank-".concat(v.shape.length,".")),A(v.shape.length===0||v.shape[0]===g.outChannels||v.shape[0]===1,()=>"Error in fused conv2d: bias shape (".concat(v.shape,") is not ")+"compatible with the number of output channels "+"(".concat(g.outChannels,")"))));let b;if(u!=null){const E=u.shape;if(A(E.length<=1||E.length===3,()=>"Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of "+"rank-".concat(E.length,".")),E.length===1)A(E[0]===1||E[0]===g.outChannels,()=>"Error in fused conv2d: PReLU activation weights "+"(".concat(E,") is not compatible with the number of output ")+"channels (".concat(g.outChannels,")."));else if(E.length===3)try{Rt(E,g.outShape)}catch(T){const D="Error in fused conv2d: PReLU activation weights (".concat(E,") ")+"is not compatible with the output shape of the conv2d "+"(".concat(g.outShape,").");throw Error(D)}b=C(u,"prelu weights","fused conv2d")}const w=(E,T)=>{A(s==="NHWC",()=>"Error in gradient of fused conv2D: got dataFormat of ".concat(s," but only NHWC is currently supported."));const[D,R,$,M]=T,B=Ng(E,$,l);
3510A(ou(a),()=>"Error in gradient of fused conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(a,"'"));const z=Rw(R.shape,B,D,n,r),H=fM(R,B,D.shape,n,r),V=[z,H];if(M!=null){const X=Ag(M,B);V.push(X)}return V},S={x:p,filter:f,bias:v,preluActivationWeights:b},I={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?xs((T,D,R)=>{let $=W.runKernel(yc,S,I);return R([D,T,$]),h&&($=re($,[$.shape[1],$.shape[2],$.shape[3]])),{value:$,gradFunc:w}})(p,f):xs((T,D,R,$)=>{let M=W.runKernel(yc,S,I);return $([D,T,M,R]),h&&(M=re(M,[M.shape[1],M.shape[2],M.shape[3]])),{value:M,gradFunc:w}})(p,f,v)}const hM=P({fusedConv2d_:pM});/** 3511 * @license 3512 * Copyright 2020 Google LLC. All Rights Reserved. 3513 * Licensed under the Apache License, Version 2.0 (the "License"); 3514 * you may not use this file except in compliance with the License. 3515 * You may obtain a copy of the License at 3516 * 3517 * http://www.apache.org/licenses/LICENSE-2.0 3518 * 3519 * Unless required by applicable law or agreed to in writing, software 3520 * distributed under the License is distributed on an "AS IS" BASIS, 3521 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3522 * See the License for the specific language governing permissions and 3523 * limitations under the License. 3524 * ============================================================================= 3525 */function mM(t,e,n,r,s,a=[1,1],o){let i=t;t.rank===3&&(i=re(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let l=e;l.rank===3&&(l=re(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const u={x:i,dy:l},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,filterShape:n};return W.runKernel(D1,u,c)}const gM=P({depthwiseConv2dNativeBackpropFilter_:mM});/** 3526 * @license 3527 * Copyright 2020 Google LLC. All Rights Reserved. 3528 * Licensed under the Apache License, Version 2.0 (the "License"); 3529 * you may not use this file except in compliance with the License. 3530 * You may obtain a copy of the License at 3531 * 3532 * http://www.apache.org/licenses/LICENSE-2.0 3533 * 3534 * Unless required by applicable law or agreed to in writing, software 3535 * distributed under the License is distributed on an "AS IS" BASIS, 3536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3537 * See the License for the specific language governing permissions and 3538 * limitations under the License. 3539 * ============================================================================= 3540 */function yM(t,e,n,r,s,a=[1,1],o){let i=e,l=!1;e.rank===3&&(l=!0,i=re(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const u={dy:i,filter:n},c={strides:r,pad:s,dimRoundingMode:o,dilations:a,inputShape:t},d=W.runKernel(F1,u,c);return l?re(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const vM=P({depthwiseConv2dNativeBackpropInput_:yM});/** 3541 * @license 3542 * Copyright 2019 Google LLC. All Rights Reserved. 3543 * Licensed under the Apache License, Version 2.0 (the "License"); 3544 * you may not use this file except in compliance with the License. 3545 * You may obtain a copy of the License at 3546 * 3547 * http://www.apache.org/licenses/LICENSE-2.0 3548 * 3549 * Unless required by applicable law or agreed to in writing, software 3550 * distributed under the License is distributed on an "AS IS" BASIS, 3551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3552 * See the License for the specific language governing permissions and 3553 * limitations under the License. 3554 * ============================================================================= 3555 */function bM({x:t,filter:e,strides:n,pad:r,dataFormat:s="NHWC",dilations:a=[1,1],dimRoundingMode:o,bias:i,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(Rg(W.state.gradientDepth,l)===!1){let I=mg(t,e,n,r,s,a,o);return i!=null&&(I=Fe(I,i)),$g(I,l,u,c)}const d=C(t,"x","depthwiseConv2d","float32"),f=C(e,"filter","depthwiseConv2d","float32");let p=d,h=!1;d.rank===3&&(h=!0,p=re(d,[1,d.shape[0],d.shape[1],d.shape[2]])),A(p.rank===4,()=>"Error in fused depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(p.rank,".")),A(f.rank===4,()=>"Error in fused depthwiseConv2d: filter must be rank 4, "+"but got rank ".concat(f.rank,".")),A(p.shape[3]===f.shape[2],()=>"Error in fused depthwiseConv2d: number of input channels "+"(".concat(p.shape[3],") must match the inChannels dimension in ")+"filter ".concat(f.shape[2],".")),a==null&&(a=[1,1]),A(Tr(n,a),()=>"Error in fused depthwiseConv2d: Either strides or dilations must "+"be 1. Got strides ".concat(n," and dilations '").concat(a,"'")),zr("fused depthwiseConv2d",r,o);const m=Vn(p.shape,f.shape,n,a,r,o,!0);let g;i!=null&&(g=C(i,"bias","fused conv2d"),[g]=Xt(g,d),Rt(m.outShape,g.shape));let v;u!=null&&(v=C(u,"prelu weights","fused depthwiseConv2d"));const b=(I,E)=>
3555{A(ou(a),()=>"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(a,"'"));const[T,D,R,$]=E,M=Ng(I,R,l),B=vM(D.shape,M,T,n,r,a,o),z=gM(D,M,T.shape,n,r,a,o);if($!=null){const H=Ag(g,M);return[B,z,H]}return[B,z]},w={x:p,filter:f,bias:g,preluActivationWeights:v},S={strides:n,pad:r,dataFormat:s,dilations:a,dimRoundingMode:o,activation:l,leakyreluAlpha:c};return i==null?xs((E,T,D)=>{let R=W.runKernel(vc,w,S);return D([T,E,R]),h&&(R=re(R,[R.shape[1],R.shape[2],R.shape[3]])),{value:R,gradFunc:b}})(p,f):xs((E,T,D,R)=>{let $=W.runKernel(vc,w,S);return R([T,E,$,D]),h&&($=re($,[$.shape[1],$.shape[2],$.shape[3]])),{value:$,gradFunc:b}})(p,f,g)}const wM=P({fusedDepthwiseConv2d_:bM});/** 3556 * @license 3557 * Copyright 2019 Google LLC. All Rights Reserved. 3558 * Licensed under the Apache License, Version 2.0 (the "License"); 3559 * you may not use this file except in compliance with the License. 3560 * You may obtain a copy of the License at 3561 * 3562 * http://www.apache.org/licenses/LICENSE-2.0 3563 * 3564 * Unless required by applicable law or agreed to in writing, software 3565 * distributed under the License is distributed on an "AS IS" BASIS, 3566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3567 * See the License for the specific language governing permissions and 3568 * limitations under the License. 3569 * ============================================================================= 3570 */function SM({a:t,b:e,transposeA:n=!1,transposeB:r=!1,bias:s,activation:a="linear",preluActivationWeights:o,leakyreluAlpha:i=.2}){if(Rg(W.state.gradientDepth,a)===!1){let M=xt(t,e,n,r);return s!=null&&(M=Fe(M,s)),$g(M,a,o,i)}let l=C(t,"a","fused matMul"),u=C(e,"b","fused matMul");[l,u]=Xt(l,u);const c=n?l.shape[l.rank-2]:l.shape[l.rank-1],d=r?u.shape[u.rank-1]:u.shape[u.rank-2],f=n?l.shape[l.rank-1]:l.shape[l.rank-2],p=r?u.shape[u.rank-2]:u.shape[u.rank-1],h=l.shape.slice(0,-2),m=u.shape.slice(0,-2),g=J(h),v=J(m);A(c===d,()=>"Error in fused matMul: inner shapes (".concat(c,") and (")+"".concat(d,") of Tensors with shapes ").concat(l.shape," and ")+"".concat(u.shape," and transposeA=").concat(n)+" and transposeB=".concat(r," must match."));const w=Rt(l.shape.slice(0,-2),u.shape.slice(0,-2)).concat([f,p]),S=n?re(l,[g,c,f]):re(l,[g,f,c]),I=r?re(u,[v,p,d]):re(u,[v,d,p]);let E;s!=null&&(E=C(s,"bias","fused matMul"),[E]=Xt(E,l),Rt(w,E.shape));let T;o!=null&&(T=C(o,"prelu weights","fused matMul"));const D=(M,B)=>{const[z,H,V,X]=B,Q=Ng(re(M,V.shape),V,a);let K,ee;if(!n&&!r?(K=xt(Q,H,!1,!0),ee=xt(z,Q,!0,!1)):!n&&r?(K=xt(Q,H,!1,!1),ee=xt(Q,z,!0,!1)):n&&!r?(K=xt(H,Q,!1,!0),ee=xt(z,Q,!1,!1)):(K=xt(H,Q,!0,!0),ee=xt(Q,z,!0,!0)),s!=null){const ae=Ag(X,Q);return[K,ee,ae]}else return[K,ee]},R={a:S,b:I,bias:E,preluActivationWeights:T},$={transposeA:n,transposeB:r,activation:a,leakyreluAlpha:i};return s==null?xs((B,z,H)=>{const V=W.runKernel(gc,R,$);return H([B,z,V]),{value:re(V,w),gradFunc:D}})(S,I):xs((B,z,H,V)=>{const X=W.runKernel(gc,R,$);return V([B,z,X,H]),{value:re(X,w),gradFunc:D}})(S,I,E)}const xM=P({fusedMatMul_:SM});/** 3571 * @license 3572 * Copyright 2019 Google LLC. All Rights Reserved. 3573 * Licensed under the Apache License, Version 2.0 (the "License"); 3574 * you may not use this file except in compliance with the License. 3575 * You may obtain a copy of the License at 3576 * 3577 * http://www.apache.org/licenses/LICENSE-2.0 3578 * 3579 * Unless required by applicable law or agreed to in writing, software 3580 * distributed under the License is distributed on an "AS IS" BASIS, 3581 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3582 * See the License for the specific language governing permissions and 3583 * limitations under the License. 3584 * ============================================================================= 3585 */const _M=Object.freeze(Object.defineProperty({__proto__:null,conv2d:hM,depthwiseConv2d:wM,matMul:xM},Symbol.toStringTag,{value:"Module"}));/** 3586 * @license 3587 * Copyright 2019 Google LLC. All Rights Reserved. 3588 * Licensed under the Apache License, Version 2.0 (the "License"); 3589 * you may not use this file except in compliance with the License. 3590 * You may obtain a copy of the License at 3591 * 3592 * http://www.apache.org/licenses/LICENSE-2.0 3593 * 3594 * Unless required by applicable law or agreed to in writing, softw
3594are 3595 * distributed under the License is distributed on an "AS IS" BASIS, 3596 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3597 * See the License for the specific language governing permissions and 3598 * limitations under the License. 3599 * ============================================================================= 3600 */function IM(t){return Cg(t,.54,.46)}const kM=P({hammingWindow_:IM});/** 3601 * @license 3602 * Copyright 2019 Google LLC. All Rights Reserved. 3603 * Licensed under the Apache License, Version 2.0 (the "License"); 3604 * you may not use this file except in compliance with the License. 3605 * You may obtain a copy of the License at 3606 * 3607 * http://www.apache.org/licenses/LICENSE-2.0 3608 * 3609 * Unless required by applicable law or agreed to in writing, software 3610 * distributed under the License is distributed on an "AS IS" BASIS, 3611 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3612 * See the License for the specific language governing permissions and 3613 * limitations under the License. 3614 * ============================================================================= 3615 */function EM(t){return Cg(t,.5,.5)}const u2=P({hannWindow_:EM});/** 3616 * @license 3617 * Copyright 2019 Google LLC. All Rights Reserved. 3618 * Licensed under the Apache License, Version 2.0 (the "License"); 3619 * you may not use this file except in compliance with the License. 3620 * You may obtain a copy of the License at 3621 * 3622 * http://www.apache.org/licenses/LICENSE-2.0 3623 * 3624 * Unless required by applicable law or agreed to in writing, software 3625 * distributed under the License is distributed on an "AS IS" BASIS, 3626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3627 * See the License for the specific language governing permissions and 3628 * limitations under the License. 3629 * ============================================================================= 3630 */function TM(t,e,n,r=!1,s=0){let a=0;const o=[];for(;a+e<=t.size;)o.push(Ye(t,a,e)),a+=n;if(r)for(;a<t.size;){const i=a+e-t.size,l=mn([Ye(t,a,e-i),Uc([i],s)]);o.push(l),a+=n}return o.length===0?La([],[0,e]):re(mn(o),[o.length,e])}const d2=P({frame_:TM});/** 3631 * @license 3632 * Copyright 2019 Google LLC. All Rights Reserved. 3633 * Licensed under the Apache License, Version 2.0 (the "License"); 3634 * you may not use this file except in compliance with the License. 3635 * You may obtain a copy of the License at 3636 * 3637 * http://www.apache.org/licenses/LICENSE-2.0 3638 * 3639 * Unless required by applicable law or agreed to in writing, software 3640 * distributed under the License is distributed on an "AS IS" BASIS, 3641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3642 * See the License for the specific language governing permissions and 3643 * limitations under the License. 3644 * ============================================================================= 3645 */function CM(t,e,n,r,s=u2){r==null&&(r=l2(e));const a=d2(t,e,n),o=he(a,s(e));return Tg(o,r)}const NM=P({stft_:CM});/** 3646 * @license 3647 * Copyright 2020 Google LLC. All Rights Reserved. 3648 * Licensed under the Apache License, Version 2.0 (the "License"); 3649 * you may not use this file except in compliance with the License. 3650 * You may obtain a copy of the License at 3651 * 3652 * http://www.apache.org/licenses/LICENSE-2.0 3653 * 3654 * Unless required by applicable law or agreed to in writing, software 3655 * distributed under the License is distributed on an "AS IS" BASIS, 3656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3657 * See the License for the specific language governing permissions and 3658 * limitations under the License. 3659 * ============================================================================= 3660 */function AM(t,e,n,r,s="bilinear",a=0){const o=C(t,"image","cropAndResize"),i=C(e,"boxes","cropAndResize","float32"),l=C(n,"boxInd","cropAndResize","int32"),u=i.shape[0];A(o.rank===4,()=>"Error in cropAndResize: image must be rank 4,"+"but got rank ".concat(o.rank,".")),A(i.rank===2&&i.shape[1]===4,()=>"Error in cropAndResize: boxes must be have size [".concat(u,",4] ")+"but had shape ".concat(i.shape,".")),A(l.rank===1&&l.shape[0]===u,()=>"Error in cropAndResize: boxInd must be have size [".concat(u,"] ")+"but had shape ".concat(i.shape,".")),A(r.length===2,()=>"Error in cropAndResize: cropSize must be of length 2, but got "+"length ".concat(r.length,".")),A(r[0]>=1&&r[1]>=1,()=>"cropSize must be atleast [1,1], but was ".concat(r)),A(s==="bilinear"||s==="nearest",()=>"method must be bilinear or nearest, but was ".concat(s));const c={image:o,boxes:i,boxInd:l},d={method:s,extrapolationValue:a,cropSize:r};return W.runKernel(od,c,d)}const $M=P({cropAndResize_:AM});/** 3661 * @license 3662 * Copyright 2020 Google LLC. All Rights Reserved. 3663 * Licensed under the Apache License, Version 2.0 (the "License");
3664 * you may not use this file except in compliance with the License. 3665 * You may obtain a copy of the License at 3666 * 3667 * http://www.apache.org/licenses/LICENSE-2.0 3668 * 3669 * Unless required by applicable law or agreed to in writing, software 3670 * distributed under the License is distributed on an "AS IS" BASIS, 3671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3672 * See the License for the specific language governing permissions and 3673 * limitations under the License. 3674 * ============================================================================= 3675 */function RM(t){const e=C(t,"image","flipLeftRight","float32");A(e.rank===4,()=>"Error in flipLeftRight: image must be rank 4,"+"but got rank ".concat(e.rank,"."));const n={image:e};return W.runKernel(gd,n,{})}const DM=P({flipLeftRight_:RM});/** 3676 * @license 3677 * Copyright 2021 Google LLC. All Rights Reserved. 3678 * Licensed under the Apache License, Version 2.0 (the "License"); 3679 * you may not use this file except in compliance with the License. 3680 * You may obtain a copy of the License at 3681 * 3682 * http://www.apache.org/licenses/LICENSE-2.0 3683 * 3684 * Unless required by applicable law or agreed to in writing, software 3685 * distributed under the License is distributed on an "AS IS" BASIS, 3686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3687 * See the License for the specific language governing permissions and 3688 * limitations under the License. 3689 * ============================================================================= 3690 */function FM(t){const e=C(t,"image","grayscaleToRGB"),n=e.rank-1,r=e.shape[n];A(e.rank>=2,()=>"Error in grayscaleToRGB: images must be at least rank 2, "+"but got rank ".concat(e.rank,".")),A(r===1,()=>"Error in grayscaleToRGB: last dimension of a grayscale image "+"should be size 1, but got size ".concat(r,"."));const s=new Array(e.rank);return s.fill(1,0,n),s[n]=3,ec(e,s)}const MM=P({grayscaleToRGB_:FM});/** 3691 * @license 3692 * Copyright 2023 Google LLC. 3693 * Licensed under the Apache License, Version 2.0 (the "License"); 3694 * you may not use this file except in compliance with the License. 3695 * You may obtain a copy of the License at 3696 * 3697 * http://www.apache.org/licenses/LICENSE-2.0 3698 * 3699 * Unless required by applicable law or agreed to in writing, software 3700 * distributed under the License is distributed on an "AS IS" BASIS, 3701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3702 * See the License for the specific language governing permissions and 3703 * limitations under the License. 3704 * ============================================================================= 3705 */function OM(t){const e=C(t,"image","RGBToGrayscale"),n=e.rank-1,r=e.shape[n];A(e.rank>=2,()=>"Error in RGBToGrayscale: images must be at least rank 2, "+"but got rank ".concat(e.rank,".")),A(r===3,()=>"Error in RGBToGrayscale: last dimension of an RGB image "+"should be size 3, but got size ".concat(r,"."));const s=e.dtype,a=Ut(e,"float32"),o=Sn([.2989,.587,.114]);let i;switch(e.rank){case 2:i=No("ij,j->i",a,o);break;case 3:i=No("ijk,k->ij",a,o);break;case 4:i=No("ijkl,l->ijk",a,o);break;case 5:i=No("ijklm,m->ijkl",a,o);break;case 6:i=No("ijklmn,n->ijklm",a,o);break;default:throw new Error("Not a valid tensor rank.")}return i=Kr(i,-1),Ut(i,s)}const PM=P({rgbToGrayscale_:OM});/** 3706 * @license 3707 * Copyright 2020 Google LLC. All Rights Reserved. 3708 * Licensed under the Apache License, Version 2.0 (the "License"); 3709 * you may not use this file except in compliance with the License. 3710 * You may obtain a copy of the License at 3711 * 3712 * http://www.apache.org/licenses/LICENSE-2.0 3713 * 3714 * Unless required by applicable law or agreed to in writing, software 3715 * distributed under the License is distributed on an "AS IS" BASIS, 3716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3717 * See the License for the specific language governing permissions and 3718 * limitations under the License. 3719 * ============================================================================= 3720 */function BM(t,e,n=0,r=.5){const s=C(t,"image","rotateWithOffset","float32");A(s.rank===4,()=>"Error in rotateWithOffset: image must be rank 4,"+"but got rank ".concat(s.rank,"."));const a={image:s},o={radians:e,fillValue:n,center:r};return W.runKernel(Rf,a,o)}const LM=P({rotateWithOffset_:BM});/** 3721 * @license 3722 * Copyright 2020 Google LLC. All Rights Reserved. 3723 * Licensed under the Apache License, Version 2.0 (the "License");
3724 * you may not use this file except in compliance with the License. 3725 * You may obtain a copy of the License at 3726 * 3727 * http://www.apache.org/licenses/LICENSE-2.0 3728 * 3729 * Unless required by applicable law or agreed to in writing, software 3730 * distributed under the License is distributed on an "AS IS" BASIS, 3731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3732 * See the License for the specific language governing permissions and 3733 * limitations under the License. 3734 * ============================================================================= 3735 */function fi(t,e,n,r,s,a){r==null&&(r=.5),s==null&&(s=Number.NEGATIVE_INFINITY),a==null&&(a=0);const o=t.shape[0];return n=Math.min(n,o),A(0<=r&&r<=1,()=>"iouThreshold must be in [0, 1], but was '".concat(r,"'")),A(t.rank===2,()=>"boxes must be a 2D tensor, but was of rank '".concat(t.rank,"'")),A(t.shape[1]===4,()=>"boxes must have 4 columns, but 2nd dimension was ".concat(t.shape[1])),A(e.rank===1,()=>"scores must be a 1D tensor"),A(e.shape[0]===o,()=>"scores has incompatible shape with boxes. Expected ".concat(o,", ")+"but was ".concat(e.shape[0])),A(0<=a&&a<=1,()=>"softNmsSigma must be in [0, 1], but was '".concat(a,"'")),{maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a}}/** 3736 * @license 3737 * Copyright 2020 Google LLC. All Rights Reserved. 3738 * Licensed under the Apache License, Version 2.0 (the "License"); 3739 * you may not use this file except in compliance with the License. 3740 * You may obtain a copy of the License at 3741 * 3742 * http://www.apache.org/licenses/LICENSE-2.0 3743 * 3744 * Unless required by applicable law or agreed to in writing, software 3745 * distributed under the License is distributed on an "AS IS" BASIS, 3746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3747 * See the License for the specific language governing permissions and 3748 * limitations under the License. 3749 * ============================================================================= 3750 */function WM(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY){const a=C(t,"boxes","nonMaxSuppression","float32"),o=C(e,"scores","nonMaxSuppression","float32"),i=fi(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;const l={maxOutputSize:n,iouThreshold:r,scoreThreshold:s};return W.runKernel(Kd,{boxes:a,scores:o},l)}const zM=P({nonMaxSuppression_:WM});/** 3751 * @license 3752 * Copyright 2019 Google LLC. All Rights Reserved. 3753 * Licensed under the Apache License, Version 2.0 (the "License"); 3754 * you may not use this file except in compliance with the License. 3755 * You may obtain a copy of the License at 3756 * 3757 * http://www.apache.org/licenses/LICENSE-2.0 3758 * 3759 * Unless required by applicable law or agreed to in writing, software 3760 * distributed under the License is distributed on an "AS IS" BASIS, 3761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3762 * See the License for the specific language governing permissions and 3763 * limitations under the License. 3764 * ============================================================================= 3765 */function HM(t,e,n){const r=UM(t,e,n),s=r<0?-(r+1):r;t.splice(s,0,e)}function UM(t,e,n){return jM(t,e,n||VM)}function VM(t,e){return t>e?1:t<e?-1:0}function jM(t,e,n){let r=0,s=t.length,a=0,o=!1;for(;r<s;){a=r+(s-r>>>1);const i=n(e,t[a]);i>0?r=a+1:(s=a,o=!i)}return o?r:-r-1}/** 3766 * @license 3767 * Copyright 2020 Google LLC. All Rights Reserved. 3768 * Licensed under the Apache License, Version 2.0 (the "License"); 3769 * you may not use this file except in compliance with the License. 3770 * You may obtain a copy of the License at 3771 * 3772 * http://www.apache.org/licenses/LICENSE-2.0 3773 * 3774 * Unless required by applicable law or agreed to in writing, software 3775 * distributed under the License is distributed on an "AS IS" BASIS, 3776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3777 * See the License for the specific language governing permissions and 3778 * limitations under the License. 3779 * ============================================================================= 3780 */function f2(t,e,n,r,s){return Dg(t,e,n,r,s,0)}function p2(t,e,n,r,s,a){return Dg(t,e,n,r,s,0,!1,a,!0)}function h2(t,e,n,r,s,a){return Dg(t,e,n,r,s,a,!0)}function Dg(t,e,n,r,s,a,o=!1,i=!1,l=!1){const u=[];for(let g=0;g<e.length;g++)e[g]>s&&u.push({score:e[g],boxIndex:g,suppressBeginIndex:0});
vendor: 4,622 bytes, lines 3780-3828
3780u.sort(Ev);const c=a>0?-.5/a:0,d=[],f=[];for(;d.length<n&&u.length>0;){const g=u.pop(),{score:v,boxIndex:b,suppressBeginIndex:w}=g;if(v<s)break;let S=!1;for(let I=d.length-1;I>=w;--I){const E=GM(t,b,d[I]);if(E>=r){S=!0;break}if(g.score=g.score*qM(r,c,E),g.score<=s)break}g.suppressBeginIndex=d.length,S||(g.score===v?(d.push(b),f.push(g.score)):g.score>s&&HM(u,g,Ev))}const p=d.length,h=n-p;i&&h>0&&(d.push(...new Array(h).fill(0)),f.push(...new Array(h).fill(0)));const m={selectedIndices:d};return o&&(m.selectedScores=f),l&&(m.validOutputs=p),m}function GM(t,e,n){const r=t.subarray(e*4,e*4+4),s=t.subarray(n*4,n*4+4),a=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),i=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(s[0],s[2]),c=Math.min(s[1],s[3]),d=Math.max(s[0],s[2]),f=Math.max(s[1],s[3]),p=(i-a)*(l-o),h=(d-u)*(f-c);if(p<=0||h<=0)return 0;const m=Math.max(a,u),g=Math.max(o,c),v=Math.min(i,d),b=Math.min(l,f),w=Math.max(v-m,0)*Math.max(b-g,0);return w/(p+h-w)}function qM(t,e,n){const r=Math.exp(e*n*n);return n<=t?r:0}function Ev(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}/** 3781 * @license 3782 * Copyright 2020 Google LLC. All Rights Reserved. 3783 * Licensed under the Apache License, Version 2.0 (the "License"); 3784 * you may not use this file except in compliance with the License. 3785 * You may obtain a copy of the License at 3786 * 3787 * http://www.apache.org/licenses/LICENSE-2.0 3788 * 3789 * Unless required by applicable law or agreed to in writing, software 3790 * distributed under the License is distributed on an "AS IS" BASIS, 3791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3792 * See the License for the specific language governing permissions and 3793 * limitations under the License. 3794 * ============================================================================= 3795 */async function KM(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY){const a=C(t,"boxes","nonMaxSuppressionAsync"),o=C(e,"scores","nonMaxSuppressionAsync"),i=fi(a,o,n,r,s);n=i.maxOutputSize,r=i.iouThreshold,s=i.scoreThreshold;const l=await Promise.all([a.data(),o.data()]),u=l[0],c=l[1],{selectedIndices:d}=f2(u,c,n,r,s);return a!==t&&a.dispose(),o!==e&&o.dispose(),Sn(d,"int32")}const XM=KM;/** 3796 * @license 3797 * Copyright 2020 Google LLC. All Rights Reserved. 3798 * Licensed under the Apache License, Version 2.0 (the "License"); 3799 * you may not use this file except in compliance with the License. 3800 * You may obtain a copy of the License at 3801 * 3802 * http://www.apache.org/licenses/LICENSE-2.0 3803 * 3804 * Unless required by applicable law or agreed to in writing, software 3805 * distributed under the License is distributed on an "AS IS" BASIS, 3806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3807 * See the License for the specific language governing permissions and 3808 * limitations under the License. 3809 * ============================================================================= 3810 */function YM(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){const o=C(t,"boxes","nonMaxSuppression"),i=C(e,"scores","nonMaxSuppression"),l=fi(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;const u={boxes:o,scores:i},c={maxOutputSize:n,iouThreshold:r,scoreThreshold:s,softNmsSigma:a},d=W.runKernel(Yd,u,c);return{selectedIndices:d[0],selectedScores:d[1]}}const JM=P({nonMaxSuppressionWithScore_:YM});/** 3811 * @license 3812 * Copyright 2020 Google LLC. All Rights Reserved. 3813 * Licensed under the Apache License, Version 2.0 (the "License"); 3814 * you may not use this file except in compliance with the License. 3815 * You may obtain a copy of the License at 3816 * 3817 * http://www.apache.org/licenses/LICENSE-2.0 3818 * 3819 * Unless required by applicable law or agreed to in writing, software 3820 * distributed under the License is distributed on an "AS IS" BASIS, 3821 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3822 * See the License for the specific language governing permissions and 3823 * limitations under the License. 3824 * ============================================================================= 3825 */async function QM(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,a=0){const o=C(t,"boxes","nonMaxSuppressionAsync"),i=C(e,"scores","nonMaxSuppressionAsync"),l=fi(o,i,n,r,s,a);n=l.maxOutputSize,r=l.iouThreshold,s=l.scoreThreshold,a=l.softNmsSigma;const u=await Promise.all([o.data(),i.data()]),c=u[0],d=u[1],{selectedIndices:f,selectedScores:p}=h2(c,d,n,r,s,a);return o!==t&&o.dispose(),i!==e&&i.dispose(),{selectedIndices:Sn(f,"int32"),selectedScores:Sn(p)}}const ZM=QM;/** 3826 * @license 3827 * Copyright 2020 Google LLC. All Rights Reserved. 3828 * Licensed under the Apache License, Version 2.0 (the "License");
3829 * you may not use this file except in compliance with the License. 3830 * You may obtain a copy of the License at 3831 * 3832 * http://www.apache.org/licenses/LICENSE-2.0 3833 * 3834 * Unless required by applicable law or agreed to in writing, software 3835 * distributed under the License is distributed on an "AS IS" BASIS, 3836 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3837 * See the License for the specific language governing permissions and 3838 * limitations under the License. 3839 * ============================================================================= 3840 */function eO(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){const o=C(t,"boxes","nonMaxSuppression"),i=C(e,"scores","nonMaxSuppression"),l=fi(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,f={boxes:o,scores:i},p={maxOutputSize:u,iouThreshold:c,scoreThreshold:d,padToMaxOutputSize:a},h=W.runKernel(Xd,f,p);return{selectedIndices:h[0],validOutputs:h[1]}}const tO=P({nonMaxSuppressionPadded_:eO});/** 3841 * @license 3842 * Copyright 2020 Google LLC. All Rights Reserved. 3843 * Licensed under the Apache License, Version 2.0 (the "License"); 3844 * you may not use this file except in compliance with the License. 3845 * You may obtain a copy of the License at 3846 * 3847 * http://www.apache.org/licenses/LICENSE-2.0 3848 * 3849 * Unless required by applicable law or agreed to in writing, software 3850 * distributed under the License is distributed on an "AS IS" BASIS, 3851 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3852 * See the License for the specific language governing permissions and 3853 * limitations under the License. 3854 * ============================================================================= 3855 */async function nO(t,e,n,r=.5,s=Number.NEGATIVE_INFINITY,a=!1){const o=C(t,"boxes","nonMaxSuppressionAsync"),i=C(e,"scores","nonMaxSuppressionAsync"),l=fi(o,i,n,r,s,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,[f,p]=await Promise.all([o.data(),i.data()]),{selectedIndices:h,validOutputs:m}=p2(f,p,u,c,d,a);return o!==t&&o.dispose(),i!==e&&i.dispose(),{selectedIndices:Sn(h,"int32"),validOutputs:ot(m,"int32")}}const rO=nO;/** 3856 * @license 3857 * Copyright 2020 Google LLC. All Rights Reserved. 3858 * Licensed under the Apache License, Version 2.0 (the "License"); 3859 * you may not use this file except in compliance with the License. 3860 * You may obtain a copy of the License at 3861 * 3862 * http://www.apache.org/licenses/LICENSE-2.0 3863 * 3864 * Unless required by applicable law or agreed to in writing, software 3865 * distributed under the License is distributed on an "AS IS" BASIS, 3866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3867 * See the License for the specific language governing permissions and 3868 * limitations under the License. 3869 * ============================================================================= 3870 */function sO(t,e,n=!1,r=!1){const s=C(t,"images","resizeBilinear");A(s.rank===3||s.rank===4,()=>"Error in resizeBilinear: x must be rank 3 or 4, but got "+"rank ".concat(s.rank,".")),A(e.length===2,()=>"Error in resizeBilinear: new shape must 2D, but got shape "+"".concat(e,".")),A(r===!1||n===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=re(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const i={images:a},l={alignCorners:n,halfPixelCenters:r,size:e},u=W.runKernel(af,i,l);return o?re(u,[u.shape[1],u.shape[2],u.shape[3]]):u}const aO=P({resizeBilinear_:sO});/** 3871 * @license 3872 * Copyright 2020 Google LLC. All Rights Reserved. 3873 * Licensed under the Apache License, Version 2.0 (the "License"); 3874 * you may not use this file except in compliance with the License. 3875 * You may obtain a copy of the License at 3876 * 3877 * http://www.apache.org/licenses/LICENSE-2.0 3878 * 3879 * Unless required by applicable law or agreed to in writing, software 3880 * distributed under the License is distributed on an "AS IS" BASIS, 3881 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3882 * See the License for the specific language governing permissions and 3883 * limitations under the License. 3884 * ============================================================================= 3885 */function oO(t,e,n=!1,r=!1){const s=C(t,"images","resizeNearestNeighbor");A(s.rank===3||s.rank===4,()=>"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got "+"rank ".concat(s.rank,".")),A(e.length===2,()=>"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+"".concat(e,".")),A(s.dtype==="float32"||s.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),A(r===!1||n===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let a=s,o=!1;s.rank===3&&(o=!0,a=re(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const i={images:a},l={alignCorners:n,halfPixelCenters:r,size:e},u=W.runKernel(sf,i,l);return o?re(u,[u.shape[1],u.shape[2],u.shape[3]]):u}const iO=P({resizeNearestNeighbor_:oO});/** 3886 * @license 3887 * Copyright 2021 Google LLC. All Rights Reserved. 3888 * Licensed under the Apache License, Version 2.0 (the "License");
3889 * you may not use this file except in compliance with the License. 3890 * You may obtain a copy of the License at 3891 * 3892 * https://www.apache.org/licenses/LICENSE-2.0 3893 * 3894 * Unless required by applicable law or agreed to in writing, software 3895 * distributed under the License is distributed on an "AS IS" BASIS, 3896 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3897 * See the License for the specific language governing permissions and 3898 * limitations under the License. 3899 * ============================================================================= 3900 */function cO(t,e="binary",n=!1,r=.5){const s=C(t,"image","threshold"),a=.2989,o=.587,i=.114,l=s.shape[0]*s.shape[1];let u=he(Sn([r]),255),c,d,f,p;if(A(s.rank===3,()=>"Error in threshold: image must be rank 3,"+"but got rank ".concat(s.rank,".")),A(s.shape[2]===3||s.shape[2]===1,()=>"Error in threshold: image color channel must be equal to 3 or 1"+"but got ".concat(s.shape[2],".")),A(s.dtype==="int32"||s.dtype==="float32",()=>"Error in dtype: image dtype must be int32 or float32,"+"but got dtype ".concat(s.dtype,".")),A(e==="otsu"||e==="binary",()=>"Method must be binary or otsu, but was ".concat(e)),s.shape[2]===3){[c,d,f]=Tc(s,[1,1,1],-1);const g=he(c,a),v=he(d,o),b=he(f,i);p=Fe(Fe(g,v),b)}else p=t;if(e==="otsu"){const g=Aw(Ut(t2(p),"int32"),Fr([]),256);u=lO(g,l)}const h=n?gg(p,u):Bf(p,u);return Ut(he(h,255),"int32")}function lO(t,e){let n=Sn([-1]),r=Sn([0]),s=Sn([0]),a,o,i,l,u,c;for(let d=0;d<t.size-1;d++){a=Ye(t,0,d+1),o=Ye(t,d+1),u=tt(Mt(a),e),c=tt(Mt(o),e);const f=Mt(he(a,kc(0,a.size)));i=tt(f,Mt(a));const p=Uc(o.shape,a.size),h=Fe(kc(0,o.size),p),m=he(o,h);l=tt(Mt(m),Mt(o));const g=Je(i,l),v=Je(i,l),b=he(u,c);s=he(he(b,g),v);const w=Bf(s,r);r=Ys(w,s,r),n=Ys(w,Sn([d]),n)}return n}const uO=P({threshold_:cO});/** 3901 * @license 3902 * Copyright 2021 Google LLC. All Rights Reserved. 3903 * Licensed under the Apache License, Version 2.0 (the "License"); 3904 * you may not use this file except in compliance with the License. 3905 * You may obtain a copy of the License at 3906 * 3907 * http://www.apache.org/licenses/LICENSE-2.0 3908 * 3909 * Unless required by applicable law or agreed to in writing, software 3910 * distributed under the License is distributed on an "AS IS" BASIS, 3911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3912 * See the License for the specific language governing permissions and 3913 * limitations under the License. 3914 * ============================================================================= 3915 */function dO(t,e,n="nearest",r="constant",s=0,a){const o=C(t,"image","transform","float32"),i=C(e,"transforms","transform","float32");A(o.rank===4,()=>"Error in transform: image must be rank 4,"+"but got rank ".concat(o.rank,".")),A(i.rank===2&&(i.shape[0]===o.shape[0]||i.shape[0]===1)&&i.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),A(a==null||a.length===2,()=>"Error in transform: outputShape must be [height, width] or null, "+"but got ".concat(a,"."));const l={image:o,transforms:i},u={interpolation:n,fillMode:r,fillValue:s,outputShape:a};return W.runKernel($f,l,u)}const fO=P({transform_:dO});/** 3916 * @license 3917 * Copyright 2020 Google LLC. All Rights Reserved. 3918 * Licensed under the Apache License, Version 2.0 (the "License"); 3919 * you may not use this file except in compliance with the License. 3920 * You may obtain a copy of the License at 3921 * 3922 * http://www.apache.org/licenses/LICENSE-2.0 3923 * 3924 * Unless required by applicable law or agreed to in writing, software 3925 * distributed under the License is distributed on an "AS IS" BASIS, 3926 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3927 * See the License for the specific language governing permissions and 3928 * limitations under the License. 3929 * ============================================================================= 3930 */function pO(t,e,n){const r=C(t,"a","bandPart");A(r.rank>=2,()=>"bandPart(): Rank must be at least 2, got ".concat(r.rank,"."));const s=r.shape,[a,o]=r.shape.slice(-2);let i,l;typeof e=="number"?(A(e%1===0,()=>"bandPart(): numLower must be an integer, got ".concat(e,".")),A(e<=a,()=>"bandPart(): numLower (".concat(e,")")+" must not be greater than the number of rows (".concat(a,").")),i=C(e<0?a:e,"numLower","bandPart")):(A(e.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),i=Ys(Ch(e,0),a,uu(e,a))),typeof n=="number"?(A(n%1===0,()=>"bandPart(): numUpper must be an integer, got ".concat(n,".")),A(n<=o,()=>"bandPart(): numUpper (".concat(n,")")+" must not be greater than the number of columns (".concat(o,").")),l=C(n<0?o:n,"numUpper","bandPart")):(A(n.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),l=Ys(Ch(n,0),o,uu(n,o)));const u=re(kc(0,a,1,"int32"),[-1,1]),c=kc(0,o,1,"int32"),d=Je(u,c),f=cu(gg(d,i),Ww(d,ns(l))),p=Jo([a,o],r.dtype);return re(_s(so(re(r,[-1,a,o])).map(h=>Ys(f,h,p))),s)}const hO=P({bandPart_:pO});/** 3931 * @license 3932 * Copyright 2020 Google LLC. All Rights Reserved. 3933 * Licensed under the Apache License, Version 2.0 (the "License");
3934 * you may not use this file except in compliance with the License. 3935 * You may obtain a copy of the License at 3936 * 3937 * http://www.apache.org/licenses/LICENSE-2.0 3938 * 3939 * Unless required by applicable law or agreed to in writing, software 3940 * distributed under the License is distributed on an "AS IS" BASIS, 3941 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3942 * See the License for the specific language governing permissions and 3943 * limitations under the License. 3944 * ============================================================================= 3945 */function mO(t){let e;if(Array.isArray(t)){e=!1,A(t!=null&&t.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");const s=t[0].shape[0];for(let a=1;a<t.length;++a)A(t[a].shape[0]===s,()=>"Gram-Schmidt: Non-unique lengths found in the input vectors: "+"(".concat(t[a].shape[0]," vs. ").concat(s,")"))}else e=!0,t=Tc(t,t.shape[0],0).map(s=>pn(s,[0]));A(t.length<=t[0].shape[0],()=>"Gram-Schmidt: Number of vectors (".concat(t.length,") exceeds ")+"number of dimensions (".concat(t[0].shape[0],")."));const n=[],r=t;for(let s=0;s<t.length;++s)n.push(W.tidy(()=>{let a=r[s];if(s>0)for(let o=0;o<s;++o){const i=he(Mt(he(n[o],a)),n[o]);a=Je(a,i)}return tt(a,Pf(a,"euclidean"))}));return e?_s(n,0):n}const gO=P({gramSchmidt_:mO});/** 3946 * @license 3947 * Copyright 2020 Google LLC. All Rights Reserved. 3948 * Licensed under the Apache License, Version 2.0 (the "License"); 3949 * you may not use this file except in compliance with the License. 3950 * You may obtain a copy of the License at 3951 * 3952 * http://www.apache.org/licenses/LICENSE-2.0 3953 * 3954 * Unless required by applicable law or agreed to in writing, software 3955 * distributed under the License is distributed on an "AS IS" BASIS, 3956 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3957 * See the License for the specific language governing permissions and 3958 * limitations under the License. 3959 * ============================================================================= 3960 */function yO(t,e=!1){if(A(t.rank>=2,()=>"qr() requires input tensor to have a rank >= 2, but got rank ".concat(t.rank)),t.rank===2)return Tv(t,e);{const n=t.shape.slice(0,t.shape.length-2).reduce((l,u)=>l*u),r=so(re(t,[n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0),s=[],a=[];r.forEach(l=>{const[u,c]=Tv(l,e);s.push(u),a.push(c)});const o=re(_s(s,0),t.shape),i=re(_s(a,0),t.shape);return[o,i]}}function Tv(t,e=!1){return W.tidy(()=>{A(t.shape.length===2,()=>"qr2d() requires a 2D Tensor, but got a ".concat(t.shape.length,"D Tensor."));const n=t.shape[0],r=t.shape[1];let s=Pw(n),a=Xs(t);const o=La([[1]],[1,1]);let i=Xs(o);const l=n>=r?r:n;for(let u=0;u<l;++u){const c=a,d=i,f=s;[i,a,s]=W.tidy(()=>{const p=Ye(a,[u,u],[n-u,1]),h=Pf(p),m=Ye(a,[u,u],[1,1]),g=Ys(Bf(m,0),La([[-1]]),La([[1]])),v=Je(m,he(g,h)),b=tt(p,v);b.shape[0]===1?i=Xs(o):i=mn([o,Ye(b,[1,0],[b.shape[0]-1,b.shape[1]])],0);const w=ns(tt(xt(g,v),h)),S=Ye(a,[u,0],[n-u,r]),I=he(w,i),E=Nh(i);if(u===0)a=Je(S,xt(I,xt(E,S)));else{const R=Je(S,xt(I,xt(E,S)));a=mn([Ye(a,[0,0],[u,r]),R],0)}const T=Nh(I),D=Ye(s,[0,u],[n,s.shape[1]-u]);if(u===0)s=Je(D,xt(xt(D,i),T));else{const R=Je(D,xt(xt(D,i),T));s=mn([Ye(s,[0,0],[n,u]),R],1)}return[i,a,s]}),cn([c,d,f])}return!e&&n>r&&(s=Ye(s,[0,0],[n,r]),a=Ye(a,[0,0],[r,r])),[s,a]})}const vO=P({qr_:yO});/** 3961 * @license 3962 * Copyright 2020 Google LLC. All Rights Reserved. 3963 * Licensed under the Apache License, Version 2.0 (the "License"); 3964 * you may not use this file except in compliance with the License. 3965 * You may obtain a copy of the License at 3966 * 3967 * http://www.apache.org/licenses/LICENSE-2.0 3968 * 3969 * Unless required by applicable law or agreed to in writing, software 3970 * distributed under the License is distributed on an "AS IS" BASIS, 3971 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3972 * See the License for the specific language governing permissions and 3973 * limitations under the License. 3974 * ============================================================================= 3975 */var Wn;(function(t){t[t.NONE=0]="NONE",t[t.MEAN=1]="MEAN",t[t.SUM=2]="SUM",t[t.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Wn||(Wn={}));function bO(t,e,n=Wn.SUM_BY_NONZERO_WEIGHTS){const r=C(t,"losses","computeWeightedLoss");let s=null;e!=null&&(s=C(e,"weights","computeWeightedLoss"));const a=s==null?r:he(r,s);if(n===Wn.NONE)return a;
vendor: 4,237 bytes, lines 3975-4023
3975if(n===Wn.SUM)return Mt(a);if(n===Wn.MEAN){if(s==null)return lu(a);{const o=r.size/s.size,i=tt(Mt(a),Mt(s));return o>1?tt(i,ot(o)):i}}if(n===Wn.SUM_BY_NONZERO_WEIGHTS){if(s==null)return tt(Mt(a),ot(r.size));{const o=he(s,Fa(r.shape)),i=Ut(Mt(Xw(o,ot(0))),"float32");return tt(Mt(a),i)}}throw Error("Unknown reduction: ".concat(n))}const Cs=P({computeWeightedLoss_:bO});/** 3976 * @license 3977 * Copyright 2020 Google LLC. All Rights Reserved. 3978 * Licensed under the Apache License, Version 2.0 (the "License"); 3979 * you may not use this file except in compliance with the License. 3980 * You may obtain a copy of the License at 3981 * 3982 * http://www.apache.org/licenses/LICENSE-2.0 3983 * 3984 * Unless required by applicable law or agreed to in writing, software 3985 * distributed under the License is distributed on an "AS IS" BASIS, 3986 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3987 * See the License for the specific language governing permissions and 3988 * limitations under the License. 3989 * ============================================================================= 3990 */function wO(t,e,n,r=Wn.SUM_BY_NONZERO_WEIGHTS){const s=C(t,"labels","absoluteDifference"),a=C(e,"predictions","absoluteDifference");let o=null;n!=null&&(o=C(n,"weights","absoluteDifference")),tr(s.shape,a.shape,"Error in absoluteDifference: ");const i=ir(Je(s,a));return Cs(i,o,r)}const SO=P({absoluteDifference_:wO});function xO(t,e,n,r,s=Wn.SUM_BY_NONZERO_WEIGHTS){const a=C(t,"labels","cosineDistance"),o=C(e,"predictions","cosineDistance");let i=null;r!=null&&(i=C(r,"weights","cosineDistance")),tr(a.shape,o.shape,"Error in cosineDistance: ");const l=ot(1),u=Je(l,Mt(he(a,o),n,!0));return Cs(u,i,s)}const _O=P({cosineDistance_:xO});function IO(t,e,n,r=Wn.SUM_BY_NONZERO_WEIGHTS){let s=C(t,"labels","hingeLoss");const a=C(e,"predictions","hingeLoss");let o=null;n!=null&&(o=C(n,"weights","hingeLoss")),tr(s.shape,a.shape,"Error in hingeLoss: ");const i=ot(1);s=Je(he(ot(2),s),i);const l=zf(Je(i,he(s,a)));return Cs(l,o,r)}const kO=P({hingeLoss_:IO});/** 3991 * @license 3992 * Copyright 2020 Google LLC. All Rights Reserved. 3993 * Licensed under the Apache License, Version 2.0 (the "License"); 3994 * you may not use this file except in compliance with the License. 3995 * You may obtain a copy of the License at 3996 * 3997 * http://www.apache.org/licenses/LICENSE-2.0 3998 * 3999 * Unless required by applicable law or agreed to in writing, software 4000 * distributed under the License is distributed on an "AS IS" BASIS, 4001 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4002 * See the License for the specific language governing permissions and 4003 * limitations under the License. 4004 * ============================================================================= 4005 */function EO(t,e,n,r=1,s=Wn.SUM_BY_NONZERO_WEIGHTS){const a=C(t,"labels","huberLoss"),o=C(e,"predictions","huberLoss");let i=null;n!=null&&(i=C(n,"weights","huberLoss")),tr(a.shape,o.shape,"Error in huberLoss: ");const l=ot(r),u=ir(Je(o,a)),c=uu(u,l),d=Je(u,c),f=Fe(he(ot(.5),Mr(c)),he(l,d));return Cs(f,i,s)}const TO=P({huberLoss_:EO});/** 4006 * @license 4007 * Copyright 2020 Google LLC. All Rights Reserved. 4008 * Licensed under the Apache License, Version 2.0 (the "License"); 4009 * you may not use this file except in compliance with the License. 4010 * You may obtain a copy of the License at 4011 * 4012 * http://www.apache.org/licenses/LICENSE-2.0 4013 * 4014 * Unless required by applicable law or agreed to in writing, software 4015 * distributed under the License is distributed on an "AS IS" BASIS, 4016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4017 * See the License for the specific language governing permissions and 4018 * limitations under the License. 4019 * ============================================================================= 4020 */function CO(t,e,n,r=1e-7,s=Wn.SUM_BY_NONZERO_WEIGHTS){const a=C(t,"labels","logLoss"),o=C(e,"predictions","logLoss");let i=null;n!=null&&(i=C(n,"weights","logLoss")),tr(a.shape,o.shape,"Error in logLoss: ");const l=ot(1),u=ot(r),c=ns(he(a,Ic(Fe(o,u)))),d=he(Je(l,a),Ic(Fe(Je(l,o),u))),f=Je(c,d);return Cs(f,i,s)}const NO=P({logLoss_:CO});/** 4021 * @license 4022 * Copyright 2020 Google LLC. All Rights Reserved. 4023 * Licensed under the Apache License, Version 2.0 (the "License");
4024 * you may not use this file except in compliance with the License. 4025 * You may obtain a copy of the License at 4026 * 4027 * http://www.apache.org/licenses/LICENSE-2.0 4028 * 4029 * Unless required by applicable law or agreed to in writing, software 4030 * distributed under the License is distributed on an "AS IS" BASIS, 4031 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4032 * See the License for the specific language governing permissions and 4033 * limitations under the License. 4034 * ============================================================================= 4035 */function AO(t,e,n,r=Wn.SUM_BY_NONZERO_WEIGHTS){const s=C(t,"labels","meanSquaredError"),a=C(e,"predictions","meanSquaredError");let o=null;n!=null&&(o=C(n,"weights","meanSquaredError")),tr(s.shape,a.shape,"Error in meanSquaredError: ");const i=r2(s,a);return Cs(i,o,r)}const $O=P({meanSquaredError_:AO});/** 4036 * @license 4037 * Copyright 2020 Google LLC. All Rights Reserved. 4038 * Licensed under the Apache License, Version 2.0 (the "License"); 4039 * you may not use this file except in compliance with the License. 4040 * You may obtain a copy of the License at 4041 * 4042 * http://www.apache.org/licenses/LICENSE-2.0 4043 * 4044 * Unless required by applicable law or agreed to in writing, software 4045 * distributed under the License is distributed on an "AS IS" BASIS, 4046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4047 * See the License for the specific language governing permissions and 4048 * limitations under the License. 4049 * ============================================================================= 4050 */function RO(t,e){const n=C(t,"labels","sigmoidCrossEntropyWithLogits"),r=C(e,"logits","sigmoidCrossEntropyWithLogits");tr(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");const s=zf(r),a=he(r,n),o=Hw(Ss(ns(ir(r))));return Fe(Je(s,a),o)}function DO(t,e,n,r=0,s=Wn.SUM_BY_NONZERO_WEIGHTS){let a=C(t,"multiClassLabels","sigmoidCrossEntropy");const o=C(e,"logits","sigmoidCrossEntropy");let i=null;if(n!=null&&(i=C(n,"weights","sigmoidCrossEntropy")),tr(a.shape,o.shape,"Error in sigmoidCrossEntropy: "),r>0){const u=ot(r),c=ot(1),d=ot(.5);a=Fe(he(a,Je(c,u)),he(d,u))}const l=RO(a,o);return Cs(l,i,s)}const FO=P({sigmoidCrossEntropy_:DO});/** 4051 * @license 4052 * Copyright 2020 Google LLC. All Rights Reserved. 4053 * Licensed under the Apache License, Version 2.0 (the "License"); 4054 * you may not use this file except in compliance with the License. 4055 * You may obtain a copy of the License at 4056 * 4057 * http://www.apache.org/licenses/LICENSE-2.0 4058 * 4059 * Unless required by applicable law or agreed to in writing, software 4060 * distributed under the License is distributed on an "AS IS" BASIS, 4061 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4062 * See the License for the specific language governing permissions and 4063 * limitations under the License. 4064 * ============================================================================= 4065 */function MO(t,e,n=-1){if(n===-1&&(n=e.rank-1),n!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet "+"supported. Labels / logits was rank ".concat(e.rank," ")+"and dim was ".concat(n));return xs((s,a,o)=>{const l=Vw(a,[n],!0),u=Je(Ut(a,"float32"),l);o([s,u]);const c=ns(he(u,s));return{value:Mt(c,[n]),gradFunc:(p,h)=>{const[m,g]=h,v=gn(p.shape,[n]);return[he(re(p,v),Je(Ut(m,"float32"),Ss(g))),he(re(p,v),Je(Ss(g),Ut(m,"float32")))]}}})(t,e)}function OO(t,e,n,r=0,s=Wn.SUM_BY_NONZERO_WEIGHTS){let a=C(t,"onehotLabels","softmaxCrossEntropy");const o=C(e,"logits","softmaxCrossEntropy");let i=null;if(n!=null&&(i=C(n,"weights","softmaxCrossEntropy")),tr(a.shape,o.shape,"Error in softmaxCrossEntropy: "),r>0){const u=ot(r),c=ot(1),d=ot(a.shape[1]);a=Fe(he(a,Je(c,u)),tt(u,d))}const l=MO(a,o);return Cs(l,i,s)}const PO=P({softmaxCrossEntropy_:OO});/** 4066 * @license 4067 * Copyright 2021 Google LLC. All Rights Reserved. 4068 * Licensed under the Apache License, Version 2.0 (the "License"); 4069 * you may not use this file except in compliance with the License. 4070 * You may obtain a copy of the License at 4071 * 4072 * http://www.apache.org/licenses/LICENSE-2.0 4073 * 4074 * Unless required by applicable law or agreed to in writing, softw
4074are 4075 * distributed under the License is distributed on an "AS IS" BASIS, 4076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4077 * See the License for the specific language governing permissions and 4078 * limitations under the License. 4079 * ============================================================================= 4080 */function BO(t,e,n,r){const s=C(t,"indices","sparseFillEmptyRows","int32"),a=C(e,"values","sparseFillEmptyRows"),o=C(n,"denseShape","sparseFillEmptyRows","int32"),i=C(r,"defaultValue","sparseFillEmptyRows",a.dtype);if(s.rank!==2)throw new Error("Indices should be Tensor2D but received shape\n ".concat(s.shape));if(a.rank!==1)throw new Error("Values should be Tensor1D but received shape ".concat(a.shape));if(o.rank!==1)throw new Error("Dense shape should be Tensor1D but received shape ".concat(o.shape));if(i.rank!==0)throw new Error("Default value should be a scalar but received shape ".concat(i.shape));const l={indices:s,values:a,denseShape:o,defaultValue:i},u=W.runKernel(tg,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}const LO=P({sparseFillEmptyRows_:BO});/** 4081 * @license 4082 * Copyright 2021 Google LLC. All Rights Reserved. 4083 * Licensed under the Apache License, Version 2.0 (the "License"); 4084 * you may not use this file except in compliance with the License. 4085 * You may obtain a copy of the License at 4086 * 4087 * http://www.apache.org/licenses/LICENSE-2.0 4088 * 4089 * Unless required by applicable law or agreed to in writing, software 4090 * distributed under the License is distributed on an "AS IS" BASIS, 4091 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4092 * See the License for the specific language governing permissions and 4093 * limitations under the License. 4094 * ============================================================================= 4095 */function WO(t,e,n){const r=C(t,"inputIndices","sparseReshape","int32"),s=C(e,"inputShape","sparseReshape","int32"),a=C(n,"newShape","sparseReshape","int32");if(r.rank!==2)throw new Error("Input indices should be Tensor2D but received shape\n ".concat(r.shape));if(s.rank!==1)throw new Error("Input shape should be Tensor1D but received shape ".concat(s.shape));if(a.rank!==1)throw new Error("New shape should be Tensor1D but received shape ".concat(a.shape));const o={inputIndices:r,inputShape:s,newShape:a},i=W.runKernel(_f,o);return{outputIndices:i[0],outputShape:i[1]}}const zO=P({sparseReshape_:WO});/** 4096 * @license 4097 * Copyright 2021 Google LLC. All Rights Reserved. 4098 * Licensed under the Apache License, Version 2.0 (the "License"); 4099 * you may not use this file except in compliance with the License. 4100 * You may obtain a copy of the License at 4101 * 4102 * http://www.apache.org/licenses/LICENSE-2.0 4103 * 4104 * Unless required by applicable law or agreed to in writing, software 4105 * distributed under the License is distributed on an "AS IS" BASIS, 4106 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4107 * See the License for the specific language governing permissions and 4108 * limitations under the License. 4109 * ============================================================================= 4110 */function HO(t,e,n){const r=C(t,"data","sparseSegmentMean"),s=C(e,"indices","sparseSegmentMean","int32"),a=C(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error("Indices should be Tensor1D but received shape\n ".concat(s.shape));if(a.rank!==1)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(a.shape));const o={data:r,indices:s,segmentIds:a};return W.runKernel(ng,o)}const UO=P({sparseSegmentMean_:HO});/** 4111 * @license 4112 * Copyright 2021 Google LLC. All Rights Reserved. 4113 * Licensed under the Apache License, Version 2.0 (the "License"); 4114 * you may not use this file except in compliance with the License. 4115 * You may obtain a copy of the License at 4116 * 4117 * http://www.apache.org/licenses/LICENSE-2.0 4118 * 4119 * Unless required by applicable law or agreed to in writing, softw
4119are 4120 * distributed under the License is distributed on an "AS IS" BASIS, 4121 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4122 * See the License for the specific language governing permissions and 4123 * limitations under the License. 4124 * ============================================================================= 4125 */function VO(t,e,n){const r=C(t,"data","sparseSegmentSum"),s=C(e,"indices","sparseSegmentSum","int32"),a=C(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.rank!==1)throw new Error("Indices should be Tensor1D but received shape\n ".concat(s.shape));if(a.rank!==1)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(a.shape));const o={data:r,indices:s,segmentIds:a};return W.runKernel(rg,o)}const jO=P({sparseSegmentSum_:VO});/** 4126 * @license 4127 * Copyright 2021 Google LLC. All Rights Reserved. 4128 * Licensed under the Apache License, Version 2.0 (the "License"); 4129 * you may not use this file except in compliance with the License. 4130 * You may obtain a copy of the License at 4131 * 4132 * http://www.apache.org/licenses/LICENSE-2.0 4133 * 4134 * Unless required by applicable law or agreed to in writing, software 4135 * distributed under the License is distributed on an "AS IS" BASIS, 4136 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4137 * See the License for the specific language governing permissions and 4138 * limitations under the License. 4139 * ============================================================================= 4140 */function GO(t,e,n,r,s,a,o,i){const l=C(t,"data","stringNGrams","string");if(l.dtype!=="string")throw new Error("Data must be of datatype string");if(l.shape.length!==1)throw new Error("Data must be a vector, saw: ".concat(l.shape));const u=C(e,"dataSplits","stringNGrams");if(u.dtype!=="int32")throw new Error("Data splits must be of datatype int32");const c={separator:n,nGramWidths:r,leftPad:s,rightPad:a,padWidth:o,preserveShortSequences:i},d={data:l,dataSplits:u},f=W.runKernel(ag,d,c);return{nGrams:f[0],nGramsSplits:f[1]}}const qO=P({stringNGrams_:GO});/** 4141 * @license 4142 * Copyright 2021 Google LLC. All Rights Reserved. 4143 * Licensed under the Apache License, Version 2.0 (the "License"); 4144 * you may not use this file except in compliance with the License. 4145 * You may obtain a copy of the License at 4146 * 4147 * http://www.apache.org/licenses/LICENSE-2.0 4148 * 4149 * Unless required by applicable law or agreed to in writing, software 4150 * distributed under the License is distributed on an "AS IS" BASIS, 4151 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4152 * See the License for the specific language governing permissions and 4153 * limitations under the License. 4154 * ============================================================================= 4155 */function KO(t,e,n=!0){const r=C(t,"input","stringSplit","string"),s=C(e,"delimiter","stringSplit","string");if(r.rank!==1)throw new Error("Input should be Tensor1D but received shape ".concat(r.shape));if(s.rank!==0)throw new Error("Delimiter should be a scalar but received shape ".concat(s.shape));const a={skipEmpty:n},o={input:r,delimiter:s},i=W.runKernel(og,o,a);return{indices:i[0],values:i[1],shape:i[2]}}const XO=P({stringSplit_:KO});/** 4156 * @license 4157 * Copyright 2021 Google LLC. All Rights Reserved. 4158 * Licensed under the Apache License, Version 2.0 (the "License"); 4159 * you may not use this file except in compliance with the License. 4160 * You may obtain a copy of the License at 4161 * 4162 * http://www.apache.org/licenses/LICENSE-2.0 4163 * 4164 * Unless required by applicable law or agreed to in writing, software 4165 * distributed under the License is distributed on an "AS IS" BASIS, 4166 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4167 * See the License for the specific language governing permissions and 4168 * limitations under the License. 4169 * ============================================================================= 4170 */function YO(t,e){const n=C(t,"input","stringToHashBucketFast","string"),r={numBuckets:e};if(e<=0)throw new Error("Number of buckets must be at least 1");const s={input:n};return W.runKernel(ig,s,r)}const JO=P({stringToHashBucketFast_:YO});/** 4171 * @license 4172 * Copyright 2023 Google LLC. 4173 * Licensed under the Apache License, Version 2.0 (the "License");
4174 * you may not use this file except in compliance with the License. 4175 * You may obtain a copy of the License at 4176 * 4177 * http://www.apache.org/licenses/LICENSE-2.0 4178 * 4179 * Unless required by applicable law or agreed to in writing, software 4180 * distributed under the License is distributed on an "AS IS" BASIS, 4181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4182 * See the License for the specific language governing permissions and 4183 * limitations under the License. 4184 * ============================================================================= 4185 */function QO(t,e,n,r=!0){const s=C(t,"input","staticRegexReplace","string"),a={pattern:e,rewrite:n,replaceGlobal:r};return W.runKernel(sg,{x:s},a)}const ZO=P({staticRegexReplace_:QO});/** 4186 * @license 4187 * Copyright 2020 Google LLC. All Rights Reserved. 4188 * Licensed under the Apache License, Version 2.0 (the "License"); 4189 * you may not use this file except in compliance with the License. 4190 * You may obtain a copy of the License at 4191 * 4192 * http://www.apache.org/licenses/LICENSE-2.0 4193 * 4194 * Unless required by applicable law or agreed to in writing, software 4195 * distributed under the License is distributed on an "AS IS" BASIS, 4196 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4197 * See the License for the specific language governing permissions and 4198 * limitations under the License. 4199 * ============================================================================= 4200 */const e6={fft:Eg,ifft:du,rfft:Tg,irfft:n2},t6={hammingWindow:kM,hannWindow:u2,frame:d2,stft:NM},Hf={flipLeftRight:DM,grayscaleToRGB:MM,resizeNearestNeighbor:iO,resizeBilinear:aO,rgbToGrayscale:PM,rotateWithOffset:LM,cropAndResize:$M,nonMaxSuppression:zM,nonMaxSuppressionAsync:XM,nonMaxSuppressionWithScore:JM,nonMaxSuppressionWithScoreAsync:ZM,nonMaxSuppressionPadded:tO,nonMaxSuppressionPaddedAsync:rO,threshold:uO,transform:fO},n6={bandPart:hO,gramSchmidt:gO,qr:vO},r6={absoluteDifference:SO,computeWeightedLoss:Cs,cosineDistance:_O,hingeLoss:kO,huberLoss:TO,logLoss:NO,meanSquaredError:$O,sigmoidCrossEntropy:FO,softmaxCrossEntropy:PO},s6={sparseFillEmptyRows:LO,sparseReshape:zO,sparseSegmentMean:UO,sparseSegmentSum:jO},a6={stringNGrams:qO,stringSplit:XO,stringToHashBucketFast:JO,staticRegexReplace:ZO};/** 4201 * @license 4202 * Copyright 2018 Google LLC. All Rights Reserved. 4203 * Licensed under the Apache License, Version 2.0 (the "License"); 4204 * you may not use this file except in compliance with the License. 4205 * You may obtain a copy of the License at 4206 * 4207 * http://www.apache.org/licenses/LICENSE-2.0 4208 * 4209 * Unless required by applicable law or agreed to in writing, software 4210 * distributed under the License is distributed on an "AS IS" BASIS, 4211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4212 * See the License for the specific language governing permissions and 4213 * limitations under the License. 4214 * ============================================================================= 4215 */const o6=new Map,i6=new Map;class c6{getClassName(){return this.constructor.className}static fromConfig(e,n){return new e(n)}}class Ca{constructor(){this.classNameMap={}}static getMap(){return Ca.instance==null&&(Ca.instance=new Ca),Ca.instance}static register(e){Ca.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function l6(t,e,n){A(t.className!=null,()=>"Class being registered does not have the static className property defined."),A(typeof t.className=="string",()=>"className is required to be a string, but got type "+typeof t.className),A(t.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof e>"u"&&(e="Custom"),typeof n>"u"&&(n=t.className);const r=n,s=e+">"+r;return Ca.register(t),o6.set(s,t),i6.set(t,s),t}/** 4216 * @license 4217 * Copyright 2018 Google LLC. All Rights Reserved. 4218 * Licensed under the Apache License, Version 2.0 (the "License"); 4219 * you may not use this file except in compliance with the License. 4220 * You may obtain a copy of the License at 4221 * 4222 * http://www.apache.org/licenses/LICENSE-2.0 4223 * 4224 * Unless required by applicable law or agreed to in writing, softw
4224are 4225 * distributed under the License is distributed on an "AS IS" BASIS, 4226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4227 * See the License for the specific language governing permissions and 4228 * limitations under the License. 4229 * ============================================================================= 4230 */class ao extends c6{minimize(e,n=!1,r){const{value:s,grads:a}=this.computeGradients(e,r);if(r!=null){const o=r.map(i=>({name:i.name,tensor:a[i.name]}));this.applyGradients(o)}else this.applyGradients(a);return cn(a),n?s:(s.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,n){return K$(e,n)}dispose(){this.iterations_!=null&&cn(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:ot(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for this optimizer class "+"".concat(this.getClassName()))}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(ao,Symbol.hasInstance,{value:t=>t.minimize!=null&&t.computeGradients!=null&&t.applyGradients!=null});/** 4231 * @license 4232 * Copyright 2018 Google LLC. All Rights Reserved. 4233 * Licensed under the Apache License, Version 2.0 (the "License"); 4234 * you may not use this file except in compliance with the License. 4235 * You may obtain a copy of the License at 4236 * 4237 * http://www.apache.org/licenses/LICENSE-2.0 4238 * 4239 * Unless required by applicable law or agreed to in writing, software 4240 * distributed under the License is distributed on an "AS IS" BASIS, 4241 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4242 * See the License for the specific language governing permissions and 4243 * limitations under the License. 4244 * ============================================================================= 4245 */class u6 extends ao{static get className(){return"Adadelta"}constructor(e,n,r=null){super(),this.learningRate=e,this.rho=n,this.epsilon=r,this.accumulatedGrads=[],this.accumulatedUpdates=[],r==null&&(this.epsilon=W.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const a=W.registeredVariables[r],o=!1;this.accumulatedGrads[s]==null&&(this.accumulatedGrads[s]={originalName:"".concat(r,"/accum_grad"),variable:nt(()=>lr(a).variable(o))}),this.accumulatedUpdates[s]==null&&(this.accumulatedUpdates[s]={originalName:"".concat(r,"/accum_var"),variable:nt(()=>lr(a).variable(o))});const i=Array.isArray(e)?e[s].tensor:e[r];if(i==null)return;const l=this.accumulatedGrads[s].variable,u=this.accumulatedUpdates[s].variable;nt(()=>{const c=Fe(he(l,this.rho),he(Mr(i),1-this.rho)),d=he(tt(ws(Fe(u,this.epsilon)),ws(Fe(l,this.epsilon))),i),f=Fe(he(u,this.rho),he(Mr(d),1-this.rho));l.assign(c),u.assign(f);const p=Fe(he(d,-this.learningRate),a);a.assign(p)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(cn(this.accumulatedGrads.map(e=>e.variable)),cn(this.accumulatedUpdates.map(e=>e.variable)))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=e.length/2,r=!1;this.accumulatedGrads=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedUpdates=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,n){return new e(n.learningRate,n.rho,n.epsilon)}}/** 4246 * @license 4247 * Copyright 2018 Google LLC. All Rights Reserved. 4248 * Licensed under the Apache License, Version 2.0 (the "License"); 4249 * you may not use this file except in compliance with the License. 4250 * You may obtain a copy of the License at 4251 * 4252 * http://www.apache.org/licenses/LICENSE-2.0 4253 * 4254 * Unless required by applicable law or agreed to in writing, softw
4254are 4255 * distributed under the License is distributed on an "AS IS" BASIS, 4256 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4257 * See the License for the specific language governing permissions and 4258 * limitations under the License. 4259 * ============================================================================= 4260 */class d6 extends ao{static get className(){return"Adagrad"}constructor(e,n=.1){super(),this.learningRate=e,this.initialAccumulatorValue=n,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const a=W.registeredVariables[r];this.accumulatedGrads[s]==null&&(this.accumulatedGrads[s]={originalName:"".concat(r,"/accumulator"),variable:nt(()=>Uc(a.shape,this.initialAccumulatorValue).variable(!1))});const o=Array.isArray(e)?e[s].tensor:e[r];if(o==null)return;const i=this.accumulatedGrads[s].variable;nt(()=>{const l=Fe(i,Mr(o));i.assign(l);const u=Fe(he(tt(o,ws(Fe(l,W.backend.epsilon()))),-this.learningRate),a);a.assign(u)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&cn(this.accumulatedGrads.map(e=>e.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=!1;this.accumulatedGrads=e.map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,n){return new e(n.learningRate,n.initialAccumulatorValue)}}/** 4261 * @license 4262 * Copyright 2018 Google LLC. All Rights Reserved. 4263 * Licensed under the Apache License, Version 2.0 (the "License"); 4264 * you may not use this file except in compliance with the License. 4265 * You may obtain a copy of the License at 4266 * 4267 * http://www.apache.org/licenses/LICENSE-2.0 4268 * 4269 * Unless required by applicable law or agreed to in writing, software 4270 * distributed under the License is distributed on an "AS IS" BASIS, 4271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4272 * See the License for the specific language governing permissions and 4273 * limitations under the License. 4274 * ============================================================================= 4275 */class f6 extends ao{static get className(){return"Adam"}constructor(e,n,r,s=null){super(),this.learningRate=e,this.beta1=n,this.beta2=r,this.epsilon=s,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],nt(()=>{this.accBeta1=ot(n).variable(),this.accBeta2=ot(r).variable()}),s==null&&(this.epsilon=W.backend.epsilon())}applyGradients(e){const n=Array.isArray(e)?e.map(r=>r.name):Object.keys(e);nt(()=>{const r=Je(1,this.accBeta1),s=Je(1,this.accBeta2);n.forEach((a,o)=>{const i=W.registeredVariables[a],l=!1;this.accumulatedFirstMoment[o]==null&&(this.accumulatedFirstMoment[o]={originalName:"".concat(a,"/m"),variable:nt(()=>lr(i).variable(l))}),this.accumulatedSecondMoment[o]==null&&(this.accumulatedSecondMoment[o]={originalName:"".concat(a,"/v"),variable:nt(()=>lr(i).variable(l))});const u=Array.isArray(e)?e[o].tensor:e[a];if(u==null)return;const c=this.accumulatedFirstMoment[o].variable,d=this.accumulatedSecondMoment[o].variable,f=Fe(he(c,this.beta1),he(u,1-this.beta1)),p=Fe(he(d,this.beta2),he(Mr(u),1-this.beta2)),h=tt(f,r),m=tt(p,s);c.assign(f),d.assign(p);const g=Fe(he(tt(h,Fe(ws(m),this.epsilon)),-this.learningRate),i);i.assign(g)}),this.accBeta1.assign(he(this.accBeta1,this.beta1)),this.accBeta2.assign(he(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&cn(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedSecondMoment!=null&&cn(this.accumulatedSecondMoment.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable})))}async setWeights(e){e=await this.extractIterations(e),nt(()=>{this.accBeta1.assign(_c(this.beta1,this.iterations_+1)),this.accBeta2.assign(_c(this.beta2,this.iterations_+1))});const n=e.length/2,r=!1;this.accumulatedFirstMoment=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedSecondMoment=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,n){return new e(n.learningRate,n.beta1,n.beta2,n.epsilon)}}/** 4276 * @license 4277 * Copyright 2018 Google LLC. All Rights Reserved. 4278 * Licensed under the Apache License, Version 2.0 (the "License");
4279 * you may not use this file except in compliance with the License. 4280 * You may obtain a copy of the License at 4281 * 4282 * http://www.apache.org/licenses/LICENSE-2.0 4283 * 4284 * Unless required by applicable law or agreed to in writing, software 4285 * distributed under the License is distributed on an "AS IS" BASIS, 4286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4287 * See the License for the specific language governing permissions and 4288 * limitations under the License. 4289 * ============================================================================= 4290 */class p6 extends ao{static get className(){return"Adamax"}constructor(e,n,r,s=null,a=0){super(),this.learningRate=e,this.beta1=n,this.beta2=r,this.epsilon=s,this.decay=a,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],nt(()=>{this.iteration=ot(0).variable(),this.accBeta1=ot(n).variable()}),s==null&&(this.epsilon=W.backend.epsilon())}applyGradients(e){const n=Array.isArray(e)?e.map(r=>r.name):Object.keys(e);nt(()=>{const r=Je(1,this.accBeta1),s=tt(-this.learningRate,Fe(he(this.iteration,this.decay),1));n.forEach((a,o)=>{const i=W.registeredVariables[a],l=!1;this.accumulatedFirstMoment[o]==null&&(this.accumulatedFirstMoment[o]={originalName:"".concat(a,"/m"),variable:lr(i).variable(l)}),this.accumulatedWeightedInfNorm[o]==null&&(this.accumulatedWeightedInfNorm[o]={originalName:"".concat(a,"/v"),variable:lr(i).variable(l)});const u=Array.isArray(e)?e[o].tensor:e[a];if(u==null)return;const c=this.accumulatedFirstMoment[o].variable,d=this.accumulatedWeightedInfNorm[o].variable,f=Fe(he(c,this.beta1),he(u,1-this.beta1)),p=he(d,this.beta2),h=ir(u),m=Kw(p,h);c.assign(f),d.assign(m);const g=Fe(he(tt(s,r),tt(f,Fe(m,this.epsilon))),i);i.assign(g)}),this.iteration.assign(Fe(this.iteration,1)),this.accBeta1.assign(he(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&cn(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&cn(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,n){return new e(n.learningRate,n.beta1,n.beta2,n.epsilon,n.decay)}}/** 4291 * @license 4292 * Copyright 2018 Google LLC. All Rights Reserved. 4293 * Licensed under the Apache License, Version 2.0 (the "License"); 4294 * you may not use this file except in compliance with the License. 4295 * You may obtain a copy of the License at 4296 * 4297 * http://www.apache.org/licenses/LICENSE-2.0 4298 * 4299 * Unless required by applicable law or agreed to in writing, software 4300 * distributed under the License is distributed on an "AS IS" BASIS, 4301 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4302 * See the License for the specific language governing permissions and 4303 * limitations under the License. 4304 * ============================================================================= 4305 */class m2 extends ao{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const a=Array.isArray(e)?e[s].tensor:e[r];if(a==null)return;const o=W.registeredVariables[r];nt(()=>{const i=Fe(he(this.c,a),o);o.assign(i)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Qr(ot(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,n){return new e(n.learningRate)}}/** 4306 * @license 4307 * Copyright 2018 Google LLC. All Rights Reserved. 4308 * Licensed under the Apache License, Version 2.0 (the "License");
4309 * you may not use this file except in compliance with the License. 4310 * You may obtain a copy of the License at 4311 * 4312 * http://www.apache.org/licenses/LICENSE-2.0 4313 * 4314 * Unless required by applicable law or agreed to in writing, software 4315 * distributed under the License is distributed on an "AS IS" BASIS, 4316 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4317 * See the License for the specific language governing permissions and 4318 * limitations under the License. 4319 * ============================================================================= 4320 */class h6 extends m2{static get className(){return"Momentum"}constructor(e,n,r=!1){super(e),this.learningRate=e,this.momentum=n,this.useNesterov=r,this.accumulations=[],this.m=ot(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const a=W.registeredVariables[r];this.accumulations[s]==null&&(this.accumulations[s]={originalName:"".concat(r,"/momentum"),variable:nt(()=>lr(a).variable(!1))});const o=this.accumulations[s].variable,i=Array.isArray(e)?e[s].tensor:e[r];i!=null&&nt(()=>{let l;const u=Fe(he(this.m,o),i);this.useNesterov?l=Fe(he(this.c,Fe(i,he(u,this.m))),a):l=Fe(he(this.c,u),a),o.assign(u),a.assign(l)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&cn(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const n=!1;this.accumulations=e.map(r=>({originalName:r.name,variable:r.tensor.variable(n)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,n){return new e(n.learningRate,n.momentum,n.useNesterov)}}/** 4321 * @license 4322 * Copyright 2018 Google LLC. All Rights Reserved. 4323 * Licensed under the Apache License, Version 2.0 (the "License"); 4324 * you may not use this file except in compliance with the License. 4325 * You may obtain a copy of the License at 4326 * 4327 * http://www.apache.org/licenses/LICENSE-2.0 4328 * 4329 * Unless required by applicable law or agreed to in writing, software 4330 * distributed under the License is distributed on an "AS IS" BASIS, 4331 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4332 * See the License for the specific language governing permissions and 4333 * limitations under the License. 4334 * ============================================================================= 4335 */class m6 extends ao{static get className(){return"RMSProp"}constructor(e,n=.9,r=0,s=null,a=!1){if(super(),this.learningRate=e,this.decay=n,this.momentum=r,this.epsilon=s,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=a,s==null&&(this.epsilon=W.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map(r=>r.name):Object.keys(e)).forEach((r,s)=>{const a=W.registeredVariables[r],o=!1;this.accumulatedMeanSquares[s]==null&&(this.accumulatedMeanSquares[s]={originalName:"".concat(r,"/rms"),variable:nt(()=>lr(a).variable(o))}),this.accumulatedMoments[s]==null&&(this.accumulatedMoments[s]={originalName:"".concat(r,"/momentum"),variable:nt(()=>lr(a).variable(o))}),this.accumulatedMeanGrads[s]==null&&this.centered&&(this.accumulatedMeanGrads[s]={originalName:"".concat(r,"/mg"),variable:nt(()=>lr(a).variable(o))});const i=Array.isArray(e)?e[s].tensor:e[r];if(i==null)return;const l=this.accumulatedMeanSquares[s].variable,u=this.accumulatedMoments[s].variable;nt(()=>{const c=Fe(he(l,this.decay),he(Mr(i),1-this.decay));if(this.centered){const d=this.accumulatedMeanGrads[s].variable,f=Fe(he(d,this.decay),he(i,1-this.decay)),p=tt(he(i,this.learningRate),ws(Je(c,Fe(Mr(f),this.epsilon)))),h=Fe(he(u,this.momentum),p);l.assign(c),d.assign(f),u.assign(h);const m=Je(a,h);a.assign(m)}else{const d=Fe(he(l,this.decay),he(Mr(i),1-this.decay)),f=Fe(he(u,this.momentum),tt(he(i,this.learningRate),ws(Fe(d,this.epsilon))));l.assign(d),u.assign(f);const p=Je(a,f);a.assign(p)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&cn(this.accumulatedMeanSquares.map(e=>e.variable)),this.accumulatedMeanGrads!=null&&this.centered&&cn(this.accumulatedMeanGrads.map(e=>e.variable)),this.accumulatedMoments!=null&&cn(this.accumulatedMoments.map(e=>e.variable))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map(n=>({name:n.originalName,tensor:n.variable}
4335)))}async setWeights(e){e=await this.extractIterations(e);const n=this.centered?e.length/3:e.length/2,r=!1;this.accumulatedMeanSquares=e.slice(0,n).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.accumulatedMoments=e.slice(n,n*2).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})),this.centered&&(this.accumulatedMeanGrads=e.slice(n*2,n*3).map(s=>({originalName:s.name,variable:s.tensor.variable(r)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,n){return new e(n.learningRate,n.decay,n.momentum,n.epsilon,n.centered)}}/** 4336 * @license 4337 * Copyright 2022 Google LLC. 4338 * Licensed under the Apache License, Version 2.0 (the "License"); 4339 * you may not use this file except in compliance with the License. 4340 * You may obtain a copy of the License at 4341 * 4342 * http://www.apache.org/licenses/LICENSE-2.0 4343 * 4344 * Unless required by applicable law or agreed to in writing, software 4345 * distributed under the License is distributed on an "AS IS" BASIS, 4346 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4347 * See the License for the specific language governing permissions and 4348 * limitations under the License. 4349 * ============================================================================= 4350 */const g6=[u6,d6,f6,p6,h6,m6,m2];function y6(){for(const t of g6)l6(t)}/** 4351 * @license 4352 * Copyright 2018 Google LLC. All Rights Reserved. 4353 * Licensed under the Apache License, Version 2.0 (the "License"); 4354 * you may not use this file except in compliance with the License. 4355 * You may obtain a copy of the License at 4356 * 4357 * http://www.apache.org/licenses/LICENSE-2.0 4358 * 4359 * Unless required by applicable law or agreed to in writing, software 4360 * distributed under the License is distributed on an "AS IS" BASIS, 4361 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4362 * See the License for the specific language governing permissions and 4363 * limitations under the License. 4364 * ============================================================================= 4365 */const v6="model",b6=".json",w6=".weights.bin";function Cv(t){return new Promise(e=>setTimeout(e)).then(t)}class ja{constructor(e){if(!Qe().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(ja.URL_SCHEME)&&(e=e.slice(ja.URL_SCHEME.length)),(e==null||e.length===0)&&(e=v6),this.modelJsonFileName=e+b6,this.weightDataFileName=e+w6}async save(e){if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");const n=Lr.join(e.weightData),r=window.URL.createObjectURL(new Blob([n],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const s=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],a=hw(e,s),o=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),i=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(i.download=this.modelJsonFileName,i.href=o,await Cv(()=>i.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){const l=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;l.download=this.weightDataFileName,l.href=r,await Cv(()=>l.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:Hc(e)}}}}ja.URL_SCHEME="downloads://";class S6{constructor(e){if(e==null||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)}async load(){return new Promise((e,n)=>{const r=new FileReader;r.onload=s=>{const a=JSON.parse(s.target.result),o=a.modelTopology;if(o==null){n(new Error("modelTopology field is missing from file ".concat(this.jsonFile.name)));return}if(a.weightsManifest==null){n(new Error("weightManifest field is missing from file ".concat(this.jsonFile.name)));return}if(this.weightsFiles.length===0){e({modelTopology:o});return}const l=hg(a,u=>this.loadWeights(u));e(l)},r.onerror=s=>n("Failed to read model topology and weights manifest JSON "+"from file '".concat(this.jsonFile.name,"'. BrowserFiles supports loading ")+"Keras-style tf.Model artifacts only."),r.readAsText(this.jsonFile)})}loadWeights(e){const n=[],r=[];for(const o of e)n.push(...o.weights),r.push(...o.paths);const s=this.checkManifestAndWeightFiles(e),a=r.map(o=>this.loadWeightsFile(o,s[o]));return Promise.all(a).then(o=>[n,o])}loadWeightsFile(e,n){return new Promise((r,s)=>{const a=new FileReader;a.onload=o=>{const i=o.target.result;r(i)},a.onerror=o=>s("Failed to weights data from file of path '".concat(e,"'.")),a.readAsArrayBuffer(n)})}checkManifestAndWeightFiles(e){const n=[],r=this.weightsFiles.map(a=>Iv(a.name)),s={};for(const a of e)a.paths.forEach(o=>{const i=Iv(o);if(n.indexOf(i)!==-1)throw new Error("Duplicate file basename found in weights manifest: "+"'".concat(i,"'"));if(n.push(i),r.indexOf(i)===-1)throw new Error("Weight file with basename '".concat(i,"' is not provided."));s[o]=this.weightsFiles[r.indexOf(i)]});if(n.length!==this.weightsFiles.length)throw new Error("Mismatch in the number of files in weights manifest "+"(".concat(n.length,") and the number of weight files provided ")+"(".concat(this.weightsFiles.length,")."));return s}}const x6=t=>
4365Qe().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(ja.URL_SCHEME)?_6(t.slice(ja.URL_SCHEME.length)):null;zt.registerSaveRouter(x6);function _6(t="model"){return new ja(t)}function I6(t){return new S6(t)}/** 4366 * @license 4367 * Copyright 2019 Google LLC. All Rights Reserved. 4368 * Licensed under the Apache License, Version 2.0 (the "License"); 4369 * you may not use this file except in compliance with the License. 4370 * You may obtain a copy of the License at 4371 * 4372 * http://www.apache.org/licenses/LICENSE-2.0 4373 * 4374 * Unless required by applicable law or agreed to in writing, software 4375 * distributed under the License is distributed on an "AS IS" BASIS, 4376 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4377 * See the License for the specific language governing permissions and 4378 * limitations under the License. 4379 * ============================================================================= 4380 */function Nv(t,e,n,r){o(t),n=n==null?0:n,r=r==null?1:r,i(n,r);let s=0;const a=l=>(l.then(u=>{const c=n+ ++s/t.length*(r-n);return e(c),u}),l);function o(l){A(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function i(l,u){A(l>=0&&l<=1,()=>"Progress fraction must be in range [0, 1], but "+"got startFraction ".concat(l)),A(u>=0&&u<=1,()=>"Progress fraction must be in range [0, 1], but "+"got endFraction ".concat(u)),A(u>=l,()=>"startFraction must be no more than endFraction, but "+"got startFraction ".concat(l," and endFraction ")+"".concat(u))}return Promise.all(t.map(a))}/** 4381 * @license 4382 * Copyright 2018 Google LLC. All Rights Reserved. 4383 * Licensed under the Apache License, Version 2.0 (the "License"); 4384 * you may not use this file except in compliance with the License. 4385 * You may obtain a copy of the License at 4386 * 4387 * http://www.apache.org/licenses/LICENSE-2.0 4388 * 4389 * Unless required by applicable law or agreed to in writing, software 4390 * distributed under the License is distributed on an "AS IS" BASIS, 4391 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4392 * See the License for the specific language governing permissions and 4393 * limitations under the License. 4394 * ============================================================================= 4395 */async function g2(t,e){e==null&&(e={});const n=e.fetchFunc==null?Qe().platform.fetch:e.fetchFunc,r=t.map(d=>n(d,e.requestInit,{isBinary:!0})),s=0,a=.5,i=(e.onProgress==null?await Promise.all(r):await Nv(r,e.onProgress,s,a)).map(d=>d.arrayBuffer()),l=.5,u=1;return e.onProgress==null?await Promise.all(i):await Nv(i,e.onProgress,l,u)}async function k6(t,e="",n,r){return y2(o=>g2(o,{requestInit:r}))(t,e,n)}function y2(t){return async(e,n="",r)=>{const s=e.map(()=>!1),a={},o=r!=null?r.map(()=>!1):[],i=[];if(e.forEach((p,h)=>{let m=0;p.weights.forEach(g=>{const v="quantization"in g?g.quantization.dtype:g.dtype,b=wh[v]*J(g.shape),w=()=>{s[h]=!0,a[h]==null&&(a[h]=[]),a[h].push({manifestEntry:g,groupOffset:m,sizeBytes:b})};r!=null?r.forEach((S,I)=>{S===g.name&&(w(),o[I]=!0)}):w(),i.push(g.name),m+=b})}),!o.every(p=>p)){const p=r.filter((h,m)=>!o[m]);throw new Error("Could not find weights in manifest with names: "+"".concat(p.join(", "),". \n")+"Manifest JSON has weights with names: "+"".concat(i.join(", "),"."))}const l=s.reduce((p,h,m)=>(h&&p.push(m),p),[]),u=[];l.forEach(p=>{e[p].paths.forEach(h=>{const m=n+(n.endsWith("/")?"":"/")+h;u.push(m)})});const c=await t(u),d={};let f=0;return l.forEach(p=>{const h=e[p].paths.length,m=new Lr(c.slice(f,f+h));a[p].forEach(v=>{const b=m.slice(v.groupOffset,v.groupOffset+v.sizeBytes),w=pw(b,[v.manifestEntry]);for(const S in w)d[S]=w[S]}),f+=h}),d}}/** 4396 * @license 4397 * Copyright 2018 Google LLC. All Rights Reserved. 4398 * Licensed under the Apache License, Version 2.0 (the "License"); 4399 * you may not use this file except in compliance with the License. 4400 * You may obtain a copy of the License at 4401 * 4402 * http://www.apache.org/licenses/LICENSE-2.0 4403 * 4404 * Unless required by applicable law or agreed to in writing, software 4405 * distributed under the License is distributed on an "AS IS" BASIS, 4406 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4407 * See the License for the specific language governing permissions and 4408 * limitations under the License. 4409 * ============================================================================= 4410 */const E6="application/octet-stream",T6="application/json";class Fg{constructor(e,n){if(this.DEFAULT_METHOD="POST",n==null&&(n={}),this.weightPathPrefix=n.weightPathPrefix,this.onProgress=n.onProgress,this.weightUrlConverter=n.weightUrlConverter,n.fetchFunc!=null?(A(typeof n.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=n.fetchFunc):this.fetch=Qe().platform.fetch,A(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&A(e.length===2,()=>"URL paths for http must have a length of 2, "+"(actual length is ".concat(e.length,").")),this.path=e,n.requestInit!=null&&n.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=n.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const n=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);n.body=new FormData;const r=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],s=hw(e,r);if(n.body.append("model.json",new Blob([JSON.stringify(s)],{type:T6}),"model.json"),e.weightData!=null){const o=Lr.join(e.weightData);n.body.append("model.weights.bin",new Blob([o],{type:E6}
4410),"model.weights.bin")}const a=await this.fetch(this.path,n);if(a.ok)return{modelArtifactsInfo:Hc(e),responses:[a]};throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+"".concat(a.status,"."))}async load(){const e=await this.fetch(this.path,this.requestInit);if(!e.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.");let n;try{n=await e.json()}catch(a){let o="Failed to parse model JSON of response from ".concat(this.path,".");throw this.path.endsWith(".pb")?o+=" 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.":o+=" Please make sure the server is serving valid JSON for this request.",new Error(o)}const r=n.modelTopology,s=n.weightsManifest;if(r==null&&s==null)throw new Error("The JSON from HTTP path ".concat(this.path," contains
4410neither model ")+"topology or manifest for weights.");return hg(n,a=>this.loadWeights(a))}async loadWeights(e){const n=Array.isArray(this.path)?this.path[1]:this.path,[r,s]=C6(n),a=this.weightPathPrefix||r,o=gw(e),i=[],l=[];for(const c of e)for(const d of c.paths)this.weightUrlConverter!=null?l.push(this.weightUrlConverter(d)):i.push(a+d+s);this.weightUrlConverter&&i.push(...await Promise.all(l));const u=await g2(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[o,u]}}Fg.URL_SCHEME_REGEX=/^https?:\/\//;function C6(t){const e=t.lastIndexOf("/"),n=t.lastIndexOf("?"),r=t.substring(0,e),s=n>e?t.substring(n):"";return[r+"/",s]}function Ah(t){return t.match(Fg.URL_SCHEME_REGEX)!=null}const v2=(t,e)=>{if(typeof fetch>"u"&&(e==null||e.fetchFunc==null))return null;{let n=!0;if(Array.isArray(t)?n=t.every(r=>Ah(r)):n=Ah(t),n)return Mg(t,e)}return null};zt.registerSaveRouter(v2);zt.registerLoadRouter(v2);function Mg(t,e){return new Fg(t,e)}function N6(t,e){return Mg(t,e)}/** 4411 * @license 4412 * Copyright 2018 Google LLC. All Rights Reserved. 4413 * Licensed under the Apache License, Version 2.0 (the "License"); 4414 * you may not use this file except in compliance with the License. 4415 * You may obtain a copy of the License at 4416 * 4417 * http://www.apache.org/licenses/LICENSE-2.0 4418 * 4419 * Unless required by applicable law or agreed to in writing, software 4420 * distributed under the License is distributed on an "AS IS" BASIS, 4421 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4422 * See the License for the specific language governing permissions and 4423 * limitations under the License. 4424 * ============================================================================= 4425 */class _p{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class b2{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class A6{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=n=>Promise.resolve(e.save(n)))}}function $6(t,e,n,r){const s=arguments;return new A6(w2(...s))}function w2(t,e,n,r){return arguments.length===1?t.modelTopology!=null||t.weightSpecs!=null?new _p(t):(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 _p({modelTopology:t})):(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 _p({modelTopology:t,weightSpecs:e,weightData:n,trainingConfig:r}))}function R6(t){return new b2(t)}function D6(t){return new b2(t)}/** 4426 * @license 4427 * Copyright 2018 Google LLC. All Rights Reserved. 4428 * Licensed under the Apache License, Version 2.0 (the "License"); 4429 * you may not use this file except in compliance with the License. 4430 * You may obtain a copy of the License at 4431 * 4432 * http://www.apache.org/licenses/LICENSE-2.0 4433 * 4434 * Unless required by applicable law or agreed to in writing, software 4435 * distributed under the License is distributed on an "AS IS" BASIS, 4436 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4437 * See the License for the specific language governing permissions and 4438 * limitations under the License. 4439 * ============================================================================= 4440 */const S2=Object.freeze(Object.defineProperty({__proto__:null,CompositeArrayBuffer:Lr,browserFiles:I6,browserHTTPRequest:N6,concatenateArrayBuffers:$N,copyModel:ZN,decodeWeights:pw,encodeWeights:TN,fromMemory:$6,fromMemorySync:w2,getLoadHandlers:LN,getModelArtifactsForJSON:hg,getModelArtifactsForJSONSync:mw,getModelArtifactsInfoForJSON:Hc,getSaveHandlers:BN,getWeightSpecs:gw,http:Mg,isHTTPScheme:Ah,listModels:JN,loadWeights:k6,moveModel:eA,registerLoadRouter:PN,registerSaveRouter:ON,removeModel:QN,weightsLoaderFactory:y2,withSaveHandler:R6,withSaveHandlerSync:D6},Symbol.toStringTag,{value:"Module"}));/** 4441 * @license 4442 * Copyright 2019 Google LLC. All Rights Reserved. 4443 * Licensed under the Apache License, Version 2.0 (the "License");
4444 * you may not use this file except in compliance with the License. 4445 * You may obtain a copy of the License at 4446 * 4447 * http://www.apache.org/licenses/LICENSE-2.0 4448 * 4449 * Unless required by applicable law or agreed to in writing, software 4450 * distributed under the License is distributed on an "AS IS" BASIS, 4451 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4452 * See the License for the specific language governing permissions and 4453 * limitations under the License. 4454 * ============================================================================= 4455 */let Sa,Av=!1;function F6(t,e=3){if(e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(t==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,s=!1,a=!1,o=!1,i=!1;if(t.data instanceof Uint8Array)n=!0;else if(typeof ImageData<"u"&&t instanceof ImageData)r=!0;else if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)s=!0;else if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement)a=!0;else if(t.getContext!=null)o=!0;else if(typeof ImageBitmap<"u"&&t instanceof ImageBitmap)i=!0;else 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(t.constructor.name));if(tu(uv,W.backendName)!=null){const h={pixels:t},m={numChannels:e};return W.runKernel(uv,h,m)}const[u,c]=s?[t.videoWidth,t.videoHeight]:[t.width,t.height];let d;if(o)d=t.getContext("2d").getImageData(0,0,u,c).data;else if(r||n)d=t.data;else if(a||s||i){if(Sa==null)if(typeof document>"u")if(typeof OffscreenCanvas<"u"&&typeof OffscreenCanvasRenderingContext2D<"u")Sa=new OffscreenCanvas(1,1).getContext("2d");else throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");else Sa=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});Sa.canvas.width=u,Sa.canvas.height=c,Sa.drawImage(t,0,0,u,c),d=Sa.getImageData(0,0,u,c).data}let f;if(e===4)f=new Int32Array(d);else{const h=u*c;f=new Int32Array(h*e);for(let m=0;m<h;m++)for(let g=0;g<e;++g)f[m*e+g]=d[m*4+g]}return a2(f,[c,u,e],"int32")}function M6(t){if(t.rank!==2&&t.rank!==3)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank ".concat(t.rank,"."));const e=t.rank===2?1:t.shape[2];if(e>4||e===2)throw new Error("toPixels only supports depth of size "+"1, 3 or 4 but got ".concat(e));if(t.dtype!=="float32"&&t.dtype!=="int32")throw new Error("Unsupported type for toPixels: ".concat(t.dtype,".")+" Please use float32 or int32 tensors.")}async function O6(t,e){let n=C(t,"img","toPixels");if(!(t instanceof Zt)){const u=n;n=Ut(u,"int32"),u.dispose()}M6(n);const[r,s]=n.shape.slice(0,2),a=n.rank===2?1:n.shape[2],o=await n.data(),i=n.dtype==="float32"?255:1,l=new Uint8ClampedArray(s*r*4);for(let u=0;u<r*s;++u){const c=[0,0,0,255];for(let f=0;f<a;f++){const p=o[u*a+f];if(n.dtype==="float32"){if(p<0||p>1)throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(p,"."))}else if(n.dtype==="int32"&&(p<0||p>255))throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(p,"."));a===1?(c[0]=p*i,c[1]=p*i,c[2]=p*i):c[f]=p*i}const d=u*4;l[d+0]=Math.round(c[0]),l[d+1]=Math.round(c[1]),l[d+2]=Math.round(c[2]),l[d+3]=Math.round(c[3])}if(e!=null){Av||tu(M1,W.backendName)!=null&&(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),Av=!0),e.width=s,e.height=r;const u=e.getContext("2d"),c=new ImageData(l,s,r);u.putImageData(c,0,0)}return n!==t&&n.dispose(),l}const P6=P({fromPixels_:F6});function x2(t,e){const n=t.shape.length,r=e.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(e.dtype!=="int32")throw new Error("tf.gatherND() expects the indices to be int32 type,"+" but the dtype was ".concat(e.dtype,"."));if(e.shape[r-1]>n)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+"".concat(e.shape[r-1]," vs. ").concat(n));if(J(t.shape)===0)throw new Error("Requested more than 0 entries, but input is empty."+" Input shape: ".concat(t.shape,"."));const s=e.shape,a=s[s.length-1];let o=1;for(let d=0;d<s.length-1;++d)o*=s[d];const i=t.shape,l=s.slice();l.pop();let u=1;for(let d=a;d<n;++d)u*=i[d],l.push(i[d]);const c=[...Ie(t.shape).map(d=>d/u),1].slice(0,a);return[l,o,u,c]}/** 4456 * @license 4457 * Copyright 2021 Google LLC. All Rights Reserved. 4458 * Licensed under the Apache License, Version 2.0 (the "License");
4459 * you may not use this file except in compliance with the License. 4460 * You may obtain a copy of the License at 4461 * 4462 * http://www.apache.org/licenses/LICENSE-2.0 4463 * 4464 * Unless required by applicable law or agreed to in writing, software 4465 * distributed under the License is distributed on an "AS IS" BASIS, 4466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4467 * See the License for the specific language governing permissions and 4468 * limitations under the License. 4469 * ============================================================================= 4470 */const $h=-2,B6=-1;function L6(t,e,n){const r=t.shape.length;A(r===e.length,()=>"Error in slice".concat(r,"D: Length of begin ").concat(e," must ")+"match the rank of the array (".concat(r,").")),A(r===n.length,()=>"Error in slice".concat(r,"D: Length of size ").concat(n," must ")+"match the rank of the array (".concat(r,")."));for(let s=0;s<r;++s)A(e[s]+n[s]<=t.shape[s],()=>"Error in slice".concat(r,"D: begin[").concat(s,"] + size[").concat(s,"] ")+"(".concat(e[s]+n[s],") would overflow input.shape[").concat(s,"] (").concat(t.shape[s],")"))}function _2(t,e,n){const r=[];for(let s=0;s<t.length;s++)r[s]=Math.ceil((e[s]-t[s])/n[s]);return r}function I2(t,e,n){let r=n.length;for(let s=0;s<n.length;s++)if(n[s]>1){r=s;break}for(let s=r+1;s<n.length;s++)if(e[s]>0||n[s]!==t[s])return!1;return!0}function k2(t,e){let n=t.length>0?t[t.length-1]:1;for(let r=0;r<t.length-1;r++)n+=t[r]*e[r];return n}function E2(t,e,n){let r;const s=t.shape.length;typeof e=="number"?r=[e,...new Array(s-1).fill(0)]:e.length<s?r=e.concat(new Array(s-e.length).fill(0)):r=e.slice(),r.forEach(o=>{A(o!==-1,()=>"slice() does not support negative begin indexing.")});let a;return n==null?a=new Array(s).fill(-1):typeof n=="number"?a=[n,...new Array(s-1).fill(-1)]:n.length<s?a=n.concat(new Array(s-n.length).fill(-1)):a=n,a=a.map((o,i)=>o>=0?o:(A(o===-1,()=>"Negative size values should be exactly -1 but got "+"".concat(o," for the slice() size at index ").concat(i,".")),t.shape[i]-r[i])),[r,a]}function T2(t,e,n,r,s,a,o,i,l){let u;if(r==null?(u=new Array(e.length),u.fill(1)):u=r,o!=null&&o&o-1)throw new Error("Multiple ellipses in slice is not allowed.");let c=!1;const d={dims:u.length,numAddAxisAfterEllipsis:0,begin:e.slice(),end:n.slice(),strides:u.slice(),beginMask:s,endMask:a,ellipsisMask:o,newAxisMask:i,shrinkAxisMask:l};for(let w=0;w<d.dims;w++)c&&1<<w&i&&d.numAddAxisAfterEllipsis++,1<<w&o&&(c=!0);c||(d.ellipsisMask|=1<<d.dims,d.dims++);const f={dims:t.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};W6(d,f);let p=!0,h=!0,m=!0;const g=[],v=[];for(let w=0;w<t.length;++w){if(f.strides[w]===0)throw Error("strides[".concat(w,"] must be non-zero"));const S=!!(f.shrinkAxisMask&1<<w),I=t[w];if(I===-1){g.push(S?1:-1);continue}const E=[f.beginMask&1<<w,f.endMask&1<<w],T=[f.strides[w]>0?0:-1,f.strides[w]>0?I:I-1];if(S&&f.strides[w]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&f.strides[w]===1;const D=!!(f.beginMask&1<<w&&f.endMask&1<<w);if(f.beginValid&&f.endValid){if(S){const B=f.begin[w]<0?I+f.begin[w]:f.begin[w];if(f.begin[w]=B,f.end[w]=f.begin[w]+1,B<0||B>=I)throw Error("slice index ".concat(f.begin[w]," of dimension ").concat(w," out of bounds."))}else f.begin[w]=$v(f.begin[w],0,f.strides[w],I,E,T),f.end[w]=$v(f.end[w],1,f.strides[w],I,E,T);const M=f.strides[w]===1&&f.begin[w]===0&&f.end[w]===I;p=p&&M,h=h&&(w===0&&f.strides[w]===1||M)}else p=p&&f.strides[w]===1&&D,h=h&&(w===0&&f.strides[w]===1||D);let R,$=!1;if(f.beginValid&&f.endValid?(R=f.end[w]-f.begin[w],$=!0):S?(R=1,$=!0):D&&I>=0&&(f.strides[w]<0?R=-I:R=I,$=!0),$){let M;R===0||R<0!=f.strides[w]<0?M=0:M=Math.trunc(R/f.strides[w])+(R%f.strides[w]!==0?1:0),g.push(M)}else g.push(-1)}for(let w=0;w<f.finalShapeGatherIndices.length;++w){const S=f.finalShapeGatherIndices[w];S>=0?v.push(g[S]):S===$h&&v.push(1)}return{finalShapeSparse:v.filter((w,S)=>f.finalShapeGatherIndices[S]!==$h),finalShape:v,isIdentity:p,sliceDim0:h,isSimpleSlice:m,begin:f.begin,end:f.end,strides:f.strides}}function W6(t,e){e.beginMask=0,e.endMask=0,e.shrinkAxisMask=0;let n=0;e.beginValid=t.begin!=null,e.endValid=t.end!=null,e.begin=new Array(e.dims),e.end=new Array(e.dims),e.strides=new Array(e.dims),e.finalShapeGatherIndices=[],e.finalShapeGatherIndicesSparse=[],e.inputShapeGatherIndicesSparse=new Array(e.dims);for(let r=0;r<t.dims;r++)if(1<<r&t.ellipsisMask){const s=Math.min(e.dims-(t.dims-r)+1+t.numAddAxisAfterEllipsis,e.dims);for(;n<s;n++)e.begin[n]=0,e.end[n]=0,e.strides[n]=1,e.beginMask|=1<<n,e.endMask|=1<<n,e.finalShapeGatherIndices.push(n),e.finalShapeGatherIndicesSparse.push(-1),e.inputShapeGatherIndicesSparse[n]=r}else if(1<<r&t.newAxisMask)e.finalShapeGatherIndices.push($h),e.finalShapeGatherIndicesSparse.push(-1);else{if(n===e.begin.length)throw Error("Index out of range using input dim ".concat(n,"; input ")+"has only ".concat(e.dims," dims, ").concat(e.begin.length,"."));t.begin!=null&&(e.begin[n]=t.begin[r]),t.end!=null&&(e.end[n]=t.end[r]),e.strides[n]=t.strides[r],t.beginMask&1<<r&&(e.beginMask|=1<<n),t.endMask&1<<r&&(e.endMask|=1<<n),t.shrinkAxisMask&1<<r?(e.finalShapeGatherIndices.push(B6),e.finalShapeGatherIndicesSparse.push(-1),e.shrinkAxisMask|=1<<n):(e.finalShapeGatherIndices.push(n),e.finalShapeGatherIndicesSparse.push(r)),e.inputShapeGatherIndicesSparse[n]=r,n++}}function $v(t,e,n,r,s,a){if(s[e])return n>0?a[e]:a[e+1&1];{const o=t<0?r+t:t;return o<a[0]?a[0]:o>a[1]?a[1]:o}}/** 4471 * @license 4472 * Copyright 2017 Google LLC. All Rights Reserved. 4473 * Licensed under the Apache License, Version 2.0 (the "License");
4474 * you may not use this file except in compliance with the License. 4475 * You may obtain a copy of the License at 4476 * 4477 * http://www.apache.org/licenses/LICENSE-2.0 4478 * 4479 * Unless required by applicable law or agreed to in writing, software 4480 * distributed under the License is distributed on an "AS IS" BASIS, 4481 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4482 * See the License for the specific language governing permissions and 4483 * limitations under the License. 4484 * ============================================================================= 4485 */function C2(t,e){const n=t[0].length;t.forEach((s,a)=>{A(s.length===n,()=>"Error in concat".concat(n,"D: rank of tensors[").concat(a,"] must be the same ")+"as the rank of the rest (".concat(n,")"))}),A(e>=0&&e<n,()=>"Error in concat".concat(n,"D: axis must be between 0 and ").concat(n-1,"."));const r=t[0];t.forEach((s,a)=>{for(let o=0;o<n;o++)A(o===e||s[o]===r[o],()=>"Error in concat".concat(n,"D: Shape of tensors[").concat(a,"] (").concat(s,") ")+"does not match the shape of the rest (".concat(r,") ")+"along the non-concatenated axis ".concat(a,"."))})}function Uo(t,e){const n=t[0].slice();for(let r=1;r<t.length;r++)n[e]+=t[r][e];return n}/** 4486 * @license 4487 * Copyright 2022 Google LLC. All Rights Reserved. 4488 * Licensed under the Apache License, Version 2.0 (the "License"); 4489 * you may not use this file except in compliance with the License. 4490 * You may obtain a copy of the License at 4491 * 4492 * http://www.apache.org/licenses/LICENSE-2.0 4493 * 4494 * Unless required by applicable law or agreed to in writing, software 4495 * distributed under the License is distributed on an "AS IS" BASIS, 4496 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4497 * See the License for the specific language governing permissions and 4498 * limitations under the License. 4499 * ============================================================================= 4500 */var Xr;(function(t){t[t.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",t[t.VALUE_ROWIDS=1]="VALUE_ROWIDS",t[t.ROW_LENGTHS=2]="ROW_LENGTHS",t[t.ROW_SPLITS=3]="ROW_SPLITS",t[t.ROW_LIMITS=4]="ROW_LIMITS",t[t.ROW_STARTS=5]="ROW_STARTS"})(Xr||(Xr={}));function z6(t,e,n){let r=new Array;if(n==null&&e==null)return r;if(e==null)for(;r.length<t+n.length;)r.push(-1);else r=e.slice();if(n==null)return r;if(t+n.length!==r.length)throw new Error("rt input.shape and shape=".concat(e," are incompatible: rt input.rank = ").concat(t+n.length,", but shape.rank = ").concat(r.length));for(let s=1;s<n.length;++s){const a=n[s],o=r[r.length-n.length+s],i=r[o];if(a>=0)if(i>=0){if(i!==a)throw new Error("rt input.shape and shape=".concat(e," are incompatible: rt input.shape[").concat(s+t,"] = ").concat(a," but shape[").concat(s+t,"] = ").concat(i))}else r[o]=a}return r}function H6(t){const e={FIRST_DIM_SIZE:Xr.FIRST_DIM_SIZE,VALUE_ROWIDS:Xr.VALUE_ROWIDS,ROW_LENGTHS:Xr.ROW_LENGTHS,ROW_SPLITS:Xr.ROW_SPLITS,ROW_LIMITS:Xr.ROW_LIMITS,ROW_STARTS:Xr.ROW_STARTS},n=[];for(const r of t)if(r in e)n.push(e[r]);else break;return n}function U6(t){return t.length===0?0:t[0]===Xr.FIRST_DIM_SIZE?t.length-1:t.length}function V6(t,e){if(t==null||e==null)return;const n=t.length,r=e.length;if(n>=r)throw new Error("defaultValue.shape=".concat(t," and ragged tensor flatValues.shape=").concat(e,", are incompatible: defaultValue.rank = ").concat(n," must be less than ragged tensor input flatValues.rank = ").concat(r,")"));for(let s=0;s<Math.min(n,r-1);++s){const a=t[s],o=e[s+1];if(a>=0&&o>=0&&a!==1&&a!==o)throw new Error("defaultValue.shape=".concat(t,", and ragged tensor input flatValues.shape=").concat(e," are incompatible: defaultValue.shape[").concat(s-t.length,"] = ").concat(a," but ragged tensor input.flatValues.shape[").concat(s-t.length,"] = ").concat(o))}}/** 4501 * @license 4502 * Copyright 2020 Google LLC. All Rights Reserved. 4503 * Licensed under the Apache License, Version 2.0 (the "License"); 4504 * you may not use this file except in compliance with the License. 4505 * You may obtain a copy of the License at 4506 * 4507 * http://www.apache.org/licenses/LICENSE-2.0 4508 * 4509 * Unless required by applicable law or agreed to in writing, softw
4509are 4510 * distributed under the License is distributed on an "AS IS" BASIS, 4511 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4512 * See the License for the specific language governing permissions and 4513 * limitations under the License. 4514 * ============================================================================= 4515 */function N2(t,e,n){const r=n*(typeof t=="number"?t:t[0]),s=e*(typeof t=="number"?t:t[1]);return[r,s]}/** 4516 * @license 4517 * Copyright 2018 Google LLC. All Rights Reserved. 4518 * Licensed under the Apache License, Version 2.0 (the "License"); 4519 * you may not use this file except in compliance with the License. 4520 * You may obtain a copy of the License at 4521 * 4522 * http://www.apache.org/licenses/LICENSE-2.0 4523 * 4524 * Unless required by applicable law or agreed to in writing, software 4525 * distributed under the License is distributed on an "AS IS" BASIS, 4526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4527 * See the License for the specific language governing permissions and 4528 * limitations under the License. 4529 * ============================================================================= 4530 */function Uf(t,e,n,r=!0){let s=[];if(r)s=s.concat(e.slice(0)),s.push(t[0]/n),s=s.concat(t.slice(1));else{s=s.concat(t[0]);const a=e.length;for(let o=0;o<a;++o)s=s.concat([t[o+1]/e[o],e[o]]);s=s.concat(t.slice(a+1))}return s}function Vf(t,e,n=!0){const r=[];if(n){r.push(e);for(let s=e+1;s<t;++s)s<=2*e?(r.push(s),r.push(s-(e+1))):r.push(s)}else{const s=[],a=[];for(let o=1;o<t;++o)o>=e*2+1||o%2===1?a.push(o):s.push(o);r.push(...s),r.push(0),r.push(...a)}return r}function jf(t,e,n,r=!0){const s=[];r?s.push(t[0]/n):s.push(t[0]*n);for(let a=1;a<t.length;++a)a<=e.length?r?s.push(e[a-1]*t[a]):s.push(t[a]/e[a-1]):s.push(t[a]);return s}function A2(t,e){const n=[0];for(let r=0;r<e;++r)n.push(t[r][0]);return n}function $2(t,e,n){const r=t.slice(0,1);for(let s=0;s<n;++s)r.push(t[s+1]-e[s][0]-e[s][1]);return r}/** 4531 * @license 4532 * Copyright 2018 Google LLC. All Rights Reserved. 4533 * Licensed under the Apache License, Version 2.0 (the "License"); 4534 * you may not use this file except in compliance with the License. 4535 * You may obtain a copy of the License at 4536 * 4537 * http://www.apache.org/licenses/LICENSE-2.0 4538 * 4539 * Unless required by applicable law or agreed to in writing, software 4540 * distributed under the License is distributed on an "AS IS" BASIS, 4541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4542 * See the License for the specific language governing permissions and 4543 * limitations under the License. 4544 * ============================================================================= 4545 */const j6=1.7580993408473768,G6=1.0507009873554805;/** 4546 * @license 4547 * Copyright 2018 Google LLC. All Rights Reserved. 4548 * Licensed under the Apache License, Version 2.0 (the "License"); 4549 * you may not use this file except in compliance with the License. 4550 * You may obtain a copy of the License at 4551 * 4552 * http://www.apache.org/licenses/LICENSE-2.0 4553 * 4554 * Unless required by applicable law or agreed to in writing, software 4555 * distributed under the License is distributed on an "AS IS" BASIS, 4556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4557 * See the License for the specific language governing permissions and 4558 * limitations under the License. 4559 * ============================================================================= 4560 */const q6=.3275911,K6=.254829592,X6=-.284496736,Y6=1.421413741,J6=-1.453152027,Q6=1.061405429;/** 4561 * @license 4562 * Copyright 2018 Google LLC. All Rights Reserved. 4563 * Licensed under the Apache License, Version 2.0 (the "License"); 4564 * you may not use this file except in compliance with the License. 4565 * You may obtain a copy of the License at 4566 * 4567 * http://www.apache.org/licenses/LICENSE-2.0 4568 * 4569 * Unless required by applicable law or agreed to in writing, software 4570 * distributed under the License is distributed on an "AS IS" BASIS, 4571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4572 * See the License for the specific language governing permissions and 4573 * limitations under the License. 4574 * ============================================================================= 4575 */function Qo(t,e){if(t.length!==e.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+"".concat(t.length,", imag: ").concat(e.length,"."));const n=new Float32Array(t.length*2);for(let r=0;r<n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n}function Z6(t){const e=new Float32Array(t.length/2),n=new Float32Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}}function e5(t){const e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e);for(let s=0;s<t.length;s+=4)n[Math.floor(s/4)]=t[s],r[Math.floor(s/4)]=t[s+1];return{real:n,imag:r}}function t5(t){const e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e);for(let s=2;s<t.length;s+=4)n[Math.floor(s/4)]=t[s],r[Math.floor(s/4)]=t[s+1];return{real:n,imag:r}}function R2(t,e){const n=t[e*2],r=t[e*2+1];return{real:n,imag:r}}function n5(t,e,n,r){t[r*2]=e,t[r*2+1]=n}function r5(t,e){const n=new Float32Array(t/2),r=new Float32Array(t/2);for(let s=0;s<Math.ceil(t/2);s++){const a=(e?2:-2)*Math.PI*(s/t);n[s]=Math.cos(a),r[s]=Math.sin(a)}return{real:n,imag:r}}function s5(t,e,n){const r=(n?2:-2)*Math.PI*(t/e),s=Math.cos(r),a=Math.sin(r);return{real:s,imag:a}}/** 4576 * @license 4577 * Copyright 2021 Google LLC. All Rights Reserved. 4578 * Licensed under the Apache License, Version 2.0 (the "License");
4579 * you may not use this file except in compliance with the License. 4580 * You may obtain a copy of the License at 4581 * 4582 * http://www.apache.org/licenses/LICENSE-2.0 4583 * 4584 * Unless required by applicable law or agreed to in writing, software 4585 * distributed under the License is distributed on an "AS IS" BASIS, 4586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4587 * See the License for the specific language governing permissions and 4588 * limitations under the License. 4589 * ============================================================================= 4590 */const Ip="->",a5=/->/g,Rv=",",Dv="...";function o5(t,e){t=t.replace(/\s/g,"");const n=(t.length-t.replace(a5,"").length)/Ip.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error('Equation must contain exactly one arrow ("'.concat(Ip,'").'));const[r,s]=t.split(Ip);A(r.indexOf(Dv)===-1,()=>'The ellipsis notation ("'.concat(Dv,'") is not supported yet.'));const a=r.split(Rv),o=a.length;if(e!==o)throw new Error("Expected ".concat(o," input tensors, received ").concat(e));if(o>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const i=[];for(let f=0;f<s.length;++f){const p=s[f];if(!a.some(h=>h.indexOf(p)!==-1))throw new Error("Output subscripts contain the label ".concat(p," ")+"not present in the input subscripts.");i.indexOf(p)===-1&&i.push(p)}for(let f=0;f<r.length;++f){const p=r[f];i.indexOf(p)===-1&&p!==Rv&&i.push(p)}const l=new Array(a.length);for(let f=0;f<o;++f){if(new Set(a[f].split("")).size!==a[f].length)throw new Error("Found duplicate axes in input component ".concat(a[f],". ")+"Support for duplicate axes in input is not implemented yet.");l[f]=[];for(let p=0;p<a[f].length;++p)l[f].push(i.indexOf(a[f][p]))}const u=i.length,c=s.length,d=[];for(let f=c;f<u;++f)d.push(f);return{allDims:i,summedDims:d,idDims:l}}function i5(t,e){let n=new Array(t);n.fill(-1);for(let s=0;s<e.length;++s)n[e[s]]=s;const r=[];for(let s=0;s<t;++s)n[s]===-1&&r.push(s);return n=n.filter(s=>s!==-1),{permutationIndices:n,expandDims:r}}function c5(t,e,n){const r=new Array(t);for(let s=0;s<n.length;++s){const a=n[s].shape;for(let o=0;o<e[s].length;++o)r[e[s][o]]===void 0?r[e[s][o]]=a[o]:A(r[e[s][o]]===a[o],()=>"Expected dimension ".concat(r[e[s][o]]," at axis ").concat(o," ")+"of input shaped ".concat(JSON.stringify(a),", ")+"but got dimension ".concat(a[o]))}}function l5(t,e){const n=t,r=[];let s=0;t.length===0&&n.push(-1),s=t.length+1;for(let o=0;o<s;++o)r.push([]);const a=[];for(let o=0;o<n.length;++o){const i=n[o],l=d5(e,i);for(const u of l)a.indexOf(u)===-1&&(r[o].push(u),a.push(u))}return{path:n,steps:r}}function u5(t){return t.every((e,n)=>e===n)}function d5(t,e){const n=[];for(let r=0;r<t.length;++r)(t[r].length===0||t[r].indexOf(e)!==-1||e===-1)&&n.push(r);return n}function D2(t,e,n=0){let r=[];if(typeof e=="number")A(t.shape[n]%e===0,()=>"Number of splits must evenly divide the axis."),r=new Array(e).fill(t.shape[n]/e);else{const s=e.reduce((o,i)=>(i===-1&&(o+=1),o),0);A(s<=1,()=>"There should be only one negative value in split array.");const a=e.indexOf(-1);if(a!==-1){const o=e.reduce((i,l)=>l>0?i+l:i);e[a]=t.shape[n]-o}A(t.shape[n]===e.reduce((o,i)=>o+i),()=>"The sum of sizes must match the size of the axis dimension."),r=e}return r}/** 4591 * @license 4592 * Copyright 2021 Google LLC. All Rights Reserved. 4593 * Licensed under the Apache License, Version 2.0 (the "License"); 4594 * you may not use this file except in compliance with the License. 4595 * You may obtain a copy of the License at 4596 * 4597 * http://www.apache.org/licenses/LICENSE-2.0 4598 * 4599 * Unless required by applicable law or agreed to in writing, software 4600 * distributed under the License is distributed on an "AS IS" BASIS, 4601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4602 * See the License for the specific language governing permissions and 4603 * limitations under the License. 4604 * ============================================================================= 4605 */function F2(t){return"Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ".concat(t)}
4605function M2(t,e){return"indices(".concat(t,", 0) is invalid: ").concat(e," < 0")}function O2(t,e,n){return"indices(".concat(t,", 0) is invalid: ").concat(e," >= ").concat(n)}/** 4606 * @license 4607 * Copyright 2021 Google LLC. All Rights Reserved. 4608 * Licensed under the Apache License, Version 2.0 (the "License"); 4609 * you may not use this file except in compliance with the License. 4610 * You may obtain a copy of the License at 4611 * 4612 * http://www.apache.org/licenses/LICENSE-2.0 4613 * 4614 * Unless required by applicable law or agreed to in writing, software 4615 * distributed under the License is distributed on an "AS IS" BASIS, 4616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4617 * See the License for the specific language governing permissions and 4618 * limitations under the License. 4619 * ============================================================================= 4620 */function P2(t,e){return"only one output dimension may be -1, not both ".concat(t," and ").concat(e)}function B2(t,e){return"size ".concat(t," must be non-negative, not ").concat(e)}function L2(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function W2(t,e){const n=J(t),r=J(e);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(t," outputShape= ").concat(e)}function z2(t,e){const n=J(t),r=J(e);return"Input to reshape is a tensor with ".concat(n," dense values, but the requested shape has ").concat(r,". inputShape=").concat(t," outputShape=").concat(e)}/** 4621 * @license 4622 * Copyright 2021 Google LLC. All Rights Reserved. 4623 * Licensed under the Apache License, Version 2.0 (the "License"); 4624 * you may not use this file except in compliance with the License. 4625 * You may obtain a copy of the License at 4626 * 4627 * http://www.apache.org/licenses/LICENSE-2.0 4628 * 4629 * Unless required by applicable law or agreed to in writing, software 4630 * distributed under the License is distributed on an "AS IS" BASIS, 4631 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4632 * See the License for the specific language governing permissions and 4633 * limitations under the License. 4634 * ============================================================================= 4635 */function fu(){return"segment ids must be >= 0"}function H2(){return"segment ids are not increasing"}function U2(t,e){return"Segment id ".concat(t," out of range [0, ").concat(e,"), possibly because segmentIds input is not sorted.")}function V2(t,e,n){return"Bad: indices[".concat(t,"] == ").concat(e," out of range [0, ").concat(n,")")}/** 4636 * @license 4637 * Copyright 2018 Google LLC. All Rights Reserved. 4638 * Licensed under the Apache License, Version 2.0 (the "License"); 4639 * you may not use this file except in compliance with the License. 4640 * You may obtain a copy of the License at 4641 * 4642 * http://www.apache.org/licenses/LICENSE-2.0 4643 * 4644 * Unless required by applicable law or agreed to in writing, software 4645 * distributed under the License is distributed on an "AS IS" BASIS, 4646 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4647 * See the License for the specific language governing permissions and 4648 * limitations under the License. 4649 * ============================================================================= 4650 */function j2(t,e,n,r){const s=e.shape.length,a=t.shape.length;if(r!==0&&(r<-s||r>s))throw new Error("Expect batchDims in the range of [-".concat(s,", ").concat(s,"], but got ").concat(r));if(r<0&&(r+=s),r>a)throw new Error("batchDims (".concat(r,") must be less than rank(x) (\n ").concat(a,")."));if(n<r)throw new Error("batchDims (".concat(r,") must be less than or equal to axis (").concat(n,")."));for(let d=0;d<r;++d)if(t.shape[d]!==e.shape[d])throw new Error("x.shape[".concat(d,"]: ").concat(t.shape[d]," should be equal to indices.shape[").concat(d,"]: ").concat(e.shape[d],"."));const o=t.shape[n],i=[];let l=1,u=1,c=1;for(let d=0;d<r;++d)i.push(t.shape[d]),l*=t.shape[d];for(let d=r;d<n;d++)i.push(t.shape[d]),u*=t.shape[d];for(let d=r;d<s;d++)i.push(e.shape[d]);for(let d=n+1;d<a;d++)i.push(t.shape[d]),c*=t.shape[d];return{batchSize:l,sliceSize:c,outerSize:u,dimSize:o,outputShape:i}}/** 4651 * @license 4652 * Copyright 2018 Google LLC. All Rights Reserved. 4653 * Licensed under the Apache License, Version 2.0 (the "License");
4654 * you may not use this file except in compliance with the License. 4655 * You may obtain a copy of the License at 4656 * 4657 * http://www.apache.org/licenses/LICENSE-2.0 4658 * 4659 * Unless required by applicable law or agreed to in writing, software 4660 * distributed under the License is distributed on an "AS IS" BASIS, 4661 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4662 * See the License for the specific language governing permissions and 4663 * limitations under the License. 4664 * ============================================================================= 4665 */function Cc(t){try{return t.map(e=>bc(e))}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8, error: ".concat(e))}}function G2(t){return t.map(e=>Pa(e))}/** 4666 * @license 4667 * Copyright 2017 Google LLC. All Rights Reserved. 4668 * Licensed under the Apache License, Version 2.0 (the "License"); 4669 * you may not use this file except in compliance with the License. 4670 * You may obtain a copy of the License at 4671 * 4672 * http://www.apache.org/licenses/LICENSE-2.0 4673 * 4674 * Unless required by applicable law or agreed to in writing, software 4675 * distributed under the License is distributed on an "AS IS" BASIS, 4676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4677 * See the License for the specific language governing permissions and 4678 * limitations under the License. 4679 * ============================================================================= 4680 */y6();var Fv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kp={},Mv;function p5(){return Mv||(Mv=1,(function(){var t;function e(y){var _=0;return function(){return _<y.length?{done:!1,value:y[_++]}:{done:!0}}}var n=typeof Object.defineProperties=="function"?Object.defineProperty:function(y,_,k){return y==Array.prototype||y==Object.prototype||(y[_]=k.value),y};function r(y){y=[typeof globalThis=="object"&&globalThis,y,typeof window=="object"&&window,typeof self=="object"&&self,typeof Fv=="object"&&Fv];for(var _=0;_<y.length;++_){var k=y[_];if(k&&k.Math==Math)return k}throw Error("Cannot find global object")}var s=r(this);function a(y,_){if(_)e:{var k=s;y=y.split(".");for(var N=0;N<y.length-1;N++){var O=y[N];if(!(O in k))break e;k=k[O]}y=y[y.length-1],N=k[y],_=_(N),_!=N&&_!=null&&n(k,y,{configurable:!0,writable:!0,value:_})}}a("Symbol",function(y){function _(j){if(this instanceof _)throw new TypeError("Symbol is not a constructor");return new k(N+(j||"")+"_"+O++,j)}function k(j,L){this.g=j,n(this,"description",{configurable:!0,writable:!0,value:L})}if(y)return y;k.prototype.toString=function(){return this.g};var N="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",O=0;return _}),a("Symbol.iterator",function(y){if(y)return y;y=Symbol("Symbol.iterator");for(var _="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),k=0;k<_.length;k++){var N=s[_[k]];typeof N=="function"&&typeof N.prototype[y]!="function"&&n(N.prototype,y,{configurable:!0,writable:!0,value:function(){return o(e(this))}})}return y});function o(y){return y={next:y},y[Symbol.iterator]=function(){return this},y}function i(y){var _=typeof Symbol<"u"&&Symbol.iterator&&y[Symbol.iterator];return _?_.call(y):{next:e(y)}}function l(y){if(!(y instanceof Array)){y=i(y);for(var _,k=[];!(_=y.next()).done;)k.push(_.value);y=k}return y}var u=typeof Object.create=="function"?Object.create:function(y){function _(){}return _.prototype=y,new _},c;if(typeof Object.setPrototypeOf=="function")c=Object.setPrototypeOf;else{var d;e:{var f={a:!0},p={};try{p.__proto__=f,d=p.a;break e}catch(y){}d=!1}c=d?function(y,_){if(y.__proto__=_,y.__proto__!==_)throw new TypeError(y+" is not extensible");return y}:null}var h=c;function m(y,_){if(y.prototype=u(_.prototype),y.prototype.constructor=y,h)h(y,_);else for(var k in _)if(k!="prototype")if(Object.defineProperties){var N=Object.getOwnPropertyDescriptor(_,k);N&&Object.defineProperty(y,k,N)}else y[k]=_[k];y.na=_.prototype}function g(){this.l=!1,this.i=null,this.h=void 0,this.g=1,this.u=this.o=0,this.j=null}function v(y){if(y.l)throw new TypeError("Generator is already running");y.l=!0}g.prototype.s=function(y){this.h=y};function b(y,_){y.j={da:_,ea:!0},y.g=y.o||y.u}g.prototype.return=function(y){this.j={return:y},this.g=this.u};function w(y,_,k){return y.g=k,{value:_}}function S(y){this.g=new g,this.h=y}function I(y,_){v(y.g);var k=y.g.i;return k?E(y,"return"in k?k.return:function(N){return{value:N,done:!0}},_,y.g.return):(y.g.return(_),T(y))}function E(y,_,k,N){try{var O=_.call(y.g.i,k);if(!(O instanceof Object))throw new TypeError("Iterator result "+O+" is not an object");
vendor: 7,873 bytes, line 4680
4680if(!O.done)return y.g.l=!1,O;var j=O.value}catch(L){return y.g.i=null,b(y.g,L),T(y)}return y.g.i=null,N.call(y.g,j),T(y)}function T(y){for(;y.g.g;)try{var _=y.h(y.g);if(_)return y.g.l=!1,{value:_.value,done:!1}}catch(k){y.g.h=void 0,b(y.g,k)}if(y.g.l=!1,y.g.j){if(_=y.g.j,y.g.j=null,_.ea)throw _.da;return{value:_.return,done:!0}}return{value:void 0,done:!0}}function D(y){this.next=function(_){return v(y.g),y.g.i?_=E(y,y.g.i.next,_,y.g.s):(y.g.s(_),_=T(y)),_},this.throw=function(_){return v(y.g),y.g.i?_=E(y,y.g.i.throw,_,y.g.s):(b(y.g,_),_=T(y)),_},this.return=function(_){return I(y,_)},this[Symbol.iterator]=function(){return this}}function R(y){function _(N){return y.next(N)}function k(N){return y.throw(N)}return new Promise(function(N,O){function j(L){L.done?N(L.value):Promise.resolve(L.value).then(_,k).then(j,O)}j(y.next())})}function $(y){return R(new D(new S(y)))}a("Promise",function(y){function _(L){this.h=0,this.i=void 0,this.g=[],this.s=!1;var Y=this.j();try{L(Y.resolve,Y.reject)}catch(te){Y.reject(te)}}function k(){this.g=null}function N(L){return L instanceof _?L:new _(function(Y){Y(L)})}if(y)return y;k.prototype.h=function(L){if(this.g==null){this.g=[];var Y=this;this.i(function(){Y.l()})}this.g.push(L)};var O=s.setTimeout;k.prototype.i=function(L){O(L,0)},k.prototype.l=function(){for(;this.g&&this.g.length;){var L=this.g;this.g=[];for(var Y=0;Y<L.length;++Y){var te=L[Y];L[Y]=null;try{te()}catch(de){this.j(de)}}}this.g=null},k.prototype.j=function(L){this.i(function(){throw L})},_.prototype.j=function(){function L(de){return function(Ee){te||(te=!0,de.call(Y,Ee))}}var Y=this,te=!1;return{resolve:L(this.D),reject:L(this.l)}},_.prototype.D=function(L){if(L===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(L instanceof _)this.H(L);else{e:switch(typeof L){case"object":var Y=L!=null;break e;case"function":Y=!0;break e;default:Y=!1}Y?this.A(L):this.o(L)}},_.prototype.A=function(L){var Y=void 0;try{Y=L.then}catch(te){this.l(te);return}typeof Y=="function"?this.I(Y,L):this.o(L)},_.prototype.l=function(L){this.u(2,L)},_.prototype.o=function(L){this.u(1,L)},_.prototype.u=function(L,Y){if(this.h!=0)throw Error("Cannot settle("+L+", "+Y+"): Promise already settled in state"+this.h);this.h=L,this.i=Y,this.h===2&&this.G(),this.B()},_.prototype.G=function(){var L=this;O(function(){if(L.C()){var Y=s.console;typeof Y<"u"&&Y.error(L.i)}},1)},_.prototype.C=function(){if(this.s)return!1;var L=s.CustomEvent,Y=s.Event,te=s.dispatchEvent;return typeof te>"u"?!0:(typeof L=="function"?L=new L("unhandledrejection",{cancelable:!0}):typeof Y=="function"?L=new Y("unhandledrejection",{cancelable:!0}):(L=s.document.createEvent("CustomEvent"),L.initCustomEvent("unhandledrejection",!1,!0,L)),L.promise=this,L.reason=this.i,te(L))},_.prototype.B=function(){if(this.g!=null){for(var L=0;L<this.g.length;++L)j.h(this.g[L]);this.g=null}};var j=new k;return _.prototype.H=function(L){var Y=this.j();L.M(Y.resolve,Y.reject)},_.prototype.I=function(L,Y){var te=this.j();try{L.call(Y,te.resolve,te.reject)}catch(de){te.reject(de)}},_.prototype.then=function(L,Y){function te(He,Te){return typeof He=="function"?function(Xe){try{de(He(Xe))}catch(ct){Ee(ct)}}:Te}var de,Ee,ze=new _(function(He,Te){de=He,Ee=Te});return this.M(te(L,de),te(Y,Ee)),ze},_.prototype.catch=function(L){return this.then(void 0,L)},_.prototype.M=function(L,Y){function te(){switch(de.h){case 1:L(de.i);break;case 2:Y(de.i);break;default:throw Error("Unexpected state: "+de.h)}}var de=this;this.g==null?j.h(te):this.g.push(te),this.s=!0},_.resolve=N,_.reject=function(L){return new _(function(Y,te){te(L)})},_.race=function(L){return new _(function(Y,te){for(var de=i(L),Ee=de.next();!Ee.done;Ee=de.next())N(Ee.value).M(Y,te)})},_.all=function(L){var Y=i(L),te=Y.next();return te.done?N([]):new _(function(de,Ee){function ze(Xe){return function(ct){He[Xe]=ct,Te--,Te==0&&de(He)}}var He=[],Te=0;do He.push(void 0),Te++,N(te.value).M(ze(He.length-1),Ee),te=Y.next();while(!te.done)})},_});function M(y,_){y instanceof String&&(y+="");var k=0,N=!1,O={next:function(){if(!N&&k<y.length){var j=k++;return{value:_(j,y[j]),done:!1}}return N=!0,{done:!0,value:void 0}}};return O[Symbol.iterator]=function(){return O},O}var B=typeof Object.assign=="function"?Object.assign:function(y,_){for(var k=1;k<arguments.length;k++){var N=arguments[k];if(N)for(var O in N)Object.prototype.hasOwnProperty.call(N,O)&&(y[O]=N[O])}return y};a("Object.assign",function(y){return y||B}),a("Object.is",function(y){return y||function(_,k){return _===k?_!==0||1/_===1/k:_!==_&&k!==k}}),a("Array.prototype.includes",function(y){return y||function(_,k){var N=this;N instanceof String&&(N=String(N));var O=N.length;for(k=k||0,0>k&&(k=Math.max(k+O,0));k<O;k++){var j=N[k];if(j===_||Object.is(j,_))return!0}return!1}}),a("String.prototype.includes",function(y){return y||function(_,k){if(this==null)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(_ instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return this.indexOf(_,k||0)!==-1}}),a("Array.prototype.keys",function(y){return y||function(){return M(this,function(_){return _})}});var z=this||self;function H(y,_){y=y.split(".");var k=z;y[0]in k||typeof k.execScript>"u"||k.execScript("var "+y[0]);for(var N;y.length&&(N=y.shift());)y.length||_===void 0?k[N]&&k[N]!==Object.prototype[N]?k=k[N]:k=k[N]={}:k[N]=_}function V(){throw Error("Invalid UTF8")}function X(y,_){return _=String.fromCharCode.apply(null,_),y==null?_:y+_}var Q,K=typeof TextDecoder<"u",ee,ae=typeof TextEncoder<"u",ne={},ce=null;function se(y){var _;_===void 0&&(_=0),pe(),_=ne[_];for(var k=Array(Math.floor(y.length/3)),N=_[64]||"",O=0,j=0;O<y.length-2;O+=3){var L=y[O],Y=y[O+1],te=y[O+2],de=_[L>>2];L=_[(L&3)<<4|Y>>4],Y=_[(Y&15)<<2|te>>6],te=_[te&63],k[j++]=de+L+Y+te}switch(de=0,te=N,y.length-O){case 2:de=y[O+1],te=_[(de&15)<<2]||N;case 1:y=y[O],k[j]=_[y>>2]+_[(y&3)<<4|de>>4]+te+N}return k.join("")}function oe(y){var _=y.length,k=3*_/4;k%3?k=Math.floor(k):"=.".indexOf(y[_-1])!=-1&&(k="=.".indexOf(y[_-2])!=-1?k-2:k-1);var N=new Uint8Array(k),O=0;return ie(y,function(j){N[O++]=j}),O!==k?N.subarray(0,O):N}function ie(y,_){function k(te){for(;N<y.length;){var de=y.charAt(N++),Ee=ce[de];if(Ee!=null)return Ee;if(!/^[\s\xa0]*$/.test(de))throw Error("Unknown base64 encoding at char: "+de)}return te}pe();for(var N=0;;){var O=k(-1),j=k(0),L=k(64),Y=k(64);if(Y===64&&O===-1)break;_(O<<2|j>>4),L!=64&&(_(j<<4&240|L>>2),Y!=64&&_(L<<6&192|Y))}}function pe(){if(!ce){ce={};for(var y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),_=["+/=","+/","-_=","-_.","-_"],k=0;5>k;k++){var N=y.concat(_[k].split(""));ne[k]=N;for(var O=0;O<N.length;O++){var j=N[O];ce[j]===void 0&&(ce[j]=O)}}}}var ve=typeof Uint8Array=="function";function fe(y){return ve&&y!=null&&y instanceof Uint8Array}var be;function $e(y){if(this.L=y,y!==null&&y.length===0)throw Error("ByteString should be constructed with non-empty values")}var Re=typeof Uint8Array.prototype.slice=="function",De=0,Pe=0;function je(y,_){if(y.constructor===Uint8Array)return y;if(y.constructor===ArrayBuffer)return new Uint8Array(y);if(y.constructor===Array)return new Uint8Array(y);if(y.constructor===String)return oe(y);if(y.constructor===$e)return!_&&(_=y.L)&&_.constructor===Uint8Array?_:(_=y.L,_=_==null||fe(_)?_:typeof _=="string"?oe(_):null,(y=y.L=_)?new Uint8Array(y):be||(be=new Uint8Array(0)));if(y instanceof Uint8Array)return new Uint8Array(y.buffer,y.byteOffset,y.byteLength);throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, or Array of numbers")}function Ue(y,_){return Error("Invalid wire type: "+y+" (at position "+_+")")}function Ce(){return Error("Failed to read varint, encoding is invali
4680d.")}function Ze(y,_){_=_===void 0?{}:_,_=_.v===void 0?!1:_.v,this.h=null,this.g=this.i=this.j=0,this.v=_,y&&Ke(this,y)}function Ke(y,_){y.h=je(_,y.v),y.j=0,y.i=y.h.length,y.g=y.j}Ze.prototype.reset=function(){this.g=this.j};function Ne(y){if(y.g>y.i)throw Error("Tried to read past the end of the data "+y.g+" > "+y.i)}function Ge(y){var _=y.h,k=_[y.g],N=k&127;if(128>k)return y.g+=1,Ne(y),N;if(k=_[y.g+1],N|=(k&127)<<7,128>k)return y.g+=2,Ne(y),N;if(k=_[y.g+2],N|=(k&127)<<14,128>k)return y.g+=3,Ne(y),N;if(k=_[y.g+3],N|=(k&127)<<21,128>k)return y.g+=4,Ne(y),N;if(k=_[y.g+4],y.g+=5,N|=(k&15)<<28,128>k)return Ne(y),N;if(128<=_[y.g++]&&128<=_[y.g++]&&128<=_[y.g++]&&128<=_[y.g++]&&128<=_[y.g++])throw Ce();return Ne(y),N}var jt=[];function gt(){this.g=[]}gt.prototype.length=function(){return this.g.length},gt.prototype.end=function(){var y=this.g;return this.g=[],y};function It(y,_){for(;127<_;)y.g.push(_&127|128),_>>>=7;y.g.push(_)}function yt(y){var _={},k=_.W===void 0?!1:_.W;this.l={v:_.v===void 0?!1:_.v},this.W=k,_=this.l,jt.length?(k=jt.pop(),_&&(k.v=_.v),y&&Ke(k,y),y=k):y=new Ze(y,_),this.g=y,this.j=this.g.g,this.h=this.i=-1}yt.prototype.reset=function(){this.g.reset(),this.j=this.g.g,this.h=this.i=-1};function Tt(y){var _=y.g;if(_.g==_.i)return!1;y.j=y.g.g;var k=Ge(y.g)>>>0;if(_=k>>>3,k&=7,!(0<=k&&5>=k))throw Ue(k,y.j);if(1>_)throw Error("Invalid field number: "+_+" (at position "+y.j+")");return y.i=_,y.h=k,!0}function Yt(y){switch(y.h){case 0:if(y.h!=0)Yt(y);else e:{y=y.g;for(var _=y.g,k=_+10;_<k;)if(!(y.h[_++]&128)){y.g=_,Ne(y);break e}throw Ce()}break;case 1:y=y.g,y.g+=8,Ne(y);break;case 2:y.h!=2?Yt(y):(_=Ge(y.g)>>>0,y=y.g,y.g+=_,Ne(y));break;case 5:y=y.g,y.g+=4,Ne(y);break;case 3:_=y.i;do{if(!Tt(y))throw Error("Unmatched start-group tag: stream EOF");if(y.h==4){if(y.i!=_)throw Error("Unmatched end-group tag");break}Yt(y)}while(1);break;default:throw Ue(y.h,y.j)}}var vt=[];function rn(){this.i=[],this.h=0,this.g=new gt}function _n(y,_){_.length!==0&&(y.i.push(_),y.h+=_.length)}function cs(y,_){if(_=_.ba){_n(y,y.g.end());for(var k=0;k<_.length;k++)_n(y,_[k])}}var In=typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol(void 0):void 0;function Ns(y,_){Object.isFrozen(y)||(In?y[In]|=_:y.N!==void 0?y.N|=_:Object.defineProperties(y,{N:{value:_,configurable:!0,writable:!0,enumerable:!1}}))}function rr(y){var _;return In?_=y[In]:_=y.N,_==null?0:_}function jn(y){return Ns(y,1),y}function Wt(y){return Array.isArray(y)?!!(rr(y)&2):!1}function As(y){if(!Array.isArray(y))throw Error("cannot mark non-array as immutable");Ns(y,2)}function fa(y){return y!==null&&typeof y=="object"&&!Array.isArray(y)&&y.constructor===Object}var ls=Object.freeze(jn([]));function pa(y){if(Wt(y.m))throw Error("Cannot mutate an immutable Message")}var pr=typeof Symbol<"u"&&typeof Symbol.hasInstance<"u";function us(y){return{value:y,configurable:!1,writable:!1,enumerable:!1}}function kn(y,_,k){return _===-1?null:_>=y.i?y.g?y.g[_]:void 0:k!==void 0&&k&&y.g&&(k=y.g[_],k!=null)?k:y.m[_+y.h]}function Ct(y,_,k,N){N=N===void 0?!1:N,pa(y),_<y.i&&!N?y.m[_+y.h]=k:(y.g||(y.g=y.m[y.i+y.h]={}))[_]=k}function Hr(y,_,k,N){k=k===void 0?!0:k,N=N===void 0?!1:N;var O=kn(y,_,N);return O==null&&(O=ls),Wt(y.m)?k&&(As(O),Object.freeze(O)):(O===ls||Wt(O))&&(O=jn(O.slice()),Ct(y,_,O,N)),O}function Mn(y,_,k){return y=kn(y,_),y=y==null?y:+y,y==null?k===void 0?0:k:y}function Z(y,_,k,N){y.j||(y.j={});var O=Wt(y.m),j=y.j[k];if(!j){N=Hr(y,k,!0,N===void 0?!1:N),j=[],O=O||Wt(N);for(var L=0;L<N.length;L++)j[L]=new _(N[L]),O&&As(j[L].m);O&&(As(j),Object.freeze(j)),y.j[k]=j}return j}function le(y,_,k,N,O){var j=j===void 0?!1:j;return pa(y),j=Z(y,k,_,j),k=N||new k,y=Hr(y,_),O!=null?(j.splice(O,0,k),y.splice(O,0,k.m)):(j.push(k),y.push(k.m)),k}function Ae(y,_){return y=kn(y,_),y==null?0:y}function ye(y,_){return y=kn(y,_),y==null?"":y}function bt(y){switch(typeof y){case"number":return isFinite(y)?y:String(y);case"object":if(y&&!Array.isArray(y)){if(fe(y))return se(y);if(y instanceof $e){var _=y.L;return _=_==null||typeof _=="string"?_:ve&&_ instanceof Uint8Array?se(_):null,(y.L=_)||""}}}return y}function kt(y){var _=Gt;return _=_===void 0?On:_,We(y,_)}function qe(y,_){if(y!=null){if(Array.isArray(y))y=We(y,_);else if(fa(y)){var k={},N;for(N in y)k[N]=qe(y[N],_);y=k}else y=_(y);return y}}function We(y,_){for(var k=y.slice(),N=0;N<k.length;N++)k[N]=qe(k[N],_);return Array.isArray(y)&&rr(y)&1&&jn(k),k}function Gt(y){return y&&typeof y=="object"&&y.toJSON?y.toJSON():(y=bt(y),Array.isArray(y)?kt
4680(y):y)}function On(y){return fe(y)?new Uint8Array(y):y}function Gn(y,_,k){y||(y=ha),ha=null;var N=this.constructor.h;y||(y=N?[N]:[]),this.h=(N?0:-1)-(this.constructor.g||0),this.j=void 0,this.m=y;e:{if(N=this.m.length,y=N-1,N&&(N=this.m[y],fa(N))){this.i=y-this.h,this.g=N;break e}_!==void 0&&-1<_?(this.i=Math.max(_,y+1-this.h),this.g=void 0):this.i=Number.MAX_VALUE}if(k)for(_=0;_<k.length;_++)if(y=k[_],y<this.i)y+=this.h,(N=this.m[y])?Array.isArray(N)&&jn(N):this.m[y]=ls;else{N=this.g||(this.g=this.m[this.i+this.h]={});var O=N[y];O?Array.isArray(O)&&jn(O):N[y]=ls}}Gn.prototype.toJSON=function(){return kt(this.m)},Gn.prototype.toString=function(){return this.m.toString()};var ha;function Ur(){Gn.apply(this,arguments)}if(m(Ur,Gn),pr){var ma={};Object.defineProperties(Ur,(ma[Symbol.hasInstance]=us(function(){throw Error("Cannot perform instanceof checks for MutableMessage")}),ma))}function sn(y,_,k){if(k){var N={},O;for(O in k){var j=k[O],L=j.ha;L||(N.F=j.la||j.fa.P,j.aa?(N.U=$s(j.aa),L=function(Y){return function(te,de,Ee){return Y.F(te,de,Ee,Y.U)}}(N)):j.ca?(N.T=Xc(j.X.g,j.ca),L=function(Y){return function(te,de,Ee){return Y.F(te,de,Ee,Y.T)}}(N)):L=N.F,j.ha=L),L(_,y,j.X),N={F:N.F,U:N.U,T:N.T}}}cs(_,y)}var sr=Symbol();function ga(y,_,k){return y[sr]||(y[sr]=function(N,O){return _(N,O,k)})}function qc(y){var _=y[sr];if(!_){var k=el(y);_=function(N,O){return tl(N,O,k)},y[sr]=_}return _}function gi(y){var _=y.aa;if(_)return qc(_);if(_=y.ka)return ga(y.X.g,_,y.ca)}function op(y){var _=gi(y),k=y.X,N=y.fa.O;return _?function(O,j){return N(O,j,k,_)}:function(O,j){return N(O,j,k)}}function Kc(y,_,k,N,O,j){y=y();var L=0;for(y.length&&typeof y[0]!="number"&&(k(_,y[0]),L++);L<y.length;){k=y[L++];for(var Y=L+1;Y<y.length&&typeof y[Y]!="number";)Y++;var te=y[L++];switch(Y-=L,Y){case 0:N(_,k,te);break;case 1:N(_,k,te,y[L++]);break;case 2:O(_,k,te,y[L++],y[L++]);break;case 3:Y=y[L++];var de=y[L++],Ee=y[L++];Array.isArray(Ee)?O(_,k,te,Y,de,Ee):j(_,k,te,Y,de,Ee);break;case 4:j(_,k,te,y[L++],y[L++],y[L++],y[L++]);break;default:throw Error("unexpected number of binary field arguments: "+Y)}}return _}var fo=Symbol();function $s(y){var _=y[fo];if(!_){var k=Qc(y);_=function(N,O){return bi(N,O,k)},y[fo]=_}return _}function Xc(y,_){var k=y[fo];return k||(k=function(N,O){return sn(N,O,_)},y[fo]=k),k}var Yc=Symbol();function Jc(y,_){y.push(_)}function ip(y,_,k){y.push(_,k.P)}function yi(y,_,k,N,O){var j=$s(O),L=k.P;y.push(_,function(Y,te,de){return L(Y,te,de,N,j)})}function cp(y,_,k,N,O,j){var L=Xc(N,j),Y=k.P;y.push(_,function(te,de,Ee){return Y(te,de,Ee,N,L)})}function Qc(y){var _=y[Yc];return _||Kc(y,y[Yc]=[],Jc,ip,yi,cp)}var Zc=Symbol();function Rs(y,_){y[0]=_}function vi(y,_,k,N){var O=k.O;y[_]=N?function(j,L,Y){return O(j,L,Y,N)}:O}function lp(y,_,k,N,O,j){var L=k.O,Y=qc(O);y[_]=function(te,de,Ee){return L(te,de,Ee,N,Y,j)}}function up(y,_,k,N,O,j,L){var Y=k.O,te=ga(N,O,j);y[_]=function(de,Ee,ze){return Y(de,Ee,ze,N,te,L)}}function el(y){var _=y[Zc];return _||Kc(y,y[Zc]={},Rs,vi,lp,up)}function tl(y,_,k){for(;Tt(_)&&_.h!=4;){var N=_.i,O=k[N];if(!O){var j=k[0];j&&(j=j[N])&&(O=k[N]=op(j))}if((!O||!O(_,y,N))&&(O=_,N=y,j=O.j,Yt(O),!O.W)){var L=O.g.h;O=O.g.g,O=j===O?be||(be=new Uint8Array(0)):Re?L.slice(j,O):new Uint8Array(L.subarray(j,O)),(j=N.ba)?j.push(O):N.ba=[O]}}return y}function po(y,_,k){if(vt.length){var N=vt.pop();y&&(Ke(N.g,y),N.i=-1,N.h=-1),y=N}else y=new yt(y);try{return tl(new _,y,el(k))}finally{_=y.g,_.h=null,_.j=0,_.i=0,_.g=0,_.v=!1,y.i=-1,y.h=-1,100>vt.length&&vt.push(y)}}function bi(y,_,k){for(var N=k.length,O=N%2==1,j=O?1:0;j<N;j+=2)(0,k[j+1])(_,y,k[j]);sn(y,_,O?k[0]:void 0)}function wi(y,_){var k=new rn;bi(y,k,Qc(_)),_n(k,k.g.end()),y=new Uint8Array(k.h),_=k.i;for(var N=_.length,O=0,j=0;j<N;j++){var L=_[j];y.set(L,O),O+=L.length}return k.i=[y],y}function ya(y,_){return{O:y,P:_}}var qn=ya(function(y,_,k){if(y.h!==5)return!1;y=y.g;var N=y.h[y.g],O=y.h[y.g+1],j=y.h[y.g+2],L=y.h[y.g+3];return y.g+=4,Ne(y),O=(N<<0|O<<8|j<<16|L<<24)>>>0,y=2*(O>>31)+1,N=O>>>23&255,O&=8388607,Ct(_,k,N==255?O?NaN:1/0*y:N==0?y*Math.pow(2,-149)*O:y*Math.pow(2,N-150)*(O+Math.pow(2,23))),!0},function(y,_,k){if(_=kn(_,k),_!=null){It(y.g,8*k+5),y=y.g;var N=_;N=(k=0>N?1:0)?-N:N,N===0?0<1/N?De=Pe=0:(Pe=0,De=2147483648):isNaN(N)?(Pe=0,De=2147483647):34028234663852886e22<N?(Pe=0,De=(k<<31|2139095040)>>>0):11754943508222875e-54>N?(N=Math.round(N/Math.pow(2,-149)),Pe=0,De=(k<<31|N)>>>0):(_=Math.floor(Math.log(N)/Math.LN2),N*=Math.pow(2,-_),N=Math.round(8388608*N),16777216<=N&&++_,Pe=0,De=(k<<31|_+127<<23|N&8388607)>>>0),k=De,y.g.push(k>>>
46800&255),y.g.push(k>>>8&255),y.g.push(k>>>16&255),y.g.push(k>>>24&255)}}),nl=ya(function(y,_,k){if(y.h!==0)return!1;for(var N=y.g,O=128,j=0,L=y=0;4>L&&128<=O;L++)O=N.h[N.g++],Ne(N),j|=(O&127)<<7*L;if(128<=O&&(O=N.h[N.g++],Ne(N),j|=(O&127)<<28,y|=(O&127)>>4),128<=O)for(L=0;5>L&&128<=O;L++)O=N.h[N.g++],Ne(N),y|=(O&127)<<7*L+3;if(128>O)N=j>>>0,O=y>>>0,(y=O&2147483648)&&(N=~N+1>>>0,O=~O>>>0,N==0&&(O=O+1>>>0)),N=4294967296*O+(N>>>0);else throw Ce();return Ct(_,k,y?-N:N),!0},function(y,_,k){if(_=kn(_,k),_!=null&&_!=null){It(y.g,8*k),y=y.g;var N=_;for(k=0>N,N=Math.abs(N),_=N>>>0,N=Math.floor((N-_)/4294967296),N>>>=0,k&&(N=~N>>>0,_=(~_>>>0)+1,4294967295<_&&(_=0,N++,4294967295<N&&(N=0))),De=_,Pe=N,k=De,_=Pe;0<_||127<k;)y.g.push(k&127|128),k=(k>>>7|_<<25)>>>0,_>>>=7;y.g.push(k)}}),dp=ya(function(y,_,k){return y.h!==0?!1:(Ct(_,k,Ge(y.g)),!0)},function(y,_,k){if(_=kn(_,k),_!=null&&_!=null)if(It(y.g,8*k),y=y.g,k=_,0<=k)It(y,k);else{for(_=0;9>_;_++)y.g.push(k&127|128),k>>=7;y.g.push(1)}}),rl=ya(function(y,_,k){if(y.h!==2)return!1;var N=Ge(y.g)>>>0;y=y.g;var O=y.g;y.g+=N,Ne(y),y=y.h;var j;if(K)(j=Q)||(j=Q=new TextDecoder("utf-8",{fatal:!0})),j=j.decode(y.subarray(O,O+N));else{N=O+N;for(var L=[],Y=null,te,de,Ee;O<N;)te=y[O++],128>te?L.push(te):224>te?O>=N?V():(de=y[O++],194>te||(de&192)!==128?(O--,V()):L.push((te&31)<<6|de&63)):240>te?O>=N-1?V():(de=y[O++],(de&192)!==128||te===224&&160>de||te===237&&160<=de||((j=y[O++])&192)!==128?(O--,V()):L.push((te&15)<<12|(de&63)<<6|j&63)):244>=te?O>=N-2?V():(de=y[O++],(de&192)!==128||(te<<28)+(de-144)>>30||((j=y[O++])&192)!==128||((Ee=y[O++])&192)!==128?(O--,V()):(te=(te&7)<<18|(de&63)<<12|(j&63)<<6|Ee&63,te-=65536,L.push((te>>10&1023)+55296,(te&1023)+56320))):V(),8192<=L.length&&(Y=X(Y,L),L.length=0);j=X(Y,L)}return Ct(_,k,j),!0},function(y,_,k){if(_=kn(_,k),_!=null){var N=!1;if(N=N===void 0?!1:N,ae){if(N&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(_))throw Error("Found an unpaired surrogate");_=(ee||(ee=new TextEncoder)).encode(_)}else{for(var O=0,j=new Uint8Array(3*_.length),L=0;L<_.length;L++){var Y=_.charCodeAt(L);if(128>Y)j[O++]=Y;else{if(2048>Y)j[O++]=Y>>6|192;else{if(55296<=Y&&57343>=Y){if(56319>=Y&&L<_.length){var te=_.charCodeAt(++L);if(56320<=te&&57343>=te){Y=1024*(Y-55296)+te-56320+65536,j[O++]=Y>>18|240,j[O++]=Y>>12&63|128,j[O++]=Y>>6&63|128,j[O++]=Y&63|128;continue}else L--}if(N)throw Error("Found an unpaired surrogate");Y=65533}j[O++]=Y>>12|224,j[O++]=Y>>6&63|128}j[O++]=Y&63|128}}_=j.subarray(0,O)}It(y.g,8*k+2),It(y.g,_.length),_n(y,y.g.end()),_n(y,_)}}),sl=ya(function(y,_,k,N,O){if(y.h!==2)return!1;_=le(_,k,N),k=y.g.i,N=Ge(y.g)>>>0;var j=y.g.g+N,L=j-k;if(0>=L&&(y.g.i=j,O(_,y),L=j-y.g.g),L)throw Error("Message parsing ended unexpectedly. Expected to read "+(N+" bytes, instead read "+(N-L)+" bytes, either the data ended unexpectedly or the message misreported its own length"));return y.g.g=j,y.g.i=k,!0},function(y,_,k,N,O){if(_=Z(_,N,k),_!=null)for(N=0;N<_.length;N++){var j=y;It(j.g,8*k+2);var L=j.g.end();_n(j,L),L.push(j.h),j=L,O(_[N],y),L=y;var Y=j.pop();for(Y=L.h+L.g.length()-Y;127<Y;)j.push(Y&127|128),Y>>>=7,L.h++;j.push(Y),L.h++}});function Kn(){Ur.apply(this,arguments)}if(m(Kn,Ur),pr){var Si={};Object.defineProperties(Kn,(Si[Symbol.hasInstance]=us(Object[Symbol.hasInstance]),Si))}function Vr(y){Kn.call(this,y)}m(Vr,Kn);function xi(){return[1,dp,2,qn,3,rl,4,rl]}function ho(y){Kn.call(this,y,-1,_i)}m(ho,Kn),ho.prototype.addClassification=function(y,_){return le(this,1,Vr,y,_),this};function al(){return[1,sl,Vr,xi]}var _i=[1];function va(y){Kn.call(this,y)}m(va,Kn);function Ii(){return[1,qn,2,qn,3,qn,4,qn,5,qn]}function mo(y){Kn.call(this,y,-1,yo)}m(mo,Kn);function go(){return[1,sl,va,Ii]}var yo=[1];function Ds(y){Kn.call(this,y)}m(Ds,Kn);function ki(){return[1,qn,2,qn,3,qn,4,qn,5,qn,6,nl]}var ba=[[61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]],wa=[[263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]],ol=[[276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]],F=[[33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]],q=[[46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]],ue=[[10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,3
vendor: 7,489 bytes, line 4680
468061],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]],Me=[].concat(l(ba),l(wa),l(ol),l(F),l(q),l(ue));function Le(y,_,k){if(k=y.createShader(k===0?y.VERTEX_SHADER:y.FRAGMENT_SHADER),y.shaderSource(k,_),y.compileShader(k),!y.getShaderParameter(k,y.COMPILE_STATUS))throw Error("Could not compile WebGL shader.\n\n"+y.getShaderInfoLog(k));return k}function Ve(y){return Z(y,Vr,1).map(function(_){return{index:Ae(_,1),ga:Mn(_,2),label:kn(_,3)!=null?ye(_,3):void 0,displayName:kn(_,4)!=null?ye(_,4):void 0}})}function we(y){return{x:Mn(y,1),y:Mn(y,2),z:Mn(y,3),visibility:kn(y,4)!=null?Mn(y,4):void 0}}function ke(y,_){this.h=y,this.g=_,this.l=0}function Nt(y,_,k){return Pn(y,_),typeof y.g.canvas.transferToImageBitmap=="function"?Promise.resolve(y.g.canvas.transferToImageBitmap()):k?Promise.resolve(y.g.canvas):typeof createImageBitmap=="function"?createImageBitmap(y.g.canvas):(y.i===void 0&&(y.i=document.createElement("canvas")),new Promise(function(N){y.i.height=y.g.canvas.height,y.i.width=y.g.canvas.width,y.i.getContext("2d",{}).drawImage(y.g.canvas,0,0,y.g.canvas.width,y.g.canvas.height),N(y.i)}))}function Pn(y,_){var k=y.g;if(y.o===void 0){var N=Le(k,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",0),O=Le(k,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D sampler0;\n void main(){\n gl_FragColor = texture2D(sampler0, vTex);\n }",1),j=k.createProgram();if(k.attachShader(j,N),k.attachShader(j,O),k.linkProgram(j),!k.getProgramParameter(j,k.LINK_STATUS))throw Error("Could not compile WebGL program.\n\n"+k.getProgramInfoLog(j));N=y.o=j,k.useProgram(N),O=k.getUniformLocation(N,"sampler0"),y.j={K:k.getAttribLocation(N,"aVertex"),J:k.getAttribLocation(N,"aTex"),ma:O},y.u=k.createBuffer(),k.bindBuffer(k.ARRAY_BUFFER,y.u),k.enableVertexAttribArray(y.j.K),k.vertexAttribPointer(y.j.K,2,k.FLOAT,!1,0,0),k.bufferData(k.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),k.STATIC_DRAW),k.bindBuffer(k.ARRAY_BUFFER,null),y.s=k.createBuffer(),k.bindBuffer(k.ARRAY_BUFFER,y.s),k.enableVertexAttribArray(y.j.J),k.vertexAttribPointer(y.j.J,2,k.FLOAT,!1,0,0),k.bufferData(k.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),k.STATIC_DRAW),k.bindBuffer(k.ARRAY_BUFFER,null),k.uniform1i(O,0)}N=y.j,k.useProgram(y.o),k.canvas.width=_.width,k.canvas.height=_.height,k.viewport(0,0,_.width,_.height),k.activeTexture(k.TEXTURE0),y.h.bindTexture2d(_.glName),k.enableVertexAttribArray(N.K),k.bindBuffer(k.ARRAY_BUFFER,y.u),k.vertexAttribPointer(N.K,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(N.J),k.bindBuffer(k.ARRAY_BUFFER,y.s),k.vertexAttribPointer(N.J,2,k.FLOAT,!1,0,0),k.bindFramebuffer(k.DRAW_FRAMEBUFFER?k.DRAW_FRAMEBUFFER:k.FRAMEBUFFER,null),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),k.colorMask(!0,!0,!0,!0),k.drawArrays(k.TRIANGLE_FAN,0,4),k.disableVertexAttribArray(N.K),k.disableVertexAttribArray(N.J),k.bindBuffer(k.ARRAY_BUFFER,null),y.h.bindTexture2d(0)}function Cr(y){this.g=y}var il=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function Ei(y,_){return _+y}function cl(y,_){window[y]=_}function En(y){var _=document.createElement("script");return _.setAttribute("src",y),_.setAttribute("crossorigin","anonymous"),new Promise(function(k){_.addEventListener("load",function(){k()},!1),_.addEventListener("error",function(){k()},!1),document.body.appendChild(_)})}function Fs(){return $(function(y){switch(y.g){case 1:return y.o=2,w(y,WebAssembly.instantiate(il),4);case 4:y.g=3,y.o=0;break;case 2:return y.o=0,y.j=null,y.return(!1);case 3:return y.return(!0)}})}function vo(y){if(this.g=y,this.listeners={},this.j={},this.H={},this.o={},this.u={},this.I=this.s=this.Z=!0,this.D=Promise.resolve(),this.Y="",this.C={},this.locateFile=y&&y.locateFile||Ei,typeof window=="object")var _=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else if(typeof location<"u")_=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/";else throw Error("solutions can only be loaded on a web page or in a web worker");if(this.$=_,y.options){_=i(Object.keys(y.options));for(var k=_.next();!k.done;k=_.next()){k=k.value;var N=y.options[k].default;N!==void 0&&(this.j[k]=typeof N=="function"?N():N)}}}t=vo.prototype,t.close=function(){return this.i&&this.i.delete(),Promise.resolve()};function s3(y){var _,k,N,O,j,L,Y,te,de,Ee,ze;return $(function(He){switch(He.g){case 1:return y.Z?(_=y.g.files===void 0?[]:typeof y.g.files=="function"?y.g.files(y.j):y.g.files,w(He,Fs(),2)):He.return();case 2:if(k=He.h,typeof window=="object")return cl("createMediapipeSolutionsWasm",{locateFile:y.locateFile}),cl("createMediapipeSolutionsPackedAssets",{locateFile:y.locateFile}),L=_.filter(function(Te){return Te.data!==void 0}),Y=_.filter(function(Te){return Te.data===void 0}),te=Promise.all(L.map(function(Te){var Xe=ll(y,Te.url);if(Te.path!==void 0){var ct=Te.path;Xe=Xe.then(function(Bt){return y.overrideFile(ct,Bt),Promise.resolve(Bt)})}return Xe})),de=Promise.all(Y.map(function(Te){return Te.simd===void 0||Te.simd&&k||!Te.simd&&!k?En(y.locateFile(Te.url,y.$)):Promise.resolve()})).then(function(){var Te,Xe,ct;return $(function(Bt){if(Bt.g==1)return Te=window.createMediapipeSolutionsWasm,Xe=window.createMediapipeSolutionsPackedAssets,ct=y,w(Bt,Te(Xe),2);ct.h=Bt.h,Bt.g=0})}),Ee=function(){return $(function(Te){return y.g.graph&&y.g.graph.url?Te=w(Te,ll(y,y.g.graph.url),0):(Te.g=0,Te=void 0),Te})}(),w(He,Promise.all([de,te,Ee]),7);if(typeof importScripts!="function")throw Error("solutions can only be loaded on a web page or in a web worker");return N=_.filter(function(Te){return Te.simd===void 0||Te.simd&&k||!Te.simd&&!k}).map(function(Te){return y.locateFile(Te.url,y.$)}),importScripts.apply(null,l(N)),O=y,w(He,createMediapipeSolutionsWasm(Module),6);case 6:O.h=He.h,y.l=new OffscreenCanvas(1,1),y.h.canvas=y.l,j=y.h.GL.createContext(y.l,{antialias:!1,alpha:!1,ja:typeof WebGL2RenderingContext<"u"?2:1}),y.h.GL.makeContextCurrent(j),He.g=4;break;case 7:if(y.l=document.createElement("canvas"),ze=y.l.getContext("webgl2",{}),!ze&&(ze=y.l.getContext("webgl",{}),!ze))return alert("Failed to create WebGL canvas context when passing video frame."),He.return();y.G=ze,y.h.canvas=y.l,y.h.createContext(y.l,!0,!0,{});case 4:y.i=new y.h.SolutionWasm,y.Z=!1,He.g=0}})}function a3(y){var _,k,N,O,j,L,Y,te;return $(function(de){if(de.g==1){if(y.g.graph&&y.g.graph.url&&y.Y===y.g.graph.url)return de.return();if(y.s=!0,!y.g.graph||!y.g.graph.url){de.g=2;return}return y.Y=y.g.graph.url,w(de,ll(y,y.g.graph.url),3)}for(de.g!=2&&(_=de.h,y.i.loadGraph(_)),k=i(Object.keys(y.C)),N=k.next();!N.done;N=k.next())O=N.value,y.i.overrideFile(O,y.C[O]);if(y.C={},y.g.listeners)for(j=i(y.g.listeners),L=j.next();!L.done;L=j.next())Y=L.value,l3(y,Y);te=y.j,y.j={},y.setOptions(te),de.g=0})}t.reset=function(){var y=this;return $(function(_){y.i&&(y.i.reset(),y.o={},y.u={}),_.g=0})},t.setOptions=function(y,_){var k=this;if(_=_||this.g.options){for(var N=[],O=[],j={},L=i(Object.keys(y)),Y=L.next();!Y.done;j={R:j.R,S:j.S},Y=L.next()){var te=Y.value;te in this.j&&this.j[te]===y[te]||(this.j[te]=y[te],Y=_[te],Y!==void 0&&(Y.onCh
4680ange&&(j.R=Y.onChange,j.S=y[te],N.push(function(de){return function(){var Ee;return $(function(ze){if(ze.g==1)return w(ze,de.R(de.S),2);Ee=ze.h,Ee===!0&&(k.s=!0),ze.g=0})}}(j))),Y.graphOptionXref&&(te={valueNumber:Y.type===1?y[te]:0,valueBoolean:Y.type===0?y[te]:!1,valueString:Y.type===2?y[te]:""},Y=Object.assign(Object.assign(Object.assign({},{calculatorName:"",calculatorIndex:0}),Y.graphOptionXref),te),O.push(Y))))}(N.length!==0||O.length!==0)&&(this.s=!0,this.B=(this.B===void 0?[]:this.B).concat(O),this.A=(this.A===void 0?[]:this.A).concat(N))}};function o3(y){var _,k,N,O,j,L,Y;return $(function(te){switch(te.g){case 1:if(!y.s)return te.return();if(!y.A){te.g=2;break}_=i(y.A),k=_.next();case 3:if(k.done){te.g=5;break}return N=k.value,w(te,N(),4);case 4:k=_.next(),te.g=3;break;case 5:y.A=void 0;case 2:if(y.B){for(O=new y.h.GraphOptionChangeRequestList,j=i(y.B),L=j.next();!L.done;L=j.next())Y=L.value,O.push_back(Y);y.i.changeOptions(O),O.delete(),y.B=void 0}y.s=!1,te.g=0}})}t.initialize=function(){var y=this;return $(function(_){return _.g==1?w(_,s3(y),2):_.g!=3?w(_,a3(y),3):w(_,o3(y),0)})};function ll(y,_){var k,N;return $(function(O){return _ in y.H?O.return(y.H[_]):(k=y.locateFile(_,""),N=fetch(k).then(function(j){return j.arrayBuffer()}),y.H[_]=N,O.return(N))})}t.overrideFile=function(y,_){this.i?this.i.overrideFile(y,_):this.C[y]=_},t.clearOverriddenFiles=function(){this.C={},this.i&&this.i.clearOverriddenFiles()},t.send=function(y,_){var k=this,N,O,j,L,Y,te,de,Ee,ze;return $(function(He){switch(He.g){case 1:return k.g.inputs?(N=1e3*(_==null?performance.now():_),w(He,k.D,2)):He.return();case 2:return w(He,k.initialize(),3);case 3:for(O=new k.h.PacketDataList,j=i(Object.keys(y)),L=j.next();!L.done;L=j.next())if(Y=L.value,te=k.g.inputs[Y]){e:{var Te=y[Y];switch(te.type){case"video":var Xe=k.o[te.stream];if(Xe||(Xe=new ke(k.h,k.G),k.o[te.stream]=Xe),Xe.l===0&&(Xe.l=Xe.h.createTexture()),typeof HTMLVideoElement<"u"&&Te instanceof HTMLVideoElement)var ct=Te.videoWidth,Bt=Te.videoHeight;else typeof HTMLImageElement<"u"&&Te instanceof HTMLImageElement?(ct=Te.naturalWidth,Bt=Te.naturalHeight):(ct=Te.width,Bt=Te.height);Bt={glName:Xe.l,width:ct,height:Bt},ct=Xe.g,ct.canvas.width=Bt.width,ct.canvas.height=Bt.height,ct.activeTexture(ct.TEXTURE0),Xe.h.bindTexture2d(Xe.l),ct.texImage2D(ct.TEXTURE_2D,0,ct.RGBA,ct.RGBA,ct.UNSIGNED_BYTE,Te),Xe.h.bindTexture2d(0),Xe=Bt;break e;case"detections":for(Xe=k.o[te.stream],Xe||(Xe=new Cr(k.h),k.o[te.stream]=Xe),Xe.data||(Xe.data=new Xe.g.DetectionListData),Xe.data.reset(Te.length),Bt=0;Bt<Te.length;++Bt){ct=Te[Bt];var Ft=Xe.data,vn=Ft.setBoundingBox,hr=Bt,Xn=ct.boundingBox,lt=new Ds;if(Ct(lt,1,Xn.xCenter),Ct(lt,2,Xn.yCenter),Ct(lt,3,Xn.height),Ct(lt,4,Xn.width),Ct(lt,5,Xn.rotation),Ct(lt,6,Xn.rectId),Xn=wi(lt,ki),vn.call(Ft,hr,Xn),ct.landmarks)for(Ft=0;Ft<ct.landmarks.length;++Ft){lt=ct.landmarks[Ft];var un=!!lt.visibility;vn=Xe.data,hr=vn.addNormalizedLandmark,Xn=Bt,lt=Object.assign(Object.assign({},lt),{visibility:un?lt.visibility:0}),un=new va,Ct(un,1,lt.x),Ct(un,2,lt.y),Ct(un,3,lt.z),lt.visibility&&Ct(un,4,lt.visibility),lt=wi(un,Ii),hr.call(vn,Xn,lt)}if(ct.V)for(Ft=0;Ft<ct.V.length;++Ft)vn=Xe.data,hr=vn.addClassification,Xn=Bt,lt=ct.V[Ft],un=new Vr,Ct(un,2,lt.ga),lt.index&&Ct(un,1,lt.index),lt.label&&Ct(un,3,lt.label),lt.displayName&&Ct(un,4,lt.displayName),lt=wi(un,xi),hr.call(vn,Xn,lt)}Xe=Xe.data;break e;default:Xe={}}}switch(de=Xe,Ee=te.stream,te.type){case"video":O.pushTexture2d(Object.assign(Object.assign({},de),{stream:Ee,timestamp:N}));break;case"detections":ze=de,ze.stream=Ee,ze.timestamp=N,O.pushDetectionList(ze);break;default:throw Error("Unknown input config type: '"+te.type+"'")}}return k.i.send(O),w(He,k.D,4);case 4:O.delete(),He.g=0}})};function i3(y,_,k){var N,O,j,L,Y,te,de,Ee,ze,He,Te,Xe,ct,Bt;return $(function(Ft){switch(Ft.g){case 1:if(!k)return Ft.return(_);for(N={},O=0,j=i(Object.keys(k)),L=j.next();!L.done;L=j.next())Y=L.value,te=k[Y],typeof te!="string"&&te.type==="texture"&&_[te.stream]!==void 0&&++O;1<O&&(y.I=!1),de=i(Object.keys(k)),L=de.next();case 2:if(L.done){Ft.g=4;break}if(Ee=L.value,ze=k[Ee],typeof ze=="string")return ct=N,Bt=Ee,w(Ft,c3(y,Ee,_[ze]),14);if(He=_[ze.stream],ze.type==="detection_list"){if(He){for(var vn=He.getRectList(),hr=He.getLandmarksList(),Xn=
4680He.getClassificationsList(),lt=[],un=0;un<vn.size();++un){var Ms=po(vn.get(un),Ds,ki);Ms={boundingBox:{xCenter:Mn(Ms,1),yCenter:Mn(Ms,2),height:Mn(Ms,3),width:Mn(Ms,4),rotation:Mn(Ms,5,0),rectId:Ae(Ms,6)},landmarks:Z(po(hr.get(un),mo,go),va,1).map(we),V:Ve(po(Xn.get(un),ho,al))},lt.push(Ms)}vn=lt}else vn=[];N[Ee]=vn,Ft.g=7;break}if(ze.type==="proto_list"){if(He){for(vn=Array(He.size()),hr=0;hr<He.size();hr++)vn[hr]=He.get(hr);He.delete()}else vn=[];N[Ee]=vn,Ft.g=7;break}if(He===void 0){Ft.g=3;break}if(ze.type==="float_list"){N[Ee]=He,Ft.g=7;break}if(ze.type==="proto"){N[Ee]=He,Ft.g=7;break}if(ze.type!=="texture")throw Error("Unknown output config type: '"+ze.type+"'");return Te=y.u[Ee],Te||(Te=new ke(y.h,y.G),y.u[Ee]=Te),w(Ft,Nt(Te,He,y.I),13);case 13:Xe=Ft.h,N[Ee]=Xe;case 7:ze.transform&&N[Ee]&&(N[Ee]=ze.transform(N[Ee])),Ft.g=3;break;case 14:ct[Bt]=Ft.h;case 3:L=de.next(),Ft.g=2;break;case 4:return Ft.return(N)}})}function c3(y,_,k){var N;return $(function(O){return typeof k=="number"||k instanceof Uint8Array||k instanceof y.h.Uint8BlobList?O.return(k):k instanceof y.h.Texture2dDataOut?(N=y.u[_],N||(N=new ke(y.h,y.G),y.u[_]=N),O.return(Nt(N,k,y.I))):O.return(void 0)})}function l3(y,_){for(var k=_.name||"$",N=[].concat(l(_.wants)),O=new y.h.StringList,j=i(_.wants),L=j.next();!L.done;L=j.next())O.push_back(L.value);j=y.h.PacketListener.implement({onResults:function(Y){for(var te={},de=0;de<_.wants.length;++de)te[N[de]]=Y.get(de);var Ee=y.listeners[k];Ee&&(y.D=i3(y,te,_.outs).then(function(ze){ze=Ee(ze);for(var He=0;He<_.wants.length;++He){var Te=te[N[He]];typeof Te=="object"&&Te.hasOwnProperty&&Te.hasOwnProperty("delete")&&Te.delete()}ze&&(y.D=ze)}))}}),y.i.attachMultiListener(O,j),O.delete()}t.onResults=function(y,_){this.listeners[_||"$"]=y},H("Solution",vo),H("OptionType",{BOOL:0,NUMBER:1,ia:2,0:"BOOL",1:"NUMBER",2:"STRING"});function ky(y){var _=this;y=y||{};var k={url:"face_detection_short.binarypb"},N={type:1,graphOptionXref:{calculatorType:"TensorsToDetectionsCalculator",calculatorName:"facedetectionshortrangegpu__facedetectionshortrangecommon__TensorsToDetectionsCalculator",fieldName:"min_score_thresh"}};this.g=new vo({locateFile:y.locateFile,files:[{data:!0,url:"face_detection_short.binarypb"},{data:!0,url:"face_detection_short_range.tflite"},{simd:!0,url:"face_detection_solution_simd_wasm_bin.js"},{simd:!1,url:"face_detection_solution_wasm_bin.js"}],graph:k,listeners:[{wants:["detections","image_transformed"],outs:{image:"image_transformed",detections:{type:"detection_list",stream:"detections"}}}],inputs:{image:{type:"video",stream:"input_frames_gpu"}},options:{useCpuInference:{type:0,graphOptionXref:{calculatorType:"InferenceCalculator",fieldName:"use_cpu_inference"},default:typeof window!="object"||window.navigator===void 0?!1:"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},selfieMode:{type:0,graphOptionXref:{calculatorType:"GlScalerCalculator",calculatorIndex:1,fieldName:"flip_horizontal"}},model:{type:0,onChange:function(O){var j,L,Y,te,de,Ee;return $(function(ze){switch(ze.g){case 1:j=O==="short"?["face_detection_short_range.tflite"]:["face_detection_full_range_sparse.tflite"],L=i(j),Y=L.next();case 2:if(Y.done){ze.g=4;break}return te=Y.value,de="third_party/mediapipe/modules/face_detection/"+te,w(ze,ll(_.g,te),5);case 5:Ee=ze.h,_.g.overrideFile(de,Ee),Y=L.next(),ze.g=2;break;case 4:return k.url=O==="short"?"face_detection_short.binarypb":"face_detection_full.binarypb",N.graphOptionXref.calculatorName=O==="short"?"facedetectionshortrangegpu__facedetectionshortrangecommon__TensorsToDetectionsCalculator":"facedetectionfullrangegpu__facedetectionfullrangecommon__TensorsToDetectionsCalculator",ze.return(!0)}})}},minDetectionConfidence:N}})}t=ky.prototype,t.close=function(){return this.g.close(),Promise.resolve()},t.onResults=function(y){this.g.onResults(y)},t.initialize=function(){var y=this;return $(function(_){return w(_,y.g.initialize(),0)})},t.reset=function(){this.g.reset()},t.send=function(y){var _=this;return $(function(k){return w(k,_.g.send(y),0)})},t.setOptions=function(y){this.g.setOptions(y)},H("FaceDetection",ky),H("FACEDETECTION_LIPS",ba),H("FACEDETECTION_LEFT_EYE",wa),H("FACEDETECTION_LEFT_EYEBROW",ol),H("FACEDETECTION_RIGHT_EYE",F),H("FACEDETECTION_RIGHT_EYEBROW",q),H("FACEDETECTION_FACE_OVAL",ue),H("FACEDETECTION_CONTOURS",Me),H("FACEDETECTION_TESSELATION",[
vendor: 24,341 bytes, line 4680
4680[127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]
4680]),H("VERSION","0.4.1646425229")}).call(kp)),kp}var h5=p5(),m5=f5(h5);/** 4681 * @license 4682 * Copyright 2021 Google LLC. All Rights Reserved. 4683 * Licensed under the Apache License, Version 2.0 (the "License"); 4684 * you may not use this file except in compliance with the License. 4685 * You may obtain a copy of the License at 4686 * 4687 * http://www.apache.org/licenses/LICENSE-2.0 4688 * 4689 * Unless required by applicable law or agreed to in writing, software 4690 * distributed under the License is distributed on an "AS IS" BASIS, 4691 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4692 * See the License for the specific language governing permissions and 4693 * limitations under the License. 4694 * ============================================================================= 4695 */const g5=Qe();g5.registerFlag("KEEP_INTERMEDIATE_TENSORS",()=>!1,t=>{t&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")});/** 4696 * @license 4697 * Copyright 2019 Google LLC. All Rights Reserved. 4698 * Licensed under the Apache License, Version 2.0 (the "License"); 4699 * you may not use this file except in compliance with the License. 4700 * You may obtain a copy of the License at 4701 * 4702 * http://www.apache.org/licenses/LICENSE-2.0 4703 * 4704 * Unless required by applicable law or agreed to in writing, software 4705 * distributed under the License is distributed on an "AS IS" BASIS, 4706 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4707 * See the License for the specific language governing permissions and 4708 * limitations under the License. 4709 * 4710 * ============================================================================= 4711 */var gr;(function(t){t[t.DT_INVALID=0]="DT_INVALID",t[t.DT_FLOAT=1]="DT_FLOAT",t[t.DT_DOUBLE=2]="DT_DOUBLE",t[t.DT_INT32=3]="DT_INT32",t[t.DT_UINT8=4]="DT_UINT8",t[t.DT_INT16=5]="DT_INT16",t[t.DT_INT8=6]="DT_INT8",t[t.DT_STRING=7]="DT_STRING",t[t.DT_COMPLEX64=8]="DT_COMPLEX64",t[t.DT_INT64=9]="DT_INT64",t[t.DT_BOOL=10]="DT_BOOL",t[t.DT_QINT8=11]="DT_QINT8",t[t.DT_QUINT8=12]="DT_QUINT8",t[t.DT_QINT32=13]="DT_QINT32",t[t.DT_BFLOAT16=14]="DT_BFLOAT16",t[t.DT_QINT16=15]="DT_QINT16",t[t.DT_QUINT16=16]="DT_QUINT16",t[t.DT_UINT16=17]="DT_UINT16",t[t.DT_COMPLEX128=18]="DT_COMPLEX128",t[t.DT_HALF=19]="DT_HALF",t[t.DT_RESOURCE=20]="DT_RESOURCE",t[t.DT_VARIANT=21]="DT_VARIANT",t[t.DT_UINT32=22]="DT_UINT32",t[t.DT_UINT64=23]="DT_UINT64",t[t.DT_FLOAT_REF=101]="DT_FLOAT_REF",t[t.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",t[t.DT_INT32_REF=103]="DT_INT32_REF",t[t.DT_UINT8_REF=104]="DT_UINT8_REF",t[t.DT_INT16_REF=105]="DT_INT16_REF",t[t.DT_INT8_REF=106]="DT_INT8_REF",t[t.DT_STRING_REF=107]="DT_STRING_REF",t[t.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",t[t.DT_INT64_REF=109]="DT_INT64_REF",t[t.DT_BOOL_REF=110]="DT_BOOL_REF",t[t.DT_QINT8_REF=111]="DT_QINT8_REF",t[t.DT_QUINT8_REF=112]="DT_QUINT8_REF",t[t.DT_QINT32_REF=113]="DT_QINT32_REF",t[t.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",t[t.DT_QINT16_REF=115]="DT_QINT16_REF",t[t.DT_QUINT16_REF=116]="DT_QUINT16_REF",t[t.DT_UINT16_REF=117]="DT_UINT16_REF",t[t.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",t[t.DT_HALF_REF=119]="DT_HALF_REF",t[t.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",t[t.DT_VARIANT_REF=121]="DT_VARIANT_REF",t[t.DT_UINT32_REF=122]="DT_UINT32_REF",t[t.DT_UINT64_REF=123]="DT_UINT64_REF"})(gr||(gr={}));var Ov;(function(t){(function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"})(t.CheckpointFormatVersion||(t.CheckpointFormatVersion={}))})(Ov||(Ov={}));/** 4712 * @license 4713 * Copyright 2019 Google LLC. All Rights Reserved. 4714 * Licensed under the Apache License, Version 2.0 (the "License"); 4715 * you may not use this file except in compliance with the License. 4716 * You may obtain a copy of the License at 4717 * 4718 * http://www.apache.org/licenses/LICENSE-2.0 4719 * 4720 * Unless required by applicable law or agreed to in writing, software 4721 * distributed under the License is distributed on an "AS IS" BASIS, 4722 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4723 * See the License for the specific language governing permissions and 4724 * limitations under the License. 4725 * ============================================================================= 4726 */const y5={};function q2(t){return y5[t]}/** 4727 * @license 4728 * Copyright 2018 Google LLC. All Rights Reserved. 4729 * Licensed under the Apache License, Version 2.0 (the "License");
4730 * you may not use this file except in compliance with the License. 4731 * You may obtain a copy of the License at 4732 * 4733 * http://www.apache.org/licenses/LICENSE-2.0 4734 * 4735 * Unless required by applicable law or agreed to in writing, software 4736 * distributed under the License is distributed on an "AS IS" BASIS, 4737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4738 * See the License for the specific language governing permissions and 4739 * limitations under the License. 4740 * ============================================================================= 4741 */function x(t,e,n,r,s){const a=e.inputParams[t];if(a&&a.inputIndexStart!==void 0){const i=a.inputIndexStart,l=a.inputIndexEnd===0?void 0:a.inputIndexEnd===void 0?i+1:a.inputIndexEnd,u=i<0?e.inputNames.length+i:i;if(a.type==="tensor")return hn(e.inputNames[u],n,r,s);if(a.type==="tensors"){const f=e.inputs.slice(i,l);return e.inputNames.slice(i,l).filter((h,m)=>{var g;return((g=f[m])===null||g===void 0?void 0:g.op)!=="NoOp"}).map(h=>hn(h,n,r,s))}const c=hn(e.inputNames[u],n,r,s),d=c.dataSync();return a.type==="number"?d[0]:_r(c.shape,d)}const o=e.attrParams[t];return o&&o.value}function hn(t,e,n,r){const[s,a]=Jn(t,n);if(r!=null){const i=r.getHashTableHandleByName(s);if(i!=null)return i}const o=n.currentContextIds.find(i=>!!e[pu(s,i)]);return o!==void 0?e[pu(s,o)][a]:void 0}function Pv(t,e,n){return e[pu(t,n.currentContextId)]}function hs(t,e){const[n,r,s]=Jn(t,e);return[pu(n,e&&e.currentContextId),r,s]}function pu(t,e){return e?"".concat(t,"-").concat(e):t}function Jn(t,e){if(t==="")return["",0,void 0];const n=e!=null&&e.parseNodeNameCache!=null;if(n){const a=e.parseNodeNameCache.get(t);if(a!=null)return a}const r=t.split(":");let s;if(r.length===1)s=[t,0,void 0];else{const a=r[0],o=r.length===3?r[1]:void 0,i=Number(r[r.length-1]);s=[a,i,o]}return n&&e.parseNodeNameCache.set(t,s),s}function Ol(t,e,n){let r=x("pad",t,e,n);if(r==="explicit"){r=x("explicitPaddings",t,e,n);const s=[[0,0],[0,0],[0,0],[0,0]];for(let a=0;a<4;a++)s[a][0]=r[a*2],s[a][1]=r[a*2+1];return s}return r}function ms(t){return t.kept?t:Xs(t)}/** 4742 * @license 4743 * Copyright 2023 Google LLC. All Rights Reserved. 4744 * Licensed under the Apache License, Version 2.0 (the "License"); 4745 * you may not use this file except in compliance with the License. 4746 * You may obtain a copy of the License at 4747 * 4748 * http://www.apache.org/licenses/LICENSE-2.0 4749 * 4750 * Unless required by applicable law or agreed to in writing, software 4751 * distributed under the License is distributed on an "AS IS" BASIS, 4752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4753 * See the License for the specific language governing permissions and 4754 * limitations under the License. 4755 * ============================================================================= 4756 */const v5=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
4756]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],b5=Object.freeze(Object.defineProperty({__proto__:null,json:v5},Symbol.toStringTag,{value:"Module"}));/** 4757 * @license 4758 * Copyright 2023 Google LLC. All Rights Reserved. 4759 * Licensed under the Apache License, Version 2.0 (the "License"); 4760 * you may not use this file except in compliance with the License. 4761 * You may obtain a copy of the License at 4762 * 4763 * http://www.apache.org/licenses/LICENSE-2.0 4764 * 4765 * Unless required by applicable law or agreed to in writing, software 4766 * distributed under the License is distributed on an "AS IS" BASIS, 4767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4768 * See the License for the specific language governing permissions and 4769 * limitations under the License. 4770 * ============================================================================= 4771 */const w5
vendor: 6,810 bytes, line 4771
4771=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],
4771S5=Object.freeze(Object.defineProperty({__proto__:null,json:w5},Symbol.toStringTag,{value:"Module"}));/** 4772 * @license 4773 * Copyright 2023 Google LLC. All Rights Reserved. 4774 * Licensed under the Apache License, Version 2.0 (the "License"); 4775 * you may not use this file except in compliance with the License. 4776 * You may obtain a copy of the License at 4777 * 4778 * http://www.apache.org/licenses/LICENSE-2.0 4779 * 4780 * Unless required by applicable law or agreed to in writing, software 4781 * distributed under the License is distributed on an "AS IS" BASIS, 4782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4783 * See the License for the specific language governing permissions and 4784 * limitations under the License. 4785 * ============================================================================= 4786 */const x5=
vendor: 7,588 bytes, line 4786
4786[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}]
4786,_5=Object.freeze(Object.defineProperty({__proto__:null,json:x5},Symbol.toStringTag,{value:"Module"}));/** 4787 * @license 4788 * Copyright 2023 Google LLC. All Rights Reserved. 4789 * Licensed under the Apache License, Version 2.0 (the "License"); 4790 * you may not use this file except in compliance with the License. 4791 * You may obtain a copy of the License at 4792 * 4793 * http://www.apache.org/licenses/LICENSE-2.0 4794 * 4795 * Unless required by applicable law or agreed to in writing, software 4796 * distributed under the License is distributed on an "AS IS" BASIS, 4797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4798 * See the License for the specific language governing permissions and 4799 * limitations under the License. 4800 * ============================================================================= 4801 */const I5=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}
vendor: 4,969 bytes, lines 4801-4804
4801,{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}],k5=Object.freeze(Object.defineProperty({__proto__:null,json:I5},Symbol.toStringTag,{value:"Module"}));/** 4802 * @license 4803 * Copyright 2023 Google LLC. All Rights Reserved. 4804 * Licensed under the Apache License, Version 2.0 (the "License");
4805 * you may not use this file except in compliance with the License. 4806 * You may obtain a copy of the License at 4807 * 4808 * http://www.apache.org/licenses/LICENSE-2.0 4809 * 4810 * Unless required by applicable law or agreed to in writing, software 4811 * distributed under the License is distributed on an "AS IS" BASIS, 4812 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4813 * See the License for the specific language governing permissions and 4814 * limitations under the License. 4815 * ============================================================================= 4816 */const E5=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}],T5=Object.freeze(Object.defineProperty({__proto__:null,json:E5},Symbol.toStringTag,{value:"Module"}));/** 4817 * @license 4818 * Copyright 2023 Google LLC. All Rights Reserved. 4819 * Licensed under the Apache License, Version 2.0 (the "License");
4820 * you may not use this file except in compliance with the License. 4821 * You may obtain a copy of the License at 4822 * 4823 * http://www.apache.org/licenses/LICENSE-2.0 4824 * 4825 * Unless required by applicable law or agreed to in writing, software 4826 * distributed under the License is distributed on an "AS IS" BASIS, 4827 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4828 * See the License for the specific language governing permissions and 4829 * limitations under the License. 4830 * ============================================================================= 4831 */const C5=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}],N5=Object.freeze(Object.defineProperty({__proto__:null,json:C5},Symbol.toStringTag,{value:"Module"}));/** 4832 * @license 4833 * Copyright 2023 Google LLC. All Rights Reserved. 4834 * Licensed under the Apache License, Version 2.0 (the "License"); 4835 * you may not use this file except in compliance with the License. 4836 * You may obtain a copy of the License at 4837 * 4838 * http://www.apache.org/licenses/LICENSE-2.0 4839 * 4840 * Unless required by applicable law or agreed to in writing, software 4841 * distributed under the License is distributed on an "AS IS" BASIS, 4842 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4843 * See the License for the specific language governing permissions and 4844 * limitations under the License. 4845 * ============================================================================= 4846 */const A5=[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}],$5=Object.freeze(Object.defineProperty({__proto__:null,json:A5},Symbol.toStringTag,{value:"Module"}));/** 4847 * @license 4848 * Copyright 2023 Google LLC. All Rights Reserved. 4849 * Licensed under the Apache License, Version 2.0 (the "License"); 4850 * you may not use this file except in compliance with the License. 4851 * You may obtain a copy of the License at 4852 * 4853 * http://www.apache.org/licenses/LICENSE-2.0 4854 * 4855 * Unless required by applicable law or agreed to in writing, softw
4855are 4856 * distributed under the License is distributed on an "AS IS" BASIS, 4857 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4858 * See the License for the specific language governing permissions and 4859 * limitations under the License. 4860 * ============================================================================= 4861 */const R5=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}],D5=Object.freeze(Object.defineProperty({__proto__:null,json:R5},Symbol.toStringTag,{value:"Module"}));/** 4862 * @license 4863 * Copyright 2023 Google LLC. All Rights Reserved. 4864 * Licensed under the Apache License, Version 2.0 (the "License"); 4865 * you may not use this file except in compliance with the License. 4866 * You may obtain a copy of the License at 4867 * 4868 * http://www.apache.org/licenses/LICENSE-2.0 4869 * 4870 * Unless required by applicable law or agreed to in writing, software 4871 * distributed under the License is distributed on an "AS IS" BASIS, 4872 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4873 * See the License for the specific language governing permissions and 4874 * limitations under the License. 4875 * ============================================================================= 4876 */const F5=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}
4876],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],M5=Object.freeze(Object.defineProperty({__proto__:null,json:F5},Symbol.toStringTag,{value:"Module"}));/** 4877 * @license 4878 * Copyright 2023 Google LLC. All Rights Reserved. 4879 * Licensed under the Apache License, Version 2.0 (the "License"); 4880 * you may not use this file except in compliance with the License. 4881 * You may obtain a copy of the License at 4882 * 4883 * http://www.apache.org/licenses/LICENSE-2.0 4884 * 4885 * Unless required by applicable law or agreed to in writing, software 4886 * distributed under the License is distributed on an "AS IS" BASIS, 4887 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4888 * See the License for the specific language governing permissions and 4889 * limitations under the License. 4890 * ============================================================================= 4891 */const O5=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}],P5=Object.freeze(Object.defineProperty({__proto__:null,json:O5},Symbol.toStringTag,{value:"Module"}));/** 4892 * @license 4893 * Copyright 2023 Google LLC. All Rights Reserved. 4894 * Licensed under the Apache License, Version 2.0 (the "License"); 4895 * you may not use this file except in compliance with the License. 4896 * You may obtain a copy of the License at 4897 * 4898 * http://www.apache.org/licenses/LICENSE-2.0 4899 * 4900 * Unless required by applicable law or agreed to in writing, software 4901 * distributed under the License is distributed on an "AS IS" BASIS, 4902 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4903 * See the License for the specific language governing permissions and 4904 * limitations under the License. 4905 * ============================================================================= 4906 */const B5=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
4906]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}],L5=Object.freeze(Object.defineProperty({__proto__:null,json:B5},Symbol.toStringTag,{value:"Module"}));/** 4907 * @license 4908 * Copyright 2023 Google LLC. All Rights Reserved. 4909 * Licensed under the Apache License, Version 2.0 (the "License"); 4910 * you may not use this file except in compliance with the License. 4911 * You may obtain a copy of the License at 4912 * 4913 * http://www.apache.org/licenses/LICENSE-2.0 4914 * 4915 * Unless required by applicable law or agreed to in writing, software 4916 * distributed under the License is distributed on an "AS IS" BASIS, 4917 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4918 * See the License for the specific language governing permissions and 4919 * limitations under the License. 4920 * ============================================================================= 4921 */const W5=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
vendor: 15,939 bytes, lines 4921-5014
4921]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}],z5=Object.freeze(Object.defineProperty({__proto__:null,json:W5},Symbol.toStringTag,{value:"Module"}));/** 4922 * @license 4923 * Copyright 2023 Google LLC. All Rights Reserved. 4924 * Licensed under the Apache License, Version 2.0 (the "License"); 4925 * you may not use this file except in compliance with the License. 4926 * You may obtain a copy of the License at 4927 * 4928 * http://www.apache.org/licenses/LICENSE-2.0 4929 * 4930 * Unless required by applicable law or agreed to in writing, software 4931 * distributed under the License is distributed on an "AS IS" BASIS, 4932 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4933 * See the License for the specific language governing permissions and 4934 * limitations under the License. 4935 * ============================================================================= 4936 */const H5=[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}],U5=Object.freeze(Object.defineProperty({__proto__:null,json:H5},Symbol.toStringTag,{value:"Module"}));/** 4937 * @license 4938 * Copyright 2023 Google LLC. All Rights Reserved. 4939 * Licensed under the Apache License, Version 2.0 (the "License"); 4940 * you may not use this file except in compliance with the License. 4941 * You may obtain a copy of the License at 4942 * 4943 * http://www.apache.org/licenses/LICENSE-2.0 4944 * 4945 * Unless required by applicable law or agreed to in writing, software 4946 * distributed under the License is distributed on an "AS IS" BASIS, 4947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4948 * See the License for the specific language governing permissions and 4949 * limitations under the License. 4950 * ============================================================================= 4951 */const V5=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}],j5=Object.freeze(Object.defineProperty({__proto__:null,json:V5},Symbol.toStringTag,{value:"Module"}));/** 4952 * @license 4953 * Copyright 2023 Google LLC. All Rights Reserved. 4954 * Licensed under the Apache License, Version 2.0 (the "License"); 4955 * you may not use this file except in compliance with the License. 4956 * You may obtain a copy of the License at 4957 * 4958 * http://www.apache.org/licenses/LICENSE-2.0 4959 * 4960 * Unless required by applicable law or agreed to in writing, software 4961 * distributed under the License is distributed on an "AS IS" BASIS, 4962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4963 * See the License for the specific language governing permissions and 4964 * limitations under the License. 4965 * ============================================================================= 4966 */const G5=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}],q5=Object.freeze(Object.defineProperty({__proto__:null,json:G5},Symbol.toStringTag,{value:"Module"}));/** 4967 * @license 4968 * Copyright 2023 Google LLC. All Rights Reserved. 4969 * Licensed under the Apache License, Version 2.0 (the "License"); 4970 * you may not use this file except in compliance with the License. 4971 * You may obtain a copy of the License at 4972 * 4973 * http://www.apache.org/licenses/LICENSE-2.0 4974 * 4975 * Unless required by applicable law or agreed to in writing, software 4976 * distributed under the License is distributed on an "AS IS" BASIS, 4977 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4978 * See the License for the specific language governing permissions and 4979 * limitations under the License. 4980 * ============================================================================= 4981 */const K5=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}],X5=Object.freeze(Object.defineProperty({__proto__:null,json:K5},Symbol.toStringTag,{value:"Module"}));/** 4982 * @license 4983 * Copyright 2023 Google LLC. All Rights Reserved. 4984 * Licensed under the Apache License, Version 2.0 (the "License"); 4985 * you may not use this file except in compliance with the License. 4986 * You may obtain a copy of the License at 4987 * 4988 * http://www.apache.org/licenses/LICENSE-2.0 4989 * 4990 * Unless required by applicable law or agreed to in writing, software 4991 * distributed under the License is distributed on an "AS IS" BASIS, 4992 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4993 * See the License for the specific language governing permissions and 4994 * limitations under the License. 4995 * ============================================================================= 4996 */const Y5=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}],J5=Object.freeze(Object.defineProperty({__proto__:null,json:Y5},Symbol.toStringTag,{value:"Module"}));/** 4997 * @license 4998 * Copyright 2023 Google LLC. All Rights Reserved. 4999 * Licensed under the Apache License, Version 2.0 (the "License"); 5000 * you may not use this file except in compliance with the License. 5001 * You may obtain a copy of the License at 5002 * 5003 * http://www.apache.org/licenses/LICENSE-2.0 5004 * 5005 * Unless required by applicable law or agreed to in writing, software 5006 * distributed under the License is distributed on an "AS IS" BASIS, 5007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5008 * See the License for the specific language governing permissions and 5009 * limitations under the License. 5010 * ============================================================================= 5011 */const Q5=[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}],Z5=Object.freeze(Object.defineProperty({__proto__:null,json:Q5},Symbol.toStringTag,{value:"Module"}));/** 5012 * @license 5013 * Copyright 2023 Google LLC. All Rights Reserved. 5014 * Licensed under the Apache License, Version 2.0 (the "License");
5015 * you may not use this file except in compliance with the License. 5016 * You may obtain a copy of the License at 5017 * 5018 * http://www.apache.org/licenses/LICENSE-2.0 5019 * 5020 * Unless required by applicable law or agreed to in writing, software 5021 * distributed under the License is distributed on an "AS IS" BASIS, 5022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5023 * See the License for the specific language governing permissions and 5024 * limitations under the License. 5025 * ============================================================================= 5026 */const e8=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}],t8=Object.freeze(Object.defineProperty({__proto__:null,json:e8},Symbol.toStringTag,{value:"Module"}));/** 5027 * @license 5028 * Copyright 2018 Google LLC. All Rights Reserved. 5029 * Licensed under the Apache License, Version 2.0 (the "License"); 5030 * you may not use this file except in compliance with the License. 5031 * You may obtain a copy of the License at 5032 * 5033 * http://www.apache.org/licenses/LICENSE-2.0 5034 * 5035 * Unless required by applicable law or agreed to in writing, software 5036 * distributed under the License is distributed on an "AS IS" BASIS, 5037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5038 * See the License for the specific language governing permissions and 5039 * limitations under the License. 5040 * ============================================================================= 5041 */class Bv{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[b5,S5,_5,k5,T5,N5,$5,D5,M5,P5,L5,z5,U5,j5,q5,X5,J5,Z5,t8],n=[].concat(...e.map(r=>r.json));this.opMappers=n.reduce((r,s)=>(r[s.tfOpName]=s,r),{})}transformGraph(e,n={}){const r=e.node,s=[],a=[],o=[],i=r.reduce((m,g)=>(m[g.name]=this.mapNode(g),g.op.startsWith("Placeholder")?s.push(m[g.name]):g.op==="Const"?a.push(m[g.name]):(g.input==null||g.input.length===0)&&o.push(m[g.name]),m),{});let l=[];const u=[];let c={},d={};n!=null&&(c=this.mapSignatureEntries(n.inputs),d=this.mapSignatureEntries(n.outputs));const f=Object.keys(i);f.forEach(m=>{const g=i[m];
5041g.inputNames.forEach((v,b)=>{const[w,,S]=hs(v),I=i[w];if(I.outputs!=null){const E=I.outputs.indexOf(S);if(E!==-1){const T="".concat(w,":").concat(E);g.inputNames[b]=T}}g.inputs.push(I),I.children.push(g)})}),Object.keys(d).length===0?f.forEach(m=>{const g=i[m];g.children.length===0&&u.push(g)}):Object.keys(d).forEach(m=>{const[g]=hs(m),v=i[g];v!=null&&(v.signatureKey=d[m],u.push(v))}),Object.keys(c).length>0?Object.keys(c).forEach(m=>{const[g]=hs(m),v=i[g];v&&(v.signatureKey=c[m],l.push(v))}):l=s;let p={};e.library!=null&&e.library.function!=null&&(p=e.library.function.reduce((m,g)=>(m[g.signature.name]=this.mapFunction(g),m),{}));const h={nodes:i,inputs:l,outputs:u,weights:a,placeholders:s,signature:n,functions:p};return o.length>0&&(h.initNodes=o),h}mapSignatureEntries(e){return Object.keys(e||{}).reduce((n,r)=>(n[e[r].name]=r,n),{})}mapNode(e){const n=q2(e.op)||this.opMappers[e.op]||{};e.attr==null&&(e.attr={});const r={name:e.name,op:e.op,category:n.category,inputNames:(e.input||[]).map(s=>s.startsWith("^")?s.slice(1):s),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:n.outputs};return n.inputs!=null&&(r.inputParams=n.inputs.reduce((s,a)=>(s[a.name]={type:a.type,inputIndexStart:a.start,inputIndexEnd:a.end},s),{})),n.attrs!=null&&(r.attrParams=n.attrs.reduce((s,a)=>{const o=a.type;let i;switch(a.type){case"string":i=Rh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Rh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"string[]":i=Lh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Lh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"number":i=Fh(e.attr,a.tfName,a.defaultValue||0),i===void 0&&a.tfDeprecatedName&&(i=Fh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"number[]":i=Bh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Bh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool":i=Dh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Dh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool[]":i=zh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=zh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape":i=Ph(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Ph(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape[]":i=Wh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Wh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype":i=Mh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Mh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype[]":i=Oh(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Oh(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"func":i=Lv(e.attr,a.tfName,a.defaultValue),i===void 0&&a.tfDeprecatedName&&(i=Lv(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: ".concat(a.type," for op: ").concat(e.op))}return s[a.name]={value:i,type:o},s},{})),r}mapFunction(e){const n=e.nodeDef,r=[],s=[];let a={};n!=null&&(a=n.reduce((d,f)=>(d[f.name]=this.mapNode(f),f.op==="Const"&&s.push(d[f.name]),d),{}));const o=[],i=[];e.signature.inputArg.forEach(d=>{const[f]=hs(d.name),p={name:f,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:Og(d.type),type:"dtype"}},children:[]};p.signatureKey=d.name,o.push(p),a[f]=p}),Object.keys(a).forEach(d=>{const f=a[d];f.inputNames.forEach((p,h)=>{const[m,,g]=hs(p),v=a[m];if(v.outputs!=null){const b=v.outputs.indexOf(g);if(b!==-1){const w="".concat(m,":").concat(b);f.inputNames[h]=w}}f.inputs.push(v),v.children.push(f)})});const u=e.ret;e.signature.outputArg.forEach(d=>{const[f,p]=hs(u[d.name]),h=a[f];h!=null&&(h.defaultOutput=p,i.push(h))});const c=this.mapArgsToSignature(e);return{nodes:a,inputs:o,outputs:i,weights:s,placeholders:r,signature:c}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((n,r)=>(n[r.name]=this.mapArgToTensorInfo(r),n),{}),outputs:e.signature.outputArg.reduce((n,r)=>(n[r.name]=this.mapArgToTensorInfo(r,e.ret),n),{})}}mapArgToTensorInfo(e,n){let r=e.name;return n!=null&&(r=n[r]),{name:r,dtype:e.type}}}function n8(t){const e=Qe().global;if(typeof e.atob<"u")return e.atob(t);if(typeof Buffer<"u")return new Buffer(t,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function K2(t,e){const n=Array.isArray(t)?String.fromCharCode.apply(null,t):n8(t);return e?n:n.toLowerCase()}function Rh(t,e,n,r=!1){const s=t[e];return s!=null?K2(s.s,r):n}function Dh(t,e,n){const r=t[e];return r?r.b:n}function Fh(t,e,n){const r=t[e]||{},s=r.i!=null?r.i:r.f!=null?r.f:n;return typeof s=="number"?s:parseInt(s,10)}function Og(t){switch(typeof t=="string"&&(t=gr[t]),t){case gr.DT_FLOAT:case gr.DT_HALF:return"float32";case gr.DT_INT32:case gr.DT_INT64:case gr.DT_INT8:case gr.DT_UINT8:return"int32";case gr.DT_BOOL:return"bool";case gr.DT_DOUBLE:return"float32";case gr.DT_STRING:return"string";default:return null}}function Lv(t,e,n){const r=t[e];return r&&r.func?r.func.name:n}function Mh(t,e,n){const r=t[e];return r&&r.type?Og(r.type):n}function Oh(t,e,n){const r=t[e];return r&&r.list&&r.list.type?r.list.type.map(s=>Og(s)):n}function X2(t){if(!t.unknownRank)return t.dim!=null?t.dim.map(e=>typeof e.size=="number"?e.size:parseInt(e.size,10)):[]}function Ph(t,e,n){const r=t[e];return r&&r.shape?X2(r.shape):n}function Bh(t,e,n){const r=t[e];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map(s=>typeof s=="number"?s:parseInt(s,10)):n}function Lh(t,e,n,r=!1){const s=t[e];return s&&s.list&&s.list.s?s.list.s.map(a=>K2(a,r)):n}function Wh(t,e,n){const r=t[e];return r&&r.list&&r.list.shape?r.list.shape.map(s=>X2(s)):n}function zh(t,e,n){const r=t[e];return r&&r.list&&r.list.b?r.list.b:n}/** 5042 * @license 5043 * Copyright 2019 Google LLC. All Rights Reserved. 5044 * Licensed under the Apache License, Version 2.0 (the "License");
5045 * you may not use this file except in compliance with the License. 5046 * You may obtain a copy of the License at 5047 * 5048 * http://www.apache.org/licenses/LICENSE-2.0 5049 * 5050 * Unless required by applicable law or agreed to in writing, software 5051 * distributed under the License is distributed on an "AS IS" BASIS, 5052 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5053 * See the License for the specific language governing permissions and 5054 * limitations under the License. 5055 * ============================================================================= 5056 */class r8{constructor(e,n,r){this.node=e,this.tensorMap=n,this.context=r,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(s=>this.getInput(s)),e.rawAttrs!=null&&(this.attrs=Object.keys(e.rawAttrs).reduce((s,a)=>(s[a]=this.getAttr(a),s),{}))}getInput(e){return hn(e,this.tensorMap,this.context)}getAttr(e,n){const r=this.node.rawAttrs[e];if(r.tensor!=null)return hn(e,this.tensorMap,this.context);if(r.i!=null||r.f!=null)return Fh(this.node.rawAttrs,e,n);if(r.s!=null)return Rh(this.node.rawAttrs,e,n);if(r.b!=null)return Dh(this.node.rawAttrs,e,n);if(r.shape!=null)return Ph(this.node.rawAttrs,e,n);if(r.type!=null)return Mh(this.node.rawAttrs,e,n);if(r.list!=null){if(r.list.i!=null||r.list.f!=null)return Bh(this.node.rawAttrs,e,n);if(r.list.s!=null)return Lh(this.node.rawAttrs,e,n);if(r.list.shape!=null)return Wh(this.node.rawAttrs,e,n);if(r.list.b!=null)return zh(this.node.rawAttrs,e,n);if(r.list.type!=null)return Oh(this.node.rawAttrs,e,n)}return n}}/** 5057 * @license 5058 * Copyright 2020 Google LLC. All Rights Reserved. 5059 * Licensed under the Apache License, Version 2.0 (the "License"); 5060 * you may not use this file except in compliance with the License. 5061 * You may obtain a copy of the License at 5062 * 5063 * http://www.apache.org/licenses/LICENSE-2.0 5064 * 5065 * Unless required by applicable law or agreed to in writing, software 5066 * distributed under the License is distributed on an "AS IS" BASIS, 5067 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5068 * See the License for the specific language governing permissions and 5069 * limitations under the License. 5070 * ============================================================================= 5071 */const yn=Object.freeze(Object.defineProperty({__proto__:null,OP_SCOPE_SUFFIX:fw,abs:ir,acos:hA,acosh:gA,add:Fe,addN:vA,all:wA,any:xA,argMax:IA,argMin:EA,asin:CA,asinh:AA,atan:RA,atan2:FA,atanh:OA,avgPool:Cw,avgPool3d:VA,basicLSTMCell:JA,batchNorm:Ff,batchNorm2d:n4,batchNorm3d:s4,batchNorm4d:o4,batchToSpaceND:Nw,bincount:Aw,bitwiseAnd:l4,booleanMaskAsync:XF,broadcastArgs:d4,broadcastTo:Zi,buffer:rt,cast:Ut,ceil:h4,clipByValue:$w,clone:Xs,complex:Zs,concat:mn,concat1d:y4,concat2d:b4,concat3d:S4,concat4d:_4,conv1d:E4,conv2d:Mf,conv2dTranspose:N4,conv3d:$4,conv3dTranspose:M4,cos:P4,cosh:L4,cosineWindow:Cg,cumprod:z4,cumsum:U4,denseBincount:j4,depthToSpace:q4,depthwiseConv2d:mg,diag:Y4,dilation2d:Q4,div:tt,divNoNan:s$,dot:o$,dropout:cM,einsum:No,elu:Fw,enclosingPowerOfTwo:l2,ensureShape:u$,equal:Dw,erf:f$,euclideanNorm:x$,exp:Ss,expandDims:Kr,expm1:E$,eye:Pw,fft:Eg,fill:Uc,floor:Bw,floorDiv:Ew,fused:_M,gather:Lw,gatherND:aM,greater:Bf,greaterEqual:Ww,ifft:du,imag:Lf,image:Hf,inTopKAsync:uM,irfft:n2,isFinite:M$,isInf:P$,isNaN:L$,leakyRelu:zw,less:Ch,lessEqual:gg,linalg:n6,linspace:U$,localResponseNormalization:j$,log:Ic,log1p:Hw,logSigmoid:Q$,logSoftmax:tR,logSumExp:Vw,logicalAnd:cu,logicalNot:jw,logicalOr:Gw,logicalXor:iR,losses:r6,lowerBound:lR,matMul:xt,max:Ho,maxPool:qw,maxPool3d:fR,maxPoolWithArgmax:hR,maximum:Kw,mean:lu,meshgrid:yR,min:Th,minimum:uu,mirrorPad:wR,mod:xR,moments:IR,movingAverage:QF,mul:he,multiRNNCell:ER,multinomial:CR,neg:ns,norm:Pf,notEqual:Xw,oneHot:$R,ones:Fa,onesLike:DR,op:P,outerProduct:MR,pad:Vc,pad1d:BR,pad2d:WR,pad3d:HR,pad4d:VR,pool:XR,pow:_c,prelu:Jw,print:Iw,prod:QR,raggedGather:eD,raggedRange:nD,raggedTensorToTensor:sD,rand:oD,randomGamma:kD,randomNormal:Zw,randomStandardNormal:CD,randomUniform:kg,randomUniformInt:$D,range:kc,real:Ec,reciprocal:FD,relu:zf,relu6:e2,reshape:re,reverse:Va,reverse1d:LD,reverse2d:zD,reverse3d:UD,reverse4d:jD,rfft:Tg,round:t2,rsqrt:KD,scalar:ot,scatterND:eM,searchSorted:yg,selu:YD,separableConv2d:QD,setdiff1dAsync:eF,sigmoid:Ba,sign:nF,signal:t6,sin:sF,sinh:oF,slice:Ye,slice1d:cF,slice2d:uF,slice3d:fF,slice4d:hF,softmax:gF,softplus:Uw,spaceToBatchND:Yw,sparse:s6,sparseToDense:rM,spectral:e6,split:Tc,sqrt:ws,square:Mr,squaredDifference:r2,squeeze:pn,stack:_s,step:s2,stridedSlice:TF,string:a6,sub:Je,sum:Mt,tan:NF,tanh:Eh,tensor:Fr,tensor1d:Sn,tensor2d:La,tensor3d:a2,tensor4d:AF,tensor5d:$F,tensor6d:RF,tensorScatterUpdate:MF,tile:ec,topk:PF,transpose:Nh,truncatedNormal:LF,unique:zF,unsortedSegmentSum:UF,unstack:so,upperBound:jF,variable:GF,where:Ys,whereAsync:c2,zeros:Jo,zerosLike:lr},Symbol.toStringTag,{value:"Module"}));/** 5072 * @license 5073 * Copyright 2018 Google LLC. All Rights Reserved. 5074 * Licensed under the Apache License, Version 2.0 (the "License");
5075 * you may not use this file except in compliance with the License. 5076 * You may obtain a copy of the License at 5077 * 5078 * http://www.apache.org/licenses/LICENSE-2.0 5079 * 5080 * Unless required by applicable law or agreed to in writing, software 5081 * distributed under the License is distributed on an "AS IS" BASIS, 5082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5083 * See the License for the specific language governing permissions and 5084 * limitations under the License. 5085 * ============================================================================= 5086 */const s8=(t,e,n,r=yn)=>{switch(t.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(x("a",t,e,n),x("b",t,e,n))];case"AddN":return[r.addN(x("tensors",t,e,n))];case"FloorMod":case"Mod":return[r.mod(x("a",t,e,n),x("b",t,e,n))];case"Mul":return[r.mul(x("a",t,e,n),x("b",t,e,n))];case"RealDiv":case"Div":return[r.div(x("a",t,e,n),x("b",t,e,n))];case"DivNoNan":return[r.divNoNan(x("a",t,e,n),x("b",t,e,n))];case"FloorDiv":return[r.floorDiv(x("a",t,e,n),x("b",t,e,n))];case"Sub":return[r.sub(x("a",t,e,n),x("b",t,e,n))];case"Minimum":return[r.minimum(x("a",t,e,n),x("b",t,e,n))];case"Maximum":return[r.maximum(x("a",t,e,n),x("b",t,e,n))];case"Pow":return[r.pow(x("a",t,e,n),x("b",t,e,n))];case"SquaredDifference":return[r.squaredDifference(x("a",t,e,n),x("b",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5087 * @license 5088 * Copyright 2018 Google LLC. All Rights Reserved. 5089 * Licensed under the Apache License, Version 2.0 (the "License"); 5090 * you may not use this file except in compliance with the License. 5091 * You may obtain a copy of the License at 5092 * 5093 * http://www.apache.org/licenses/LICENSE-2.0 5094 * 5095 * Unless required by applicable law or agreed to in writing, software 5096 * distributed under the License is distributed on an "AS IS" BASIS, 5097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5098 * See the License for the specific language governing permissions and 5099 * limitations under the License. 5100 * ============================================================================= 5101 */const a8=(t,e,n,r=yn)=>{switch(t.op){case"Abs":case"ComplexAbs":return[r.abs(x("x",t,e,n))];case"Acos":return[r.acos(x("x",t,e,n))];case"Acosh":return[r.acosh(x("x",t,e,n))];case"Asin":return[r.asin(x("x",t,e,n))];case"Asinh":return[r.asinh(x("x",t,e,n))];case"Atan":return[r.atan(x("x",t,e,n))];case"Atan2":return[r.atan2(x("x",t,e,n),x("y",t,e,n))];case"Atanh":return[r.atanh(x("x",t,e,n))];case"Ceil":return[r.ceil(x("x",t,e,n))];case"Complex":return[r.complex(x("real",t,e,n),x("imag",t,e,n))];case"Cos":return[r.cos(x("x",t,e,n))];case"Cosh":return[r.cosh(x("x",t,e,n))];case"Elu":return[r.elu(x("x",t,e,n))];case"Erf":return[r.erf(x("x",t,e,n))];case"Exp":return[r.exp(x("x",t,e,n))];case"Expm1":return[r.expm1(x("x",t,e,n))];case"Floor":return[r.floor(x("x",t,e,n))];case"Log":return[r.log(x("x",t,e,n))];case"Log1p":return[r.log1p(x("x",t,e,n))];case"Imag":return[r.imag(x("x",t,e,n))];case"Neg":return[r.neg(x("x",t,e,n))];case"Reciprocal":return[r.reciprocal(x("x",t,e,n))];case"Real":return[r.real(x("x",t,e,n))];case"Relu":return[r.relu(x("x",t,e,n))];case"Round":return[r.round(x("x",t,e,n))];case"Selu":return[r.selu(x("x",t,e,n))];case"Sigmoid":return[r.sigmoid(x("x",t,e,n))];case"Sin":return[r.sin(x("x",t,e,n))];case"Sign":return[r.sign(x("x",t,e,n))];case"Sinh":return[r.sinh(x("x",t,e,n))];case"Softplus":return[r.softplus(x("x",t,e,n))];case"Sqrt":return[r.sqrt(x("x",t,e,n))];case"Square":return[r.square(x("x",t,e,n))];case"Tanh":return[r.tanh(x("x",t,e,n))];case"Tan":return[r.tan(x("x",t,e,n))];case"ClipByValue":return[r.clipByValue(x("x",t,e,n),x("clipValueMin",t,e,n),x("clipValueMax",t,e,n))];case"Relu6":return[r.relu6(x("x",t,e,n))];case"Rsqrt":return[r.rsqrt(hn(t.inputNames[0],e,n))];case"LeakyRelu":return[r.leakyRelu(x("x",t,e,n),x("alpha",t,e,n))];case"Prelu":return[r.prelu(x("x",t,e,n),x("alpha",t,e,n))];case"IsNan":return[r.isNaN(hn(t.inputNames[0],e,n))];case"IsInf":return[r.isInf(hn(t.inputNames[0],e,n))];case"IsFinite":return[r.isFinite(hn(t.inputNames[0],e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5102 * @license 5103 * Copyright 2020 Google LLC. All Rights Reserved. 5104 * Licensed under the Apache License, Version 2.0 (the "License");
5105 * you may not use this file except in compliance with the License. 5106 * You may obtain a copy of the License at 5107 * 5108 * http://www.apache.org/licenses/LICENSE-2.0 5109 * 5110 * Unless required by applicable law or agreed to in writing, software 5111 * distributed under the License is distributed on an "AS IS" BASIS, 5112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5113 * See the License for the specific language governing permissions and 5114 * limitations under the License. 5115 * ============================================================================= 5116 */function vr(t,e,n=""){if(!(typeof t=="number"||typeof e=="number")){A(t.length===e.length,()=>n+" Shapes ".concat(t," and ").concat(e," must match"));for(let r=0;r<t.length;r++){const s=t[r],a=e[r];A(s<0||a<0||s===a,()=>n+" Shapes ".concat(t," and ").concat(e," must match"))}}}function Wv(t){return!(typeof t=="number"||t.some(e=>e<0))}function $i(t,e,n){let r=Hh(t,n);const s=!Wv(r);if(s&&e.length===0)throw new Error("Tried to calculate elements of an empty list"+" with non-fully-defined elementShape: ".concat(r));if(s&&e.forEach(a=>{r=Hh(a.shape,r)}),!Wv(r))throw new Error("Non-fully-defined elementShape: ".concat(r));return r}function Hh(t,e){if(typeof t=="number")return e;if(typeof e=="number")return t;if(t.length!==e.length)throw new Error("Incompatible ranks during merge: ".concat(t," vs. ").concat(e));const n=[];for(let r=0;r<t.length;++r){const s=t[r],a=e[r];if(s>=0&&a>=0&&s!==a)throw new Error("Incompatible shape during merge: ".concat(t," vs. ").concat(e));n[r]=s>=0?s:a}return n}/** 5117 * @license 5118 * Copyright 2018 Google LLC. All Rights Reserved. 5119 * Licensed under the Apache License, Version 2.0 (the "License"); 5120 * you may not use this file except in compliance with the License. 5121 * You may obtain a copy of the License at 5122 * 5123 * http://www.apache.org/licenses/LICENSE-2.0 5124 * 5125 * Unless required by applicable law or agreed to in writing, software 5126 * distributed under the License is distributed on an "AS IS" BASIS, 5127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5128 * See the License for the specific language governing permissions and 5129 * limitations under the License. 5130 * ============================================================================= 5131 */class o8{constructor(e,n,r,s,a,o,i){this.name=e,this.dtype=n,this.maxSize=r,this.elementShape=s,this.identicalElementShapes=a,this.dynamicSize=o,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=ot(0),Qr(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach(n=>{(e==null||!e.has(n.tensor.id))&&n.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||e>=this.size())throw new Error("Tried to read from index ".concat(e,", but array size is: ").concat(this.size()));const n=this.tensors[e];if(n.cleared)throw new Error("TensorArray ".concat(this.name,": Could not read index ").concat(e," twice because it was cleared after a previous read ")+"(perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(n.cleared=!0),n.read=!0,n.tensor}readMany(e){return e.map(n=>this.read(n))}write(e,n){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error("Tried to write to index ".concat(e,", but array is not resizeable and size is: ").concat(this.maxSize));const r=this.tensors[e]||{};if(n.dtype!==this.dtype)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,",\n because the value dtype is ").concat(n.dtype,", but TensorArray dtype is ").concat(this.dtype,"."));if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=n.shape),vr(this.elementShape,n.shape,"TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,".")),r.read)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been read."));if(r.written)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been written."));r.tensor=n,Qr(n),r.written=!0,this.tensors[e]=r}writeMany(e,n){if(e.length!==n.length)throw new Error("TensorArray ".concat(this.name,": could not write multiple tensors,")+"because the index size: ".concat(e.length," is not the same as tensors size: ").concat(n.length,"."));e.forEach((r,s)=>this.write(r,n[s]))}gather(e,n){if(n&&n!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but gather requested dtype ").concat(n));if(e)e=e.slice(0,this.size());else{e=[];for(let s=0;s<this.size();s++)e.push(s)}if(e.length===0)return Fr([],[0].concat(this.elementShape));const r=this.readMany(e);return vr(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),_s(r,0)}concat(e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but concat requested dtype ").concat(e));if(this.size()===0)return Fr([],[0].concat(this.elementShape));const n=[];for(let s=0;s<this.size();s++)n.push(s);const r=this.readMany(n);return vr(this.elementShape,r[0].shape,"TensorArray shape mismatch: tensor array shape (".concat(this.elementShape,") vs first tensor shape (").concat(r[0].shape,")")),mn(r,0)}scatter(e,n){if(n.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(n.dtype));if(e.length!==n.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(e.length," vs. ").concat(n.shape[0]));const r=Math.max(...e);if(!this.dynamicSize&&r>=this.maxSize)throw new Error("Max index must be < array size (".concat(r," vs. ").concat(this.maxSize,")"));this.writeMany(e,so(n,0))}split(e,n){if(n.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(n.dtype));let r=0;const s=e.map(l=>(r+=l,r));if(r!==n.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ".concat(r,", and tensor's shape is: ").concat(n.shape));if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths (".concat(this.maxSize," vs. ").concat(e.length,"), ")+"and the TensorArray is not marked as dynamically resizeable");const a=r===0?0:n.size/r,o=[];nt(()=>{n=re(n,[1,r,a]);for(let l=0;l<e.length;++l){const c=[0,l===0?0:s[l-1],0],d=[1,e[l],a];o[l]=re(Ye(n,c,d),this.elementShape)}return o}
5131);const i=[];for(let l=0;l<e.length;l++)i[l]=l;this.writeMany(i,o)}}/** 5132 * @license 5133 * Copyright 2020 Google LLC. All Rights Reserved. 5134 * Licensed under the Apache License, Version 2.0 (the "License"); 5135 * you may not use this file except in compliance with the License. 5136 * You may obtain a copy of the License at 5137 * 5138 * http://www.apache.org/licenses/LICENSE-2.0 5139 * 5140 * Unless required by applicable law or agreed to in writing, software 5141 * distributed under the License is distributed on an "AS IS" BASIS, 5142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5143 * See the License for the specific language governing permissions and 5144 * limitations under the License. 5145 * ============================================================================= 5146 */class Ga{get id(){return this.idTensor.id}constructor(e,n,r,s=-1){this.tensors=e,this.elementShape=n,this.elementDtype=r,e!=null&&e.forEach(a=>{if(r!==a.dtype)throw new Error("Invalid data types; op elements ".concat(r,", but list elements ").concat(a.dtype));vr(n,a.shape,"TensorList shape mismatch: "),Qr(a)}),this.idTensor=ot(0),this.maxNumElements=s,Qr(this.idTensor)}copy(){return new Ga([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach(n=>{(e==null||!e.has(n.id))&&n.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,n,r=-1){if(n!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(this.elementDtype));if(r!==-1&&this.tensors.length!==r)throw new Error("Operation expected a list with ".concat(r," elements but got a list with ").concat(this.tensors.length," elements."));vr(e,this.elementShape,"TensorList shape mismatch: ");const s=$i(this.elementShape,this.tensors,e);return nt(()=>{const a=this.tensors.map(o=>re(o,s));return _s(a,0)})}popBack(e,n){if(n!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(this.elementDtype));if(this.size()===0)throw new Error("Trying to pop from an empty list.");const r=$i(this.elementShape,this.tensors,e),s=this.tensors.pop();return s.kept=!1,vr(s.shape,e,"TensorList shape mismatch: "),re(s,r)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(e.dtype,", but list elements ").concat(this.elementDtype));if(vr(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");Qr(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error("TensorListResize expects size to be non-negative. Got: ".concat(e));if(this.maxNumElements!==-1&&e>this.maxNumElements)throw new Error("TensorListResize input size ".concat(e," is greater maxNumElement ").concat(this.maxNumElements,"."));const n=new Ga([],this.elementShape,this.elementDtype,this.maxNumElements);n.tensors.length=e;for(let r=0;r<Math.min(this.tensors.length,e);++r)n.tensors[r]=this.tensors[r];return n}getItem(e,n,r){if(r!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(r,", but list elements ").concat(this.elementDtype));if(e<0||e>this.tensors.length)throw new Error("Trying to access element ".concat(e," in a list with ").concat(this.tensors.length," elements."));if(this.tensors[e]==null)throw new Error("element at index ".concat(e," is null."));vr(this.tensors[e].shape,n,"TensorList shape mismatch: ");const s=$i(this.elementShape,this.tensors,n);return re(this.tensors[e],s)}setItem(e,n){if(n.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n.dtype,", but list elements ").concat(this.elementDtype));if(e<0||this.maxNumElements!==-1&&e>=this.maxNumElements)throw new Error("Trying to set element ".concat(e," in a list with max ").concat(this.maxNumElements," elements."));vr(this.elementShape,n.shape,"TensorList shape mismatch: "),Qr(n),this.tensors[e]!=null&&(this.tensors[e].kept=!1),this.tensors[e]=n}gather(e,n,r){if(n!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(this.elementDtype));vr(this.elementShape,r,"TensorList shape mismatch: "),e=e.slice(0,this.size());const s=$i(this.elementShape,this.tensors,r);return e.length===0?Fr([],[0].concat(s)):nt(()=>{const a=e.map(o=>re(this.tensors[o],s));return _s(a,0)})}concat(e,n){if(e&&e!==this.elementDtype)throw new Error("TensorList dtype is ".concat(this.elementDtype," but concat requested dtype ").concat(e));vr(this.elementShape,n,"TensorList shape mismatch: ");const r=$i(this.elementShape,this.tensors,n);return this.size()===0?Fr([],[0].concat(r)):nt(()=>{const s=this.tensors.map(a=>re(a,r));return mn(s,0)})}}function i8(t,e,n){const r=t.dtype;if(t.shape.length<1)throw new Error("Tensor must be at least a vector, but saw shape: ".concat(t.shape));if(t.dtype!==n)throw new Error("Invalid data types; op elements ".concat(t.dtype,", but list elements ").concat(n));const s=t.shape.slice(1);vr(s,e,"TensorList shape mismatch: ");const a=so(t);return new Ga(a,e,r)}function c8(t,e,n,r){return new Ga([],t,e,r)}function l8(t,e,n,r){if(e.length!==t.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(e.length," vs. ").concat(t.shape[0]));const s=Math.max(...e);if(r!=null&&r!==-1&&s>=r)throw new Error("Max index must be < array size (".concat(s," vs. ").concat(r,")"));const a=new Ga([],n,t.dtype,r),o=so(t,0);return e.forEach((i,l)=>{a.setItem(i,o[l])}),a}function u8(t,e,n){let r=0;const s=e.map(c=>(r+=c,r));if(r!==t.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ".concat(r,", and tensor's shape is: ").concat(t.shape));const a=t.shape.slice(1),o=Hh(a,n),i=r===0?0:t.size/r,l=nt(()=>{const c=[];t=re(t,[1,r,i]);for(let d=0;d<e.length;++d){const p=[0,d===0?0:s[d-1],0],h=[1,e[d],i];c[d]=re(Ye(t,p,h),o)}return t.dispose(),c}),u=new Ga([],n,t.dtype,e.length);for(let c=0;c<l.length;c++)u.setItem(c,l[c]);return u}/** 5147 * @license 5148 * Copyright 2018 Google LLC. All Rights Reserved. 5149 * Licensed under the Apache License, Version 2.0 (the "License");
5150 * you may not use this file except in compliance with the License. 5151 * You may obtain a copy of the License at 5152 * 5153 * http://www.apache.org/licenses/LICENSE-2.0 5154 * 5155 * Unless required by applicable law or agreed to in writing, software 5156 * distributed under the License is distributed on an "AS IS" BASIS, 5157 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5158 * See the License for the specific language governing permissions and 5159 * limitations under the License. 5160 * ============================================================================= 5161 */const d8=async(t,e,n)=>{switch(t.op){case"If":case"StatelessIf":{const r=x("thenBranch",t,e,n),s=x("elseBranch",t,e,n),a=x("cond",t,e,n),o=x("args",t,e,n);return(await a.data())[0]?n.functionMap[r].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap):n.functionMap[s].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=x("body",t,e,n),s=x("cond",t,e,n),a=x("args",t,e,n),o=await n.functionMap[s].executeFunctionAsync(a,n.tensorArrayMap,n.tensorListMap),i=a.map(c=>c.id);let l=await o[0].data();o.forEach(c=>{!c.kept&&i.indexOf(c.id)===-1&&c.dispose()});let u=a;for(;l[0];){const c=u;u=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);const d=u.map(p=>p.id);c.forEach(p=>{!p.kept&&i.indexOf(p.id)===-1&&d.indexOf(p.id)===-1&&p.dispose()});const f=await n.functionMap[s].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await f[0].data(),f.forEach(p=>{!p.kept&&i.indexOf(p.id)===-1&&d.indexOf(p.id)===-1&&p.dispose()})}return u}case"LoopCond":{const r=x("pred",t,e,n);return[ms(r)]}case"Switch":{const r=x("pred",t,e,n);let s=x("data",t,e,n);return s.kept||(s=ms(s)),(await r.data())[0]?[void 0,s]:[s,void 0]}case"Merge":{const r=t.inputNames.find(s=>hn(s,e,n)!==void 0);if(r){const s=hn(r,e,n);return[ms(s)]}return}case"Enter":{const r=x("frameName",t,e,n),s=x("tensor",t,e,n);return n.enterFrame(r),[ms(s)]}case"Exit":{const r=x("tensor",t,e,n);return n.exitFrame(),[ms(r)]}case"NextIteration":{const r=x("tensor",t,e,n);return n.nextIteration(),[ms(r)]}case"TensorArrayV3":{const r=x("size",t,e,n),s=x("dtype",t,e,n),a=x("elementShape",t,e,n),o=x("dynamicSize",t,e,n),i=x("clearAfterRead",t,e,n),l=x("identicalElementShapes",t,e,n),u=x("name",t,e,n),c=new o8(u,s,r,a,l,o,i);return n.addTensorArray(c),[c.idTensor,ot(1)]}case"TensorArrayWriteV3":{const r=x("tensorArrayId",t,e,n),s=x("index",t,e,n),a=x("tensor",t,e,n),o=n.getTensorArray(r.id);return o.write(s,a),[o.idTensor]}case"TensorArrayReadV3":{const r=x("tensorArrayId",t,e,n),s=x("index",t,e,n);return[n.getTensorArray(r.id).read(s)]}case"TensorArrayGatherV3":{const r=x("tensorArrayId",t,e,n),s=x("indices",t,e,n),a=x("dtype",t,e,n);return[n.getTensorArray(r.id).gather(s,a)]}case"TensorArrayScatterV3":{const r=x("tensorArrayId",t,e,n),s=x("indices",t,e,n),a=x("tensor",t,e,n),o=n.getTensorArray(r.id);return o.scatter(s,a),[o.idTensor]}case"TensorArrayConcatV3":{const r=x("tensorArrayId",t,e,n),s=n.getTensorArray(r.id),a=x("dtype",t,e,n);return[s.concat(a)]}case"TensorArraySplitV3":{const r=x("tensorArrayId",t,e,n),s=x("tensor",t,e,n),a=x("lengths",t,e,n),o=n.getTensorArray(r.id);return o.split(a,s),[o.idTensor]}case"TensorArraySizeV3":{const r=x("tensorArrayId",t,e,n),s=n.getTensorArray(r.id);return[ot(s.size(),"int32")]}case"TensorArrayCloseV3":{const r=x("tensorArrayId",t,e,n),s=n.getTensorArray(r.id);return s.clearAndClose(),[s.idTensor]}case"TensorListSetItem":{const r=x("tensorListId",t,e,n),s=x("index",t,e,n),a=x("tensor",t,e,n),o=n.getTensorList(r.id);return o.setItem(s,a),[o.idTensor]}case"TensorListGetItem":{const r=x("tensorListId",t,e,n),s=x("index",t,e,n),a=x("elementShape",t,e,n),o=x("elementDType",t,e,n);return[n.getTensorList(r.id).getItem(s,a,o)]}case"TensorListScatterV2":case"TensorListScatter":{const r=x("indices",t,e,n),s=x("tensor",t,e,n),a=x("elementShape",t,e,n),o=x("numElements",t,e,n),i=l8(s,r,a,o);return n.addTensorList(i),[i.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=x("elementShape",t,e,n),s=x("elementDType",t,e,n);let a;t.op==="TensorListReserve"?a="numElements":a="maxNumElements";
5161const o=x(a,t,e,n),i=t.op==="TensorListReserve"?-1:o,l=c8(r,s,o,i);return n.addTensorList(l),[l.idTensor]}case"TensorListGather":{const r=x("tensorListId",t,e,n),s=x("indices",t,e,n),a=x("elementShape",t,e,n),o=x("elementDType",t,e,n);return[n.getTensorList(r.id).gather(s,o,a)]}case"TensorListStack":{const r=x("tensorListId",t,e,n),s=x("elementShape",t,e,n),a=x("elementDType",t,e,n),o=x("numElements",t,e,n);return[n.getTensorList(r.id).stack(s,a,o)]}case"TensorListFromTensor":{const r=x("tensor",t,e,n),s=x("elementShape",t,e,n),a=x("elementDType",t,e,n),o=i8(r,s,a);return n.addTensorList(o),[o.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const r=x("tensorListId",t,e,n),s=n.getTensorList(r.id),a=x("dtype",t,e,n),o=x("elementShape",t,e,n);return[s.concat(a,o)]}case"TensorListPushBack":{const r=x("tensorListId",t,e,n),s=x("tensor",t,e,n),a=n.getTensorList(r.id);return a.pushBack(s),[a.idTensor]}case"TensorListPopBack":{const r=x("tensorListId",t,e,n),s=x("elementShape",t,e,n),a=x("elementDType",t,e,n);return[n.getTensorList(r.id).popBack(s,a)]}case"TensorListSplit":{const r=x("tensor",t,e,n),s=x("elementShape",t,e,n),a=x("lengths",t,e,n),o=u8(r,a,s);return n.addTensorList(o),[o.idTensor]}case"TensorListLength":{const r=x("tensorListId",t,e,n),s=n.getTensorList(r.id);return[ot(s.size(),"int32")]}case"TensorListResize":{const r=x("tensorListId",t,e,n),s=x("size",t,e,n),o=n.getTensorList(r.id).resize(s);return n.addTensorList(o),[o.idTensor]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5162 * @license 5163 * Copyright 2018 Google LLC. All Rights Reserved. 5164 * Licensed under the Apache License, Version 2.0 (the "License"); 5165 * you may not use this file except in compliance with the License. 5166 * You may obtain a copy of the License at 5167 * 5168 * http://www.apache.org/licenses/LICENSE-2.0 5169 * 5170 * Unless required by applicable law or agreed to in writing, software 5171 * distributed under the License is distributed on an "AS IS" BASIS, 5172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5173 * See the License for the specific language governing permissions and 5174 * limitations under the License. 5175 * ============================================================================= 5176 */function zv(t,e,n){const[r,s]=x("fusedOps",t,e,n),a=r==="biasadd",o=!a,i=s==="prelu",l=r==="fusedbatchnorm",u=x("numArgs",t,e,n);if(a){if(i&&u!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&a&&u!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const c=x("strides",t,e,n),d=Ol(t,e,n),f=x("dataFormat",t,e,n).toUpperCase(),p=x("dilations",t,e,n);let[h,m]=x("args",t,e,n);o&&(m=h,h=void 0);const g=x("leakyreluAlpha",t,e,n);return{stride:c,pad:d,dataFormat:f,dilations:p,biasArg:h,preluArg:m,activationFunc:s,leakyreluAlpha:g}}const f8=(t,e,n,r=yn)=>{switch(t.op){case"Conv1D":{const s=x("stride",t,e,n),a=x("pad",t,e,n),o=x("dataFormat",t,e,n).toUpperCase(),i=x("dilation",t,e,n);return[r.conv1d(x("x",t,e,n),x("filter",t,e,n),s,a,o,i)]}case"Conv2D":{const s=x("strides",t,e,n),a=Ol(t,e,n),o=x("dataFormat",t,e,n).toUpperCase(),i=x("dilations",t,e,n);return[r.conv2d(x("x",t,e,n),x("filter",t,e,n),[s[1],s[2]],a,o,[i[1],i[2]])]}case"_FusedConv2D":{const{stride:s,pad:a,dataFormat:o,dilations:i,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=zv(t,e,n);return[r.fused.conv2d({x:x("x",t,e,n),filter:x("filter",t,e,n),strides:[s[1],s[2]],pad:a,dataFormat:o,dilations:[i[1],i[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{const{stride:s,pad:a,dataFormat:o,dilations:i,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=zv(t,e,n);return[r.fused.depthwiseConv2d({x:x("x",t,e,n),filter:x("filter",t,e,n),strides:[s[1],s[2]],pad:a,dataFormat:o,dilations:[i[1],i[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const s=x("outputShape",t,e,n),a=x("strides",t,e,n),o=Ol(t,e,n);return[r.conv2dTranspose(x("x",t,e,n),x("filter",t,e,n),s,[a[1],a[2]],o)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const s=x("strides",t,e,n),a=Ol(t,e,n),o=x("dilations",t,e,n),i=x("dataFormat",t,e,n).toUpperCase();return[r.depthwiseConv2d(x("input",t,e,n),x("filter",t,e,n),[s[1],s[2]],a,i,[o[1],o[2]])]}case"Conv3D":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("dataFormat",t,e,n).toUpperCase(),i=x("dilations",t,e,n);return[r.conv3d(x("x",t,e,n),x("filter",t,e,n),[s[1],s[2],s[3]],a,o,[i[
vendor: 5,249 bytes, lines 5176-5209
51761],i[2],i[3]])]}case"AvgPool":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("kernelSize",t,e,n);return[r.avgPool(x("x",t,e,n),[o[1],o[2]],[s[1],s[2]],a)]}case"MaxPool":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("kernelSize",t,e,n);return[r.maxPool(x("x",t,e,n),[o[1],o[2]],[s[1],s[2]],a)]}case"MaxPoolWithArgmax":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("kernelSize",t,e,n),i=x("includeBatchInIndex",t,e,n),{result:l,indexes:u}=r.maxPoolWithArgmax(x("x",t,e,n),[o[1],o[2]],[s[1],s[2]],a,i);return[l,u]}case"AvgPool3D":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("kernelSize",t,e,n);return[r.avgPool3d(x("x",t,e,n),[o[1],o[2],o[3]],[s[1],s[2],s[3]],a)]}case"MaxPool3D":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("kernelSize",t,e,n);return[r.maxPool3d(x("x",t,e,n),[o[1],o[2],o[3]],[s[1],s[2],s[3]],a)]}case"Dilation2D":{const s=x("strides",t,e,n),a=x("pad",t,e,n),o=x("dilations",t,e,n),i=s[1],l=s[2],u=o[1],c=o[2];return[r.dilation2d(x("x",t,e,n),x("filter",t,e,n),[i,l],a,[u,c],"NHWC")]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5177 * @license 5178 * Copyright 2018 Google LLC. All Rights Reserved. 5179 * Licensed under the Apache License, Version 2.0 (the "License"); 5180 * you may not use this file except in compliance with the License. 5181 * You may obtain a copy of the License at 5182 * 5183 * http://www.apache.org/licenses/LICENSE-2.0 5184 * 5185 * Unless required by applicable law or agreed to in writing, software 5186 * distributed under the License is distributed on an "AS IS" BASIS, 5187 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5188 * See the License for the specific language governing permissions and 5189 * limitations under the License. 5190 * ============================================================================= 5191 */const p8=(t,e,n,r=yn)=>{switch(t.op){case"Fill":{const s=x("shape",t,e,n),a=x("dtype",t,e,n),o=x("value",t,e,n);return[r.fill(s,o,a)]}case"LinSpace":{const s=x("start",t,e,n),a=x("stop",t,e,n),o=x("num",t,e,n);return[r.linspace(s,a,o)]}case"Multinomial":{const s=x("logits",t,e,n),a=x("numSamples",t,e,n),o=x("seed",t,e,n);return[r.multinomial(s,a,o)]}case"OneHot":{const s=x("indices",t,e,n),a=x("depth",t,e,n),o=x("onValue",t,e,n),i=x("offValue",t,e,n),l=x("dtype",t,e,n);return[r.oneHot(s,a,o,i,l)]}case"Ones":return[r.ones(x("shape",t,e,n),x("dtype",t,e,n))];case"OnesLike":return[r.onesLike(x("x",t,e,n))];case"RandomStandardNormal":return[r.randomStandardNormal(x("shape",t,e,n),x("dtype",t,e,n),x("seed",t,e,n))];case"RandomUniform":return[r.randomUniform(x("shape",t,e,n),x("minval",t,e,n),x("maxval",t,e,n),x("dtype",t,e,n))];case"RandomUniformInt":return[r.randomUniformInt(x("shape",t,e,n),x("minval",t,e,n),x("maxval",t,e,n),x("seed",t,e,n))];case"Range":{const s=x("start",t,e,n),a=x("stop",t,e,n),o=x("step",t,e,n);return[r.range(s,a,o,x("dtype",t,e,n))]}case"TruncatedNormal":{const s=x("shape",t,e,n),a=x("mean",t,e,n),o=x("stdDev",t,e,n),i=x("seed",t,e,n);return[r.truncatedNormal(s,a,o,x("dtype",t,e,n),i)]}case"Zeros":return[r.zeros(x("shape",t,e,n),x("dtype",t,e,n))];case"ZerosLike":return[r.zerosLike(x("x",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5192 * @license 5193 * Copyright 2018 Google LLC. All Rights Reserved. 5194 * Licensed under the Apache License, Version 2.0 (the "License"); 5195 * you may not use this file except in compliance with the License. 5196 * You may obtain a copy of the License at 5197 * 5198 * http://www.apache.org/licenses/LICENSE-2.0 5199 * 5200 * Unless required by applicable law or agreed to in writing, software 5201 * distributed under the License is distributed on an "AS IS" BASIS, 5202 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5203 * See the License for the specific language governing permissions and 5204 * limitations under the License. 5205 * ============================================================================= 5206 */function Ep(t,e,n){const r=x("boxes",t,e,n),s=x("scores",t,e,n),a=x("maxOutputSize",t,e,n),o=x("iouThreshold",t,e,n),i=x("scoreThreshold",t,e,n),l=x("softNmsSigma",t,e,n);return{boxes:r,scores:s,maxOutputSize:a,iouThreshold:o,scoreThreshold:i,softNmsSigma:l}}const h8=async(t,e,n,r,s=yn)=>{switch(t.op){case"NonMaxSuppressionV5":{const{boxes:a,scores:o,maxOutputSize:i,iouThreshold:l,scoreThreshold:u,softNmsSigma:c}=Ep(t,e,n),d=await s.image.nonMaxSuppressionWithScoreAsync(a,o,i,l,u,c);return[d.selectedIndices,d.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:a,scores:o,maxOutputSize:i,iouThreshold:l,scoreThreshold:u}=Ep(t,e,n),c=x("padToMaxOutputSize",t,e,n),d=await s.image.nonMaxSuppressionPaddedAsync(a,o,i,l,u,c);return[d.selectedIndices,d.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:a,scores:o,maxOutputSize:i,iouThreshold:l,scoreThreshold:u}=Ep(t,e,n);return[await s.image.nonMaxSuppressionAsync(a,o,i,l,u)]}case"Where":{const a=s.cast(x("condition",t,e,n),"bool"),o=[await s.whereAsync(a)];return a.dispose(),o}case"ListDiff":return s.setdiff1dAsync(x("x",t,e,n),x("y",t,e,n));default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5207 * @license 5208 * Copyright 2018 Google LLC. All Rights Reserved. 5209 * Licensed under the Apache License, Version 2.0 (the "License");
5210 * you may not use this file except in compliance with the License. 5211 * You may obtain a copy of the License at 5212 * 5213 * http://www.apache.org/licenses/LICENSE-2.0 5214 * 5215 * Unless required by applicable law or agreed to in writing, software 5216 * distributed under the License is distributed on an "AS IS" BASIS, 5217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5218 * See the License for the specific language governing permissions and 5219 * limitations under the License. 5220 * ============================================================================= 5221 */const m8=(t,e,n,r=yn)=>{switch(t.op){case"LowerBound":{const s=x("sortedSequence",t,e,n),a=x("values",t,e,n);return[r.lowerBound(s,a)]}case"TopKV2":{const s=x("x",t,e,n),a=x("k",t,e,n),o=x("sorted",t,e,n),i=r.topk(s,a,o);return[i.values,i.indices]}case"UpperBound":{const s=x("sortedSequence",t,e,n),a=x("values",t,e,n);return[r.upperBound(s,a)]}case"Unique":{const s=x("x",t,e,n),a=r.unique(s);return[a.values,a.indices]}case"UniqueV2":{const s=x("x",t,e,n),a=x("axis",t,e,n),o=r.unique(s,a);return[o.values,o.indices]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5222 * @license 5223 * Copyright 2018 Google LLC. All Rights Reserved. 5224 * Licensed under the Apache License, Version 2.0 (the "License"); 5225 * you may not use this file except in compliance with the License. 5226 * You may obtain a copy of the License at 5227 * 5228 * http://www.apache.org/licenses/LICENSE-2.0 5229 * 5230 * Unless required by applicable law or agreed to in writing, software 5231 * distributed under the License is distributed on an "AS IS" BASIS, 5232 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5233 * See the License for the specific language governing permissions and 5234 * limitations under the License. 5235 * ============================================================================= 5236 */const g8=(t,e,n,r=yn)=>{switch(t.op){case"Const":return e[t.name];case"PlaceholderWithDefault":const s=x("default",t,e,n);return[hn(t.name,e,n)||s];case"Placeholder":return[hn(t.name,e,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{const c=x("x",t,e,n);return[ms(c)]}case"IdentityN":return x("x",t,e,n).map(c=>ms(c));case"Snapshot":const a=x("x",t,e,n);return[ms(a)];case"Shape":return[r.tensor1d(x("x",t,e,n).shape,"int32")];case"ShapeN":return x("x",t,e,n).map(c=>r.tensor1d(c.shape));case"Size":return[r.scalar(x("x",t,e,n).size,"int32")];case"Rank":return[r.scalar(x("x",t,e,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const o=x("x",t,e,n),i=x("data",t,e,n),l=x("message",t,e,n),u=x("summarize",t,e,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(l);for(let c=0;c<i.length;c++)console.log(Array.prototype.slice.call(i[c].dataSync()).slice(0,u));return[o];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5237 * @license 5238 * Copyright 2020 Google LLC. All Rights Reserved. 5239 * Licensed under the Apache License, Version 2.0 (the "License"); 5240 * you may not use this file except in compliance with the License. 5241 * You may obtain a copy of the License at 5242 * 5243 * http://www.apache.org/licenses/LICENSE-2.0 5244 * 5245 * Unless required by applicable law or agreed to in writing, software 5246 * distributed under the License is distributed on an "AS IS" BASIS, 5247 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5248 * See the License for the specific language governing permissions and 5249 * limitations under the License. 5250 * ============================================================================= 5251 */class y8{get id(){return this.handle.id}constructor(e,n){this.keyDType=e,this.valueDType=n,this.handle=ot(0),this.tensorMap=new Map,Qr(this.handle)}clearAndClose(){this.tensorMap.forEach(e=>e.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return ot(this.size(),"int32")}async import(e,n){this.checkKeyAndValueTensor(e,n);const r=await e.data();return this.tensorMap.forEach(s=>s.dispose()),this.tensorMap.clear(),nt(()=>{const s=so(n),a=r.length,o=s.length;A(a===o,()=>"The number of elements doesn't match, keys has "+"".concat(a," elements, the values has ").concat(o," ")+"elements.");for(let i=0;i<a;i++){const l=r[i],u=s[i];Qr(u),this.tensorMap.set(l,u)}return this.handle})}async find(e,n){this.checkKeyAndValueTensor(e,n);const r=await e.data();return nt(()=>{const s=[];for(let a=0;a<r.length;a++){const o=r[a],i=this.findWithDefault(o,n);s.push(i)}return _s(s)})}findWithDefault(e,n){const r=this.tensorMap.get(e);return r!=null?r:n}checkKeyAndValueTensor(e,n){if(e.dtype!==this.keyDType)throw new Error("Expect key dtype ".concat(this.keyDType,", but got ")+"".concat(e.dtype));if(n.dtype!==this.valueDType)throw new Error("Expect value dtype ".concat(this.valueDType,", but got ")+"".concat(n.dtype))}}/** 5252 * @license 5253 * Copyright 2020 Google LLC. All Rights Reserved. 5254 * Licensed under the Apache License, Version 2.0 (the "License");
5255 * you may not use this file except in compliance with the License. 5256 * You may obtain a copy of the License at 5257 * 5258 * http://www.apache.org/licenses/LICENSE-2.0 5259 * 5260 * Unless required by applicable law or agreed to in writing, software 5261 * distributed under the License is distributed on an "AS IS" BASIS, 5262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5263 * See the License for the specific language governing permissions and 5264 * limitations under the License. 5265 * ============================================================================= 5266 */const v8=async(t,e,n,r)=>{switch(t.op){case"HashTable":case"HashTableV2":{const s=r.getHashTableHandleByName(t.name);if(s!=null)return[s];{const a=x("keyDType",t,e,n),o=x("valueDType",t,e,n),i=new y8(a,o);return r.addHashTable(t.name,i),[i.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{const s=x("tableHandle",t,e,n,r),a=x("keys",t,e,n),o=x("values",t,e,n);return[await r.getHashTableById(s.id).import(a,o)]}case"LookupTableFind":case"LookupTableFindV2":{const s=x("tableHandle",t,e,n,r),a=x("keys",t,e,n),o=x("defaultValue",t,e,n);return[await r.getHashTableById(s.id).find(a,o)]}case"LookupTableSize":case"LookupTableSizeV2":{const s=x("tableHandle",t,e,n,r);return[r.getHashTableById(s.id).tensorSize()]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5267 * @license 5268 * Copyright 2018 Google LLC. All Rights Reserved. 5269 * Licensed under the Apache License, Version 2.0 (the "License"); 5270 * you may not use this file except in compliance with the License. 5271 * You may obtain a copy of the License at 5272 * 5273 * http://www.apache.org/licenses/LICENSE-2.0 5274 * 5275 * Unless required by applicable law or agreed to in writing, software 5276 * distributed under the License is distributed on an "AS IS" BASIS, 5277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5278 * See the License for the specific language governing permissions and 5279 * limitations under the License. 5280 * ============================================================================= 5281 */const b8=(t,e,n,r=yn)=>{switch(t.op){case"ResizeBilinear":{const s=x("images",t,e,n),a=x("size",t,e,n),o=x("alignCorners",t,e,n),i=x("halfPixelCenters",t,e,n);return[r.image.resizeBilinear(s,[a[0],a[1]],o,i)]}case"ResizeNearestNeighbor":{const s=x("images",t,e,n),a=x("size",t,e,n),o=x("alignCorners",t,e,n),i=x("halfPixelCenters",t,e,n);return[r.image.resizeNearestNeighbor(s,[a[0],a[1]],o,i)]}case"CropAndResize":{const s=x("image",t,e,n),a=x("boxes",t,e,n),o=x("boxInd",t,e,n),i=x("cropSize",t,e,n),l=x("method",t,e,n),u=x("extrapolationValue",t,e,n);return[r.image.cropAndResize(s,a,o,i,l,u)]}case"ImageProjectiveTransformV3":{const s=x("images",t,e,n),a=x("transforms",t,e,n),o=x("outputShape",t,e,n),i=x("fillValue",t,e,n),l=x("interpolation",t,e,n),u=x("fillMode",t,e,n);return[r.image.transform(s,a,l.toLowerCase(),u.toLowerCase(),i,o)]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5282 * @license 5283 * Copyright 2018 Google LLC. All Rights Reserved. 5284 * Licensed under the Apache License, Version 2.0 (the "License"); 5285 * you may not use this file except in compliance with the License. 5286 * You may obtain a copy of the License at 5287 * 5288 * http://www.apache.org/licenses/LICENSE-2.0 5289 * 5290 * Unless required by applicable law or agreed to in writing, software 5291 * distributed under the License is distributed on an "AS IS" BASIS, 5292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5293 * See the License for the specific language governing permissions and 5294 * limitations under the License. 5295 * ============================================================================= 5296 */const w8=(t,e,n,r=yn)=>{switch(t.op){case"Equal":return[r.equal(x("a",t,e,n),x("b",t,e,n))];case"NotEqual":return[r.notEqual(x("a",t,e,n),x("b",t,e,n))];case"Greater":return[r.greater(x("a",t,e,n),x("b",t,e,n))];case"GreaterEqual":return[r.greaterEqual(x("a",t,e,n),x("b",t,e,n))];case"Less":return[r.less(x("a",t,e,n),x("b",t,e,n))];case"LessEqual":return[r.lessEqual(x("a",t,e,n),x("b",t,e,n))];case"LogicalAnd":return[r.logicalAnd(x("a",t,e,n),x("b",t,e,n))];case"LogicalNot":return[r.logicalNot(x("a",t,e,n))];case"LogicalOr":return[r.logicalOr(x("a",t,e,n),x("b",t,e,n))];case"Select":case"SelectV2":return[r.where(x("condition",t,e,n),x("a",t,e,n),x("b",t,e,n))];case"BitwiseAnd":return[r.bitwiseAnd(x("a",t,e,n),x("b",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5297 * @license 5298 * Copyright 2018 Google LLC. All Rights Reserved. 5299 * Licensed under the Apache License, Version 2.0 (the "License");
5300 * you may not use this file except in compliance with the License. 5301 * You may obtain a copy of the License at 5302 * 5303 * http://www.apache.org/licenses/LICENSE-2.0 5304 * 5305 * Unless required by applicable law or agreed to in writing, software 5306 * distributed under the License is distributed on an "AS IS" BASIS, 5307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5308 * See the License for the specific language governing permissions and 5309 * limitations under the License. 5310 * ============================================================================= 5311 */const S8=(t,e,n,r=yn)=>{switch(t.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(x("a",t,e,n),x("b",t,e,n),x("transposeA",t,e,n),x("transposeB",t,e,n))];case"Einsum":return[r.einsum(x("equation",t,e,n),...x("tensors",t,e,n))];case"Transpose":return[r.transpose(x("x",t,e,n),x("perm",t,e,n))];case"_FusedMatMul":const[s,a]=x("fusedOps",t,e,n),o=s==="biasadd",i=a==="prelu",l=x("numArgs",t,e,n),u=x("leakyreluAlpha",t,e,n);if(o){if(i&&l!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&l!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[c,d]=x("args",t,e,n);return[r.fused.matMul({a:x("a",t,e,n),b:x("b",t,e,n),transposeA:x("transposeA",t,e,n),transposeB:x("transposeB",t,e,n),bias:c,activation:a,preluActivationWeights:d,leakyreluAlpha:u})];case"MatrixBandPart":return[r.linalg.bandPart(x("a",t,e,n),x("numLower",t,e,n),x("numUpper",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5312 * @license 5313 * Copyright 2018 Google LLC. All Rights Reserved. 5314 * Licensed under the Apache License, Version 2.0 (the "License"); 5315 * you may not use this file except in compliance with the License. 5316 * You may obtain a copy of the License at 5317 * 5318 * http://www.apache.org/licenses/LICENSE-2.0 5319 * 5320 * Unless required by applicable law or agreed to in writing, software 5321 * distributed under the License is distributed on an "AS IS" BASIS, 5322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5323 * See the License for the specific language governing permissions and 5324 * limitations under the License. 5325 * ============================================================================= 5326 */const x8=(t,e,n,r=yn)=>{switch(t.op){case"EuclideanNorm":return[r.euclideanNorm(x("x",t,e,n),x("axis",t,e,n),x("keepDims",t,e,n))];case"FusedBatchNorm":case"FusedBatchNormV2":return[r.batchNorm(x("x",t,e,n),x("mean",t,e,n),x("variance",t,e,n),x("offset",t,e,n),x("scale",t,e,n),x("epsilon",t,e,n))];case"FusedBatchNormV3":return[r.batchNorm(x("x",t,e,n),x("mean",t,e,n),x("variance",t,e,n),x("offset",t,e,n),x("scale",t,e,n),x("epsilon",t,e,n))];case"LRN":return[r.localResponseNormalization(x("x",t,e,n),x("radius",t,e,n),x("bias",t,e,n),x("alpha",t,e,n),x("beta",t,e,n))];case"Softmax":return[r.softmax(x("x",t,e,n))];case"LogSoftmax":return[r.logSoftmax(x("x",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5327 * @license 5328 * Copyright 2022 Google LLC. All Rights Reserved. 5329 * Licensed under the Apache License, Version 2.0 (the "License"); 5330 * you may not use this file except in compliance with the License. 5331 * You may obtain a copy of the License at 5332 * 5333 * http://www.apache.org/licenses/LICENSE-2.0 5334 * 5335 * Unless required by applicable law or agreed to in writing, software 5336 * distributed under the License is distributed on an "AS IS" BASIS, 5337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5338 * See the License for the specific language governing permissions and 5339 * limitations under the License. 5340 * ============================================================================= 5341 */const _8=(t,e,n,r=yn)=>{switch(t.op){case"RaggedGather":{const{outputNestedSplits:s,outputDenseValues:a}=r.raggedGather(x("paramsNestedSplits",t,e,n),x("paramsDenseValues",t,e,n),x("indices",t,e,n),x("outputRaggedRank",t,e,n));return s.concat(a)}case"RaggedRange":{const{rtNestedSplits:s,rtDenseValues:a}=r.raggedRange(x("starts",t,e,n),x("limits",t,e,n),x("splits",t,e,n));return[s,a]}case"RaggedTensorToTensor":return[r.raggedTensorToTensor(x("shape",t,e,n),x("values",t,e,n),x("defaultValue",t,e,n),x("rowPartitionTensors",t,e,n),x("rowPartitionTypes",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5342 * @license 5343 * Copyright 2018 Google LLC. All Rights Reserved. 5344 * Licensed under the Apache License, Version 2.0 (the "License");
5345 * you may not use this file except in compliance with the License. 5346 * You may obtain a copy of the License at 5347 * 5348 * http://www.apache.org/licenses/LICENSE-2.0 5349 * 5350 * Unless required by applicable law or agreed to in writing, software 5351 * distributed under the License is distributed on an "AS IS" BASIS, 5352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5353 * See the License for the specific language governing permissions and 5354 * limitations under the License. 5355 * ============================================================================= 5356 */const I8=(t,e,n,r=yn)=>{switch(t.op){case"Max":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.max(x("x",t,e,n),i,l)]}case"Mean":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.mean(x("x",t,e,n),i,l)]}case"Min":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.min(x("x",t,e,n),i,l)]}case"Sum":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.sum(x("x",t,e,n),i,l)]}case"All":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.all(x("x",t,e,n),i,l)]}case"Any":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.any(x("x",t,e,n),i,l)]}case"ArgMax":{const i=x("axis",t,e,n);return[r.argMax(x("x",t,e,n),i)]}case"ArgMin":{const i=x("axis",t,e,n);return[r.argMin(x("x",t,e,n),i)]}case"Prod":{const i=x("axis",t,e,n),l=x("keepDims",t,e,n);return[r.prod(x("x",t,e,n),i,l)]}case"Cumprod":{const i=x("axis",t,e,n),l=x("exclusive",t,e,n),u=x("reverse",t,e,n);return[r.cumprod(x("x",t,e,n),i,l,u)]}case"Cumsum":{const i=x("axis",t,e,n),l=x("exclusive",t,e,n),u=x("reverse",t,e,n);return[r.cumsum(x("x",t,e,n),i,l,u)]}case"Bincount":const s=x("x",t,e,n),a=x("weights",t,e,n),o=x("size",t,e,n);return[r.bincount(s,a,o)];case"DenseBincount":{const i=x("x",t,e,n),l=x("weights",t,e,n),u=x("size",t,e,n),c=x("binaryOutput",t,e,n);return[r.denseBincount(i,l,u,c)]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5357 * @license 5358 * Copyright 2018 Google LLC. All Rights Reserved. 5359 * Licensed under the Apache License, Version 2.0 (the "License"); 5360 * you may not use this file except in compliance with the License. 5361 * You may obtain a copy of the License at 5362 * 5363 * http://www.apache.org/licenses/LICENSE-2.0 5364 * 5365 * Unless required by applicable law or agreed to in writing, software 5366 * distributed under the License is distributed on an "AS IS" BASIS, 5367 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5368 * See the License for the specific language governing permissions and 5369 * limitations under the License. 5370 * ============================================================================= 5371 */const k8=(t,e,n,r=yn)=>{switch(t.op){case"ConcatV2":case"Concat":{const s=x("n",t,e,n),a=x("axis",t,e,n);let o=x("tensors",t,e,n);return o=o.slice(0,s),[r.concat(o,a)]}case"Gather":{const s=x("x",t,e,n),a=x("indices",t,e,n);return[r.gather(s,r.cast(a,"int32"),0)]}case"GatherV2":{const s=x("axis",t,e,n),a=x("batchDims",t,e,n),o=x("x",t,e,n),i=x("indices",t,e,n);return[r.gather(o,r.cast(i,"int32"),s,a)]}case"Reverse":{const s=x("dims",t,e,n),a=[];for(let i=0;i<s.length;i++)s[i]&&a.push(i);const o=x("x",t,e,n);return[r.reverse(o,a)]}case"ReverseV2":{const s=x("axis",t,e,n),a=x("x",t,e,n);return[r.reverse(a,s)]}case"Slice":{const s=x("begin",t,e,n),a=x("size",t,e,n);return[r.slice(x("x",t,e,n),s,a)]}case"StridedSlice":{const s=x("begin",t,e,n),a=x("end",t,e,n),o=x("strides",t,e,n),i=x("beginMask",t,e,n),l=x("endMask",t,e,n),u=x("ellipsisMask",t,e,n),c=x("newAxisMask",t,e,n),d=x("shrinkAxisMask",t,e,n),f=x("x",t,e,n);return[r.stridedSlice(f,s,a,o,i,l,u,c,d)]}case"Pack":return nt(()=>{const s=x("axis",t,e,n),a=x("tensors",t,e,n),o=a[0].shape,i=r.squeeze(a[0]).shape,l=a.map(u=>{const c=Ir(u.shape,o);if(!c&&!Ir(r.squeeze(u).shape,i))throw new Error("the input tensors shape does not match");return c?u:r.reshape(u,o)});return[r.stack(l,s)]});case"Unpack":{const s=x("axis",t,e,n),a=x("tensor",t,e,n);return r.unstack(a,s)}case"Tile":{const s=x("reps",t,e,n);return[r.tile(x("x",t,e,n),s)]}case"Split":case"SplitV":{const s=x("axis",t,e,n),a=x("numOrSizeSplits",t,e,n),o=x("x",t,e,n);return r.split(o,a,s)}case"ScatterNd":{const s=x("indices",t,e,n),a=x("values",t,e,n),o=x("shape",t,e,n);return[r.scatterND(s,a,o)]}case"GatherNd":{const s=x("x",t,e,n),a=x("indices",t,e,n);return[r.gatherND(s,a)]}case"SparseToDense":{const s=x("sparseIndices",t,e,n),a=x("outputShape",t,e,n),o=x("sparseValues",t,e,n),i=x("defaultValue",t,e,n);return[r.sparseToDense(s,o,a,o.dtype===i.dtype?i:r.cast(i,o.dtype))]}case"TensorScatterUpdate":{const s=x("indices",t,e,n),a=x("values",t,e,n),o=x("tensor",t,e,n);return[r.tensorScatterUpdate(o,s,a)]}default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5372 * @license 5373 * Copyright 2021 Google LLC. All Rights Reserved. 5374 * Licensed under the Apache License, Version 2.0 (the "License");
5375 * you may not use this file except in compliance with the License. 5376 * You may obtain a copy of the License at 5377 * 5378 * http://www.apache.org/licenses/LICENSE-2.0 5379 * 5380 * Unless required by applicable law or agreed to in writing, software 5381 * distributed under the License is distributed on an "AS IS" BASIS, 5382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5383 * See the License for the specific language governing permissions and 5384 * limitations under the License. 5385 * ============================================================================= 5386 */const E8=(t,e,n,r=yn)=>{switch(t.op){case"SparseFillEmptyRows":{const{outputIndices:s,outputValues:a,emptyRowIndicator:o,reverseIndexMap:i}=r.sparse.sparseFillEmptyRows(x("indices",t,e,n),x("values",t,e,n),x("denseShape",t,e,n),x("defaultValue",t,e,n));return[s,a,o,i]}case"SparseReshape":{const{outputIndices:s,outputShape:a}=r.sparse.sparseReshape(x("inputIndices",t,e,n),x("inputShape",t,e,n),x("newShape",t,e,n));return[s,a]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean(x("data",t,e,n),x("indices",t,e,n),x("segmentIds",t,e,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum(x("data",t,e,n),x("indices",t,e,n),x("segmentIds",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5387 * @license 5388 * Copyright 2018 Google LLC. All Rights Reserved. 5389 * Licensed under the Apache License, Version 2.0 (the "License"); 5390 * you may not use this file except in compliance with the License. 5391 * You may obtain a copy of the License at 5392 * 5393 * http://www.apache.org/licenses/LICENSE-2.0 5394 * 5395 * Unless required by applicable law or agreed to in writing, software 5396 * distributed under the License is distributed on an "AS IS" BASIS, 5397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5398 * See the License for the specific language governing permissions and 5399 * limitations under the License. 5400 * ============================================================================= 5401 */const T8=(t,e,n,r=yn)=>{switch(t.op){case"FFT":return[r.fft(x("x",t,e,n))];case"IFFT":return[r.ifft(x("x",t,e,n))];case"RFFT":return[r.rfft(x("x",t,e,n))];case"IRFFT":return[r.irfft(x("x",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5402 * @license 5403 * Copyright 2021 Google LLC. All Rights Reserved. 5404 * Licensed under the Apache License, Version 2.0 (the "License"); 5405 * you may not use this file except in compliance with the License. 5406 * You may obtain a copy of the License at 5407 * 5408 * http://www.apache.org/licenses/LICENSE-2.0 5409 * 5410 * Unless required by applicable law or agreed to in writing, software 5411 * distributed under the License is distributed on an "AS IS" BASIS, 5412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5413 * See the License for the specific language governing permissions and 5414 * limitations under the License. 5415 * ============================================================================= 5416 */const C8=(t,e,n,r=yn)=>{switch(t.op){case"StaticRegexReplace":return[r.string.staticRegexReplace(x("input",t,e,n),x("pattern",t,e,n),x("rewrite",t,e,n),x("replaceGlobal",t,e,n))];case"StringNGrams":{const{nGrams:s,nGramsSplits:a}=r.string.stringNGrams(x("data",t,e,n),x("dataSplits",t,e,n),x("separator",t,e,n),x("nGramWidths",t,e,n),x("leftPad",t,e,n),x("rightPad",t,e,n),x("padWidth",t,e,n),x("preserveShortSequences",t,e,n));return[s,a]}case"StringSplit":{const{indices:s,values:a,shape:o}=r.string.stringSplit(x("input",t,e,n),x("delimiter",t,e,n),x("skipEmpty",t,e,n));return[s,a,o]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast(x("input",t,e,n),x("numBuckets",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5417 * @license 5418 * Copyright 2018 Google LLC. All Rights Reserved. 5419 * Licensed under the Apache License, Version 2.0 (the "License"); 5420 * you may not use this file except in compliance with the License. 5421 * You may obtain a copy of the License at 5422 * 5423 * http://www.apache.org/licenses/LICENSE-2.0 5424 * 5425 * Unless required by applicable law or agreed to in writing, softw
5425are 5426 * distributed under the License is distributed on an "AS IS" BASIS, 5427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5428 * See the License for the specific language governing permissions and 5429 * limitations under the License. 5430 * ============================================================================= 5431 */const N8=(t,e,n,r=yn)=>{switch(t.op){case"Cast":return[r.cast(x("x",t,e,n),x("dtype",t,e,n))];case"ExpandDims":{const s=x("axis",t,e,n);return[r.expandDims(x("x",t,e,n),s)]}case"Squeeze":{const s=x("axis",t,e,n);return[r.squeeze(x("x",t,e,n),s)]}case"Reshape":return[r.reshape(x("x",t,e,n),x("shape",t,e,n))];case"EnsureShape":return[r.ensureShape(x("x",t,e,n),x("shape",t,e,n))];case"MirrorPad":return[r.mirrorPad(x("x",t,e,n),x("padding",t,e,n),x("mode",t,e,n))];case"PadV2":case"Pad":return[r.pad(x("x",t,e,n),x("padding",t,e,n),x("constantValue",t,e,n))];case"SpaceToBatchND":{const s=x("blockShape",t,e,n),a=x("paddings",t,e,n);return[r.spaceToBatchND(x("x",t,e,n),s,a)]}case"BatchToSpaceND":{const s=x("blockShape",t,e,n),a=x("crops",t,e,n);return[r.batchToSpaceND(x("x",t,e,n),s,a)]}case"DepthToSpace":{const s=x("blockSize",t,e,n),a=x("dataFormat",t,e,n).toUpperCase();return[r.depthToSpace(x("x",t,e,n),s,a)]}case"BroadcastTo":return[r.broadcastTo(x("x",t,e,n),x("shape",t,e,n))];case"BroadcastArgs":return[r.broadcastArgs(x("s0",t,e,n),x("s1",t,e,n))];default:throw TypeError("Node type ".concat(t.op," is not implemented"))}};/** 5432 * @license 5433 * Copyright 2018 Google LLC. All Rights Reserved. 5434 * Licensed under the Apache License, Version 2.0 (the "License"); 5435 * you may not use this file except in compliance with the License. 5436 * You may obtain a copy of the License at 5437 * 5438 * http://www.apache.org/licenses/LICENSE-2.0 5439 * 5440 * Unless required by applicable law or agreed to in writing, software 5441 * distributed under the License is distributed on an "AS IS" BASIS, 5442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5443 * See the License for the specific language governing permissions and 5444 * limitations under the License. 5445 * ============================================================================= 5446 */function Hv(t,e,n,r,s=nt){const a=((o,i,l)=>{switch(o.category){case"arithmetic":return s(()=>s8(o,i,l));case"basic_math":return s(()=>a8(o,i,l));case"control":return d8(o,i,l);case"convolution":return s(()=>f8(o,i,l));case"creation":return s(()=>p8(o,i,l));case"dynamic":return h8(o,i,l);case"evaluation":return s(()=>m8(o,i,l));case"image":return s(()=>b8(o,i,l));case"graph":return s(()=>
5446g8(o,i,l));case"logical":return s(()=>w8(o,i,l));case"matrices":return s(()=>S8(o,i,l));case"normalization":return s(()=>x8(o,i,l));case"ragged":return s(()=>_8(o,i,l));case"reduction":return s(()=>I8(o,i,l));case"slice_join":return s(()=>k8(o,i,l));case"sparse":return s(()=>E8(o,i,l));case"spectral":return s(()=>T8(o,i,l));case"string":return s(()=>C8(o,i,l));case"transformation":return s(()=>N8(o,i,l));case"hash_table":return v8(o,i,l,r);case"custom":const u=q2(o.op);if(u&&u.customExecutor)return u.customExecutor(new r8(o,i,l));throw TypeError("Custom op ".concat(o.op," is not registered."));default:throw TypeError("Unknown op '".concat(o.op,"'. File an issue at ")+"https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}})(t,e,n);return za(a)?a.then(o=>[].concat(o)):[].concat(a)}class Uv{constructor(e={},n={},r={},s={},a){this.weightMap=e,this.tensorArrayMap=n,this.tensorListMap=r,this.functionMap=s,this.parseNodeNameCache=a,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,n){return{id:e,frameName:n,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let n=0;n<this.contexts.length-1;n++){const r=this.contexts.slice(0,this.contexts.length-n);e.push(this.contextIdforContexts(r))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map(n=>n.id===0&&n.iterationId===0?"":"".concat(n.frameName,"-").concat(n.iterationId)).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(this.contexts&&this.contexts.length>1)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;const e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}else throw new Error("Cannot increase frame iteration, the context is empty")}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const n in this.tensorArrayMap)this.tensorArrayMap[n].clearAndClose(e);for(const n in this.tensorListMap)this.tensorListMap[n].clearAndClose(e)}}/** 5447 * @license 5448 * Copyright 2019 Google LLC. All Rights Reserved. 5449 * Licensed under the Apache License, Version 2.0 (the "License"); 5450 * you may not use this file except in compliance with the License. 5451 * You may obtain a copy of the License at 5452 * 5453 * http://www.apache.org/licenses/LICENSE-2.0 5454 * 5455 * Unless required by applicable law or agreed to in writing, software 5456 * distributed under the License is distributed on an "AS IS" BASIS, 5457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5458 * See the License for the specific language governing permissions and 5459 * limitations under the License. 5460 * ============================================================================= 5461 */function Vv(t,e,n,r){const s=new Set,a=[];let o=null,i=null;const l=new Set,u=new Set(Object.keys(t).map(f=>Jn(f)[0]));r=r||[];const c=new Set(r.map(f=>Jn(f.name)[0])),d=[...e];for(;d.length>0;){const f=d.pop();if((Na(f)||P8(f)||B8(f))&&o==null&&(o=f,i=o.children.map(p=>p.name).filter(p=>s.has(p))),s.add(f.name),n[f.name]==null&&!u.has(f.name)&&!c.has(f.name)){if(f.inputs.length===0){a.push(f.name);continue}f.inputs.forEach(p=>{l.has(p.name)||(l.add(p.name),d.push(p))})}}return{inputs:t,outputs:e,usedNodes:s,missingInputs:a,dynamicNode:o,syncInputs:i}}function A8(t,e){const{usedNodes:n,inputs:r}=e,s=Object.keys(r).map(g=>Jn(g)[0]).map(g=>t.nodes[g]),a=t.initNodes||[],o=g=>n.has(typeof g=="string"?g:g.name);function i(g){return[...new Map(g.map(v=>[v.name,v])).values()]}const l=i([...s,...t.weights,...a]).filter(o),u=i([...l,...Object.values(t.nodes)]).filter(o),c=new Map(u.map(g=>[g.name,g])),d={};for(const g of u){d[g.name]=d[g.name]||0;for(const v of g.children)o(v)||(d[v.name]=Number.POSITIVE_INFINITY),d[v.name]=(d[v.name]||0)+1}const f=Object.entries(d).filter(([,g])=>g===0).map(([g])=>g),p=[...f];for(;f.length>0;){const g=f.pop(),v=c.get(g);for(const b of v.children.filter(o))--d[b.name]===0&&(p.push(b.name),f.push(b.name))}
5461const h=p.map(g=>c.get(g)),m=$8(h,l);return R8(m,l),m}function $8(t,e){const n=new Map(t.map(o=>[o.name,o])),r=e.map(o=>o.name),s=new Set(r);for(;r.length>0;){const o=r.pop(),i=n.get(o);for(const l of i.children)!n.has(l.name)||s.has(l.name)||(s.add(l.name),r.push(l.name))}return t.filter(o=>s.has(o.name))}class bl extends Error{constructor(e){super("NodesExecutionOrderError: ".concat(e))}}function R8(t,e){const n=new Map(t.map((i,l)=>[i.name,l])),r=new Set(e.map(i=>i.name)),s=i=>r.has(typeof i=="string"?i:i.name),a=new Set(t.map(i=>i.name)),o=i=>a.has(typeof i=="string"?i:i.name);for(const i of t){for(const l of i.children.filter(o)){if(!n.has(l.name))throw new bl("Child ".concat(l.name," of node ").concat(i.name," is unreachable."));if(n.get(i.name)>n.get(l.name))throw new bl("Node ".concat(i.name," is scheduled to run after its child ").concat(l.name,"."))}if(!s(i))for(const l of i.inputs){if(!n.has(l.name))throw new bl("Input ".concat(l.name," of node ").concat(i.name," is unreachable."));if(n.get(l.name)>n.get(i.name))throw new bl("Node ".concat(i.name," is scheduled to run before its input ").concat(l.name,"."))}}}function D8(t){const e=new Map(t.map((i,l)=>[i.name,l])),n=Number.MAX_SAFE_INTEGER,r=t.map((i,l)=>Na(i)?n:l),s=i=>{const l=r[e.get(i.name)];return l==null?-1:l},a=t.map((i,l)=>i.children.map(s).reduce((u,c)=>Math.max(u,c),r[l])),o=new Map;for(let i=0;i<t.length;++i){const l=a[i];if(l===n)continue;const u=t[i],c=t[l];o.has(c.name)||o.set(c.name,[]),o.get(c.name).push(u)}return o}const F8=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),M8=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),O8=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function Na(t){return F8.has(t.op)}function P8(t){return M8.has(t.op)}function B8(t){return O8.has(t.op)}/** 5462 * @license 5463 * Copyright 2018 Google LLC. All Rights Reserved. 5464 * Licensed under the Apache License, Version 2.0 (the "License"); 5465 * you may not use this file except in compliance with the License. 5466 * You may obtain a copy of the License at 5467 * 5468 * http://www.apache.org/licenses/LICENSE-2.0 5469 * 5470 * Unless required by applicable law or agreed to in writing, software 5471 * distributed under the License is distributed on an "AS IS" BASIS, 5472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5473 * See the License for the specific language governing permissions and 5474 * limitations under the License. 5475 * ============================================================================= 5476 */class hu{get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const n=Object.keys(e).map(r=>e[r].map(s=>s.id));this._weightIds=[].concat(...n),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(e=>e.signatureKey||e.name)}get outputNodes(){return this._outputs.map(e=>{const n=e.signatureKey||e.name;return e.defaultOutput?"".concat(n,":").concat(e.defaultOutput):n})}get functions(){return Object.keys(this._functions).reduce((e,n)=>(e[n]=this._functions[n].signature,e),{})}constructor(e,n){this.graph=e,this.parent=n,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,e.functions!=null&&Object.keys(e.functions).forEac
5476h(r=>{this._functionExecutorMap[r]=new hu(e.functions[r],this)})}getCompilationKey(e,n){const r=e.map(a=>a.name).sort(),s=n.map(a=>a.name).sort();return r.join(this.SEPARATOR)+"--"+s.join(this.SEPARATOR)}compile(e,n){const r=Vv(e,n,this.weightMap,this._initNodes),{missingInputs:s,dynamicNode:a,syncInputs:o}=r;if(a!=null)throw new Error("This execution contains the node '".concat(a.name,"', which has ")+"the dynamic op '".concat(a.op,"'. Please use ")+"model.executeAsync() instead. Alternatively, to avoid the "+"dynamic ops, specify the inputs [".concat(o,"]"));if(s.length>0){const u=n.map(d=>d.name),c=Object.keys(e);throw new Error("Cannot compute the outputs [".concat(u,"] from the provided inputs ")+"[".concat(c,"]. Missing the following inputs: [").concat(s,"]"))}const i=A8(this.graph,r),l=D8(i);return{orderedNodes:i,nodeLiveUntilMap:l}}cloneAndKeepTensor(e){if(e==null)return null;const n=e.clone();return Qr(n),n}cloneTensorList(e){return e?e.map(r=>this.cloneAndKeepTensor(r)):null}cloneTensorMap(e){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,this.cloneTensorList(r)]))}execute(e,n){this.disposeIntermediateTensors(),e=this.mapInputs(e);const r=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),n=this.mapOutputs(n),this.checkOutputs(n);const s=r.map(f=>this.graph.nodes[Jn(f)[0]]),a=n.map(f=>Jn(f)[0]),o=new Set(a);let i=a.map(f=>this.graph.nodes[f]);i.length===0&&(i=this._outputs);const l=this.getCompilationKey(s,i);let u=this.compiledMap.get(l);u==null&&(u=this.compile(e,i),this.compiledMap.set(l,u));try{this.keepIntermediateTensors=Qe().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(f){this.keepIntermediateTensors=!1,console.warn(f.message)}const c={},d={};return nt(()=>{const f=new Uv(this.weightMap,c,d,this.functionExecutorMap,this.parseNodeNameCache),p=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(e).forEach(v=>{const[b,w]=Jn(v,f),S=[];S[w]=e[v],p[b]=S,this.keepIntermediateTensors&&(this.clonedTensorsMap[b]=this.cloneTensorList(S))});const h=this.getFrozenTensorIds(p),{orderedNodes:m,nodeLiveUntilMap:g}=u;for(const v of m){if(p[v.name])continue;const b=Hv(v,p,f,this._resourceManager);if(za(b))throw new Error("The execution of the op '".concat(v.op,"' returned a promise. ")+"Please use model.executeAsync() instead.");p[v.name]=b,this.keepIntermediateTensors&&(this.clonedTensorsMap[v.name]=this.cloneTensorList(b)),this.checkTensorForDisposalWithNodeLiveUntilInfo(v,p,f,h,o,g.get(v.name))}return this.parent==null&&f.dispose(h),n.map(v=>hn(v,p,f))})}getFrozenTensorIds(e){const n=[].concat.apply([],Object.keys(e).map(r=>e[r]).map(r=>r.map(s=>s.id)));return new Set(n)}checkTensorForDisposal(e,n,r,s,a,o,i){if(!(Na(n)||o.has(e))){for(const l of r[e])l!=null&&(i[l.id]=(i[l.id]||0)+n.children.length);for(const l of n.inputs){if(Na(l))continue;const u=Pv(l.name,r,s);if(u!=null)for(const c of u){if(!c||c.kept||a.has(c.id))continue;const d=i[c.id];d===1?(c.dispose(),delete i[c.id]):d!=null&&i[c.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(e,n,r,s,a,o){function i(l){return Na(l)||a.has(l.name)}if(!(Na(e)||o==null))for(const l of o){if(i(l))continue;const u=Pv(l.name,n,r);for(const c of u)!c||c.kept||s.has(c.id)||c.dispose()}}async executeAsync(e,n){return this._executeAsync(e,n)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach(e=>{for(const n of e)n&&!n.isDisposed&&n.dispose()}),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(e,n,r=!1,s={},a={}){this.disposeIntermediateTensors(),r||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),n=this.mapOutputs(n),this.checkOutputs(n));try{this.keepIntermediateTensors=Qe().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(f){this.keepIntermediateTensors=!1,console.warn(f.message)}const o=new Uv(this.weightMap,s,a,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));const i=await this.executeWithControlFlow(e,o,n,r),l=n.map(f=>hn(f,i,o)),u=l.map(f=>f.id),c=Object.keys(e).map(f=>e[f].id),d=new Set([...u,...c,...this.weightIds]);
5476return Object.values(i).forEach(f=>{f.forEach(p=>{p&&!p.isDisposed&&!d.has(p.id)&&p.dispose()})}),this.parent==null&&o.dispose(d),l}async executeFunctionAsync(e,n,r){const s=e.reduce((a,o,i)=>(a[this.inputs[i].name]=o,a),{});return this._executeAsync(s,this.outputNodes,!0,n,r)}async executeWithControlFlow(e,n,r,s){const a=Object.keys(e),o=a.map(S=>this.graph.nodes[Jn(S)[0]]),i=r.map(S=>Jn(S)[0]),l=new Set(i);let u=i.map(S=>this.graph.nodes[S]);u.length===0&&(u=this._outputs);const{usedNodes:c,missingInputs:d,dynamicNode:f,syncInputs:p}=Vv(e,u,this.weightMap,this._initNodes),h=[...o,...this.graph.weights,...this._initNodes||[]].map(S=>({node:S,contexts:n.currentContext})),m=Object.assign({},this.weightMap);Object.keys(e).forEach(S=>{const[I,E]=Jn(S),T=[];T[E]=e[S],m[I]=T});const g={},v=this.getFrozenTensorIds(m),b={};for(;h.length>0;){const S=this.processStack(o,h,n,m,b,v,l,g,c);await Promise.all(S)}f==null&&!s&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");const w=u.filter(S=>!Na(S)&&!hn(S.name,m,n)).map(S=>S.name);if(w.length>0){let S="";throw f!=null&&(S="Alternatively, to avoid the dynamic ops, use model.execute() "+"and specify the inputs [".concat(p,"]")),new Error("Cannot compute the outputs [".concat(w,"] from the provided ")+"inputs [".concat(a,"]. Consider providing the following inputs: ")+"[".concat(d,"]. ").concat(S))}return m}processStack(e,n,r,s,a,o,i,l,u){const c=[];for(;n.length>0;){const d=n.pop();r.currentContext=d.contexts;let f="";if(d.node.op==="Enter"&&x("isConstant",d.node,s,r)&&([f]=hs(d.node.name,r)),s[d.node.name]==null){const p=Hv(d.node,s,r,this._resourceManager);f||([f]=hs(d.node.name,r));const h=r.currentContext;za(p)?c.push(p.then(m=>(s[f]=m,this.keepIntermediateTensors&&(this.clonedTensorsMap[f]=this.cloneTensorList(m)),r.currentContext=h,this.checkTensorForDisposal(f,d.node,s,r,o,i,l),this.processChildNodes(d.node,n,r,s,a,u),m))):(s[f]=p,this.keepIntermediateTensors&&(this.clonedTensorsMap[f]=this.cloneTensorList(p)),this.checkTensorForDisposal(f,d.node,s,r,o,i,l),this.processChildNodes(d.node,n,r,s,a,u))}else this.processChildNodes(d.node,n,r,s,a,u)}return c}processChildNodes(e,n,r,s,a,o){e.children.forEach(i=>{const[l]=hs(i.name,r);a[l]||!o.has(i.name)||(i.op==="Merge"?i.inputNames.some(u=>!!hn(u,s,r))&&(a[l]=!0,n.push({contexts:r.currentContext,node:i})):i.inputNames.every(u=>!!hn(u,s,r))&&(a[l]=!0,n.push({contexts:r.currentContext,node:i})))})}dispose(){Object.keys(this.weightMap).forEach(e=>this.weightMap[e].forEach(n=>n.dispose()))}checkInputShapeAndType(e){Object.keys(e).forEach(n=>{const r=e[n],[s]=Jn(n),a=this.graph.nodes[s];if(a.attrParams.shape&&a.attrParams.shape.value){const o=a.attrParams.shape.value,i=o.length===r.shape.length&&r.shape.every((l,u)=>o[u]===-1||o[u]===l);A(i,()=>"The shape of dict['".concat(a.name,"'] provided in ")+"model.execute(dict) must be [".concat(o,"], but was ")+"[".concat(r.shape,"]"))}a.attrParams.dtype&&a.attrParams.dtype.value&&A(r.dtype===a.attrParams.dtype.value,()=>"The dtype of dict['".concat(a.name,"'] provided in ")+"model.execute(dict) must be "+"".concat(a.attrParams.dtype.value,", but was ").concat(r.dtype))})}mapInputs(e){var n,r;const s={};for(const a in e){const o=(r=(n=this._signature)===null||n===void 0?void 0:n.inputs)===null||r===void 0?void 0:r[a];o!=null?s[o.name]=e[a]:s[a]=e[a]}return s}checkInputs(e){const n=Object.keys(e).filter(r=>{const[s]=Jn(r);return this.graph.nodes[s]==null});if(n.length>0)throw new Error("The dict provided in model.execute(dict) has "+"keys: [".concat(n,"] that are not part of graph"))}mapOutputs(e){return e.map(n=>{var r,s;const a=(s=(r=this._signature)===null||r===void 0?void 0:r.outputs)===null||s===void 0?void 0:s[n];return a!=null?a.name:n},{})}checkOutputs(e){e.forEach(n=>{const[r]=Jn(n);if(!this.graph.nodes[r])throw new Error("The output '".concat(n,"' is not found in the graph"))})}}class L8{constructor(e={},n={}){this.hashTableNameToHandle=e,this.hashTableMap=n}addHashTable(e,n){this.hashTableNameToHandle[e]=n.handle,this.hashTableMap[n.id]=n}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}/** 5477 * @license 5478 * Copyright 2018 Google LLC. All Rights Reserved. 5479 * Licensed under the Apache License, Version 2.0 (the "License");
5480 * you may not use this file except in compliance with the License. 5481 * You may obtain a copy of the License at 5482 * 5483 * http://www.apache.org/licenses/LICENSE-2.0 5484 * 5485 * Unless required by applicable law or agreed to in writing, software 5486 * distributed under the License is distributed on an "AS IS" BASIS, 5487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5488 * See the License for the specific language governing permissions and 5489 * limitations under the License. 5490 * ============================================================================= 5491 */const W8="?tfjs-format=file",z8="model.json";class H8{get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}constructor(e,n={},r=S2){this.modelUrl=e,this.loadOptions=n,this.version="n/a",this.io=r,n==null&&(this.loadOptions={}),this.resourceManager=new L8}findIOHandler(){const e=this.modelUrl;if(e.load!=null)this.handler=e;else if(this.loadOptions.requestInit!=null)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{const n=this.io.getLoadHandlers(e,this.loadOptions);if(n.length===0)n.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(n.length>1)throw new Error("Found more than one (".concat(n.length,") load handlers for ")+"URL '".concat([e],"'"));this.handler=n[0]}}load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=this.handler.load();return za(e)?e.then(n=>this.loadSync(n)):this.loadSync(e)}loadSync(e){this.artifacts=e;const n=this.artifacts.modelTopology;let r=this.artifacts.signature;if(this.artifacts.userDefinedMetadata!=null){const a=this.artifacts.userDefinedMetadata;a.signature!=null&&(r=a.signature),a.structuredOutputKeys!=null&&(this.structuredOutputKeys=a.structuredOutputKeys)}this.signature=r,this.version="".concat(n.versions.producer,".").concat(n.versions.minConsumer);const s=this.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new hu(Bv.Instance.transformGraph(n,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(s),this.executor.resourceManager=this.resourceManager,e.modelInitializer!=null&&e.modelInitializer.node!=null){const a=Bv.Instance.transformGraph(e.modelInitializer);this.initializer=new hu(a),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}async save(e,n){if(typeof e=="string"){const r=this.io.getSaveHandlers(e);if(r.length===0)throw new Error("Cannot find any save handlers for URL '".concat(e,"'"));if(r.length>1)throw new Error("Found more than one (".concat(r.length,") save handlers for ")+"URL '".concat(e,"'"));e=r[0]}if(e.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}addStructuredOutputNames(e){if(this.structuredOutputKeys){const n=e instanceof Zt?[e]:e,r={};return n.forEach((s,a)=>r[this.structuredOutputKeys[a]]=s),r}return e}predict(e,n){const r=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(r)}async predictAsync(e,n){const r=await this.executeAsync(e,this.outputNodes);return this.addStructuredOutputNames(r)}normalizeInputs(e){var n;if(!(e instanceof Zt)&&!Array.isArray(e)){const a=(n=this.signature)===null||n===void 0?void 0:n.inputs;if(a!=null)for(const o in a){const i=a[o];i.resourceId!=null&&(e[o]=this.resourceIdToCapturedInput[i.resourceId])}return e}e=Array.isArray(e)?e:[e];const r=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+r!==this.inputNodes.length)throw new Error("Input tensor count mismatch, the graph model has ".concat(this.inputNodes.length-r," non-resource placeholders, while there are ").concat(e.length," input tensors provided."));let s=0;return this.inputNodes.reduce((a,o)=>{var i,l,u;const c=(u=(l=(i=this.signature)===null||i===void 0?void 0:i.inputs)===null||l===void 0?void 0:l[o])===null||u===void 0?void 0:u.resourceId;return c!=null?a[o]=this.resourceIdToCapturedInput[c]:a[o]=e[s++],a},{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}executeInitializerGraph(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}async executeInitializerGraphAsync(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.executeAsync({},[]):this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs))}setResourceIdToCapturedInput(e){if(this.resourceIdToCapturedInput={},this.initializerSignature){const n=this.initializerSignature.outputs,r=Object.keys(n);for(let s=0;s<r.length;s++){const a=r[s],o=n[a];this.resourceIdToCapturedInput[o.resourceId]=e[s]}}}execute(e,n){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),n=this.normalizeOutputs(n);const r=this.executor.execute(e,n);return r.length>1?r:r[0]}async executeAsync(e,n){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),e=this.normalizeInputs(e),n=this.normalizeOutputs(n);const r=await this.executor.executeAsync(e,n);return r.length>1?r:r[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce((n,r)=>(n[r]=[e[r]],n),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&cn(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}async function U8(t,e={},n=S2){if(t==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");e==null&&(e={}),e.fromTFHub&&typeof t=="string"&&(t=V8(t));const r=new H8(t,e,n);return await r.load(),r}function V8(t){return t.endsWith("/")||(t=t+"/"),"".concat(t).concat(z8).concat(W8)}/** 5492 * @license 5493 * Copyright 2024 Google LLC. All Rights Reserved. 5494 * Licensed under the Apache License, Version 2.0 (the "License");
5495 * you may not use this file except in compliance with the License. 5496 * You may obtain a copy of the License at 5497 * 5498 * http://www.apache.org/licenses/LICENSE-2.0 5499 * 5500 * Unless required by applicable law or agreed to in writing, software 5501 * distributed under the License is distributed on an "AS IS" BASIS, 5502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5503 * See the License for the specific language governing permissions and 5504 * limitations under the License. 5505 * ============================================================================= 5506 */var ea=function(){return ea=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},ea.apply(this,arguments)};function Is(t,e,n,r){return new(n||(n=Promise))(function(s,a){function o(u){try{l(r.next(u))}catch(c){a(c)}}function i(u){try{l(r.throw(u))}catch(c){a(c)}}function l(u){var c;u.done?s(u.value):(c=u.value,c instanceof n?c:new n(function(d){d(c)})).then(o,i)}l((r=r.apply(t,[])).next())})}function ks(t,e){var n,r,s,a,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(l){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(s=2&c[0]?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(s=o.trys,!((s=s.length>0&&s[s.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){o.label=c[1];break}if(c[0]===6&&o.label<s[1]){o.label=s[1],s=c;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(c);break}s[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(d){c=[6,d],r=0}finally{n=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([l,u])}}}var Y2=["rightEye","leftEye","noseTip","mouthCenter","rightEarTragion","leftEarTragion"],Tp={modelType:"short",runtime:"mediapipe",maxFaces:1},j8=function(){function t(e){var n=this;this.width=0,this.height=0,this.selfieMode=!1,this.faceDetectorSolution=new m5({locateFile:function(r,s){if(e.solutionPath){var a=e.solutionPath.replace(/\/+$/,"");return"".concat(a,"/").concat(r)}return"".concat(s,"/").concat(r)}}),this.faceDetectorSolution.setOptions({selfieMode:this.selfieMode,model:e.modelType}),this.faceDetectorSolution.onResults(function(r){if(n.height=r.image.height,n.width=r.image.width,n.faces=[],r.detections!==null)for(var s=0,a=r.detections;s<a.length;s++){var o=a[s];n.faces.push(n.normalizedToAbsolute(o.landmarks,(i=o.boundingBox,l=void 0,u=void 0,c=void 0,l=i.xCenter-i.width/2,u=l+i.width,c=i.yCenter-i.height/2,{xMin:l,xMax:u,yMin:c,yMax:c+i.height,width:i.width,height:i.height})))}var i,l,u,c})}return t.prototype.normalizedToAbsolute=function(e,n){var r=this;return{keypoints:e.map(function(s,a){return{x:s.x*r.width,y:s.y*r.height,name:Y2[a]}}),box:{xMin:n.xMin*this.width,yMin:n.yMin*this.height,xMax:n.xMax*this.width,yMax:n.yMax*this.height,width:n.width*this.width,height:n.height*this.height}}},t.prototype.estimateFaces=function(e,n){return Is(this,void 0,void 0,function(){var r,s;return ks(this,function(a){switch(a.label){case 0:return n&&n.flipHorizontal&&n.flipHorizontal!==this.selfieMode&&(this.selfieMode=n.flipHorizontal,this.faceDetectorSolution.setOptions({selfieMode:this.selfieMode})),e instanceof Zt?(s=ImageData.bind,[4,O6(e)]):[3,2];case 1:return r=new(s.apply(ImageData,[void 0,a.sent(),e.shape[1],e.shape[0]])),[3,3];case 2:r=e,a.label=3;case 3:return e=r,[4,this.faceDetectorSolution.send({image:e})];case 4:return a.sent(),[2,this.faces]}})})},t.prototype.dispose=function(){this.faceDetectorSolution.close()},t.prototype.reset=function(){this.faceDetectorSolution.reset(),this.width=0,this.height=0,this.faces=null,this.selfieMode=!1},t.prototype.initialize=function(){return this.faceDetectorSolution.initialize()},t}();function G8(t){return Is(this,void 0,void 0,function(){var e,n;return ks(this,function(r){switch(r.label){case 0:return e=function(s){if(s==null)return ea({},Tp);var a=ea({},s);return a.runtime="mediapipe",a.modelType==null&&(a.modelType=Tp.modelType),a.maxFaces==null&&(a.maxFaces=Tp.maxFaces),a}(t),[4,(n=new j8(e)).initialize()];case 1:return r.sent(),[2,n]}})})}
5506function q8(t,e,n,r){var s=t.width,a=t.height,o=1,i=Math.cos(t.rotation),l=Math.sin(t.rotation),u=t.xCenter,c=t.yCenter,d=1/e,f=1/n,p=new Array(16);return p[0]=s*i*o*d,p[1]=-a*l*d,p[2]=0,p[3]=(-.5*s*i*o+.5*a*l+u)*d,p[4]=s*l*o*f,p[5]=a*i*f,p[6]=0,p[7]=(-.5*a*i-.5*s*l*o+c)*f,p[8]=0,p[9]=0,p[10]=s*d,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,function(h){if(h.length!==16)throw new Error("Array length must be 16 but got ".concat(h.length));return[[h[0],h[1],h[2],h[3]],[h[4],h[5],h[6],h[7]],[h[8],h[9],h[10],h[11]],[h[12],h[13],h[14],h[15]]]}(p)}function J2(t){return t instanceof Zt?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function Q2(t){return t instanceof Zt?t:P6(t)}function Cp(t,e){A(t.width!==0,function(){return"".concat(e," width cannot be 0.")}),A(t.height!==0,function(){return"".concat(e," height cannot be 0.")})}function K8(t,e){var n=function(r,s,a,o){var i=s-r,l=o-a,u=l/i;return{scale:u,offset:a-r*u}}(0,255,e[0],e[1]);return nt(function(){return Fe(he(t,n.scale),n.offset)})}function X8(t,e,n){var r=e.outputTensorSize,s=e.keepAspectRatio,a=e.borderMode,o=e.outputTensorFloatRange,i=J2(t),l=function(f,p){return{xCenter:.5*f.width,yCenter:.5*f.height,width:f.width,height:f.height,rotation:0}}(i),u=function(f,p,h){if(h===void 0&&(h=!1),!h)return{top:0,left:0,right:0,bottom:0};var m=p.height,g=p.width;Cp(p,"targetSize"),Cp(f,"roi");var v,b,w=m/g,S=f.height/f.width,I=0,E=0;return w>S?(v=f.width,b=f.width*w,E=(1-S/w)/2):(v=f.height/w,b=f.height,I=(1-w/S)/2),f.width=v,f.height=b,{top:E,left:I,right:I,bottom:E}}(l,r,s),c=q8(l,i.width,i.height),d=nt(function(){var f=Q2(t),p=La(function(g,v,b){return Cp(b,"inputResolution"),[1/b.width*g[0][0]*v.width,1/b.height*g[0][1]*v.width,g[0][3]*v.width,1/b.width*g[1][0]*v.height,1/b.height*g[1][1]*v.height,g[1][3]*v.height,0,0]}(c,i,r),[1,8]),h=a==="zero"?"constant":"nearest",m=Hf.transform(Kr(Ut(f,"float32")),p,"bilinear",h,0,[r.height,r.width]);return o!=null?K8(m,o):m});return{imageTensor:d,padding:u,transformationMatrix:c}}function jv(t){t.reduceBoxesInLowestLayer==null&&(t.reduceBoxesInLowestLayer=!1),t.interpolatedScaleAspectRatio==null&&(t.interpolatedScaleAspectRatio=1),t.fixedAnchorSize==null&&(t.fixedAnchorSize=!1);for(var e=[],n=0;n<t.numLayers;){for(var r=[],s=[],a=[],o=[],i=n;i<t.strides.length&&t.strides[i]===t.strides[n];){var l=Gv(t.minScale,t.maxScale,i,t.strides.length);if(i===0&&t.reduceBoxesInLowestLayer)a.push(1),a.push(2),a.push(.5),o.push(.1),o.push(l),o.push(l);else{for(var u=0;u<t.aspectRatios.length;++u)a.push(t.aspectRatios[u]),o.push(l);if(t.interpolatedScaleAspectRatio>0){var c=i===t.strides.length-1?1:Gv(t.minScale,t.maxScale,i+1,t.strides.length);o.push(Math.sqrt(l*c)),a.push(t.interpolatedScaleAspectRatio)}}i++}for(var d=0;d<a.length;++d){var f=Math.sqrt(a[d]);r.push(o[d]/f),s.push(o[d]*f)}var p=0,h=0;if(t.featureMapHeight.length>0)p=t.featureMapHeight[n],h=t.featureMapWidth[n];else{var m=t.strides[n];p=Math.ceil(t.inputSizeHeight/m),h=Math.ceil(t.inputSizeWidth/m)}for(var g=0;g<p;++g)for(var v=0;v<h;++v)for(var b=0;b<r.length;++b){var w={xCenter:(v+t.anchorOffsetX)/h,yCenter:(g+t.anchorOffsetY)/p,width:0,height:0};t.fixedAnchorSize?(w.width=1,w.height=1):(w.width=s[b],w.height=r[b]),e.push(w)}n=i}return e}function Gv(t,e,n,r){return r===1?.5*(t+e):t+(e-t)*n/(r-1)}function qv(t,e){var n=e[0],r=e[1];return[n*t[0]+r*t[1]+t[3],n*t[4]+r*t[5]+t[7]]}function Y8(t){return nt(function(){var e=function(s){return nt(function(){return[Ye(s,[0,0,0],[1,-1,1]),Ye(s,[0,0,1],[1,-1,-1])]})}(t),n=e[0],r=e[1];return{boxes:pn(r),logits:pn(n)}})}function J8(t,e,n,r){return Is(this,void 0,void 0,function(){var s,a,o,i,l;return ks(this,function(u){switch(u.label){case 0:return t.sort(function(c,d){return Math.max.apply(Math,d.score)-Math.max.apply(Math,c.score)}),s=La(t.map(function(c){return[c.locationData.relativeBoundingBox.yMin,c.locationData.relativeBoundingBox.xMin,c.locationData.relativeBoundingBox.yMax,c.locationData.relativeBoundingBox.xMax]})),a=Sn(t.map(function(c){return c.score[0]})),[4,Hf.nonMaxSuppressionAsync(s,a,e,n)];case 1:return[4,(o=u.sent()).array()];case 2:return i=u.sent(),l=t.filter(function(c,d){return i.indexOf(d)>-1}),cn([s,a,o]),[2,l]}})})}function Q8(t,e,n){return Is(this,void 0,void 0,function(){var r,s,a,o,i;return ks(this,function(l){switch(l.label){case 0:return r=t[0],s=t[1],a=function(u,c,d){return nt(function(){var f,p,h,m;d.reverseOutputOrder?(p=pn(Ye(u,[0,d.boxCoordOffset+0],[-1,1])),f=pn(Ye(u,[0,d.boxCoordOffset+1],[-1,1])),m=pn(Ye(u,[0,d.boxCoordOffset+2],[-1,1])),h=pn(Ye(u,[0,d.boxCoordOffset+3],[-1,1]))):(f=pn(Ye(u,[0,d.boxCoordOffset+0],[-1,1])),p=pn(Ye(u,[0,d.boxCoordOffset+1],[-1,1])),h=pn(Ye(u,[0,d.boxCoordOffset+2],[-1,1])),m=pn(Ye(u,[0,d.boxCoordOffset+3],[-1,1]))),p=Fe(he(tt(p,d.xScale),c.w),c.x),f=Fe(he(tt(f,d.yScale),c.h),c.y),d.applyExponentialOnBoxSize?(h=he(Ss(tt(h,d.hScale)),c.h),m=he(Ss(tt(m,d.wScale)),c.w)):(h=he(tt(h,d.hScale),c.h),m=he(tt(m,d.wScale),c.h));var g=Je(f,tt(h,2)),v=Je(p,tt(m,2)),b=Fe(f,tt(h,2)),w=Fe(p,tt(m,2)),S=mn([re(g,[d.numBoxes,1]),re(v,[d.numBoxes,1]),re(b,[d.numBoxes,1]),re(w,[d.numBoxes,1])],1
5506);if(d.numKeypoints)for(var I=0;I<d.numKeypoints;++I){var E=d.keypointCoordOffset+I*d.numValuesPerKeypoint,T=void 0,D=void 0;d.reverseOutputOrder?(T=pn(Ye(u,[0,E],[-1,1])),D=pn(Ye(u,[0,E+1],[-1,1]))):(D=pn(Ye(u,[0,E],[-1,1])),T=pn(Ye(u,[0,E+1],[-1,1])));var R=Fe(he(tt(T,d.xScale),c.w),c.x),$=Fe(he(tt(D,d.yScale),c.h),c.y);S=mn([S,re(R,[d.numBoxes,1]),re($,[d.numBoxes,1])],1)}return S})}(s,e,n),o=nt(function(){var u=r;return n.sigmoidScore?(n.scoreClippingThresh!=null&&(u=$w(r,-n.scoreClippingThresh,n.scoreClippingThresh)),u=Ba(u)):u}),[4,Z8(a,o,n)];case 1:return i=l.sent(),cn([a,o]),[2,i]}})})}function Z8(t,e,n){return Is(this,void 0,void 0,function(){var r,s,a,o,i,l,u,c,d,f,p,h;return ks(this,function(m){switch(m.label){case 0:return r=[],[4,t.data()];case 1:return s=m.sent(),[4,e.data()];case 2:for(a=m.sent(),o=0;o<n.numBoxes;++o)if(!(n.minScoreThresh!=null&&a[o]<n.minScoreThresh||(i=o*n.numCoords,l=eP(s[i+0],s[i+1],s[i+2],s[i+3],a[o],n.flipVertically,o),(u=l.locationData.relativeBoundingBox).width<0||u.height<0))){if(n.numKeypoints>0)for((c=l.locationData).relativeKeypoints=[],d=n.numKeypoints*n.numValuesPerKeypoint,f=0;f<d;f+=n.numValuesPerKeypoint)p=i+n.keypointCoordOffset+f,h={x:s[p+0],y:n.flipVertically?1-s[p+1]:s[p+1]},c.relativeKeypoints.push(h);r.push(l)}return[2,r]}})})}function eP(t,e,n,r,s,a,o){return{score:[s],ind:o,locationData:{relativeBoundingBox:{xMin:e,yMin:a?1-n:t,xMax:r,yMax:a?1-t:n,width:r-e,height:n-t}}}}var tP={reduceBoxesInLowestLayer:!1,interpolatedScaleAspectRatio:1,featureMapHeight:[],featureMapWidth:[],numLayers:4,minScale:.1484375,maxScale:.75,inputSizeHeight:128,inputSizeWidth:128,anchorOffsetX:.5,anchorOffsetY:.5,strides:[8,16,16,16],aspectRatios:[1],fixedAnchorSize:!0},nP={reduceBoxesInLowestLayer:!1,interpolatedScaleAspectRatio:0,featureMapHeight:[],featureMapWidth:[],numLayers:1,minScale:.1484375,maxScale:.75,inputSizeHeight:192,inputSizeWidth:192,anchorOffsetX:.5,anchorOffsetY:.5,strides:[4],aspectRatios:[1],fixedAnchorSize:!0},Np={runtime:"tfjs",modelType:"short",maxFaces:1,detectorModelUrl:"https://tfhub.dev/mediapipe/tfjs-model/face_detection/short/1"},rP={applyExponentialOnBoxSize:!1,flipVertically:!1,ignoreClasses:[],numClasses:1,numBoxes:896,numCoords:16,boxCoordOffset:0,keypointCoordOffset:4,numKeypoints:6,numValuesPerKeypoint:2,sigmoidScore:!0,scoreClippingThresh:100,reverseOutputOrder:!0,xScale:128,yScale:128,hScale:128,wScale:128,minScoreThresh:.5},sP={applyExponentialOnBoxSize:!1,flipVertically:!1,ignoreClasses:[],numClasses:1,numBoxes:2304,numCoords:16,boxCoordOffset:0,keypointCoordOffset:4,numKeypoints:6,numValuesPerKeypoint:2,sigmoidScore:!0,scoreClippingThresh:100,reverseOutputOrder:!0,xScale:192,yScale:192,hScale:192,wScale:192,minScoreThresh:.6},aP=.3,oP={outputTensorSize:{width:128,height:128},keepAspectRatio:!0,outputTensorFloatRange:[-1,1],borderMode:"zero"},iP={outputTensorSize:{width:192,height:192},keepAspectRatio:!0,outputTensorFloatRange:[-1,1],borderMode:"zero"},mu,cP=function(){function t(e,n,r){this.detectorModel=n,this.maxFaces=r,e==="full"?(this.imageToTensorConfig=iP,this.tensorsToDetectionConfig=sP,this.anchors=jv(nP)):(this.imageToTensorConfig=oP,this.tensorsToDetectionConfig=rP,this.anchors=jv(tP));var s=Sn(this.anchors.map(function(l){return l.width})),a=Sn(this.anchors.map(function(l){return l.height})),o=Sn(this.anchors.map(function(l){return l.xCenter})),i=Sn(this.anchors.map(function(l){return l.yCenter}));this.anchorTensor={x:o,y:i,w:s,h:a}}return t.prototype.dispose=function(){this.detectorModel.dispose(),cn([this.anchorTensor.x,this.anchorTensor.y,this.anchorTensor.
5506w,this.anchorTensor.h])},t.prototype.reset=function(){},t.prototype.detectFaces=function(e,n){return n===void 0&&(n=!1),Is(this,void 0,void 0,function(){var r,s,a,o,i,l,u,c,d,f,p;return ks(this,function(h){switch(h.label){case 0:return e==null?(this.reset(),[2,[]]):(r=nt(function(){var m=Ut(Q2(e),"float32");return n&&(m=pn(Hf.flipLeftRight(Kr(m,0)),[0])),m}),s=X8(r,this.imageToTensorConfig),a=s.imageTensor,o=s.transformationMatrix,i=this.detectorModel.execute(a,"Identity:0"),l=Y8(i),u=l.boxes,[4,Q8([c=l.logits,u],this.anchorTensor,this.tensorsToDetectionConfig)]);case 1:return(d=h.sent()).length===0?(cn([r,a,i,c,u]),[2,d]):[4,J8(d,this.maxFaces,aP)];case 2:return f=h.sent(),p=function(m,g){m===void 0&&(m=[]);var v,b=(v=g,[].concat.apply([],v));return m.forEach(function(w){var S=w.locationData;S.relativeKeypoints.forEach(function($){var M=qv(b,[$.x,$.y]),B=M[0],z=M[1];$.x=B,$.y=z});var I=S.relativeBoundingBox,E=Number.MAX_VALUE,T=Number.MAX_VALUE,D=Number.MIN_VALUE,R=Number.MIN_VALUE;[[I.xMin,I.yMin],[I.xMin+I.width,I.yMin],[I.xMin+I.width,I.yMin+I.height],[I.xMin,I.yMin+I.height]].forEach(function($){var M=qv(b,$),B=M[0],z=M[1];E=Math.min(E,B),D=Math.max(D,B),T=Math.min(T,z),R=Math.max(R,z)}),S.relativeBoundingBox={xMin:E,xMax:D,yMin:T,yMax:R,width:D-E,height:R-T}}),m}(f,o),cn([r,a,i,c,u]),[2,p]}})})},t.prototype.estimateFaces=function(e,n){return Is(this,void 0,void 0,function(){var r,s;return ks(this,function(a){return r=J2(e),s=!!n&&n.flipHorizontal,[2,this.detectFaces(e,s).then(function(o){return o.map(function(i){for(var l=i.locationData.relativeKeypoints.map(function(h,m){return ea(ea({},h),{x:h.x*r.width,y:h.y*r.height,name:Y2[m]})}),u=i.locationData.relativeBoundingBox,c=0,d=["width","xMax","xMin"];c<d.length;c++)u[d[c]]*=r.width;for(var f=0,p=["height","yMax","yMin"];f<p.length;f++)u[p[f]]*=r.height;return{keypoints:l,box:u}})})]})})},t}();function lP(t){return Is(this,void 0,void 0,function(){var e,n,r;return ks(this,function(s){switch(s.label){case 0:return e=function(a){if(a==null)return ea({},Np);var o=ea({},a);return o.modelType==null&&(o.modelType=Np.modelType),o.maxFaces==null&&(o.maxFaces=Np.maxFaces),o.detectorModelUrl==null&&(o.modelType==="full"?o.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/face_detection/full/1":o.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/face_detection/short/1"),o}(t),n=typeof e.detectorModelUrl=="string"&&e.detectorModelUrl.indexOf("https://tfhub.dev")>-1,[4,U8(e.detectorModelUrl,{fromTFHub:n})];case 1:return r=s.sent(),[2,new cP(e.modelType,r,e.maxFaces)]}})})}function uP(t,e){return Is(this,void 0,void 0,function(){var n,r;return ks(this,function(s){if(t===mu.MediaPipeFaceDetector){if(r=void 0,(n=e)!=null){if(n.runtime==="tfjs")return[2,lP(n)];if(n.runtime==="mediapipe")return[2,G8(n)];r=n.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' "+"or 'mediapipe', but got ".concat(r))}throw new Error("".concat(t," is not a supported model name."))})})}(function(t){t.MediaPipeFaceDetector="MediaPipeFaceDetector"})(mu||(mu={}));/** 5507 * @license 5508 * Copyright 2019 Google LLC. All Rights Reserved. 5509 * Licensed under the Apache License, Version 2.0 (the "License"); 5510 * you may not use this file except in compliance with the License. 5511 * You may obtain a copy of the License at 5512 * 5513 * http://www.apache.org/licenses/LICENSE-2.0 5514 * 5515 * Unless required by applicable law or agreed to in writing, software 5516 * distributed under the License is distributed on an "AS IS" BASIS, 5517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5518 * See the License for the specific language governing permissions and 5519 * limitations under the License. 5520 * ============================================================================= 5521 */var it;(function(t){t[t.float32=0]="float32",t[t.int32=1]="int32",t[t.bool=2]="bool",t[t.string=3]="string",t[t.complex64=4]="complex64"})(it||(it={}));var Nc;(function(t){t[t.linear=0]="linear",t[t.relu=1]="relu",t[t.relu6=2]="relu6",t[t.prelu=3]="prelu",t[t.leakyrelu=4]="leakyrelu",t[t.sigmoid=5]="sigmoid",t[t.elu=6
5521]="elu"})(Nc||(Nc={}));/** 5522 * @license 5523 * Copyright 2019 Google LLC. All Rights Reserved. 5524 * Licensed under the Apache License, Version 2.0 (the "License"); 5525 * you may not use this file except in compliance with the License. 5526 * You may obtain a copy of the License at 5527 * 5528 * http://www.apache.org/licenses/LICENSE-2.0 5529 * 5530 * Unless required by applicable law or agreed to in writing, software 5531 * distributed under the License is distributed on an "AS IS" BASIS, 5532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5533 * See the License for the specific language governing permissions and 5534 * limitations under the License. 5535 * ============================================================================= 5536 */let Z2;function dP(t){Z2=t.wasm.cwrap(gc,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function fP(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:a,bias:o,preluActivationWeights:i}=e;if(s.dtype!=="float32"||a.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");const{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r,f=n.dataIdMap.get(s.dataId).id,p=n.dataIdMap.get(a.dataId).id;let h=0;if(o!=null){const D=n.dataIdMap.get(o.dataId);if(D.shape.length!==1)throw new Error("_FusedMatMul only supports rank-1 bias but got "+"rank ".concat(D.shape.length,"."));h=D.id}const m=i==null?0:n.dataIdMap.get(i.dataId).id,g=Nc[c];if(g==null)throw new Error("".concat(c," activation not yet supported for FusedConv2D ")+"in the wasm backend.");const v=l?s.shape[2]:s.shape[1],b=u?a.shape[1]:a.shape[2],w=Rt(s.shape.slice(0,-2),a.shape.slice(0,-2)),S=n.makeOutput([...w,v,b],s.dtype),I=n.dataIdMap.get(S.dataId).id,E=new Uint8Array(new Int32Array(s.shape).buffer),T=new Uint8Array(new Int32Array(a.shape).buffer);return Z2(f,E,s.shape.length,p,T,a.shape.length,l,u,g,h,m,d||0,I),S}const pP={kernelName:gc,backendName:"wasm",setupFunc:dP,kernelFunc:fP};/** 5537 * @license 5538 * Copyright 2019 Google LLC. All Rights Reserved. 5539 * Licensed under the Apache License, Version 2.0 (the "License"); 5540 * you may not use this file except in compliance with the License. 5541 * You may obtain a copy of the License at 5542 * 5543 * http://www.apache.org/licenses/LICENSE-2.0 5544 * 5545 * Unless required by applicable law or agreed to in writing, software 5546 * distributed under the License is distributed on an "AS IS" BASIS, 5547 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5548 * See the License for the specific language governing permissions and 5549 * limitations under the License. 5550 * ============================================================================= 5551 */function st(t,e){let n;function r(a){n=a.wasm.cwrap(t,null,["number","number","number"])}function s(a){const{backend:o,inputs:{x:i}}=a,l=o.dataIdMap.get(i.dataId).id,u=o.makeOutput(i.shape,e||i.dtype),c=o.dataIdMap.get(u.dataId).id;return J(u.shape)===0||n(l,it[i.dtype],c),u}return{kernelName:t,backendName:"wasm",setupFunc:r,kernelFunc:s}}/** 5552 * @license 5553 * Copyright 2019 Google LLC. All Rights Reserved. 5554 * Licensed under the Apache License, Version 2.0 (the "License"); 5555 * you may not use this file except in compliance with the License. 5556 * You may obtain a copy of the License at 5557 * 5558 * http://www.apache.org/licenses/LICENSE-2.0 5559 * 5560 * Unless required by applicable law or agreed to in writing, software 5561 * distributed under the License is distributed on an "AS IS" BASIS, 5562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5563 * See the License for the specific language governing permissions and 5564 * limitations under the License. 5565 * ============================================================================= 5566 */const hP=st(Tm);/** 5567 * @license 5568 * Copyright 2023 Google LLC. 5569 * Licensed under the Apache License, Version 2.0 (the "License"); 5570 * you may not use this file except in compliance with the License. 5571 * You may obtain a copy of the License at 5572 * 5573 * http://www.apache.org/licenses/LICENSE-2.0 5574 * 5575 * Unless required by applicable law or agreed to in writing, softw
5575are 5576 * distributed under the License is distributed on an "AS IS" BASIS, 5577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5578 * See the License for the specific language governing permissions and 5579 * limitations under the License. 5580 * ============================================================================= 5581 */const mP=st(Ou);/** 5582 * @license 5583 * Copyright 2023 Google LLC. 5584 * Licensed under the Apache License, Version 2.0 (the "License"); 5585 * you may not use this file except in compliance with the License. 5586 * You may obtain a copy of the License at 5587 * 5588 * http://www.apache.org/licenses/LICENSE-2.0 5589 * 5590 * Unless required by applicable law or agreed to in writing, software 5591 * distributed under the License is distributed on an "AS IS" BASIS, 5592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5593 * See the License for the specific language governing permissions and 5594 * limitations under the License. 5595 * ============================================================================= 5596 */const gP=st(Pu);/** 5597 * @license 5598 * Copyright 2019 Google LLC. All Rights Reserved. 5599 * Licensed under the Apache License, Version 2.0 (the "License"); 5600 * you may not use this file except in compliance with the License. 5601 * You may obtain a copy of the License at 5602 * 5603 * http://www.apache.org/licenses/LICENSE-2.0 5604 * 5605 * Unless required by applicable law or agreed to in writing, software 5606 * distributed under the License is distributed on an "AS IS" BASIS, 5607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5608 * See the License for the specific language governing permissions and 5609 * limitations under the License. 5610 * ============================================================================= 5611 */function nn(t,e,n){let r;function s(o){r=o.wasm.cwrap(t,null,["number","array","number","number","array","number","number","number"])}function a(o){const{backend:i,inputs:l}=o,{a:u,b:c}=l,d=i.dataIdMap.get(u.dataId).id,f=i.dataIdMap.get(c.dataId).id,p=n!=null?n:u.dtype,h=Rt(u.shape,c.shape),m=i.makeOutput(h,p);if(J(h)===0)return m;const g=new Uint8Array(new Int32Array(u.shape).buffer),v=new Uint8Array(new Int32Array(c.shape).buffer),b=i.dataIdMap.get(m.dataId).id;return(()=>r(d,g,u.shape.length,f,v,c.shape.length,it[u.dtype],b))(),m}return{kernelName:t,backendName:"wasm",setupFunc:s,kernelFunc:a}}/** 5612 * @license 5613 * Copyright 2019 Google LLC. All Rights Reserved. 5614 * Licensed under the Apache License, Version 2.0 (the "License"); 5615 * you may not use this file except in compliance with the License. 5616 * You may obtain a copy of the License at 5617 * 5618 * http://www.apache.org/licenses/LICENSE-2.0 5619 * 5620 * Unless required by applicable law or agreed to in writing, software 5621 * distributed under the License is distributed on an "AS IS" BASIS, 5622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5623 * See the License for the specific language governing permissions and 5624 * limitations under the License. 5625 * ============================================================================= 5626 */const yP=nn(Bc);/** 5627 * @license 5628 * Copyright 2019 Google LLC. All Rights Reserved. 5629 * Licensed under the Apache License, Version 2.0 (the "License"); 5630 * you may not use this file except in compliance with the License. 5631 * You may obtain a copy of the License at 5632 * 5633 * http://www.apache.org/licenses/LICENSE-2.0 5634 * 5635 * Unless required by applicable law or agreed to in writing, software 5636 * distributed under the License is distributed on an "AS IS" BASIS, 5637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5638 * See the License for the specific language governing permissions and 5639 * limitations under the License. 5640 * ============================================================================= 5641 */let eS;function vP(t){eS=t.wasm.cwrap(Bu,null,["array","number","number","number"])}function bP(t){const{inputs:e,backend:n}=t,r=n.makeOutput(e[0].shape,e[0].dtype);if(J(r.shape)===0)return r;const s=e.map(i=>n.dataIdMap.get(i.dataId).id),a=new Uint8Array(new Int32Array(s).buffer),o=n.dataIdMap.get(r.dataId).id;return eS(a,s.length,it[r.dtype],o),r}const wP={kernelName:Bu,backendName:"wasm",setupFunc:vP,kernelFunc:bP};/** 5642 * @license 5643 * Copyright 2020 Google LLC. All Rights Reserved. 5644 * Licensed under the Apache License, Version 2.0 (the "License");
5645 * you may not use this file except in compliance with the License. 5646 * You may obtain a copy of the License at 5647 * 5648 * http://www.apache.org/licenses/LICENSE-2.0 5649 * 5650 * Unless required by applicable law or agreed to in writing, software 5651 * distributed under the License is distributed on an "AS IS" BASIS, 5652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5653 * See the License for the specific language governing permissions and 5654 * limitations under the License. 5655 * ============================================================================= 5656 */function Gf(t){const{inputs:{x:e},backend:n}=t;if(e.dtype==="string")return Fr(n.readSync(e.dataId),e.shape,e.dtype);const r=n.makeOutput(e.shape,e.dtype),s=n.typedArrayFromHeap(e);return n.typedArrayFromHeap(r).set(s),r}const SP={kernelName:_d,backendName:"wasm",kernelFunc:Gf};/** 5657 * @license 5658 * Copyright 2019 Google LLC. All Rights Reserved. 5659 * Licensed under the Apache License, Version 2.0 (the "License"); 5660 * you may not use this file except in compliance with the License. 5661 * You may obtain a copy of the License at 5662 * 5663 * http://www.apache.org/licenses/LICENSE-2.0 5664 * 5665 * Unless required by applicable law or agreed to in writing, software 5666 * distributed under the License is distributed on an "AS IS" BASIS, 5667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5668 * See the License for the specific language governing permissions and 5669 * limitations under the License. 5670 * ============================================================================= 5671 */let tS;function xP(t){tS=t.wasm.cwrap(Lo,null,["number","array","number","number","number","array","number"])}function ta(t){const{inputs:e,backend:n,attrs:r}=t,[s,a]=IP(e.x.shape,r.perm);let o=!0;for(let h=0;h<a.length;h++)a[h]!==h&&(o=!1);const i=_P(e.x.shape,r.perm),l={dataId:e.x.dataId,shape:s,dtype:e.x.dtype};if(o){const h=Gf({inputs:e,backend:n});return h.shape=i,h}const u=n.makeOutput(i,l.dtype),c=n.dataIdMap.get(l.dataId).id,d=n.dataIdMap.get(u.dataId).id,f=new Uint8Array(new Int32Array(a).buffer),p=new Uint8Array(new Int32Array(l.shape).buffer);return tS(c,p,l.shape.length,it[l.dtype],d,f,a.length),u}function _P(t,e){const n=new Array(t.length);for(let r=0;r<n.length;r++)n[r]=t[e[r]];return n}function IP(t,e){const n=[],r=[];for(let s=0;s<t.length;++s)t[s]!==1&&n.push(t[s]),t[e[s]]!==1&&r.push(e[s]);for(let s=0;s<r.length;++s){let a=-1;for(let o=0;o<r.length;++o)r[o]>=s&&(a===-1||r[a]>r[o])&&(a=o);r[a]=s}return[n,r]}const kP={kernelName:Lo,backendName:"wasm",kernelFunc:ta,setupFunc:xP};/** 5672 * @license 5673 * Copyright 2020 Google Inc. All Rights Reserved. 5674 * Licensed under the Apache License, Version 2.0 (the "License"); 5675 * you may not use this file except in compliance with the License. 5676 * You may obtain a copy of the License at 5677 * 5678 * http://www.apache.org/licenses/LICENSE-2.0 5679 * 5680 * Unless required by applicable law or agreed to in writing, software 5681 * distributed under the License is distributed on an "AS IS" BASIS, 5682 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5683 * See the License for the specific language governing permissions and 5684 * limitations under the License. 5685 * ============================================================================= 5686 */function ca(t,e,n){const r=t.shape,s=t.shape.length,a=Vt(e,r);let o=a;const i=fr(o,s);let l=null,u=!1;if(i!=null){const c=new Array(s);for(let p=0;p<c.length;p++)c[p]=r[i[p]];o=Fn(o.length,s),l=ta({inputs:{x:t},attrs:{perm:i},backend:n});const d=n.dataIdMap.get(t.dataId).id;n.dataIdMap.get(l.dataId).id!==d&&(u=!0)}return{transposed:l,originalAxes:a,axes:o,inputWasTransposed:u}}/** 5687 * @license 5688 * Copyright 2021 Google LLC. All Rights Reserved. 5689 * Licensed under the Apache License, Version 2.0 (the "License"); 5690 * you may not use this file except in compliance with the License. 5691 * You may obtain a copy of the License at 5692 * 5693 * http://www.apache.org/licenses/LICENSE-2.0 5694 * 5695 * Unless required by applicable law or agreed to in writing, software 5696 * distributed under the License is distributed on an "AS IS" BASIS, 5697 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5698 * See the License for the specific language governing permissions and 5699 * limitations under the License. 5700 * ============================================================================= 5701 */let nS;function EP(t){nS=t.wasm.cwrap(Lu,null,["number, number, number"])}
5701function TP(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n;let l=e.dataIdMap.get(o.dataId).id,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);if(p){const w=e.dataIdMap.get(c.dataId).id;u=c,l=w}const h=u.shape.length;Dn("all",d,h);const[m,g]=Rn(u.shape,d),v=J(g),b=e.makeOutput(m,o.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;nS(l,v,w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const CP={kernelName:Lu,backendName:"wasm",setupFunc:EP,kernelFunc:TP};/** 5702 * @license 5703 * Copyright 2021 Google LLC. All Rights Reserved. 5704 * Licensed under the Apache License, Version 2.0 (the "License"); 5705 * you may not use this file except in compliance with the License. 5706 * You may obtain a copy of the License at 5707 * 5708 * http://www.apache.org/licenses/LICENSE-2.0 5709 * 5710 * Unless required by applicable law or agreed to in writing, software 5711 * distributed under the License is distributed on an "AS IS" BASIS, 5712 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5713 * See the License for the specific language governing permissions and 5714 * limitations under the License. 5715 * ============================================================================= 5716 */let rS;function NP(t){rS=t.wasm.cwrap(Wu,null,["number, number, number"])}function AP(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n;let l=e.dataIdMap.get(o.dataId).id,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);if(p){const w=e.dataIdMap.get(c.dataId).id;u=c,l=w}const h=u.shape.length;Dn("any",d,h);const[m,g]=Rn(u.shape,d),v=J(g),b=e.makeOutput(m,o.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;rS(l,v,w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const $P={kernelName:Wu,backendName:"wasm",setupFunc:NP,kernelFunc:AP};/** 5717 * @license 5718 * Copyright 2023 Google LLC. 5719 * Licensed under the Apache License, Version 2.0 (the "License"); 5720 * you may not use this file except in compliance with the License. 5721 * You may obtain a copy of the License at 5722 * 5723 * http://www.apache.org/licenses/LICENSE-2.0 5724 * 5725 * Unless required by applicable law or agreed to in writing, software 5726 * distributed under the License is distributed on an "AS IS" BASIS, 5727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5728 * See the License for the specific language governing permissions and 5729 * limitations under the License. 5730 * ============================================================================= 5731 */function sS(t){let e;function n(s){e=s.wasm.cwrap(t,null,["number","number","number","number","number"])}function r(s){const{backend:a,inputs:o,attrs:i}=s,{axis:l}=i,{x:u}=o,c=a.dataIdMap.get(u.dataId).id;let d=c,f=u;const{transposed:p,axes:h,inputWasTransposed:m}=ca(u,l,a);if(m){const I=a.dataIdMap.get(p.dataId).id;I!==c&&(f=p,d=I)}const g=f.shape.slice(0,-1),v=a.makeOutput(g,"int32"),b=a.dataIdMap.get(v.dataId).id,w=J(v.shape),S=f.shape[h[0]];return e(d,it[f.dtype],w,S,b),m&&a.disposeData(p.dataId),v}return{kernelName:t,backendName:"wasm",setupFunc:n,kernelFunc:r}}/** 5732 * @license 5733 * Copyright 2019 Google LLC. All Rights Reserved. 5734 * Licensed under the Apache License, Version 2.0 (the "License"); 5735 * you may not use this file except in compliance with the License. 5736 * You may obtain a copy of the License at 5737 * 5738 * http://www.apache.org/licenses/LICENSE-2.0 5739 * 5740 * Unless required by applicable law or agreed to in writing, software 5741 * distributed under the License is distributed on an "AS IS" BASIS, 5742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5743 * See the License for the specific language governing permissions and 5744 * limitations under the License. 5745 * ============================================================================= 5746 */const RP=sS(Cm);/** 5747 * @license 5748 * Copyright 2023 Google LLC. 5749 * Licensed under the Apache License, Version 2.0 (the "License"); 5750 * you may not use this file except in compliance with the License. 5751 * You may obtain a copy of the License at 5752 * 5753 * http://www.apache.org/licenses/LICENSE-2.0 5754 * 5755 * Unless required by applicable law or agreed to in writing, softw
5755are 5756 * distributed under the License is distributed on an "AS IS" BASIS, 5757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5758 * See the License for the specific language governing permissions and 5759 * limitations under the License. 5760 * ============================================================================= 5761 */const DP=sS(Nm);/** 5762 * @license 5763 * Copyright 2023 Google LLC. 5764 * Licensed under the Apache License, Version 2.0 (the "License"); 5765 * you may not use this file except in compliance with the License. 5766 * You may obtain a copy of the License at 5767 * 5768 * http://www.apache.org/licenses/LICENSE-2.0 5769 * 5770 * Unless required by applicable law or agreed to in writing, software 5771 * distributed under the License is distributed on an "AS IS" BASIS, 5772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5773 * See the License for the specific language governing permissions and 5774 * limitations under the License. 5775 * ============================================================================= 5776 */const FP=st(zu);
5776/** 5777 * @license 5778 * Copyright 2023 Google LLC. 5779 * Licensed under the Apache License, Version 2.0 (the "License"); 5780 * you may not use this file except in compliance with the License. 5781 * You may obtain a copy of the License at 5782 * 5783 * http://www.apache.org/licenses/LICENSE-2.0 5784 * 5785 * Unless required by applicable law or agreed to in writing, software 5786 * distributed under the License is distributed on an "AS IS" BASIS, 5787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5788 * See the License for the specific language governing permissions and 5789 * limitations under the License. 5790 * ============================================================================= 5791 */const MP=st(Hu);/** 5792 * @license 5793 * Copyright 2023 Google LLC. 5794 * Licensed under the Apache License, Version 2.0 (the "License"); 5795 * you may not use this file except in compliance with the License. 5796 * You may obtain a copy of the License at 5797 * 5798 * http://www.apache.org/licenses/LICENSE-2.0 5799 * 5800 * Unless required by applicable law or agreed to in writing, software 5801 * distributed under the License is distributed on an "AS IS" BASIS, 5802 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5803 * See the License for the specific language governing permissions and 5804 * limitations under the License. 5805 * ============================================================================= 5806 */const OP=st(Uu);/** 5807 * @license 5808 * Copyright 2023 Google LLC. 5809 * Licensed under the Apache License, Version 2.0 (the "License"); 5810 * you may not use this file except in compliance with the License. 5811 * You may obtain a copy of the License at 5812 * 5813 * http://www.apache.org/licenses/LICENSE-2.0 5814 * 5815 * Unless required by applicable law or agreed to in writing, software 5816 * distributed under the License is distributed on an "AS IS" BASIS, 5817 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5818 * See the License for the specific language governing permissions and 5819 * limitations under the License. 5820 * ============================================================================= 5821 */const PP=nn(ju);/** 5822 * @license 5823 * Copyright 2023 Google LLC. 5824 * Licensed under the Apache License, Version 2.0 (the "License"); 5825 * you may not use this file except in compliance with the License. 5826 * You may obtain a copy of the License at 5827 * 5828 * http://www.apache.org/licenses/LICENSE-2.0 5829 * 5830 * Unless required by applicable law or agreed to in writing, software 5831 * distributed under the License is distributed on an "AS IS" BASIS, 5832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5833 * See the License for the specific language governing permissions and 5834 * limitations under the License. 5835 * ============================================================================= 5836 */const BP=st(Vu);/** 5837 * @license 5838 * Copyright 2019 Google LLC. All Rights Reserved. 5839 * Licensed under the Apache License, Version 2.0 (the "License"); 5840 * you may not use this file except in compliance with the License. 5841 * You may obtain a copy of the License at 5842 * 5843 * http://www.apache.org/licenses/LICENSE-2.0 5844 * 5845 * Unless required by applicable law or agreed to in writing, software 5846 * distributed under the License is distributed on an "AS IS" BASIS, 5847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5848 * See the License for the specific language governing permissions and 5849 * limitations under the License. 5850 * ============================================================================= 5851 */let aS;function LP(t){aS=t.wasm.cwrap(Gu,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function WP(t){const{inputs:e,attrs:n,backend:r}=t,s=e.x,a=r.dataIdMap.get(s.dataId).id,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=n,c=Wr(s.shape,o,i,1,l,u),d=c.filterHeight,f=c.filterWidth,p=c.padInfo.top,h=c.padInfo.right,m=c.padInfo.bottom,g=c.padInfo.left,v=c.strideHeight,b=c.strideWidth,w=c.inChannels;if(c.dataFormat!=="channelsLast")throw new Error("wasm backend does not support dataFormat:'"+"".concat(c.dataFormat,"'. Please use 'channelsLast'."));if(c.dilationWidth!==1||c.dilationHeight!==1)throw new Error("was backend only supports average pooling with dilation = [1, 1], "+"got [".concat(c.dilationHeight,", ").concat(c.dilationWidth,"]."));const S=r.makeOutput(c.outShape,"float32"),I=r.dataIdMap.get(S.dataId).id;return aS(a,s.shape[0],s.shape[1],s.shape[2],d,f,p,h,m,g,v,b,w,I),S}const zP={kernelName:Gu,backendName:"wasm",setupFunc:LP,kernelFunc:WP};/** 5852 * @license 5853 * Copyright 2023 Google LLC. 5854 * Licensed under the Apache License, Version 2.0 (the "License");
5855 * you may not use this file except in compliance with the License. 5856 * You may obtain a copy of the License at 5857 * 5858 * http://www.apache.org/licenses/LICENSE-2.0 5859 * 5860 * Unless required by applicable law or agreed to in writing, software 5861 * distributed under the License is distributed on an "AS IS" BASIS, 5862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5863 * See the License for the specific language governing permissions and 5864 * limitations under the License. 5865 * ============================================================================= 5866 */let oS;function HP(t){oS=t.wasm.cwrap("AvgPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function UP(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r,c=ia(s.shape,a,o,1,i,l,u),d=n.makeOutput(c.outShape,s.dtype);return oS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),d}const VP={kernelName:Am,backendName:"wasm",setupFunc:HP,kernelFunc:UP};/** 5867 * @license 5868 * Copyright 2023 Google LLC. 5869 * Licensed under the Apache License, Version 2.0 (the "License"); 5870 * you may not use this file except in compliance with the License. 5871 * You may obtain a copy of the License at 5872 * 5873 * http://www.apache.org/licenses/LICENSE-2.0 5874 * 5875 * Unless required by applicable law or agreed to in writing, software 5876 * distributed under the License is distributed on an "AS IS" BASIS, 5877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5878 * See the License for the specific language governing permissions and 5879 * limitations under the License. 5880 * ============================================================================= 5881 */let iS;function jP(t){iS=t.wasm.cwrap("AvgPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function GP(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r,c=ia(a.shape,o,i,1,l,u),d=n.makeOutput(a.shape,a.dtype);return iS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left,c.filterDepth,c.filterHeight,c.filterWidth),d}const qP={kernelName:N1,backendName:"wasm",setupFunc:jP,kernelFunc:GP};/** 5882 * @license 5883 * Copyright 2023 Google LLC. 5884 * Licensed under the Apache License, Version 2.0 (the "License"); 5885 * you may not use this file except in compliance with the License. 5886 * You may obtain a copy of the License at 5887 * 5888 * http://www.apache.org/licenses/LICENSE-2.0 5889 * 5890 * Unless required by applicable law or agreed to in writing, software 5891 * distributed under the License is distributed on an "AS IS" BASIS, 5892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5893 * See the License for the specific language governing permissions and 5894 * limitations under the License. 5895 * ============================================================================= 5896 */let cS;function KP(t){cS=t.wasm.cwrap("AvgPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function XP(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l}=r,u=Wr(a.shape,o,i,1,l),c=n.makeOutput(a.shape,a.dtype);return cS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(c.dataId).id,u.batchSize,u.inChannels,u.inHeight,u.inWidth,u.outHeight,u.outWidth,u.strideHeight,u.strideWidth,u.dilationHeight,u.dilationWidth,u.effectiveFilterHeight,u.effectiveFilterWidth,u.padInfo.top,u.padInfo.left,u.filterHeight,u.filterWidth),c}const YP={kernelName:C1,backendName:"wasm",setupFunc:KP,kernelFunc:XP};/** 5897 * @license 5898 * Copyright 2019 Google LLC. All Rights Reserved. 5899 * Licensed under the Apache License, Version 2.0 (the "License");
5900 * you may not use this file except in compliance with the License. 5901 * You may obtain a copy of the License at 5902 * 5903 * http://www.apache.org/licenses/LICENSE-2.0 5904 * 5905 * Unless required by applicable law or agreed to in writing, software 5906 * distributed under the License is distributed on an "AS IS" BASIS, 5907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5908 * See the License for the specific language governing permissions and 5909 * limitations under the License. 5910 * ============================================================================= 5911 */function zn(t){const{inputs:e,attrs:n}=t,{x:r}=e,{shape:s}=n,a=J(r.shape),o=_1(s,a);return A(a===J(o),()=>"new shape: ".concat(o,", old shape: ").concat(r.shape,". New shape and old ")+"shape must have the same number of elements."),t.backend.incRef(r.dataId),{dataId:r.dataId,shape:o,dtype:r.dtype}}const JP={kernelName:Km,backendName:"wasm",kernelFunc:zn};/** 5912 * @license 5913 * Copyright 2019 Google LLC. All Rights Reserved. 5914 * Licensed under the Apache License, Version 2.0 (the "License"); 5915 * you may not use this file except in compliance with the License. 5916 * You may obtain a copy of the License at 5917 * 5918 * http://www.apache.org/licenses/LICENSE-2.0 5919 * 5920 * Unless required by applicable law or agreed to in writing, software 5921 * distributed under the License is distributed on an "AS IS" BASIS, 5922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5923 * See the License for the specific language governing permissions and 5924 * limitations under the License. 5925 * ============================================================================= 5926 */let lS;function QP(t){lS=t.wasm.cwrap(qu,null,["number","array","number","number","array","number","number","number","number"])}function ZP(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:a}=e,{transposeA:o,transposeB:i}=r;if(s.dtype!=="float32"||a.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");const l=s.shape.length,u=a.shape.length,c=o?s.shape[l-2]:s.shape[l-1],d=i?a.shape[u-1]:a.shape[u-2],f=o?s.shape[l-1]:s.shape[l-2],p=i?a.shape[u-2]:a.shape[u-1],h=s.shape.slice(0,-2),m=a.shape.slice(0,-2),g=J(h),v=J(m),w=Rt(s.shape.slice(0,-2),a.shape.slice(0,-2)).concat([f,p]);A(c===d,()=>"Error in matMul: inner shapes (".concat(c,") and (")+"".concat(d,") of Tensors with shapes ").concat(s.shape," and ")+"".concat(a.shape," and transposeA=").concat(o)+" and transposeB=".concat(i," must match."));const S=o?[g,c,f]:[g,f,c],I=i?[v,p,d]:[v,d,p],E=zn({inputs:{x:s},backend:n,attrs:{shape:S}}),T=zn({inputs:{x:a},backend:n,attrs:{shape:I}}),D=n.dataIdMap.get(E.dataId).id,R=n.dataIdMap.get(T.dataId).id,$=o?E.shape[2]:E.shape[1],M=i?T.shape[1]:T.shape[2],B=Math.max(g,v),z=n.makeOutput([B,$,M],E.dtype),H=n.dataIdMap.get(z.dataId).id,V=new Uint8Array(new Int32Array(E.shape).buffer),X=new Uint8Array(new Int32Array(T.shape).buffer);return lS(D,V,E.shape.length,R,X,T.shape.length,o,i,H),n.disposeData(E.dataId),n.disposeData(T.dataId),z.shape=w,z}const eB={kernelName:qu,backendName:"wasm",setupFunc:QP,kernelFunc:ZP};/** 5927 * @license 5928 * Copyright 2019 Google LLC. All Rights Reserved. 5929 * Licensed under the Apache License, Version 2.0 (the "License"); 5930 * you may not use this file except in compliance with the License. 5931 * You may obtain a copy of the License at 5932 * 5933 * http://www.apache.org/licenses/LICENSE-2.0 5934 * 5935 * Unless required by applicable law or agreed to in writing, software 5936 * distributed under the License is distributed on an "AS IS" BASIS, 5937 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5938 * See the License for the specific language governing permissions and 5939 * limitations under the License. 5940 * ============================================================================= 5941 */function _e(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>{n!=null&&A(n.dtype!=="complex64",()=>"".concat(e," does not support complex64 tensors in the CPU backend."))})}/** 5942 * @license 5943 * Copyright 2020 Google LLC. All Rights Reserved. 5944 * Licensed under the Apache License, Version 2.0 (the License);
5945 * you may not use this file except in compliance with the License. 5946 * You may obtain a copy of the License at 5947 * 5948 * http://www.apache.org/licenses/LICENSE-2.0 5949 * 5950 * Unless required by applicable law or agreed to in writing, software 5951 * distributed under the License is distributed on an AS IS BASIS, 5952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5953 * See the License for the specific language governing permissions and 5954 * limitations under the License. 5955 * ============================================================================= 5956 */function tB(t){const e=new Float32Array(t.length);for(let n=0;n<t.length;++n)e[n]=Math.abs(t[n]);return e}const nB=t=>{const{x:e}=t.inputs,n=t.backend;_e(e,"abs");let r=new Float32Array(J(e.shape));const s=n.data.get(e.dataId).values;return r=tB(s),n.makeOutput(r,e.shape,e.dtype)},rB={kernelName:Tm,backendName:"cpu",kernelFunc:nB};/** 5957 * @license 5958 * Copyright 2020 Google LLC. All Rights Reserved. 5959 * Licensed under the Apache License, Version 2.0 (the "License"); 5960 * you may not use this file except in compliance with the License. 5961 * You may obtain a copy of the License at 5962 * 5963 * http://www.apache.org/licenses/LICENSE-2.0 5964 * 5965 * Unless required by applicable law or agreed to in writing, software 5966 * distributed under the License is distributed on an "AS IS" BASIS, 5967 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5968 * See the License for the specific language governing permissions and 5969 * limitations under the License. 5970 * ============================================================================= 5971 */function Qt(t){return(e,n,r,s,a)=>{const o=Rt(e,n),i=o.length,l=Ie(o),u=J(o),c=$n(a,u),d=e.length,f=n.length,p=Ie(e),h=Ie(n),m=iu(e,o),g=iu(n,o);if(m.length+g.length===0)for(let v=0;v<c.length;++v)c[v]=t(r[v%r.length],s[v%s.length]);else for(let v=0;v<c.length;++v){const b=ii(v,i,l),w=b.slice(-d);m.forEach(T=>w[T]=0);const S=ts(w,d,p),I=b.slice(-f);g.forEach(T=>I[T]=0);const E=ts(I,f,h);c[v]=t(r[S],s[E])}return[c,o]}}/** 5972 * @license 5973 * Copyright 2020 Google LLC. All Rights Reserved. 5974 * Licensed under the Apache License, Version 2.0 (the "License"); 5975 * you may not use this file except in compliance with the License. 5976 * You may obtain a copy of the License at 5977 * 5978 * http://www.apache.org/licenses/LICENSE-2.0 5979 * 5980 * Unless required by applicable law or agreed to in writing, software 5981 * distributed under the License is distributed on an "AS IS" BASIS, 5982 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5983 * See the License for the specific language governing permissions and 5984 * limitations under the License. 5985 * ============================================================================= 5986 */function Qn(t){const{inputs:e,backend:n}=t,{real:r,imag:s}=e,a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,i=n.makeTensorInfo(r.shape,"complex64"),l=n.data.get(i.dataId);return l.complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",a),imag:n.makeTensorInfo(s.shape,"float32",o)},i}const sB={kernelName:A1,backendName:"cpu",kernelFunc:Qn};/** 5987 * @license 5988 * Copyright 2020 Google LLC. All Rights Reserved. 5989 * Licensed under the Apache License, Version 2.0 (the "License"); 5990 * you may not use this file except in compliance with the License. 5991 * You may obtain a copy of the License at 5992 * 5993 * http://www.apache.org/licenses/LICENSE-2.0 5994 * 5995 * Unless required by applicable law or agreed to in writing, software 5996 * distributed under the License is distributed on an "AS IS" BASIS, 5997 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5998 * See the License for the specific language governing permissions and 5999 * limitations under the License. 6000 * ============================================================================= 6001 */function gu(t,e,n="float32"){if(n==="complex64"){const s=gu(t,e,"float32"),a=gu(t,e,"float32");return Qn({inputs:{real:s,imag:a},backend:t})}const r=xn(J(e),n);return t.makeTensorInfo(e,n,r)}/** 6002 * @license 6003 * Copyright 2020 Google LLC. All Rights Reserved. 6004 * Licensed under the Apache License, Version 2.0 (the "License");
6005 * you may not use this file except in compliance with the License. 6006 * You may obtain a copy of the License at 6007 * 6008 * http://www.apache.org/licenses/LICENSE-2.0 6009 * 6010 * Unless required by applicable law or agreed to in writing, software 6011 * distributed under the License is distributed on an "AS IS" BASIS, 6012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6013 * See the License for the specific language governing permissions and 6014 * limitations under the License. 6015 * ============================================================================= 6016 */function ss(t){const{inputs:e,backend:n}=t,{x:r}=e;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}const aB={kernelName:_d,backendName:"cpu",kernelFunc:ss};/** 6017 * @license 6018 * Copyright 2020 Google LLC. All Rights Reserved. 6019 * Licensed under the Apache License, Version 2.0 (the "License"); 6020 * you may not use this file except in compliance with the License. 6021 * You may obtain a copy of the License at 6022 * 6023 * http://www.apache.org/licenses/LICENSE-2.0 6024 * 6025 * Unless required by applicable law or agreed to in writing, software 6026 * distributed under the License is distributed on an "AS IS" BASIS, 6027 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6028 * See the License for the specific language governing permissions and 6029 * limitations under the License. 6030 * ============================================================================= 6031 */function qa(t){const{inputs:e,backend:n}=t,{input:r}=e,s=n.data.get(r.dataId).complexTensorInfos.real,a=n.data.get(s.dataId).values;return n.makeTensorInfo(s.shape,s.dtype,a)}const oB={kernelName:j1,backendName:"cpu",kernelFunc:qa};/** 6032 * @license 6033 * Copyright 2020 Google LLC. All Rights Reserved. 6034 * Licensed under the Apache License, Version 2.0 (the "License"); 6035 * you may not use this file except in compliance with the License. 6036 * You may obtain a copy of the License at 6037 * 6038 * http://www.apache.org/licenses/LICENSE-2.0 6039 * 6040 * Unless required by applicable law or agreed to in writing, software 6041 * distributed under the License is distributed on an "AS IS" BASIS, 6042 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6043 * See the License for the specific language governing permissions and 6044 * limitations under the License. 6045 * ============================================================================= 6046 */function iB(t,e,n,r){if(r==="int32"){const s=Int32Array.from(t);return[e,"int32",s]}if(r==="bool"){const s=to([0],n),[a,o]=Qt((i,l)=>i!==l?1:0)(e,[],t,s,"bool");return[o,"bool",a]}throw new Error("Error in Cast: failed to cast ".concat(n," to ").concat(r))}function na(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{dtype:a}=r;if(a==="complex64"){if(s.dtype==="complex64")return ss({inputs:{x:s},backend:n});const c=gu(n,s.shape,s.dtype),d=na({inputs:{x:s},backend:n,attrs:{dtype:"float32"}}),f=Qn({inputs:{real:d,imag:c},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),f}if(s.dtype==="complex64"){const c=qa({inputs:{input:s},backend:n}),d=na({inputs:{x:c},backend:n,attrs:{dtype:a}});return n.disposeIntermediateTensorInfo(c),d}if(!zC(s.dtype,a)){const c=ss({inputs:{x:s},backend:n});return{dataId:c.dataId,shape:c.shape,dtype:a}}const o=n.data.get(s.dataId).values,[i,l,u]=iB(o,s.shape,s.dtype,a);return n.makeTensorInfo(i,l,u)}const cB={kernelName:Yu,backendName:"cpu",kernelFunc:na};/** 6047 * @license 6048 * Copyright 2020 Google LLC. All Rights Reserved. 6049 * Licensed under the Apache License, Version 2.0 (the "License"); 6050 * you may not use this file except in compliance with the License. 6051 * You may obtain a copy of the License at 6052 * 6053 * http://www.apache.org/licenses/LICENSE-2.0 6054 * 6055 * Unless required by applicable law or agreed to in writing, software 6056 * distributed under the License is distributed on an "AS IS" BASIS, 6057 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6058 * See the License for the specific language governing permissions and 6059 * limitations under the License. 6060 * ============================================================================= 6061 */function ln(t,e,n,r){return n==null?({inputs:s,backend:a})=>{const{a:o,b:i}=s,l=a;_e([o,i],t);const u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=o.dtype==="string"?Cc(u):u,f=o.dtype==="string"?Cc(c):c,p=r||o.dtype,[h,m]=e(o.shape,i.shape,d,f,p);return l.makeTensorInfo(m,p,h)}
vendor: 4,418 bytes, lines 6061-6109
6061:({inputs:s,backend:a})=>{const{a:o,b:i}=s,l=a;if(o.dtype==="complex64"||i.dtype==="complex64"){const u=na({inputs:{x:o},backend:l,attrs:{dtype:"complex64"}}),c=l.data.get(u.dataId),d=c.complexTensorInfos.real,f=c.complexTensorInfos.imag,p=l.data.get(d.dataId).values,h=l.data.get(f.dataId).values,m=na({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(m.dataId),v=g.complexTensorInfos.real,b=g.complexTensorInfos.imag,w=l.data.get(v.dataId).values,S=l.data.get(b.dataId).values,[I,E,T]=n(o.shape,i.shape,p,h,w,S),D=l.makeTensorInfo(T,"float32",I),R=l.makeTensorInfo(T,"float32",E),$=Qn({inputs:{real:D,imag:R},backend:l});return l.disposeIntermediateTensorInfo(u),l.disposeIntermediateTensorInfo(m),l.disposeIntermediateTensorInfo(D),l.disposeIntermediateTensorInfo(R),$}else{const u=l.data.get(o.dataId).values,c=l.data.get(i.dataId).values,d=r||o.dtype,[f,p]=e(o.shape,i.shape,u,c,d);return l.makeTensorInfo(p,d,f)}}}function Pg(t){return(e,n,r,s,a,o)=>{const i=Rt(e,n),l=J(i),u=i.length,c=Ie(i),d=$n("float32",l),f=$n("float32",l),p=iu(e,i),h=iu(n,i),m=Qo(r,s),g=Qo(a,o),v=e.length,b=Ie(e),w=n.length,S=Ie(n);if(p.length+h.length===0)for(let I=0;I<d.length;I++){const E=I%m.length,T=I%g.length,D=t(m[E*2],m[E*2+1],g[T*2],g[T*2+1]);d[I]=D.real,f[I]=D.imag}else for(let I=0;I<d.length;I++){const E=ii(I,u,c),T=E.slice(-v);p.forEach(B=>T[B]=0);const D=ts(T,v,b),R=E.slice(-w);h.forEach(B=>R[B]=0);const $=ts(R,w,S),M=t(m[D*2],m[D*2+1],g[$*2],g[$*2+1]);d[I]=M.real,f[I]=M.imag}return[d,f,i]}}/** 6062 * @license 6063 * Copyright 2020 Google LLC. All Rights Reserved. 6064 * Licensed under the Apache License, Version 2.0 (the "License"); 6065 * you may not use this file except in compliance with the License. 6066 * You may obtain a copy of the License at 6067 * 6068 * http://www.apache.org/licenses/LICENSE-2.0 6069 * 6070 * Unless required by applicable law or agreed to in writing, software 6071 * distributed under the License is distributed on an "AS IS" BASIS, 6072 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6073 * See the License for the specific language governing permissions and 6074 * limitations under the License. 6075 * ============================================================================= 6076 */const lB=Qt((t,e)=>t+e),uB=Pg((t,e,n,r)=>({real:t+n,imag:e+r})),Zo=ln(Bc,lB,uB),dB={kernelName:Bc,backendName:"cpu",kernelFunc:Zo};/** 6077 * @license 6078 * Copyright 2020 Google LLC. All Rights Reserved. 6079 * Licensed under the Apache License, Version 2.0 (the "License"); 6080 * you may not use this file except in compliance with the License. 6081 * You may obtain a copy of the License at 6082 * 6083 * http://www.apache.org/licenses/LICENSE-2.0 6084 * 6085 * Unless required by applicable law or agreed to in writing, software 6086 * distributed under the License is distributed on an "AS IS" BASIS, 6087 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6088 * See the License for the specific language governing permissions and 6089 * limitations under the License. 6090 * ============================================================================= 6091 */function uS(t,e,n,r,s){const a=J(r),o=xn(s,n);for(let i=0;i<t.length;i++){const l=t[i];if(l<0)throw new Error("Input x must be non-negative!");l>=s||(a>0?o[l]+=e[i]:o[l]+=1)}return o}function fB(t,e,n,r=!1){const s=t.shape[0],a=t.shape[1],o=rt([s,n],e.dtype);for(let i=0;i<s;i++)for(let l=0;l<a;l++){const u=t.get(i,l);if(u<0)throw new Error("Input x must be non-negative!");u>=n||(r?o.set(1,i,u):e.size>0?o.set(o.get(i,u)+e.get(i,l),i,u):o.set(o.get(i,u)+1,i,u))}return o}/** 6092 * @license 6093 * Copyright 2023 Google LLC. 6094 * Licensed under the Apache License, Version 2.0 (the "License"); 6095 * you may not use this file except in compliance with the License. 6096 * You may obtain a copy of the License at 6097 * 6098 * http://www.apache.org/licenses/LICENSE-2.0 6099 * 6100 * Unless required by applicable law or agreed to in writing, software 6101 * distributed under the License is distributed on an "AS IS" BASIS, 6102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6103 * See the License for the specific language governing permissions and 6104 * limitations under the License. 6105 * ============================================================================= 6106 */const pB=Qt((t,e)=>t&e),hB=ln(Xu,pB),mB={kernelName:Xu,backendName:"cpu",kernelFunc:hB};/** 6107 * @license 6108 * Copyright 2020 Google LLC. All Rights Reserved. 6109 * Licensed under the Apache License, Version 2.0 (the "License");
6110 * you may not use this file except in compliance with the License. 6111 * You may obtain a copy of the License at 6112 * 6113 * http://www.apache.org/licenses/LICENSE-2.0 6114 * 6115 * Unless required by applicable law or agreed to in writing, software 6116 * distributed under the License is distributed on an "AS IS" BASIS, 6117 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6118 * See the License for the specific language governing permissions and 6119 * limitations under the License. 6120 * ============================================================================= 6121 */function la(t){return(e,n,r)=>{const s=tn(n,e.length);for(let a=0;a<e.length;++a)s[a]=t(e[a],r);return s}}/** 6122 * @license 6123 * Copyright 2020 Google LLC. All Rights Reserved. 6124 * Licensed under the Apache License, Version 2.0 (the "License"); 6125 * you may not use this file except in compliance with the License. 6126 * You may obtain a copy of the License at 6127 * 6128 * http://www.apache.org/licenses/LICENSE-2.0 6129 * 6130 * Unless required by applicable law or agreed to in writing, software 6131 * distributed under the License is distributed on an "AS IS" BASIS, 6132 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6133 * See the License for the specific language governing permissions and 6134 * limitations under the License. 6135 * ============================================================================= 6136 */function mt(t,e,n){const r=la(e);return ua(t,r,n)}function ua(t,e,n){return({inputs:r,attrs:s,backend:a})=>{const{x:o}=r;_e(o,t);const i=a,l=i.data.get(o.dataId).values;let u;if(o.dtype==="string"){if(!Array.isArray(l))throw new Error("String tensor's value was not an instance of Array");u=Cc(l)}else u=l;const c=n||o.dtype,d=e(u,c,s);return i.makeTensorInfo(o.shape,c,d)}}/** 6137 * @license 6138 * Copyright 2020 Google LLC. All Rights Reserved. 6139 * Licensed under the Apache License, Version 2.0 (the License); 6140 * you may not use this file except in compliance with the License. 6141 * You may obtain a copy of the License at 6142 * 6143 * http://www.apache.org/licenses/LICENSE-2.0 6144 * 6145 * Unless required by applicable law or agreed to in writing, software 6146 * distributed under the License is distributed on an AS IS BASIS, 6147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6148 * See the License for the specific language governing permissions and 6149 * limitations under the License. 6150 * ============================================================================= 6151 */const gB=la(t=>Math.ceil(t)),yB=ua(Ju,gB),vB={kernelName:Ju,backendName:"cpu",kernelFunc:yB};/** 6152 * @license 6153 * Copyright 2020 Google LLC. All Rights Reserved. 6154 * Licensed under the Apache License, Version 2.0 (the "License"); 6155 * you may not use this file except in compliance with the License. 6156 * You may obtain a copy of the License at 6157 * 6158 * http://www.apache.org/licenses/LICENSE-2.0 6159 * 6160 * Unless required by applicable law or agreed to in writing, software 6161 * distributed under the License is distributed on an "AS IS" BASIS, 6162 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6163 * See the License for the specific language governing permissions and 6164 * limitations under the License. 6165 * ============================================================================= 6166 */function dS(t,e,n,r){const s=tn(n,J(e));if(r&&n!=="string"){let a=0;t.forEach(o=>{const i=J(o.shape);s.set(o.vals,a),a+=i})}else{let a=0;t.forEach(o=>{const i=n==="string"?Cc(o.vals):o.vals;let l=0;for(let u=0;u<o.shape[0];++u){const c=u*e[1]+a;for(let d=0;d<o.shape[1];++d)s[c+d]=i[l++]}a+=o.shape[1]})}return s}/** 6167 * @license 6168 * Copyright 2020 Google LLC. All Rights Reserved. 6169 * Licensed under the Apache License, Version 2.0 (the "License"); 6170 * you may not use this file except in compliance with the License. 6171 * You may obtain a copy of the License at 6172 * 6173 * http://www.apache.org/licenses/LICENSE-2.0 6174 * 6175 * Unless required by applicable law or agreed to in writing, software 6176 * distributed under the License is distributed on an "AS IS" BASIS, 6177 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6178 * See the License for the specific language governing permissions and 6179 * limitations under the License. 6180 * ============================================================================= 6181 */const bB=Qt((t,e)=>t===e?1:0),fS=ln(pd,bB,null,"bool"),wB={kernelName:pd,backendName:"cpu",kernelFunc:fS};/** 6182 * @license 6183 * Copyright 2020 Google LLC. All Rights Reserved. 6184 * Licensed under the Apache License, Version 2.0 (the License);
6185 * you may not use this file except in compliance with the License. 6186 * You may obtain a copy of the License at 6187 * 6188 * http://www.apache.org/licenses/LICENSE-2.0 6189 * 6190 * Unless required by applicable law or agreed to in writing, software 6191 * distributed under the License is distributed on an AS IS BASIS, 6192 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6193 * See the License for the specific language governing permissions and 6194 * limitations under the License. 6195 * ============================================================================= 6196 */const SB=la(t=>Math.exp(t)),pS=ua(hd,SB,"float32"),xB={kernelName:hd,backendName:"cpu",kernelFunc:pS};/** 6197 * @license 6198 * Copyright 2020 Google LLC. All Rights Reserved. 6199 * Licensed under the Apache License, Version 2.0 (the License); 6200 * you may not use this file except in compliance with the License. 6201 * You may obtain a copy of the License at 6202 * 6203 * http://www.apache.org/licenses/LICENSE-2.0 6204 * 6205 * Unless required by applicable law or agreed to in writing, software 6206 * distributed under the License is distributed on an AS IS BASIS, 6207 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6208 * See the License for the specific language governing permissions and 6209 * limitations under the License. 6210 * ============================================================================= 6211 */const _B=la(t=>Math.expm1(t)),IB=ua(md,_B),kB={kernelName:md,backendName:"cpu",kernelFunc:IB};/** 6212 * @license 6213 * Copyright 2020 Google LLC. All Rights Reserved. 6214 * Licensed under the Apache License, Version 2.0 (the License); 6215 * you may not use this file except in compliance with the License. 6216 * You may obtain a copy of the License at 6217 * 6218 * http://www.apache.org/licenses/LICENSE-2.0 6219 * 6220 * Unless required by applicable law or agreed to in writing, software 6221 * distributed under the License is distributed on an AS IS BASIS, 6222 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6223 * See the License for the specific language governing permissions and 6224 * limitations under the License. 6225 * ============================================================================= 6226 */const EB=la(t=>Math.floor(t)),TB=ua(yd,EB),CB={kernelName:yd,backendName:"cpu",kernelFunc:TB};/** 6227 * @license 6228 * Copyright 2020 Google LLC. All Rights Reserved. 6229 * Licensed under the Apache License, Version 2.0 (the "License"); 6230 * you may not use this file except in compliance with the License. 6231 * You may obtain a copy of the License at 6232 * 6233 * http://www.apache.org/licenses/LICENSE-2.0 6234 * 6235 * Unless required by applicable law or agreed to in writing, software 6236 * distributed under the License is distributed on an "AS IS" BASIS, 6237 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6238 * See the License for the specific language governing permissions and 6239 * limitations under the License. 6240 * ============================================================================= 6241 */const NB=Qt((t,e)=>Math.floor(t/e)),AB=ln(vd,NB,null,"int32"),$B={kernelName:vd,backendName:"cpu",kernelFunc:AB};/** 6242 * @license 6243 * Copyright 2021 Google LLC. All Rights Reserved. 6244 * Licensed under the Apache License, Version 2.0 (the "License"); 6245 * you may not use this file except in compliance with the License. 6246 * You may obtain a copy of the License at 6247 * 6248 * http://www.apache.org/licenses/LICENSE-2.0 6249 * 6250 * Unless required by applicable law or agreed to in writing, software 6251 * distributed under the License is distributed on an "AS IS" BASIS, 6252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6253 * See the License for the specific language governing permissions and 6254 * limitations under the License. 6255 * ============================================================================= 6256 */function RB(t,e,n,r,s,a,o,i,l){const u=rt([r,a],n);for(let c=0;c<r;c++){const d=[];let f=0;for(let p=0;p<s;p++){const h=t[c*s+p];f+=h*o[p],d.push(h)}if(f<0||f>=l/a)throw new Error("Invalid indices: ".concat(d," does not index into ").concat(i));for(let p=0;p<a;p++)u.values[c*a+p]=e.get(...e.indexToLoc(f*a+p))}return u}/** 6257 * @license 6258 * Copyright 2020 Google LLC. All Rights Reserved. 6259 * Licensed under the Apache License, Version 2.0 (the "License");
6260 * you may not use this file except in compliance with the License. 6261 * You may obtain a copy of the License at 6262 * 6263 * http://www.apache.org/licenses/LICENSE-2.0 6264 * 6265 * Unless required by applicable law or agreed to in writing, software 6266 * distributed under the License is distributed on an "AS IS" BASIS, 6267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6268 * See the License for the specific language governing permissions and 6269 * limitations under the License. 6270 * ============================================================================= 6271 */function DB(t,e,n){const r=rt(n,t.dtype);for(let s=0;s<r.size;++s){const o=r.indexToLoc(s).slice(),i=o[0],l=o[2],u=e.locToIndex([i,l]);o[2]=e.values[u];const c=t.locToIndex(o);0<=c&&c<t.values.length&&(r.values[s]=t.values[c])}return r}/** 6272 * @license 6273 * Copyright 2020 Google LLC. All Rights Reserved. 6274 * Licensed under the Apache License, Version 2.0 (the "License"); 6275 * you may not use this file except in compliance with the License. 6276 * You may obtain a copy of the License at 6277 * 6278 * http://www.apache.org/licenses/LICENSE-2.0 6279 * 6280 * Unless required by applicable law or agreed to in writing, software 6281 * distributed under the License is distributed on an "AS IS" BASIS, 6282 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6283 * See the License for the specific language governing permissions and 6284 * limitations under the License. 6285 * ============================================================================= 6286 */const FB=Qt((t,e)=>t>e?1:0),MB=ln(Sd,FB,null,"bool"),OB={kernelName:Sd,backendName:"cpu",kernelFunc:MB};/** 6287 * @license 6288 * Copyright 2020 Google LLC. All Rights Reserved. 6289 * Licensed under the Apache License, Version 2.0 (the "License"); 6290 * you may not use this file except in compliance with the License. 6291 * You may obtain a copy of the License at 6292 * 6293 * http://www.apache.org/licenses/LICENSE-2.0 6294 * 6295 * Unless required by applicable law or agreed to in writing, software 6296 * distributed under the License is distributed on an "AS IS" BASIS, 6297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6298 * See the License for the specific language governing permissions and 6299 * limitations under the License. 6300 * ============================================================================= 6301 */const PB=Qt((t,e)=>t>=e?1:0),BB=ln(xd,PB,null,"bool"),LB={kernelName:xd,backendName:"cpu",kernelFunc:BB};/** 6302 * @license 6303 * Copyright 2020 Google LLC. All Rights Reserved. 6304 * Licensed under the Apache License, Version 2.0 (the "License"); 6305 * you may not use this file except in compliance with the License. 6306 * You may obtain a copy of the License at 6307 * 6308 * http://www.apache.org/licenses/LICENSE-2.0 6309 * 6310 * Unless required by applicable law or agreed to in writing, software 6311 * distributed under the License is distributed on an "AS IS" BASIS, 6312 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6313 * See the License for the specific language governing permissions and 6314 * limitations under the License. 6315 * ============================================================================= 6316 */const WB=Qt((t,e)=>t<e?1:0),zB=ln(Cd,WB,null,"bool"),HB={kernelName:Cd,backendName:"cpu",kernelFunc:zB};/** 6317 * @license 6318 * Copyright 2020 Google LLC. All Rights Reserved. 6319 * Licensed under the Apache License, Version 2.0 (the "License"); 6320 * you may not use this file except in compliance with the License. 6321 * You may obtain a copy of the License at 6322 * 6323 * http://www.apache.org/licenses/LICENSE-2.0 6324 * 6325 * Unless required by applicable law or agreed to in writing, software 6326 * distributed under the License is distributed on an "AS IS" BASIS, 6327 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6328 * See the License for the specific language governing permissions and 6329 * limitations under the License. 6330 * ============================================================================= 6331 */const UB=Qt((t,e)=>t<=e?1:0),VB=ln(Nd,UB,null,"bool"),jB={kernelName:Nd,backendName:"cpu",kernelFunc:VB};/** 6332 * @license 6333 * Copyright 2020 Google LLC. All Rights Reserved. 6334 * Licensed under the Apache License, Version 2.0 (the "License");
6335 * you may not use this file except in compliance with the License. 6336 * You may obtain a copy of the License at 6337 * 6338 * http://www.apache.org/licenses/LICENSE-2.0 6339 * 6340 * Unless required by applicable law or agreed to in writing, software 6341 * distributed under the License is distributed on an "AS IS" BASIS, 6342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6343 * See the License for the specific language governing permissions and 6344 * limitations under the License. 6345 * ============================================================================= 6346 */function GB(t,e,n){const r=(e-t)/(n-1),s=xn(n,"float32");s[0]=t;for(let a=1;a<s.length;a++)s[a]=s[a-1]+r;return s}/** 6347 * @license 6348 * Copyright 2020 Google LLC. All Rights Reserved. 6349 * Licensed under the Apache License, Version 2.0 (the License); 6350 * you may not use this file except in compliance with the License. 6351 * You may obtain a copy of the License at 6352 * 6353 * http://www.apache.org/licenses/LICENSE-2.0 6354 * 6355 * Unless required by applicable law or agreed to in writing, software 6356 * distributed under the License is distributed on an AS IS BASIS, 6357 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6358 * See the License for the specific language governing permissions and 6359 * limitations under the License. 6360 * ============================================================================= 6361 */const qB=la(t=>Math.log(t)),KB=ua($d,qB),XB={kernelName:$d,backendName:"cpu",kernelFunc:KB};/** 6362 * @license 6363 * Copyright 2020 Google LLC. All Rights Reserved. 6364 * Licensed under the Apache License, Version 2.0 (the "License"); 6365 * you may not use this file except in compliance with the License. 6366 * You may obtain a copy of the License at 6367 * 6368 * http://www.apache.org/licenses/LICENSE-2.0 6369 * 6370 * Unless required by applicable law or agreed to in writing, software 6371 * distributed under the License is distributed on an "AS IS" BASIS, 6372 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6373 * See the License for the specific language governing permissions and 6374 * limitations under the License. 6375 * ============================================================================= 6376 */function YB(t,e,n,r){const s=$n(r,J(n));for(let a=0;a<s.length;++a){const o=a*e;let i=t[o];for(let l=0;l<e;++l){const u=t[o+l];(Number.isNaN(u)||u>i)&&(i=u)}s[a]=i}return s}/** 6377 * @license 6378 * Copyright 2020 Google LLC. All Rights Reserved. 6379 * Licensed under the Apache License, Version 2.0 (the "License"); 6380 * you may not use this file except in compliance with the License. 6381 * You may obtain a copy of the License at 6382 * 6383 * http://www.apache.org/licenses/LICENSE-2.0 6384 * 6385 * Unless required by applicable law or agreed to in writing, software 6386 * distributed under the License is distributed on an "AS IS" BASIS, 6387 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6388 * See the License for the specific language governing permissions and 6389 * limitations under the License. 6390 * ============================================================================= 6391 */const JB=Qt((t,e)=>Math.max(t,e)),QB=ln(Bd,JB),ZB={kernelName:Bd,backendName:"cpu",kernelFunc:QB};/** 6392 * @license 6393 * Copyright 2020 Google LLC. All Rights Reserved. 6394 * Licensed under the Apache License, Version 2.0 (the "License"); 6395 * you may not use this file except in compliance with the License. 6396 * You may obtain a copy of the License at 6397 * 6398 * http://www.apache.org/licenses/LICENSE-2.0 6399 * 6400 * Unless required by applicable law or agreed to in writing, software 6401 * distributed under the License is distributed on an "AS IS" BASIS, 6402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6403 * See the License for the specific language governing permissions and 6404 * limitations under the License. 6405 * ============================================================================= 6406 */const e7=Qt((t,e)=>Math.min(t,e)),t7=ln(Hd,e7),n7={kernelName:Hd,backendName:"cpu",kernelFunc:t7};/** 6407 * @license 6408 * Copyright 2020 Google LLC. All Rights Reserved. 6409 * Licensed under the Apache License, Version 2.0 (the "License"); 6410 * you may not use this file except in compliance with the License. 6411 * You may obtain a copy of the License at 6412 * 6413 * http://www.apache.org/licenses/LICENSE-2.0 6414 * 6415 * Unless required by applicable law or agreed to in writing, softw
6415are 6416 * distributed under the License is distributed on an "AS IS" BASIS, 6417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6418 * See the License for the specific language governing permissions and 6419 * limitations under the License. 6420 * ============================================================================= 6421 */const hS=Qt((t,e)=>t*e),r7=Pg((t,e,n,r)=>({real:t*n-e*r,imag:t*r+e*n})),qf=ln(Gd,hS,r7),s7={kernelName:Gd,backendName:"cpu",kernelFunc:qf};/** 6422 * @license 6423 * Copyright 2020 Google LLC. All Rights Reserved. 6424 * Licensed under the Apache License, Version 2.0 (the "License"); 6425 * you may not use this file except in compliance with the License. 6426 * You may obtain a copy of the License at 6427 * 6428 * http://www.apache.org/licenses/LICENSE-2.0 6429 * 6430 * Unless required by applicable law or agreed to in writing, software 6431 * distributed under the License is distributed on an "AS IS" BASIS, 6432 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6433 * See the License for the specific language governing permissions and 6434 * limitations under the License. 6435 * ============================================================================= 6436 */function a7(t,e,n){const r=fg(-1,n);return hS([],e,r,t,n)}function o7(t){const{inputs:e,backend:n}=t,{x:r}=e;_e(r,"neg");const s=n.data.get(r.dataId).values,[a,o]=a7(s,r.shape,r.dtype);return n.makeTensorInfo(o,r.dtype,a)}const i7={kernelName:Vm,backendName:"cpu",kernelFunc:o7};/** 6437 * @license 6438 * Copyright 2020 Google LLC. All Rights Reserved. 6439 * Licensed under the Apache License, Version 2.0 (the "License"); 6440 * you may not use this file except in compliance with the License. 6441 * You may obtain a copy of the License at 6442 * 6443 * http://www.apache.org/licenses/LICENSE-2.0 6444 * 6445 * Unless required by applicable law or agreed to in writing, software 6446 * distributed under the License is distributed on an "AS IS" BASIS, 6447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6448 * See the License for the specific language governing permissions and 6449 * limitations under the License. 6450 * ============================================================================= 6451 */const c7=Qt((t,e)=>t!==e?1:0),l7=ln(qd,c7,null,"bool"),u7={kernelName:qd,backendName:"cpu",kernelFunc:l7};/** 6452 * @license 6453 * Copyright 2020 Google LLC. All Rights Reserved. 6454 * Licensed under the Apache License, Version 2.0 (the "License"); 6455 * you may not use this file except in compliance with the License. 6456 * You may obtain a copy of the License at 6457 * 6458 * http://www.apache.org/licenses/LICENSE-2.0 6459 * 6460 * Unless required by applicable law or agreed to in writing, software 6461 * distributed under the License is distributed on an "AS IS" BASIS, 6462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6463 * See the License for the specific language governing permissions and 6464 * limitations under the License. 6465 * ============================================================================= 6466 */function mS(t,e,n,r,s){const a=e.length,o=J(e),i=Ie(e),l=Ie(s),u=$n(n,J(s));for(let c=0;c<o;++c){const d=ii(c,a,i),f=new Array(d.length);for(let h=0;h<f.length;h++)f[h]=d[r[h]];const p=ts(f,a,l);u[p]=t[c]}return u}/** 6467 * @license 6468 * Copyright 2020 Google LLC. All Rights Reserved. 6469 * Licensed under the Apache License, Version 2.0 (the "License"); 6470 * you may not use this file except in compliance with the License. 6471 * You may obtain a copy of the License at 6472 * 6473 * http://www.apache.org/licenses/LICENSE-2.0 6474 * 6475 * Unless required by applicable law or agreed to in writing, software 6476 * distributed under the License is distributed on an "AS IS" BASIS, 6477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6478 * See the License for the specific language governing permissions and 6479 * limitations under the License. 6480 * ============================================================================= 6481 */function Un(t){const{inputs:e,attrs:n,backend:r}=t,{x:s}=e,{perm:a}=n;_e(s,"transpose");const o=s.shape.length,i=new Array(o);for(let d=0;d<i.length;d++)i[d]=s.shape[a[d]];const l=r.data.get(s.dataId).values,u=mS(l,s.shape,s.dtype,a,i);return{dataId:r.write(u,i,s.dtype),shape:i,dtype:s.dtype}}const d7={kernelName:Lo,backendName:"cpu",kernelFunc:Un};/** 6482 * @license 6483 * Copyright 2020 Google LLC. All Rights Reserved. 6484 * Licensed under the Apache License, Version 2.0 (the "License");
6485 * you may not use this file except in compliance with the License. 6486 * You may obtain a copy of the License at 6487 * 6488 * http://www.apache.org/licenses/LICENSE-2.0 6489 * 6490 * Unless required by applicable law or agreed to in writing, software 6491 * distributed under the License is distributed on an "AS IS" BASIS, 6492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6493 * See the License for the specific language governing permissions and 6494 * limitations under the License. 6495 * ============================================================================= 6496 */function f7(t,e,n,r){const[s,a]=Rn(t,r),o=ci(e,"int32"),i=xn(J(s),o),l=J(a);for(let u=0;u<i.length;++u){const c=u*l;let d=1;for(let f=0;f<l;++f)d*=n[c+f];i[u]=d}return{outVals:i,outShape:s,outDtype:o}}function p7(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r;_e(s,"prod");const i=s.shape.length,l=Vt(a,s.shape),u=fr(l,i);let c=l,d=s;const f=[];u!=null&&(d=Un({inputs:{x:s},backend:n,attrs:{perm:u}}),f.push(d),c=Fn(c.length,i));const p=n.data.get(d.dataId).values,{outVals:h,outShape:m,outDtype:g}=f7(d.shape,d.dtype,p,c);let v=m;return o&&(v=gn(m,l)),f.forEach(b=>n.disposeIntermediateTensorInfo(b)),n.makeTensorInfo(v,g,h)}const h7={kernelName:tf,backendName:"cpu",kernelFunc:p7};/** 6497 * @license 6498 * Copyright 2022 Google LLC. All Rights Reserved. 6499 * Licensed under the Apache License, Version 2.0 (the "License"); 6500 * you may not use this file except in compliance with the License. 6501 * You may obtain a copy of the License at 6502 * 6503 * http://www.apache.org/licenses/LICENSE-2.0 6504 * 6505 * Unless required by applicable law or agreed to in writing, software 6506 * distributed under the License is distributed on an "AS IS" BASIS, 6507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6508 * See the License for the specific language governing permissions and 6509 * limitations under the License. 6510 * ============================================================================= 6511 */function m7(t,e,n){t.forEach((r,s)=>{if(r<0||r>=n){const a=ii(s,e.length,Ie(e)).join(",");throw new Error("indices[".concat(a,"] = ").concat(r," is not in [0, ").concat(n,")"))}})}function g7(t,e){for(let n=0;n<t.length;++n){const r=t[n],s=n===t.length-1?e:t[n+1].length;if(r.length===0)throw new Error("Ragged splits may not be empty");if(r[0]<0)throw new Error("Ragged splits must be non-negative");if(r[r.length-1]>s)throw new Error("Ragged splits must not point past values");for(let a=1;a<r.length;++a)if(r[a-1]>r[a])throw new Error("Ragged splits must be sorted in ascending order")}}function y7(t,e,n,r){const s=[];let a=0;const o=e.length-1+n.length,i=new Array(o).fill(null).map(()=>[0]);g7(n,r);let l=1;for(let u=0;u<e.length-1;++u){l*=e[u];const c=e[u+1];for(let d=1;d<l+1;++d)i[u].push(d*c)}for(let u=0;u<t.length;++u){let c=t[u],d=t[u]+1;for(let f=0;f<n.length;++f){const p=n[f],h=f+e.length-1;if(h>=0){const m=i[h],g=m[m.length-1]-p[c];for(let v=c;v<d;++v)i[h].push(p[v+1]+g)}c=p[c],d=p[d]}d!==c&&(s.push([c,d]),a+=d-c)}return{outSplits:i,valueSlices:s,numValues:a}}function v7(t){const e=[];for(let n=0;n<t.length;++n){const r=t[n].length,s=tn("int32",r);e.push(s),t[n].forEach((a,o)=>s[o]=a)}return e}function Kv(t,e){const n=t.slice(0,e);for(;n.length<e;)n.push(1);for(let r=e;r<t.length;r++)n[e-1]*=t[r];return n}function b7(t,e,n,r,s,a){const o=Kv(e,2)[1],i=Kv(a,2)[1];let l=0;for(const u of n)for(let c=u[0];c<u[1];++c){for(let d=0;d<r;++d)s[l*i+d]=t[c*o+d];++l}}function w7(t,e,n,r,s){const a=e.slice();a[0]=s;const o=tn(n,J(a)),i=t.length,l=i===0?0:i/e[0];return b7(t,e,r,l,o,a),[o,a]}function S7(t,e,n,r,s,a,o,i){if(t.length===0)throw new Error("paramsNestedSplits must be non empty");if(e[0].length===0)throw new Error("Split tensors must not be scalars");const l=e[0][0]-1;if(m7(a,o,l),r.length===0)throw new Error("params.rank must be nonzero");const u=r[0],{outSplits:c,valueSlices:d,numValues:f}=y7(a,o,t,u),p=v7(c),h=w7(n,r,s,d,f);return[p,h[0],h[1]]}/** 6512 * @license 6513 * Copyright 2022 Google LLC. 6514 * Licensed under the Apache License, Version 2.0 (the "License"); 6515 * you may not use this file except in compliance with the License. 6516 * You may obtain a copy of the License at 6517 * 6518 * http://www.apache.org/licenses/LICENSE-2.0 6519 * 6520 * Unless required by applicable law or agreed to in writing, softw
6520are 6521 * distributed under the License is distributed on an "AS IS" BASIS, 6522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6523 * See the License for the specific language governing permissions and 6524 * limitations under the License. 6525 * ============================================================================= 6526 */const Xv=2147483647;function x7(t,e,n,r,s,a,o){if(e.length>1)throw new Error("starts must be a scalar or vector");if(s.length>1)throw new Error("limits must be a scalar or vector");if(o.length>1)throw new Error("deltas must be a scalar or vector");const i=e.length===0,l=s.length===0,u=o.length===0,c=[];i||c.push(e[0]),l||c.push(s[0]),u||c.push(o[0]);for(let g=1;g<c.length;++g)if(c[g]!==c[g-1])throw new Error("starts, limits, and deltas must have the same shape");const d=c.length===0?1:c[0],f=tn("int32",d+1);f[0]=0;for(let g=0;g<d;++g){const v=i?t[0]:t[g],b=l?r[0]:r[g],w=u?a[0]:a[g];if(w===0)throw new Error("Requires delta != 0");let S;if(w>0&&b<v||w<0&&b>v)S=0;else if(S=Math.ceil(Math.abs((b-v)/w)),S>Xv)throw new Error("Requires ((limit - start) / delta) <= ".concat(Xv));f[g+1]=f[g]+S}const p=f[d],h=tn(n,p);let m=0;for(let g=0;g<d;++g){const v=f[g+1]-f[g];let b=i?t[0]:t[g];const w=u?a[0]:a[g];for(let S=0;S<v;++S)h[m++]=b,b+=w}return[f,h]}/** 6527 * @license 6528 * Copyright 2022 Google LLC. All Rights Reserved. 6529 * Licensed under the Apache License, Version 2.0 (the "License"); 6530 * you may not use this file except in compliance with the License. 6531 * You may obtain a copy of the License at 6532 * 6533 * http://www.apache.org/licenses/LICENSE-2.0 6534 * 6535 * Unless required by applicable law or agreed to in writing, software 6536 * distributed under the License is distributed on an "AS IS" BASIS, 6537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6538 * See the License for the specific language governing permissions and 6539 * limitations under the License. 6540 * ============================================================================= 6541 */var mr=Xr;class yu{constructor(e,n,r,s,a,o,i,l,u,c){this.shape=e,this.shapeShape=n,this.values=r,this.valuesShape=s,this.valuesDType=a,this.defaultValue=o,this.defaultValueShape=i,this.rowPartitionValues=l,this.rowPartitionValuesShapes=u,this.rowPartitionTypes=H6(c),this.raggedRank=U6(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===mr.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===mr.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const n=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case mr.VALUE_ROWIDS:return yu.getMaxWidthValueRowID(n);case mr.ROW_SPLITS:return yu.getMaxWidthRowSplit(n);default:throw new Error("Cannot handle partition type ".concat(mr[this.getRowPartitionTypeByDimension(e-1)]))}}static getMaxWidthRowSplit(e){const n=e.length;if(n===0||n===1)return 0;let r=0;for(let s=0;s<n-1;++s){const a=e[s+1]-e[s];a>r&&(r=a)}return r}static getMaxWidthValueRowID(e){const n=e.length;if(n===0)return 0;let r=0,s=e[0],a=0;for(let o=1;o<n;++o){const i=e[o];i!==s&&(s=i,a=Math.max(o-r,a),r=o)}return Math.max(n-r,a)}tensorShapeFromTensor(e,n,r=!0){if(n.length===0){if(e[0]===-1)return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return Jv(e,r)}calculateOutputSize(e){const n=this.valuesShape,r=this.defaultValueShape;V6(r,n);const s=this.tensorShapeFromTensor(this.shape,this.shapeShape),o=z6(this.raggedRank,s,n);o[0]<0&&(o[0]=e);for(let i=1;i<=this.raggedRank;++i)o[i]<0&&(o[i]=this.getMaxWidth(i));return o}calculateFirstParentOutputIndex(e,n,r){const s=Math.min(e,r),a=[];let o=0;for(let i=0;i<s;++i,o+=n)a.push(o);for(let i=s;i<e;++i)a.push(-1);return A(a.length===e,()=>"Final length of result must be equal to firstDimension."),a}calculateOutputIndexRowSplit(e,n,r,s){const a=e.length,o=[];for(let i=0;i<a-1;++i){const l=e[i+1]-e[i];let u=Math.min(s,l),c=n[i];c===-1&&(u=0);for(let d=0;d<u;++d)o.push(c),c+=r;for(let d=0;d<l-u;++d)o.push(-1)}if(a>0&&o.length!==e[a-1])throw new Error("Invalid row split size.");return o}
vendor: 4,175 bytes, lines 6541-6565
6541calculateOutputIndexValueRowID(e,n,r,s){const a=e.length,o=[];if(a===0)return[];let i=0,l=e[0];if(l>=n.length)throw new Error("Got currentValueRowId=".concat(l,", which is not less than ").concat(n.length));let u=n[l];o.push(u);for(let c=1;c<a;++c){const d=e[c];if(d===l)u>=0&&(++i,i<s?u+=r:u=-1);else{if(i=0,l=d,d>=n.length)throw new Error("Got nextValueRowId=".concat(d," which is not less than ").concat(n.length));u=n[d]}o.push(u)}if(o.length!==e.length)throw new Error("Invalid row ids.");return o}calculateOutputIndex(e,n,r,s){const a=this.getRowPartitionTensor(e),o=this.getRowPartitionTypeByDimension(e);switch(o){case mr.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,n,r,s);case mr.ROW_SPLITS:if(a.length-1>n.length)throw new Error("Row partition size is greater than output size: ".concat(a.length-1," > ").concat(n.length));return this.calculateOutputIndexRowSplit(a,n,r,s);default:throw new Error("Unsupported partition type: ".concat(mr[o]))}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");const n=this.rowPartitionTypes[0];switch(n){case mr.FIRST_DIM_SIZE:return e[0];case mr.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case mr.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error("Cannot handle type ".concat(mr[n]))}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const n=this.getFirstDimensionSize(),r=this.calculateOutputSize(n),s=new Array(this.raggedRank+1);s[s.length-1]=1;for(let l=s.length-2;l>=0;--l)s[l]=s[l+1]*r[l+1];const a=Jv(r,!1),o=tn(this.valuesDType,J(a));if(s[0]*r[0]>0){let l=this.calculateFirstParentOutputIndex(n,s[0],r[0]);for(let u=1;u<=this.raggedRank;++u)l=this.calculateOutputIndex(u-1,l,s[u],r[u]);this.setOutput(this.raggedRank,l,o,a)}return[a,o]}setOutput(e,n,r,s){if(r.length===0)return;const a=this.values,o=r;let i=s.slice();i=i.slice(e+1);const l=J(i),u=n.length;let c=this.defaultValue;if(c.length!==l&&c.length!==1){const h=this.defaultValueShape;nt(()=>{const m=re(c,h);c=Zi(m,i).dataSync()})}let d=0,f=0,p=0;for(let h=0;h<=u;++h){let m=h<u?n[h]:-1;if(m===p){++p;continue}if(f<p){const g=a.subarray(d*l),v=o.subarray(f*l),b=(p-f)*l;Yv(v,g,b)}if(h>=u){const g=r.length;m=Math.floor(g/l)}if(m>p)if(this.defaultValue.length===1)o.subarray(p*l,m*l).fill(this.defaultValue[0]),p=m;else for(;m>p;){const g=o.slice(p*l);Yv(g,c,l),++p}m<0?(d=h+1,f=p):(d=h,f=p,p=f+1)}}}function Yv(t,e,n){for(let r=0;r<n;r++)t[r]=e[r]}function Jv(t,e){const n=[];for(let r of t){if(r<0){if(!e)throw new Error("Dimension ".concat(r," must be >= 0"));if(r<-1)throw new Error("Dimension ".concat(r," must be >= -1"));r=-1}n.push(r)}return n}function _7(t,e,n,r,s,a,o,i,l,u){return new yu(t,e,n,r,s,a,o,i,l,u).compute()}/** 6542 * @license 6543 * Copyright 2020 Google LLC. All Rights Reserved. 6544 * Licensed under the Apache License, Version 2.0 (the "License"); 6545 * you may not use this file except in compliance with the License. 6546 * You may obtain a copy of the License at 6547 * 6548 * http://www.apache.org/licenses/LICENSE-2.0 6549 * 6550 * Unless required by applicable law or agreed to in writing, software 6551 * distributed under the License is distributed on an "AS IS" BASIS, 6552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6553 * See the License for the specific language governing permissions and 6554 * limitations under the License. 6555 * ============================================================================= 6556 */function gS(t,e,n,r){const s=t===e,a=t<e&&n<0,o=e<t&&n>1;if(s||a||o)return xn(0,r);const i=Math.abs(Math.ceil((e-t)/n)),l=xn(i,r);e<t&&n===1&&(n=-1),l[0]=t;for(let u=1;u<l.length;u++)l[u]=l[u-1]+n;return l}/** 6557 * @license 6558 * Copyright 2020 Google LLC. All Rights Reserved. 6559 * Licensed under the Apache License, Version 2.0 (the License); 6560 * you may not use this file except in compliance with the License. 6561 * You may obtain a copy of the License at 6562 * 6563 * http://www.apache.org/licenses/LICENSE-2.0 6564 * 6565 * Unless required by applicable law or agreed to in writing, softw
6565are 6566 * distributed under the License is distributed on an AS IS BASIS, 6567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6568 * See the License for the specific language governing permissions and 6569 * limitations under the License. 6570 * ============================================================================= 6571 */const I7=la(t=>1/Math.sqrt(t)),k7=ua(uf,I7),E7={kernelName:uf,backendName:"cpu",kernelFunc:k7};/** 6572 * @license 6573 * Copyright 2020 Google LLC. All Rights Reserved. 6574 * Licensed under the Apache License, Version 2.0 (the "License"); 6575 * you may not use this file except in compliance with the License. 6576 * You may obtain a copy of the License at 6577 * 6578 * http://www.apache.org/licenses/LICENSE-2.0 6579 * 6580 * Unless required by applicable law or agreed to in writing, software 6581 * distributed under the License is distributed on an "AS IS" BASIS, 6582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6583 * See the License for the specific language governing permissions and 6584 * limitations under the License. 6585 * ============================================================================= 6586 */function Fo(t,e,n,r,s,a,o,i,l,u){const c=[r/s,s],d=t.values,f=e.values;if(r===0)return rt(n,e.dtype);const p=l instanceof on?l:rt(c,e.dtype);typeof l=="string"||typeof l=="number"?p.values.fill(l):typeof l=="boolean"&&p.values.fill(+l);for(let h=0;h<a;h++){const m=[];let g=0;for(let v=0;v<o;v++){const b=d[h*o+v];m.push(b),g+=b*i[v]}if(g<0||g>=r/s)throw new Error("Invalid indices: ".concat(m," does not index into ").concat(n));for(let v=0;v<s;v++)u?p.values[g*s+v]+=f[h*s+v]:p.values[g*s+v]=e.rank===0?f[0]:f[h*s+v]}return p}/** 6587 * @license 6588 * Copyright 2020 Google LLC. All Rights Reserved. 6589 * Licensed under the Apache License, Version 2.0 (the License); 6590 * you may not use this file except in compliance with the License. 6591 * You may obtain a copy of the License at 6592 * 6593 * http://www.apache.org/licenses/LICENSE-2.0 6594 * 6595 * Unless required by applicable law or agreed to in writing, software 6596 * distributed under the License is distributed on an AS IS BASIS, 6597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6598 * See the License for the specific language governing permissions and 6599 * limitations under the License. 6600 * ============================================================================= 6601 */const yS=mt(vf,t=>1/(1+Math.exp(-t))),T7={kernelName:vf,backendName:"cpu",kernelFunc:yS};/** 6602 * @license 6603 * Copyright 2020 Google LLC. All Rights Reserved. 6604 * Licensed under the Apache License, Version 2.0 (the "License"); 6605 * you may not use this file except in compliance with the License. 6606 * You may obtain a copy of the License at 6607 * 6608 * http://www.apache.org/licenses/LICENSE-2.0 6609 * 6610 * Unless required by applicable law or agreed to in writing, software 6611 * distributed under the License is distributed on an "AS IS" BASIS, 6612 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6613 * See the License for the specific language governing permissions and 6614 * limitations under the License. 6615 * ============================================================================= 6616 */function Uh(t,e,n,r,s){const a=I2(r,e,n),o=J(n),i=Ie(r);if(a){const d=k2(e,i);return s==="string"?t.slice(d,d+o):t.subarray(d,d+o)}const l=s==="string"?Cc(t):t,u=rt(r,s,l),c=rt(n,s);for(let d=0;d<c.size;++d){const f=c.indexToLoc(d),p=f.map((h,m)=>h+e[m]);c.set(u.get(...p),...f)}return s==="string"?G2(c.values):c.values}function Ka(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{begin:a,size:o}=r;_e(s,"slice");const[i,l]=E2(s,a,o);L6(s,i,l);const u=n.data.get(s.dataId).values,c=Uh(u,i,l,s.shape,s.dtype);return n.makeTensorInfo(l,s.dtype,c)}const C7={kernelName:Qm,backendName:"cpu",kernelFunc:Ka};/** 6617 * @license 6618 * Copyright 2021 Google LLC. All Rights Reserved. 6619 * Licensed under the Apache License, Version 2.0 (the "License"); 6620 * you may not use this file except in compliance with the License. 6621 * You may obtain a copy of the License at 6622 * 6623 * http://www.apache.org/licenses/LICENSE-2.0 6624 * 6625 * Unless required by applicable law or agreed to in writing, softw
6625are 6626 * distributed under the License is distributed on an "AS IS" BASIS, 6627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6628 * See the License for the specific language governing permissions and 6629 * limitations under the License. 6630 * ============================================================================= 6631 */function N7(t,e,n,r,s,a,o){const i=e[0],l=a[0],u=new Array(l),c=new Array(i),d=e[1];if(l===0){if(i!==0)throw new Error(F2(i));const g=tn(n,0),v=tn(s,0);return[g,[0,d],v,u,c]}let f=!0,p=0;const h=new Array(l).fill(0);for(let g=0;g<i;++g){const v=t[g*d];if(v<0)throw new Error(M2(g,v));if(v>=l)throw new Error(O2(g,v,l));++h[v],f=f&&v>=p,p=v}let m=!0;for(let g=0;g<l;++g){const v=h[g]===0;u[g]=v,m=m&&!v,h[g]=Math.max(h[g],1),g>0&&(h[g]+=h[g-1])}if(m&&f){const g=t,v=r;for(let b=0;b<i;++b)c[b]=b;return[g,[i,d],v,u,c]}else{const g=h[l-1],v=tn(n,g*d),b=tn(s,g),w=new Array(l).fill(0);for(let S=0;S<i;++S){const I=t[S*d],E=w[I],T=(I===0?0:h[I-1])+E;w[I]++;for(let D=0;D<d;++D)v[T*d+D]=t[S*d+D];b[T]=r[S],c[S]=T}for(let S=0;S<l;++S)if(w[S]===0){const E=S===0?0:h[S-1];v[E*d+0]=S;for(let T=1;T<d;++T)v[E*d+T]=0;b[E]=o}return[v,[g,d],b,u,c]}}/** 6632 * @license 6633 * Copyright 2021 Google LLC. All Rights Reserved. 6634 * Licensed under the Apache License, Version 2.0 (the "License"); 6635 * you may not use this file except in compliance with the License. 6636 * You may obtain a copy of the License at 6637 * 6638 * http://www.apache.org/licenses/LICENSE-2.0 6639 * 6640 * Unless required by applicable law or agreed to in writing, software 6641 * distributed under the License is distributed on an "AS IS" BASIS, 6642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6643 * See the License for the specific language governing permissions and 6644 * limitations under the License. 6645 * ============================================================================= 6646 */function A7(t,e,n,r,s){const a=J(r),o=e[0],i=s.length,l=[];let u=1,c=-1;for(let g=0;g<i;++g){const v=s[g];if(v===-1){if(c!==-1)throw new Error(P2(c,g));c=g,l.push(1)}else{if(v<0)throw new Error(B2(g,v));u*=v,l.push(v)}}if(c!==-1){if(u<=0)throw new Error(L2());const g=Math.trunc(a/u);if(u*g!==a)throw new Error(W2(r,l));l[c]=g}if(J(l)!==a)throw new Error(z2(r,l));const f=r.length,p=[];if(f>0){p[f-1]=1;for(let g=f-2;g>=0;--g)p[g]=p[g+1]*r[g+1]}const h=[];if(i>0){h[i-1]=1;for(let g=i-2;g>=0;--g)h[g]=h[g+1]*l[g+1]}const m=tn(n,o*i);for(let g=0;g<o;++g){let v=0;for(let b=0;b<f;++b)v+=t[g*f+b]*p[b];for(let b=0;b<i;++b)m[g*i+b]=Math.trunc(v/h[b]),v%=h[b]}return[m,[o,i],l]}/** 6647 * @license 6648 * Copyright 2021 Google LLC. All Rights Reserved. 6649 * Licensed under the Apache License, Version 2.0 (the "License"); 6650 * you may not use this file except in compliance with the License. 6651 * You may obtain a copy of the License at 6652 * 6653 * http://www.apache.org/licenses/LICENSE-2.0 6654 * 6655 * Unless required by applicable law or agreed to in writing, software 6656 * distributed under the License is distributed on an "AS IS" BASIS, 6657 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6658 * See the License for the specific language governing permissions and 6659 * limitations under the License. 6660 * ============================================================================= 6661 */function vS(t,e,n,r,s,a=!1,o=0){const i=r.length,l=[e[0],t.length/e[0]],u=l[1],d=i>0?s[i-1]+1:0;if(d<0)throw new Error(fu());const f=e.slice();f[0]=d;const p=f.reduce((w,S)=>w*S,1),h=tn(n,p);if(i===0)return d>0&&h.fill(o),[h,f];if(d<=0)throw new Error(fu());let m=0,g=1,v=0,b=s[m];for(;;){let w=0;if(g<i){if(w=s[g],b===w){++g;continue}if(b>=w)throw new Error(H2())}if(b<0||b>=d)throw new Error(U2(b,d));b>v&&h.fill(o,v*u,b*u);for(let S=m;S<g;++S){const I=r[S];if(I<0||I>=l[0])throw new Error(V2(S,r[S],l[0]));for(let E=0;E<u;E++)h[b*u+E]+=t[I*u+E]}if(a)for(let S=0;S<u;S++)h[b*u+S]/=g-m;if(m=g,++g,v=b+1,b=w,g>i)break}return v<d&&h.fill(o,v*u,d*u),[h,f]}/** 6662 * @license 6663 * Copyright 2020 Google LLC. All Rights Reserved. 6664 * Licensed under the Apache License, Version 2.0 (the License); 6665 * you may not use this file except in compliance with the License. 6666 * You may obtain a copy of the License at 6667 * 6668 * http://www.apache.org/licenses/LICENSE-2.0 6669 * 6670 * Unless required by applicable law or agreed to in writing, softw
6670are 6671 * distributed under the License is distributed on an AS IS BASIS, 6672 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6673 * See the License for the specific language governing permissions and 6674 * limitations under the License. 6675 * ============================================================================= 6676 */const $7=mt(wf,t=>Math.sqrt(t)),R7={kernelName:wf,backendName:"cpu",kernelFunc:$7};/** 6677 * @license 6678 * Copyright 2020 Google LLC. All Rights Reserved. 6679 * Licensed under the Apache License, Version 2.0 (the "License"); 6680 * you may not use this file except in compliance with the License. 6681 * You may obtain a copy of the License at 6682 * 6683 * http://www.apache.org/licenses/LICENSE-2.0 6684 * 6685 * Unless required by applicable law or agreed to in writing, software 6686 * distributed under the License is distributed on an "AS IS" BASIS, 6687 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6688 * See the License for the specific language governing permissions and 6689 * limitations under the License. 6690 * ============================================================================= 6691 */const D7=Qt((t,e)=>{const n=t-e;return n*n}),F7=ln(kf,D7),M7={kernelName:kf,backendName:"cpu",kernelFunc:F7};/** 6692 * @license 6693 * Copyright 2023 Google LLC. 6694 * Licensed under the Apache License, Version 2.0 (the "License"); 6695 * you may not use this file except in compliance with the License. 6696 * You may obtain a copy of the License at 6697 * 6698 * http://www.apache.org/licenses/LICENSE-2.0 6699 * 6700 * Unless required by applicable law or agreed to in writing, software 6701 * distributed under the License is distributed on an "AS IS" BASIS, 6702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6703 * See the License for the specific language governing permissions and 6704 * limitations under the License. 6705 * ============================================================================= 6706 */const O7=la((t,e)=>{const{pattern:n,replaceGlobal:r,rewrite:s}=e;return t.replace(new RegExp(n,r?"g":""),s)}),P7=ua(sg,O7),B7={kernelName:sg,backendName:"cpu",kernelFunc:P7};/** 6707 * @license 6708 * Copyright 2020 Google LLC. All Rights Reserved. 6709 * Licensed under the Apache License, Version 2.0 (the "License"); 6710 * you may not use this file except in compliance with the License. 6711 * You may obtain a copy of the License at 6712 * 6713 * http://www.apache.org/licenses/LICENSE-2.0 6714 * 6715 * Unless required by applicable law or agreed to in writing, software 6716 * distributed under the License is distributed on an "AS IS" BASIS, 6717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6718 * See the License for the specific language governing permissions and 6719 * limitations under the License. 6720 * ============================================================================= 6721 */function L7(t,e,n,r){const s=rt(t,e.dtype);for(let a=0;a<s.size;a++){const o=s.indexToLoc(a),i=new Array(o.length);for(let l=0;l<i.length;l++)i[l]=o[l]*n[l]+r[l];s.set(e.get(...i),...o)}return s}/** 6722 * @license 6723 * Copyright 2021 Google LLC. All Rights Reserved. 6724 * Licensed under the Apache License, Version 2.0 (the "License"); 6725 * you may not use this file except in compliance with the License. 6726 * You may obtain a copy of the License at 6727 * 6728 * http://www.apache.org/licenses/LICENSE-2.0 6729 * 6730 * Unless required by applicable law or agreed to in writing, software 6731 * distributed under the License is distributed on an "AS IS" BASIS, 6732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6733 * See the License for the specific language governing permissions and 6734 * limitations under the License. 6735 * ============================================================================= 6736 */class W7{constructor(e,n,r,s,a,o){this.separator=Pa(e),this.nGramWidths=n,this.leftPad=Pa(r),this.rightPad=Pa(s),this.padWidth=a,this.preserveShort=o}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,n){const r=this.getPadWidth(n);return Math.max(0,e+2*r-n+1)}createNGrams(e,n,r,s,a,o){for(let i=0;i<a;++i){const l=this.getPadWidth(o),u=Math.max(0,l-i),c=Math.max(0,l-(a-(i+1))),d=o-(u+c),f=n+(u>0?0:i-l);let p=0;p+=u*this.leftPad.length;for(let b=0;b<d;++b)p+=e[f+b].length;p+=c*this.rightPad.length;const h=u+c+d-1;p+=h*this.separator.length,r[s+i]=new Uint8Array(p);const m=r[s+i];let g=0;const v=b=>b.forEach(w=>m[g++]=w);for(let b=0;b<u;++b)v(this.leftPad),v(this.separator);for(let b=0;b<d-1;++b)v(e[f+b]),v(this.separator);if(d>0){v(e[f+d-1]);for(let b=0;b<c;++b)v(this.separator),v(this.rightPad)}else{for(let b=0;b<c-1;++b)v(this.rightPad),v(this.separator);v(this.rightPad)}}}compute(e,n){const r=e.length,s=n.length;if(s>0){let l=n[0];if(l!==0)throw new Error("First split value must be 0, got ".concat(l));for(let u=1;u<s;++u){let c=n[u]>=l;if(c=c&&n[u]<=r,!c)throw new Error("Invalid split value ".concat(n[u],", must be in [").concat(l,", ").concat(r,"]"));l=n[u]}if(l!==r)throw new Error("Last split value must be data size. Expected ".concat(r,", got ").concat(l))}const a=s-1,o=tn("int32",s);if(r===0||s===0){const l=new Array(r);for(let u=0;u<=a;++u)o[u]=0;return[l,o]}o[0]=0;for(let l=1;l<=a;++l){const u=n[l]-n[l-1];let c=0;this.nGramWidths.forEach(d=>{c+=this.getNumNGrams(u,d)}),this.preserveShort&&u>
vendor: 4,685 bytes, lines 6736-6799
67360&&c===0&&(c=1),o[l]=o[l-1]+c}const i=new Array(o[a]);for(let l=0;l<a;++l){const u=n[l];let c=o[l];if(this.nGramWidths.forEach(d=>{const f=n[l+1]-n[l],p=this.getNumNGrams(f,d);this.createNGrams(e,u,i,c,p,d),c+=p}),this.preserveShort&&c===o[l]){const d=n[l+1]-n[l];if(d===0)continue;const f=d+2*this.padWidth,p=1;this.createNGrams(e,u,i,c,p,f)}}return[i,o]}}function bS(t,e,n,r,s,a,o,i){return new W7(n,r,s,a,o,i).compute(t,e)}/** 6737 * @license 6738 * Copyright 2021 Google LLC. All Rights Reserved. 6739 * Licensed under the Apache License, Version 2.0 (the "License"); 6740 * you may not use this file except in compliance with the License. 6741 * You may obtain a copy of the License at 6742 * 6743 * http://www.apache.org/licenses/LICENSE-2.0 6744 * 6745 * Unless required by applicable law or agreed to in writing, software 6746 * distributed under the License is distributed on an "AS IS" BASIS, 6747 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6748 * See the License for the specific language governing permissions and 6749 * limitations under the License. 6750 * ============================================================================= 6751 */function z7(t,e,n,r){if(!t.length)return;if(e.length===0){for(let a=0;a<t.length;++a)r.push(t.subarray(a,a+1));return}if(e.length===1){const a=e[0];let o=t.indexOf(a);for(;o!==-1;){const i=t.subarray(0,o);(!n||i.length!==0)&&r.push(i),t=t.subarray(o+1),o=t.indexOf(a)}(!n||t.length!==0)&&r.push(t);return}let s=0;for(let a=0;a<t.length+1;a++)if(a===t.length||e.indexOf(t[a])!==-1){const o=t.subarray(s,a);(!n||o.length!==0)&&r.push(o),s=a+1}}function wS(t,e,n){const r=t.length,s=[];let a=0,o=0;const i=new Array(r);for(let f=0;f<r;++f){const p=s.length;z7(t[f],e,n,s);const h=s.length-p;i[f]=h,a+=h,o=Math.max(o,h)}const l=tn("int32",a*2),u=new Array(a),c=[r,o];let d=0;for(let f=0;f<r;++f)for(let p=0;p<i[f];++p)l[d*2]=f,l[d*2+1]=p,u[d]=s[d],++d;return[l,u,c]}/** 6752 * @license 6753 * Copyright 2021 Google LLC. All Rights Reserved. 6754 * Licensed under the Apache License, Version 2.0 (the "License"); 6755 * you may not use this file except in compliance with the License. 6756 * You may obtain a copy of the License at 6757 * 6758 * http://www.apache.org/licenses/LICENSE-2.0 6759 * 6760 * Unless required by applicable law or agreed to in writing, software 6761 * distributed under the License is distributed on an "AS IS" BASIS, 6762 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6763 * See the License for the specific language governing permissions and 6764 * limitations under the License. 6765 * ============================================================================= 6766 */function SS(t,e){const n=tn("int32",t.length);for(let r=0;r<t.length;++r)n[r]=oN(t[r]).modulo(e).getLowBitsUnsigned();return n}/** 6767 * @license 6768 * Copyright 2020 Google LLC. All Rights Reserved. 6769 * Licensed under the Apache License, Version 2.0 (the "License"); 6770 * you may not use this file except in compliance with the License. 6771 * You may obtain a copy of the License at 6772 * 6773 * http://www.apache.org/licenses/LICENSE-2.0 6774 * 6775 * Unless required by applicable law or agreed to in writing, software 6776 * distributed under the License is distributed on an "AS IS" BASIS, 6777 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6778 * See the License for the specific language governing permissions and 6779 * limitations under the License. 6780 * ============================================================================= 6781 */const H7=Qt((t,e)=>t-e),U7=Pg((t,e,n,r)=>({real:t-n,imag:e-r})),Bg=ln(Tf,H7,U7),V7={kernelName:Tf,backendName:"cpu",kernelFunc:Bg};/** 6782 * @license 6783 * Copyright 2019 Google LLC. All Rights Reserved. 6784 * Licensed under the Apache License, Version 2.0 (the "License"); 6785 * you may not use this file except in compliance with the License. 6786 * You may obtain a copy of the License at 6787 * 6788 * http://www.apache.org/licenses/LICENSE-2.0 6789 * 6790 * Unless required by applicable law or agreed to in writing, software 6791 * distributed under the License is distributed on an "AS IS" BASIS, 6792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6793 * See the License for the specific language governing permissions and 6794 * limitations under the License. 6795 * ============================================================================= 6796 */function j7(t,e){const n=new Array(t.rank);for(let s=0;s<n.length;s++)n[s]=t.shape[s]*e[s];const r=rt(n,t.dtype);for(let s=0;s<r.values.length;++s){const a=r.indexToLoc(s),o=new Array(t.rank);for(let l=0;l<o.length;l++)o[l]=a[l]%t.shape[l];const i=t.locToIndex(o);r.values[s]=t.values[i]}return r}/** 6797 * @license 6798 * Copyright 2020 Google LLC. All Rights Reserved. 6799 * Licensed under the Apache License, Version 2.0 (the "License");
6800 * you may not use this file except in compliance with the License. 6801 * You may obtain a copy of the License at 6802 * 6803 * http://www.apache.org/licenses/LICENSE-2.0 6804 * 6805 * Unless required by applicable law or agreed to in writing, software 6806 * distributed under the License is distributed on an "AS IS" BASIS, 6807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6808 * See the License for the specific language governing permissions and 6809 * limitations under the License. 6810 * ============================================================================= 6811 */const Vi=(t,e)=>{const n=e.value-t.value;return n===0?t.index-e.index:n};function xS(t,e,n=0,r=t.length-1){for(;r>n;){if(r-n>600){const i=r-n+1,l=e-n+1,u=Math.log(i),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(i-c)/i)*Math.sign(l-i/2),f=Math.max(n,Math.floor(e-l*c/i+d)),p=Math.min(r,Math.floor(e+(i-l)*c/i+d));xS(t,e,f,p)}const s=t[e];let a=n,o=r;for(Ni(t,n,e),Vi(t[r],s)>0&&Ni(t,n,r);a<o;){for(Ni(t,a,o),a++,o--;Vi(t[a],s)<0;)a=a+1;for(;Vi(t[o],s)>0;)o=o-1}Vi(t[n],s)===0?Ni(t,n,o):(o=o+1,Ni(t,o,r)),o<=e&&(n=o+1),e<=o&&(r=o-1)}}function G7(t,e,n,r,s){const a=e[e.length-1],[o,i]=[t.length/a,a],l=$n(n,o*r),u=$n("int32",o*r);for(let d=0;d<o;d++){const f=d*i,p=t.subarray(f,f+i);let h=new Array(p.length);p.forEach((b,w)=>h[w]={value:b,index:w}),r<h.length&&(xS(h,r),h=h.slice(0,r)),s&&h.sort(Vi);const m=d*r,g=l.subarray(m,m+r),v=u.subarray(m,m+r);for(let b=0;b<r;b++)g[b]=h[b].value,v[b]=h[b].index}const c=e.slice();return c[c.length-1]=r,[rt(c,n,l),rt(c,"int32",u)]}/** 6812 * @license 6813 * Copyright 2020 Google LLC. All Rights Reserved. 6814 * Licensed under the Apache License, Version 2.0 (the "License"); 6815 * you may not use this file except in compliance with the License. 6816 * You may obtain a copy of the License at 6817 * 6818 * http://www.apache.org/licenses/LICENSE-2.0 6819 * 6820 * Unless required by applicable law or agreed to in writing, software 6821 * distributed under the License is distributed on an "AS IS" BASIS, 6822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6823 * See the License for the specific language governing permissions and 6824 * limitations under the License. 6825 * ============================================================================= 6826 */function _S(t,e,n,r){const s=Vt(e,n)[0],a=[1,n[0],1];for(let h=0;h<s;h++)a[0]*=n[h];a[1]=n[s];for(let h=s+1;h<n.length;h++)a[2]*=n[h];const o=new Map,i=new Int32Array(n[s]),l=new on(a,r,t),u=[],c=a[0]===1&&a[2]===1;for(let h=0;h<n[s];h++){let m;if(c)m=t[h].toString();else{const v=[];for(let b=0;b<a[0];b++)for(let w=0;w<a[2];w++)v.push(l.get(b,h,w));m=v.join(",")}const g=o.get(m);if(g!=null)i[h]=g;else{const v=o.size;o.set(m,v),i[h]=v,u.push(h)}}const d=a.slice();d[1]=o.size;const f=new on(d,r);u.forEach((h,m)=>{for(let g=0;g<a[0];g++)for(let v=0;v<a[2];v++)f.set(l.get(g,h,v),g,m,v)});const p=n.slice();return p[s]=d[1],{outputValues:f.values,outputShape:p,indices:i}}/** 6827 * @license 6828 * Copyright 2019 Google LLC. All Rights Reserved. 6829 * Licensed under the Apache License, Version 2.0 (the "License"); 6830 * you may not use this file except in compliance with the License. 6831 * You may obtain a copy of the License at 6832 * 6833 * http://www.apache.org/licenses/LICENSE-2.0 6834 * 6835 * Unless required by applicable law or agreed to in writing, software 6836 * distributed under the License is distributed on an "AS IS" BASIS, 6837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6838 * See the License for the specific language governing permissions and 6839 * limitations under the License. 6840 * ============================================================================= 6841 */function Xa(t){const{inputs:{x:e},attrs:{begin:n,size:r},backend:s}=t,[a,o]=E2(e,n,r),i=I2(e.shape,a,o),l=s.readSync(e.dataId),u=s.makeOutput(o,e.dtype),c=Ie(e.shape),d=s.dataIdMap.get(u.dataId);if(i){const h=k2(a,c);return e.dtype==="string"?d.stringBytes=l.slice(h,h+J(o)):s.typedArrayFromHeap(u).set(l.subarray(h,h+J(o))),u}if(e.dtype==="string"){const h=Uh(l,a,o,e.shape,e.dtype);return d.stringBytes=h,u}const f=s.typedArrayFromHeap(u),p=e.shape.length;if(p===2)q7(l,c[0],f,a,o);else if(p===3)K7(l,c[0],c[1],f,a,o);else if(p===4)X7(l,c[0],c[1],c[2],f,a,o);else{const h=Uh(l,a,o,e.shape,e.dtype);f.set(h)}return u}function q7(t,e,n,r,s){let a=0;const o=r[0],i=r[1],l=o+s[0];for(let u=o;u<l;u++){const c=u*e+i;n.set(t.subarray(c,c+s[1]),a),a+=s[1]}}function K7(t,e,n,r,s,a){let o=0;const i=s[0],l=s[1],u=s[2],c=i+a[0],d=l+a[1];for(let f=i;f<c;f++)for(let p=l;p<d;p++){const h=f*e+p*n+u;r.set(t.subarray(h,h+a[2]),o),o+=a[2]}}function X7(t,e,n,r,s,a,o){let i=0;const l=a[0],u=a[1],c=a[2],d=l+o[0],f=u+o[1],p=c+o[2],h=a[3];for(let m=l;m<d;m++)for(let g=u;g<f;g++)for(let v=c;v<p;v++){const b=m*e+g*n+v*r+h;s.set(t.subarray(b,b+o[3]),i),i+=o[3]}}const Y7={kernelName:Qm,backendName:"wasm",kernelFunc:Xa};/** 6842 * @license 6843 * Copyright 2021 Google LLC. All Rights Reserved. 6844 * Licensed under the Apache License, Version 2.0 (the "License");
6845 * you may not use this file except in compliance with the License. 6846 * You may obtain a copy of the License at 6847 * 6848 * http://www.apache.org/licenses/LICENSE-2.0 6849 * 6850 * Unless required by applicable law or agreed to in writing, software 6851 * distributed under the License is distributed on an "AS IS" BASIS, 6852 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6853 * See the License for the specific language governing permissions and 6854 * limitations under the License. 6855 * ============================================================================= 6856 */function J7(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockShape:a,crops:o}=r,i=a.reduce((v,b)=>v*b),l=Uf(s.shape,a,i),u=Vf(l.length,a.length),c=jf(s.shape,a,i),d=A2(o,a.length),f=$2(c,o,a.length),p=zn({inputs:{x:s},backend:n,attrs:{shape:l}}),h=ta({inputs:{x:p},backend:n,attrs:{perm:u}}),m=zn({inputs:{x:h},backend:n,attrs:{shape:c}}),g=Xa({inputs:{x:m},backend:n,attrs:{begin:d,size:f}});return n.disposeData(p.dataId),n.disposeData(h.dataId),n.disposeData(m.dataId),g}const Q7={kernelName:$m,backendName:"wasm",kernelFunc:J7};/** 6857 * @license 6858 * Copyright 2023 Google LLC. 6859 * Licensed under the Apache License, Version 2.0 (the "License"); 6860 * you may not use this file except in compliance with the License. 6861 * You may obtain a copy of the License at 6862 * 6863 * http://www.apache.org/licenses/LICENSE-2.0 6864 * 6865 * Unless required by applicable law or agreed to in writing, software 6866 * distributed under the License is distributed on an "AS IS" BASIS, 6867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6868 * See the License for the specific language governing permissions and 6869 * limitations under the License. 6870 * ============================================================================= 6871 */let IS;function Z7(t){IS=t.wasm.cwrap(Ku,null,["number","number","boolean","number","number","number"])}function eL(t){const{backend:e,inputs:n,attrs:r}=t,{x:s,weights:a}=n,{size:o}=r,i=a.shape.reduce((d,f)=>d*f,1)!==0,l=s.shape.length===1?[o]:[s.shape[0],o],u=e.makeOutput(l,a.dtype);function c(d){return e.dataIdMap.get(d.dataId).id}return IS(c(s),o,i,c(a),it[a.dtype],c(u)),u}const tL={kernelName:Ku,backendName:"wasm",setupFunc:Z7,kernelFunc:eL};/** 6872 * @license 6873 * Copyright 2023 Google LLC. 6874 * Licensed under the Apache License, Version 2.0 (the "License"); 6875 * you may not use this file except in compliance with the License. 6876 * You may obtain a copy of the License at 6877 * 6878 * http://www.apache.org/licenses/LICENSE-2.0 6879 * 6880 * Unless required by applicable law or agreed to in writing, software 6881 * distributed under the License is distributed on an "AS IS" BASIS, 6882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6883 * See the License for the specific language governing permissions and 6884 * limitations under the License. 6885 * ============================================================================= 6886 */const nL=nn(Xu);/** 6887 * @license 6888 * Copyright 2023 Google LLC. 6889 * Licensed under the Apache License, Version 2.0 (the "License"); 6890 * you may not use this file except in compliance with the License. 6891 * You may obtain a copy of the License at 6892 * 6893 * http://www.apache.org/licenses/LICENSE-2.0 6894 * 6895 * Unless required by applicable law or agreed to in writing, software 6896 * distributed under the License is distributed on an "AS IS" BASIS, 6897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6898 * See the License for the specific language governing permissions and 6899 * limitations under the License. 6900 * ============================================================================= 6901 */function rL(t){const{inputs:e,backend:n}=t,{s0:r,s1:s}=e,a=n.typedArrayFromHeap(r),o=n.typedArrayFromHeap(s),i=Rt(Array.from(a),Array.from(o));return n.makeOutput([i.length],"int32",void 0,new Int32Array(i))}const sL={kernelName:Rm,backendName:"wasm",kernelFunc:rL};/** 6902 * @license 6903 * Copyright 2019 Google LLC. All Rights Reserved. 6904 * Licensed under the Apache License, Version 2.0 (the "License"); 6905 * you may not use this file except in compliance with the License. 6906 * You may obtain a copy of the License at 6907 * 6908 * http://www.apache.org/licenses/LICENSE-2.0 6909 * 6910 * Unless required by applicable law or agreed to in writing, softw
6910are 6911 * distributed under the License is distributed on an "AS IS" BASIS, 6912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6913 * See the License for the specific language governing permissions and 6914 * limitations under the License. 6915 * ============================================================================= 6916 */function da(t){const{inputs:{x:e},attrs:{dtype:n},backend:r}=t,s=r.makeOutput(e.shape,n),a=r.typedArrayFromHeap(e);return r.typedArrayFromHeap(s).set(a),s}const aL={kernelName:Yu,backendName:"wasm",kernelFunc:da};/** 6917 * @license 6918 * Copyright 2021 Google LLC. All Rights Reserved. 6919 * Licensed under the Apache License, Version 2.0 (the "License"); 6920 * you may not use this file except in compliance with the License. 6921 * You may obtain a copy of the License at 6922 * 6923 * http://www.apache.org/licenses/LICENSE-2.0 6924 * 6925 * Unless required by applicable law or agreed to in writing, software 6926 * distributed under the License is distributed on an "AS IS" BASIS, 6927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6928 * See the License for the specific language governing permissions and 6929 * limitations under the License. 6930 * ============================================================================= 6931 */const oL=st(Ju);/** 6932 * @license 6933 * Copyright 2019 Google LLC. All Rights Reserved. 6934 * Licensed under the Apache License, Version 2.0 (the "License"); 6935 * you may not use this file except in compliance with the License. 6936 * You may obtain a copy of the License at 6937 * 6938 * http://www.apache.org/licenses/LICENSE-2.0 6939 * 6940 * Unless required by applicable law or agreed to in writing, software 6941 * distributed under the License is distributed on an "AS IS" BASIS, 6942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6943 * See the License for the specific language governing permissions and 6944 * limitations under the License. 6945 * ============================================================================= 6946 */let kS;function iL(t){kS=t.wasm.cwrap(Lc,null,["number","number","number","number"])}function cL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{clipValueMin:a,clipValueMax:o}=r,i=n.dataIdMap.get(s.dataId).id,l=n.makeOutput(s.shape,s.dtype),u=n.dataIdMap.get(l.dataId).id;return kS(i,a,o,u),l}const lL={kernelName:Lc,backendName:"wasm",setupFunc:iL,kernelFunc:cL};/** 6947 * @license 6948 * Copyright 2019 Google LLC. All Rights Reserved. 6949 * Licensed under the Apache License, Version 2.0 (the "License"); 6950 * you may not use this file except in compliance with the License. 6951 * You may obtain a copy of the License at 6952 * 6953 * http://www.apache.org/licenses/LICENSE-2.0 6954 * 6955 * Unless required by applicable law or agreed to in writing, software 6956 * distributed under the License is distributed on an "AS IS" BASIS, 6957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6958 * See the License for the specific language governing permissions and 6959 * limitations under the License. 6960 * ============================================================================= 6961 */function ES(t){const{inputs:e,backend:n}=t,r=Vt(t.attrs.axis,e[0].shape)[0],s=e.map(p=>p.shape);C2(s,r);let a=Uo(e.map(p=>p.shape),r);const o=e.filter(p=>J(p.shape)>0);if(o.length===1)return Gf({inputs:{x:o[0]},backend:n});const i=n.makeOutput(a,e[0].dtype);if(J(a)===0)return i;if(o[0].dtype==="string"){const p=o.map(w=>{const I=[-1,J(w.shape.slice(r))];return zn({inputs:{x:w},backend:n,attrs:{shape:I}})}),h=p.map(w=>({vals:n.readSync(w.dataId),shape:w.shape}));a=Uo(p.map(w=>w.shape),1);const m=p[0].shape[0]===1,g=dS(h,a,e[0].dtype,m),v=Uo(o.map(w=>w.shape),r);i.shape=v;const b=n.dataIdMap.get(i.dataId);return b.stringBytes=G2(g),p.forEach(w=>n.disposeData(w.dataId)),i}const l=J(o[0].shape.slice(0,r));let u=0;const c=o.map(p=>{const h=J(p.shape.slice(r));return u+=h,h}),d=o.map(p=>n.typedArrayFromHeap(p)),f=n.typedArrayFromHeap(i);for(let p=0;p<l;p++){let h=p*u;for(let m=0;m<d.length;m++){const g=c[m],v=p*g,b=d[m].subarray(v,v+g);f.set(b,h),h+=g}}return i}const uL={kernelName:Dm,backendName:"wasm",kernelFunc:ES};/** 6962 * @license 6963 * Copyright 2019 Google LLC. All Rights Reserved. 6964 * Licensed under the Apache License, Version 2.0 (the "License");
6965 * you may not use this file except in compliance with the License. 6966 * You may obtain a copy of the License at 6967 * 6968 * http://www.apache.org/licenses/LICENSE-2.0 6969 * 6970 * Unless required by applicable law or agreed to in writing, software 6971 * distributed under the License is distributed on an "AS IS" BASIS, 6972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6973 * See the License for the specific language governing permissions and 6974 * limitations under the License. 6975 * ============================================================================= 6976 */let TS;function dL(t){TS=t.wasm.cwrap(Qu,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function fL(t){const{inputs:e,attrs:n,backend:r}=t,{x:s,filter:a}=e,o=r.dataIdMap.get(s.dataId).id,i=r.dataIdMap.get(a.dataId).id,{strides:l,dilations:u,pad:c,dimRoundingMode:d,dataFormat:f}=n,p=ui(f),h=Vn(s.shape,a.shape,l,u,c,d,!1,p),m=h.filterHeight,g=h.filterWidth,v=h.padInfo.top,b=h.padInfo.right,w=h.padInfo.bottom,S=h.padInfo.left,I=h.dilationHeight,E=h.dilationWidth,T=h.strideHeight,D=h.strideWidth,R=h.inChannels,$=h.outChannels,M=h.padInfo.type==="SAME"?1:0;if(h.dataFormat!=="channelsLast")throw new Error("wasm backend Conv2D does not support dataFormat:'"+"".concat(h.dataFormat,"'. Please use 'channelsLast'."));const B=r.makeOutput(h.outShape,"float32"),z=r.dataIdMap.get(B.dataId).id;return TS(o,s.shape[0],s.shape[1],s.shape[2],i,m,g,v,b,w,S,M,I,E,T,D,R,$,z),B}const pL={kernelName:Qu,backendName:"wasm",setupFunc:dL,kernelFunc:fL};/** 6977 * @license 6978 * Copyright 2020 Google LLC. All Rights Reserved. 6979 * Licensed under the Apache License, Version 2.0 (the "License"); 6980 * you may not use this file except in compliance with the License. 6981 * You may obtain a copy of the License at 6982 * 6983 * http://www.apache.org/licenses/LICENSE-2.0 6984 * 6985 * Unless required by applicable law or agreed to in writing, software 6986 * distributed under the License is distributed on an "AS IS" BASIS, 6987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 6988 * See the License for the specific language governing permissions and 6989 * limitations under the License. 6990 * ============================================================================= 6991 */let CS;function hL(t){CS=t.wasm.cwrap(Zu,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function mL(t){const{backend:e,inputs:n,attrs:r}=t,{dy:s,filter:a}=n,{strides:o,pad:i,dataFormat:l,dimRoundingMode:u,inputShape:c}=r,d=1,f=ui(l),p=Vn(c,a.shape,o,d,i,u,!1,f),{batchSize:h,filterHeight:m,filterWidth:g,inChannels:v,inHeight:b,inWidth:w,outChannels:S,outHeight:I,outWidth:E,strideHeight:T,strideWidth:D}=p,R=m-1-p.padInfo.top,$=g-1-p.padInfo.left,M=p.dataFormat==="channelsLast",B=Ie(p.inShape),z=Ie(s.shape),[H,V,X]=Ie(a.shape),Q=B[0],K=M?B[1]:B[2],ee=M?B[2]:1,ae=M?1:B[1],ne=z[0],ce=M?z[1]:z[2],se=M?z[2]:1,oe=M?1:z[1],ie=e.makeOutput(p.inShape,"float32"),pe=e.dataIdMap.get(ie.dataId).id,ve=e.dataIdMap.get(s.dataId).id,fe=e.dataIdMap.get(a.dataId).id;return CS(ve,fe,h,m,g,b,w,v,I,E,S,T,D,R,$,H,V,X,Q,K,ee,ae,ne,ce,se,oe,pe),ie}const gL={kernelName:Zu,backendName:"wasm",setupFunc:hL,kernelFunc:mL};/** 6992 * @license 6993 * Copyright 2023 Google LLC. 6994 * Licensed under the Apache License, Version 2.0 (the "License"); 6995 * you may not use this file except in compliance with the License. 6996 * You may obtain a copy of the License at 6997 * 6998 * http://www.apache.org/licenses/LICENSE-2.0 6999 * 7000 * Unless required by applicable law or agreed to in writing, software 7001 * distributed under the License is distributed on an "AS IS" BASIS, 7002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7003 * See the License for the specific language governing permissions and 7004 * limitations under the License. 7005 * ============================================================================= 7006 */let NS;function yL(t){NS=t.wasm.cwrap(ed,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function vL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a}=e,{strides:o,pad:i,dilations:l}=r;if(s.dtype!=="float32")throw new Error("Tensor x must have dtype float32, got ".concat(s.dtype));if(a.dtype!=="float32")throw new Error("Tensor filter must have dtype float32, got ".concat(a.dtype));const u=no(s.shape,a.shape,o,l,i),c=n.makeOutput(u.outShape,s.dtype);return NS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(c.dataId).id,u.batchSize,u.inDepth,u.inHeight,u.inWidth,u.inChannels,u.outDepth,u.outHeight,u.outWidth,u.outChannels,u.strideDepth,u.strideHeight,u.strideWidth,u.dilationDepth,u.dilationHeight,u.dilationWidth,u.filterDepth,u.filterHeight,u.filterWidth,u.padInfo.front,u.padInfo.top,u.padInfo.left),c}const bL={kernelName:ed,backendName:"wasm",setupFunc:yL,kernelFunc:vL};/** 7007 * @license 7008 * Copyright 2023 Google LLC. 7009 * Licensed under the Apache License, Version 2.0 (the "License");
7010 * you may not use this file except in compliance with the License. 7011 * You may obtain a copy of the License at 7012 * 7013 * http://www.apache.org/licenses/LICENSE-2.0 7014 * 7015 * Unless required by applicable law or agreed to in writing, software 7016 * distributed under the License is distributed on an "AS IS" BASIS, 7017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7018 * See the License for the specific language governing permissions and 7019 * limitations under the License. 7020 * ============================================================================= 7021 */let AS;function wL(t){AS=t.wasm.cwrap(Fm,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function SL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:a}=e,{strides:o,pad:i,filterShape:l}=r;if(s.dtype!=="float32")throw new Error("Tensor dy must have dtype float32, got ".concat(s.dtype));if(a.dtype!=="float32")throw new Error("Tensor filter must have dtype float32, got ".concat(a.dtype));const u=no(s.shape,l,o,1,i),c=n.makeOutput(u.filterShape,a.dtype);return AS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(c.dataId).id,u.batchSize,u.inDepth,u.inHeight,u.inWidth,u.inChannels,u.outDepth,u.outHeight,u.outWidth,u.outChannels,u.strideDepth,u.strideHeight,u.strideWidth,u.dilationDepth,u.dilationHeight,u.dilationWidth,u.filterDepth,u.filterHeight,u.filterWidth,u.padInfo.front,u.padInfo.top,u.padInfo.left),c}const xL={kernelName:Fm,backendName:"wasm",setupFunc:wL,kernelFunc:SL};/** 7022 * @license 7023 * Copyright 2023 Google LLC. 7024 * Licensed under the Apache License, Version 2.0 (the "License"); 7025 * you may not use this file except in compliance with the License. 7026 * You may obtain a copy of the License at 7027 * 7028 * http://www.apache.org/licenses/LICENSE-2.0 7029 * 7030 * Unless required by applicable law or agreed to in writing, software 7031 * distributed under the License is distributed on an "AS IS" BASIS, 7032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7033 * See the License for the specific language governing permissions and 7034 * limitations under the License. 7035 * ============================================================================= 7036 */let $S;function _L(t){$S=t.wasm.cwrap(td,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function IL(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:a}=e,{pad:o,strides:i,inputShape:l}=r;if(s.dtype!=="float32")throw new Error("Tensor dy must have dtype float32, got ".concat(s.dtype));if(a.dtype!=="float32")throw new Error("Tensor filter must have dtype float32, got ".concat(a.dtype));const u=no(l,a.shape,i,1,o),c=n.makeOutput(u.inShape,s.dtype);return $S(n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(c.dataId).id,u.batchSize,u.inDepth,u.inHeight,u.inWidth,u.inChannels,u.outDepth,u.outHeight,u.outWidth,u.outChannels,u.strideDepth,u.strideHeight,u.strideWidth,u.dilationDepth,u.dilationHeight,u.dilationWidth,u.filterDepth,u.filterHeight,u.filterWidth,u.padInfo.front,u.padInfo.top,u.padInfo.left),c}const kL={kernelName:td,backendName:"wasm",setupFunc:_L,kernelFunc:IL};/** 7037 * @license 7038 * Copyright 2019 Google LLC. All Rights Reserved. 7039 * Licensed under the Apache License, Version 2.0 (the "License"); 7040 * you may not use this file except in compliance with the License. 7041 * You may obtain a copy of the License at 7042 * 7043 * http://www.apache.org/licenses/LICENSE-2.0 7044 * 7045 * Unless required by applicable law or agreed to in writing, software 7046 * distributed under the License is distributed on an "AS IS" BASIS, 7047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7048 * See the License for the specific language governing permissions and 7049 * limitations under the License. 7050 * ============================================================================= 7051 */const EL=st(nd);/** 7052 * @license 7053 * Copyright 2021 Google LLC. All Rights Reserved. 7054 * Licensed under the Apache License, Version 2.0 (the "License");
7055 * you may not use this file except in compliance with the License. 7056 * You may obtain a copy of the License at 7057 * 7058 * http://www.apache.org/licenses/LICENSE-2.0 7059 * 7060 * Unless required by applicable law or agreed to in writing, software 7061 * distributed under the License is distributed on an "AS IS" BASIS, 7062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7063 * See the License for the specific language governing permissions and 7064 * limitations under the License. 7065 * ============================================================================= 7066 */const TL=st(rd);/** 7067 * @license 7068 * Copyright 2019 Google LLC. All Rights Reserved. 7069 * Licensed under the Apache License, Version 2.0 (the "License"); 7070 * you may not use this file except in compliance with the License. 7071 * You may obtain a copy of the License at 7072 * 7073 * http://www.apache.org/licenses/LICENSE-2.0 7074 * 7075 * Unless required by applicable law or agreed to in writing, software 7076 * distributed under the License is distributed on an "AS IS" BASIS, 7077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7078 * See the License for the specific language governing permissions and 7079 * limitations under the License. 7080 * ============================================================================= 7081 */var Vh;(function(t){t[t.bilinear=0]="bilinear",t[t.nearest=1]="nearest"})(Vh||(Vh={}));let RS;function CL(t){RS=t.wasm.cwrap(od,null,["number","number","number","number","array","number","number","number","number","number"])}function NL(t){const{backend:e,inputs:n,attrs:r}=t,{method:s,extrapolationValue:a,cropSize:o}=r,{image:i,boxes:l,boxInd:u}=n,c=l.shape[0],[d,f]=o,p=[c,d,f,i.shape[3]];let h=e.dataIdMap.get(i.dataId),m;i.dtype!=="float32"&&(m=da({backend:e,inputs:{x:i},attrs:{dtype:"float32"}}),h=e.dataIdMap.get(m.dataId));const g=h.id,v=e.dataIdMap.get(l.dataId).id,b=e.dataIdMap.get(u.dataId).id,w=e.makeOutput(p,"float32"),S=e.dataIdMap.get(w.dataId).id,I=new Uint8Array(new Int32Array(i.shape).buffer);return RS(g,v,b,c,I,d,f,Vh[s],a,S),m!=null&&e.disposeData(m.dataId),w}const AL={kernelName:od,backendName:"wasm",setupFunc:CL,kernelFunc:NL};/** 7082 * @license 7083 * Copyright 2022 Google LLC. All Rights Reserved. 7084 * Licensed under the Apache License, Version 2.0 (the "License"); 7085 * you may not use this file except in compliance with the License. 7086 * You may obtain a copy of the License at 7087 * 7088 * http://www.apache.org/licenses/LICENSE-2.0 7089 * 7090 * Unless required by applicable law or agreed to in writing, software 7091 * distributed under the License is distributed on an "AS IS" BASIS, 7092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7093 * See the License for the specific language governing permissions and 7094 * limitations under the License. 7095 * ============================================================================= 7096 */let DS;function $L(t){DS=t.wasm.cwrap(sd,null,["number","number","number","number","number","number"])}function RL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,exclusive:o,reverse:i}=r,l=s.shape.length;A(s.dtype==="float32"||s.dtype==="int32",()=>"cumprod does not support ".concat(s.dtype," tensors in the WASM backend"));const u=fr([a],l);let c=s;u!==null&&(c=ta({inputs:{x:s},attrs:{perm:u},backend:n}));const d=Fn(1,l)[0];Dn("cumprod",[d],l);const f=n.makeOutput(c.shape,c.dtype),p=c.shape[d],h=n.dataIdMap.get(c.dataId).id,m=n.dataIdMap.get(f.dataId).id;DS(h,o?1:0,i?1:0,p,m,it[s.dtype]);let g=f;if(u!==null){const v=Of(u);g=ta({inputs:{x:f},attrs:{perm:v},backend:n}),n.disposeData(c.dataId),n.disposeData(f.dataId)}return g}const DL={kernelName:sd,backendName:"wasm",setupFunc:$L,kernelFunc:RL};/** 7097 * @license 7098 * Copyright 2020 Google LLC. All Rights Reserved. 7099 * Licensed under the Apache License, Version 2.0 (the "License"); 7100 * you may not use this file except in compliance with the License. 7101 * You may obtain a copy of the License at 7102 * 7103 * http://www.apache.org/licenses/LICENSE-2.0 7104 * 7105 * Unless required by applicable law or agreed to in writing, software 7106 * distributed under the License is distributed on an "AS IS" BASIS, 7107 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7108 * See the License for the specific language governing permissions and 7109 * limitations under the License. 7110 * ============================================================================= 7111 */let FS;function FL(t){FS=t.wasm.cwrap(ad,null,["number","number","number","number","number","number"])}function ML(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,exclusive:o,reverse:i}
7111=r,l=s.shape.length;A(s.dtype==="float32"||s.dtype==="int32",()=>"cumsum does not support ".concat(s.dtype," tensors in the WASM backend"));const u=fr([a],l);let c=s;u!==null&&(c=ta({inputs:{x:s},attrs:{perm:u},backend:n}));const d=Fn(1,l)[0];Dn("cumsum",[d],l);const f=n.makeOutput(c.shape,c.dtype),p=c.shape[d],h=n.dataIdMap.get(c.dataId).id,m=n.dataIdMap.get(f.dataId).id;FS(h,o?1:0,i?1:0,p,m,it[s.dtype]);let g=f;if(u!==null){const v=Of(u);g=ta({inputs:{x:f},attrs:{perm:v},backend:n}),n.disposeData(c.dataId),n.disposeData(f.dataId)}return g}const OL={kernelName:ad,backendName:"wasm",setupFunc:FL,kernelFunc:ML};/** 7112 * @license 7113 * Copyright 2023 Google LLC. 7114 * Licensed under the Apache License, Version 2.0 (the "License"); 7115 * you may not use this file except in compliance with the License. 7116 * You may obtain a copy of the License at 7117 * 7118 * http://www.apache.org/licenses/LICENSE-2.0 7119 * 7120 * Unless required by applicable law or agreed to in writing, software 7121 * distributed under the License is distributed on an "AS IS" BASIS, 7122 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7123 * See the License for the specific language governing permissions and 7124 * limitations under the License. 7125 * ============================================================================= 7126 */let MS;function PL(t){MS=t.wasm.cwrap("DenseBincount",null,["number","array","number","number","boolean","number","number","boolean","number"])}function BL(t){const{backend:e,inputs:n,attrs:r}=t,{x:s,weights:a}=n,{size:o,binaryOutput:i}=r,l=a.shape.reduce((f,p)=>f*p,1)!==0,u=s.shape.length===1?[o]:[s.shape[0],o],c=e.makeOutput(u,a.dtype);function d(f){return e.dataIdMap.get(f.dataId).id}return MS(d(s),new Uint8Array(new Int32Array(s.shape).buffer),s.shape.length,o,l,d(a),it[a.dtype],i,d(c)),c}const LL={kernelName:Mm,backendName:"wasm",setupFunc:PL,kernelFunc:BL};/** 7127 * @license 7128 * Copyright 2019 Google LLC. All Rights Reserved. 7129 * Licensed under the Apache License, Version 2.0 (the "License"); 7130 * you may not use this file except in compliance with the License. 7131 * You may obtain a copy of the License at 7132 * 7133 * http://www.apache.org/licenses/LICENSE-2.0 7134 * 7135 * Unless required by applicable law or agreed to in writing, software 7136 * distributed under the License is distributed on an "AS IS" BASIS, 7137 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7138 * See the License for the specific language governing permissions and 7139 * limitations under the License. 7140 * ============================================================================= 7141 */let OS;function WL(t){OS=t.wasm.cwrap(id,null,["number","number","number","array","number","array","array","number","number"])}function zL(t){const{backend:e,inputs:n,attrs:r}=t,{x:s}=n,{blockSize:a,dataFormat:o}=r,i=s.shape[0],l=o==="NHWC"?s.shape[1]:s.shape[2],u=o==="NHWC"?s.shape[2]:s.shape[3],c=o==="NHWC"?s.shape[3]:s.shape[1],d=l*a,f=u*a,p=c/(a*a),h=o==="NHWC"?[i,d,f,p]:[i,p,d,f],m=e.makeOutput(h,"float32"),v=e.dataIdMap.get(s.dataId).id,b=new Uint8Array(new Int32Array(Ie(s.shape)).buffer),w=new Uint8Array(new Int32Array(h).buffer),S=new Uint8Array(new Int32Array(Ie(h)).buffer),I=e.dataIdMap.get(m.dataId).id;return OS(v,a,o==="NHWC"?1:0,b,s.shape.length-1,w,S,h.length,I),m}const HL={kernelName:id,backendName:"wasm",setupFunc:WL,kernelFunc:zL};/** 7142 * @license 7143 * Copyright 2019 Google LLC. All Rights Reserved. 7144 * Licensed under the Apache License, Version 2.0 (the "License"); 7145 * you may not use this file except in compliance with the License. 7146 * You may obtain a copy of the License at 7147 * 7148 * http://www.apache.org/licenses/LICENSE-2.0 7149 * 7150 * Unless required by applicable law or agreed to in writing, software 7151 * distributed under the License is distributed on an "AS IS" BASIS, 7152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7153 * See the License for the specific language governing permissions and 7154 * limitations under the License. 7155 * ============================================================================= 7156 */let PS;function UL(t){PS=t.wasm.cwrap(cd,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function VL(t){const{inputs:e,attrs:n,backend:r}=t,{x:s,filter:a}=e,o=r.dataIdMap.get(s.dataId).id,i=r.dataIdMap.get(a.dataId).id,{strides:l,dilations:u,pad:c,dimRoundingMode:d}
7156=n,f=u==null?[1,1]:u,p=Vn(s.shape,a.shape,l,f,c,d,!0),h=p.filterHeight,m=p.filterWidth,g=p.padInfo.top,v=p.padInfo.right,b=p.padInfo.bottom,w=p.padInfo.left,S=p.dilationHeight,I=p.dilationWidth,E=p.strideHeight,T=p.strideWidth,D=p.inChannels,R=p.outChannels,$=p.padInfo.type==="SAME"?1:0;if(p.dataFormat!=="channelsLast")throw new Error("wasm backend DepthwiseConv2dNative does not support dataFormat:'"+"".concat(p.dataFormat,"'. Please use 'channelsLast'."));const M=r.makeOutput(p.outShape,"float32"),B=r.dataIdMap.get(M.dataId).id;return PS(o,s.shape[0],s.shape[1],s.shape[2],i,h,m,g,v,b,w,$,S,I,E,T,D,R,B),M}const jL={kernelName:cd,backendName:"wasm",setupFunc:UL,kernelFunc:VL};/** 7157 * @license 7158 * Copyright 2023 Google LLC. 7159 * Licensed under the Apache License, Version 2.0 (the "License"); 7160 * you may not use this file except in compliance with the License. 7161 * You may obtain a copy of the License at 7162 * 7163 * http://www.apache.org/licenses/LICENSE-2.0 7164 * 7165 * Unless required by applicable law or agreed to in writing, software 7166 * distributed under the License is distributed on an "AS IS" BASIS, 7167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7168 * See the License for the specific language governing permissions and 7169 * limitations under the License. 7170 * ============================================================================= 7171 */let BS;function GL(t){BS=t.wasm.cwrap("Diag",null,["number","number","number","number"])}function qL(t){const{inputs:e,backend:n}=t,{x:r}=e,s=J(r.shape),a=n.makeOutput([...r.shape,...r.shape],r.dtype);return BS(n.dataIdMap.get(r.dataId).id,it[r.dtype],s,n.dataIdMap.get(a.dataId).id),a}const KL={kernelName:Om,backendName:"wasm",setupFunc:GL,kernelFunc:qL};/** 7172 * @license 7173 * Copyright 2023 Google LLC. 7174 * Licensed under the Apache License, Version 2.0 (the "License"); 7175 * you may not use this file except in compliance with the License. 7176 * You may obtain a copy of the License at 7177 * 7178 * http://www.apache.org/licenses/LICENSE-2.0 7179 * 7180 * Unless required by applicable law or agreed to in writing, software 7181 * distributed under the License is distributed on an "AS IS" BASIS, 7182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7183 * See the License for the specific language governing permissions and 7184 * limitations under the License. 7185 * ============================================================================= 7186 */let LS;function XL(t){LS=t.wasm.cwrap(ld,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function YL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a}=e,{strides:o,pad:i,dilations:l}=r;if(s.dtype!==a.dtype)throw new Error("Dilation2D error: x must have the same dtype as filter. Got ".concat(s.dtype," and ").concat(a.dtype));const u=li(s.shape,a.shape,o,i,"NHWC",l),c=n.makeOutput(u.outShape,s.dtype);return LS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(c.dataId).id,it[s.dtype],u.batchSize,u.inChannels,u.inHeight,u.inWidth,u.outHeight,u.outWidth,u.strideHeight,u.strideWidth,u.dilationHeight,u.dilationWidth,u.filterHeight,u.filterWidth,u.padInfo.top,u.padInfo.left),c}const JL={kernelName:ld,backendName:"wasm",setupFunc:XL,kernelFunc:YL};/** 7187 * @license 7188 * Copyright 2023 Google LLC. 7189 * Licensed under the Apache License, Version 2.0 (the "License"); 7190 * you may not use this file except in compliance with the License. 7191 * You may obtain a copy of the License at 7192 * 7193 * http://www.apache.org/licenses/LICENSE-2.0 7194 * 7195 * Unless required by applicable law or agreed to in writing, software 7196 * distributed under the License is distributed on an "AS IS" BASIS, 7197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7198 * See the License for the specific language governing permissions and 7199 * limitations under the License. 7200 * ============================================================================= 7201 */let WS;function QL(t){WS=t.wasm.cwrap(Zl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function ZL(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a,dy:o}=e,{strides:i,pad:l,dilations:u}=r;if(s.dtype!==a.dtype||s.dtype!==o.dtype)throw new Error("Dilation2DBackpropFilter error: x must have the same dtype as filter and dy. Got ".concat(s.dtype,", ").concat(a.dtype,", and ").concat(o.dtype));const c=li(s.shape,a.shape,i,l,"NHWC",u),d=n.makeOutput(a.shape,a.dtype);return WS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(o.dataId).id,n.dataIdMap.get(d.dataId).id,it[s.dtype],c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.filterHeight,c.filterWidth,c.padInfo.top,c.padInfo.left),d}const e9={kernelName:Zl,backendName:"wasm",setupFunc:QL,kernelFunc:ZL};/** 7202 * @license 7203 * Copyright 2023 Google LLC. 7204 * Licensed under the Apache License, Version 2.0 (the "License");
7205 * you may not use this file except in compliance with the License. 7206 * You may obtain a copy of the License at 7207 * 7208 * http://www.apache.org/licenses/LICENSE-2.0 7209 * 7210 * Unless required by applicable law or agreed to in writing, software 7211 * distributed under the License is distributed on an "AS IS" BASIS, 7212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7213 * See the License for the specific language governing permissions and 7214 * limitations under the License. 7215 * ============================================================================= 7216 */let zS;function t9(t){zS=t.wasm.cwrap(Ql,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function n9(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a,dy:o}=e,{strides:i,pad:l,dilations:u}=r;if(s.dtype!==a.dtype||s.dtype!==o.dtype)throw new Error("Dilation2DBackpropInput error: x must have the same dtype as filter and dy. Got ".concat(s.dtype,", ").concat(a.dtype,", and ").concat(o.dtype));const c=li(s.shape,a.shape,i,l,"NHWC",u),d=n.makeOutput(s.shape,s.dtype);return zS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(o.dataId).id,n.dataIdMap.get(d.dataId).id,it[s.dtype],c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.filterHeight,c.filterWidth,c.padInfo.top,c.padInfo.left),d}const r9={kernelName:Ql,backendName:"wasm",setupFunc:t9,kernelFunc:n9};/** 7217 * @license 7218 * Copyright 2021 Google LLC. All Rights Reserved. 7219 * Licensed under the Apache License, Version 2.0 (the "License"); 7220 * you may not use this file except in compliance with the License. 7221 * You may obtain a copy of the License at 7222 * 7223 * http://www.apache.org/licenses/LICENSE-2.0 7224 * 7225 * Unless required by applicable law or agreed to in writing, software 7226 * distributed under the License is distributed on an "AS IS" BASIS, 7227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7228 * See the License for the specific language governing permissions and 7229 * limitations under the License. 7230 * ============================================================================= 7231 */const s9=st(dd);/** 7232 * @license 7233 * Copyright 2023 Google LLC. 7234 * Licensed under the Apache License, Version 2.0 (the "License"); 7235 * you may not use this file except in compliance with the License. 7236 * You may obtain a copy of the License at 7237 * 7238 * http://www.apache.org/licenses/LICENSE-2.0 7239 * 7240 * Unless required by applicable law or agreed to in writing, software 7241 * distributed under the License is distributed on an "AS IS" BASIS, 7242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7243 * See the License for the specific language governing permissions and 7244 * limitations under the License. 7245 * ============================================================================= 7246 */let HS;function a9(t){HS=t.wasm.cwrap(Pm,null,["number","number","number"])}function o9(t){const{inputs:e,backend:n}=t,{dy:r,y:s}=e,a=n.makeOutput(s.shape,"float32"),o=i=>n.dataIdMap.get(i.dataId).id;return HS(o(s),o(r),o(a)),a}const i9={kernelName:Pm,backendName:"wasm",setupFunc:a9,kernelFunc:o9};/** 7247 * @license 7248 * Copyright 2020 Google LLC. All Rights Reserved. 7249 * Licensed under the Apache License, Version 2.0 (the "License"); 7250 * you may not use this file except in compliance with the License. 7251 * You may obtain a copy of the License at 7252 * 7253 * http://www.apache.org/licenses/LICENSE-2.0 7254 * 7255 * Unless required by applicable law or agreed to in writing, software 7256 * distributed under the License is distributed on an "AS IS" BASIS, 7257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7258 * See the License for the specific language governing permissions and 7259 * limitations under the License. 7260 * ============================================================================= 7261 */const c9=!1,l9=nn(pd,c9,"bool");/** 7262 * @license 7263 * Copyright 2023 Google LLC. 7264 * Licensed under the Apache License, Version 2.0 (the "License");
7265 * you may not use this file except in compliance with the License. 7266 * You may obtain a copy of the License at 7267 * 7268 * http://www.apache.org/licenses/LICENSE-2.0 7269 * 7270 * Unless required by applicable law or agreed to in writing, software 7271 * distributed under the License is distributed on an "AS IS" BASIS, 7272 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7273 * See the License for the specific language governing permissions and 7274 * limitations under the License. 7275 * ============================================================================= 7276 */const u9=st(fd);/** 7277 * @license 7278 * Copyright 2019 Google LLC. All Rights Reserved. 7279 * Licensed under the Apache License, Version 2.0 (the "License"); 7280 * you may not use this file except in compliance with the License. 7281 * You may obtain a copy of the License at 7282 * 7283 * http://www.apache.org/licenses/LICENSE-2.0 7284 * 7285 * Unless required by applicable law or agreed to in writing, software 7286 * distributed under the License is distributed on an "AS IS" BASIS, 7287 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7288 * See the License for the specific language governing permissions and 7289 * limitations under the License. 7290 * ============================================================================= 7291 */const d9=st(hd,"float32");/** 7292 * @license 7293 * Copyright 2019 Google LLC. All Rights Reserved. 7294 * Licensed under the Apache License, Version 2.0 (the "License"); 7295 * you may not use this file except in compliance with the License. 7296 * You may obtain a copy of the License at 7297 * 7298 * http://www.apache.org/licenses/LICENSE-2.0 7299 * 7300 * Unless required by applicable law or agreed to in writing, software 7301 * distributed under the License is distributed on an "AS IS" BASIS, 7302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7303 * See the License for the specific language governing permissions and 7304 * limitations under the License. 7305 * ============================================================================= 7306 */function jh(t){const{inputs:e,attrs:n,backend:r}=t,{input:s}=e,{dim:a}=n,o=s.shape.length,i=s.shape.slice();let l=a;return a<0&&(A(-(o+1)<=a,()=>"Axis must be in the interval [".concat(-(o+1),", ").concat(o,"]")),l=o+a+1),i.splice(l,0,1),zn({inputs:{x:s},backend:r,attrs:{shape:i}})}const f9={kernelName:Bm,backendName:"wasm",kernelFunc:jh};/** 7307 * @license 7308 * Copyright 2023 Google LLC. 7309 * Licensed under the Apache License, Version 2.0 (the "License"); 7310 * you may not use this file except in compliance with the License. 7311 * You may obtain a copy of the License at 7312 * 7313 * http://www.apache.org/licenses/LICENSE-2.0 7314 * 7315 * Unless required by applicable law or agreed to in writing, software 7316 * distributed under the License is distributed on an "AS IS" BASIS, 7317 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7318 * See the License for the specific language governing permissions and 7319 * limitations under the License. 7320 * ============================================================================= 7321 */const p9=st(md,"float32");/** 7322 * @license 7323 * Copyright 2020 Google LLC. All Rights Reserved. 7324 * Licensed under the Apache License, Version 2.0 (the "License"); 7325 * you may not use this file except in compliance with the License. 7326 * You may obtain a copy of the License at 7327 * 7328 * http://www.apache.org/licenses/LICENSE-2.0 7329 * 7330 * Unless required by applicable law or agreed to in writing, software 7331 * distributed under the License is distributed on an "AS IS" BASIS, 7332 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7333 * See the License for the specific language governing permissions and 7334 * limitations under the License. 7335 * ============================================================================= 7336 */function US(t){const{attrs:{shape:e,value:n,dtype:r},backend:s}=t,a=s.makeOutput(e,r);return s.typedArrayFromHeap(a).fill(n),a}const h9={kernelName:Lm,backendName:"wasm",kernelFunc:US};/** 7337 * @license 7338 * Copyright 2019 Google LLC. All Rights Reserved. 7339 * Licensed under the Apache License, Version 2.0 (the "License"); 7340 * you may not use this file except in compliance with the License. 7341 * You may obtain a copy of the License at 7342 * 7343 * http://www.apache.org/licenses/LICENSE-2.0 7344 * 7345 * Unless required by applicable law or agreed to in writing, softw
7345are 7346 * distributed under the License is distributed on an "AS IS" BASIS, 7347 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7348 * See the License for the specific language governing permissions and 7349 * limitations under the License. 7350 * ============================================================================= 7351 */let VS;function m9(t){VS=t.wasm.cwrap(gd,null,["number","number","number","number","number","number"])}function g9(t){const{inputs:e,backend:n}=t,{image:r}=e,s=n.makeOutput(r.shape,r.dtype),a=n.dataIdMap.get(r.dataId).id,o=n.dataIdMap.get(s.dataId).id,[i,l,u,c]=r.shape;return VS(a,i,l,u,c,o),s}const y9={kernelName:gd,backendName:"wasm",kernelFunc:g9,setupFunc:m9};/** 7352 * @license 7353 * Copyright 2020 Google LLC. All Rights Reserved. 7354 * Licensed under the Apache License, Version 2.0 (the "License"); 7355 * you may not use this file except in compliance with the License. 7356 * You may obtain a copy of the License at 7357 * 7358 * http://www.apache.org/licenses/LICENSE-2.0 7359 * 7360 * Unless required by applicable law or agreed to in writing, software 7361 * distributed under the License is distributed on an "AS IS" BASIS, 7362 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7363 * See the License for the specific language governing permissions and 7364 * limitations under the License. 7365 * ============================================================================= 7366 */const v9=st(yd);/** 7367 * @license 7368 * Copyright 2019 Google LLC. All Rights Reserved. 7369 * Licensed under the Apache License, Version 2.0 (the "License"); 7370 * you may not use this file except in compliance with the License. 7371 * You may obtain a copy of the License at 7372 * 7373 * http://www.apache.org/licenses/LICENSE-2.0 7374 * 7375 * Unless required by applicable law or agreed to in writing, software 7376 * distributed under the License is distributed on an "AS IS" BASIS, 7377 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7378 * See the License for the specific language governing permissions and 7379 * limitations under the License. 7380 * ============================================================================= 7381 */const b9=nn(vd);/** 7382 * @license 7383 * Copyright 2019 Google LLC. All Rights Reserved. 7384 * Licensed under the Apache License, Version 2.0 (the "License"); 7385 * you may not use this file except in compliance with the License. 7386 * You may obtain a copy of the License at 7387 * 7388 * http://www.apache.org/licenses/LICENSE-2.0 7389 * 7390 * Unless required by applicable law or agreed to in writing, software 7391 * distributed under the License is distributed on an "AS IS" BASIS, 7392 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7393 * See the License for the specific language governing permissions and 7394 * limitations under the License. 7395 * ============================================================================= 7396 */let jS;function w9(t){jS=t.wasm.cwrap(bd,null,["number","number","number","number","number","number","number"])}function S9(t){const{backend:e,inputs:n,attrs:r}=t,{varianceEpsilon:s}=r,{x:a,mean:o,variance:i,offset:l,scale:u}=n,c=e.dataIdMap.get(a.dataId).id,d=e.dataIdMap.get(o.dataId).id,f=e.dataIdMap.get(i.dataId).id,p=l!=null?e.dataIdMap.get(l.dataId).id:0,h=u!=null?e.dataIdMap.get(u.dataId).id:0,m=e.makeOutput(a.shape,a.dtype);if(J(a.shape)===0)return m;const g=e.dataIdMap.get(m.dataId).id;return jS(c,d,f,p,h,s,g),m}const x9={kernelName:bd,backendName:"wasm",setupFunc:w9,kernelFunc:S9};/** 7397 * @license 7398 * Copyright 2019 Google LLC. All Rights Reserved. 7399 * Licensed under the Apache License, Version 2.0 (the "License"); 7400 * you may not use this file except in compliance with the License. 7401 * You may obtain a copy of the License at 7402 * 7403 * http://www.apache.org/licenses/LICENSE-2.0 7404 * 7405 * Unless required by applicable law or agreed to in writing, software 7406 * distributed under the License is distributed on an "AS IS" BASIS, 7407 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7408 * See the License for the specific language governing permissions and 7409 * limitations under the License. 7410 * ============================================================================= 7411 */let GS;function _9(t){GS=t.wasm.cwrap(yc,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function I9(t){const{inputs:e,attrs:n,backend:r}=t,{x:s,filter:a,bias:o,preluActivationWeights:i}=e,{strides:l,pad:u,dilations:c,dataFormat:d,dimRoundingMode:f,activation:p,leakyreluAlpha:h}=n,m=Vn(s.shape,a.shape,l,c,u,f),g=Nc[p];if(g==null)throw new Error("".concat(p," activation not yet supported for FusedConv2D ")+"in the wasm backend.");const v=r.dataIdMap.get(s.dataId).id,b=r.dataIdMap.get(a.dataId).id,w=m.outChannels;let S=0;if(o!=null){const se=r.dataIdMap.get(o.dataId);if(se.shape.length!==1)throw new Error("FusedConv2D only supports rank-1 bias but got "+"rank ".concat(se.shape.length,"."));if(se.shape[0]!==w)throw new Error("FusedConv2D bias shape (".concat(se.shape,") does not ")+"match the number of output channels (".concat(w,")"));S=se.id}
7411const I=m.filterHeight,E=m.filterWidth,T=m.padInfo.top,D=m.padInfo.right,R=m.padInfo.bottom,$=m.padInfo.left,M=m.dilationHeight,B=m.dilationWidth,z=m.strideHeight,H=m.strideWidth,V=m.inChannels,X=m.padInfo.type==="SAME"?1:0,Q=m.batchSize,K=m.inHeight,ee=m.inWidth;if(d!=="NHWC")throw new Error("wasm backend FusedConv2D does not support dataFormat:'"+"".concat(d,"'. Please use 'NHWC'."));const ae=r.makeOutput(m.outShape,"float32"),ne=r.dataIdMap.get(ae.dataId).id,ce=i==null?0:r.dataIdMap.get(i.dataId).id;return GS(v,Q,K,ee,b,I,E,S,T,D,R,$,X,M,B,z,H,V,w,g,ce,h||0,ne),ae}const k9={kernelName:yc,backendName:"wasm",setupFunc:_9,kernelFunc:I9};/** 7412 * @license 7413 * Copyright 2019 Google LLC. All Rights Reserved. 7414 * Licensed under the Apache License, Version 2.0 (the "License"); 7415 * you may not use this file except in compliance with the License. 7416 * You may obtain a copy of the License at 7417 * 7418 * http://www.apache.org/licenses/LICENSE-2.0 7419 * 7420 * Unless required by applicable law or agreed to in writing, software 7421 * distributed under the License is distributed on an "AS IS" BASIS, 7422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7423 * See the License for the specific language governing permissions and 7424 * limitations under the License. 7425 * ============================================================================= 7426 */let qS;function E9(t){qS=t.wasm.cwrap(vc,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function T9(t){const{inputs:e,attrs:n,backend:r}=t,{x:s,filter:a,bias:o,preluActivationWeights:i}=e,{strides:l,pad:u,dilations:c,dataFormat:d,dimRoundingMode:f,activation:p,leakyreluAlpha:h}=n,m=Vn(s.shape,a.shape,l,c,u,f,!0),g=Nc[p];if(g==null)throw new Error("".concat(p," activation not yet supported for FusedDepthwiseConv2D ")+"in the wasm backend.");const v=r.dataIdMap.get(s.dataId).id,b=r.dataIdMap.get(a.dataId).id,w=m.outChannels;let S=0;if(o!=null){const se=r.dataIdMap.get(o.dataId);if(se.shape.length!==1)throw new Error("FusedDepthwiseConv2D only supports rank-1 bias but got "+"rank ".concat(se.shape.length,"."));if(se.shape[0]!==w)throw new Error("FusedDepthwiseConv2D bias shape (".concat(se.shape,") does not ")+"match the number of output channels (".concat(w,")"));S=se.id}const I=m.filterHeight,E=m.filterWidth,T=m.padInfo.top,D=m.padInfo.right,R=m.padInfo.bottom,$=m.padInfo.left,M=m.dilationHeight,B=m.dilationWidth,z=m.strideHeight,H=m.strideWidth,V=m.inChannels,X=m.padInfo.type==="SAME"?1:0,Q=m.batchSize,K=m.inHeight,ee=m.inWidth;if(d!=="NHWC")throw new Error("wasm backend FusedDepthwiseConv2D does not support dataFormat:'"+"".concat(d,"'. Please use 'NHWC'."));const ae=r.makeOutput(m.outShape,"float32"),ne=r.dataIdMap.get(ae.dataId).id,ce=i==null?0:r.dataIdMap.get(i.dataId).id;return qS(v,Q,K,ee,b,I,E,S,T,D,R,$,X,M,B,z,H,V,w,g,ce,h||0,ne),ae}const C9={kernelName:vc,backendName:"wasm",setupFunc:E9,kernelFunc:T9};/** 7427 * @license 7428 * Copyright 2019 Google LLC. All Rights Reserved. 7429 * Licensed under the Apache License, Version 2.0 (the "License"); 7430 * you may not use this file except in compliance with the License. 7431 * You may obtain a copy of the License at 7432 * 7433 * http://www.apache.org/licenses/LICENSE-2.0 7434 * 7435 * Unless required by applicable law or agreed to in writing, software 7436 * distributed under the License is distributed on an "AS IS" BASIS, 7437 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7438 * See the License for the specific language governing permissions and 7439 * limitations under the License. 7440 * ============================================================================= 7441 */let KS;function N9(t){KS=t.wasm.cwrap(wd,null,["number","number","number","number","number","number","array","number"])}function A9(t){const{backend:e,inputs:n}=t,{params:r,indices:s}=n,[a,o,i,l]=x2(r,s),u=e.makeOutput(a,r.dtype);if(o===0)return u;const c=s.shape,d=c[c.length-1],p=e.dataIdMap.get(r.dataId).id,m=e.dataIdMap.get(s.dataId).id,g=new Uint8Array(new Int32Array(l).buffer),v=e.dataIdMap.get(u.dataId).id;return KS(p,it[r.dtype],m,o,d,i,g,v),u}const $9={kernelName:wd,backendName:"wasm",setupFunc:N9,kernelFunc:A9};/** 7442 * @license 7443 * Copyright 2019 Google LLC. All Rights Reserved. 7444 * Licensed under the Apache License, Version 2.0 (the "License");
7445 * you may not use this file except in compliance with the License. 7446 * You may obtain a copy of the License at 7447 * 7448 * http://www.apache.org/licenses/LICENSE-2.0 7449 * 7450 * Unless required by applicable law or agreed to in writing, software 7451 * distributed under the License is distributed on an "AS IS" BASIS, 7452 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7453 * See the License for the specific language governing permissions and 7454 * limitations under the License. 7455 * ============================================================================= 7456 */let XS;function R9(t){XS=t.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function D9(t){const{backend:e,inputs:n,attrs:r}=t,{x:s,indices:a}=n,{axis:o,batchDims:i}=r,l=Vt(o,s.shape)[0],u=e.readSync(a.dataId),c=s.shape[l];for(let R=0;R<u.length;++R){const $=u[R];A($<=c-1&&$>=0,()=>"GatherV2: the index value ".concat($," is not in [0, ").concat(c-1,"]"))}const d=j2(s,a,l,i),f=zn({inputs:{x:s},attrs:{shape:[d.batchSize,d.outerSize,d.dimSize,d.sliceSize]},backend:e}),p=J(a.shape),h=zn({inputs:{x:a},attrs:{shape:[d.batchSize,p/d.batchSize]},backend:e}),m=[d.batchSize,d.outerSize,p/d.batchSize,d.sliceSize],g=e.makeOutput(m,s.dtype);if(J(s.shape)===0)return g;const v=f.shape.length-1,w=e.dataIdMap.get(f.dataId).id,I=e.dataIdMap.get(h.dataId).id,E=e.dataIdMap.get(g.dataId).id,T=new Uint8Array(new Int32Array(Ie(f.shape)).buffer),D=new Uint8Array(new Int32Array(Ie(m)).buffer);return XS(w,it[s.dtype],T,v,I,d.batchSize,D,E),e.disposeData(f.dataId),e.disposeData(h.dataId),g.shape=d.outputShape,g}const F9={kernelName:Wm,backendName:"wasm",setupFunc:R9,kernelFunc:D9};/** 7457 * @license 7458 * Copyright 2019 Google LLC. All Rights Reserved. 7459 * Licensed under the Apache License, Version 2.0 (the "License"); 7460 * you may not use this file except in compliance with the License. 7461 * You may obtain a copy of the License at 7462 * 7463 * http://www.apache.org/licenses/LICENSE-2.0 7464 * 7465 * Unless required by applicable law or agreed to in writing, software 7466 * distributed under the License is distributed on an "AS IS" BASIS, 7467 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7468 * See the License for the specific language governing permissions and 7469 * limitations under the License. 7470 * ============================================================================= 7471 */const M9=!1,O9=nn(Sd,M9,"bool");/** 7472 * @license 7473 * Copyright 2019 Google LLC. All Rights Reserved. 7474 * Licensed under the Apache License, Version 2.0 (the "License"); 7475 * you may not use this file except in compliance with the License. 7476 * You may obtain a copy of the License at 7477 * 7478 * http://www.apache.org/licenses/LICENSE-2.0 7479 * 7480 * Unless required by applicable law or agreed to in writing, software 7481 * distributed under the License is distributed on an "AS IS" BASIS, 7482 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7483 * See the License for the specific language governing permissions and 7484 * limitations under the License. 7485 * ============================================================================= 7486 */const P9=!1,B9=nn(xd,P9,"bool");/** 7487 * @license 7488 * Copyright 2023 Google LLC. 7489 * Licensed under the Apache License, Version 2.0 (the "License"); 7490 * you may not use this file except in compliance with the License. 7491 * You may obtain a copy of the License at 7492 * 7493 * http://www.apache.org/licenses/LICENSE-2.0 7494 * 7495 * Unless required by applicable law or agreed to in writing, software 7496 * distributed under the License is distributed on an "AS IS" BASIS, 7497 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7498 * See the License for the specific language governing permissions and 7499 * limitations under the License. 7500 * ============================================================================= 7501 */const L9=st(Id,"bool");/** 7502 * @license 7503 * Copyright 2023 Google LLC. 7504 * Licensed under the Apache License, Version 2.0 (the "License"); 7505 * you may not use this file except in compliance with the License. 7506 * You may obtain a copy of the License at 7507 * 7508 * http://www.apache.org/licenses/LICENSE-2.0 7509 * 7510 * Unless required by applicable law or agreed to in writing, softw
7510are 7511 * distributed under the License is distributed on an "AS IS" BASIS, 7512 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7513 * See the License for the specific language governing permissions and 7514 * limitations under the License. 7515 * ============================================================================= 7516 */const W9=st(kd,"bool");/** 7517 * @license 7518 * Copyright 2022 The TensorFlow Authors. All Rights Reserved. 7519 * Licensed under the Apache License, Version 2.0 (the License); 7520 * you may not use this file except in compliance with the License. 7521 * You may obtain a copy of the License at 7522 * 7523 * http://www.apache.org/licenses/LICENSE-2.0 7524 * 7525 * Unless required by applicable law or agreed to in writing, software 7526 * distributed under the License is distributed on an AS IS BASIS, 7527 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7528 * See the License for the specific language governing permissions and 7529 * limitations under the License. 7530 * ============================================================================= 7531 */const z9=st(Ed,"bool");/** 7532 * @license 7533 * Copyright 2019 Google LLC. All Rights Reserved. 7534 * Licensed under the Apache License, Version 2.0 (the "License"); 7535 * you may not use this file except in compliance with the License. 7536 * You may obtain a copy of the License at 7537 * 7538 * http://www.apache.org/licenses/LICENSE-2.0 7539 * 7540 * Unless required by applicable law or agreed to in writing, software 7541 * distributed under the License is distributed on an "AS IS" BASIS, 7542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7543 * See the License for the specific language governing permissions and 7544 * limitations under the License. 7545 * ============================================================================= 7546 */let YS;function H9(t){YS=t.wasm.cwrap(Td,null,["number","number","number","number"])}function U9(t){const{inputs:{x:e},attrs:{alpha:n},backend:r}=t,s=r.dataIdMap.get(e.dataId).id,a=r.makeOutput(e.shape,"float32");if(J(e.shape)!==0){const o=r.dataIdMap.get(a.dataId).id;YS(s,it[e.dtype],n,o)}return a}const V9={kernelName:Td,backendName:"wasm",setupFunc:H9,kernelFunc:U9};/** 7547 * @license 7548 * Copyright 2019 Google LLC. All Rights Reserved. 7549 * Licensed under the Apache License, Version 2.0 (the "License"); 7550 * you may not use this file except in compliance with the License. 7551 * You may obtain a copy of the License at 7552 * 7553 * http://www.apache.org/licenses/LICENSE-2.0 7554 * 7555 * Unless required by applicable law or agreed to in writing, software 7556 * distributed under the License is distributed on an "AS IS" BASIS, 7557 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7558 * See the License for the specific language governing permissions and 7559 * limitations under the License. 7560 * ============================================================================= 7561 */const j9=!1,G9=nn(Cd,j9,"bool");/** 7562 * @license 7563 * Copyright 2019 Google LLC. All Rights Reserved. 7564 * Licensed under the Apache License, Version 2.0 (the "License"); 7565 * you may not use this file except in compliance with the License. 7566 * You may obtain a copy of the License at 7567 * 7568 * http://www.apache.org/licenses/LICENSE-2.0 7569 * 7570 * Unless required by applicable law or agreed to in writing, software 7571 * distributed under the License is distributed on an "AS IS" BASIS, 7572 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7573 * See the License for the specific language governing permissions and 7574 * limitations under the License. 7575 * ============================================================================= 7576 */const q9=!1,K9=nn(Nd,q9,"bool");/** 7577 * @license 7578 * Copyright 2023 Google LLC. All Rights Reserved. 7579 * Licensed under the Apache License, Version 2.0 (the "License"); 7580 * you may not use this file except in compliance with the License. 7581 * You may obtain a copy of the License at 7582 * 7583 * http://www.apache.org/licenses/LICENSE-2.0 7584 * 7585 * Unless required by applicable law or agreed to in writing, software 7586 * distributed under the License is distributed on an "AS IS" BASIS, 7587 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7588 * See the License for the specific language governing permissions and 7589 * limitations under the License. 7590 * ============================================================================= 7591 */let JS;function X9(t){JS=t.wasm.cwrap(Ad,null,["number","number","number","number"])}function Y9(t){const{attrs:e,backend:n}=t,{start:r,stop:s,num:a}=e,o=Math.floor(a),i=n.makeOutput([o],"float32");return JS(n.dataIdMap.get(i.dataId).id,r,s,o),i}const J9={kernelName:Ad,backendName:"wasm",setupFunc:X9,kernelFunc:Y9};/** 7592 * @license 7593 * Copyright 2019 Google LLC. All Rights Reserved. 7594 * Licensed under the Apache License, Version 2.0 (the "License");
7595 * you may not use this file except in compliance with the License. 7596 * You may obtain a copy of the License at 7597 * 7598 * http://www.apache.org/licenses/LICENSE-2.0 7599 * 7600 * Unless required by applicable law or agreed to in writing, software 7601 * distributed under the License is distributed on an "AS IS" BASIS, 7602 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7603 * See the License for the specific language governing permissions and 7604 * limitations under the License. 7605 * ============================================================================= 7606 */const Q9=st($d);/** 7607 * @license 7608 * Copyright 2023 Google LLC. 7609 * Licensed under the Apache License, Version 2.0 (the "License"); 7610 * you may not use this file except in compliance with the License. 7611 * You may obtain a copy of the License at 7612 * 7613 * http://www.apache.org/licenses/LICENSE-2.0 7614 * 7615 * Unless required by applicable law or agreed to in writing, software 7616 * distributed under the License is distributed on an "AS IS" BASIS, 7617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7618 * See the License for the specific language governing permissions and 7619 * limitations under the License. 7620 * ============================================================================= 7621 */const Z9=st(Rd);/** 7622 * @license 7623 * Copyright 2019 Google LLC. All Rights Reserved. 7624 * Licensed under the Apache License, Version 2.0 (the "License"); 7625 * you may not use this file except in compliance with the License. 7626 * You may obtain a copy of the License at 7627 * 7628 * http://www.apache.org/licenses/LICENSE-2.0 7629 * 7630 * Unless required by applicable law or agreed to in writing, software 7631 * distributed under the License is distributed on an "AS IS" BASIS, 7632 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7633 * See the License for the specific language governing permissions and 7634 * limitations under the License. 7635 * ============================================================================= 7636 */const eW=!1,tW=nn(Dd,eW,"bool");/** 7637 * @license 7638 * Copyright 2019 Google LLC. All Rights Reserved. 7639 * Licensed under the Apache License, Version 2.0 (the "License"); 7640 * you may not use this file except in compliance with the License. 7641 * You may obtain a copy of the License at 7642 * 7643 * http://www.apache.org/licenses/LICENSE-2.0 7644 * 7645 * Unless required by applicable law or agreed to in writing, software 7646 * distributed under the License is distributed on an "AS IS" BASIS, 7647 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7648 * See the License for the specific language governing permissions and 7649 * limitations under the License. 7650 * ============================================================================= 7651 */const nW=st(Fd);/** 7652 * @license 7653 * Copyright 2019 Google LLC. All Rights Reserved. 7654 * Licensed under the Apache License, Version 2.0 (the "License"); 7655 * you may not use this file except in compliance with the License. 7656 * You may obtain a copy of the License at 7657 * 7658 * http://www.apache.org/licenses/LICENSE-2.0 7659 * 7660 * Unless required by applicable law or agreed to in writing, software 7661 * distributed under the License is distributed on an "AS IS" BASIS, 7662 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7663 * See the License for the specific language governing permissions and 7664 * limitations under the License. 7665 * ============================================================================= 7666 */const rW=!1,sW=nn(Md,rW,"bool");/** 7667 * @license 7668 * Copyright 2019 Google LLC. All Rights Reserved. 7669 * Licensed under the Apache License, Version 2.0 (the "License"); 7670 * you may not use this file except in compliance with the License. 7671 * You may obtain a copy of the License at 7672 * 7673 * http://www.apache.org/licenses/LICENSE-2.0 7674 * 7675 * Unless required by applicable law or agreed to in writing, software 7676 * distributed under the License is distributed on an "AS IS" BASIS, 7677 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7678 * See the License for the specific language governing permissions and 7679 * limitations under the License. 7680 * ============================================================================= 7681 */const aW=!1,oW=nn(QC,aW,"bool");/** 7682 * @license 7683 * Copyright 2023 Google LLC. 7684 * Licensed under the Apache License, Version 2.0 (the "License");
7685 * you may not use this file except in compliance with the License. 7686 * You may obtain a copy of the License at 7687 * 7688 * http://www.apache.org/licenses/LICENSE-2.0 7689 * 7690 * Unless required by applicable law or agreed to in writing, software 7691 * distributed under the License is distributed on an "AS IS" BASIS, 7692 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7693 * See the License for the specific language governing permissions and 7694 * limitations under the License. 7695 * ============================================================================= 7696 */let QS;function iW(t){QS=t.wasm.cwrap(Od,null,["number","number","number","number","number","number","number"])}function cW(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{depthRadius:a,bias:o,alpha:i,beta:l}=r;if(s.dtype!=="float32")throw new Error("LRN error: x must have dtype float32");const u=n.makeOutput(s.shape,s.dtype);return QS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(u.dataId).id,s.shape[3],a,o,i,l),u}const lW={kernelName:Od,backendName:"wasm",setupFunc:iW,kernelFunc:cW};/** 7697 * @license 7698 * Copyright 2023 Google LLC. 7699 * Licensed under the Apache License, Version 2.0 (the "License"); 7700 * you may not use this file except in compliance with the License. 7701 * You may obtain a copy of the License at 7702 * 7703 * http://www.apache.org/licenses/LICENSE-2.0 7704 * 7705 * Unless required by applicable law or agreed to in writing, software 7706 * distributed under the License is distributed on an "AS IS" BASIS, 7707 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7708 * See the License for the specific language governing permissions and 7709 * limitations under the License. 7710 * ============================================================================= 7711 */let ZS;function uW(t){ZS=t.wasm.cwrap(zm,null,["number","number","number","number","number","number","number","number","number"])}function dW(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,y:a,dy:o}=e,{depthRadius:i,bias:l,alpha:u,beta:c}=r;if(s.dtype!=="float32"||a.dtype!=="float32"||o.dtype!=="float32")throw new Error("LRNGrad error: x, y, and dy must have dtype float32");const d=n.makeOutput(s.shape,s.dtype);return ZS(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(o.dataId).id,n.dataIdMap.get(d.dataId).id,o.shape[3],i,l,u,c),d}const fW={kernelName:zm,backendName:"wasm",setupFunc:uW,kernelFunc:dW};/** 7712 * @license 7713 * Copyright 2019 Google LLC. All Rights Reserved. 7714 * Licensed under the Apache License, Version 2.0 (the "License"); 7715 * you may not use this file except in compliance with the License. 7716 * You may obtain a copy of the License at 7717 * 7718 * http://www.apache.org/licenses/LICENSE-2.0 7719 * 7720 * Unless required by applicable law or agreed to in writing, software 7721 * distributed under the License is distributed on an "AS IS" BASIS, 7722 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7723 * See the License for the specific language governing permissions and 7724 * limitations under the License. 7725 * ============================================================================= 7726 */let ex;function pW(t){ex=t.wasm.cwrap(Pd,null,["number","number","number","number"])}function hW(t){const{backend:e,inputs:n,attrs:r}=t,{reductionIndices:s,keepDims:a}=r,{x:o}=n;let l=e.dataIdMap.get(o.dataId).id,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);if(p){const w=e.dataIdMap.get(c.dataId).id;u=c,l=w}const h=u.shape.length;Dn("max",d,h);const[m,g]=Rn(u.shape,d),v=J(g),b=e.makeOutput(m,o.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;ex(l,it[o.dtype],v,w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const mW={kernelName:Pd,backendName:"wasm",setupFunc:pW,kernelFunc:hW};/** 7727 * @license 7728 * Copyright 2019 Google LLC. All Rights Reserved. 7729 * Licensed under the Apache License, Version 2.0 (the "License"); 7730 * you may not use this file except in compliance with the License. 7731 * You may obtain a copy of the License at 7732 * 7733 * http://www.apache.org/licenses/LICENSE-2.0 7734 * 7735 * Unless required by applicable law or agreed to in writing, software 7736 * distributed under the License is distributed on an "AS IS" BASIS, 7737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7738 * See the License for the specific language governing permissions and 7739 * limitations under the License. 7740 * ============================================================================= 7741 */const gW=nn(Bd);/** 7742 * @license 7743 * Copyright 2019 Google LLC. All Rights Reserved. 7744 * Licensed under the Apache License, Version 2.0 (the "License");
7745 * you may not use this file except in compliance with the License. 7746 * You may obtain a copy of the License at 7747 * 7748 * http://www.apache.org/licenses/LICENSE-2.0 7749 * 7750 * Unless required by applicable law or agreed to in writing, software 7751 * distributed under the License is distributed on an "AS IS" BASIS, 7752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7753 * See the License for the specific language governing permissions and 7754 * limitations under the License. 7755 * ============================================================================= 7756 */let tx;function yW(t){tx=t.wasm.cwrap(Ld,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function vW(t){const{inputs:e,attrs:n,backend:r}=t,s=e.x,a=r.dataIdMap.get(s.dataId).id;A(s.dtype==="float32",()=>"Error in MaxPool: only float32 input is supported. Got ".concat(s.dtype,"."));const{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=n,c=Wr(s.shape,o,i,1,l,u),d=c.filterHeight,f=c.filterWidth,p=c.padInfo.top,h=c.padInfo.right,m=c.padInfo.bottom,g=c.padInfo.left,v=c.dilationHeight,b=c.dilationWidth,w=c.strideHeight,S=c.strideWidth,I=c.inChannels,E=c.outChannels;if(c.dataFormat!=="channelsLast")throw new Error("wasm backend does not support dataFormat:'"+"".concat(c.dataFormat,"'. Please use 'channelsLast'."));const T=r.makeOutput(c.outShape,"float32"),D=r.dataIdMap.get(T.dataId).id;return tx(a,s.shape[0],s.shape[1],s.shape[2],d,f,p,h,m,g,v,b,w,S,I,E,D),T}const bW={kernelName:Ld,backendName:"wasm",setupFunc:yW,kernelFunc:vW};/** 7757 * @license 7758 * Copyright 2023 Google LLC. 7759 * Licensed under the Apache License, Version 2.0 (the "License"); 7760 * you may not use this file except in compliance with the License. 7761 * You may obtain a copy of the License at 7762 * 7763 * http://www.apache.org/licenses/LICENSE-2.0 7764 * 7765 * Unless required by applicable law or agreed to in writing, software 7766 * distributed under the License is distributed on an "AS IS" BASIS, 7767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7768 * See the License for the specific language governing permissions and 7769 * limitations under the License. 7770 * ============================================================================= 7771 */let nx;function wW(t){nx=t.wasm.cwrap("MaxPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function SW(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r,c=ia(s.shape,a,o,1,i,l,u),d=n.makeOutput(c.outShape,s.dtype);return nx(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),d}const xW={kernelName:Hm,backendName:"wasm",setupFunc:wW,kernelFunc:SW};/** 7772 * @license 7773 * Copyright 2023 Google LLC. 7774 * Licensed under the Apache License, Version 2.0 (the "License"); 7775 * you may not use this file except in compliance with the License. 7776 * You may obtain a copy of the License at 7777 * 7778 * http://www.apache.org/licenses/LICENSE-2.0 7779 * 7780 * Unless required by applicable law or agreed to in writing, software 7781 * distributed under the License is distributed on an "AS IS" BASIS, 7782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7783 * See the License for the specific language governing permissions and 7784 * limitations under the License. 7785 * ============================================================================= 7786 */let rx;function _W(t){rx=t.wasm.cwrap("MaxPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function IW(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r,c=ia(a.shape,o,i,1,l,u),d=n.makeOutput(a.shape,a.dtype);return rx(n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,c.batchSize,c.inChannels,c.inDepth,c.inHeight,c.inWidth,c.outDepth,c.outHeight,c.outWidth,c.strideDepth,c.strideHeight,c.strideWidth,c.dilationDepth,c.dilationHeight,c.dilationWidth,c.effectiveFilterDepth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.front,c.padInfo.top,c.padInfo.left),d}const kW={kernelName:z1,backendName:"wasm",setupFunc:_W,kernelFunc:IW};/** 7787 * @license 7788 * Copyright 2023 Google LLC. 7789 * Licensed under the Apache License, Version 2.0 (the "License");
7790 * you may not use this file except in compliance with the License. 7791 * You may obtain a copy of the License at 7792 * 7793 * http://www.apache.org/licenses/LICENSE-2.0 7794 * 7795 * Unless required by applicable law or agreed to in writing, software 7796 * distributed under the License is distributed on an "AS IS" BASIS, 7797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7798 * See the License for the specific language governing permissions and 7799 * limitations under the License. 7800 * ============================================================================= 7801 */let sx;function EW(t){sx=t.wasm.cwrap("MaxPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function TW(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r,c=Wr(a.shape,o,i,1,l,u),d=n.makeOutput(a.shape,a.dtype);return sx(n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.top,c.padInfo.left),d}const CW={kernelName:W1,backendName:"wasm",setupFunc:EW,kernelFunc:TW};/** 7802 * @license 7803 * Copyright 2023 Google LLC. 7804 * Licensed under the Apache License, Version 2.0 (the "License"); 7805 * you may not use this file except in compliance with the License. 7806 * You may obtain a copy of the License at 7807 * 7808 * http://www.apache.org/licenses/LICENSE-2.0 7809 * 7810 * Unless required by applicable law or agreed to in writing, software 7811 * distributed under the License is distributed on an "AS IS" BASIS, 7812 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7813 * See the License for the specific language governing permissions and 7814 * limitations under the License. 7815 * ============================================================================= 7816 */let ax;function NW(t){ax=t.wasm.cwrap("MaxPoolWithArgmax",null,["number","number","number","number","boolean","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function AW(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:a,strides:o,pad:i,includeBatchInIndex:l}=r;A(s.shape.length===4,()=>"Error in maxPool: input must be rank 4 but got rank ".concat(s.shape.length,"."));const u=[1,1];A(Tr(o,u),()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(u,"'"));const c=Wr(s.shape,a,o,[1,1],i),d=n.makeOutput(c.outShape,s.dtype),f=n.makeOutput(c.outShape,"int32");return ax(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(d.dataId).id,n.dataIdMap.get(f.dataId).id,it[s.dtype],l,c.batchSize,c.inChannels,c.inHeight,c.inWidth,c.outHeight,c.outWidth,c.strideHeight,c.strideWidth,c.dilationHeight,c.dilationWidth,c.effectiveFilterHeight,c.effectiveFilterWidth,c.padInfo.top,c.padInfo.left),[d,f]}const $W={kernelName:Um,backendName:"wasm",setupFunc:NW,kernelFunc:AW};/** 7817 * @license 7818 * Copyright 2020 Google LLC. All Rights Reserved. 7819 * Licensed under the Apache License, Version 2.0 (the "License"); 7820 * you may not use this file except in compliance with the License. 7821 * You may obtain a copy of the License at 7822 * 7823 * http://www.apache.org/licenses/LICENSE-2.0 7824 * 7825 * Unless required by applicable law or agreed to in writing, software 7826 * distributed under the License is distributed on an "AS IS" BASIS, 7827 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7828 * See the License for the specific language governing permissions and 7829 * limitations under the License. 7830 * ============================================================================= 7831 */let ox;function RW(t){ox=t.wasm.cwrap(Wd,null,["number, number, number"])}function DW(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n,i=e.dataIdMap.get(o.dataId).id;let l=i,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);let h=d;if(p){const S=e.dataIdMap.get(c.dataId).id;S!==i&&(u=c,l=S,h=Fn(h.length,u.shape.length))}Dn("mean",h,u.shape.length);const[m,g]=Rn(u.shape,h),v=J(g);let b=u;
7831u.dtype!=="float32"&&(b=da({backend:e,inputs:{x:u},attrs:{dtype:"float32"}}),l=e.dataIdMap.get(b.dataId).id);const w=e.makeOutput(m,"float32");if(J(u.shape)!==0){const S=e.dataIdMap.get(w.dataId).id;ox(l,v,S)}if(p&&e.disposeData(c.dataId),a){const S=gn(w.shape,f);w.shape=S}return u.dtype!=="float32"&&e.disposeData(b.dataId),w}const FW={kernelName:Wd,backendName:"wasm",setupFunc:RW,kernelFunc:DW};/** 7832 * @license 7833 * Copyright 2019 Google LLC. All Rights Reserved. 7834 * Licensed under the Apache License, Version 2.0 (the "License"); 7835 * you may not use this file except in compliance with the License. 7836 * You may obtain a copy of the License at 7837 * 7838 * http://www.apache.org/licenses/LICENSE-2.0 7839 * 7840 * Unless required by applicable law or agreed to in writing, software 7841 * distributed under the License is distributed on an "AS IS" BASIS, 7842 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7843 * See the License for the specific language governing permissions and 7844 * limitations under the License. 7845 * ============================================================================= 7846 */let ix;function MW(t){ix=t.wasm.cwrap(zd,null,["number","number","number","number"])}function OW(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n,i=e.dataIdMap.get(o.dataId).id;let l=i,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);if(p){const w=e.dataIdMap.get(c.dataId).id;w!==i&&(u=c,l=w)}const h=u.shape.length;Dn("min",d,h);const[m,g]=Rn(u.shape,d),v=J(g),b=e.makeOutput(m,u.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;ix(l,it[o.dtype],v,w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const PW={kernelName:zd,backendName:"wasm",setupFunc:MW,kernelFunc:OW};/** 7847 * @license 7848 * Copyright 2019 Google LLC. All Rights Reserved. 7849 * Licensed under the Apache License, Version 2.0 (the "License"); 7850 * you may not use this file except in compliance with the License. 7851 * You may obtain a copy of the License at 7852 * 7853 * http://www.apache.org/licenses/LICENSE-2.0 7854 * 7855 * Unless required by applicable law or agreed to in writing, software 7856 * distributed under the License is distributed on an "AS IS" BASIS, 7857 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7858 * See the License for the specific language governing permissions and 7859 * limitations under the License. 7860 * ============================================================================= 7861 */const BW=nn(Hd);/** 7862 * @license 7863 * Copyright 2021 Google LLC. All Rights Reserved. 7864 * Licensed under the Apache License, Version 2.0 (the "License"); 7865 * you may not use this file except in compliance with the License. 7866 * You may obtain a copy of the License at 7867 * 7868 * http://www.apache.org/licenses/LICENSE-2.0 7869 * 7870 * Unless required by applicable law or agreed to in writing, software 7871 * distributed under the License is distributed on an "AS IS" BASIS, 7872 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7873 * See the License for the specific language governing permissions and 7874 * limitations under the License. 7875 * ============================================================================= 7876 */var Gh;(function(t){t[t.reflect=0]="reflect",t[t.symmetric=1]="symmetric"})(Gh||(Gh={}));let cx;function LW(t){cx=t.wasm.cwrap(Ud,null,["number","array","number","number","array","array","number","number"])}function WW(t){const{inputs:{x:e},backend:n,attrs:{paddings:r,mode:s}}=t,a=r.map((h,m)=>h[0]+e.shape[m]+h[1]),o=n.dataIdMap.get(e.dataId).id,i=n.makeOutput(a,e.dtype),l=n.dataIdMap.get(i.dataId).id,u=new Uint8Array(new Int32Array(e.shape).buffer),c=r.map(h=>h[0]),d=r.map(h=>h[1]),f=new Uint8Array(new Int32Array(c).buffer),p=new Uint8Array(new Int32Array(d).buffer);return cx(o,u,e.shape.length,it[e.dtype],f,p,Gh[s],l),i}const zW={kernelName:Ud,backendName:"wasm",kernelFunc:WW,setupFunc:LW};/** 7877 * @license 7878 * Copyright 2020 Google LLC. All Rights Reserved. 7879 * Licensed under the Apache License, Version 2.0 (the "License"); 7880 * you may not use this file except in compliance with the License. 7881 * You may obtain a copy of the License at 7882 * 7883 * http://www.apache.org/licenses/LICENSE-2.0 7884 * 7885 * Unless required by applicable law or agreed to in writing, softw
7885are 7886 * distributed under the License is distributed on an "AS IS" BASIS, 7887 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7888 * See the License for the specific language governing permissions and 7889 * limitations under the License. 7890 * ============================================================================= 7891 */let lx;function HW(t){lx=t.wasm.cwrap(xf,null,["number","number","number","number"])}function ux(t){const{backend:e,inputs:{logits:n},attrs:{dim:r}}=t,s=e.dataIdMap.get(n.dataId).id,a=e.makeOutput(n.shape,n.dtype),o=e.dataIdMap.get(a.dataId).id,i=n.shape[r],l=J(n.shape)/i;return J(a.shape)===0||lx(s,o,i,l),a}const UW={kernelName:xf,backendName:"wasm",setupFunc:HW,kernelFunc:ux};/** 7892 * @license 7893 * Copyright 2023 Google LLC. 7894 * Licensed under the Apache License, Version 2.0 (the "License"); 7895 * you may not use this file except in compliance with the License. 7896 * You may obtain a copy of the License at 7897 * 7898 * http://www.apache.org/licenses/LICENSE-2.0 7899 * 7900 * Unless required by applicable law or agreed to in writing, software 7901 * distributed under the License is distributed on an "AS IS" BASIS, 7902 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7903 * See the License for the specific language governing permissions and 7904 * limitations under the License. 7905 * ============================================================================= 7906 */let dx;function VW(t){dx=t.wasm.cwrap(jd,null,["number","number","number","number","number","number"])}function jW(t){const{inputs:e,backend:n,attrs:r}=t,{logits:s}=e,{numSamples:a,seed:o,normalized:i}=r;if(s.dtype!=="float32")throw new Error("Tensor logits must have dtype float32, got ".concat(s.dtype));const l=i?s:ux({inputs:{logits:s},backend:n,attrs:{dim:s.shape.length-1}}),[u,c]=l.shape,d=n.makeOutput([u,a],"int32");return dx(n.dataIdMap.get(l.dataId).id,u,c,a,o,n.dataIdMap.get(d.dataId).id),i||n.disposeData(l.dataId),d}const GW={kernelName:jd,backendName:"wasm",setupFunc:VW,kernelFunc:jW};/** 7907 * @license 7908 * Copyright 2023 Google LLC. 7909 * Licensed under the Apache License, Version 2.0 (the "License"); 7910 * you may not use this file except in compliance with the License. 7911 * You may obtain a copy of the License at 7912 * 7913 * http://www.apache.org/licenses/LICENSE-2.0 7914 * 7915 * Unless required by applicable law or agreed to in writing, software 7916 * distributed under the License is distributed on an "AS IS" BASIS, 7917 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7918 * See the License for the specific language governing permissions and 7919 * limitations under the License. 7920 * ============================================================================= 7921 */const qW=nn(Vd);/** 7922 * @license 7923 * Copyright 2019 Google LLC. All Rights Reserved. 7924 * Licensed under the Apache License, Version 2.0 (the "License"); 7925 * you may not use this file except in compliance with the License. 7926 * You may obtain a copy of the License at 7927 * 7928 * http://www.apache.org/licenses/LICENSE-2.0 7929 * 7930 * Unless required by applicable law or agreed to in writing, software 7931 * distributed under the License is distributed on an "AS IS" BASIS, 7932 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7933 * See the License for the specific language governing permissions and 7934 * limitations under the License. 7935 * ============================================================================= 7936 */const KW=nn(Gd);/** 7937 * @license 7938 * Copyright 2020 Google LLC. All Rights Reserved. 7939 * Licensed under the Apache License, Version 2.0 (the "License"); 7940 * you may not use this file except in compliance with the License. 7941 * You may obtain a copy of the License at 7942 * 7943 * http://www.apache.org/licenses/LICENSE-2.0 7944 * 7945 * Unless required by applicable law or agreed to in writing, software 7946 * distributed under the License is distributed on an "AS IS" BASIS, 7947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7948 * See the License for the specific language governing permissions and 7949 * limitations under the License. 7950 * ============================================================================= 7951 */const XW=st(Vm);/** 7952 * @license 7953 * Copyright 2019 Google LLC. All Rights Reserved. 7954 * Licensed under the Apache License, Version 2.0 (the "License");
7955 * you may not use this file except in compliance with the License. 7956 * You may obtain a copy of the License at 7957 * 7958 * http://www.apache.org/licenses/LICENSE-2.0 7959 * 7960 * Unless required by applicable law or agreed to in writing, software 7961 * distributed under the License is distributed on an "AS IS" BASIS, 7962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7963 * See the License for the specific language governing permissions and 7964 * limitations under the License. 7965 * ============================================================================= 7966 */function Lg(t,e){const n=new Int32Array(t.wasm.HEAPU8.buffer,e,4),r=n[0],s=n[1],a=n[2],o=n[3];return t.wasm._free(e),{pSelectedIndices:r,selectedSize:s,pSelectedScores:a,pValidOutputs:o}}/** 7967 * @license 7968 * Copyright 2019 Google LLC. All Rights Reserved. 7969 * Licensed under the Apache License, Version 2.0 (the "License"); 7970 * you may not use this file except in compliance with the License. 7971 * You may obtain a copy of the License at 7972 * 7973 * http://www.apache.org/licenses/LICENSE-2.0 7974 * 7975 * Unless required by applicable law or agreed to in writing, software 7976 * distributed under the License is distributed on an "AS IS" BASIS, 7977 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7978 * See the License for the specific language governing permissions and 7979 * limitations under the License. 7980 * ============================================================================= 7981 */let fx;function YW(t){fx=t.wasm.cwrap(Kd,"number",["number","number","number","number","number"])}function JW(t){const{backend:e,inputs:n,attrs:r}=t,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o}=r,{boxes:i,scores:l}=n,u=e.dataIdMap.get(i.dataId).id,c=e.dataIdMap.get(l.dataId).id,d=fx(u,c,a,s,o),{pSelectedIndices:f,selectedSize:p,pSelectedScores:h,pValidOutputs:m}=Lg(e,d);return e.wasm._free(h),e.wasm._free(m),e.makeOutput([p],"int32",f)}const QW={kernelName:Kd,backendName:"wasm",setupFunc:YW,kernelFunc:JW};/** 7982 * @license 7983 * Copyright 2020 Google LLC. All Rights Reserved. 7984 * Licensed under the Apache License, Version 2.0 (the "License"); 7985 * you may not use this file except in compliance with the License. 7986 * You may obtain a copy of the License at 7987 * 7988 * http://www.apache.org/licenses/LICENSE-2.0 7989 * 7990 * Unless required by applicable law or agreed to in writing, software 7991 * distributed under the License is distributed on an "AS IS" BASIS, 7992 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7993 * See the License for the specific language governing permissions and 7994 * limitations under the License. 7995 * ============================================================================= 7996 */let px;function ZW(t){px=t.wasm.cwrap(Xd,"number",["number","number","number","number","number","bool"])}function ez(t){const{backend:e,inputs:n,attrs:r}=t,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o,padToMaxOutputSize:i}=r,{boxes:l,scores:u}=n,c=e.dataIdMap.get(l.dataId).id,d=e.dataIdMap.get(u.dataId).id,f=px(c,d,a,s,o,i),{pSelectedIndices:p,selectedSize:h,pSelectedScores:m,pValidOutputs:g}=Lg(e,f);e.wasm._free(m);const v=e.makeOutput([h],"int32",p),b=e.makeOutput([],"int32",g);return[v,b]}const tz={kernelName:Xd,backendName:"wasm",setupFunc:ZW,kernelFunc:ez};/** 7997 * @license 7998 * Copyright 2019 Google LLC. All Rights Reserved. 7999 * Licensed under the Apache License, Version 2.0 (the "License"); 8000 * you may not use this file except in compliance with the License. 8001 * You may obtain a copy of the License at 8002 * 8003 * http://www.apache.org/licenses/LICENSE-2.0 8004 * 8005 * Unless required by applicable law or agreed to in writing, software 8006 * distributed under the License is distributed on an "AS IS" BASIS, 8007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8008 * See the License for the specific language governing permissions and 8009 * limitations under the License. 8010 * ============================================================================= 8011 */let hx;function nz(t){hx=t.wasm.cwrap(Yd,"number",["number","number","number","number","number","number"])}function rz(t){const{backend:e,inputs:n,attrs:r}=t,{iouThreshold:s,maxOutputSize:a,scoreThreshold:o,softNmsSigma:i}=r,{boxes:l,scores:u}=n,c=e.dataIdMap.get(l.dataId).id,d=e.dataIdMap.get(u.dataId).id,f=hx(c,d,a,s,o,i),{pSelectedIndices:p,selectedSize:h,pSelectedScores:m,pValidOutputs:g}=Lg(e,f);e.wasm._free(g);const v=e.makeOutput([h],"int32",p),b=e.makeOutput([h],"float32",m);return[v,b]}const sz={kernelName:Yd,backendName:"wasm",setupFunc:nz,kernelFunc:rz};/** 8012 * @license 8013 * Copyright 2020 Google LLC. All Rights Reserved. 8014 * Licensed under the Apache License, Version 2.0 (the "License");
8015 * you may not use this file except in compliance with the License. 8016 * You may obtain a copy of the License at 8017 * 8018 * http://www.apache.org/licenses/LICENSE-2.0 8019 * 8020 * Unless required by applicable law or agreed to in writing, software 8021 * distributed under the License is distributed on an "AS IS" BASIS, 8022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8023 * See the License for the specific language governing permissions and 8024 * limitations under the License. 8025 * ============================================================================= 8026 */const az=!1,oz=nn(qd,az,"bool");/** 8027 * @license 8028 * Copyright 2020 Google LLC. All Rights Reserved. 8029 * Licensed under the Apache License, Version 2.0 (the "License"); 8030 * you may not use this file except in compliance with the License. 8031 * You may obtain a copy of the License at 8032 * 8033 * http://www.apache.org/licenses/LICENSE-2.0 8034 * 8035 * Unless required by applicable law or agreed to in writing, software 8036 * distributed under the License is distributed on an "AS IS" BASIS, 8037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8038 * See the License for the specific language governing permissions and 8039 * limitations under the License. 8040 * ============================================================================= 8041 */let mx;function iz(t){mx=t.wasm.cwrap(Jd,null,["number","number","number","number","number"])}function cz(t){const{inputs:e,backend:n,attrs:r}=t,{indices:s}=e,{dtype:a,depth:o,onValue:i,offValue:l}=r,u=n.makeOutput([...s.shape,o],a),c=n.dataIdMap.get(u.dataId).id,f=n.dataIdMap.get(s.dataId).id;return mx(f,o,i,l,c),u}const lz={kernelName:Jd,backendName:"wasm",setupFunc:iz,kernelFunc:cz};/** 8042 * @license 8043 * Copyright 2020 Google LLC. All Rights Reserved. 8044 * Licensed under the Apache License, Version 2.0 (the "License"); 8045 * you may not use this file except in compliance with the License. 8046 * You may obtain a copy of the License at 8047 * 8048 * http://www.apache.org/licenses/LICENSE-2.0 8049 * 8050 * Unless required by applicable law or agreed to in writing, software 8051 * distributed under the License is distributed on an "AS IS" BASIS, 8052 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8053 * See the License for the specific language governing permissions and 8054 * limitations under the License. 8055 * ============================================================================= 8056 */function uz(t){const{inputs:{x:e},backend:n}=t,r=n.makeOutput(e.shape,e.dtype);return n.typedArrayFromHeap(r).fill(1),r}const dz={kernelName:jm,backendName:"wasm",kernelFunc:uz};/** 8057 * @license 8058 * Copyright 2020 Google LLC. All Rights Reserved. 8059 * Licensed under the Apache License, Version 2.0 (the "License"); 8060 * you may not use this file except in compliance with the License. 8061 * You may obtain a copy of the License at 8062 * 8063 * http://www.apache.org/licenses/LICENSE-2.0 8064 * 8065 * Unless required by applicable law or agreed to in writing, software 8066 * distributed under the License is distributed on an "AS IS" BASIS, 8067 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8068 * See the License for the specific language governing permissions and 8069 * limitations under the License. 8070 * ============================================================================= 8071 */function fz(t){const{inputs:e,backend:n,attrs:r}=t,{axis:s}=r;if(e.length===1)return jh({inputs:{input:e[0]},backend:n,attrs:{dim:s}});const a=e[0].shape,o=e[0].dtype;e.forEach(c=>{tr(a,c.shape,"All tensors passed to stack must have matching shapes"),A(o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});const i=[],l=e.map(c=>{const d=jh({inputs:{input:c},backend:n,attrs:{dim:s}});return i.push(d),d}),u=ES({inputs:l,backend:n,attrs:{axis:s}});return i.forEach(c=>n.disposeData(c.dataId)),u}const pz={kernelName:Gm,backendName:"wasm",kernelFunc:fz};/** 8072 * @license 8073 * Copyright 2019 Google LLC. All Rights Reserved. 8074 * Licensed under the Apache License, Version 2.0 (the "License"); 8075 * you may not use this file except in compliance with the License. 8076 * You may obtain a copy of the License at 8077 * 8078 * http://www.apache.org/licenses/LICENSE-2.0 8079 * 8080 * Unless required by applicable law or agreed to in writing, softw
8080are 8081 * distributed under the License is distributed on an "AS IS" BASIS, 8082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8083 * See the License for the specific language governing permissions and 8084 * limitations under the License. 8085 * ============================================================================= 8086 */let gx;function hz(t){gx=t.wasm.cwrap(Qd,null,["number","array","number","number","array","array","number","number"])}function mz(t){const{inputs:{x:e},backend:n,attrs:{paddings:r,constantValue:s}}=t,a=r.map((m,g)=>m[0]+e.shape[g]+m[1]);if(J(e.shape)===0)return US({backend:n,attrs:{shape:a,value:s,dtype:e.dtype}});const o=n.dataIdMap.get(e.dataId).id,i=n.makeOutput(a,e.dtype),u=n.dataIdMap.get(i.dataId).id,c=new Uint8Array(new Int32Array(e.shape).buffer),d=r.map(m=>m[0]),f=r.map(m=>m[1]),p=new Uint8Array(new Int32Array(d).buffer),h=new Uint8Array(new Int32Array(f).buffer);return gx(o,c,e.shape.length,it[e.dtype],p,h,s,u),i}const yx={kernelName:Qd,backendName:"wasm",kernelFunc:mz,setupFunc:hz};/** 8087 * @license 8088 * Copyright 2019 Google LLC. All Rights Reserved. 8089 * Licensed under the Apache License, Version 2.0 (the "License"); 8090 * you may not use this file except in compliance with the License. 8091 * You may obtain a copy of the License at 8092 * 8093 * http://www.apache.org/licenses/LICENSE-2.0 8094 * 8095 * Unless required by applicable law or agreed to in writing, software 8096 * distributed under the License is distributed on an "AS IS" BASIS, 8097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8098 * See the License for the specific language governing permissions and 8099 * limitations under the License. 8100 * ============================================================================= 8101 */const gz=nn(Zd);/** 8102 * @license 8103 * Copyright 2019 Google LLC. All Rights Reserved. 8104 * Licensed under the Apache License, Version 2.0 (the "License"); 8105 * you may not use this file except in compliance with the License. 8106 * You may obtain a copy of the License at 8107 * 8108 * http://www.apache.org/licenses/LICENSE-2.0 8109 * 8110 * Unless required by applicable law or agreed to in writing, software 8111 * distributed under the License is distributed on an "AS IS" BASIS, 8112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8113 * See the License for the specific language governing permissions and 8114 * limitations under the License. 8115 * ============================================================================= 8116 */let vx;function yz(t){vx=t.wasm.cwrap(ef,null,["number","number","number"])}function vz(t){const{inputs:e,backend:n}=t,{x:r,alpha:s}=e,a=n.dataIdMap.get(r.dataId).id,o=n.dataIdMap.get(s.dataId).id;let i=a;const l=r;let u=l;l.dtype!=="float32"&&(u=da({backend:n,inputs:{x:r},attrs:{dtype:"float32"}}),i=n.dataIdMap.get(u.dataId).id);const c=n.makeOutput(r.shape,"float32"),d=n.dataIdMap.get(c.dataId).id;return vx(i,o,d),l.dtype!=="float32"&&n.disposeData(u.dataId),c}const bz={kernelName:ef,backendName:"wasm",setupFunc:yz,kernelFunc:vz};/** 8117 * @license 8118 * Copyright 2020 Google LLC. All Rights Reserved. 8119 * Licensed under the Apache License, Version 2.0 (the "License"); 8120 * you may not use this file except in compliance with the License. 8121 * You may obtain a copy of the License at 8122 * 8123 * http://www.apache.org/licenses/LICENSE-2.0 8124 * 8125 * Unless required by applicable law or agreed to in writing, software 8126 * distributed under the License is distributed on an "AS IS" BASIS, 8127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8128 * See the License for the specific language governing permissions and 8129 * limitations under the License. 8130 * ============================================================================= 8131 */let bx;function wz(t){bx=t.wasm.cwrap(tf,null,["number","number","number","number"])}function Sz(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n,i=e.dataIdMap.get(o.dataId).id;let l=i,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);let h=d;if(p){const w=e.dataIdMap.get(c.dataId).id;w!==i&&(u=c,l=w,h=Fn(h.length,u.shape.length))}Dn("prod",h,u.shape.length);const[m,g]=Rn(u.shape,h),v=J(g),b=e.makeOutput(m,u.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;bx(l,v,it[b.dtype],w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const xz={kernelName:tf,backendName:"wasm",setupFunc:wz,kernelFunc:Sz};/** 8132 * @license 8133 * Copyright 2020 Google LLC. All Rights Reserved. 8134 * Licensed under the Apache License, Version 2.0 (the "License");
8135 * you may not use this file except in compliance with the License. 8136 * You may obtain a copy of the License at 8137 * 8138 * http://www.apache.org/licenses/LICENSE-2.0 8139 * 8140 * Unless required by applicable law or agreed to in writing, software 8141 * distributed under the License is distributed on an "AS IS" BASIS, 8142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8143 * See the License for the specific language governing permissions and 8144 * limitations under the License. 8145 * ============================================================================= 8146 */const _z=t=>{const{backend:e,attrs:n}=t,{start:r,stop:s,step:a,dtype:o}=n,i=gS(r,s,a,o),l=e.makeOutput([i.length],o);return e.typedArrayFromHeap(l).set(i),l},Iz={kernelName:qm,backendName:"wasm",kernelFunc:_z};/** 8147 * @license 8148 * Copyright 2019 Google LLC. All Rights Reserved. 8149 * Licensed under the Apache License, Version 2.0 (the "License"); 8150 * you may not use this file except in compliance with the License. 8151 * You may obtain a copy of the License at 8152 * 8153 * http://www.apache.org/licenses/LICENSE-2.0 8154 * 8155 * Unless required by applicable law or agreed to in writing, software 8156 * distributed under the License is distributed on an "AS IS" BASIS, 8157 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8158 * See the License for the specific language governing permissions and 8159 * limitations under the License. 8160 * ============================================================================= 8161 */const kz=nn(ud);/** 8162 * @license 8163 * Copyright 2022 The TensorFlow Authors. All Rights Reserved. 8164 * Licensed under the Apache License, Version 2.0 (the "License"); 8165 * you may not use this file except in compliance with the License. 8166 * You may obtain a copy of the License at 8167 * 8168 * http://www.apache.org/licenses/LICENSE-2.0 8169 * 8170 * Unless required by applicable law or agreed to in writing, software 8171 * distributed under the License is distributed on an "AS IS" BASIS, 8172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8173 * See the License for the specific language governing permissions and 8174 * limitations under the License. 8175 * ============================================================================= 8176 */const Ez=st(nf);/** 8177 * @license 8178 * Copyright 2019 Google LLC. All Rights Reserved. 8179 * Licensed under the Apache License, Version 2.0 (the "License"); 8180 * you may not use this file except in compliance with the License. 8181 * You may obtain a copy of the License at 8182 * 8183 * http://www.apache.org/licenses/LICENSE-2.0 8184 * 8185 * Unless required by applicable law or agreed to in writing, software 8186 * distributed under the License is distributed on an "AS IS" BASIS, 8187 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8188 * See the License for the specific language governing permissions and 8189 * limitations under the License. 8190 * ============================================================================= 8191 */const Tz=st(rf);/** 8192 * @license 8193 * Copyright 2019 Google LLC. All Rights Reserved. 8194 * Licensed under the Apache License, Version 2.0 (the "License"); 8195 * you may not use this file except in compliance with the License. 8196 * You may obtain a copy of the License at 8197 * 8198 * http://www.apache.org/licenses/LICENSE-2.0 8199 * 8200 * Unless required by applicable law or agreed to in writing, software 8201 * distributed under the License is distributed on an "AS IS" BASIS, 8202 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8203 * See the License for the specific language governing permissions and 8204 * limitations under the License. 8205 * ============================================================================= 8206 */const Cz=st(of);/** 8207 * @license 8208 * Copyright 2019 Google LLC. All Rights Reserved. 8209 * Licensed under the Apache License, Version 2.0 (the "License"); 8210 * you may not use this file except in compliance with the License. 8211 * You may obtain a copy of the License at 8212 * 8213 * http://www.apache.org/licenses/LICENSE-2.0 8214 * 8215 * Unless required by applicable law or agreed to in writing, software 8216 * distributed under the License is distributed on an "AS IS" BASIS, 8217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8218 * See the License for the specific language governing permissions and 8219 * limitations under the License. 8220 * ============================================================================= 8221 */let wx;function Nz(t){wx=t.wasm.cwrap(af,null,["number","number","number","number","number","number","number","number","number","number"])}
vendor: 4,733 bytes, lines 8221-8269
8221function Az(t){const{backend:e,inputs:n,attrs:r}=t,{images:s}=n,{alignCorners:a,halfPixelCenters:o,size:i}=r,[l,u]=i,[c,d,f,p]=s.shape,h=[c,l,u,p];let m=e.dataIdMap.get(s.dataId),g;m.dtype!=="float32"&&(g=da({backend:e,inputs:{x:s},attrs:{dtype:"float32"}}),m=e.dataIdMap.get(g.dataId));const v=m.id,b=e.makeOutput(h,"float32");if(J(s.shape)===0)return b;const w=e.dataIdMap.get(b.dataId).id;return wx(v,c,d,f,p,l,u,a?1:0,o?1:0,w),g!=null&&e.disposeData(g.dataId),b}const $z={kernelName:af,backendName:"wasm",setupFunc:Nz,kernelFunc:Az};/** 8222 * @license 8223 * Copyright 2023 Google LLC. 8224 * Licensed under the Apache License, Version 2.0 (the "License"); 8225 * you may not use this file except in compliance with the License. 8226 * You may obtain a copy of the License at 8227 * 8228 * http://www.apache.org/licenses/LICENSE-2.0 8229 * 8230 * Unless required by applicable law or agreed to in writing, software 8231 * distributed under the License is distributed on an "AS IS" BASIS, 8232 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8233 * See the License for the specific language governing permissions and 8234 * limitations under the License. 8235 * ============================================================================= 8236 */let Sx;function Rz(t){Sx=t.wasm.cwrap(Ym,null,["number","number","number","array","array","boolean"])}function Dz(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:a}=e,{alignCorners:o}=r,i=n.makeOutput(s.shape,"float32");let l=n.dataIdMap.get(s.dataId),u;return l.dtype!=="float32"&&(u=da({backend:n,inputs:{x:s},attrs:{dtype:"float32"}}),l=n.dataIdMap.get(u.dataId)),Sx(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(i.dataId).id,new Uint8Array(new Int32Array(s.shape).buffer),new Uint8Array(new Int32Array(a.shape).buffer),o),u!=null&&n.disposeData(u.dataId),i}const Fz={kernelName:Ym,backendName:"wasm",setupFunc:Rz,kernelFunc:Dz};/** 8237 * @license 8238 * Copyright 2019 Google LLC. All Rights Reserved. 8239 * Licensed under the Apache License, Version 2.0 (the 'License'); 8240 * you may not use this file except in compliance with the License. 8241 * You may obtain a copy of the License at 8242 * 8243 * http://www.apache.org/licenses/LICENSE-2.0 8244 * 8245 * Unless required by applicable law or agreed to in writing, software 8246 * distributed under the License is distributed on an 'AS IS' BASIS, 8247 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8248 * See the License for the specific language governing permissions and 8249 * limitations under the License. 8250 * ============================================================================= 8251 */let xx;function Mz(t){xx=t.wasm.cwrap(sf,null,["number","number","number","number","number","number","number","number","number","number"])}function Oz(t){const{backend:e,inputs:n,attrs:r}=t,{images:s}=n,{alignCorners:a,halfPixelCenters:o,size:i}=r,[l,u]=i,[c,d,f,p]=s.shape,h=[c,l,u,p],m=e.makeOutput(h,"float32");if(J(s.shape)===0)return m;let g=e.dataIdMap.get(s.dataId),v;g.dtype!=="float32"&&(v=da({backend:e,inputs:{x:s},attrs:{dtype:"float32"}}),g=e.dataIdMap.get(v.dataId));const b=g.id,w=e.dataIdMap.get(m.dataId).id;return xx(b,c,d,f,p,l,u,a?1:0,o?1:0,w),v!=null&&e.disposeData(v.dataId),m}const Pz={kernelName:sf,backendName:"wasm",setupFunc:Mz,kernelFunc:Oz};/** 8252 * @license 8253 * Copyright 2023 Google LLC. 8254 * Licensed under the Apache License, Version 2.0 (the "License"); 8255 * you may not use this file except in compliance with the License. 8256 * You may obtain a copy of the License at 8257 * 8258 * http://www.apache.org/licenses/LICENSE-2.0 8259 * 8260 * Unless required by applicable law or agreed to in writing, software 8261 * distributed under the License is distributed on an "AS IS" BASIS, 8262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8263 * See the License for the specific language governing permissions and 8264 * limitations under the License. 8265 * ============================================================================= 8266 */let _x;function Bz(t){_x=t.wasm.cwrap(Xm,null,["number","number","number","array","array","boolean"])}function Lz(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:a}=e,{alignCorners:o}=r,i=n.makeOutput(s.shape,"float32");let l=n.dataIdMap.get(s.dataId),u;return l.dtype!=="float32"&&(u=da({backend:n,inputs:{x:s},attrs:{dtype:"float32"}}),l=n.dataIdMap.get(u.dataId)),_x(n.dataIdMap.get(s.dataId).id,n.dataIdMap.get(a.dataId).id,n.dataIdMap.get(i.dataId).id,new Uint8Array(new Int32Array(s.shape).buffer),new Uint8Array(new Int32Array(a.shape).buffer),o),u!=null&&n.disposeData(u.dataId),i}const Wz={kernelName:Xm,backendName:"wasm",setupFunc:Bz,kernelFunc:Lz};/** 8267 * @license 8268 * Copyright 2020 Google LLC. All Rights Reserved. 8269 * Licensed under the Apache License, Version 2.0 (the "License");
8270 * you may not use this file except in compliance with the License. 8271 * You may obtain a copy of the License at 8272 * 8273 * http://www.apache.org/licenses/LICENSE-2.0 8274 * 8275 * Unless required by applicable law or agreed to in writing, software 8276 * distributed under the License is distributed on an "AS IS" BASIS, 8277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8278 * See the License for the specific language governing permissions and 8279 * limitations under the License. 8280 * ============================================================================= 8281 */let Ix;function zz(t){Ix=t.wasm.cwrap(cf,null,["number","array","number","array","number","number"])}function Hz(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{dims:a}=r,o=Vt(a,s.shape);if(s.shape.length===0)return Gf({inputs:{x:s},backend:n});const i=n.makeOutput(s.shape,s.dtype),l=n.dataIdMap.get(s.dataId).id,u=n.dataIdMap.get(i.dataId).id,c=new Uint8Array(new Int32Array(o).buffer),d=new Uint8Array(new Int32Array(s.shape).buffer);Ix(l,c,o.length,d,s.shape.length,u);const f=zn({inputs:{x:i},attrs:{shape:s.shape},backend:n});return n.disposeData(i.dataId),f}const Uz={kernelName:cf,backendName:"wasm",kernelFunc:Hz,setupFunc:zz};/** 8282 * @license 8283 * Copyright 2019 Google LLC. All Rights Reserved. 8284 * Licensed under the Apache License, Version 2.0 (the "License"); 8285 * you may not use this file except in compliance with the License. 8286 * You may obtain a copy of the License at 8287 * 8288 * http://www.apache.org/licenses/LICENSE-2.0 8289 * 8290 * Unless required by applicable law or agreed to in writing, software 8291 * distributed under the License is distributed on an "AS IS" BASIS, 8292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8293 * See the License for the specific language governing permissions and 8294 * limitations under the License. 8295 * ============================================================================= 8296 */let kx;function Vz(t){kx=t.wasm.cwrap(Rf,null,["number","number","number","number","number","number","number","number","array","number","number"])}function jz(t){const{inputs:e,backend:n,attrs:r}=t,{image:s}=e,{radians:a,fillValue:o,center:i}=r,l=n.makeOutput(s.shape,s.dtype),u=n.dataIdMap.get(s.dataId).id,c=n.dataIdMap.get(l.dataId).id,[d,f,p,h]=s.shape,[m,g]=N2(i,f,p),v=o===0,b=255,w=typeof o=="number"?[o,o,o,v?0:b]:[...o,b],S=new Uint8Array(new Int32Array(w).buffer);return kx(u,d,f,p,h,a,m,g,S,w.length,c),l}const Gz={kernelName:Rf,backendName:"wasm",kernelFunc:jz,setupFunc:Vz};/** 8297 * @license 8298 * Copyright 2021 Google LLC. All Rights Reserved. 8299 * Licensed under the Apache License, Version 2.0 (the "License"); 8300 * you may not use this file except in compliance with the License. 8301 * You may obtain a copy of the License at 8302 * 8303 * http://www.apache.org/licenses/LICENSE-2.0 8304 * 8305 * Unless required by applicable law or agreed to in writing, software 8306 * distributed under the License is distributed on an "AS IS" BASIS, 8307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8308 * See the License for the specific language governing permissions and 8309 * limitations under the License. 8310 * ============================================================================= 8311 */const qz=st(lf);/** 8312 * @license 8313 * Copyright 2019 Google LLC. All Rights Reserved. 8314 * Licensed under the Apache License, Version 2.0 (the "License"); 8315 * you may not use this file except in compliance with the License. 8316 * You may obtain a copy of the License at 8317 * 8318 * http://www.apache.org/licenses/LICENSE-2.0 8319 * 8320 * Unless required by applicable law or agreed to in writing, software 8321 * distributed under the License is distributed on an "AS IS" BASIS, 8322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8323 * See the License for the specific language governing permissions and 8324 * limitations under the License. 8325 * ============================================================================= 8326 */const Kz=st(uf);/** 8327 * @license 8328 * Copyright 2019 Google LLC. All Rights Reserved. 8329 * Licensed under the Apache License, Version 2.0 (the "License"); 8330 * you may not use this file except in compliance with the License. 8331 * You may obtain a copy of the License at 8332 * 8333 * http://www.apache.org/licenses/LICENSE-2.0 8334 * 8335 * Unless required by applicable law or agreed to in writing, softw
8335are 8336 * distributed under the License is distributed on an "AS IS" BASIS, 8337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8338 * See the License for the specific language governing permissions and 8339 * limitations under the License. 8340 * ============================================================================= 8341 */let Ex;function Xz(t){Ex=t.wasm.cwrap(df,null,["number","number","number","number","number","number","array","number","number"])}function Yz(t){const{backend:e,inputs:n,attrs:r}=t,{indices:s,updates:a}=n,{shape:o}=r,i=e.makeOutput(o,a.dtype);if(J(o)===0)return i;const{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:f}=di(a,s,o),h=e.dataIdMap.get(s.dataId).id,g=e.dataIdMap.get(a.dataId).id,v=new Uint8Array(new Int32Array(d).buffer),b=e.dataIdMap.get(i.dataId).id;return Ex(h,g,it[a.dtype],l,u,c,v,f,b),i}const Jz={kernelName:df,backendName:"wasm",setupFunc:Xz,kernelFunc:Yz};/** 8342 * @license 8343 * Copyright 2023 Google LLC. 8344 * Licensed under the Apache License, Version 2.0 (the "License"); 8345 * you may not use this file except in compliance with the License. 8346 * You may obtain a copy of the License at 8347 * 8348 * http://www.apache.org/licenses/LICENSE-2.0 8349 * 8350 * Unless required by applicable law or agreed to in writing, software 8351 * distributed under the License is distributed on an "AS IS" BASIS, 8352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8353 * See the License for the specific language governing permissions and 8354 * limitations under the License. 8355 * ============================================================================= 8356 */let Tx;function Qz(t){Tx=t.wasm.cwrap(pf,null,["number","number","number","number","number","number","bool","number"])}function Zz(t){const{inputs:e,backend:n,attrs:r}=t,{sortedSequence:s,values:a}=e,{side:o}=r;if(s.dtype!==a.dtype)throw new Error("SearchSorted error: sorted_sequence must have the same dtype as values. Got ".concat(s.dtype," and ").concat(a.dtype));const i=n.makeOutput(a.shape,"int32");function l(u){return n.dataIdMap.get(u.dataId).id}return Tx(l(s),l(a),s.shape[0],s.shape[1],a.shape[1],it[s.dtype],o==="left",l(i)),i}const eH={kernelName:pf,backendName:"wasm",setupFunc:Qz,kernelFunc:Zz};/** 8357 * @license 8358 * Copyright 2020 Google LLC. All Rights Reserved. 8359 * Licensed under the Apache License, Version 2.0 (the "License"); 8360 * you may not use this file except in compliance with the License. 8361 * You may obtain a copy of the License at 8362 * 8363 * http://www.apache.org/licenses/LICENSE-2.0 8364 * 8365 * Unless required by applicable law or agreed to in writing, software 8366 * distributed under the License is distributed on an "AS IS" BASIS, 8367 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8368 * See the License for the specific language governing permissions and 8369 * limitations under the License. 8370 * ============================================================================= 8371 */let Cx;function tH(t){Cx=t.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function nH(t){const{inputs:e,backend:n}=t,{condition:r,t:s,e:a}=e,o=n.dataIdMap.get(r.dataId).id,i=n.dataIdMap.get(s.dataId).id,l=n.dataIdMap.get(a.dataId).id,u=n.makeOutput(s.shape,s.dtype),c=n.dataIdMap.get(u.dataId).id,d=r.shape.length,f=s.shape.length,p=d===0||d>1||f===1?1:J(s.shape.slice(1));return Cx(o,i,l,p,c),u}const rH={kernelName:Jm,backendName:"wasm",kernelFunc:nH,setupFunc:tH};/** 8372 * @license 8373 * Copyright 2023 Google LLC. 8374 * Licensed under the Apache License, Version 2.0 (the "License"); 8375 * you may not use this file except in compliance with the License. 8376 * You may obtain a copy of the License at 8377 * 8378 * http://www.apache.org/licenses/LICENSE-2.0 8379 * 8380 * Unless required by applicable law or agreed to in writing, software 8381 * distributed under the License is distributed on an "AS IS" BASIS, 8382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8383 * See the License for the specific language governing permissions and 8384 * limitations under the License. 8385 * ============================================================================= 8386 */const sH=st(hf);/** 8387 * @license 8388 * Copyright 2019 Google LLC. All Rights Reserved. 8389 * Licensed under the Apache License, Version 2.0 (the "License");
8390 * you may not use this file except in compliance with the License. 8391 * You may obtain a copy of the License at 8392 * 8393 * http://www.apache.org/licenses/LICENSE-2.0 8394 * 8395 * Unless required by applicable law or agreed to in writing, software 8396 * distributed under the License is distributed on an "AS IS" BASIS, 8397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8398 * See the License for the specific language governing permissions and 8399 * limitations under the License. 8400 * ============================================================================= 8401 */let Nx;function aH(t){Nx=t.wasm.cwrap(vf,null,["number","number"])}function oH(t){const{backend:e,inputs:{x:n}}=t,r=e.dataIdMap.get(n.dataId).id,s=e.makeOutput(n.shape,n.dtype),a=e.dataIdMap.get(s.dataId).id;return J(s.shape)===0||Nx(r,a),s}const iH={kernelName:"Sigmoid",backendName:"wasm",setupFunc:aH,kernelFunc:oH};/** 8402 * @license 8403 * Copyright 2023 Google LLC. 8404 * Licensed under the Apache License, Version 2.0 (the "License"); 8405 * you may not use this file except in compliance with the License. 8406 * You may obtain a copy of the License at 8407 * 8408 * http://www.apache.org/licenses/LICENSE-2.0 8409 * 8410 * Unless required by applicable law or agreed to in writing, software 8411 * distributed under the License is distributed on an "AS IS" BASIS, 8412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8413 * See the License for the specific language governing permissions and 8414 * limitations under the License. 8415 * ============================================================================= 8416 */const cH=st(yf);/** 8417 * @license 8418 * Copyright 2019 Google LLC. All Rights Reserved. 8419 * Licensed under the Apache License, Version 2.0 (the "License"); 8420 * you may not use this file except in compliance with the License. 8421 * You may obtain a copy of the License at 8422 * 8423 * http://www.apache.org/licenses/LICENSE-2.0 8424 * 8425 * Unless required by applicable law or agreed to in writing, software 8426 * distributed under the License is distributed on an "AS IS" BASIS, 8427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8428 * See the License for the specific language governing permissions and 8429 * limitations under the License. 8430 * ============================================================================= 8431 */const lH=st(mf);/** 8432 * @license 8433 * Copyright 2023 Google LLC. 8434 * Licensed under the Apache License, Version 2.0 (the "License"); 8435 * you may not use this file except in compliance with the License. 8436 * You may obtain a copy of the License at 8437 * 8438 * http://www.apache.org/licenses/LICENSE-2.0 8439 * 8440 * Unless required by applicable law or agreed to in writing, software 8441 * distributed under the License is distributed on an "AS IS" BASIS, 8442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8443 * See the License for the specific language governing permissions and 8444 * limitations under the License. 8445 * ============================================================================= 8446 */const uH=st(gf);/** 8447 * @license 8448 * Copyright 2023 Google LLC. 8449 * Licensed under the Apache License, Version 2.0 (the "License"); 8450 * you may not use this file except in compliance with the License. 8451 * You may obtain a copy of the License at 8452 * 8453 * http://www.apache.org/licenses/LICENSE-2.0 8454 * 8455 * Unless required by applicable law or agreed to in writing, software 8456 * distributed under the License is distributed on an "AS IS" BASIS, 8457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8458 * See the License for the specific language governing permissions and 8459 * limitations under the License. 8460 * ============================================================================= 8461 */const dH=st(bf);/** 8462 * @license 8463 * Copyright 2021 Google LLC. All Rights Reserved. 8464 * Licensed under the Apache License, Version 2.0 (the "License"); 8465 * you may not use this file except in compliance with the License. 8466 * You may obtain a copy of the License at 8467 * 8468 * http://www.apache.org/licenses/LICENSE-2.0 8469 * 8470 * Unless required by applicable law or agreed to in writing, software 8471 * distributed under the License is distributed on an "AS IS" BASIS, 8472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8473 * See the License for the specific language governing permissions and 8474 * limitations under the License. 8475 * ============================================================================= 8476 */function fH(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}
8476=e,{blockShape:a,paddings:o}=r,i=J(a),l=[[0,0]];l.push(...o);for(let E=1+a.length;E<s.shape.length;++E)l.push([0,0]);const u=yx.kernelFunc({inputs:{x:s},backend:n,attrs:{paddings:l,constantValue:0}}),c=Uf(u.shape,a,i,!1),d=Vf(c.length,a.length,!1),f=jf(u.shape,a,i,!1),m=zn({inputs:{x:u},backend:n,attrs:{shape:c}}),b=ta({inputs:{x:m},backend:n,attrs:{perm:d}}),I=zn({inputs:{x:b},backend:n,attrs:{shape:f}});return n.disposeData(u.dataId),n.disposeData(m.dataId),n.disposeData(b.dataId),I}const pH={kernelName:Zm,backendName:"wasm",kernelFunc:fH};/** 8477 * @license 8478 * Copyright 2021 Google LLC. All Rights Reserved. 8479 * Licensed under the Apache License, Version 2.0 (the "License"); 8480 * you may not use this file except in compliance with the License. 8481 * You may obtain a copy of the License at 8482 * 8483 * http://www.apache.org/licenses/LICENSE-2.0 8484 * 8485 * Unless required by applicable law or agreed to in writing, software 8486 * distributed under the License is distributed on an "AS IS" BASIS, 8487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8488 * See the License for the specific language governing permissions and 8489 * limitations under the License. 8490 * ============================================================================= 8491 */let Ax;function hH(t){Ax=t.wasm.cwrap("SparseFillEmptyRows","number",["number","number","number","number","number","number","number","number","number","number","number","number"])}function mH(t){const{backend:e,inputs:n}=t,{indices:r,values:s,denseShape:a,defaultValue:o}=n,i=r.shape[0],l=r.shape[1],u=e.readSync(a.dataId)[0],c=[i+u,l],d=e.dataIdMap.get(r.dataId).id,f=e.dataIdMap.get(s.dataId).id,p=e.dataIdMap.get(o.dataId).id,h=e.makeOutput(c,r.dtype),m=e.dataIdMap.get(h.dataId).id,g=e.makeOutput(c.slice(0,1),s.dtype),v=e.dataIdMap.get(g.dataId).id,b=e.makeOutput([u],"bool"),w=e.dataIdMap.get(b.dataId).id,S=e.makeOutput([i],r.dtype),I=e.dataIdMap.get(S.dataId).id,E=e.makeOutput([4],"int32"),T=e.dataIdMap.get(E.dataId).id,D=Ax(d,f,it[s.dtype],i,u,l,p,m,v,w,I,T),R=e.readSync(E.dataId);let $;switch(R[0]){case 1:{$=F2(R[1]);break}case 2:{$=M2(R[1],R[2]);break}case 3:$=O2(R[1],R[2],R[3]);break;default:$=""}if(e.disposeData(E.dataId),$)throw e.disposeData(h.dataId),e.disposeData(g.dataId),e.disposeData(b.dataId),e.disposeData(S.dataId),new Error($);let M=h,B=g;return D!==c[0]&&(M=Xa({inputs:{x:h},attrs:{begin:0,size:[D,l]},backend:e}),B=Xa({inputs:{x:g},attrs:{begin:0,size:D},backend:e}),e.disposeData(h.dataId),e.disposeData(g.dataId)),[M,B,b,S]}const gH={kernelName:tg,backendName:"wasm",setupFunc:hH,kernelFunc:mH};/** 8492 * @license 8493 * Copyright 2021 Google LLC. All Rights Reserved. 8494 * Licensed under the Apache License, Version 2.0 (the "License"); 8495 * you may not use this file except in compliance with the License. 8496 * You may obtain a copy of the License at 8497 * 8498 * http://www.apache.org/licenses/LICENSE-2.0 8499 * 8500 * Unless required by applicable law or agreed to in writing, software 8501 * distributed under the License is distributed on an "AS IS" BASIS, 8502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8503 * See the License for the specific language governing permissions and 8504 * limitations under the License. 8505 * ============================================================================= 8506 */let $x;function yH(t){$x=t.wasm.cwrap(_f,null,["number","number","number","number","number","number","number"])}function vH(t){const{backend:e,inputs:n}=t,{inputIndices:r,inputShape:s,newShape:a}=n;if(r.shape.length!==2)throw new Error("Input indices should be a matrix but received shape\n ".concat(r.shape));if(s.shape.length!==1)throw new Error("Input shape should be a vector but received shape\n ".concat(s.shape));if(a.shape.length!==1)throw new Error("Target shape should be a vector but received shape ".concat(a.shape));const o=e.dataIdMap.get(r.dataId).id,i=e.dataIdMap.get(s.dataId).id,l=e.dataIdMap.get(a.dataId).id,u=r.shape[0],c=J(a.shape),d=e.makeOutput([u,c],r.dtype),f=e.dataIdMap.get(d.dataId).id,p=e.makeOutput([c],a.dtype),h=e.dataIdMap.get(p.dataId).id,m=e.makeOutput([3],"int32"),g=e.dataIdMap.get(m.dataId).id;$x(o,i,l,u,f,h,g);const v=e.readSync(m.dataId);let b;switch(v[0]){case 0:{b=P2(v[1],v[2]);break}case 1:{b=B2(v[1],v[2]);break}case 2:b=L2();break;case 3:{const w=Array.from(e.readSync(s.dataId)),S=Array.from(e.readSync(p.dataId));b=W2(w,S);break}case 4:{const w=Array.from(e.readSync(s.dataId)),S=Array.from(e.readSync(p.dataId));b=z2(w,S);break}default:b=""}
8506if(e.disposeData(m.dataId),b)throw e.disposeData(d.dataId),e.disposeData(p.dataId),new Error(b);return[d,p]}const bH={kernelName:_f,backendName:"wasm",setupFunc:yH,kernelFunc:vH};/** 8507 * @license 8508 * Copyright 2021 Google LLC. All Rights Reserved. 8509 * Licensed under the Apache License, Version 2.0 (the "License"); 8510 * you may not use this file except in compliance with the License. 8511 * You may obtain a copy of the License at 8512 * 8513 * http://www.apache.org/licenses/LICENSE-2.0 8514 * 8515 * Unless required by applicable law or agreed to in writing, software 8516 * distributed under the License is distributed on an "AS IS" BASIS, 8517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8518 * See the License for the specific language governing permissions and 8519 * limitations under the License. 8520 * ============================================================================= 8521 */let Rx;function Dx(t){Rx=t.wasm.cwrap("SparseSegmentReduction",null,["number","number","number","number","number","number","number","number","number"])}function Fx(t,e){const{backend:n,inputs:r}=t,{data:s,indices:a,segmentIds:o}=r,i=a.shape[0],l=n.readSync(o.dataId,i-1,i)[0],c=i>0?l+1:0;if(c<0)throw new Error(fu());const d=s.shape.slice();d[0]=c;const f=n.dataIdMap.get(s.dataId).id,p=n.dataIdMap.get(a.dataId).id,h=n.dataIdMap.get(o.dataId).id,m=n.makeOutput(d,s.dtype),g=n.dataIdMap.get(m.dataId).id,v=n.makeOutput([4],"int32"),b=n.dataIdMap.get(v.dataId).id;Rx(f,it[s.dtype],s.shape[0],p,h,g,b,e,0);const w=n.readSync(v.dataId);let S;switch(w[0]){case 0:{S=fu();break}case 1:{S=H2();break}case 2:S=U2(w[1],w[2]);break;case 3:S=V2(w[1],w[2],w[3]);break;default:S=""}if(n.disposeData(v.dataId),S)throw n.disposeData(m.dataId),new Error(S);return m}/** 8522 * @license 8523 * Copyright 2021 Google LLC. All Rights Reserved. 8524 * Licensed under the Apache License, Version 2.0 (the "License"); 8525 * you may not use this file except in compliance with the License. 8526 * You may obtain a copy of the License at 8527 * 8528 * http://www.apache.org/licenses/LICENSE-2.0 8529 * 8530 * Unless required by applicable law or agreed to in writing, software 8531 * distributed under the License is distributed on an "AS IS" BASIS, 8532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8533 * See the License for the specific language governing permissions and 8534 * limitations under the License. 8535 * ============================================================================= 8536 */function wH(t){return Fx(t,!0)}const SH={kernelName:ng,backendName:"wasm",setupFunc:Dx,kernelFunc:wH};/** 8537 * @license 8538 * Copyright 2021 Google LLC. All Rights Reserved. 8539 * Licensed under the Apache License, Version 2.0 (the "License"); 8540 * you may not use this file except in compliance with the License. 8541 * You may obtain a copy of the License at 8542 * 8543 * http://www.apache.org/licenses/LICENSE-2.0 8544 * 8545 * Unless required by applicable law or agreed to in writing, software 8546 * distributed under the License is distributed on an "AS IS" BASIS, 8547 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8548 * See the License for the specific language governing permissions and 8549 * limitations under the License. 8550 * ============================================================================= 8551 */function xH(t){return Fx(t,!1)}const _H={kernelName:rg,backendName:"wasm",setupFunc:Dx,kernelFunc:xH};/** 8552 * @license 8553 * Copyright 2021 Google LLC. All Rights Reserved. 8554 * Licensed under the Apache License, Version 2.0 (the "License"); 8555 * you may not use this file except in compliance with the License. 8556 * You may obtain a copy of the License at 8557 * 8558 * http://www.apache.org/licenses/LICENSE-2.0 8559 * 8560 * Unless required by applicable law or agreed to in writing, software 8561 * distributed under the License is distributed on an "AS IS" BASIS, 8562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8563 * See the License for the specific language governing permissions and 8564 * limitations under the License. 8565 * ============================================================================= 8566 */let Mx;function IH(t){Mx=t.wasm.cwrap(If,null,["number","number","number","number","number","number","number","number","array","number","number"])}
8566function kH(t){const{backend:e,inputs:n,attrs:r}=t,{sparseIndices:s,sparseValues:a,defaultValue:o}=n,{outputShape:i}=r,l=e.makeOutput(i,o.dtype);if(J(i)===0)return l;const{sliceRank:u,numUpdates:c,sliceSize:d,strides:f,outputSize:p}=di(a,s,i),h=e.dataIdMap.get(s.dataId).id,m=e.dataIdMap.get(a.dataId).id,g=e.dataIdMap.get(o.dataId).id,v=new Uint8Array(new Int32Array(f).buffer),b=e.dataIdMap.get(l.dataId).id;return Mx(h,m,a.shape.length,g,it[o.dtype],u,c,d,v,p,b),l}const EH={kernelName:If,backendName:"wasm",setupFunc:IH,kernelFunc:kH};/** 8567 * @license 8568 * Copyright 2020 Google LLC. All Rights Reserved. 8569 * Licensed under the Apache License, Version 2.0 (the "License"); 8570 * you may not use this file except in compliance with the License. 8571 * You may obtain a copy of the License at 8572 * 8573 * http://www.apache.org/licenses/LICENSE-2.0 8574 * 8575 * Unless required by applicable law or agreed to in writing, software 8576 * distributed under the License is distributed on an "AS IS" BASIS, 8577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8578 * See the License for the specific language governing permissions and 8579 * limitations under the License. 8580 * ============================================================================= 8581 */function TH(t){const{inputs:e,attrs:n,backend:r}=t,{x:s}=e,{numOrSizeSplits:a,axis:o}=n,i=Vt(o,s.shape)[0],l=D2(s,a,i),u=new Array(s.shape.length).fill(0),c=s.shape.slice();return l.map(d=>{const f=[...c];f[i]=d;const p=Xa({inputs:{x:s},attrs:{begin:u,size:f},backend:r});return u[i]+=d,p})}const CH={kernelName:eg,backendName:"wasm",kernelFunc:TH};/** 8582 * @license 8583 * Copyright 2020 Google LLC. All Rights Reserved. 8584 * Licensed under the Apache License, Version 2.0 (the "License"); 8585 * you may not use this file except in compliance with the License. 8586 * You may obtain a copy of the License at 8587 * 8588 * http://www.apache.org/licenses/LICENSE-2.0 8589 * 8590 * Unless required by applicable law or agreed to in writing, software 8591 * distributed under the License is distributed on an "AS IS" BASIS, 8592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8593 * See the License for the specific language governing permissions and 8594 * limitations under the License. 8595 * ============================================================================= 8596 */const NH=st(wf);/** 8597 * @license 8598 * Copyright 2019 Google LLC. All Rights Reserved. 8599 * Licensed under the Apache License, Version 2.0 (the "License"); 8600 * you may not use this file except in compliance with the License. 8601 * You may obtain a copy of the License at 8602 * 8603 * http://www.apache.org/licenses/LICENSE-2.0 8604 * 8605 * Unless required by applicable law or agreed to in writing, software 8606 * distributed under the License is distributed on an "AS IS" BASIS, 8607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8608 * See the License for the specific language governing permissions and 8609 * limitations under the License. 8610 * ============================================================================= 8611 */const AH=st(G1);/** 8612 * @license 8613 * Copyright 2019 Google LLC. All Rights Reserved. 8614 * Licensed under the Apache License, Version 2.0 (the "License"); 8615 * you may not use this file except in compliance with the License. 8616 * You may obtain a copy of the License at 8617 * 8618 * http://www.apache.org/licenses/LICENSE-2.0 8619 * 8620 * Unless required by applicable law or agreed to in writing, software 8621 * distributed under the License is distributed on an "AS IS" BASIS, 8622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8623 * See the License for the specific language governing permissions and 8624 * limitations under the License. 8625 * ============================================================================= 8626 */const $H=nn(kf);/** 8627 * @license 8628 * Copyright 2020 Google LLC. All Rights Reserved. 8629 * Licensed under the Apache License, Version 2.0 (the "License"); 8630 * you may not use this file except in compliance with the License. 8631 * You may obtain a copy of the License at 8632 * 8633 * http://www.apache.org/licenses/LICENSE-2.0 8634 * 8635 * Unless required by applicable law or agreed to in writing, softw
8635are 8636 * distributed under the License is distributed on an "AS IS" BASIS, 8637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8638 * See the License for the specific language governing permissions and 8639 * limitations under the License. 8640 * ============================================================================= 8641 */let Ox;function RH(t){Ox=t.wasm.cwrap(zc,null,["number","number","number","number"])}function DH(t){const{backend:e,inputs:n,attrs:r}=t,{alpha:s}=r,{x:a}=n,o=e.dataIdMap.get(a.dataId).id,i=e.makeOutput(a.shape,a.dtype),l=e.dataIdMap.get(i.dataId).id;return Ox(o,s,it[a.dtype],l),i}const FH={kernelName:zc,backendName:"wasm",setupFunc:RH,kernelFunc:DH};/** 8642 * @license 8643 * Copyright 2021 Google LLC. All Rights Reserved. 8644 * Licensed under the Apache License, Version 2.0 (the "License"); 8645 * you may not use this file except in compliance with the License. 8646 * You may obtain a copy of the License at 8647 * 8648 * http://www.apache.org/licenses/LICENSE-2.0 8649 * 8650 * Unless required by applicable law or agreed to in writing, software 8651 * distributed under the License is distributed on an "AS IS" BASIS, 8652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8653 * See the License for the specific language governing permissions and 8654 * limitations under the License. 8655 * ============================================================================= 8656 */let Px;function MH(t){Px=t.wasm.cwrap(Ef,null,["number","array","number","array","array","array","array","array","number","number"])}function OH(t){const{backend:e,inputs:n,attrs:r}=t,{x:s}=n,{begin:a,end:o,strides:i,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:f}=r,{finalShapeSparse:p,finalShape:h,isIdentity:m,sliceDim0:g,isSimpleSlice:v,begin:b,end:w,strides:S}=T2(s.shape,a,o,i,l,u,c,d,f);let I;if(m)I=zn({inputs:{x:s},backend:e,attrs:{shape:h}});else if(g||v){A(s.shape.length>=1,()=>"Input must have rank at least 1, got: ".concat(s.shape.length));const E=_2(b,w,S),T=Xa({inputs:{x:s},backend:e,attrs:{begin:b,size:E}});I=zn({inputs:{x:T},backend:e,attrs:{shape:h}}),e.disposeData(T.dataId)}else{const E=e.makeOutput(p,"float32"),T=e.dataIdMap.get(s.dataId).id,D=new Uint8Array(new Int32Array(Ie(s.shape)).buffer),R=new Uint8Array(new Int32Array(b).buffer),$=new Uint8Array(new Int32Array(w).buffer),M=new Uint8Array(new Int32Array(S).buffer),B=new Uint8Array(new Int32Array(p).buffer),z=new Uint8Array(new Int32Array(Ie(p)).buffer),H=e.dataIdMap.get(E.dataId).id;Px(T,D,s.shape.length,R,$,M,B,z,p.length,H),I=zn({inputs:{x:E},backend:e,attrs:{shape:h}}),e.disposeData(E.dataId)}return I}const PH={kernelName:Ef,backendName:"wasm",setupFunc:MH,kernelFunc:OH};/** 8657 * @license 8658 * Copyright 2021 Google LLC. All Rights Reserved. 8659 * Licensed under the Apache License, Version 2.0 (the "License"); 8660 * you may not use this file except in compliance with the License. 8661 * You may obtain a copy of the License at 8662 * 8663 * http://www.apache.org/licenses/LICENSE-2.0 8664 * 8665 * Unless required by applicable law or agreed to in writing, software 8666 * distributed under the License is distributed on an "AS IS" BASIS, 8667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8668 * See the License for the specific language governing permissions and 8669 * limitations under the License. 8670 * ============================================================================= 8671 */function BH(t){const{backend:e,inputs:n,attrs:r}=t,{data:s,dataSplits:a}=n,{separator:o,nGramWidths:i,leftPad:l,rightPad:u,padWidth:c,preserveShortSequences:d}=r,f=e.readSync(s.dataId),p=e.readSync(a.dataId),[h,m]=bS(f,p,o,i,l,u,c,d),g=e.makeOutput([h.length],"string"),v=e.dataIdMap.get(g.dataId);v.stringBytes=h;const b=e.makeOutput(a.shape,"int32");return e.typedArrayFromHeap(b).set(m),[g,b]}const LH={kernelName:ag,backendName:"wasm",kernelFunc:BH};/** 8672 * @license 8673 * Copyright 2021 Google LLC. All Rights Reserved. 8674 * Licensed under the Apache License, Version 2.0 (the "License"); 8675 * you may not use this file except in compliance with the License. 8676 * You may obtain a copy of the License at 8677 * 8678 * http://www.apache.org/licenses/LICENSE-2.0 8679 * 8680 * Unless required by applicable law or agreed to in writing, softw
8680are 8681 * distributed under the License is distributed on an "AS IS" BASIS, 8682 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8683 * See the License for the specific language governing permissions and 8684 * limitations under the License. 8685 * ============================================================================= 8686 */function WH(t){const{backend:e,inputs:n,attrs:r}=t,{input:s,delimiter:a}=n,{skipEmpty:o}=r,i=e.readSync(s.dataId),l=e.readSync(a.dataId),[u,c,d]=wS(i,l[0],o),f=c.length,p=e.makeOutput([f,2],"int32");e.typedArrayFromHeap(p).set(u);const m=e.makeOutput([f],"string"),g=e.dataIdMap.get(m.dataId);g.stringBytes=c;const v=e.makeOutput([2],"int32");return e.typedArrayFromHeap(v).set(d),[p,m,v]}const zH={kernelName:og,backendName:"wasm",kernelFunc:WH};/** 8687 * @license 8688 * Copyright 2021 Google LLC. All Rights Reserved. 8689 * Licensed under the Apache License, Version 2.0 (the "License"); 8690 * you may not use this file except in compliance with the License. 8691 * You may obtain a copy of the License at 8692 * 8693 * http://www.apache.org/licenses/LICENSE-2.0 8694 * 8695 * Unless required by applicable law or agreed to in writing, software 8696 * distributed under the License is distributed on an "AS IS" BASIS, 8697 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8698 * See the License for the specific language governing permissions and 8699 * limitations under the License. 8700 * ============================================================================= 8701 */function HH(t){const{backend:e,inputs:n,attrs:r}=t,{input:s}=n,{numBuckets:a}=r,o=e.readSync(s.dataId),i=SS(o,a),l=e.makeOutput(s.shape,"int32");return e.typedArrayFromHeap(l).set(i),l}const UH={kernelName:ig,backendName:"wasm",kernelFunc:HH};/** 8702 * @license 8703 * Copyright 2019 Google LLC. All Rights Reserved. 8704 * Licensed under the Apache License, Version 2.0 (the "License"); 8705 * you may not use this file except in compliance with the License. 8706 * You may obtain a copy of the License at 8707 * 8708 * http://www.apache.org/licenses/LICENSE-2.0 8709 * 8710 * Unless required by applicable law or agreed to in writing, software 8711 * distributed under the License is distributed on an "AS IS" BASIS, 8712 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8713 * See the License for the specific language governing permissions and 8714 * limitations under the License. 8715 * ============================================================================= 8716 */const VH=nn(Tf);/** 8717 * @license 8718 * Copyright 2019 Google LLC. All Rights Reserved. 8719 * Licensed under the Apache License, Version 2.0 (the "License"); 8720 * you may not use this file except in compliance with the License. 8721 * You may obtain a copy of the License at 8722 * 8723 * http://www.apache.org/licenses/LICENSE-2.0 8724 * 8725 * Unless required by applicable law or agreed to in writing, software 8726 * distributed under the License is distributed on an "AS IS" BASIS, 8727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8728 * See the License for the specific language governing permissions and 8729 * limitations under the License. 8730 * ============================================================================= 8731 */let Bx;function jH(t){Bx=t.wasm.cwrap(Sf,null,["number","number","number","number"])}function GH(t){const{backend:e,inputs:n,attrs:r}=t,{axis:s,keepDims:a}=r,{x:o}=n,i=e.dataIdMap.get(o.dataId).id;let l=i,u=o;const{transposed:c,axes:d,originalAxes:f,inputWasTransposed:p}=ca(o,s,e);let h=d;if(p){const w=e.dataIdMap.get(c.dataId).id;w!==i&&(u=c,l=w,h=Fn(h.length,u.shape.length))}Dn("sum",h,u.shape.length);const[m,g]=Rn(u.shape,h),v=J(g),b=e.makeOutput(m,u.dtype);if(J(u.shape)!==0){const w=e.dataIdMap.get(b.dataId).id;Bx(l,v,it[b.dtype],w)}if(p&&e.disposeData(c.dataId),a){const w=gn(b.shape,f);b.shape=w}return b}const qH={kernelName:Sf,backendName:"wasm",setupFunc:jH,kernelFunc:GH};/** 8732 * @license 8733 * Copyright 2021 Google LLC. All Rights Reserved. 8734 * Licensed under the Apache License, Version 2.0 (the "License"); 8735 * you may not use this file except in compliance with the License. 8736 * You may obtain a copy of the License at 8737 * 8738 * http://www.apache.org/licenses/LICENSE-2.0 8739 * 8740 * Unless required by applicable law or agreed to in writing, softw
8740are 8741 * distributed under the License is distributed on an "AS IS" BASIS, 8742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8743 * See the License for the specific language governing permissions and 8744 * limitations under the License. 8745 * ============================================================================= 8746 */const KH=st(Cf);/** 8747 * @license 8748 * Copyright 2019 Google LLC. All Rights Reserved. 8749 * Licensed under the Apache License, Version 2.0 (the "License"); 8750 * you may not use this file except in compliance with the License. 8751 * You may obtain a copy of the License at 8752 * 8753 * http://www.apache.org/licenses/LICENSE-2.0 8754 * 8755 * Unless required by applicable law or agreed to in writing, software 8756 * distributed under the License is distributed on an "AS IS" BASIS, 8757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8758 * See the License for the specific language governing permissions and 8759 * limitations under the License. 8760 * ============================================================================= 8761 */const XH=st(Nf);/** 8762 * @license 8763 * Copyright 2022 Google LLC. All Rights Reserved. 8764 * Licensed under the Apache License, Version 2.0 (the "License"); 8765 * you may not use this file except in compliance with the License. 8766 * You may obtain a copy of the License at 8767 * 8768 * http://www.apache.org/licenses/LICENSE-2.0 8769 * 8770 * Unless required by applicable law or agreed to in writing, software 8771 * distributed under the License is distributed on an "AS IS" BASIS, 8772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8773 * See the License for the specific language governing permissions and 8774 * limitations under the License. 8775 * ============================================================================= 8776 */let Lx;function YH(t){Lx=t.wasm.cwrap(ff,null,["number","number","number","number","number","number","array","number","number","number"])}function JH(t){const{backend:e,inputs:n,attrs:r}=t,{tensor:s,indices:a,updates:o}=n,i=e.makeOutput(s.shape,s.dtype);if(J(s.shape)===0)return i;const{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:f}=di(o,a,s.shape),h=e.dataIdMap.get(a.dataId).id,g=e.dataIdMap.get(o.dataId).id,b=e.dataIdMap.get(s.dataId).id,w=new Uint8Array(new Int32Array(d).buffer),S=e.dataIdMap.get(i.dataId).id;return Lx(h,g,it[o.dtype],l,u,c,w,f,S,b),i}const QH={kernelName:ff,backendName:"wasm",setupFunc:YH,kernelFunc:JH};/** 8777 * @license 8778 * Copyright 2019 Google LLC. All Rights Reserved. 8779 * Licensed under the Apache License, Version 2.0 (the "License"); 8780 * you may not use this file except in compliance with the License. 8781 * You may obtain a copy of the License at 8782 * 8783 * http://www.apache.org/licenses/LICENSE-2.0 8784 * 8785 * Unless required by applicable law or agreed to in writing, software 8786 * distributed under the License is distributed on an "AS IS" BASIS, 8787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8788 * See the License for the specific language governing permissions and 8789 * limitations under the License. 8790 * ============================================================================= 8791 */let Wx;function ZH(t){Wx=t.wasm.cwrap(Wc,null,["number","array","number","array","number","number"])}function eU(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,a=n.dataIdMap.get(s.dataId).id,{reps:o}=r,i=new Array(s.shape.length);for(let f=0;f<i.length;f++)i[f]=s.shape[f]*o[f];const l=new Uint8Array(new Int32Array(s.shape).buffer),u=new Uint8Array(new Int32Array(i).buffer),c=n.makeOutput(i,s.dtype),d=n.dataIdMap.get(c.dataId).id;return Wx(a,l,s.shape.length,u,i.length,it[c.dtype],d),c}const tU={kernelName:Wc,backendName:"wasm",setupFunc:ZH,kernelFunc:eU};/** 8792 * @license 8793 * Copyright 2020 Google LLC. All Rights Reserved. 8794 * Licensed under the Apache License, Version 2.0 (the "License"); 8795 * you may not use this file except in compliance with the License. 8796 * You may obtain a copy of the License at 8797 * 8798 * http://www.apache.org/licenses/LICENSE-2.0 8799 * 8800 * Unless required by applicable law or agreed to in writing, software 8801 * distributed under the License is distributed on an "AS IS" BASIS, 8802 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8803 * See the License for the specific language governing permissions and 8804 * limitations under the License. 8805 * ============================================================================= 8806 */let zx;function nU(t){zx=t.wasm.cwrap(Af,null,["number","array","number","number","number","bool","number","number"])}
8806const rU=({inputs:t,backend:e,attrs:n})=>{const{x:r}=t,{k:s,sorted:a}=n,o=e.dataIdMap.get(r.dataId).id,i=new Uint8Array(new Int32Array(r.shape).buffer),l=r.shape.slice();l[l.length-1]=s;const u=e.makeOutput(l,r.dtype),c=e.dataIdMap.get(u.dataId).id,d=e.makeOutput(l,"int32"),f=e.dataIdMap.get(d.dataId).id;return zx(o,i,r.shape.length,it[r.dtype],s,a,c,f),[u,d]},sU={kernelName:Af,backendName:"wasm",setupFunc:nU,kernelFunc:rU};/** 8807 * @license 8808 * Copyright 2021 Google LLC. All Rights Reserved. 8809 * Licensed under the Apache License, Version 2.0 (the "License"); 8810 * you may not use this file except in compliance with the License. 8811 * You may obtain a copy of the License at 8812 * 8813 * http://www.apache.org/licenses/LICENSE-2.0 8814 * 8815 * Unless required by applicable law or agreed to in writing, software 8816 * distributed under the License is distributed on an "AS IS" BASIS, 8817 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8818 * See the License for the specific language governing permissions and 8819 * limitations under the License. 8820 * ============================================================================= 8821 */let Hx;function aU(t){Hx=t.wasm.cwrap($f,null,["number","number","bool","number","number","number","number","number","number","array","number","array","number","number","number","number","number"])}function oU(t){const{backend:e,inputs:n,attrs:r}=t,{image:s,transforms:a}=n,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=r,[c,d,f,p]=s.shape,[h,m]=u!=null?u:[d,f],g=[c,h,m,p],v=new Uint8Array(new Int32Array(Ie(s.shape)).buffer),b=new Uint8Array(new Int32Array(Ie(g)).buffer),w=e.makeOutput(g,s.dtype),S=e.dataIdMap.get(w.dataId).id,E=e.dataIdMap.get(s.dataId).id,D=e.dataIdMap.get(a.dataId).id,R=o==="nearest"?1:2;let $;switch(i){case"constant":$=1;break;case"reflect":$=2;break;case"wrap":$=3;break;case"nearest":$=4;break;default:$=1;break}return Hx(E,D,a.shape[0]>1,c,h,m,p,f,d,v,s.shape.length-1,b,g.length-1,R,$,l,S),w}const iU={kernelName:$f,backendName:"wasm",setupFunc:aU,kernelFunc:oU};/** 8822 * @license 8823 * Copyright 2023 Google LLC. 8824 * Licensed under the Apache License, Version 2.0 (the "License"); 8825 * you may not use this file except in compliance with the License. 8826 * You may obtain a copy of the License at 8827 * 8828 * http://www.apache.org/licenses/LICENSE-2.0 8829 * 8830 * Unless required by applicable law or agreed to in writing, software 8831 * distributed under the License is distributed on an "AS IS" BASIS, 8832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8833 * See the License for the specific language governing permissions and 8834 * limitations under the License. 8835 * ============================================================================= 8836 */function cU(t){const{inputs:e,attrs:n,backend:r}=t,{axis:s}=n,{x:a}=e,{outputValues:o,outputShape:i,indices:l}=_S(r.readSync(a.dataId),s,a.shape,a.dtype);return[r.makeOutput(i,a.dtype,void 0,o),r.makeOutput([l.length],"int32",void 0,l)]}const lU={kernelName:cg,backendName:"wasm",kernelFunc:cU};/** 8837 * @license 8838 * Copyright 2019 Google LLC. All Rights Reserved. 8839 * Licensed under the Apache License, Version 2.0 (the "License"); 8840 * you may not use this file except in compliance with the License. 8841 * You may obtain a copy of the License at 8842 * 8843 * http://www.apache.org/licenses/LICENSE-2.0 8844 * 8845 * Unless required by applicable law or agreed to in writing, software 8846 * distributed under the License is distributed on an "AS IS" BASIS, 8847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8848 * See the License for the specific language governing permissions and 8849 * limitations under the License. 8850 * ============================================================================= 8851 */function uU(t){const{inputs:e,backend:n,attrs:r}=t,{value:s}=e;let{axis:a}=r;a<0&&(a+=s.shape.length);const o=s.shape[a],i=s.shape.length,l=new Array(i-1);let u=0;for(let p=0;p<i;p++)p!==a&&(l[u++]=s.shape[p]);const c=new Array(o),d=new Array(i).fill(0),f=s.shape.slice();f[a]=1;for(let p=0;p<c.length;p++)d[a]=p,c[p]=Xa({inputs:{x:s},attrs:{begin:d,size:f},backend:n});return c.map(({dataId:p,dtype:h})=>({dataId:p,dtype:h,shape:l}))}const dU={kernelName:lg,backendName:"wasm",kernelFunc:uU};/** 8852 * @license 8853 * Copyright 2020 Google LLC. All Rights Reserved. 8854 * Licensed under the Apache License, Version 2.0 (the "License");
8855 * you may not use this file except in compliance with the License. 8856 * You may obtain a copy of the License at 8857 * 8858 * http://www.apache.org/licenses/LICENSE-2.0 8859 * 8860 * Unless required by applicable law or agreed to in writing, software 8861 * distributed under the License is distributed on an "AS IS" BASIS, 8862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8863 * See the License for the specific language governing permissions and 8864 * limitations under the License. 8865 * ============================================================================= 8866 */function fU(t){const{inputs:{x:e},backend:n}=t,r=n.makeOutput(e.shape,e.dtype);return n.typedArrayFromHeap(r).fill(0),r}const pU={kernelName:ug,backendName:"wasm",kernelFunc:fU};/** 8867 * @license 8868 * Copyright 2020 Google LLC. All Rights Reserved. 8869 * Licensed under the Apache License, Version 2.0 (the "License"); 8870 * you may not use this file except in compliance with the License. 8871 * You may obtain a copy of the License at 8872 * 8873 * http://www.apache.org/licenses/LICENSE-2.0 8874 * 8875 * Unless required by applicable law or agreed to in writing, software 8876 * distributed under the License is distributed on an "AS IS" BASIS, 8877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8878 * See the License for the specific language governing permissions and 8879 * limitations under the License. 8880 * ============================================================================= 8881 */const hU=[pP,hP,mP,gP,yP,wP,CP,$P,RP,DP,FP,MP,OP,PP,BP,zP,YP,VP,qP,eB,Q7,tL,nL,sL,aL,oL,lL,uL,pL,gL,bL,xL,kL,EL,TL,AL,DL,OL,LL,HL,jL,KL,JL,e9,r9,s9,i9,l9,u9,d9,f9,p9,h9,y9,v9,b9,x9,k9,C9,$9,F9,O9,B9,SP,L9,W9,z9,V9,G9,K9,J9,Z9,Q9,tW,nW,sW,oW,lW,fW,mW,gW,bW,xW,kW,CW,$W,FW,PW,BW,zW,GW,qW,KW,XW,QW,tz,sz,oz,lz,dz,pz,yx,gz,bz,xz,Iz,kz,Ez,Tz,Cz,JP,$z,Fz,Pz,Wz,Uz,Gz,qz,Kz,Jz,eH,rH,sH,iH,cH,lH,uH,Y7,UW,dH,pH,gH,bH,SH,_H,EH,CH,NH,AH,$H,FH,PH,LH,zH,UH,VH,qH,KH,XH,QH,tU,sU,iU,kP,lU,dU,pU];for(const t of hU)K1(t);/** 8882 * @license 8883 * Copyright 2020 Google LLC. All Rights Reserved. 8884 * Licensed under the Apache License, Version 2.0 (the "License"); 8885 * you may not use this file except in compliance with the License. 8886 * You may obtain a copy of the License at 8887 * 8888 * http://www.apache.org/licenses/LICENSE-2.0 8889 * 8890 * Unless required by applicable law or agreed to in writing, software 8891 * distributed under the License is distributed on an "AS IS" BASIS, 8892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8893 * See the License for the specific language governing permissions and 8894 * limitations under the License. 8895 * ============================================================================= 8896 */const qh=Qe();qh.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))}catch(t){return!1}});qh.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(qh.get("IS_NODE"))return!1;try{return new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(t){return!1}});var Ux={exports:{}};(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(s){s=s||{};function a(){return K.buffer!=fe&&je(K.buffer),be}function o(){return K.buffer!=fe&&je(K.buffer),$e}function i(){return K.buffer!=fe&&je(K.buffer),Re}function l(){return K.buffer!=fe&&je(K.buffer),De}function u(){return K.buffer!=fe&&je(K.buffer),Pe}var c=typeof s<"u"?s:{},d,f;c.ready=new Promise(function(F,q){d=F,f=q});var p;typeof process<"u"&&process.listeners&&(p={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var h=Object.assign({},c),m=(F,q)=>{throw q},g=typeof window=="object",v=typeof importScripts=="function",b=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w=c.ENVIRONMENT_IS_PTHREAD||!1,S="";function I(F){return c.locateFile?c.locateFile(F,S):S+F}var E,T,D;function R(F){if(F instanceof pr)return;V("exiting due to exception: "+F)}if(b){var $=Vs,M=Vs;v?S=M.dirname(S)+"/":S=__dirname+"/",E=(q,ue)=>(q=jn(q)?new URL(q):M.normalize(q),$.readFileSync(q,ue?void 0:"utf8")),D=q=>{var ue=E(q,!0);return ue.buffer||(ue=new Uint8Array(ue)),ue},T=(q,ue,Me)=>{q=jn(q)?new URL(q):M.normalize(q),$.readFile(q,function(Le,Ve){Le?Me(Le):ue(Ve.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(q){if(!(q instanceof pr))throw q}),process.on("unhandledRejection",function(q){throw q}),m=(q,ue)=>{if(Ge())throw process.exitCode=q,ue;R(ue),process.exit(q)},c.inspect=function(){return"[Emscripten Module object]"};let F;try{F=Vs}catch(q){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),q}cr.Worker=F.Worker}else(g||v)&&(v?S=self.location.href:typeof document<"u"&&document.currentScript&&(S=document.currentScript.src),typeof r<"u"&&r&&(S=r),S.indexOf("blob:")!==0?S=S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):S="",b||(E=F=>{var q=new XMLHttpRequest;return q.open("GET",F,!1),q.send(null),q.responseText},v&&(D=F=>{var q=new XMLHttpRequest;return q.open("GET",F,!1),q.responseType="arraybuffer",q.send(null),new Uint8Array(q.response)}),T=(F,q,ue)=>{var Me=new XMLHttpRequest;Me.open("GET",F,!0),Me.responseType="arraybuffer",Me.onload=()=>
vendor: 2,621 bytes, line 8896
8896{if(Me.status==200||Me.status==0&&Me.response){q(Me.response);return}ue()},Me.onerror=ue,Me.send(null)}));b&&typeof performance>"u"&&(cr.performance=Vs.performance);var B=console.log.bind(console),z=console.warn.bind(console);b&&(B=F=>$.writeSync(1,F+"\n"),z=F=>$.writeSync(2,F+"\n"));var H=c.print||B,V=c.printErr||z;Object.assign(c,h),h=null,c.arguments&&c.arguments,c.thisProgram&&c.thisProgram,c.quit&&(m=c.quit);var X;c.wasmBinary&&(X=c.wasmBinary);var Q=c.noExitRuntime||!0;typeof WebAssembly!="object"&&In("no native wasm support detected");var K,ee,ae=!1,ne;function ce(F,q){F||In(q)}var se=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function oe(F,q,ue){q>>>=0;for(var Me=q+ue,Le=q;F[Le]&&!(Le>=Me);)++Le;if(Le-q>16&&F.buffer&&se)return se.decode(F.buffer instanceof SharedArrayBuffer?F.slice(q,Le):F.subarray(q,Le));for(var Ve="";q<Le;){var we=F[q++];if(!(we&128)){Ve+=String.fromCharCode(we);continue}var ke=F[q++]&63;if((we&224)==192){Ve+=String.fromCharCode((we&31)<<6|ke);continue}var Nt=F[q++]&63;if((we&240)==224?we=(we&15)<<12|ke<<6|Nt:we=(we&7)<<18|ke<<12|Nt<<6|F[q++]&63,we<65536)Ve+=String.fromCharCode(we);else{var Pn=we-65536;Ve+=String.fromCharCode(55296|Pn>>10,56320|Pn&1023)}}return Ve}function ie(F,q){return F>>>=0,F?oe(o(),F,q):""}function pe(F,q,ue,Me){if(ue>>>=0,!(Me>0))return 0;for(var Le=ue,Ve=ue+Me-1,we=0;we<F.length;++we){var ke=F.charCodeAt(we);if(ke>=55296&&ke<=57343){var Nt=F.charCodeAt(++we);ke=65536+((ke&1023)<<10)|Nt&1023}if(ke<=127){if(ue>=Ve)break;q[ue++>>>0]=ke}else if(ke<=2047){if(ue+1>=Ve)break;q[ue++>>>0]=192|ke>>6,q[ue++>>>0]=128|ke&63}else if(ke<=65535){if(ue+2>=Ve)break;q[ue++>>>0]=224|ke>>12,q[ue++>>>0]=128|ke>>6&63,q[ue++>>>0]=128|ke&63}else{if(ue+3>=Ve)break;q[ue++>>>0]=240|ke>>18,q[ue++>>>0]=128|ke>>12&63,q[ue++>>>0]=128|ke>>6&63,q[ue++>>>0]=128|ke&63}}return q[ue>>>0]=0,ue-Le}function ve(F,q,ue){return pe(F,o(),q,ue)}var fe,be,$e,Re,De,Pe;w&&(fe=c.buffer);function je(F){fe=F,c.HEAP8=be=new Int8Array(F),c.HEAP16=new Int16Array(F),c.HEAP32=Re=new Int32Array(F),c.HEAPU8=$e=new Uint8Array(F),c.HEAPU16=new Uint16Array(F),c.HEAPU32=De=new Uint32Array(F),c.HEAPF32=new Float32Array(F),c.HEAPF64=Pe=new Float64Array(F)}var Ue=c.INITIAL_MEMORY||16777216;if(w)K=c.wasmMemory,fe=c.buffer;else if(c.wasmMemory)K=c.wasmMemory;else if(K=new WebAssembly.Memory({initial:Ue/65536,maximum:65536,shared:!0}),!(K.buffer instanceof SharedArrayBuffer))throw V("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
8896need to set a flag"),b&&V("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");K&&(fe=K.buffer),Ue=fe.byteLength,je(fe);var Ce,Ze=[],Ke=[],Ne=[];function Ge(){return Q}function jt(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)yt(c.preRun.shift());bt(Ze)}function gt(){w||bt(Ke)}function It(){if(!w){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Yt(c.postRun.shift());bt(Ne)}}function yt(F){Ze.unshift(F)}function Tt(F){Ke.unshift(F)}function Yt(F){Ne.unshift(F)}var vt=0,rn=null;function _n(F){vt++,c.monitorRunDependencies&&c.monitorRunDependencies(vt)}function cs(F){if(vt--,c.monitorRunDependencies&&c.monitorRunDependencies(vt),vt==0&&rn){var q=rn;rn=null,q()}}function In(F){c.onAbort&&c.onAbort(F),F="Aborted("+F+")",V(F),ae=!0,ne=1,F+=". Build with -sASSERTIONS for more info.";var q=new WebAssembly.RuntimeError(F);throw f(q),q}var Ns="data:application/octet-stream;base64,";function rr(F){return F.startsWith(Ns)}function jn(F){return F.startsWith("file://")}var Wt;Wt="tfjs-backend-wasm-threaded-simd.wasm",rr(Wt)||(Wt=I(Wt));function As(F){try{if(F==Wt&&X)return new Uint8Array(X);if(D)return D(F);throw"both async and sync fetching of the wasm failed"}catch(q){In(q)}}function fa(){if(!X&&(g||v)){if(typeof fetch=="function"&&!jn(Wt))return fetch(Wt,{credentials:"same-origin"}).then(function(F){if(!F.ok)throw"failed to load wasm binary file at '"+Wt+"'";return F.arrayBuffer()}).catch(function(){return As(Wt)});if(T)return new Promise(function(F,q){T(Wt,function(ue){F(new Uint8Array(ue))},q)})}return Promise.resolve().then(function(){return As(Wt)})}function ls(){var F={env:Si,wasi_snapshot_preview1:Si};function q(we,ke){var Nt=we.exports;if(c.asm=Nt,Gn(c.asm._emscripten_tls_init),Ce=c.asm.__indirect_function_table,Tt(c.asm.__wasm_call_ctors),ee=ke,!w){var Pn=ye.unusedWorkers.length;ye.unusedWorkers.forEach(function(Cr){ye.loadWasmModuleToWorker(Cr,function(){--Pn||cs()})})}}w||_n();function ue(we){q(we.instance,we.module)}function Me(we){return fa().then(function(ke){return WebAssembly.instantiate(ke,F)}).then(function(ke){return ke}).then(we,function(ke){V("failed to asynchronously prepare wasm: "+ke),In(ke)})}function Le(){return!X&&typeof WebAssembly.instantiateStreaming=="function"&&!rr(Wt)&&!jn(Wt)&&!b&&typeof fetch=="function"?fetch(Wt,{credentials:"same-origin"}).then(function(we){var ke=WebAssembly.instantiateStreaming(we,F);return ke.then(ue,function(Nt){return V("wasm streaming compile failed: "+Nt),V("falling back to ArrayBuffer instantiation"),Me(ue)})}):Me(ue)}if(c.instantiateWasm)try{var Ve=c.instantiateWasm(F,q);return Ve}catch(we){V("Module.instantiateWasm callback failed with error: "+we),f(we)}return Le().catch(f),{}}var pa={};function pr(F){this.name="ExitStatus",this.message="Program terminated with exit("+F+")",this.status=F}function us(F){var q=ye.pthreads[F];delete ye.pthreads[F],q.terminate(),_i(F),ye.runningWorkers.splice(ye.runningWorkers.indexOf(q),1),q.pthread_ptr=0}function kn(F){var q=ye.pthreads[F];q.postMessage({cmd:"cancel"})}function Ct(F){var q=ye.pthreads[F];ce(q),ye.returnWorkerToPool(q)}function Hr(F){var q=ye.getNewWorker();if(!q)return 6;ye.runningWorkers.push(q),ye.pthreads[F.pthread_ptr]=q,q.pthread_ptr=F.pthread_ptr;var ue={cmd:"run",start_routine:F.startRoutine,arg:F.arg,pthread_ptr:F.pthread_ptr};return q.runPthread=()=>{b&&q.ref(),q.postMessage(ue,F.transferList),delete q.runPthread},q.loaded&&q.runPthread(),0}function Mn(F){if(w)return Rs(1,1,F);ne=F,Ge()||(ye.terminateAllThreads(),c.onExit&&c.onExit(F),ae=!0),m(F,new pr(F))}function Z(F,q){if(ne=F,!q&&w)throw qe(F),"unwind";Mn(F)}var le=Z;function Ae(F){if(F instanceof pr||F=="unwind")return ne;m(1,F)}var ye={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){w?ye.initWorker():ye.initMainThread()},initMainThread:function(){for(var F=8;F--;)ye.allocateUnusedWorker()},initWorker:function(){Q=!1},setExitStatus:function(F){ne=F},terminateAllThreads:function(){for(var F of Object.values(ye.pthreads))ye.returnWorkerToPool(F);for(var F of ye.unusedWorkers)F.terminate();ye.unusedWorkers=[]},returnWorkerToPool:function(F){var q=F.pthread_ptr;delete ye.pthreads[q],ye.unusedWorkers.push(F),ye.runningWorkers.splice(ye.runningWorkers.indexOf(F),1),F.pthread_ptr=0,b&&F.unref(),_i(q)},receiveObjectTransfer:function(F){},threadInitTLS:function(){ye.tlsInitFunctions.forEach(F=>F())},loadWasmModuleToWorker:function(F,q){F.onmessage=Ve=>{var we=Ve.data,ke=we.cmd;if(F.pthread_ptr&&(ye.currentProxiedOperationCallerThread=F.pthread_ptr),we.targetThread&&we.targetThread!=Vr()){var Nt=ye.pthreads[we.targetThread];Nt?Nt.postMessage(we,we.transferList):V('Internal error! Worker sent a message "'+ke+'" to target pthread '+we.targetThread+", but that thread no longer exists!"),ye.currentProxiedOperationCallerThread=void 0;return}ke==="processProxyingQueue"?gi(we.queue):ke==="spawnThread"?Hr(we):ke==="cleanupThread"?Ct(we.thread):ke==="killThread"?us(we.thread):ke==="cancelThread"?kn(we.thread):ke==="loaded"?(F.loaded=!0,b&&F.unref(),q&&q(F),F.runPthread&&F.runPthread()):ke==="print"?H("Thread "+we.threadId+": "+we.text):ke==="printErr"?V("Thread "+we.threadId+": "+we.text):ke==="alert"?alert("Thread "+we.threadId+": "+we.text):we.target==="setimmediate"?F.postMessage(we):ke==="callHandler"?c[we.handler](...we.args):ke&&V("worker sent an unknown command "+ke),ye.currentProxiedOperationCallerThread=void 0},F.onerror=Ve=>{var we="worker sent an error!";throw V(we+" "+Ve.filename+":"+Ve.lineno+": "+Ve.message),Ve},b&&(F.on("message",function(Ve){F.onmessage({data:Ve})}
vendor: 6,289 bytes, line 8896
8896),F.on("error",function(Ve){F.onerror(Ve)}),F.on("detachedExit",function(){}));var ue=[],Me=["onExit","onAbort","print","printErr"];for(var Le of Me)c.hasOwnProperty(Le)&&ue.push(Le);F.postMessage({cmd:"load",handlers:ue,urlOrBlob:c.mainScriptUrlOrBlob||r,wasmMemory:K,wasmModule:ee})},allocateUnusedWorker:function(){var F,q=I("tfjs-backend-wasm-threaded-simd.worker.js");F=new Worker(q),ye.unusedWorkers.push(F)},getNewWorker:function(){return ye.unusedWorkers.length==0&&(ye.allocateUnusedWorker(),ye.loadWasmModuleToWorker(ye.unusedWorkers[0])),ye.unusedWorkers.pop()}};c.PThread=ye;function bt(F){for(;F.length>0;)F.shift()(c)}function kt(){var F=Vr(),q=i()[F+52>>>2],ue=i()[F+56>>>2],Me=q-ue;Ii(q,Me),go(q)}c.establishStackSpace=kt;function qe(F){if(w)return Rs(2,0,F);try{le(F)}catch(q){Ae(q)}}var We=[];function Gt(F){var q=We[F];return q||(F>=We.length&&(We.length=F+1),We[F]=q=Ce.get(F)),q}function On(F,q){var ue=Gt(F)(q);Ge()?ye.setExitStatus(ue):va(ue)}c.invokeEntryPoint=On;function Gn(F){ye.tlsInitFunctions.push(F)}function ha(F){xi(F,!v,1,!g),ye.threadInitTLS()}function Ur(F){w?postMessage({cmd:"cleanupThread",thread:F}):Ct(F)}function ma(F,q,ue,Me){return w?Rs(3,1,F,q,ue,Me):sn(F,q,ue,Me)}function sn(F,q,ue,Me){if(typeof SharedArrayBuffer>"u")return V("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Le=[],Ve=0;if(w&&(Le.length===0||Ve))return ma(F,q,ue,Me);var we={startRoutine:ue,pthread_ptr:F,arg:Me,transferList:Le};return w?(we.cmd="spawnThread",postMessage(we,Le),0):Hr(we)}function sr(){return 65536}var ga=!0;function qc(){return ga}function gi(F){Atomics.store(i(),F>>2,1),Vr()&&al(F),Atomics.compareExchange(i(),F>>2,1,0)}c.executeNotifiedProxyingQueue=gi;function op(F,q,ue,Me){if(F==q)setTimeout(()=>gi(Me));else if(w)postMessage({targetThread:F,cmd:"processProxyingQueue",queue:Me});else{var Le=ye.pthreads[F];if(!Le)return;Le.postMessage({cmd:"processProxyingQueue",queue:Me})}return 1}function Kc(F,q,ue){return-1}function fo(){In("")}function $s(F){$s.shown||($s.shown={}),$s.shown[F]||($s.shown[F]=1,b&&(F="warning: "+F),V(F))}function Xc(){b||v||$s("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function Yc(){return Date.now()}function Jc(){return 4294901760}function ip(){return Jc()}var yi;b?yi=()=>{var F=process.hrtime();return F[0]*1e3+F[1]/1e6}:yi=()=>performance.timeOrigin+performance.now();function cp(F,q,ue){o().copyWithin(F>>>0,q>>>0,q+ue>>>0)}function Qc(){return b?Vs.cpus().length:navigator.hardwareConcurrency}function Zc(F){var q=mo(),ue=F();return go(q),ue}function Rs(F,q){var ue=arguments.length-2,Me=arguments;return Zc(()=>{for(var Le=ue,Ve=yo(Le*8),we=Ve>>3,ke=0;ke<ue;ke++){var Nt=Me[2+ke];u()[we+ke>>>0]=Nt}return ho(F,Le,Ve,q)})}var vi=[];function lp(F,q,ue){vi.length=q;for(var Me=ue>>3,Le=0;Le<q;Le++)vi[Le]=u()[Me+Le>>>0];var Ve=F<0,we=Ve?pa[-F-1]:Kn[F];return we.apply(null,vi)}function up(F){try{return K.grow(F-fe.byteLength+65535>>>16),je(K.buffer),1}catch(q){}}function el(F){var q=o().length;if(F=F>>>0,F<=q)return!1;var ue=Jc();if(F>ue)return!1;let Me=(Nt,Pn)=>Nt+(Pn-Nt%Pn)%Pn;for(var Le=1;Le<=4;Le*=2){var Ve=q*(1+.2/Le);Ve=Math.min(Ve,F+100663296);var we=Math.min(ue,Me(Math.max(F,Ve),65536)),ke=up(we);if(ke)return!0}return!1}function tl(){throw"unwind"}function po(F){return w?Rs(4,1,F):52}function bi(F,q,ue,Me,Le){return w?Rs(5,1,F,q,ue,Me,Le):70}var wi=[null,[],[]];function ya(F,q){var ue=wi[F];q===0||q===10?((F===1?H:V)(oe(ue,0)),ue.length=0):ue.push(q)}function qn(F,q,ue,Me){if(w)return Rs(6,1,F,q,ue,Me);for(var Le=0,Ve=0;Ve<ue;Ve++){var we=l()[q>>>2],ke=l()[q+4>>>2];q+=8;for(var Nt=0;Nt<ke;Nt++)ya(F,o()[we+Nt>>>0]);Le+=ke}return l()[Me>>>2]=Le,0}function nl(F){var q=c["_"+F];return q}function dp(F,q){a().set(F,q>>>0)}function rl(F,q,ue,Me,Le){var Ve={string:En=>{var Fs=0;if(En!=null&&En!==0){var vo=(En.length<<2)+1;Fs=yo(vo),ve(En,Fs,vo)}return Fs},array:En=>{var Fs=yo(En.length);return dp(En,Fs),Fs}};function we(En){return q==="string"?ie(En):q==="boolean"?!!En:En}var ke=nl(F),Nt=[],Pn=0;if(Me)for(var Cr=0;Cr<Me.length;Cr++){var il=Ve[ue[Cr]];il?(Pn===0&&(Pn=mo()),Nt[Cr]=il(Me[Cr])):Nt[Cr]=Me[Cr]}var Ei=ke.apply(null,Nt);function cl(En){return Pn!==0&&go(Pn),we(En)}return Ei=cl(Ei),Ei}function sl(F,q,ue,Me){ue=ue||[];var Le=ue.every(we=>we==="number"||we==="boolean"),Ve=q!=="string";return Ve&&Le&&!Me?nl(F):function(){return rl(F,q,ue,arguments)}}ye.init();var Kn=[null,Mn,qe,ma,po,bi,qn],Si={__emscripten_init_main_thread_js:ha,__emscripten_thread_cleanup:Ur,__pthread_create_js:sn,_emscripten_default_pthread_stack_size:sr,_emscripten_get_now_is_monotonic:qc,_emscripten_notify_task_queue:op,_emscripten_set_offscreencanvas_size:Kc,abort:fo,emscripten_check_blocking_allowed:Xc,emscripten_date_now:Yc,emscripten_get_heap_max:ip,emscripten_get_now:yi,emscripten_memcpy_big:cp,emscripten_num_logical_cores:Qc,emscripten_receive_on_main_thread_js:lp,emscripten_resize_heap:el,emscripten_unwind_to_js_event_loop:tl,exit:le,fd_close:po,fd_seek:bi,fd_write:qn,memory:K||c.wasmMemory};ls(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.__wasm_call_ctors).apply(null,arguments)},c._init=function(){return(c._init=c.asm.init).apply(null,arguments)},c._init_with_threads_count=function(){return(c._init_with_threads_count=c.asm.init_with_threads_count).apply(null,arguments)},c._get_threads_count=function(){return(c._get_threads_count=c.asm.get_threads_count).apply(null,arguments)},c._register_tensor=function(){return(c._register_tensor=c.asm.register_tensor).apply(null,arguments)},c._dispose_data=function(){return(c._dispose_data=c.asm.dispose_data).apply(null,arguments)},c._dispose=function(){return(c._dispose=c.asm.dispose).apply(null,arguments)},c._Abs=function(){return(c._Abs=c.asm.Abs).apply(null,arguments)},c._Acos=function(){return(c._Acos=c.asm.Acos).apply(null,arguments)},c._Acosh=function(){return(c._Acosh=c.asm.Acosh).apply(null,arguments)},c._Add=function(){return(c._Add=c.asm.Add).apply(null,arguments)},c._AddN=function(){return(c._AddN=c.asm.AddN).apply(null,arguments)},c._All=function(){return(c._All=c.asm.All).apply(null,arguments)},c._Any=function(){return(c._Any=c.asm.Any).apply(null,arguments)}
8896,c._ArgMax=function(){return(c._ArgMax=c.asm.ArgMax).apply(null,arguments)},c._ArgMin=function(){return(c._ArgMin=c.asm.ArgMin).apply(null,arguments)},c._Asin=function(){return(c._Asin=c.asm.Asin).apply(null,arguments)},c._Asinh=function(){return(c._Asinh=c.asm.Asinh).apply(null,arguments)},c._Atan=function(){return(c._Atan=c.asm.Atan).apply(null,arguments)},c._Atan2=function(){return(c._Atan2=c.asm.Atan2).apply(null,arguments)},c._Atanh=function(){return(c._Atanh=c.asm.Atanh).apply(null,arguments)},c._AvgPool=function(){return(c._AvgPool=c.asm.AvgPool).apply(null,arguments)},c._AvgPool3D=function(){return(c._AvgPool3D=c.asm.AvgPool3D).apply(null,arguments)},c._AvgPool3DGrad=function(){return(c._AvgPool3DGrad=c.asm.AvgPool3DGrad).apply(null,arguments)},c._AvgPoolGrad=function(){return(c._AvgPoolGrad=c.asm.AvgPoolGrad).apply(null,arguments)},c._BatchMatMul=function(){return(c._BatchMatMul=c.asm.BatchMatMul).apply(null,arguments)},c._Bincount=function(){return(c._Bincount=c.asm.Bincount).apply(null,arguments)},c._BitwiseAnd=function(){return(c._BitwiseAnd=c.asm.BitwiseAnd).apply(null,arguments)},c._Ceil=function(){return(c._Ceil=c.asm.Ceil).apply(null,arguments)},c._ClipByValue=function(){return(c._ClipByValue=c.asm.ClipByValue).apply(null,arguments)},c._Conv2D=function(){return(c._Conv2D=c.asm.Conv2D).apply(null,arguments)},c._Conv2DBackpropInput=function(){return(c._Conv2DBackpropInput=c.asm.Conv2DBackpropInput).apply(null,arguments)},c._Conv3D=function(){return(c._Conv3D=c.asm.Conv3D).apply(null,arguments)},c._Conv3DBackpropFilterV2=function(){return(c._Conv3DBackpropFilterV2=c.asm.Conv3DBackpropFilterV2).apply(null,arguments)},c._Conv3DBackpropInputV2=function(){return(c._Conv3DBackpropInputV2=c.asm.Conv3DBackpropInputV2).apply(null,arguments)},c._Cos=function(){return(c._Cos=c.asm.Cos).apply(null,arguments)},c._Cosh=function(){return(c._Cosh=c.asm.Cosh).apply(null,arguments)},c._CropAndResize=function(){return(c._CropAndResize=c.asm.CropAndResize).apply(null,arguments)},c._Cumprod=function(){return(c._Cumprod=c.asm.Cumprod).apply(null,arguments)},c._Cumsum=function(){return(c._Cumsum=c.asm.Cumsum).apply(null,arguments)},c._DenseBincount=function(){return(c._DenseBincount=c.asm.DenseBincount).apply(null,arguments)},c._DepthToSpace=function(){return(c._DepthToSpace=c.asm.DepthToSpace).apply(null,arguments)},c._DepthwiseConv2dNative=function(){return(c._DepthwiseConv2dNative=c.asm.DepthwiseConv2dNative).apply(null,arguments)},c._Diag=function(){return(c._Diag=c.asm.Diag).apply(null,arguments)},c._Dilation2D=function(){return(c._Dilation2D=c.asm.Dilation2D).apply(null,arguments)},c._Dilation2DBackpropFilter=function(){return(c._Dilation2DBackpropFilter=c.asm.Dilation2DBackpropFilter).apply(null,arguments)},c._Dilation2DBackpropInput=function(){return(c._Dilation2DBackpropInput=c.asm.Dilation2DBackpropInput).apply(null,arguments)},c._Elu=function(){return(c._Elu=c.asm.Elu).apply(null,arguments)},c._EluGrad=function(){return(c._EluGrad=c.asm.EluGrad).apply(null,arguments)},c._Equal=function(){return(c._Equal=c.asm.Equal).apply(null,arguments)},c._Erf=function(){return(c._Erf=c.asm.Erf).apply(null,arguments)},c._Exp=function(){return(c._Exp=c.asm.Exp).apply(null,arguments)},c._Expm1=function(){return(c._Expm1=c.asm.Expm1).apply(null,arguments)},c._FlipLeftRight=function(){return(c._FlipLeftRight=c.asm.FlipLeftRight).apply(null,arguments)},c._Floor=function(){return(c._Floor=c.asm.Floor).apply(null,arguments)},c._FloorDiv=function(){return(c._FloorDiv=c.asm.FloorDiv).apply(null,arguments)},c._FusedBatchNorm=function(){return(c._FusedBatchNorm=c.asm.FusedBatchNorm).apply(null,arguments)},c._FusedConv2D=function(){return(c._FusedConv2D=c.asm.FusedConv2D).apply(null,arguments)},c._FusedDepthwiseConv2D=function(){return(c._FusedDepthwiseConv2D=c.asm.FusedDepthwiseConv2D).apply(null,arguments)},c._Gather=function(){return(c._Gather=c.asm.Gather).apply(null,arguments)},c._GatherNd=function(){return(c._GatherNd=c.asm.GatherNd).apply(null,arguments)},c._Greater=function(){return(c._Greater=c.asm.Greater).apply(null,arguments)},c._GreaterEqual=function(){return(c._GreaterEqual=c.asm.GreaterEqual).apply(null,arguments)},c._IsFinite=function(){return(c._IsFinite=c.asm.IsFinite).apply(null,arguments)},c._IsInf=function(){return(c._IsInf=c.asm.IsInf).apply(null,arguments)},c._IsNan=function(){return(c._IsNan=c.asm.IsNan).apply(null,arguments)},c._LRN=function(){return(c._LRN=c.asm.LRN).apply(null,arguments)},c._LRNGrad=function(){return(c._LRNGrad=c.asm.LRNGrad).apply(null,arguments)},c._LeakyRelu=function(){return(c._LeakyRelu=c.asm.LeakyRelu).apply(null,arguments)},c._Less=function(){return(c._Less=c.asm.Less).apply(null,arguments)},c._LessEqual=function(){return(c._LessEqual=c.asm.LessEqual).apply(null,arguments)},c._LinSpace=function(){return(c._LinSpace=c.asm.LinSpace).apply(null,arguments)},c._Log=function(){return(c._Log=c.asm.Log).apply(null,arguments)},c._Log1p=function(){return(c._Log1p=c.asm.Log1p).apply(null,arguments)},c._LogicalAnd=function(){return(c._LogicalAnd=c.asm.LogicalAnd).apply(null,arguments)},c._LogicalNot=function(){return(c._LogicalNot=c.asm.LogicalNot).apply(null,arguments)},c._LogicalOr=function(){return(c._LogicalOr=c.asm.LogicalOr).apply(null,arguments)},c._LogicalXor=function(){return(c._LogicalXor=c.asm.LogicalXor).apply(null,arguments)},c._Max=function(){return(c._Max=c.asm.Max).apply(null,arguments)},c._MaxPool=function(){return(c._MaxPool=c.asm.MaxPool).apply(null,arguments)},c._MaxPool3D=function(){return(c._MaxPool3D=c.asm.MaxPool3D).apply(null,arguments)},c._MaxPool3DGrad=function(){return(c._MaxPool3DGrad=c.asm.MaxPool3DGrad).apply(null,arguments)},c._MaxPoolGrad=function(){return(c._MaxPoolGrad=c.asm.MaxPoolGrad).apply(null,arguments)},c._MaxPoolWithArgmax=function(){return(c._MaxPoolWithArgmax=c.asm.MaxPoolWithArgmax).apply(null,arguments)},c._Maximum=function(){return(c._Maximum=c.asm.Maximum).apply(null,arguments)},c._Mean=function(){return(c._Mean=c.asm.Mean).apply(null,arguments)},c._Min=function(){return(c._Min=c.asm.Min).apply(null,arguments)},c._Minimum=function(){return(c._Minimum=c.asm.Minimum).apply(null,arguments)},c._MirrorPad=function(){return(c._MirrorPad=c.asm.MirrorPad).apply(null,arguments)},c._Mod=function(){return(c._Mod=c.asm.Mod).apply(null,arguments)},c._Multinomial=function(){return(c._Multinomial=c.asm.Multinomial).apply(null,arguments)},c._Multiply=function(){return(c._Multiply=c.asm.Multiply).apply(null,arguments)},c._Neg=function(){return(c._Neg=c.asm.Neg).apply(null,arguments)},c._NonMaxSuppressionV3=function(){return(c._NonMaxSuppressionV3=c.asm.NonMaxSuppressionV3).apply(null,arguments)},c._NonMaxSuppressionV4=function(){return(c._NonMaxSuppressionV4=c.asm.NonMaxSuppressionV4).apply(null,arguments)},c._NonMaxSuppressionV5=function(){return(c._NonMaxSuppressionV5=c.asm.NonMaxSuppressionV5).apply(null,arguments)},c._NotEqual=function(){return(c._NotEqual=c.asm.NotEqual).apply(null,arguments)},c._OneHot=function(){return(c._OneHot=c.asm.OneHot).apply(null,arguments)},c._PadV2=function(){return(c._PadV2=c.asm.PadV2).apply(null,arguments)},c._Pow=function(){return(c._Pow=c.asm.Pow).apply(null,arguments)},c._Prelu=function(){return(c._Prelu=c.asm.Prelu).apply(null,arguments)},c._Prod=function(){return(c._Prod=c.asm.Prod).apply(null,arguments)},c._RealDiv=function(){return(c._RealDiv=c.asm.RealDiv).apply(null,arguments)},c._Reciprocal=function(){return(c._Reciprocal=c.asm.Reciprocal).apply(null,arguments)},c._Relu=function(){return(c._Relu=c.asm.Relu).apply(null,arguments)},c._Relu6=function(){return(c._Relu6=c.asm.Relu6).apply(null,arguments)},c._ResizeBilinear=function(){return(c._ResizeBilinear=c.asm.ResizeBilinear).apply(null,arguments)},c._ResizeBilinearGrad=function(){return(c._ResizeBilinearGrad=c.asm.ResizeBilinearGrad).apply(null,arguments)},c._ResizeNearestNeighbor=function(){return(c._ResizeNearestNeighbor=c.asm.ResizeNearestNeighbor).apply(null,arguments)},c._ResizeNearestNeighborGrad=function(){return(c._ResizeNearestNeighborGrad=c.asm.ResizeNearestNeighborGrad).apply(null,arguments)}
8896,c._Reverse=function(){return(c._Reverse=c.asm.Reverse).apply(null,arguments)},c._RotateWithOffset=function(){return(c._RotateWithOffset=c.asm.RotateWithOffset).apply(null,arguments)},c._Round=function(){return(c._Round=c.asm.Round).apply(null,arguments)},c._Rsqrt=function(){return(c._Rsqrt=c.asm.Rsqrt).apply(null,arguments)},c._ScatterNd=function(){return(c._ScatterNd=c.asm.ScatterNd).apply(null,arguments)},c._SearchSorted=function(){return(c._SearchSorted=c.asm.SearchSorted).apply(null,arguments)},c._SelectV2=function(){return(c._SelectV2=c.asm.SelectV2).apply(null,arguments)},c._Selu=function(){return(c._Selu=c.asm.Selu).apply(null,arguments)},c._Sigmoid=function(){return(c._Sigmoid=c.asm.Sigmoid).apply(null,arguments)},c._Sign=function(){return(c._Sign=c.asm.Sign).apply(null,arguments)},c._Sin=function(){return(c._Sin=c.asm.Sin).apply(null,arguments)},c._Sinh=function(){return(c._Sinh=c.asm.Sinh).apply(null,arguments)},c._Softmax=function(){return(c._Softmax=c.asm.Softmax).apply(null,arguments)},c._Softplus=function(){return(c._Softplus=c.asm.Softplus).apply(null,arguments)},c._SparseFillEmptyRows=function(){return(c._SparseFillEmptyRows=c.asm.SparseFillEmptyRows).apply(null,arguments)},c._SparseReshape=function(){return(c._SparseReshape=c.asm.SparseReshape).apply(null,arguments)},c._SparseSegmentReduction=function(){return(c._SparseSegmentReduction=c.asm.SparseSegmentReduction).apply(null,arguments)},c._SparseToDense=function(){return(c._SparseToDense=c.asm.SparseToDense).apply(null,arguments)},c._Sqrt=function(){return(c._Sqrt=c.asm.Sqrt).apply(null,arguments)},c._Square=function(){return(c._Square=c.asm.Square).apply(null,arguments)},c._SquaredDifference=function(){return(c._SquaredDifference=c.asm.SquaredDifference).apply(null,arguments)},c._Step=function(){return(c._Step=c.asm.Step).apply(null,arguments)},c._StridedSlice=function(){return(c._StridedSlice=c.asm.StridedSlice).apply(null,arguments)},c._Sub=function(){return(c._Sub=c.asm.Sub).apply(null,arguments)},c._Sum=function(){return(c._Sum=c.asm.Sum).apply(null,arguments)},c._Tan=function(){return(c._Tan=c.asm.Tan).apply(null,arguments)},c._Tanh=function(){return(c._Tanh=c.asm.Tanh).apply(null,arguments)},c._TensorScatterUpdate=function(){return(c._TensorScatterUpdate=c.asm.TensorScatterUpdate).apply(null,arguments)},c._Tile=function(){return(c._Tile=c.asm.Tile).apply(null,arguments)},c._TopK=function(){return(c._TopK=c.asm.TopK).apply(null,arguments)},c._Transform=function(){return(c._Transform=c.asm.Transform).apply(null,arguments)},c._Transpose=function(){return(c._Transpose=c.asm.Transpose).apply(null,arguments)},c.__FusedMatMul=function(){return(c.__FusedMatMul=c.asm._FusedMatMul).apply(null,arguments)},c._malloc=function(){return(c._malloc=c.asm.malloc).apply(null,arguments)},c._free=function(){return(c._free=c.asm.free).apply(null,arguments)},c.__emscripten_tls_init=function(){return(c.__emscripten_tls_init=c.asm._emscripten_tls_init).apply(null,arguments)};var Vr=c._pthread_self=function(){return(Vr=c._pthread_self=c.asm.pthread_self).apply(null,arguments)};c.___errno_location=function(){return(c.___errno_location=c.asm.__errno_location).apply(null,arguments)};var xi=c.__emscripten_thread_init=function(){return(xi=c.__emscripten_thread_init=c.asm._emscripten_thread_init).apply(null,arguments)};c.__emscripten_thread_crashed=function(){return(c.__emscripten_thread_crashed=c.asm._emscripten_thread_crashed).apply(null,arguments)},c._emscripten_main_thread_process_queued_calls=function(){return(c._emscripten_main_thread_process_queued_calls=c.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},c._emscripten_main_browser_thread_id=function(){return(c._emscripten_main_browser_thread_id=c.asm.emscripten_main_browser_thread_id).apply(null,arguments)};var ho=c._emscripten_run_in_main_runtime_thread_js=function(){return(ho=c._emscripten_run_in_main_runtime_thread_js=c.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)};c._emscripten_dispatch_to_thread_=function(){return(c._emscripten_dispatch_to_thread_=c.asm.emscripten_dispatch_to_thread_).apply(null,arguments)};var al=c.__emscripten_proxy_execute_task_queue=function(){return(al=c.__emscripten_proxy_execute_task_queue=c.asm._emscripten_proxy_execute_task_queue).apply(null,arguments)},_i=c.__emscripten_thread_free_data=function(){return(_i=c.__emscripten_thread_free_data=c.asm._emscripten_thread_free_data).apply(null,arguments)},va=c.__emscripten_thread_exit=function(){return(va=c.__emscripten_thread_exit=c.asm._emscripten_thread_exit).apply(null,arguments)},Ii=c._emscripten_stack_set_limits=function(){return(Ii=c._emscripten_stack_set_limits=c.asm.emscripten_stack_set_limits).apply(null,arguments)},mo=c.stackSave=function(){return(mo=c.stackSave=c.asm.stackSave).apply(null,arguments)},go=c.stackRestore=function(){return(go=c.stackRestore=c.asm.stackRestore).apply(null,arguments)},yo=c.stackAlloc=function(){return(yo=c.stackAlloc=c.asm.stackAlloc).apply(null,arguments)};c.dynCall_iijjiiii=function(){return(c.dynCall_iijjiiii=c.asm.dynCall_iijjiiii).apply(null,arguments)},c.dynCall_jiji=function(){return(c.dynCall_jiji=c.asm.dynCall_jiji).apply(null,arguments)}
8896,c.keepRuntimeAlive=Ge,c.wasmMemory=K,c.cwrap=sl,c.ExitStatus=pr,c.PThread=ye;var Ds;rn=function F(){Ds||ki(),Ds||(rn=F)};function ki(F){if(vt>0)return;if(w){d(c),gt(),startWorker(c);return}if(jt(),vt>0)return;function q(){Ds||(Ds=!0,c.calledRun=!0,!ae&&(gt(),d(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),It()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),q()},1)):q()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();ki();var ba;p&&(ba={uncaughtException:process.listeners("uncaughtException").filter(function(F){return!p.uncaughtException.indexOf(F)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(F){return!p.unhandledRejection.indexOf(F)>-1})});var wa;if(typeof WasmBackendModule<"u")wa=WasmBackendModule;else if(typeof s<"u")wa=s;else throw new Error("Could not find wasm module in post.js");if(ba){var ol=wa._dispose;wa._dispose=function(){ol(),ba.uncaughtException.forEach(function(F){process.removeListener("uncaughtException",F)}),ba.unhandledRejection.forEach(function(F){process.removeListener("unhandledRejection",F)})}}return s.ready}})();t.exports=n})(Ux);var Vx=Ux.exports;const jx=Nu(Vx),mU=dm({__proto__:null,default:jx},[Vx]);var gU='"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}};',Gx={exports:{}};(function(t,e){var n=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(s){s=s||{};var a=typeof s<"u"?s:{},o,i;a.ready=new Promise(function(Z,le){o=Z,i=le});var l;typeof process<"u"&&process.listeners&&(l={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var u=Object.assign({},a),c=typeof window=="object",d=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",p="";function h(Z){return a.locateFile?a.locateFile(Z,p):p+Z}var m,g,v;if(f){var b=Vs,w=Vs;d?p=w.dirname(p)+"/":p=__dirname+"/",m=(Z,le)=>
8896(Z=Ue(Z)?new URL(Z):w.normalize(Z),b.readFileSync(Z,le?void 0:"utf8")),v=Z=>{var le=m(Z,!0);return le.buffer||(le=new Uint8Array(le)),le},g=(Z,le,Ae)=>{Z=Ue(Z)?new URL(Z):w.normalize(Z),b.readFile(Z,function(ye,bt){ye?Ae(ye):le(bt.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(Z){if(!(Z instanceof Ge))throw Z}),process.on("unhandledRejection",function(Z){throw Z}),a.inspect=function(){return"[Emscripten Module object]"}}else(c||d)&&(d?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p.indexOf("blob:")!==0?p=p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):p="",m=Z=>{var le=new XMLHttpRequest;return le.open("GET",Z,!1),le.send(null),le.responseText},d&&(v=Z=>{var le=new XMLHttpRequest;return le.open("GET",Z,!1),le.responseType="arraybuffer",le.send(null),new Uint8Array(le.response)}),g=(Z,le,Ae)=>{var ye=new XMLHttpRequest;ye.open("GET",Z,!0),ye.responseType="arraybuffer",ye.onload=()=>{if(ye.status==200||ye.status==0&&ye.response){le(ye.response);return}Ae()},ye.onerror=Ae,ye.send(null)});var S=a.print||console.log.bind(console),I=a.printErr||console.warn.bind(console);Object.assign(a,u),u=null,a.arguments&&a.arguments,a.thisProgram&&a.thisProgram,a.quit&&a.quit;var E;a.wasmBinary&&(E=a.wasmBinary),a.noExitRuntime,typeof WebAssembly!="object"&&De("no native wasm support detected");var T,D=!1,R=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function $(Z,le,Ae){le>>>=0;for(var ye=le+Ae,bt=le;Z[bt]&&!(bt>=ye);)++bt;if(bt-le>16&&Z.buffer&&R)return R.decode(Z.subarray(le,bt));for(var kt="";le<bt;){var qe=Z[le++];if(!(qe&128)){kt+=String.fromCharCode(qe);continue}var We=Z[le++]&63;if((qe&224)==192){kt+=String.fromCharCode((qe&31)<<6|We);continue}var Gt=Z[le++]&63;if((qe&240)==224?qe=(qe&15)<<12|We<<6|Gt:qe=(qe&7)<<18|We<<12|Gt<<6|Z[le++]&63,qe<65536)kt+=String.fromCharCode(qe);else{var On=qe-65536;kt+=String.fromCharCode(55296|On>>10,56320|On&1023)}}return kt}function M(Z,le){return Z>>>=0,Z?$(X,Z,le):""}function B(Z,le,Ae,ye){if(Ae>>>=0,!(ye>0))return 0;for(var bt=Ae,kt=Ae+ye-1,qe=0;qe<Z.length;++qe){var We=Z.charCodeAt(qe);if(We>=55296&&We<=57343){var Gt=Z.charCodeAt(++qe);We=65536+((We&1023)<<10)|Gt&1023}if(We<=127){if(Ae>=kt)break;le[Ae++>>>0]=We}else if(We<=2047){if(Ae+1>=kt)break;le[Ae++>>>0]=192|We>>6,le[Ae++>>>0]=128|We&63}else if(We<=65535){if(Ae+2>=kt)break;le[Ae++>>>0]=224|We>>12,le[Ae++>>>0]=128|We>>6&63,le[Ae++>>>0]=128|We&63}else{if(Ae+3>=kt)break;le[Ae++>>>0]=240|We>>18,le[Ae++>>>0]=128|We>>12&63,le[Ae++>>>0]=128|We>>6&63,le[Ae++>>>0]=128|We&63}}return le[Ae>>>0]=0,Ae-bt}function z(Z,le,Ae){return B(Z,X,le,Ae)}var H,V,X,Q;function K(Z){H=Z,a.HEAP8=V=new Int8Array(Z),a.HEAP16=new Int16Array(Z),a.HEAP32=new Int32Array(Z),a.HEAPU8=X=new Uint8Array(Z),a.HEAPU16=new Uint16Array(Z),a.HEAPU32=Q=new Uint32Array(Z),a.HEAPF32=new Float32Array(Z),a.HEAPF64=new Float64Array(Z)}a.INITIAL_MEMORY;var ee=[],ae=[],ne=[];function ce(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)ie(a.preRun.shift());jt(ee)}function se(){jt(ae)}function oe(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)ve(a.postRun.shift());jt(ne)}function ie(Z){ee.unshift(Z)}function pe(Z){ae.unshift(Z)}function ve(Z){ne.unshift(Z)}var fe=0,be=null;function $e(Z){fe++,a.monitorRunDependencies&&a.monitorRunDependencies(fe)}function Re(Z){if(fe--,a.monitorRunDependencies&&a.monitorRunDependencies(fe),fe==0&&be){var le=be;be=null,le()}}function De(Z){a.onAbort&&a.onAbort(Z),Z="Aborted("+Z+")",I(Z),D=!0,Z+=". Build with -sASSERTIONS for more info.";var le=new WebAssembly.RuntimeError(Z);throw i(le),le}var Pe="data:application/octet-stream;base64,";function je(Z){return Z.startsWith(Pe)}function Ue(Z){return Z.startsWith("file://")}var Ce;Ce="tfjs-backend-wasm.wasm",je(Ce)||(Ce=h(Ce));function Ze(Z){try{if(Z==Ce&&E)return new Uint8Array(E);if(v)return v(Z);throw"both async and sync fetching of the wasm failed"}catch(le){De(le)}}
vendor: 4,327 bytes, line 8896
8896function Ke(){if(!E&&(c||d)){if(typeof fetch=="function"&&!Ue(Ce))return fetch(Ce,{credentials:"same-origin"}).then(function(Z){if(!Z.ok)throw"failed to load wasm binary file at '"+Ce+"'";return Z.arrayBuffer()}).catch(function(){return Ze(Ce)});if(g)return new Promise(function(Z,le){g(Ce,function(Ae){Z(new Uint8Array(Ae))},le)})}return Promise.resolve().then(function(){return Ze(Ce)})}function Ne(){var Z={env:fa,wasi_snapshot_preview1:fa};function le(qe,We){var Gt=qe.exports;a.asm=Gt,T=a.asm.memory,K(T.buffer),a.asm.__indirect_function_table,pe(a.asm.__wasm_call_ctors),Re()}$e();function Ae(qe){le(qe.instance)}function ye(qe){return Ke().then(function(We){return WebAssembly.instantiate(We,Z)}).then(function(We){return We}).then(qe,function(We){I("failed to asynchronously prepare wasm: "+We),De(We)})}function bt(){return!E&&typeof WebAssembly.instantiateStreaming=="function"&&!je(Ce)&&!Ue(Ce)&&!f&&typeof fetch=="function"?fetch(Ce,{credentials:"same-origin"}).then(function(qe){var We=WebAssembly.instantiateStreaming(qe,Z);return We.then(Ae,function(Gt){return I("wasm streaming compile failed: "+Gt),I("falling back to ArrayBuffer instantiation"),ye(Ae)})}):ye(Ae)}if(a.instantiateWasm)try{var kt=a.instantiateWasm(Z,le);return kt}catch(qe){I("Module.instantiateWasm callback failed with error: "+qe),i(qe)}return bt().catch(i),{}}function Ge(Z){this.name="ExitStatus",this.message="Program terminated with exit("+Z+")",this.status=Z}function jt(Z){for(;Z.length>0;)Z.shift()(a)}function gt(){De("")}function It(){return 4294901760}function yt(){return It()}function Tt(Z,le,Ae){X.copyWithin(Z>>>0,le>>>0,le+Ae>>>0)}function Yt(Z){try{return T.grow(Z-H.byteLength+65535>>>16),K(T.buffer),1}catch(le){}}function vt(Z){var le=X.length;Z=Z>>>0;var Ae=It();if(Z>Ae)return!1;let ye=(Gt,On)=>Gt+(On-Gt%On)%On;for(var bt=1;bt<=4;bt*=2){var kt=le*(1+.2/bt);kt=Math.min(kt,Z+100663296);var qe=Math.min(Ae,ye(Math.max(Z,kt),65536)),We=Yt(qe);if(We)return!0}return!1}function rn(Z){return 52}function _n(Z,le,Ae,ye,bt){return 70}var cs=[null,[],[]];function In(Z,le){var Ae=cs[Z];le===0||le===10?((Z===1?S:I)($(Ae,0)),Ae.length=0):Ae.push(le)}function Ns(Z,le,Ae,ye){for(var bt=0,kt=0;kt<Ae;kt++){var qe=Q[le>>>2],We=Q[le+4>>>2];le+=8;for(var Gt=0;Gt<We;Gt++)In(Z,X[qe+Gt>>>0]);bt+=We}return Q[ye>>>2]=bt,0}function rr(Z){var le=a["_"+Z];return le}function jn(Z,le){V.set(Z,le>>>0)}function Wt(Z,le,Ae,ye,bt){var kt={string:sn=>{var sr=0;if(sn!=null&&sn!==0){var ga=(sn.length<<2)+1;sr=pr(ga),z(sn,sr,ga)}return sr},array:sn=>{var sr=pr(sn.length);return jn(sn,sr),sr}};function qe(sn){return le==="string"?M(sn):le==="boolean"?!!sn:sn}var We=rr(Z),Gt=[],On=0;if(ye)for(var Gn=0;Gn<ye.length;Gn++){var ha=kt[Ae[Gn]];ha?(On===0&&(On=ls()),Gt[Gn]=ha(ye[Gn])):Gt[Gn]=ye[Gn]}var Ur=We.apply(null,Gt);function ma(sn){return On!==0&&pa(On),qe(sn)}return Ur=ma(Ur),Ur}function As(Z,le,Ae,ye){Ae=Ae||[];var bt=Ae.every(qe=>qe==="number"||qe==="boolean"),kt=le!=="string";return kt&&bt&&!ye?rr(Z):function(){return Wt(Z,le,Ae,arguments)}}var fa={abort:gt,emscripten_get_heap_max:yt,emscripten_memcpy_big:Tt,emscripten_resize_heap:vt,fd_close:rn,fd_seek:_n,fd_write:Ns};Ne(),a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.__wasm_call_ctors).apply(null,arguments)},a._init=function(){return(a._init=a.asm.init).apply(null,arguments)},a._init_with_threads_count=function(){return(a._init_with_threads_count=a.asm.init_with_threads_count).apply(null,arguments)},a._get_threads_count=function(){return(a._get_threads_count=a.asm.get_threads_count).apply(null,arguments)},a._register_tensor=function(){return(a._register_tensor=a.asm.register_tensor).apply(null,arguments)},a._dispose_data=function(){return(a._dispose_data=a.asm.dispose_data).apply(null,arguments)},a._dispose=function(){return(a._dispose=a.asm.dispose).apply(null,arguments)},a._Abs=function(){return(a._Abs=a.asm.Abs).apply(null,arguments)},a._Acos=function(){return(a._Acos=a.asm.Acos).apply(null,arguments)},a._Acosh=function(){return(a._Acosh=a.asm.Acosh).apply(null,arguments)},a._Add=function(){return(a._Add=a.asm.Add).apply(null,arguments)},a._AddN=function(){return(a._AddN=a.asm.AddN).apply(null,arguments)},a._All=function(){return(a._All=a.asm.All).apply(null,arguments)},a._Any=function(){return(a._Any=a.asm.Any).apply(null,arguments)}
8896,a._ArgMax=function(){return(a._ArgMax=a.asm.ArgMax).apply(null,arguments)},a._ArgMin=function(){return(a._ArgMin=a.asm.ArgMin).apply(null,arguments)},a._Asin=function(){return(a._Asin=a.asm.Asin).apply(null,arguments)},a._Asinh=function(){return(a._Asinh=a.asm.Asinh).apply(null,arguments)},a._Atan=function(){return(a._Atan=a.asm.Atan).apply(null,arguments)},a._Atan2=function(){return(a._Atan2=a.asm.Atan2).apply(null,arguments)},a._Atanh=function(){return(a._Atanh=a.asm.Atanh).apply(null,arguments)},a._AvgPool=function(){return(a._AvgPool=a.asm.AvgPool).apply(null,arguments)},a._AvgPool3D=function(){return(a._AvgPool3D=a.asm.AvgPool3D).apply(null,arguments)},a._AvgPool3DGrad=function(){return(a._AvgPool3DGrad=a.asm.AvgPool3DGrad).apply(null,arguments)},a._AvgPoolGrad=function(){return(a._AvgPoolGrad=a.asm.AvgPoolGrad).apply(null,arguments)},a._BatchMatMul=function(){return(a._BatchMatMul=a.asm.BatchMatMul).apply(null,arguments)},a._Bincount=function(){return(a._Bincount=a.asm.Bincount).apply(null,arguments)},a._BitwiseAnd=function(){return(a._BitwiseAnd=a.asm.BitwiseAnd).apply(null,arguments)},a._Ceil=function(){return(a._Ceil=a.asm.Ceil).apply(null,arguments)},a._ClipByValue=function(){return(a._ClipByValue=a.asm.ClipByValue).apply(null,arguments)},a._Conv2D=function(){return(a._Conv2D=a.asm.Conv2D).apply(null,arguments)},a._Conv2DBackpropInput=function(){return(a._Conv2DBackpropInput=a.asm.Conv2DBackpropInput).apply(null,arguments)},a._Conv3D=function(){return(a._Conv3D=a.asm.Conv3D).apply(null,arguments)},a._Conv3DBackpropFilterV2=function(){return(a._Conv3DBackpropFilterV2=a.asm.Conv3DBackpropFilterV2).apply(null,arguments)},a._Conv3DBackpropInputV2=function(){return(a._Conv3DBackpropInputV2=a.asm.Conv3DBackpropInputV2).apply(null,arguments)},a._Cos=function(){return(a._Cos=a.asm.Cos).apply(null,arguments)},a._Cosh=function(){return(a._Cosh=a.asm.Cosh).apply(null,arguments)},a._CropAndResize=function(){return(a._CropAndResize=a.asm.CropAndResize).apply(null,arguments)},a._Cumprod=function(){return(a._Cumprod=a.asm.Cumprod).apply(null,arguments)},a._Cumsum=function(){return(a._Cumsum=a.asm.Cumsum).apply(null,arguments)},a._DenseBincount=function(){return(a._DenseBincount=a.asm.DenseBincount).apply(null,arguments)},a._DepthToSpace=function(){return(a._DepthToSpace=a.asm.DepthToSpace).apply(null,arguments)},a._DepthwiseConv2dNative=function(){return(a._DepthwiseConv2dNative=a.asm.DepthwiseConv2dNative).apply(null,arguments)},a._Diag=function(){return(a._Diag=a.asm.Diag).apply(null,arguments)},a._Dilation2D=function(){return(a._Dilation2D=a.asm.Dilation2D).apply(null,arguments)},a._Dilation2DBackpropFilter=function(){return(a._Dilation2DBackpropFilter=a.asm.Dilation2DBackpropFilter).apply(null,arguments)},a._Dilation2DBackpropInput=function(){return(a._Dilation2DBackpropInput=a.asm.Dilation2DBackpropInput).apply(null,arguments)},a._Elu=function(){return(a._Elu=a.asm.Elu).apply(null,arguments)},a._EluGrad=function(){return(a._EluGrad=a.asm.EluGrad).apply(null,arguments)},a._Equal=function(){return(a._Equal=a.asm.Equal).apply(null,arguments)},a._Erf=function(){return(a._Erf=a.asm.Erf).apply(null,arguments)},a._Exp=function(){return(a._Exp=a.asm.Exp).apply(null,arguments)},a._Expm1=function(){return(a._Expm1=a.asm.Expm1).apply(null,arguments)},a._FlipLeftRight=function(){return(a._FlipLeftRight=a.asm.FlipLeftRight).apply(null,arguments)},a._Floor=function(){return(a._Floor=a.asm.Floor).apply(null,arguments)},a._FloorDiv=function(){return(a._FloorDiv=a.asm.FloorDiv).apply(null,arguments)},a._FusedBatchNorm=function(){return(a._FusedBatchNorm=a.asm.FusedBatchNorm).apply(null,arguments)},a._FusedConv2D=function(){return(a._FusedConv2D=a.asm.FusedConv2D).apply(null,arguments)},a._FusedDepthwiseConv2D=function(){return(a._FusedDepthwiseConv2D=a.asm.FusedDepthwiseConv2D).apply(null,arguments)},a._Gather=function(){return(a._Gather=a.asm.Gather).apply(null,arguments)},a._GatherNd=function(){return(a._GatherNd=a.asm.GatherNd).apply(null,arguments)},a._Greater=function(){return(a._Greater=a.asm.Greater).apply(null,arguments)},a._GreaterEqual=function(){return(a._GreaterEqual=a.asm.GreaterEqual).apply(null,arguments)},a._IsFinite=function(){return(a._IsFinite=a.asm.IsFinite).apply(null,arguments)},a._IsInf=function(){return(a._IsInf=a.asm.IsInf).apply(null,arguments)},a._IsNan=function(){return(a._IsNan=a.asm.IsNan).apply(null,arguments)},a._LRN=function(){return(a._LRN=a.asm.LRN).apply(null,arguments)},a._LRNGrad=function(){return(a._LRNGrad=a.asm.LRNGrad).apply(null,arguments)},a._LeakyRelu=function(){return(a._LeakyRelu=a.asm.LeakyRelu).apply(null,arguments)},a._Less=function(){return(a._Less=a.asm.Less).apply(null,arguments)},a._LessEqual=function(){return(a._LessEqual=a.asm.LessEqual).apply(null,arguments)},a._LinSpace=function(){return(a._LinSpace=a.asm.LinSpace).apply(null,arguments)},a._Log=function(){return(a._Log=a.asm.Log).apply(null,arguments)},a._Log1p=function(){return(a._Log1p=a.asm.Log1p).apply(null,arguments)},a._LogicalAnd=function(){return(a._LogicalAnd=a.asm.LogicalAnd).apply(null,arguments)},a._LogicalNot=function(){return(a._LogicalNot=a.asm.LogicalNot).apply(null,arguments)},a._LogicalOr=function(){return(a._LogicalOr=a.asm.LogicalOr).apply(null,arguments)},a._LogicalXor=function(){return(a._LogicalXor=a.asm.LogicalXor).apply(null,arguments)},a._Max=function(){return(a._Max=a.asm.Max).apply(null,arguments)},a._MaxPool=function(){return(a._MaxPool=a.asm.MaxPool).apply(null,arguments)},a._MaxPool3D=function(){return(a._MaxPool3D=a.asm.MaxPool3D).apply(null,arguments)},a._MaxPool3DGrad=function(){return(a._MaxPool3DGrad=a.asm.MaxPool3DGrad).apply(null,arguments)},a._MaxPoolGrad=function(){return(a._MaxPoolGrad=a.asm.MaxPoolGrad).apply(null,arguments)},a._MaxPoolWithArgmax=function(){return(a._MaxPoolWithArgmax=a.asm.MaxPoolWithArgmax).apply(null,arguments)},a._Maximum=function(){return(a._Maximum=a.asm.Maximum).apply(null,arguments)},a._Mean=function(){return(a._Mean=a.asm.Mean).apply(null,arguments)},a._Min=function(){return(a._Min=a.asm.Min).apply(null,arguments)},a._Minimum=function(){return(a._Minimum=a.asm.Minimum).apply(null,arguments)},a._MirrorPad=function(){return(a._MirrorPad=a.asm.MirrorPad).apply(null,arguments)},a._Mod=function(){return(a._Mod=a.asm.Mod).apply(null,arguments)},a._Multinomial=function(){return(a._Multinomial=a.asm.Multinomial).apply(null,arguments)},a._Multiply=function(){return(a._Multiply=a.asm.Multiply).apply(null,arguments)},a._Neg=function(){return(a._Neg=a.asm.Neg).apply(null,arguments)},a._NonMaxSuppressionV3=function(){return(a._NonMaxSuppressionV3=a.asm.NonMaxSuppressionV3).apply(null,arguments)},a._NonMaxSuppressionV4=function(){return(a._NonMaxSuppressionV4=a.asm.NonMaxSuppressionV4).apply(null,arguments)},a._NonMaxSuppressionV5=function(){return(a._NonMaxSuppressionV5=a.asm.NonMaxSuppressionV5).apply(null,arguments)},a._NotEqual=function(){return(a._NotEqual=a.asm.NotEqual).apply(null,arguments)},a._OneHot=function(){return(a._OneHot=a.asm.OneHot).apply(null,arguments)},a._PadV2=function(){return(a._PadV2=a.asm.PadV2).apply(null,arguments)},a._Pow=function(){return(a._Pow=a.asm.Pow).apply(null,arguments)},a._Prelu=function(){return(a._Prelu=a.asm.Prelu).apply(null,arguments)},a._Prod=function(){return(a._Prod=a.asm.Prod).apply(null,arguments)},a._RealDiv=function(){return(a._RealDiv=a.asm.RealDiv).apply(null,arguments)},a._Reciprocal=function(){return(a._Reciprocal=a.asm.Reciprocal).apply(null,arguments)},a._Relu=function(){return(a._Relu=a.asm.Relu).apply(null,arguments)},a._Relu6=function(){return(a._Relu6=a.asm.Relu6).apply(null,arguments)},a._ResizeBilinear=function(){return(a._ResizeBilinear=a.asm.ResizeBilinear).apply(null,arguments)},a._ResizeBilinearGrad=function(){return(a._ResizeBilinearGrad=a.asm.ResizeBilinearGrad).apply(null,arguments)},a._ResizeNearestNeighbor=function(){return(a._ResizeNearestNeighbor=a.asm.ResizeNearestNeighbor).apply(null,arguments)},a._ResizeNearestNeighborGrad=function(){return(a._ResizeNearestNeighborGrad=a.asm.ResizeNearestNeighborGrad).apply(null,arguments)}
8896,a._Reverse=function(){return(a._Reverse=a.asm.Reverse).apply(null,arguments)},a._RotateWithOffset=function(){return(a._RotateWithOffset=a.asm.RotateWithOffset).apply(null,arguments)},a._Round=function(){return(a._Round=a.asm.Round).apply(null,arguments)},a._Rsqrt=function(){return(a._Rsqrt=a.asm.Rsqrt).apply(null,arguments)},a._ScatterNd=function(){return(a._ScatterNd=a.asm.ScatterNd).apply(null,arguments)},a._SearchSorted=function(){return(a._SearchSorted=a.asm.SearchSorted).apply(null,arguments)},a._SelectV2=function(){return(a._SelectV2=a.asm.SelectV2).apply(null,arguments)},a._Selu=function(){return(a._Selu=a.asm.Selu).apply(null,arguments)},a._Sigmoid=function(){return(a._Sigmoid=a.asm.Sigmoid).apply(null,arguments)},a._Sign=function(){return(a._Sign=a.asm.Sign).apply(null,arguments)},a._Sin=function(){return(a._Sin=a.asm.Sin).apply(null,arguments)},a._Sinh=function(){return(a._Sinh=a.asm.Sinh).apply(null,arguments)},a._Softmax=function(){return(a._Softmax=a.asm.Softmax).apply(null,arguments)},a._Softplus=function(){return(a._Softplus=a.asm.Softplus).apply(null,arguments)},a._SparseFillEmptyRows=function(){return(a._SparseFillEmptyRows=a.asm.SparseFillEmptyRows).apply(null,arguments)},a._SparseReshape=function(){return(a._SparseReshape=a.asm.SparseReshape).apply(null,arguments)},a._SparseSegmentReduction=function(){return(a._SparseSegmentReduction=a.asm.SparseSegmentReduction).apply(null,arguments)},a._SparseToDense=function(){return(a._SparseToDense=a.asm.SparseToDense).apply(null,arguments)},a._Sqrt=function(){return(a._Sqrt=a.asm.Sqrt).apply(null,arguments)},a._Square=function(){return(a._Square=a.asm.Square).apply(null,arguments)},a._SquaredDifference=function(){return(a._SquaredDifference=a.asm.SquaredDifference).apply(null,arguments)},a._Step=function(){return(a._Step=a.asm.Step).apply(null,arguments)},a._StridedSlice=function(){return(a._StridedSlice=a.asm.StridedSlice).apply(null,arguments)},a._Sub=function(){return(a._Sub=a.asm.Sub).apply(null,arguments)},a._Sum=function(){return(a._Sum=a.asm.Sum).apply(null,arguments)},a._Tan=function(){return(a._Tan=a.asm.Tan).apply(null,arguments)},a._Tanh=function(){return(a._Tanh=a.asm.Tanh).apply(null,arguments)},a._TensorScatterUpdate=function(){return(a._TensorScatterUpdate=a.asm.TensorScatterUpdate).apply(null,arguments)},a._Tile=function(){return(a._Tile=a.asm.Tile).apply(null,arguments)},a._TopK=function(){return(a._TopK=a.asm.TopK).apply(null,arguments)},a._Transform=function(){return(a._Transform=a.asm.Transform).apply(null,arguments)},a._Transpose=function(){return(a._Transpose=a.asm.Transpose).apply(null,arguments)},a.__FusedMatMul=function(){return(a.__FusedMatMul=a.asm._FusedMatMul).apply(null,arguments)},a._malloc=function(){return(a._malloc=a.asm.malloc).apply(null,arguments)},a._free=function(){return(a._free=a.asm.free).apply(null,arguments)},a.___errno_location=function(){return(a.___errno_location=a.asm.__errno_location).apply(null,arguments)};var ls=a.stackSave=function(){return(ls=a.stackSave=a.asm.stackSave).apply(null,arguments)},pa=a.stackRestore=function(){return(pa=a.stackRestore=a.asm.stackRestore).apply(null,arguments)},pr=a.stackAlloc=function(){return(pr=a.stackAlloc=a.asm.stackAlloc).apply(null,arguments)};a.dynCall_iijjiiii=function(){return(a.dynCall_iijjiiii=a.asm.dynCall_iijjiiii).apply(null,arguments)},a.dynCall_jiji=function(){return(a.dynCall_jiji=a.asm.dynCall_jiji).apply(null,arguments)},a.cwrap=As;var us;be=function Z(){us||kn(),us||(be=Z)};function kn(Z){if(fe>0||(ce(),fe>0))return;function le(){us||(us=!0,a.calledRun=!0,!D&&(se(),o(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),oe()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),le()},1)):le()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();kn();var Ct;l&&(Ct={uncaughtException:process.listeners("uncaughtException").filter(function(Z){return!l.uncaughtException.indexOf(Z)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(Z){return!l.unhandledRejection.indexOf(Z)>-1})});var Hr;if(typeof s<"u")Hr=s;else if(typeof WasmBackendModuleThreadedSimd<"u")Hr=WasmBackendModuleThreadedSimd;else throw new Error("Could not find wasm module in post.js");if(Ct){var Mn=Hr._dispose;Hr._dispose=function(){Mn(),Ct.uncaughtException.forEach(function(Z){process.removeListener("uncaughtException",Z)}),Ct.unhandledRejection.forEach(function(Z){process.removeListener("unhandledRejection",Z)})}}return s.ready}})();t.exports=n})(Gx);var qx=Gx.exports;const Kx=Nu(qx),yU=dm({__proto__:null,default:Kx},[qx]);/** 8897 * @license 8898 * Copyright 2019 Google LLC. All Rights Reserved. 8899 * Licensed under the Apache License, Version 2.0 (the "License");
8900 * you may not use this file except in compliance with the License. 8901 * You may obtain a copy of the License at 8902 * 8903 * http://www.apache.org/licenses/LICENSE-2.0 8904 * 8905 * Unless required by applicable law or agreed to in writing, software 8906 * distributed under the License is distributed on an "AS IS" BASIS, 8907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8908 * See the License for the specific language governing permissions and 8909 * limitations under the License. 8910 * ============================================================================= 8911 */const Qv=jx||mU,vU=Kx||yU;class bU extends _m{constructor(e){super(),this.wasm=e,this.dataIdNextNumber=1,this.wasm.tfjs.initWithThreadsCount(EU),this.wasm.tfjs.getThreadsCount(),this.dataIdMap=new x1(this,Ih())}write(e,n,r){const s={id:this.dataIdNextNumber++};return this.move(s,e,n,r,1),s}numDataIds(){return this.dataIdMap.numDataIds()}async time(e){const n=Qs();return e(),{kernelMs:Qs()-n}}move(e,n,r,s,a){const o=this.dataIdNextNumber++;if(s==="string"){const c=n;this.dataIdMap.set(e,{id:o,stringBytes:c,shape:r,dtype:s,memoryOffset:null,refCount:a});return}const i=J(r),l=i*mc(s),u=this.wasm._malloc(l)>>>0;this.dataIdMap.set(e,{id:o,memoryOffset:u,shape:r,dtype:s,refCount:a}),this.wasm.tfjs.registerTensor(o,i,u),n!=null&&this.wasm.HEAPU8.set(new Uint8Array(n.buffer,n.byteOffset,l),u)}async read(e){return this.readSync(e)}readSync(e,n,r){const{memoryOffset:s,dtype:a,shape:o,stringBytes:i}=this.dataIdMap.get(e);if(a==="string")return(n==null||n===0)&&(r==null||r>=i.length)?i:i.slice(n,r);n=n||0,r=r||J(o);const l=mc(a),u=this.wasm.HEAPU8.slice(s+n*l,s+r*l);return xU(u.buffer,a)}disposeData(e,n=!1){if(this.dataIdMap.has(e)){const r=this.dataIdMap.get(e);if(r.refCount--,!n&&r.refCount>0)return!1;this.wasm._free(r.memoryOffset),this.wasm.tfjs.disposeData(r.id),this.dataIdMap.delete(e)}return!0}refCount(e){return this.dataIdMap.has(e)?this.dataIdMap.get(e).refCount:0}incRef(e){const n=this.dataIdMap.get(e);n!=null&&n.refCount++}floatPrecision(){return 32}getMemoryOffset(e){return this.dataIdMap.get(e).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(e,n,r,s){let a;if(r==null)a=this.write(s!=null?s:null,e,n);else{const o=this.dataIdNextNumber++;a={id:o},this.dataIdMap.set(a,{id:o,memoryOffset:r,shape:e,dtype:n,refCount:1});const i=J(e);this.wasm.tfjs.registerTensor(o,i,r)}return{dataId:a,shape:e,dtype:n}}typedArrayFromHeap({shape:e,dtype:n,dataId:r}){const s=this.wasm.HEAPU8.buffer,{memoryOffset:a}=this.dataIdMap.get(r),o=J(e);switch(n){case"float32":return new Float32Array(s,a,o);case"int32":return new Int32Array(s,a,o);case"bool":return new Uint8Array(s,a,o);default:throw new Error("Unknown dtype ".concat(n))}}}function wU(t){return(e,n)=>(cN(t,{credentials:"same-origin"}).then(r=>{r.ok||e.env.a("failed to load wasm binary file at '".concat(t,"'")),r.arrayBuffer().then(s=>{WebAssembly.instantiate(s,e).then(a=>{n(a.instance,a.module)})})}),{})}function Zv(t,e,n){let r="tfjs-backend-wasm.wasm";return t&&e?r="tfjs-backend-wasm-threaded-simd.wasm":t&&(r="tfjs-backend-wasm-simd.wasm"),tc!=null&&tc[r]!=null?tc[r]:n+r}async function SU(){const[t,e]=await Promise.all([Qe().getAsync("WAS
8911M_HAS_SIMD_SUPPORT"),Qe().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((n,r)=>{const s={};s.locateFile=(i,l)=>{if(i.endsWith(".worker.js")){const u=gU.replace(/\n/g,"\\n"),c=new Blob([u],{type:"application/javascript"});return URL.createObjectURL(c)}return i.endsWith(".wasm")?Zv(t,e,ji!=null?ji:l):l+i},Xx&&(s.instantiateWasm=wU(Zv(t,e,ji!=null?ji:"")));let a=!1;s.onAbort=()=>{if(a||Pl)return;Pl=!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"})};let o;e&&t&&IU==null?(s.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+Qv.toString()],{type:"text/javascript"}),o=Qv(s)):o=vU(s),o.then(i=>{a=!0,Pl=!1;const l=null;i.tfjs={init:i.cwrap("init",null,[]),initWithThreadsCount:i.cwrap("init_with_threads_count",null,["number"]),getThreadsCount:i.cwrap("get_threads_count","number",[]),registerTensor:i.cwrap("register_tensor",null,["number","number","number"]),disposeData:i.cwrap("dispose_data",l,["number"]),dispose:i.cwrap("dispose",l,[])},n({wasm:i})}).catch(r)})}function xU(t,e){switch(e){case"float32":return new Float32Array(t);case"int32":return new Int32Array(t);case"bool":return new Uint8Array(t);default:throw new Error("Unknown dtype ".concat(e))}}const _U=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"];let IU=null,ji=null,tc={},Pl=!1,Xx=!1;function kU(t,e=!1){if(Pl)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof t=="string")ji=t;else{tc=t;const n=_U.filter(r=>tc[r]==null);if(n.length>0)throw new Error("There were no entries found for the following binaries: "+"".concat(n.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.")}Xx=e}let EU=-1;/** @license See the LICENSE file. */const TU="4.11.0";/** 8912 * @license 8913 * Copyright 2020 Google LLC. All Rights Reserved. 8914 * Licensed under the Apache License, Version 2.0 (the "License"); 8915 * you may not use this file except in compliance with the License. 8916 * You may obtain a copy of the License at 8917 * 8918 * http://www.apache.org/licenses/LICENSE-2.0 8919 * 8920 * Unless required by applicable law or agreed to in writing, software 8921 * distributed under the License is distributed on an "AS IS" BASIS, 8922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8923 * See the License for the specific language governing permissions and 8924 * limitations under the License. 8925 * ============================================================================= 8926 */const CU=2;kw("wasm",async()=>{const{wasm:t}=await SU();return new bU(t)},CU);/** 8927 * @license 8928 * Copyright 2021 Google LLC. All Rights Reserved. 8929 * Licensed under the Apache License, Version 2.0 (the "License"); 8930 * you may not use this file except in compliance with the License. 8931 * You may obtain a copy of the License at 8932 * 8933 * http://www.apache.org/licenses/LICENSE-2.0 8934 * 8935 * Unless required by applicable law or agreed to in writing, software 8936 * distributed under the License is distributed on an "AS IS" BASIS, 8937 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8938 * See the License for the specific language governing permissions and 8939 * limitations under the License. 8940 * ============================================================================= 8941 */const NU=i2;class Kf extends _m{nextDataId(){return Kf.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new x1(this,Ih())}write(e,n,r){this.firstUse&&(this.firstUse=!1,Qe().get("IS_NODE")&&Ea("\n============================\nHi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details. \n============================"));const s={id:this.nextDataId()};return this.data.set(s,{values:e,dtype:r,refCount:1}),s}makeTensorInfo(e,n,r){let s;if(n==="string"&&r!=null&&r.length>0&&Mu(r[0])){const a=r.map(o=>Pa(o));s=this.write(a,e,n)}else s=this.write(r,e,n);return{dataId:s,shape:e,dtype:n}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){const n=this.data.get(e);n.refCount++}decRef(e){if(this.data.has(e)){const n=this.data.get(e);n.refCount--}}move(e,n,r,s,a){this.data.set(e,{values:n,dtype:s,refCount:a})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:n,complexTensorInfos:r}=this.data.get(e);if(n==="complex64"){const s=this.readSync(r.real.dataId),a=this.readSync(r.imag.dataId);return Qo(s,a)}return jC(this.data.get(e).values,n)}bufferSync(e){const n=this.readSync(e.dataId);if(e.dtype==="string")try{const r=n.map(s=>bc(s));return rt(e.shape,e.dtype,r)}catch(r){throw new Error("Failed to decode encoded string bytes into utf-8")}return rt(e.shape,e.dtype,n)}makeOutput(e,n,r){return Ih().makeTensorFromTensorInfo(this.makeTensorInfo(n,r,e),this)}
vendor: 4,374 bytes, lines 8941-9004
8941disposeData(e,n=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!n&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:r}=this.data.get(e);r!=null&&(this.disposeData(r.real.dataId,!0),this.disposeData(r.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const n=Qs();return e(),{kernelMs:Qs()-n}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){_e([e],"where");const n=this.readSync(e.dataId);return NU(e.shape,n)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}Kf.nextDataId=0;/** 8942 * @license 8943 * Copyright 2020 Google LLC. All Rights Reserved. 8944 * Licensed under the Apache License, Version 2.0 (the "License"); 8945 * you may not use this file except in compliance with the License. 8946 * You may obtain a copy of the License at 8947 * 8948 * http://www.apache.org/licenses/LICENSE-2.0 8949 * 8950 * Unless required by applicable law or agreed to in writing, software 8951 * distributed under the License is distributed on an "AS IS" BASIS, 8952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8953 * See the License for the specific language governing permissions and 8954 * limitations under the License. 8955 * ============================================================================= 8956 */kw("cpu",()=>new Kf,1);/** 8957 * @license 8958 * Copyright 2020 Google LLC. All Rights Reserved. 8959 * Licensed under the Apache License, Version 2.0 (the License); 8960 * you may not use this file except in compliance with the License. 8961 * You may obtain a copy of the License at 8962 * 8963 * http://www.apache.org/licenses/LICENSE-2.0 8964 * 8965 * Unless required by applicable law or agreed to in writing, software 8966 * distributed under the License is distributed on an AS IS BASIS, 8967 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8968 * See the License for the specific language governing permissions and 8969 * limitations under the License. 8970 * ============================================================================= 8971 */const Yx=mt(dd,t=>t>=0?t:Math.exp(t)-1),AU={kernelName:dd,backendName:"cpu",kernelFunc:Yx};/** 8972 * @license 8973 * Copyright 2020 Google LLC. All Rights Reserved. 8974 * Licensed under the Apache License, Version 2.0 (the "License"); 8975 * you may not use this file except in compliance with the License. 8976 * You may obtain a copy of the License at 8977 * 8978 * http://www.apache.org/licenses/LICENSE-2.0 8979 * 8980 * Unless required by applicable law or agreed to in writing, software 8981 * distributed under the License is distributed on an "AS IS" BASIS, 8982 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8983 * See the License for the specific language governing permissions and 8984 * limitations under the License. 8985 * ============================================================================= 8986 */function Jx(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{alpha:a}=r;_e([s],"leakyRelu");const o=J(s.shape),i=n.data.get(s.dataId).values,l=$n("float32",o);for(let u=0;u<i.length;u++)l[u]=i[u]<0?a*i[u]:i[u];return n.makeTensorInfo(s.shape,"float32",l)}const $U={kernelName:Td,backendName:"cpu",kernelFunc:Jx};/** 8987 * @license 8988 * Copyright 2020 Google LLC. All Rights Reserved. 8989 * Licensed under the Apache License, Version 2.0 (the License); 8990 * you may not use this file except in compliance with the License. 8991 * You may obtain a copy of the License at 8992 * 8993 * http://www.apache.org/licenses/LICENSE-2.0 8994 * 8995 * Unless required by applicable law or agreed to in writing, software 8996 * distributed under the License is distributed on an AS IS BASIS, 8997 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8998 * See the License for the specific language governing permissions and 8999 * limitations under the License. 9000 * ============================================================================= 9001 */const RU=Qt((t,e)=>t<0?e*t:t);function Qx(t){const{inputs:e,backend:n}=t,{x:r,alpha:s}=e;_e([r,s],"prelu");const a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,[i,l]=RU(r.shape,s.shape,a,o,"float32");return n.makeTensorInfo(l,"float32",i)}const DU={kernelName:ef,backendName:"cpu",kernelFunc:Qx};/** 9002 * @license 9003 * Copyright 2020 Google LLC. All Rights Reserved. 9004 * Licensed under the Apache License, Version 2.0 (the License);
9005 * you may not use this file except in compliance with the License. 9006 * You may obtain a copy of the License at 9007 * 9008 * http://www.apache.org/licenses/LICENSE-2.0 9009 * 9010 * Unless required by applicable law or agreed to in writing, software 9011 * distributed under the License is distributed on an AS IS BASIS, 9012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9013 * See the License for the specific language governing permissions and 9014 * limitations under the License. 9015 * ============================================================================= 9016 */const Zx=mt(rf,t=>Math.max(0,t)),FU={kernelName:rf,backendName:"cpu",kernelFunc:Zx};/** 9017 * @license 9018 * Copyright 2020 Google LLC. All Rights Reserved. 9019 * Licensed under the Apache License, Version 2.0 (the License); 9020 * you may not use this file except in compliance with the License. 9021 * You may obtain a copy of the License at 9022 * 9023 * http://www.apache.org/licenses/LICENSE-2.0 9024 * 9025 * Unless required by applicable law or agreed to in writing, software 9026 * distributed under the License is distributed on an AS IS BASIS, 9027 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9028 * See the License for the specific language governing permissions and 9029 * limitations under the License. 9030 * ============================================================================= 9031 */const e_=mt(of,t=>Math.min(Math.max(0,t),6)),MU={kernelName:of,backendName:"cpu",kernelFunc:e_};/** 9032 * @license 9033 * Copyright 2020 Google LLC. All Rights Reserved. 9034 * Licensed under the Apache License, Version 2.0 (the "License"); 9035 * you may not use this file except in compliance with the License. 9036 * You may obtain a copy of the License at 9037 * 9038 * http://www.apache.org/licenses/LICENSE-2.0 9039 * 9040 * Unless required by applicable law or agreed to in writing, software 9041 * distributed under the License is distributed on an "AS IS" BASIS, 9042 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9043 * See the License for the specific language governing permissions and 9044 * limitations under the License. 9045 * ============================================================================= 9046 */function vu(t,e,n,r,s){if(n==="linear")return ss({inputs:{x:e},backend:t});if(n==="relu")return Zx({inputs:{x:e},backend:t});if(n==="elu")return Yx({inputs:{x:e},backend:t});if(n==="relu6")return e_({inputs:{x:e},backend:t});if(n==="prelu")return Qx({inputs:{x:e,alpha:r},backend:t});if(n==="leakyrelu")return Jx({inputs:{x:e},backend:t,attrs:{alpha:s}});if(n==="sigmoid")return yS({inputs:{x:e},backend:t});throw new Error("Activation ".concat(n," has not been implemented for the CPU backend."))}/** 9047 * @license 9048 * Copyright 2020 Google LLC. All Rights Reserved. 9049 * Licensed under the Apache License, Version 2.0 (the "License"); 9050 * you may not use this file except in compliance with the License. 9051 * You may obtain a copy of the License at 9052 * 9053 * http://www.apache.org/licenses/LICENSE-2.0 9054 * 9055 * Unless required by applicable law or agreed to in writing, software 9056 * distributed under the License is distributed on an "AS IS" BASIS, 9057 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9058 * See the License for the specific language governing permissions and 9059 * limitations under the License. 9060 * ============================================================================= 9061 */function Dt(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{shape:a}=r,o=J(s.shape),i=_1(a,o),l=J(i);A(o===l,()=>"The new shape (".concat(i,") has ").concat(l," elements and the old ")+"shape (".concat(s.shape,") has ").concat(o," elements. The new shape and old ")+"shape must have the same number of elements."),n.incRef(s.dataId);const u=n.data.get(s.dataId);if(u.complexTensorInfos!=null){const c=u.complexTensorInfos.real,d=u.complexTensorInfos.imag;c.shape=i,d.shape=i}return{dataId:s.dataId,shape:i,dtype:s.dtype}}const OU={kernelName:Km,backendName:"cpu",kernelFunc:Dt};/** 9062 * @license 9063 * Copyright 2020 Google LLC. All Rights Reserved. 9064 * Licensed under the Apache License, Version 2.0 (the License); 9065 * you may not use this file except in compliance with the License. 9066 * You may obtain a copy of the License at 9067 * 9068 * http://www.apache.org/licenses/LICENSE-2.0 9069 * 9070 * Unless required by applicable law or agreed to in writing, softw
9070are 9071 * distributed under the License is distributed on an AS IS BASIS, 9072 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9073 * See the License for the specific language governing permissions and 9074 * limitations under the License. 9075 * ============================================================================= 9076 */function t_(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:a}=e,{transposeA:o,transposeB:i}=r;_e([s,a],"matMul");const l=s.shape.length,u=a.shape.length,c=o?s.shape[l-2]:s.shape[l-1],d=i?a.shape[u-1]:a.shape[u-2],f=o?s.shape[l-1]:s.shape[l-2],p=i?a.shape[u-2]:a.shape[u-1],h=s.shape.slice(0,-2),m=a.shape.slice(0,-2),g=J(h),v=J(m),w=Rt(s.shape.slice(0,-2),a.shape.slice(0,-2)).concat([f,p]);A(c===d,()=>"Error in matMul: inner shapes (".concat(c,") and (")+"".concat(d,") of Tensors with shapes ").concat(s.shape," and ")+"".concat(a.shape," and transposeA=").concat(o)+" and transposeB=".concat(i," must match."));const S=o?[g,c,f]:[g,f,c],I=i?[v,p,d]:[v,d,p],E=Dt({inputs:{x:s},backend:n,attrs:{shape:S}}),T=Dt({inputs:{x:a},backend:n,attrs:{shape:I}}),D=o?E.shape[1]:E.shape[2],R=o?E.shape[2]:E.shape[1],$=i?T.shape[1]:T.shape[2],M=Math.max(g,v),B=n.data.get(E.dataId).values,z=n.data.get(T.dataId).values,H=Ie(E.shape),V=Ie(T.shape),[X,Q,K]=o?[H[0],1,H[1]]:[H[0],H[1],1],[ee,ae,ne]=i?[1,V[1],V[0]]:[V[1],1,V[0]],ce=R*$,se=rt([M,R,$],E.dtype),oe=se.values,ie=n.blockSize;for(let pe=0;pe<M;pe++){const ve=pe%g,fe=pe%v;for(let be=0;be<R;be+=ie){const $e=Math.min(be+ie,R);for(let Re=0;Re<$;Re+=ie){const De=Math.min(Re+ie,$);for(let Pe=0;Pe<D;Pe+=ie){const je=Math.min(Pe+ie,D);for(let Ue=be;Ue<$e;Ue++)for(let Ce=Re;Ce<De;Ce++){let Ze=0;for(let Ke=Pe;Ke<je;Ke++){const Ne=B[ve*X+Ue*Q+Ke*K],Ge=z[Ke*ee+Ce*ae+fe*ne];Ze+=Ne*Ge}oe[pe*ce+(Ue*$+Ce)]+=Ze}}}}}return n.disposeIntermediateTensorInfo(E),n.disposeIntermediateTensorInfo(T),n.makeTensorInfo(w,se.dtype,se.values)}const PU={kernelName:qu,backendName:"cpu",kernelFunc:t_};/** 9077 * @license 9078 * Copyright 2020 Google LLC. All Rights Reserved. 9079 * Licensed under the Apache License, Version 2.0 (the License); 9080 * you may not use this file except in compliance with the License. 9081 * You may obtain a copy of the License at 9082 * 9083 * http://www.apache.org/licenses/LICENSE-2.0 9084 * 9085 * Unless required by applicable law or agreed to in writing, software 9086 * distributed under the License is distributed on an AS IS BASIS, 9087 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9088 * See the License for the specific language governing permissions and 9089 * limitations under the License. 9090 * ============================================================================= 9091 */function BU(t){const{inputs:e,backend:n,attrs:r}=t,{a:s,b:a,bias:o,preluActivationWeights:i}=e,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r;let f,p,h;const m=[];f=t_({inputs:{a:s,b:a},attrs:{transposeA:l,transposeB:u},backend:n}),o&&(p=Zo({inputs:{a:f,b:o},backend:n}),m.push(f),f=p),c&&(h=vu(n,f,c,i,d),m.push(f),f=h);for(const v of m)n.disposeIntermediateTensorInfo(v);return f}const LU={kernelName:gc,backendName:"cpu",kernelFunc:BU};/** 9092 * @license 9093 * Copyright 2020 Google LLC. All Rights Reserved. 9094 * Licensed under the Apache License, Version 2.0 (the License); 9095 * you may not use this file except in compliance with the License. 9096 * You may obtain a copy of the License at 9097 * 9098 * http://www.apache.org/licenses/LICENSE-2.0 9099 * 9100 * Unless required by applicable law or agreed to in writing, software 9101 * distributed under the License is distributed on an AS IS BASIS, 9102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9103 * See the License for the specific language governing permissions and 9104 * limitations under the License. 9105 * ============================================================================= 9106 */const WU=mt(Ou,t=>Math.acos(t)),zU={kernelName:Ou,backendName:"cpu",kernelFunc:WU};/** 9107 * @license 9108 * Copyright 2020 Google LLC. All Rights Reserved. 9109 * Licensed under the Apache License, Version 2.0 (the License); 9110 * you may not use this file except in compliance with the License. 9111 * You may obtain a copy of the License at 9112 * 9113 * http://www.apache.org/licenses/LICENSE-2.0 9114 * 9115 * Unless required by applicable law or agreed to in writing, softw
9115are 9116 * distributed under the License is distributed on an AS IS BASIS, 9117 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9118 * See the License for the specific language governing permissions and 9119 * limitations under the License. 9120 * ============================================================================= 9121 */const HU=mt(Pu,t=>Math.acosh(t)),UU={kernelName:Pu,backendName:"cpu",kernelFunc:HU};/** 9122 * @license 9123 * Copyright 2020 Google LLC. All Rights Reserved. 9124 * Licensed under the Apache License, Version 2.0 (the "License"); 9125 * you may not use this file except in compliance with the License. 9126 * You may obtain a copy of the License at 9127 * 9128 * http://www.apache.org/licenses/LICENSE-2.0 9129 * 9130 * Unless required by applicable law or agreed to in writing, software 9131 * distributed under the License is distributed on an "AS IS" BASIS, 9132 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9133 * See the License for the specific language governing permissions and 9134 * limitations under the License. 9135 * ============================================================================= 9136 */function VU(t){const{inputs:e,backend:n}=t,r=e;_e(e,"addN");const s=r.map(i=>n.data.get(i.dataId).values),a=rt(r[0].shape,r[0].dtype),o=a.values;for(let i=0;i<r.length;i++){const l=s[i];for(let u=0;u<o.length;u++)o[u]+=l[u]}return n.makeTensorInfo(a.shape,a.dtype,a.values)}const jU={kernelName:Bu,backendName:"cpu",kernelFunc:VU};/** 9137 * @license 9138 * Copyright 2020 Google LLC. All Rights Reserved. 9139 * Licensed under the Apache License, Version 2.0 (the "License"); 9140 * you may not use this file except in compliance with the License. 9141 * You may obtain a copy of the License at 9142 * 9143 * http://www.apache.org/licenses/LICENSE-2.0 9144 * 9145 * Unless required by applicable law or agreed to in writing, software 9146 * distributed under the License is distributed on an "AS IS" BASIS, 9147 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9148 * See the License for the specific language governing permissions and 9149 * limitations under the License. 9150 * ============================================================================= 9151 */function GU(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r;_e(s,"all");const i=Vt(a,s.shape);let l=i;const u=fr(l,s.shape.length);let c=s;u!=null&&(c=Un({inputs:{x:s},backend:n,attrs:{perm:u}}),l=Fn(l.length,s.shape.length)),Dn("all",l,c.shape.length);const[d,f]=Rn(c.shape,l),p=J(f),h=xn(J(d),c.dtype),m=n.data.get(c.dataId).values;for(let v=0;v<h.length;++v){const b=v*p;let w=m[b];for(let S=0;S<p;++S){const I=m[b+S];w=w&&I}h[v]=w}u!=null&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,h);if(o){const v=gn(d,i),b=Dt({inputs:{x:g},backend:n,attrs:{shape:v}});return n.disposeIntermediateTensorInfo(g),b}return g}const qU={kernelName:Lu,backendName:"cpu",kernelFunc:GU};/** 9152 * @license 9153 * Copyright 2020 Google LLC. All Rights Reserved. 9154 * Licensed under the Apache License, Version 2.0 (the "License"); 9155 * you may not use this file except in compliance with the License. 9156 * You may obtain a copy of the License at 9157 * 9158 * http://www.apache.org/licenses/LICENSE-2.0 9159 * 9160 * Unless required by applicable law or agreed to in writing, software 9161 * distributed under the License is distributed on an "AS IS" BASIS, 9162 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9163 * See the License for the specific language governing permissions and 9164 * limitations under the License. 9165 * ============================================================================= 9166 */function KU(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r;_e(s,"any");const i=Vt(a,s.shape);let l=i;const u=fr(l,s.shape.length);let c=s;u!=null&&(c=Un({inputs:{x:s},backend:n,attrs:{perm:u}}),l=Fn(l.length,s.shape.length)),Dn("any",l,c.shape.length);const[d,f]=Rn(c.shape,l),p=J(f),h=xn(J(d),c.dtype),m=n.data.get(c.dataId).values;for(let v=0;v<h.length;++v){const b=v*p;let w=m[b];for(let S=0;S<p;++S){const I=m[b+S];w=w||I}h[v]=w}u!=null&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,h);if(o){const v=gn(d,i),b=Dt({inputs:{x:g},backend:n,attrs:{shape:v}});return n.disposeIntermediateTensorInfo(g),b}return g}const XU={kernelName:Wu,backendName:"cpu",kernelFunc:KU};/** 9167 * @license 9168 * Copyright 2020 Google LLC. All Rights Reserved. 9169 * Licensed under the Apache License, Version 2.0 (the "License");
9170 * you may not use this file except in compliance with the License. 9171 * You may obtain a copy of the License at 9172 * 9173 * http://www.apache.org/licenses/LICENSE-2.0 9174 * 9175 * Unless required by applicable law or agreed to in writing, software 9176 * distributed under the License is distributed on an "AS IS" BASIS, 9177 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9178 * See the License for the specific language governing permissions and 9179 * limitations under the License. 9180 * ============================================================================= 9181 */function YU(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a}=r;_e(s,"argMax");let o=Vt(a,s.shape);const i=fr(o,s.shape.length);let l=s;const u=[];i!=null&&(l=Un({inputs:{x:s},backend:n,attrs:{perm:i}}),u.push(l),o=Fn(o.length,l.shape.length)),o=[o[0]],Dn("argMax",o,l.shape.length);const[c,d]=Rn(l.shape,o),f=J(c),p=xn(f,"int32"),h=J(d),m=n.data.get(l.dataId).values;for(let g=0;g<p.length;++g){const v=g*h;let b=m[v],w=0;for(let S=0;S<h;++S){const I=m[v+S];I>b&&(b=I,w=S)}p[g]=w}return u.forEach(g=>n.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(c,"int32",p)}const JU={kernelName:Cm,backendName:"cpu",kernelFunc:YU};/** 9182 * @license 9183 * Copyright 2020 Google LLC. All Rights Reserved. 9184 * Licensed under the Apache License, Version 2.0 (the "License"); 9185 * you may not use this file except in compliance with the License. 9186 * You may obtain a copy of the License at 9187 * 9188 * http://www.apache.org/licenses/LICENSE-2.0 9189 * 9190 * Unless required by applicable law or agreed to in writing, software 9191 * distributed under the License is distributed on an "AS IS" BASIS, 9192 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9193 * See the License for the specific language governing permissions and 9194 * limitations under the License. 9195 * ============================================================================= 9196 */function QU(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a}=r;_e(s,"argMin");let o=Vt(a,s.shape);const i=fr(o,s.shape.length);let l=s;const u=[];i!=null&&(l=Un({inputs:{x:s},backend:n,attrs:{perm:i}}),u.push(l),o=Fn(o.length,l.shape.length)),o=[o[0]],Dn("argMin",o,l.shape.length);const[c,d]=Rn(l.shape,o),f=J(c),p=xn(f,"int32"),h=J(d),m=n.data.get(l.dataId).values;for(let g=0;g<p.length;++g){const v=g*h;let b=m[v],w=0;for(let S=0;S<h;++S){const I=m[v+S];I<b&&(b=I,w=S)}p[g]=w}return u.forEach(g=>n.disposeIntermediateTensorInfo(g)),n.makeTensorInfo(c,"int32",p)}const ZU={kernelName:Nm,backendName:"cpu",kernelFunc:QU};/** 9197 * @license 9198 * Copyright 2020 Google LLC. All Rights Reserved. 9199 * Licensed under the Apache License, Version 2.0 (the License); 9200 * you may not use this file except in compliance with the License. 9201 * You may obtain a copy of the License at 9202 * 9203 * http://www.apache.org/licenses/LICENSE-2.0 9204 * 9205 * Unless required by applicable law or agreed to in writing, software 9206 * distributed under the License is distributed on an AS IS BASIS, 9207 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9208 * See the License for the specific language governing permissions and 9209 * limitations under the License. 9210 * ============================================================================= 9211 */const eV=mt(zu,t=>Math.asin(t)),tV={kernelName:zu,backendName:"cpu",kernelFunc:eV};/** 9212 * @license 9213 * Copyright 2020 Google LLC. All Rights Reserved. 9214 * Licensed under the Apache License, Version 2.0 (the License); 9215 * you may not use this file except in compliance with the License. 9216 * You may obtain a copy of the License at 9217 * 9218 * http://www.apache.org/licenses/LICENSE-2.0 9219 * 9220 * Unless required by applicable law or agreed to in writing, software 9221 * distributed under the License is distributed on an AS IS BASIS, 9222 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9223 * See the License for the specific language governing permissions and 9224 * limitations under the License. 9225 * ============================================================================= 9226 */const nV=mt(Hu,t=>Math.asinh(t)),rV={kernelName:Hu,backendName:"cpu",kernelFunc:nV};/** 9227 * @license 9228 * Copyright 2020 Google LLC. All Rights Reserved. 9229 * Licensed under the Apache License, Version 2.0 (the License);
9230 * you may not use this file except in compliance with the License. 9231 * You may obtain a copy of the License at 9232 * 9233 * http://www.apache.org/licenses/LICENSE-2.0 9234 * 9235 * Unless required by applicable law or agreed to in writing, software 9236 * distributed under the License is distributed on an AS IS BASIS, 9237 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9238 * See the License for the specific language governing permissions and 9239 * limitations under the License. 9240 * ============================================================================= 9241 */const sV=mt(Uu,t=>Math.atan(t)),aV={kernelName:Uu,backendName:"cpu",kernelFunc:sV};/** 9242 * @license 9243 * Copyright 2020 Google LLC. All Rights Reserved. 9244 * Licensed under the Apache License, Version 2.0 (the License); 9245 * you may not use this file except in compliance with the License. 9246 * You may obtain a copy of the License at 9247 * 9248 * http://www.apache.org/licenses/LICENSE-2.0 9249 * 9250 * Unless required by applicable law or agreed to in writing, software 9251 * distributed under the License is distributed on an AS IS BASIS, 9252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9253 * See the License for the specific language governing permissions and 9254 * limitations under the License. 9255 * ============================================================================= 9256 */const oV=Qt((t,e)=>Math.atan2(t,e)),iV=ln(ju,oV),cV={kernelName:ju,backendName:"cpu",kernelFunc:iV};/** 9257 * @license 9258 * Copyright 2020 Google LLC. All Rights Reserved. 9259 * Licensed under the Apache License, Version 2.0 (the License); 9260 * you may not use this file except in compliance with the License. 9261 * You may obtain a copy of the License at 9262 * 9263 * http://www.apache.org/licenses/LICENSE-2.0 9264 * 9265 * Unless required by applicable law or agreed to in writing, software 9266 * distributed under the License is distributed on an AS IS BASIS, 9267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9268 * See the License for the specific language governing permissions and 9269 * limitations under the License. 9270 * ============================================================================= 9271 */const lV=mt(Vu,t=>Math.atanh(t)),uV={kernelName:Vu,backendName:"cpu",kernelFunc:lV};/** 9272 * @license 9273 * Copyright 2020 Google LLC. All Rights Reserved. 9274 * Licensed under the Apache License, Version 2.0 (the "License"); 9275 * you may not use this file except in compliance with the License. 9276 * You may obtain a copy of the License at 9277 * 9278 * http://www.apache.org/licenses/LICENSE-2.0 9279 * 9280 * Unless required by applicable law or agreed to in writing, software 9281 * distributed under the License is distributed on an "AS IS" BASIS, 9282 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9283 * See the License for the specific language governing permissions and 9284 * limitations under the License. 9285 * ============================================================================= 9286 */function Wg(t,e,n,r,s,a){const o=s.strideHeight,i=s.strideWidth,l=s.dilationHeight,u=s.dilationWidth,c=s.effectiveFilterHeight,d=s.effectiveFilterWidth,f=s.padInfo.top,p=s.padInfo.left,h=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=rt(s.outShape,n),g=m.values,v=s.outShape[1]*s.outShape[2]*s.outShape[3],b=s.outShape[2]*s.outShape[3],w=s.outShape[3];for(let S=0;S<s.batchSize;++S){const I=S*v,E=S*r[0];for(let T=0;T<s.inChannels;++T)for(let D=0;D<s.outHeight;++D){const R=D*o-f,$=Math.max(0,R),M=Math.min(s.inHeight,c+R),B=I+D*b;for(let z=0;z<s.outWidth;++z){const H=z*i-p,V=Math.max(0,H),X=Math.min(s.inWidth,d+H);let Q=h,K=0,ee=0;for(let ne=$;ne<M;ne+=l){const ce=E+ne*r[1];for(let se=V;se<X;se+=u){const oe=ce+se*r[2],ie=t[oe+T];a==="max"&&ie>Q?Q=ie:a==="avg"&&(K+=ie,ee++)}if(isNaN(Q))break}const ae=B+z*w+T;g[ae]=a==="avg"?K/ee:Q}}}return m}function n_(t,e,n,r,s=!1,a=!1){const o=rt(r.outShape,"int32"),i=r.strideHeight,l=r.strideWidth,u=r.dilationHeight,c=r.dilationWidth,d=r.effectiveFilterHeight,f=r.effectiveFilterWidth,p=r.padInfo.top,h=r.padInfo.left,m=rt(e,n,t);for(let g=0;g<r.batchSize;++g)for(let v=0;v<r.inChannels;++v)for(let b=0;b<r.outHeight;++b){const w=b*i-p;let S=w;for(;S<0;)S+=u;const I=Math.min(r.inHeight,d+w);for(let E=0;E<r.outWidth;++E){const T=E*l-h;let D=T;for(;D<0;)D+=c;const R=Math.min(r.inWidth,f+T);let $=Number.NEGATIVE_INFINITY,M=-1;for(let B=S;B<I;B+=u){const z=B-w;for(let H=D;H<R;H+=c){const V=H-T,X=m.get(g,B,H,v);X>$&&($=X,s?M=a?((g*r.inHeight+B)*r.inWidth+H)*r.inChannels+v:(B*r.inWidth+H)*r.inChannels+v:M=z*f+V)}}o.set(M,g,b,E,v)}}return o}function r_(t,e,n,r,s,a){const o=s.strideDepth,i=s.strideHeight,l=s.strideWidth,u=s.dilationDepth,c=s.dilationHeight,d=s.dilationWidth,f=s.effectiveFilterDepth,p=s.effectiveFilterHeight,h=s.effectiveFilterWidth,m=s.padInfo.front,g=s.padInfo.top,v=s.padInfo.left,b=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,w=rt(s.outShape,n),S=w.values,I=s.outShape[1]*s.outShape[2]*s.outShape[3]*s.outShape[4],E=s.outShape[2]*s.outShape[3]*s.outShape[4],T=s.outShape[3]*s.outShape[4],D=s.outShape[4];for(let R=0;R<s.batchSize;++R){const $=R*I,M=R*r[0];for(let B=0;B<s.inChannels;++B)for(let z=0;z<s.outDepth;++z){const H=z*o-m;let V=H;for(;V<0;)V+=u;const X=Math.min(s.inDepth,f+H),Q=$+z*E;for(let K=0;K<s.outHeight;++K){const ee=K*i-g;let ae=ee;for(;ae<0;)ae+=c;const ne=Math.min(s.inHeight,p+ee),ce=Q+K*T;for(let se=0;se<s.outWidth;++se){const oe=se*l-v;let ie=oe;for(;ie<0;)ie+=d;const pe=Math.min(s.inWidth,h+oe),ve=ce+se*D;let fe=b,be=0,$e=0;for(let De=V;De<X;De+=u){const Pe=M+De*r[1];for(let je=ae;je<ne;je+=c){const Ue=Pe+je*r[2];for(let Ce=ie;Ce<pe;Ce+=d){const Ze=Ue+Ce*r[3],Ke=t[Ze+B];if(a==="max"&&Ke>fe?fe=Ke:a==="avg"&&(be+=Ke,$e++),isNaN(fe))break}if(isNaN(fe))break}if(isNaN(fe))break}const Re=ve+B;S[Re]=a==="avg"?be/Math.max($e,1):fe}}}}return w}function dV(t,e){const n=rt(e.outShape,"int32"),r=e.strideDepth,s=e.strideHeight,a=e.strideWidth,o=e.dilationDepth,i=e.dilationHeight,l=e.dilationWidth,u=e.effectiveFilterDepth,c=e.effectiveFilterHeight,d=e.effectiveFilterWidth,f=e.padInfo.front,p=e.padInfo.top,h=e.padInfo.left;for(let m=0;m<e.batchSize;++m)for(let g=0;g<e.inChannels;++g)for(let v=0;v<e.outDepth;++v){const b=v*r-f;let w=b;for(;w<0;)w+=o;const S=Math.min(e.inDepth,u+b);for(let I=0;I<e.outHeight;++I){const E=I*s-p;let T=E;for(;T<0;)T+=i;const D=Math.min(e.inHeight,c+E);for(let R=0;R<e.outWidth;++R){const $=R*a-h;let M=$;for(;M<0;)M+=l;const B=Math.min(e.inWidth,d+$);let z=Number.NEGATIVE_INFINITY,H=-1;for(let V=w;V<S;V+=o){const X=V-b;for(let Q=T;Q<D;Q+=i){const K=Q-E;for(let ee=M;ee<B;ee+=l){const ae=ee-$,ne=t.get(m,V,Q,ee,g);ne>=z&&(z=ne,H=X*c*d+K*c+ae)}}}n.set(H,m,v,I,R,g)}}}return n}/** 9287 * @license 9288 * Copyright 2020 Google LLC. All Rights Reserved. 9289 * Licensed under the Apache License, Version 2.0 (the "License");
9290 * you may not use this file except in compliance with the License. 9291 * You may obtain a copy of the License at 9292 * 9293 * http://www.apache.org/licenses/LICENSE-2.0 9294 * 9295 * Unless required by applicable law or agreed to in writing, software 9296 * distributed under the License is distributed on an "AS IS" BASIS, 9297 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9298 * See the License for the specific language governing permissions and 9299 * limitations under the License. 9300 * ============================================================================= 9301 */function fV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e;_e(s,"avgPool");const{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=r,u=1;A(Tr(o,u),()=>"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(u,"'"));const c=Wr(s.shape,a,o,u,i,l);let d;if(c.filterWidth===1&&c.filterHeight===1&&Ir(c.inShape,c.outShape))d=ss({inputs:{x:s},backend:n});else{const f=n.data.get(s.dataId).values,p=Ie(s.shape),h=Wg(f,s.shape,s.dtype,p,c,"avg");d=n.makeTensorInfo(c.outShape,s.dtype,h.values)}return d}const pV={kernelName:Gu,backendName:"cpu",kernelFunc:fV};/** 9302 * @license 9303 * Copyright 2020 Google LLC. All Rights Reserved. 9304 * Licensed under the Apache License, Version 2.0 (the "License"); 9305 * you may not use this file except in compliance with the License. 9306 * You may obtain a copy of the License at 9307 * 9308 * http://www.apache.org/licenses/LICENSE-2.0 9309 * 9310 * Unless required by applicable law or agreed to in writing, software 9311 * distributed under the License is distributed on an "AS IS" BASIS, 9312 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9313 * See the License for the specific language governing permissions and 9314 * limitations under the License. 9315 * ============================================================================= 9316 */function hV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r;_e(s,"avgPool3d");const c=ia(s.shape,a,o,1,i,l,u),d=n.data.get(s.dataId).values,f=r_(d,s.shape,s.dtype,Ie(s.shape),c,"avg");return n.makeTensorInfo(f.shape,"float32",f.values)}const mV={kernelName:Am,backendName:"cpu",kernelFunc:hV};/** 9317 * @license 9318 * Copyright 2020 Google LLC. All Rights Reserved. 9319 * Licensed under the Apache License, Version 2.0 (the "License"); 9320 * you may not use this file except in compliance with the License. 9321 * You may obtain a copy of the License at 9322 * 9323 * http://www.apache.org/licenses/LICENSE-2.0 9324 * 9325 * Unless required by applicable law or agreed to in writing, software 9326 * distributed under the License is distributed on an "AS IS" BASIS, 9327 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9328 * See the License for the specific language governing permissions and 9329 * limitations under the License. 9330 * ============================================================================= 9331 */function gV(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r;_e([s,a],"avgPool3DGrad");const c=ia(a.shape,o,i,1,l,u),d=c.strideDepth,f=c.strideHeight,p=c.strideWidth,h=c.filterDepth,m=c.filterHeight,g=c.filterWidth,v=c.dilationDepth,b=c.dilationHeight,w=c.dilationWidth,S=c.effectiveFilterDepth,I=c.effectiveFilterHeight,E=c.effectiveFilterWidth,T=S-1-c.padInfo.front,D=E-1-c.padInfo.left,R=I-1-c.padInfo.top,$=rt(a.shape,"float32"),M=1/(h*m*g),B=n.bufferSync(s);for(let z=0;z<c.batchSize;++z)for(let H=0;H<c.inChannels;++H)for(let V=0;V<c.inDepth;++V)for(let X=0;X<c.inHeight;++X)for(let Q=0;Q<c.inWidth;++Q){const K=V-T,ee=X-R,ae=Q-D;let ne=0;for(let ce=0;ce<S;ce+=v){const se=(K+ce)/d;if(!(se<0||se>=c.outDepth||Math.floor(se)!==se))for(let oe=0;oe<I;oe+=b){const ie=(ee+oe)/f;if(!(ie<0||ie>=c.outHeight||Math.floor(ie)!==ie))for(let pe=0;pe<E;pe+=w){const ve=(ae+pe)/p;if(ve<0||ve>=c.outWidth||Math.floor(ve)!==ve)continue;const fe=B.get(z,se,ie,ve,H);ne+=fe}}}$.set(ne*M,z,V,X,Q,H)}return n.makeTensorInfo($.shape,$.dtype,$.values)}const yV={kernelName:N1,backendName:"cpu",kernelFunc:gV};/** 9332 * @license 9333 * Copyright 2020 Google LLC. All Rights Reserved. 9334 * Licensed under the Apache License, Version 2.0 (the "License");
9335 * you may not use this file except in compliance with the License. 9336 * You may obtain a copy of the License at 9337 * 9338 * http://www.apache.org/licenses/LICENSE-2.0 9339 * 9340 * Unless required by applicable law or agreed to in writing, software 9341 * distributed under the License is distributed on an "AS IS" BASIS, 9342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9343 * See the License for the specific language governing permissions and 9344 * limitations under the License. 9345 * ============================================================================= 9346 */function vV(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,o=a;_e([s,a],"avgPoolGrad");const{filterSize:i,strides:l,pad:u}=r,c=Wr(o.shape,i,l,1,u),d=c.strideHeight,f=c.strideWidth,p=c.filterHeight,h=c.filterWidth,m=c.dilationHeight,g=c.dilationWidth,v=c.effectiveFilterHeight,b=c.effectiveFilterWidth,w=b-1-c.padInfo.left,S=v-1-c.padInfo.top,I=rt(o.shape,"float32"),E=1/(p*h),T=n.data.get(s.dataId).values,D=rt(s.shape,"float32",T);for(let R=0;R<c.batchSize;++R)for(let $=0;$<c.inChannels;++$)for(let M=0;M<c.inHeight;++M)for(let B=0;B<c.inWidth;++B){const z=M-S,H=B-w;let V=0;for(let X=0;X<v;X+=m){const Q=(z+X)/d;if(!(Q<0||Q>=c.outHeight||Math.floor(Q)!==Q))for(let K=0;K<b;K+=g){const ee=(H+K)/f;if(ee<0||ee>=c.outWidth||Math.floor(ee)!==ee)continue;const ae=D.get(R,Q,ee,$);V+=ae}}I.set(V*E,R,M,B,$)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}const bV={kernelName:C1,backendName:"cpu",kernelFunc:vV};/** 9347 * @license 9348 * Copyright 2020 Google LLC. All Rights Reserved. 9349 * Licensed under the Apache License, Version 2.0 (the "License"); 9350 * you may not use this file except in compliance with the License. 9351 * You may obtain a copy of the License at 9352 * 9353 * http://www.apache.org/licenses/LICENSE-2.0 9354 * 9355 * Unless required by applicable law or agreed to in writing, software 9356 * distributed under the License is distributed on an "AS IS" BASIS, 9357 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9358 * See the License for the specific language governing permissions and 9359 * limitations under the License. 9360 * ============================================================================= 9361 */function wV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,scale:a,offset:o,mean:i,variance:l}=e;A(i.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),A(o==null||i.shape.length===o.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),A(a==null||i.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),_e([s,i,l,a,o],"batchNorm");let{varianceEpsilon:u}=r;u==null&&(u=.001);const c=n.data.get(s.dataId).values,d=n.data.get(i.dataId).values,f=n.data.get(l.dataId).values,p=a?n.data.get(a.dataId).values:new Float32Array([1]),h=o?n.data.get(o.dataId).values:new Float32Array([0]),m=new Float32Array(c.length),g=h.length,v=p.length,b=f.length,w=d.length;let S=0,I=0,E=0,T=0;for(let D=0;D<c.length;++D)m[D]=h[S++]+(c[D]-d[I++])*p[E++]/Math.sqrt(f[T++]+u),S>=g&&(S=0),I>=w&&(I=0),E>=v&&(E=0),T>=b&&(T=0);return n.makeTensorInfo(s.shape,s.dtype,m)}const SV={kernelName:bd,backendName:"cpu",kernelFunc:wV};/** 9362 * @license 9363 * Copyright 2020 Google LLC. All Rights Reserved. 9364 * Licensed under the Apache License, Version 2.0 (the "License"); 9365 * you may not use this file except in compliance with the License. 9366 * You may obtain a copy of the License at 9367 * 9368 * http://www.apache.org/licenses/LICENSE-2.0 9369 * 9370 * Unless required by applicable law or agreed to in writing, software 9371 * distributed under the License is distributed on an "AS IS" BASIS, 9372 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9373 * See the License for the specific language governing permissions and 9374 * limitations under the License. 9375 * ============================================================================= 9376 */function xV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockShape:a,crops:o}=r;_e([s],"batchToSpaceND");const i=a.reduce((v,b)=>v*b),l=Uf(s.shape,a,i),u=Vf(l.length,a.length),c=jf(s.shape,a,i),d=A2(o,a.length),f=$2(c,o,a.length),p=Dt({inputs:{x:s},backend:n,attrs:{shape:l}}
vendor: 4,325 bytes, lines 9376-9439
9376),h=Un({inputs:{x:p},backend:n,attrs:{perm:u}}),m=Dt({inputs:{x:h},backend:n,attrs:{shape:c}}),g=Ka({inputs:{x:m},backend:n,attrs:{begin:d,size:f}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),g}const _V={kernelName:$m,backendName:"cpu",kernelFunc:xV};/** 9377 * @license 9378 * Copyright 2020 Google LLC. All Rights Reserved. 9379 * Licensed under the Apache License, Version 2.0 (the "License"); 9380 * you may not use this file except in compliance with the License. 9381 * You may obtain a copy of the License at 9382 * 9383 * http://www.apache.org/licenses/LICENSE-2.0 9384 * 9385 * Unless required by applicable law or agreed to in writing, software 9386 * distributed under the License is distributed on an "AS IS" BASIS, 9387 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9388 * See the License for the specific language governing permissions and 9389 * limitations under the License. 9390 * ============================================================================= 9391 */function IV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,weights:a}=e,{size:o}=r,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,u=uS(i,l,a.dtype,a.shape,o);return n.makeTensorInfo([o],a.dtype,u)}const kV={kernelName:Ku,backendName:"cpu",kernelFunc:IV};/** 9392 * @license 9393 * Copyright 2021 Google LLC. All Rights Reserved. 9394 * Licensed under the Apache License, Version 2.0 (the "License"); 9395 * you may not use this file except in compliance with the License. 9396 * You may obtain a copy of the License at 9397 * 9398 * http://www.apache.org/licenses/LICENSE-2.0 9399 * 9400 * Unless required by applicable law or agreed to in writing, software 9401 * distributed under the License is distributed on an "AS IS" BASIS, 9402 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9403 * See the License for the specific language governing permissions and 9404 * limitations under the License. 9405 * ============================================================================= 9406 */function EV(t){const{inputs:e,backend:n}=t,{s0:r,s1:s}=e,a=n.data.get(r.dataId).values,o=n.data.get(s.dataId).values,i=Rt(Array.from(a),Array.from(o));return n.makeTensorInfo([i.length],"int32",Int32Array.from(i))}const TV={kernelName:Rm,backendName:"cpu",kernelFunc:EV};/** 9407 * @license 9408 * Copyright 2020 Google LLC. All Rights Reserved. 9409 * Licensed under the Apache License, Version 2.0 (the License); 9410 * you may not use this file except in compliance with the License. 9411 * You may obtain a copy of the License at 9412 * 9413 * http://www.apache.org/licenses/LICENSE-2.0 9414 * 9415 * Unless required by applicable law or agreed to in writing, software 9416 * distributed under the License is distributed on an AS IS BASIS, 9417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9418 * See the License for the specific language governing permissions and 9419 * limitations under the License. 9420 * ============================================================================= 9421 */const CV=mt(Lc,(t,e)=>{const n=e;return t>n.clipValueMax?n.clipValueMax:t<n.clipValueMin?n.clipValueMin:t}),NV={kernelName:Lc,backendName:"cpu",kernelFunc:CV};/** 9422 * @license 9423 * Copyright 2020 Google LLC. All Rights Reserved. 9424 * Licensed under the Apache License, Version 2.0 (the License); 9425 * you may not use this file except in compliance with the License. 9426 * You may obtain a copy of the License at 9427 * 9428 * http://www.apache.org/licenses/LICENSE-2.0 9429 * 9430 * Unless required by applicable law or agreed to in writing, software 9431 * distributed under the License is distributed on an AS IS BASIS, 9432 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9433 * See the License for the specific language governing permissions and 9434 * limitations under the License. 9435 * ============================================================================= 9436 */const AV=t=>{const{x:e}=t.inputs,n=t.backend,r=new Float32Array(J(e.shape)),s=n.data.get(e.dataId),a=s.complexTensorInfos.real,o=s.complexTensorInfos.imag,i=n.data.get(a.dataId).values,l=n.data.get(o.dataId).values;for(let u=0;u<i.length;u++){const c=i[u],d=l[u];r[u]=Math.hypot(c,d)}return n.makeOutput(r,e.shape,"float32")},$V={kernelName:$1,backendName:"cpu",kernelFunc:AV};/** 9437 * @license 9438 * Copyright 2020 Google LLC. All Rights Reserved. 9439 * Licensed under the Apache License, Version 2.0 (the "License");
9440 * you may not use this file except in compliance with the License. 9441 * You may obtain a copy of the License at 9442 * 9443 * http://www.apache.org/licenses/LICENSE-2.0 9444 * 9445 * Unless required by applicable law or agreed to in writing, software 9446 * distributed under the License is distributed on an "AS IS" BASIS, 9447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9448 * See the License for the specific language governing permissions and 9449 * limitations under the License. 9450 * ============================================================================= 9451 */function ei(t){const{inputs:e,backend:n}=t,{input:r}=e,s=n.data.get(r.dataId).complexTensorInfos.imag,a=n.data.get(s.dataId).values;return n.makeTensorInfo(s.shape,s.dtype,a)}const RV={kernelName:L1,backendName:"cpu",kernelFunc:ei};/** 9452 * @license 9453 * Copyright 2020 Google LLC. All Rights Reserved. 9454 * Licensed under the Apache License, Version 2.0 (the "License"); 9455 * you may not use this file except in compliance with the License. 9456 * You may obtain a copy of the License at 9457 * 9458 * http://www.apache.org/licenses/LICENSE-2.0 9459 * 9460 * Unless required by applicable law or agreed to in writing, software 9461 * distributed under the License is distributed on an "AS IS" BASIS, 9462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9463 * See the License for the specific language governing permissions and 9464 * limitations under the License. 9465 * ============================================================================= 9466 */function ti(t){const{inputs:e,backend:n,attrs:r}=t,{axis:s}=r,a=Vt(s,e[0].shape)[0],o=e.map(m=>m.shape);
vendor: 4,877 bytes, lines 9466-9499
9466C2(o,a);let i=Uo(e.map(m=>m.shape),a);if(J(i)===0)return n.makeTensorInfo(i,e[0].dtype,[]);const l=e.filter(m=>J(m.shape)>0);if(l.length===1)return ss({inputs:{x:l[0]},backend:n});if(l[0].dtype==="complex64"){const m=l.map(S=>qa({inputs:{input:S},backend:n})),g=l.map(S=>ei({inputs:{input:S},backend:n})),v=ti({inputs:m,backend:n,attrs:{axis:a}}),b=ti({inputs:g,backend:n,attrs:{axis:a}}),w=Qn({inputs:{real:v,imag:b},backend:n});return m.forEach(S=>n.disposeIntermediateTensorInfo(S)),g.forEach(S=>n.disposeIntermediateTensorInfo(S)),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),w}const u=l.map(m=>{const v=[-1,J(m.shape.slice(a))];return Dt({inputs:{x:m},backend:n,attrs:{shape:v}})}),c=u.map(m=>({vals:n.data.get(m.dataId).values,shape:m.shape}));i=Uo(u.map(m=>m.shape),1);const d=u[0].shape[0]===1,f=dS(c,i,e[0].dtype,d),p=Uo(l.map(m=>m.shape),a),h=n.makeTensorInfo(p,e[0].dtype,f);return u.forEach(m=>n.disposeIntermediateTensorInfo(m)),h}const DV={kernelName:Dm,backendName:"cpu",kernelFunc:ti};/** 9467 * @license 9468 * Copyright 2020 Google LLC. All Rights Reserved. 9469 * Licensed under the Apache License, Version 2.0 (the "License"); 9470 * you may not use this file except in compliance with the License. 9471 * You may obtain a copy of the License at 9472 * 9473 * http://www.apache.org/licenses/LICENSE-2.0 9474 * 9475 * Unless required by applicable law or agreed to in writing, software 9476 * distributed under the License is distributed on an "AS IS" BASIS, 9477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9478 * See the License for the specific language governing permissions and 9479 * limitations under the License. 9480 * ============================================================================= 9481 */function s_(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a}=e,{strides:o,pad:i,dataFormat:l,dilations:u,dimRoundingMode:c}=r;_e([s,a],"conv2d");const d=ui(l),f=Vn(s.shape,a.shape,o,u,i,c,!1,d),p=f.filterHeight,h=f.filterWidth,m=f.dilationHeight,g=f.dilationWidth,v=f.padInfo.left,b=f.padInfo.top,w=f.dataFormat==="channelsLast",S=new on(f.outShape,s.dtype),I=Ie(s.shape),E=Ie(a.shape),T=I[0],D=w?I[1]:I[2],R=w?I[2]:1,$=w?1:I[1],M=S.strides[0],B=w?S.strides[1]:S.strides[2],z=w?S.strides[2]:1,H=w?1:S.strides[1],V=n.data.get(s.dataId).values,X=n.data.get(a.dataId).values,Q=S.values;for(let K=0;K<f.batchSize;++K){const ee=K*T,ae=K*M;for(let ne=0;ne<f.outHeight;++ne){const ce=ae+ne*B,se=ne*f.strideHeight-b;for(let oe=0;oe<p;++oe){const ie=se+oe*m;if(ie<0||ie>=f.inHeight)continue;const pe=oe*E[0],ve=ee+ie*D;for(let fe=0;fe<f.outWidth;++fe){const be=ce+fe*z,$e=fe*f.strideWidth-v;for(let Re=0;Re<h;++Re){const De=$e+Re*g;if(De<0||De>=f.inWidth)continue;const Pe=pe+Re*E[1],je=ve+De*R;let Ue=Pe;for(let Ce=0;Ce<f.inChannels;++Ce){const Ze=V[je+Ce*$];for(let Ke=0;Ke<f.outChannels;++Ke)Q[be+Ke*H]+=Ze*X[Ue+Ke];Ue+=f.outChannels}}}}}}return n.makeTensorInfo(S.shape,S.dtype,Q)}const FV={kernelName:Qu,backendName:"cpu",kernelFunc:s_};/** 9482 * @license 9483 * Copyright 2020 Google LLC. All Rights Reserved. 9484 * Licensed under the Apache License, Version 2.0 (the "License"); 9485 * you may not use this file except in compliance with the License. 9486 * You may obtain a copy of the License at 9487 * 9488 * http://www.apache.org/licenses/LICENSE-2.0 9489 * 9490 * Unless required by applicable law or agreed to in writing, software 9491 * distributed under the License is distributed on an "AS IS" BASIS, 9492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9493 * See the License for the specific language governing permissions and 9494 * limitations under the License. 9495 * ============================================================================= 9496 */function MV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:a}=e,{strides:o,pad:i,dataFormat:l,dimRoundingMode:u,filterShape:c}=r;_e([s,a],"conv2dBackpropFilter");const d=ui(l),f=Vn(s.shape,c,o,1,i,u,!1,d),{strideHeight:p,strideWidth:h,filterHeight:m,filterWidth:g}=f,v=f.dataFormat==="channelsLast",b=new on(f.filterShape,"float32"),w=f.padInfo.left,S=f.padInfo.top,I=n.data.get(s.dataId).values,E=n.data.get(a.dataId).values,T=new on(s.shape,s.dtype,I),D=new on(a.shape,a.dtype,E);for(let R=0;R<m;++R){const $=Math.max(0,Math.ceil((S-R)/p)),M=Math.min(f.outHeight,(f.inHeight+S-R)/p);for(let B=0;B<g;++B){const z=Math.max(0,Math.ceil((w-B)/h)),H=Math.min(f.outWidth,(f.inWidth+w-B)/h);for(let V=0;V<f.inChannels;++V)for(let X=0;X<f.outChannels;++X){let Q=0;for(let K=0;K<f.batchSize;++K)for(let ee=$;ee<M;++ee){const ae=R+ee*p-S;for(let ne=z;ne<H;++ne){const ce=B+ne*h-w;v?Q+=T.get(K,ae,ce,V)*D.get(K,ee,ne,X):Q+=T.get(K,V,ae,ce)*D.get(K,X,ee,ne)}}b.set(Q,R,B,V,X)}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}const OV={kernelName:R1,backendName:"cpu",kernelFunc:MV};/** 9497 * @license 9498 * Copyright 2020 Google LLC. All Rights Reserved. 9499 * Licensed under the Apache License, Version 2.0 (the "License");
9500 * you may not use this file except in compliance with the License. 9501 * You may obtain a copy of the License at 9502 * 9503 * http://www.apache.org/licenses/LICENSE-2.0 9504 * 9505 * Unless required by applicable law or agreed to in writing, software 9506 * distributed under the License is distributed on an "AS IS" BASIS, 9507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9508 * See the License for the specific language governing permissions and 9509 * limitations under the License. 9510 * ============================================================================= 9511 */function PV(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:a}=e,{inputShape:o,strides:i,pad:l,dataFormat:u,dimRoundingMode:c}=r;_e([s,a],"conv2dBackpropInput");const d=Ie(a.shape),f=Ie(s.shape);let p=ui(u);const h=Vn(o,a.shape,i,1,l,c,!1,p),m=new on(h.inShape,"float32"),g=m.values,v=n.data.get(s.dataId).values,b=n.data.get(a.dataId).values,[w,S,I]=d,{batchSize:E,filterHeight:T,filterWidth:D,inChannels:R,inHeight:$,inWidth:M,outChannels:B,outHeight:z,outWidth:H,strideHeight:V,strideWidth:X}=h;p=h.dataFormat;const Q=T-1-h.padInfo.top,K=D-1-h.padInfo.left,ee=p==="channelsLast",ae=m.strides[0],ne=ee?m.strides[1]:m.strides[2],ce=ee?m.strides[2]:1,se=ee?1:m.strides[1],oe=f[0],ie=ee?f[1]:f[2],pe=ee?f[2]:1,ve=ee?1:f[1];for(let fe=0;fe<E;++fe)for(let be=0;be<R;++be)for(let $e=0;$e<$;++$e){const Re=$e-Q,De=Math.max(0,Math.ceil(Re/V)),Pe=Math.min(z,(T+Re)/V);for(let je=0;je<M;++je){const Ue=je-K,Ce=Math.max(0,Math.ceil(Ue/X)),Ze=Math.min(H,(D+Ue)/X);let Ke=0;for(let Ge=De;Ge<Pe;++Ge){const jt=Ge*V-Re;for(let gt=Ce;gt<Ze;++gt){const It=gt*X-Ue,yt=oe*fe+ie*Ge+pe*gt,Tt=w*(T-1-jt)+S*(D-1-It)+I*be;for(let Yt=0;Yt<B;++Yt){const vt=v[yt+ve*Yt],rn=b[Tt+Yt];Ke+=vt*rn}}}const Ne=ae*fe+ne*$e+ce*je+se*be;g[Ne]=Ke}}return n.makeTensorInfo(m.shape,m.dtype,m.values)}const BV={kernelName:Zu,backendName:"cpu",kernelFunc:PV};/** 9512 * @license 9513 * Copyright 2020 Google LLC. All Rights Reserved. 9514 * Licensed under the Apache License, Version 2.0 (the "License"); 9515 * you may not use this file except in compliance with the License. 9516 * You may obtain a copy of the License at 9517 * 9518 * http://www.apache.org/licenses/LICENSE-2.0 9519 * 9520 * Unless required by applicable law or agreed to in writing, software 9521 * distributed under the License is distributed on an "AS IS" BASIS, 9522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9523 * See the License for the specific language governing permissions and 9524 * limitations under the License. 9525 * ============================================================================= 9526 */function LV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a}=e,{strides:o,pad:i,dilations:l}=r;_e([s,a],"conv3d");const u=no(s.shape,a.shape,o,l,i),{filterDepth:c,filterHeight:d,filterWidth:f,dilationDepth:p,dilationHeight:h,dilationWidth:m,padInfo:g}=u,v=g.front,b=g.left,w=g.top,S=new on(u.outShape,s.dtype),I=n.data.get(s.dataId).values,E=n.data.get(a.dataId).values,T=S.values,D=Ie(s.shape),R=Ie(a.shape);for(let $=0;$<u.batchSize;++$){const M=$*D[0],B=$*S.strides[0];for(let z=0;z<u.outDepth;++z){const H=B+z*S.strides[1],V=z*u.strideDepth-v;for(let X=0;X<c;++X){const Q=V+X*p;if(Q<0||Q>=u.inDepth)continue;const K=X*R[0],ee=M+Q*D[1];for(let ae=0;ae<u.outHeight;++ae){const ne=H+ae*S.strides[2],ce=ae*u.strideHeight-w;for(let se=0;se<d;++se){const oe=ce+se*h;if(oe<0||oe>=u.inHeight)continue;const ie=K+se*R[1],pe=ee+oe*D[2];for(let ve=0;ve<u.outWidth;++ve){const fe=ne+ve*u.outChannels,be=ve*u.strideWidth-b;for(let $e=0;$e<f;++$e){const Re=be+$e*m;if(Re<0||Re>=u.inWidth)continue;const De=ie+$e*R[2],Pe=pe+Re*u.inChannels;let je=De;for(let Ue=0;Ue<u.inChannels;++Ue){const Ce=I[Pe+Ue];for(let Ze=0;Ze<u.outChannels;++Ze)T[fe+Ze]+=Ce*E[je+Ze];je+=u.outChannels}}}}}}}}return n.makeTensorInfo(S.shape,S.dtype,S.values)}const WV={kernelName:ed,backendName:"cpu",kernelFunc:LV};/** 9527 * @license 9528 * Copyright 2020 Google LLC. All Rights Reserved. 9529 * Licensed under the Apache License, Version 2.0 (the "License"); 9530 * you may not use this file except in compliance with the License. 9531 * You may obtain a copy of the License at 9532 * 9533 * http://www.apache.org/licenses/LICENSE-2.0 9534 * 9535 * Unless required by applicable law or agreed to in writing, softw
9535are 9536 * distributed under the License is distributed on an "AS IS" BASIS, 9537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9538 * See the License for the specific language governing permissions and 9539 * limitations under the License. 9540 * ============================================================================= 9541 */function zV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:a}=e,{strides:o,pad:i,filterShape:l}=r;_e([s,a],"conv3dBackpropFilterV2");const u=Ie(s.shape),c=Ie(a.shape),d=no(s.shape,l,o,1,i),f=d.strideDepth,p=d.strideHeight,h=d.strideWidth,m=d.filterDepth,g=d.filterHeight,v=d.filterWidth,b=new on(d.filterShape,"float32"),w=b.values,[S,I,E,T]=b.strides,D=n.data.get(a.dataId).values,[R,$,M,B]=c,z=n.data.get(s.dataId).values,[H,V,X,Q]=u,K=d.padInfo.front,ee=d.padInfo.left,ae=d.padInfo.top;for(let ne=0;ne<m;++ne){const ce=Math.max(0,Math.ceil((K-ne)/f)),se=Math.min(d.outDepth,(d.inDepth+K-ne)/f),oe=ne*S;for(let ie=0;ie<g;++ie){const pe=Math.max(0,Math.ceil((ae-ie)/p)),ve=Math.min(d.outHeight,(d.inHeight+ae-ie)/p),fe=ie*I+oe;for(let be=0;be<v;++be){const $e=Math.max(0,Math.ceil((ee-be)/h)),Re=Math.min(d.outWidth,(d.inWidth+ee-be)/h),De=be*E+fe;for(let Pe=0;Pe<d.inChannels;++Pe){const je=Pe*T+De;for(let Ue=0;Ue<d.outChannels;++Ue){let Ce=0;for(let Ze=0;Ze<d.batchSize;++Ze){const Ke=Ze*H,Ne=Ze*R;for(let Ge=ce;Ge<se;++Ge){const gt=(ne+Ge*f-K)*V+Ke,It=Ge*$+Ne;for(let yt=pe;yt<ve;++yt){const Yt=(ie+yt*p-ae)*X+gt,vt=yt*M+It;for(let rn=$e;rn<Re;++rn){const cs=(be+rn*h-ee)*Q+Yt,In=rn*B+vt;Ce+=z[cs+Pe]*D[In+Ue]}}}}w[je+Ue]=Ce}}}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}const HV={kernelName:Fm,backendName:"cpu",kernelFunc:zV};/** 9542 * @license 9543 * Copyright 2020 Google LLC. All Rights Reserved. 9544 * Licensed under the Apache License, Version 2.0 (the "License"); 9545 * you may not use this file except in compliance with the License. 9546 * You may obtain a copy of the License at 9547 * 9548 * http://www.apache.org/licenses/LICENSE-2.0 9549 * 9550 * Unless required by applicable law or agreed to in writing, software 9551 * distributed under the License is distributed on an "AS IS" BASIS, 9552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9553 * See the License for the specific language governing permissions and 9554 * limitations under the License. 9555 * ============================================================================= 9556 */function UV(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:a}=e,{pad:o,strides:i,inputShape:l}=r;_e([s],"conv3dBackpropInputV2");const u=Ie(s.shape),c=Ie(a.shape),d=no(l,a.shape,i,1,o),f=new on(d.inShape,"float32"),p=f.values,[h,m,g,v]=f.strides,b=n.data.get(s.dataId).values,[w,S,I,E]=u,T=n.data.get(a.dataId).values,[D,R,$,M]=c,{batchSize:B,filterDepth:z,filterHeight:H,filterWidth:V,inChannels:X,inDepth:Q,inHeight:K,inWidth:ee,outChannels:ae,outDepth:ne,outHeight:ce,outWidth:se,strideDepth:oe,strideHeight:ie,strideWidth:pe}=d,ve=z-1-d.padInfo.front,fe=H-1-d.padInfo.top,be=V-1-d.padInfo.left;for(let $e=0;$e<B;++$e)for(let Re=0;Re<X;++Re)for(let De=0;De<Q;++De){const Pe=De-ve,je=Math.max(0,Math.ceil(Pe/oe)),Ue=Math.min(ne,(z+Pe)/oe);for(let Ce=0;Ce<K;++Ce){const Ze=Ce-fe,Ke=Math.max(0,Math.ceil(Ze/ie)),Ne=Math.min(ce,(H+Ze)/ie);for(let Ge=0;Ge<ee;++Ge){const jt=Ge-be,gt=Math.max(0,Math.ceil(jt/pe)),It=Math.min(se,(V+jt)/pe);let yt=0;for(let Tt=je;Tt<Ue;++Tt){const Yt=Tt*oe-Pe;for(let vt=Ke;vt<Ne;++vt){const rn=vt*ie-Ze;for(let _n=gt;_n<It;++_n){const cs=_n*pe-jt,In=w*$e+S*Tt+I*vt+E*_n,Ns=D*(z-1-Yt)+R*(H-1-rn)+$*(V-1-cs)+M*Re;for(let rr=0;rr<ae;++rr){const jn=b[In+rr],Wt=T[Ns+rr];yt+=jn*Wt}}}}p[h*$e+m*De+g*Ce+v*Ge+Re]=yt}}}return n.makeTensorInfo(f.shape,f.dtype,f.values)}const VV={kernelName:td,backendName:"cpu",kernelFunc:UV};/** 9557 * @license 9558 * Copyright 2020 Google LLC. All Rights Reserved. 9559 * Licensed under the Apache License, Version 2.0 (the "License"); 9560 * you may not use this file except in compliance with the License. 9561 * You may obtain a copy of the License at 9562 * 9563 * http://www.apache.org/licenses/LICENSE-2.0 9564 * 9565 * Unless required by applicable law or agreed to in writing, softw
9565are 9566 * distributed under the License is distributed on an "AS IS" BASIS, 9567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9568 * See the License for the specific language governing permissions and 9569 * limitations under the License. 9570 * ============================================================================= 9571 */const jV=mt(nd,t=>Math.cos(t)),GV={kernelName:nd,backendName:"cpu",kernelFunc:jV};/** 9572 * @license 9573 * Copyright 2020 Google LLC. All Rights Reserved. 9574 * Licensed under the Apache License, Version 2.0 (the License); 9575 * you may not use this file except in compliance with the License. 9576 * You may obtain a copy of the License at 9577 * 9578 * http://www.apache.org/licenses/LICENSE-2.0 9579 * 9580 * Unless required by applicable law or agreed to in writing, software 9581 * distributed under the License is distributed on an AS IS BASIS, 9582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9583 * See the License for the specific language governing permissions and 9584 * limitations under the License. 9585 * ============================================================================= 9586 */const qV=mt(rd,t=>Math.cosh(t)),KV={kernelName:rd,backendName:"cpu",kernelFunc:qV};/** 9587 * @license 9588 * Copyright 2020 Google LLC. All Rights Reserved. 9589 * Licensed under the Apache License, Version 2.0 (the "License"); 9590 * you may not use this file except in compliance with the License. 9591 * You may obtain a copy of the License at 9592 * 9593 * http://www.apache.org/licenses/LICENSE-2.0 9594 * 9595 * Unless required by applicable law or agreed to in writing, software 9596 * distributed under the License is distributed on an "AS IS" BASIS, 9597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9598 * See the License for the specific language governing permissions and 9599 * limitations under the License. 9600 * ============================================================================= 9601 */function XV(t){const{inputs:e,backend:n,attrs:r}=t,{image:s,boxes:a,boxInd:o}=e,{cropSize:i,method:l,extrapolationValue:u}=r,[c,d,f,p]=s.shape,h=a.shape[0],[m,g]=i,v=rt([h,m,g,p],"float32"),b=n.data.get(a.dataId).values,w=n.data.get(o.dataId).values,S=n.data.get(s.dataId).values,I=Ie(s.shape),E=Ie(v.shape);for(let T=0;T<h;T++){const D=T*4,R=b[D],$=b[D+1],M=b[D+2],B=b[D+3],z=w[T];if(z>=c)continue;const H=m>1?(M-R)*(d-1)/(m-1):0,V=g>1?(B-$)*(f-1)/(g-1):0;for(let X=0;X<m;X++){const Q=m>1?R*(d-1)+X*H:.5*(R+M)*(d-1);if(Q<0||Q>d-1){for(let K=0;K<g;K++)for(let ee=0;ee<p;ee++){const ae=ee+K*E[2]+X*E[1]+T*E[0];v.values[ae]=u}continue}if(l==="bilinear"){const K=Math.floor(Q),ee=Math.ceil(Q),ae=Q-K;for(let ne=0;ne<g;ne++){const ce=g>1?$*(f-1)+ne*V:.5*($+B)*(f-1);if(ce<0||ce>f-1){for(let pe=0;pe<p;pe++){const ve=pe+ne*E[2]+X*E[1]+T*E[0];v.values[ve]=u}continue}const se=Math.floor(ce),oe=Math.ceil(ce),ie=ce-se;for(let pe=0;pe<p;pe++){let ve=pe+se*I[2]+K*I[1]+z*I[0];const fe=S[ve];ve=pe+oe*I[2]+K*I[1]+z*I[0];const be=S[ve];ve=pe+se*I[2]+ee*I[1]+z*I[0];const $e=S[ve];ve=pe+oe*I[2]+ee*I[1]+z*I[0];const Re=S[ve],De=fe+(be-fe)*ie,Pe=$e+(Re-$e)*ie;ve=pe+ne*E[2]+X*E[1]+T*E[0],v.values[ve]=De+(Pe-De)*ae}}}else for(let K=0;K<g;++K){const ee=g>1?$*(f-1)+K*V:.5*($+B)*(f-1);if(ee<0||ee>f-1){for(let ce=0;ce<p;ce++){const se=ce+K*E[2]+X*E[1]+T*E[0];v.values[se]=u}continue}const ae=Math.round(ee),ne=Math.round(Q);for(let ce=0;ce<p;ce++){const se=ce+ae*I[2]+ne*I[1]+z*I[0],oe=ce+K*E[2]+X*E[1]+T*E[0];v.values[oe]=S[se]}}}}return n.makeTensorInfo(v.shape,v.dtype,v.values)}const YV={kernelName:od,backendName:"cpu",kernelFunc:XV};/** 9602 * @license 9603 * Copyright 2022 Google LLC. All Rights Reserved. 9604 * Licensed under the Apache License, Version 2.0 (the "License"); 9605 * you may not use this file except in compliance with the License. 9606 * You may obtain a copy of the License at 9607 * 9608 * http://www.apache.org/licenses/LICENSE-2.0 9609 * 9610 * Unless required by applicable law or agreed to in writing, software 9611 * distributed under the License is distributed on an "AS IS" BASIS, 9612 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9613 * See the License for the specific language governing permissions and 9614 * limitations under the License. 9615 * ============================================================================= 9616 */function JV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,exclusive:o,reverse:i}
vendor: 5,155 bytes, lines 9616-9664
9616=r;_e(s,"cumprod");const l=fr([a],s.shape.length);let u=s;l!=null&&(u=Un({inputs:{x:s},backend:n,attrs:{perm:l}}));const c=Fn(1,s.shape.length)[0];if(c!==u.shape.length-1)throw new Error("backend.cumprod in CPU expects an inner-most "+"axis=".concat(u.shape.length-1," but got axis=").concat(c));const d=ci(u.dtype,"int32"),f=km(J(u.shape),d),p=n.data.get(u.dataId).values,h=u.shape[u.shape.length-1],m=i?(v,b)=>v+h-b-1:(v,b)=>v+b;for(let v=0;v<p.length;v+=h)for(let b=0;b<h;b++){const w=m(v,b);if(b===0)f[w]=o?1:p[w];else{const S=m(v,b-1);f[w]=o?p[S]*f[S]:p[w]*f[S]}}const g=n.makeTensorInfo(u.shape,d,f);if(l!=null){const v=Of(l),b=Un({inputs:{x:g},backend:n,attrs:{perm:v}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),b}return g}const QV={kernelName:sd,backendName:"cpu",kernelFunc:JV};/** 9617 * @license 9618 * Copyright 2020 Google LLC. All Rights Reserved. 9619 * Licensed under the Apache License, Version 2.0 (the "License"); 9620 * you may not use this file except in compliance with the License. 9621 * You may obtain a copy of the License at 9622 * 9623 * http://www.apache.org/licenses/LICENSE-2.0 9624 * 9625 * Unless required by applicable law or agreed to in writing, software 9626 * distributed under the License is distributed on an "AS IS" BASIS, 9627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9628 * See the License for the specific language governing permissions and 9629 * limitations under the License. 9630 * ============================================================================= 9631 */function ZV(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,exclusive:o,reverse:i}=r;_e(s,"cumsum");const l=fr([a],s.shape.length);let u=s;l!=null&&(u=Un({inputs:{x:s},backend:n,attrs:{perm:l}}));const c=Fn(1,s.shape.length)[0];if(c!==u.shape.length-1)throw new Error("backend.cumsum in CPU expects an inner-most "+"axis=".concat(u.shape.length-1," but got axis=").concat(c));const d=ci(u.dtype,"int32"),f=xn(J(u.shape),d),p=n.data.get(u.dataId).values,h=u.shape[u.shape.length-1],m=i?(v,b)=>v+h-b-1:(v,b)=>v+b;for(let v=0;v<p.length;v+=h)for(let b=0;b<h;b++){const w=m(v,b);if(b===0)f[w]=o?0:p[w];else{const S=m(v,b-1);f[w]=o?p[S]+f[S]:p[w]+f[S]}}const g=n.makeTensorInfo(u.shape,d,f);if(l!=null){const v=Of(l),b=Un({inputs:{x:g},backend:n,attrs:{perm:v}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),b}return g}const ej={kernelName:ad,backendName:"cpu",kernelFunc:ZV};/** 9632 * @license 9633 * Copyright 2020 Google LLC. All Rights Reserved. 9634 * Licensed under the Apache License, Version 2.0 (the "License"); 9635 * you may not use this file except in compliance with the License. 9636 * You may obtain a copy of the License at 9637 * 9638 * http://www.apache.org/licenses/LICENSE-2.0 9639 * 9640 * Unless required by applicable law or agreed to in writing, software 9641 * distributed under the License is distributed on an "AS IS" BASIS, 9642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9643 * See the License for the specific language governing permissions and 9644 * limitations under the License. 9645 * ============================================================================= 9646 */function tj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,weights:a}=e,{size:o,binaryOutput:i}=r;if(s.shape.length===1){const l=n.data.get(s.dataId).values,u=n.data.get(a.dataId).values,c=uS(l,u,a.dtype,a.shape,o);return n.makeTensorInfo([o],a.dtype,c)}else if(s.shape.length===2){const l=n.bufferSync(s),u=n.bufferSync(a),c=fB(l,u,o,i);return n.makeTensorInfo(c.shape,a.dtype,c.values)}throw new Error("Error in denseBincount: input must be at most rank 2, but got rank"+"".concat(s.shape.length,"."))}const nj={kernelName:Mm,backendName:"cpu",kernelFunc:tj};/** 9647 * @license 9648 * Copyright 2020 Google LLC. All Rights Reserved. 9649 * Licensed under the Apache License, Version 2.0 (the "License"); 9650 * you may not use this file except in compliance with the License. 9651 * You may obtain a copy of the License at 9652 * 9653 * http://www.apache.org/licenses/LICENSE-2.0 9654 * 9655 * Unless required by applicable law or agreed to in writing, software 9656 * distributed under the License is distributed on an "AS IS" BASIS, 9657 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9658 * See the License for the specific language governing permissions and 9659 * limitations under the License. 9660 * ============================================================================= 9661 */function rj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockSize:a,dataFormat:o}=r;A(o==="NHWC",()=>"Only NHWC dataFormat supported on CPU for depthToSpace. Got ".concat(o));const i=s.shape[0],l=s.shape[1],u=s.shape[2],c=s.shape[3],d=l*a,f=u*a,p=c/(a*a),h=n.data.get(s.dataId).values,m=new Float32Array(i*d*f*p);let g=0;for(let v=0;v<i;++v)for(let b=0;b<d;++b){const w=Math.floor(b/a),S=b%a;for(let I=0;I<f;++I){const E=Math.floor(I/a),T=I%a,D=(S*a+T)*p;for(let R=0;R<p;++R){const M=R+D+c*(E+u*(w+l*v));m[g++]=h[M]}}}return n.makeTensorInfo([i,d,f,p],s.dtype,m)}const sj={kernelName:id,backendName:"cpu",kernelFunc:rj};/** 9662 * @license 9663 * Copyright 2020 Google LLC. All Rights Reserved. 9664 * Licensed under the Apache License, Version 2.0 (the "License");
9665 * you may not use this file except in compliance with the License. 9666 * You may obtain a copy of the License at 9667 * 9668 * http://www.apache.org/licenses/LICENSE-2.0 9669 * 9670 * Unless required by applicable law or agreed to in writing, software 9671 * distributed under the License is distributed on an "AS IS" BASIS, 9672 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9673 * See the License for the specific language governing permissions and 9674 * limitations under the License. 9675 * ============================================================================= 9676 */function a_(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a}=e,{strides:o,pad:i,dilations:l,dimRoundingMode:u}=r;_e([s,a],"depthwiseConv2DNative");const c=Ie(s.shape),d=Ie(a.shape);let f=l;f==null&&(f=[1,1]),A(Tr(o,f),()=>"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(o," and dilations '").concat(f,"'"));const p=Vn(s.shape,a.shape,o,f,i,u,!0),{filterHeight:h,filterWidth:m,dilationHeight:g,dilationWidth:v,padInfo:b}=p,w=b.left,S=b.top,I=p.outChannels/p.inChannels,E=new on(p.outShape,s.dtype),T=n.data.get(s.dataId).values,D=n.data.get(a.dataId).values,R=E.values;for(let $=0;$<p.batchSize;++$){const M=$*c[0],B=$*E.strides[0];for(let z=0;z<p.outHeight;++z){const H=B+z*E.strides[1],V=z*p.strideHeight-S;for(let X=0;X<h;++X){const Q=V+X*g;if(Q<0||Q>=p.inHeight)continue;const K=X*d[0],ee=M+Q*c[1];for(let ae=0;ae<p.outWidth;++ae){const ne=H+ae*E.strides[2],ce=ae*p.strideWidth-w;for(let se=0;se<m;++se){const oe=ce+se*v;if(oe<0||oe>=p.inWidth)continue;const ie=K+se*d[1],pe=ee+oe*p.inChannels;let ve=ne,fe=ie;for(let be=0;be<p.inChannels;++be){const $e=T[pe+be];for(let Re=0;Re<I;++Re)R[ve+Re]+=$e*D[fe+Re];ve+=I,fe+=I}}}}}}return n.makeTensorInfo(E.shape,E.dtype,E.values)}const aj={kernelName:cd,backendName:"cpu",kernelFunc:a_};/** 9677 * @license 9678 * Copyright 2020 Google LLC. All Rights Reserved. 9679 * Licensed under the Apache License, Version 2.0 (the "License"); 9680 * you may not use this file except in compliance with the License. 9681 * You may obtain a copy of the License at 9682 * 9683 * http://www.apache.org/licenses/LICENSE-2.0 9684 * 9685 * Unless required by applicable law or agreed to in writing, software 9686 * distributed under the License is distributed on an "AS IS" BASIS, 9687 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9688 * See the License for the specific language governing permissions and 9689 * limitations under the License. 9690 * ============================================================================= 9691 */function oj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,dy:a}=e,{strides:o,dilations:i,pad:l,dimRoundingMode:u,filterShape:c}=r;_e([s,a],"depthwiseConv2dNativeBackpropFilter");const d=Vn(s.shape,c,o,i,l,u,!0),{strideHeight:f,strideWidth:p,filterHeight:h,filterWidth:m}=d,g=new on(d.filterShape,"float32"),v=d.padInfo.left,b=d.padInfo.top,w=d.outChannels/d.inChannels,S=n.data.get(s.dataId).values,I=new on(s.shape,s.dtype,S),E=n.data.get(a.dataId).values,T=new on(a.shape,a.dtype,E);for(let D=0;D<h;++D){const R=Math.max(0,Math.ceil((b-D)/f)),$=Math.min(d.outHeight,(d.inHeight+b-D)/f);for(let M=0;M<m;++M){const B=Math.max(0,Math.ceil((v-M)/p)),z=Math.min(d.outWidth,(d.inWidth+v-M)/p);for(let H=0;H<d.outChannels;++H){const V=Math.trunc(H/w),X=H%w;let Q=0;for(let K=0;K<d.batchSize;++K)for(let ee=R;ee<$;++ee){const ae=D+ee*f-b;for(let ne=B;ne<z;++ne){const ce=M+ne*p-v;Q+=I.get(K,ae,ce,V)*T.get(K,ee,ne,H)}}g.set(Q,D,M,V,X)}}}return n.makeTensorInfo(g.shape,g.dtype,g.values)}const ij={kernelName:D1,backendName:"cpu",kernelFunc:oj};/** 9692 * @license 9693 * Copyright 2020 Google LLC. All Rights Reserved. 9694 * Licensed under the Apache License, Version 2.0 (the "License"); 9695 * you may not use this file except in compliance with the License. 9696 * You may obtain a copy of the License at 9697 * 9698 * http://www.apache.org/licenses/LICENSE-2.0 9699 * 9700 * Unless required by applicable law or agreed to in writing, software 9701 * distributed under the License is distributed on an "AS IS" BASIS, 9702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9703 * See the License for the specific language governing permissions and 9704 * limitations under the License. 9705 * ============================================================================= 9706 */function cj(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,filter:a}=e,{strides:o,dilations:i,pad:l,dimRoundingMode:u,inputShape:c}=r;_e([s,a],"depthwiseConv2DNativeBackpropInput");const d=Ie(s.shape),f=Ie(a.shape),p=Vn(c,a.shape,o,i,l,u,!0),h=new on(p.inShape,"float32"),m=h.values,[g,v,b]=h.strides,w=n.data.get(s.dataId).values,[S,I,E]=d,T=n.data.get(a.dataId).values,[D,R,$]=f,{batchSize:M,filterHeight:B,filterWidth:z,inChannels:H,inHeight:V,inWidth:X,outChannels:Q,outHeight:K,outWidth:ee,strideHeight:ae,strideWidth:ne}=p,ce=B-1-p.padInfo.top,se=z-1-p.padInfo.left,oe=Q/H;for(let ie=0;ie<M;++ie)for(let pe=0;pe<H;
vendor: 4,348 bytes, lines 9706-9751
9706++pe)for(let ve=0;ve<V;++ve){const fe=ve-ce,be=Math.max(0,Math.ceil(fe/ae)),$e=Math.min(K,(B+fe)/ae);for(let Re=0;Re<X;++Re){const De=Re-se,Pe=Math.max(0,Math.ceil(De/ne)),je=Math.min(ee,(z+De)/ne);let Ue=0;for(let Ce=be;Ce<$e;++Ce){const Ze=Ce*ae-fe;for(let Ke=Pe;Ke<je;++Ke){const Ne=Ke*ne-De,Ge=S*ie+I*Ce+E*Ke,jt=D*(B-1-Ze)+R*(z-1-Ne)+$*pe;for(let gt=0;gt<oe;++gt){const It=pe*oe+gt,yt=w[Ge+It],Tt=T[jt+gt];Ue+=yt*Tt}}}m[g*ie+v*ve+b*Re+pe]=Ue}}return n.makeTensorInfo(h.shape,h.dtype,h.values)}const lj={kernelName:F1,backendName:"cpu",kernelFunc:cj};/** 9707 * @license 9708 * Copyright 2020 Google LLC. All Rights Reserved. 9709 * Licensed under the Apache License, Version 2.0 (the "License"); 9710 * you may not use this file except in compliance with the License. 9711 * You may obtain a copy of the License at 9712 * 9713 * http://www.apache.org/licenses/LICENSE-2.0 9714 * 9715 * Unless required by applicable law or agreed to in writing, software 9716 * distributed under the License is distributed on an "AS IS" BASIS, 9717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9718 * See the License for the specific language governing permissions and 9719 * limitations under the License. 9720 * ============================================================================= 9721 */function uj(t){const{inputs:e,backend:n}=t,{x:r}=e,s=J(r.shape),a=n.data.get(r.dataId).values,o=rt([s,s],r.dtype),i=o.values;for(let u=0;u<a.length;u++)i[u*s+u]=a[u];const l=[...r.shape,...r.shape];return n.makeTensorInfo(l,o.dtype,o.values)}const dj={kernelName:Om,backendName:"cpu",kernelFunc:uj};/** 9722 * @license 9723 * Copyright 2020 Google LLC. All Rights Reserved. 9724 * Licensed under the Apache License, Version 2.0 (the "License"); 9725 * you may not use this file except in compliance with the License. 9726 * You may obtain a copy of the License at 9727 * 9728 * http://www.apache.org/licenses/LICENSE-2.0 9729 * 9730 * Unless required by applicable law or agreed to in writing, software 9731 * distributed under the License is distributed on an "AS IS" BASIS, 9732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9733 * See the License for the specific language governing permissions and 9734 * limitations under the License. 9735 * ============================================================================= 9736 */const fj={kernelName:ld,backendName:"cpu",kernelFunc:({inputs:t,backend:e,attrs:n})=>{const{x:r,filter:s}=t,{strides:a,pad:o,dilations:i}=n,l=e,u=l.data.get(r.dataId).values,c=r.shape.length,d=l.data.get(s.dataId).values,f=s.shape.length,{batchSize:p,inHeight:h,inWidth:m,inChannels:g,outHeight:v,outWidth:b,padInfo:w,strideHeight:S,strideWidth:I,filterHeight:E,filterWidth:T,dilationHeight:D,dilationWidth:R,outShape:$}=li(r.shape,s.shape,a,o,"NHWC",i),M=J($),B=$.length,z=tn(r.dtype,M);for(let V=0;V<p;++V)for(let X=0;X<v;++X){const Q=X*S-w.top;for(let K=0;K<b;++K){const ee=K*I-w.left;for(let ae=0;ae<g;++ae){let ne=Number.MIN_SAFE_INTEGER;for(let se=0;se<E;++se){const oe=Q+se*D;if(oe>=0&&oe<h)for(let ie=0;ie<T;++ie){const pe=ee+ie*R;if(pe>=0&&pe<m){const ve=ts([V,oe,pe,ae],c,Ie(r.shape)),fe=ts([se,ie,ae],f,Ie(s.shape)),be=u[ve]+d[fe];be>ne&&(ne=be)}}}const ce=ts([V,X,K,ae],B,Ie($));z[ce]=ne}}}return{dataId:l.write(to(z,r.dtype),$,r.dtype),shape:$,dtype:r.dtype}}};/** 9737 * @license 9738 * Copyright 2020 Google LLC. All Rights Reserved. 9739 * Licensed under the Apache License, Version 2.0 (the "License"); 9740 * you may not use this file except in compliance with the License. 9741 * You may obtain a copy of the License at 9742 * 9743 * http://www.apache.org/licenses/LICENSE-2.0 9744 * 9745 * Unless required by applicable law or agreed to in writing, software 9746 * distributed under the License is distributed on an "AS IS" BASIS, 9747 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9748 * See the License for the specific language governing permissions and 9749 * limitations under the License. 9750 * ============================================================================= 9751 */const pj={kernelName:Zl,backendName:"cpu",kernelFunc:({inputs:t,backend:e,attrs:n})=>{const{x:r,filter:s,dy:a}=t,{strides:o,pad:i,dilations:l}=n,u=e,c=_r(r.shape,u.data.get(r.dataId).values),d=_r(s.shape,u.data.get(s.dataId).values),{batchSize:f,inHeight:p,inWidth:h,inChannels:m,outHeight:g,outWidth:v,padInfo:b,strideHeight:w,strideWidth:S,filterHeight:I,filterWidth:E,dilationHeight:T,dilationWidth:D,outShape:R}
9751=li(r.shape,s.shape,o,i,"NHWC",l);A(a.rank===R.length,()=>"Error in ".concat(Zl,", dy ")+"must have the same rank as output ".concat(R.length,", but got ")+"".concat(a.rank));const $=_r(R,u.data.get(a.dataId).values),M=k1(s.shape,s.dtype);for(let z=0;z<f;++z)for(let H=0;H<g;++H){const V=H*w-b.top;for(let X=0;X<v;++X){const Q=X*S-b.left;for(let K=0;K<m;++K){let ee=Number.MIN_SAFE_INTEGER,ae=0,ne=0;for(let ce=0;ce<I;++ce){const se=V+ce*T;if(se>=0&&se<p)for(let oe=0;oe<E;++oe){const ie=Q+oe*D;if(ie>=0&&ie<h){const pe=c[z][se][ie][K]+d[ce][oe][K];pe>ee&&(ee=pe,ae=ce,ne=oe)}}}M[ae][ne][K]+=$[z][H][X][K]}}}return{dataId:u.write(to(M,r.dtype),s.shape,s.dtype),shape:s.shape,dtype:s.dtype}}};/** 9752 * @license 9753 * Copyright 2020 Google LLC. All Rights Reserved. 9754 * Licensed under the Apache License, Version 2.0 (the "License"); 9755 * you may not use this file except in compliance with the License. 9756 * You may obtain a copy of the License at 9757 * 9758 * http://www.apache.org/licenses/LICENSE-2.0 9759 * 9760 * Unless required by applicable law or agreed to in writing, software 9761 * distributed under the License is distributed on an "AS IS" BASIS, 9762 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9763 * See the License for the specific language governing permissions and 9764 * limitations under the License. 9765 * ============================================================================= 9766 */const hj={kernelName:Ql,backendName:"cpu",kernelFunc:({inputs:t,backend:e,attrs:n})=>{const{x:r,filter:s,dy:a}=t,{strides:o,pad:i,dilations:l}=n,u=e,c=_r(r.shape,u.data.get(r.dataId).values),d=_r(s.shape,u.data.get(s.dataId).values),{batchSize:f,inHeight:p,inWidth:h,inChannels:m,outHeight:g,outWidth:v,padInfo:b,strideHeight:w,strideWidth:S,filterHeight:I,filterWidth:E,dilationHeight:T,dilationWidth:D,outShape:R}=li(r.shape,s.shape,o,i,"NHWC",l);A(a.rank===R.length,()=>"Error in ".concat(Ql,", dy ")+"must have the same rank as output ".concat(R.length,", but got ")+"".concat(a.rank));const $=_r(R,u.data.get(a.dataId).values),M=k1(r.shape,r.dtype);for(let z=0;z<f;++z)for(let H=0;H<g;++H){const V=H*w-b.top;for(let X=0;X<v;++X){const Q=X*S-b.left;for(let K=0;K<m;++K){let ee=Number.MIN_SAFE_INTEGER,ae=V<0?0:V,ne=Q<0?0:Q;for(let ce=0;ce<I;++ce){const se=V+ce*T;if(se>=0&&se<p)for(let oe=0;oe<E;++oe){const ie=Q+oe*D;if(ie>=0&&ie<h){const pe=c[z][se][ie][K]+d[ce][oe][K];pe>ee&&(ee=pe,ae=se,ne=ie)}}}M[z][ae][ne][K]+=$[z][H][X][K]}}}return{dataId:u.write(to(M,r.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};/** 9767 * @license 9768 * Copyright 2023 Google LLC. 9769 * Licensed under the Apache License, Version 2.0 (the "License"); 9770 * you may not use this file except in compliance with the License. 9771 * You may obtain a copy of the License at 9772 * 9773 * http://www.apache.org/licenses/LICENSE-2.0 9774 * 9775 * Unless required by applicable law or agreed to in writing, software 9776 * distributed under the License is distributed on an "AS IS" BASIS, 9777 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9778 * See the License for the specific language governing permissions and 9779 * limitations under the License. 9780 * ============================================================================= 9781 */function mj(t){const{inputs:e,backend:n,attrs:r}=t,{image:s}=e,{canvas:a,options:o}=r,{contextOptions:i,imageOptions:l}=o||{},u=(l==null?void 0:l.alpha)||1,c=(i==null?void 0:i.contextType)||"2d";if(c!=="2d")throw new Error("Context type ".concat(i.contextType," is not supported by the CPU backend."));const d=a.getContext(c,(i==null?void 0:i.contextAttributes)||{});if(d==null)throw new Error("Could not get the context with ".concat(c," type."));const[f,p]=s.shape.slice(0,2),h=s.shape.length===2?1:s.shape[2],m=n.data.get(s.dataId).values,g=s.dtype==="float32"?255:1,v=new Uint8ClampedArray(p*f*4);for(let w=0;w<f*p;++w){const S=[0,0,0,255*u];for(let E=0;E<h;E++){const T=m[w*h+E];if(s.dtype==="float32"){if(T<0||T>1)throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(T,"."))}else if(s.dtype==="int32"&&(T<0||T>255))throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(T,"."));
vendor: 5,455 bytes, lines 9781-9844
9781h===1?(S[0]=T*g,S[1]=T*g,S[2]=T*g):S[E]=T*g}const I=w*4;v[I+0]=Math.round(S[0]),v[I+1]=Math.round(S[1]),v[I+2]=Math.round(S[2]),v[I+3]=Math.round(S[3])}a.width=p,a.height=f;const b=new ImageData(v,p,f);return d.putImageData(b,0,0),s}const gj={kernelName:M1,backendName:"cpu",kernelFunc:mj};/** 9782 * @license 9783 * Copyright 2020 Google LLC. All Rights Reserved. 9784 * Licensed under the Apache License, Version 2.0 (the "License"); 9785 * you may not use this file except in compliance with the License. 9786 * You may obtain a copy of the License at 9787 * 9788 * http://www.apache.org/licenses/LICENSE-2.0 9789 * 9790 * Unless required by applicable law or agreed to in writing, software 9791 * distributed under the License is distributed on an "AS IS" BASIS, 9792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9793 * See the License for the specific language governing permissions and 9794 * limitations under the License. 9795 * ============================================================================= 9796 */function jc(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r;_e(s,"sum");let i;s.dtype==="bool"?i=na({inputs:{x:s},backend:n,attrs:{dtype:"int32"}}):i=ss({inputs:{x:s},backend:n});const l=i.shape.length,u=Vt(a,i.shape),c=fr(u,l);let d=u,f=i;c!=null&&(f=Un({inputs:{x:i},backend:n,attrs:{perm:c}}),d=Fn(d.length,l)),Dn("sum",d,f.shape.length);const[p,h]=Rn(f.shape,d),m=ci(f.dtype,"int32");let g=gu(n,p,m);const v=J(h),b=n.data.get(g.dataId).values,w=n.data.get(f.dataId).values;for(let S=0;S<b.length;++S){const I=S*v;let E=0;for(let T=0;T<v;++T)E+=w[I+T];b[S]=E}if(o){const S=gn(g.shape,u),I=g;g=Dt({inputs:{x:g},backend:n,attrs:{shape:S}}),n.disposeIntermediateTensorInfo(I)}return n.disposeIntermediateTensorInfo(i),c!=null&&n.disposeIntermediateTensorInfo(f),g}const yj={kernelName:Sf,backendName:"cpu",kernelFunc:jc};/** 9797 * @license 9798 * Copyright 2021 Google LLC. All Rights Reserved. 9799 * Licensed under the Apache License, Version 2.0 (the "License"); 9800 * you may not use this file except in compliance with the License. 9801 * You may obtain a copy of the License at 9802 * 9803 * http://www.apache.org/licenses/LICENSE-2.0 9804 * 9805 * Unless required by applicable law or agreed to in writing, software 9806 * distributed under the License is distributed on an "AS IS" BASIS, 9807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9808 * See the License for the specific language governing permissions and 9809 * limitations under the License. 9810 * ============================================================================= 9811 */function vj(t){const{inputs:e,backend:n,attrs:r}=t,{equation:s}=r,a=e,{allDims:o,summedDims:i,idDims:l}=o5(s,a.length);c5(o.length,l,a);const{path:u,steps:c}=l5(i,l),d=c.length;let f=null,p=o.length;const h=[];for(let m=0;m<d;++m){for(const g of c[m]){const{permutationIndices:v,expandDims:b}=i5(p,l[g]);let w;u5(v)?w=a[g]:(w=Un({inputs:{x:a[g]},backend:n,attrs:{perm:v}}),h.push(w));const S=w.shape.slice();for(let I=0;I<b.length;++I)S.splice(b[I],0,1);Ir(w.shape,S)||(w=Dt({inputs:{x:w},backend:n,attrs:{shape:S}}),h.push(w)),f===null?f=w:(f=qf({inputs:{a:w,b:f},backend:n}),h.push(f))}m<d-1&&(u[m]>=0&&(f=jc({inputs:{x:f},backend:n,attrs:{axis:u[m]-(o.length-p),keepDims:!1}}),h.push(f)),p--)}for(const m of h)m!==f&&n.disposeIntermediateTensorInfo(m);return f}const bj={kernelName:O1,backendName:"cpu",kernelFunc:vj};/** 9812 * @license 9813 * Copyright 2020 Google LLC. All Rights Reserved. 9814 * Licensed under the Apache License, Version 2.0 (the "License"); 9815 * you may not use this file except in compliance with the License. 9816 * You may obtain a copy of the License at 9817 * 9818 * http://www.apache.org/licenses/LICENSE-2.0 9819 * 9820 * Unless required by applicable law or agreed to in writing, software 9821 * distributed under the License is distributed on an "AS IS" BASIS, 9822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9823 * See the License for the specific language governing permissions and 9824 * limitations under the License. 9825 * ============================================================================= 9826 */function wj(t){const{inputs:e,backend:n}=t,{dy:r,y:s}=e;_e([r,s],"eluGrad");const a=new Float32Array(J(s.shape)),o=n.data.get(s.dataId).values,i=n.data.get(r.dataId).values;for(let l=0;l<o.length;++l){const u=o[l];u>=0?a[l]=i[l]:a[l]=i[l]*(u+1)}return n.makeTensorInfo(s.shape,"float32",a)}const Sj={kernelName:Pm,backendName:"cpu",kernelFunc:wj};/** 9827 * @license 9828 * Copyright 2020 Google LLC. All Rights Reserved. 9829 * Licensed under the Apache License, Version 2.0 (the License); 9830 * you may not use this file except in compliance with the License. 9831 * You may obtain a copy of the License at 9832 * 9833 * http://www.apache.org/licenses/LICENSE-2.0 9834 * 9835 * Unless required by applicable law or agreed to in writing, software 9836 * distributed under the License is distributed on an AS IS BASIS, 9837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9838 * See the License for the specific language governing permissions and 9839 * limitations under the License. 9840 * ============================================================================= 9841 */const xj=q6,_j=K6,Ij=X6,kj=Y6,Ej=J6,Tj=Q6,Cj=mt(fd,t=>{const e=Math.sign(t),n=Math.abs(t),r=1/(1+xj*n);return e*(1-((((Tj*r+Ej)*r+kj)*r+Ij)*r+_j)*r*Math.exp(-n*n))}),Nj={kernelName:fd,backendName:"cpu",kernelFunc:Cj};/** 9842 * @license 9843 * Copyright 2020 Google LLC. All Rights Reserved. 9844 * Licensed under the Apache License, Version 2.0 (the "License");
9845 * you may not use this file except in compliance with the License. 9846 * You may obtain a copy of the License at 9847 * 9848 * http://www.apache.org/licenses/LICENSE-2.0 9849 * 9850 * Unless required by applicable law or agreed to in writing, software 9851 * distributed under the License is distributed on an "AS IS" BASIS, 9852 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9853 * See the License for the specific language governing permissions and 9854 * limitations under the License. 9855 * ============================================================================= 9856 */function bu(t){const{inputs:e,backend:n,attrs:r}=t,{input:s}=e,{dim:a}=r,o=s.shape.length,i=s.shape.slice();let l=a;return a<0&&(A(-(o+1)<=a,()=>"Axis must be in the interval [".concat(-(o+1),", ").concat(o,"]")),l=o+a+1),i.splice(l,0,1),Dt({inputs:{x:s},backend:n,attrs:{shape:i}})}const Aj={kernelName:Bm,backendName:"cpu",kernelFunc:bu};/** 9857 * @license 9858 * Copyright 2020 Google LLC. All Rights Reserved. 9859 * Licensed under the Apache License, Version 2.0 (the "License"); 9860 * you may not use this file except in compliance with the License. 9861 * You may obtain a copy of the License at 9862 * 9863 * http://www.apache.org/licenses/LICENSE-2.0 9864 * 9865 * Unless required by applicable law or agreed to in writing, software 9866 * distributed under the License is distributed on an "AS IS" BASIS, 9867 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9868 * See the License for the specific language governing permissions and 9869 * limitations under the License. 9870 * ============================================================================= 9871 */const $j=Qt((t,e)=>t/e),zg=ln(ud,$j),Kh={kernelName:ud,backendName:"cpu",kernelFunc:zg};/** 9872 * @license 9873 * Copyright 2020 Google LLC. All Rights Reserved. 9874 * Licensed under the Apache License, Version 2.0 (the "License"); 9875 * you may not use this file except in compliance with the License. 9876 * You may obtain a copy of the License at 9877 * 9878 * http://www.apache.org/licenses/LICENSE-2.0 9879 * 9880 * Unless required by applicable law or agreed to in writing, software 9881 * distributed under the License is distributed on an "AS IS" BASIS, 9882 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9883 * See the License for the specific language governing permissions and 9884 * limitations under the License. 9885 * ============================================================================= 9886 */function o_(t,e,n){const r=t.shape,s=r[0],a=r[1],o=n.data.get(t.dataId),i=o.complexTensorInfos.real,l=o.complexTensorInfos.imag,u=[s,a],c=J(u),d=$n("float32",c),f=$n("float32",c);for(let g=0;g<s;g++){const v=Ka({inputs:{x:i},backend:n,attrs:{begin:[g,0],size:[1,a]}}),b=Ka({inputs:{x:l},backend:n,attrs:{begin:[g,0],size:[1,a]}}),w=Qn({inputs:{real:v,imag:b},backend:n}),{real:S,imag:I}=Rj(w,e,n),E=Qo(S,I);for(let T=0;T<a;T++){const D=R2(E,T);d[g*a+T]=D.real,f[g*a+T]=D.imag}n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(w)}const p=n.makeTensorInfo(u,"float32",d),h=n.makeTensorInfo(u,"float32",f),m=Qn({inputs:{real:p,imag:h},backend:n});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h),m}function Rj(t,e,n){const r=J(t.shape),s=n.data.get(t.dataId),a=n.data.get(s.complexTensorInfos.real.dataId).values,o=n.data.get(s.complexTensorInfos.imag.dataId).values;if(Dj(r)){const i=Xh(a,o,r,e,n),l=[t.shape[0],t.shape[1]];if(e){const u=n.makeTensorInfo(l,"float32",i.real),c=n.makeTensorInfo(l,"float32",i.imag),d=n.makeTensorInfo([],"float32",fg(r,"float32")),f=ss({inputs:{x:d},backend:n}),p=Kh.kernelFunc({inputs:{a:u,b:d},backend:n}),h=Kh.kernelFunc({inputs:{a:c,b:f},backend:n}),m=n.data.get(p.dataId).values,g=n.data.get(h.dataId).values;return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h),{real:m,imag:g}}return i}else{const i=Qo(a,o),l=Fj(i,r,e);return Z6(l)}}function Dj(t){return(t&t-1)===0}function Xh(t,e,n,r,s){if(n===1)return{real:t,imag:e};const a=Qo(t,e),o=n/2,i=e5(a),l=i.real,u=i.imag,c=[l.length],d=s.makeTensorInfo(c,"float32",l),f=s.makeTensorInfo(c,"float32",u),p=Qn({input
vendor: 4,292 bytes, lines 9886-9919
9886s:{real:d,imag:f},backend:s}),h=t5(a),m=h.real,g=h.imag,v=[m.length],b=s.makeTensorInfo(v,"float32",m),w=s.makeTensorInfo(v,"float32",g),S=Qn({inputs:{real:b,imag:w},backend:s}),I=Xh(l,u,o,r,s),E=I.real,T=I.imag,D=[E.length],R=s.makeTensorInfo(D,"float32",E),$=s.makeTensorInfo(D,"float32",T),M=Qn({inputs:{real:R,imag:$},backend:s}),B=Xh(m,g,o,r,s),z=B.real,H=B.imag,V=[z.length],X=s.makeTensorInfo(V,"float32",z),Q=s.makeTensorInfo(V,"float32",H),K=Qn({inputs:{real:X,imag:Q},backend:s}),ee=r5(n,r),ae=[ee.real.length],ne=s.makeTensorInfo(ae,"float32",ee.real),ce=s.makeTensorInfo(ae,"float32",ee.imag),se=Qn({inputs:{real:ne,imag:ce},backend:s}),oe=qf({inputs:{a:se,b:K},backend:s}),ie=Zo({inputs:{a:M,b:oe},backend:s}),pe=Bg({inputs:{a:M,b:oe},backend:s}),ve=qa({inputs:{input:ie},backend:s}),fe=qa({inputs:{input:pe},backend:s}),be=ei({inputs:{input:ie},backend:s}),$e=ei({inputs:{input:pe},backend:s}),Re=ti({inputs:[ve,fe],backend:s,attrs:{axis:0}}),De=ti({inputs:[be,$e],backend:s,attrs:{axis:0}}),Pe=s.data.get(Re.dataId).values,je=s.data.get(De.dataId).values;return s.disposeIntermediateTensorInfo(d),s.disposeIntermediateTensorInfo(f),s.disposeIntermediateTensorInfo(p),s.disposeIntermediateTensorInfo(b),s.disposeIntermediateTensorInfo(w),s.disposeIntermediateTensorInfo(S),s.disposeIntermediateTensorInfo(R),s.disposeIntermediateTensorInfo($),s.disposeIntermediateTensorInfo(M),s.disposeIntermediateTensorInfo(X),s.disposeIntermediateTensorInfo(Q),s.disposeIntermediateTensorInfo(K),s.disposeIntermediateTensorInfo(ne),s.disposeIntermediateTensorInfo(ce),s.disposeIntermediateTensorInfo(se),s.disposeIntermediateTensorInfo(oe),s.disposeIntermediateTensorInfo(ie),s.disposeIntermediateTensorInfo(pe),s.disposeIntermediateTensorInfo(ve),s.disposeIntermediateTensorInfo(be),s.disposeIntermediateTensorInfo(fe),s.disposeIntermediateTensorInfo($e),s.disposeIntermediateTensorInfo(Re),s.disposeIntermediateTensorInfo(De),{real:Pe,imag:je}}function Fj(t,e,n){const r=new Float32Array(e*2);for(let s=0;s<e;s++){let a=0,o=0;for(let i=0;i<e;i++){const l=s5(s*i,e,n),u=R2(t,i);a+=u.real*l.real-u.imag*l.imag,o+=u.real*l.imag+u.imag*l.real}n&&(a/=e,o/=e),n5(r,a,o,s)}return r}/** 9887 * @license 9888 * Copyright 2020 Google LLC. All Rights Reserved. 9889 * Licensed under the Apache License, Version 2.0 (the "License"); 9890 * you may not use this file except in compliance with the License. 9891 * You may obtain a copy of the License at 9892 * 9893 * http://www.apache.org/licenses/LICENSE-2.0 9894 * 9895 * Unless required by applicable law or agreed to in writing, software 9896 * distributed under the License is distributed on an "AS IS" BASIS, 9897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9898 * See the License for the specific language governing permissions and 9899 * limitations under the License. 9900 * ============================================================================= 9901 */function Mj(t){const{inputs:e,backend:n}=t,{input:r}=e,s=J(r.shape),a=r.shape[r.shape.length-1],o=s/a,i=Dt({inputs:{x:r},backend:n,attrs:{shape:[o,a]}}),l=o_(i,!1,n),u=Dt({inputs:{x:l},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),u}const Oj={kernelName:P1,backendName:"cpu",kernelFunc:Mj};/** 9902 * @license 9903 * Copyright 2020 Google LLC. All Rights Reserved. 9904 * Licensed under the Apache License, Version 2.0 (the "License"); 9905 * you may not use this file except in compliance with the License. 9906 * You may obtain a copy of the License at 9907 * 9908 * http://www.apache.org/licenses/LICENSE-2.0 9909 * 9910 * Unless required by applicable law or agreed to in writing, software 9911 * distributed under the License is distributed on an "AS IS" BASIS, 9912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9913 * See the License for the specific language governing permissions and 9914 * limitations under the License. 9915 * ============================================================================= 9916 */function Hg(t){const{backend:e,attrs:n}=t,{shape:r,value:s,dtype:a}=n,o=a||Pc(s),i=tn(o,J(r));return Bj(i,s,o),e.makeTensorInfo(r,o,i)}const Pj={kernelName:Lm,backendName:"cpu",kernelFunc:Hg};function Bj(t,e,n){t.fill(e)}/** 9917 * @license 9918 * Copyright 2020 Google LLC. All Rights Reserved. 9919 * Licensed under the Apache License, Version 2.0 (the "License");
9920 * you may not use this file except in compliance with the License. 9921 * You may obtain a copy of the License at 9922 * 9923 * http://www.apache.org/licenses/LICENSE-2.0 9924 * 9925 * Unless required by applicable law or agreed to in writing, software 9926 * distributed under the License is distributed on an "AS IS" BASIS, 9927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9928 * See the License for the specific language governing permissions and 9929 * limitations under the License. 9930 * ============================================================================= 9931 */const Lj={kernelName:gd,backendName:"cpu",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{image:r}=t,s=n,a=$n(r.dtype,J(r.shape)),[o,i,l,u]=r.shape,c=s.data.get(r.dataId).values;for(let f=0;f<o;f++){const p=f*l*i*u;for(let h=0;h<i;h++){const m=h*(l*u);for(let g=0;g<l;g++){const v=g*u;for(let b=0;b<u;b++){const w=Math.round(l-g-1),S=p+m+v+b;let I=c[S];if(w>=0&&w<l){const E=w*u,T=p+m+E+b;I=c[T]}a[S]=I}}}}return{dataId:s.write(a,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};/** 9932 * @license 9933 * Copyright 2020 Google LLC. All Rights Reserved. 9934 * Licensed under the Apache License, Version 2.0 (the "License"); 9935 * you may not use this file except in compliance with the License. 9936 * You may obtain a copy of the License at 9937 * 9938 * http://www.apache.org/licenses/LICENSE-2.0 9939 * 9940 * Unless required by applicable law or agreed to in writing, software 9941 * distributed under the License is distributed on an "AS IS" BASIS, 9942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9943 * See the License for the specific language governing permissions and 9944 * limitations under the License. 9945 * ============================================================================= 9946 */function Wj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a,bias:o,preluActivationWeights:i}=e,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:f,activation:p,leakyreluAlpha:h}=r;let m=s_({inputs:{x:s,filter:a},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:f}});if(o){const g=m;if(c==="NCHW"&&o.shape.length===1&&o.shape[0]!==1){const v=Dt({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});m=Zo({inputs:{a:m,b:v},backend:n}),n.disposeIntermediateTensorInfo(v)}else m=Zo({inputs:{a:m,b:o},backend:n});n.disposeIntermediateTensorInfo(g)}if(p){const g=m;if(c==="NCHW"&&p==="prelu"&&i.shape.length===1&&i.shape[0]!==1){const v=Dt({inputs:{x:i},backend:n,attrs:{shape:[i.shape[0],1,1]}});m=vu(n,m,p,v,h),n.disposeIntermediateTensorInfo(v)}else m=vu(n,m,p,i,h);n.disposeIntermediateTensorInfo(g)}return m}const zj={kernelName:yc,backendName:"cpu",kernelFunc:Wj};/** 9947 * @license 9948 * Copyright 2020 Google LLC. All Rights Reserved. 9949 * Licensed under the Apache License, Version 2.0 (the "License"); 9950 * you may not use this file except in compliance with the License. 9951 * You may obtain a copy of the License at 9952 * 9953 * http://www.apache.org/licenses/LICENSE-2.0 9954 * 9955 * Unless required by applicable law or agreed to in writing, software 9956 * distributed under the License is distributed on an "AS IS" BASIS, 9957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9958 * See the License for the specific language governing permissions and 9959 * limitations under the License. 9960 * ============================================================================= 9961 */function Hj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,filter:a,bias:o,preluActivationWeights:i}=e,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:f,activation:p,leakyreluAlpha:h}=r;let m=a_({inputs:{x:s,filter:a},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:f}});if(o){const g=m;m=Zo({inputs:{a:m,b:o},backend:n}),n.disposeIntermediateTensorInfo(g)}if(p){const g=m;m=vu(n,m,p,i,h),n.disposeIntermediateTensorInfo(g)}return m}const Uj={kernelName:vc,backendName:"cpu",kernelFunc:Hj};/** 9962 * @license 9963 * Copyright 2020 Google LLC. All Rights Reserved. 9964 * Licensed under the Apache License, Version 2.0 (the "License"); 9965 * you may not use this file except in compliance with the License. 9966 * You may obtain a copy of the License at 9967 * 9968 * http://www.apache.org/licenses/LICENSE-2.0 9969 * 9970 * Unless required by applicable law or agreed to in writing, softw
9970are 9971 * distributed under the License is distributed on an "AS IS" BASIS, 9972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9973 * See the License for the specific language governing permissions and 9974 * limitations under the License. 9975 * ============================================================================= 9976 */function Vj(t){const{inputs:e,backend:n}=t,{params:r,indices:s}=e,a=J(r.shape),o=s.shape,i=o[o.length-1],[l,u,c,d]=x2(r,s);if(u===0)return n.makeTensorInfo(l,r.dtype,[]);const f=n.data.get(s.dataId).values,p=n.bufferSync(r),h=RB(f,p,r.dtype,u,i,c,d,r.shape,a);return n.makeTensorInfo(l,r.dtype,h.values)}const jj={kernelName:wd,backendName:"cpu",kernelFunc:Vj};/** 9977 * @license 9978 * Copyright 2020 Google LLC. All Rights Reserved. 9979 * Licensed under the Apache License, Version 2.0 (the "License"); 9980 * you may not use this file except in compliance with the License. 9981 * You may obtain a copy of the License at 9982 * 9983 * http://www.apache.org/licenses/LICENSE-2.0 9984 * 9985 * Unless required by applicable law or agreed to in writing, software 9986 * distributed under the License is distributed on an "AS IS" BASIS, 9987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9988 * See the License for the specific language governing permissions and 9989 * limitations under the License. 9990 * ============================================================================= 9991 */function Gj(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,indices:a}=e,{axis:o,batchDims:i}=r;_e([s,a],"gatherV2");const l=Vt(o,s.shape)[0],u=n.data.get(a.dataId).values,c=s.shape[l];for(let S=0;S<u.length;++S){const I=u[S];A(I<=c-1&&I>=0,()=>"GatherV2: the index value ".concat(I," is not in [0, ").concat(c-1,"]"))}let d=i;i==null&&(d=0);const f=J(a.shape),p=j2(s,a,l,d),h=Dt({inputs:{x:s},backend:n,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=Dt({inputs:{x:a},backend:n,attrs:{shape:[p.batchSize,f/p.batchSize]}}),g=[p.batchSize,p.outerSize,f/p.batchSize,p.sliceSize],v=n.bufferSync(m),b=n.bufferSync(h),w=DB(b,v,g);return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),n.makeTensorInfo(p.outputShape,w.dtype,w.values)}const qj={kernelName:Wm,backendName:"cpu",kernelFunc:Gj};/** 9992 * @license 9993 * Copyright 2020 Google LLC. All Rights Reserved. 9994 * Licensed under the Apache License, Version 2.0 (the "License"); 9995 * you may not use this file except in compliance with the License. 9996 * You may obtain a copy of the License at 9997 * 9998 * http://www.apache.org/licenses/LICENSE-2.0 9999 * 10000 * Unless required by applicable law or agreed to in writing, software 10001 * distributed under the License is distributed on an "AS IS" BASIS, 10002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10003 * See the License for the specific language governing permissions and 10004 * limitations under the License. 10005 * ============================================================================= 10006 */function Kj(t){const{inputs:e,backend:n}=t,{input:r}=e,s=J(r.shape),a=r.shape[r.shape.length-1],o=s/a,i=Dt({inputs:{x:r},backend:n,attrs:{shape:[o,a]}}),l=o_(i,!0,n),u=Dt({inputs:{x:l},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),u}const Xj={kernelName:B1,backendName:"cpu",kernelFunc:Kj};/** 10007 * @license 10008 * Copyright 2020 Google LLC. All Rights Reserved. 10009 * Licensed under the Apache License, Version 2.0 (the License); 10010 * you may not use this file except in compliance with the License. 10011 * You may obtain a copy of the License at 10012 * 10013 * http://www.apache.org/licenses/LICENSE-2.0 10014 * 10015 * Unless required by applicable law or agreed to in writing, software 10016 * distributed under the License is distributed on an AS IS BASIS, 10017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10018 * See the License for the specific language governing permissions and 10019 * limitations under the License. 10020 * ============================================================================= 10021 */const Yj=mt(Id,t=>Number.isFinite(t)?1:0,"bool"),Jj={kernelName:Id,backendName:"cpu",kernelFunc:Yj};/** 10022 * @license 10023 * Copyright 2020 Google LLC. All Rights Reserved. 10024 * Licensed under the Apache License, Version 2.0 (the License);
10025 * you may not use this file except in compliance with the License. 10026 * You may obtain a copy of the License at 10027 * 10028 * http://www.apache.org/licenses/LICENSE-2.0 10029 * 10030 * Unless required by applicable law or agreed to in writing, software 10031 * distributed under the License is distributed on an AS IS BASIS, 10032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10033 * See the License for the specific language governing permissions and 10034 * limitations under the License. 10035 * ============================================================================= 10036 */const Qj=mt(kd,t=>Math.abs(t)===1/0?1:0,"bool"),Zj={kernelName:kd,backendName:"cpu",kernelFunc:Qj};/** 10037 * @license 10038 * Copyright 2020 Google LLC. All Rights Reserved. 10039 * Licensed under the Apache License, Version 2.0 (the License); 10040 * you may not use this file except in compliance with the License. 10041 * You may obtain a copy of the License at 10042 * 10043 * http://www.apache.org/licenses/LICENSE-2.0 10044 * 10045 * Unless required by applicable law or agreed to in writing, software 10046 * distributed under the License is distributed on an AS IS BASIS, 10047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10048 * See the License for the specific language governing permissions and 10049 * limitations under the License. 10050 * ============================================================================= 10051 */const eG=mt(Ed,t=>Number.isNaN(t)?1:0,"bool"),tG={kernelName:Ed,backendName:"cpu",kernelFunc:eG};/** 10052 * @license 10053 * Copyright 2020 Google LLC. All Rights Reserved. 10054 * Licensed under the Apache License, Version 2.0 (the "License"); 10055 * you may not use this file except in compliance with the License. 10056 * You may obtain a copy of the License at 10057 * 10058 * http://www.apache.org/licenses/LICENSE-2.0 10059 * 10060 * Unless required by applicable law or agreed to in writing, software 10061 * distributed under the License is distributed on an "AS IS" BASIS, 10062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10063 * See the License for the specific language governing permissions and 10064 * limitations under the License. 10065 * ============================================================================= 10066 */function nG(t){const{backend:e,attrs:n}=t,{start:r,stop:s,num:a}=n,o=GB(r,s,a);return e.makeTensorInfo([o.length],"float32",o)}const rG={kernelName:Ad,backendName:"cpu",kernelFunc:nG};/** 10067 * @license 10068 * Copyright 2020 Google LLC. All Rights Reserved. 10069 * Licensed under the Apache License, Version 2.0 (the License); 10070 * you may not use this file except in compliance with the License. 10071 * You may obtain a copy of the License at 10072 * 10073 * http://www.apache.org/licenses/LICENSE-2.0 10074 * 10075 * Unless required by applicable law or agreed to in writing, software 10076 * distributed under the License is distributed on an AS IS BASIS, 10077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10078 * See the License for the specific language governing permissions and 10079 * limitations under the License. 10080 * ============================================================================= 10081 */const sG=mt(Rd,t=>Math.log1p(t)),aG={kernelName:Rd,backendName:"cpu",kernelFunc:sG};/** 10082 * @license 10083 * Copyright 2020 Google LLC. All Rights Reserved. 10084 * Licensed under the Apache License, Version 2.0 (the "License"); 10085 * you may not use this file except in compliance with the License. 10086 * You may obtain a copy of the License at 10087 * 10088 * http://www.apache.org/licenses/LICENSE-2.0 10089 * 10090 * Unless required by applicable law or agreed to in writing, software 10091 * distributed under the License is distributed on an "AS IS" BASIS, 10092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10093 * See the License for the specific language governing permissions and 10094 * limitations under the License. 10095 * ============================================================================= 10096 */const oG=Qt((t,e)=>t&&e),iG=ln(Dd,oG,null,"bool"),cG={kernelName:Dd,backendName:"cpu",kernelFunc:iG};/** 10097 * @license 10098 * Copyright 2020 Google LLC. All Rights Reserved. 10099 * Licensed under the Apache License, Version 2.0 (the License); 10100 * you may not use this file except in compliance with the License. 10101 * You may obtain a copy of the License at 10102 * 10103 * http://www.apache.org/licenses/LICENSE-2.0 10104 * 10105 * Unless required by applicable law or agreed to in writing, softw
10105are 10106 * distributed under the License is distributed on an AS IS BASIS, 10107 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10108 * See the License for the specific language governing permissions and 10109 * limitations under the License. 10110 * ============================================================================= 10111 */const lG=mt(Fd,t=>t?0:1,"bool"),uG={kernelName:Fd,backendName:"cpu",kernelFunc:lG};/** 10112 * @license 10113 * Copyright 2020 Google LLC. All Rights Reserved. 10114 * Licensed under the Apache License, Version 2.0 (the "License"); 10115 * you may not use this file except in compliance with the License. 10116 * You may obtain a copy of the License at 10117 * 10118 * http://www.apache.org/licenses/LICENSE-2.0 10119 * 10120 * Unless required by applicable law or agreed to in writing, software 10121 * distributed under the License is distributed on an "AS IS" BASIS, 10122 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10123 * See the License for the specific language governing permissions and 10124 * limitations under the License. 10125 * ============================================================================= 10126 */const dG=Qt((t,e)=>t||e),fG=ln(Md,dG,null,"bool"),pG={kernelName:Md,backendName:"cpu",kernelFunc:fG};/** 10127 * @license 10128 * Copyright 2020 Google LLC. All Rights Reserved. 10129 * Licensed under the Apache License, Version 2.0 (the "License"); 10130 * you may not use this file except in compliance with the License. 10131 * You may obtain a copy of the License at 10132 * 10133 * http://www.apache.org/licenses/LICENSE-2.0 10134 * 10135 * Unless required by applicable law or agreed to in writing, software 10136 * distributed under the License is distributed on an "AS IS" BASIS, 10137 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10138 * See the License for the specific language governing permissions and 10139 * limitations under the License. 10140 * ============================================================================= 10141 */function hG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{depthRadius:a,bias:o,alpha:i,beta:l}=r;_e(s,"LRN");const u=s.shape[3],c=u-1,d=n.data.get(s.dataId).values,f=J(s.shape),p=new Float32Array(f);function h(m){const g=m%u;let v=m-g+Math.max(0,g-a);const b=m-g+Math.min(g+a,c);let w=0;for(;v<=b;v++){const S=d[v];w+=S*S}return w}for(let m=0;m<f;m++){const g=h(m),v=d[m]*Math.pow(o+i*g,-l);p[m]=v}return n.makeTensorInfo(s.shape,s.dtype,p)}const mG={kernelName:Od,backendName:"cpu",kernelFunc:hG};/** 10142 * @license 10143 * Copyright 2020 Google LLC. All Rights Reserved. 10144 * Licensed under the Apache License, Version 2.0 (the "License"); 10145 * you may not use this file except in compliance with the License. 10146 * You may obtain a copy of the License at 10147 * 10148 * http://www.apache.org/licenses/LICENSE-2.0 10149 * 10150 * Unless required by applicable law or agreed to in writing, software 10151 * distributed under the License is distributed on an "AS IS" BASIS, 10152 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10153 * See the License for the specific language governing permissions and 10154 * limitations under the License. 10155 * ============================================================================= 10156 */function gG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,y:a,dy:o}=e,{depthRadius:i,bias:l,alpha:u,beta:c}=r;_e(o,"LRNGrad");const d=J(o.shape),f=o.shape[3],p=n.data.get(o.dataId).values,h=n.data.get(s.dataId).values,m=n.data.get(a.dataId).values,g=new Float32Array(d),v=d;for(let b=0;b<v;b++){const w=b%f,S=b-w+Math.max(0,w-i),I=b-w+Math.min(f,w+i+1);let E=0;for(let T=S;T<I;T++)E+=Math.pow(h[T],2);E=u*E+l;for(let T=S;T<I;T++){let D=-2*u*c*h[T]*m[b]/E;b===T&&(D+=Math.pow(E,-c)),D*=p[b],g[T]+=D}}return n.makeTensorInfo(o.shape,s.dtype,g)}const yG={kernelName:zm,backendName:"cpu",kernelFunc:gG};/** 10157 * @license 10158 * Copyright 2020 Google LLC. All Rights Reserved. 10159 * Licensed under the Apache License, Version 2.0 (the "License"); 10160 * you may not use this file except in compliance with the License. 10161 * You may obtain a copy of the License at 10162 * 10163 * http://www.apache.org/licenses/LICENSE-2.0 10164 * 10165 * Unless required by applicable law or agreed to in writing, software 10166 * distributed under the License is distributed on an "AS IS" BASIS, 10167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10168 * See the License for the specific language governing permissions and 10169 * limitations under the License. 10170 * ============================================================================= 10171 */function i_(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{reductionIndices:a,keepDims:o}=r,i=n;let l=s.shape;const u=l.length,c=Vt(a,l);let d=c;const f=fr(d,u);let p=i.data.get(s.dataId).values;if(f!=null){const S=new Array(u);for(let I=0;I<S.length;I++)S[I]=l[f[I]];p=mS(p,l,s.dtype,f,S),d=Fn(d.length,u),l=S}_e(s,"max"),Dn("max",d,u);const[h,m]=Rn(l,d),g=J(m),v=YB(p,g,h,s.dtype),b=i.write(v,h,s.dtype);let w=h;return o&&(w=gn(h,c)),{dataId:b,shape:w,dtype:s.dtype}}const vG={kernelName:Pd,backendName:"cpu",kernelFunc:i_};/** 10172 * @license 10173 * Copyright 2020 Google LLC. All Rights Reserved. 10174 * Licensed under the Apache License, Version 2.0 (the "License");
10175 * you may not use this file except in compliance with the License. 10176 * You may obtain a copy of the License at 10177 * 10178 * http://www.apache.org/licenses/LICENSE-2.0 10179 * 10180 * Unless required by applicable law or agreed to in writing, software 10181 * distributed under the License is distributed on an "AS IS" BASIS, 10182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10183 * See the License for the specific language governing permissions and 10184 * limitations under the License. 10185 * ============================================================================= 10186 */function bG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e;_e(s,"maxPool");const{filterSize:a,strides:o,pad:i,dimRoundingMode:l}=r,u=1;A(Tr(o,u),()=>"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(u,"'"));const c=Wr(s.shape,a,o,u,i,l);let d;if(c.filterWidth===1&&c.filterHeight===1&&Ir(c.inShape,c.outShape))d=ss({inputs:{x:s},backend:n});else{const f=n.data.get(s.dataId).values,p=Ie(s.shape),h=Wg(f,s.shape,s.dtype,p,c,"max");d=n.makeTensorInfo(c.outShape,s.dtype,h.values)}return d}const wG={kernelName:Ld,backendName:"cpu",kernelFunc:bG};/** 10187 * @license 10188 * Copyright 2020 Google LLC. All Rights Reserved. 10189 * Licensed under the Apache License, Version 2.0 (the "License"); 10190 * you may not use this file except in compliance with the License. 10191 * You may obtain a copy of the License at 10192 * 10193 * http://www.apache.org/licenses/LICENSE-2.0 10194 * 10195 * Unless required by applicable law or agreed to in writing, software 10196 * distributed under the License is distributed on an "AS IS" BASIS, 10197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10198 * See the License for the specific language governing permissions and 10199 * limitations under the License. 10200 * ============================================================================= 10201 */function SG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{filterSize:a,strides:o,pad:i,dimRoundingMode:l,dataFormat:u}=r;_e(s,"maxPool3d");const c=ia(s.shape,a,o,1,i,l,u),d=n.data.get(s.dataId).values,f=r_(d,s.shape,s.dtype,Ie(s.shape),c,"max");return n.makeTensorInfo(f.shape,"float32",f.values)}const xG={kernelName:Hm,backendName:"cpu",kernelFunc:SG};/** 10202 * @license 10203 * Copyright 2020 Google LLC. All Rights Reserved. 10204 * Licensed under the Apache License, Version 2.0 (the "License"); 10205 * you may not use this file except in compliance with the License. 10206 * You may obtain a copy of the License at 10207 * 10208 * http://www.apache.org/licenses/LICENSE-2.0 10209 * 10210 * Unless required by applicable law or agreed to in writing, software 10211 * distributed under the License is distributed on an "AS IS" BASIS, 10212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10213 * See the License for the specific language governing permissions and 10214 * limitations under the License. 10215 * ============================================================================= 10216 */function _G(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a}=e,{filterSize:o,strides:i,pad:l,dimRoundingMode:u}=r;_e([s,a],"maxPool3DGrad");const c=ia(a.shape,o,i,1,l,u),d=n.bufferSync(a),f=dV(d,c),p=c.strideDepth,h=c.strideHeight,m=c.strideWidth,g=c.dilationDepth,v=c.dilationHeight,b=c.dilationWidth,w=c.effectiveFilterDepth,S=c.effectiveFilterHeight,I=c.effectiveFilterWidth,E=w-1-c.padInfo.front,T=I-1-c.padInfo.left,D=S-1-c.padInfo.top,R=rt(a.shape,"float32"),$=n.bufferSync(s);for(let M=0;M<c.batchSize;++M)for(let B=0;B<c.inChannels;++B)for(let z=0;z<c.inDepth;++z)for(let H=0;H<c.inHeight;++H)for(let V=0;V<c.inWidth;++V){const X=z-E,Q=H-D,K=V-T;let ee=0;for(let ae=0;ae<w;ae+=g){const ne=(X+ae)/p;if(!(ne<0||ne>=c.outDepth||Math.floor(ne)!==ne))for(let ce=0;ce<S;ce+=v){const se=(Q+ce)/h;if(!(se<0||se>=c.outHeight||Math.floor(se)!==se))for(let oe=0;oe<I;oe+=b){const ie=(K+oe)/m;if(ie<0||ie>=c.outWidth||Math.floor(ie)!==ie)continue;const pe=w*S*I-1-f.get(M,ne,se,ie,B),ve=ae*S*I+ce*I+oe,fe=pe===ve?1:0;if(fe===0)continue;const be=$.get(M,ne,se,ie,B);ee+=be*fe}}}R.set(ee,M,z,H,V,B)}return n.makeTensorInfo(R.shape,R.dtype,R.values)}const IG={kernelName:z1,backendName:"cpu",kernelFunc:_G};
vendor: 8,862 bytes, lines 10216-10330
10216/** 10217 * @license 10218 * Copyright 2020 Google LLC. All Rights Reserved. 10219 * Licensed under the Apache License, Version 2.0 (the "License"); 10220 * you may not use this file except in compliance with the License. 10221 * You may obtain a copy of the License at 10222 * 10223 * http://www.apache.org/licenses/LICENSE-2.0 10224 * 10225 * Unless required by applicable law or agreed to in writing, software 10226 * distributed under the License is distributed on an "AS IS" BASIS, 10227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10228 * See the License for the specific language governing permissions and 10229 * limitations under the License. 10230 * ============================================================================= 10231 */function kG(t){const{inputs:e,backend:n,attrs:r}=t,{dy:s,input:a,output:o}=e,i=a;_e([a,o],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,f=Wr(i.shape,l,u,1,c,d),p=n.data.get(i.dataId).values,h=rt(f.outShape,i.dtype,n_(p,i.shape,i.dtype,f).values),m=f.strideHeight,g=f.strideWidth,v=f.dilationHeight,b=f.dilationWidth,w=f.effectiveFilterHeight,S=f.effectiveFilterWidth,I=S-1-f.padInfo.left,E=w-1-f.padInfo.top,T=rt(i.shape,"float32"),D=n.data.get(s.dataId).values,R=rt(s.shape,"float32",D);for(let $=0;$<f.batchSize;++$)for(let M=0;M<f.inChannels;++M)for(let B=0;B<f.inHeight;++B)for(let z=0;z<f.inWidth;++z){const H=B-E,V=z-I;let X=0;for(let Q=0;Q<w;Q+=v){const K=(H+Q)/m;if(!(K<0||K>=f.outHeight||Math.floor(K)!==K))for(let ee=0;ee<S;ee+=b){const ae=(V+ee)/g;if(ae<0||ae>=f.outWidth||Math.floor(ae)!==ae)continue;const ne=w*S-1-h.get($,K,ae,M),ce=Q*S+ee,se=ne===ce?1:0;if(se===0)continue;const oe=R.get($,K,ae,M);X+=oe*se}}T.set(X,$,B,z,M)}return n.makeTensorInfo(T.shape,T.dtype,T.values)}const EG={kernelName:W1,backendName:"cpu",kernelFunc:kG};/** 10232 * @license 10233 * Copyright 2020 Google LLC. All Rights Reserved. 10234 * Licensed under the Apache License, Version 2.0 (the "License"); 10235 * you may not use this file except in compliance with the License. 10236 * You may obtain a copy of the License at 10237 * 10238 * http://www.apache.org/licenses/LICENSE-2.0 10239 * 10240 * Unless required by applicable law or agreed to in writing, software 10241 * distributed under the License is distributed on an "AS IS" BASIS, 10242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10243 * See the License for the specific language governing permissions and 10244 * limitations under the License. 10245 * ============================================================================= 10246 */function TG(t,e,n,r,s){const a=Ie(e),o=Wg(t,e,n,a,s,"max"),i=n_(t,e,n,s,!0,r);return[o.values,i.values]}/** 10247 * @license 10248 * Copyright 2020 Google LLC. All Rights Reserved. 10249 * Licensed under the Apache License, Version 2.0 (the "License"); 10250 * you may not use this file except in compliance with the License. 10251 * You may obtain a copy of the License at 10252 * 10253 * http://www.apache.org/licenses/LICENSE-2.0 10254 * 10255 * Unless required by applicable law or agreed to in writing, software 10256 * distributed under the License is distributed on an "AS IS" BASIS, 10257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10258 * See the License for the specific language governing permissions and 10259 * limitations under the License. 10260 * ============================================================================= 10261 */const CG={kernelName:Um,backendName:"cpu",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{x:r}=t,{filterSize:s,strides:a,pad:o,includeBatchInIndex:i}=e,l=n;_e(r,"MaxPoolWithArgmax");const u=l.data.get(r.dataId).values,c=Wr(r.shape,s,a,[1,1],o),[d,f]=TG(u,r.shape,r.dtype,i,c),p=l.write(d,c.outShape,r.dtype),h=l.write(f,c.outShape,r.dtype);return[{dataId:p,shape:c.outShape,dtype:r.dtype},{dataId:h,shape:c.outShape,dtype:"int32"}]}};/** 10262 * @license 10263 * Copyright 2020 Google LLC. All Rights Reserved. 10264 * Licensed under the Apache License, Version 2.0 (the "License"); 10265 * you may not use this file except in compliance with the License. 10266 * You may obtain a copy of the License at 10267 * 10268 * http://www.apache.org/licenses/LICENSE-2.0 10269 * 10270 * Unless required by applicable law or agreed to in writing, software 10271 * distributed under the License is distributed on an "AS IS" BASIS, 10272 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10273 * See the License for the specific language governing permissions and 10274 * limitations under the License. 10275 * ============================================================================= 10276 */function NG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r,i=Vt(a,s.shape),u=Rn(s.shape,i)[1],c=J(u),d=[],f=n.makeTensorInfo([],"float32",new Float32Array([c]));d.push(f);const p=na({inputs:{x:s},backend:n,attrs:{dtype:"float32"}});d.push(p);const h=zg({inputs:{a:p,b:f},backend:n});d.push(h);const m=jc({inputs:{x:h},backend:n,attrs:{axis:a,keepDims:o}});return d.forEach(g=>n.disposeIntermediateTensorInfo(g)),m}const AG={kernelName:Wd,backendName:"cpu",kernelFunc:NG};/** 10277 * @license 10278 * Copyright 2020 Google LLC. All Rights Reserved. 10279 * Licensed under the Apache License, Version 2.0 (the "License"); 10280 * you may not use this file except in compliance with the License. 10281 * You may obtain a copy of the License at 10282 * 10283 * http://www.apache.org/licenses/LICENSE-2.0 10284 * 10285 * Unless required by applicable law or agreed to in writing, software 10286 * distributed under the License is distributed on an "AS IS" BASIS, 10287 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10288 * See the License for the specific language governing permissions and 10289 * limitations under the License. 10290 * ============================================================================= 10291 */function $G(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{axis:a,keepDims:o}=r;_e(s,"min");const i=Vt(a,s.shape);let l=i;const u=fr(l,s.shape.length);let c=s;u!=null&&(c=Un({inputs:{x:s},backend:n,attrs:{perm:u}}),l=Fn(l.length,s.shape.length)),Dn("min",l,c.shape.length);const[d,f]=Rn(c.shape,l),p=J(f),h=xn(J(d),c.dtype),m=n.data.get(c.dataId).values;for(let v=0;v<h.length;++v){const b=v*p;let w=m[b];for(let S=0;S<p;++S){const I=m[b+S];(Number.isNaN(I)||I<w)&&(w=I)}h[v]=w}u!=null&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,h);if(o){const v=gn(d,i),b=Dt({inputs:{x:g},backend:n,attrs:{shape:v}});return n.disposeIntermediateTensorInfo(g),b}return g}const RG={kernelName:zd,backendName:"cpu",kernelFunc:$G};/** 10292 * @license 10293 * Copyright 2020 Google LLC. All Rights Reserved. 10294 * Licensed under the Apache License, Version 2.0 (the "License"); 10295 * you may not use this file except in compliance with the License. 10296 * You may obtain a copy of the License at 10297 * 10298 * http://www.apache.org/licenses/LICENSE-2.0 10299 * 10300 * Unless required by applicable law or agreed to in writing, software 10301 * distributed under the License is distributed on an "AS IS" BASIS, 10302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10303 * See the License for the specific language governing permissions and 10304 * limitations under the License. 10305 * ============================================================================= 10306 */function DG(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{paddings:a,mode:o}=r;_e(s,"mirrorPad");const i=a.map((w,S)=>w[0]+s.shape[S]+w[1]),l=a.map(w=>w[0]),u=a.map((w,S)=>w[0]+s.shape[S]),c=o==="reflect"?0:1,d=n.data.get(s.dataId).values,f=s.shape.length,p=Ie(s.shape),h=J(i),m=i.length,g=Ie(i),v=$n(s.dtype,h);for(let w=0;w<h;w++){let S=ii(w,m,g);for(let E=0;E<m;E++)S[E]<l[E]?S[E]=l[E]*2-S[E]-c:S[E]>=u[E]&&(S[E]=(u[E]-1)*2-S[E]+c);S=S.map((E,T)=>E-l[T]);const I=ts(S,f,p);v[w]=d[I]}return{dataId:n.write(v,i,s.dtype),shape:i,dtype:s.dtype}}const FG={kernelName:Ud,backendName:"cpu",kernelFunc:DG};/** 10307 * @license 10308 * Copyright 2020 Google LLC. All Rights Reserved. 10309 * Licensed under the Apache License, Version 2.0 (the "License"); 10310 * you may not use this file except in compliance with the License. 10311 * You may obtain a copy of the License at 10312 * 10313 * http://www.apache.org/licenses/LICENSE-2.0 10314 * 10315 * Unless required by applicable law or agreed to in writing, software 10316 * distributed under the License is distributed on an "AS IS" BASIS, 10317 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10318 * See the License for the specific language governing permissions and 10319 * limitations under the License. 10320 * ============================================================================= 10321 */const MG=Qt((t,e)=>{const n=t%e;return t<0&&e<0||t>=0&&e>=0?n:(n+e)%e}),OG=ln(Vd,MG),PG={kernelName:Vd,backendName:"cpu",kernelFunc:OG};/** 10322 * @license 10323 * Copyright 2020 Google LLC. All Rights Reserved. 10324 * Licensed under the Apache License, Version 2.0 (the "License"); 10325 * you may not use this file except in compliance with the License. 10326 * You may obtain a copy of the License at 10327 * 10328 * http://www.apache.org/licenses/LICENSE-2.0 10329 * 10330 * Unless required by applicable law or agreed to in writing, softw
10330are 10331 * distributed under the License is distributed on an "AS IS" BASIS, 10332 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10333 * See the License for the specific language governing permissions and 10334 * limitations under the License. 10335 * ============================================================================= 10336 */function c_(t){const{inputs:e,backend:n,attrs:r}=t,{logits:s}=e,{dim:a}=r,o=s.shape.length;let i=a;if(i===-1&&(i=o-1),i!==o-1)throw Error("Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(o," and dim was ").concat(i));const l=Vt([i],s.shape),u=i_({inputs:{x:s},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=gn(u.shape,l),d=Dt({inputs:{x:u},backend:n,attrs:{shape:c}}),f=Bg({inputs:{a:s,b:d},backend:n}),p=pS({inputs:{x:f},backend:n}),h=jc({inputs:{x:p},backend:n,attrs:{axis:l,keepDims:!1}}),m=Dt({inputs:{x:h},backend:n,attrs:{shape:c}}),g=zg({inputs:{a:p,b:m},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(m),g}const BG={kernelName:xf,backendName:"cpu",kernelFunc:c_};/** 10337 * @license 10338 * Copyright 2020 Google LLC. All Rights Reserved. 10339 * Licensed under the Apache License, Version 2.0 (the "License"); 10340 * you may not use this file except in compliance with the License. 10341 * You may obtain a copy of the License at 10342 * 10343 * http://www.apache.org/licenses/LICENSE-2.0 10344 * 10345 * Unless required by applicable law or agreed to in writing, software 10346 * distributed under the License is distributed on an "AS IS" BASIS, 10347 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10348 * See the License for the specific language governing permissions and 10349 * limitations under the License. 10350 * ============================================================================= 10351 */function LG(t){const{inputs:e,backend:n,attrs:r}=t,{logits:s}=e,{numSamples:a,seed:o,normalized:i}=r;_e(s,"multinomial");const l=i?s:c_({inputs:{logits:s},backend:n,attrs:{dim:-1}}),u=l.shape[0],c=l.shape[1],d=n.data.get(l.dataId).values,f=[u,a],p=xn(J(f),"int32");for(let h=0;h<u;++h){const m=h*c,g=new Float32Array(c-1);g[0]=d[m];for(let w=1;w<g.length;++w)g[w]=g[w-1]+d[m+w];const v=Wf.alea(o.toString()),b=h*a;for(let w=0;w<a;++w){const S=v();p[b+w]=g.length;for(let I=0;I<g.length;I++)if(S<g[I]){p[b+w]=I;break}}}return i||n.disposeIntermediateTensorInfo(l),n.makeTensorInfo(f,"int32",p)}const WG={kernelName:jd,backendName:"cpu",kernelFunc:LG};/** 10352 * @license 10353 * Copyright 2020 Google LLC. All Rights Reserved. 10354 * Licensed under the Apache License, Version 2.0 (the "License"); 10355 * you may not use this file except in compliance with the License. 10356 * You may obtain a copy of the License at 10357 * 10358 * http://www.apache.org/licenses/LICENSE-2.0 10359 * 10360 * Unless required by applicable law or agreed to in writing, software 10361 * distributed under the License is distributed on an "AS IS" BASIS, 10362 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10363 * See the License for the specific language governing permissions and 10364 * limitations under the License. 10365 * ============================================================================= 10366 */const zG=f2;function HG(t){const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:a}=e,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l}=r;_e(s,"NonMaxSuppression");const u=n.data.get(s.dataId).values,c=n.data.get(a.dataId).values,{selectedIndices:d}=zG(u,c,o,i,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}const UG={kernelName:Kd,backendName:"cpu",kernelFunc:HG};/** 10367 * @license 10368 * Copyright 2020 Google LLC. All Rights Reserved. 10369 * Licensed under the Apache License, Version 2.0 (the "License"); 10370 * you may not use this file except in compliance with the License. 10371 * You may obtain a copy of the License at 10372 * 10373 * http://www.apache.org/licenses/LICENSE-2.0 10374 * 10375 * Unless required by applicable law or agreed to in writing, software 10376 * distributed under the License is distributed on an "AS IS" BASIS, 10377 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10378 * See the License for the specific language governing permissions and 10379 * limitations under the License. 10380 * ============================================================================= 10381 */const VG=p2;function jG(t){const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:a}=e,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,padToMaxOutputSize:u}=r;_e(s,"NonMaxSuppressionPadded");const c=n.data.get(s.dataId).values,d=n.data.get(a.dataId).values,{selectedIndices:f,validOutputs:p}=VG(c,d,o,i,l,u);return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}const GG={kernelName:Xd,backendName:"cpu",kernelFunc:jG};/** 10382 * @license 10383 * Copyright 2019 Google LLC. All Rights Reserved. 10384 * Licensed under the Apache License, Version 2.0 (the "License");
10385 * you may not use this file except in compliance with the License. 10386 * You may obtain a copy of the License at 10387 * 10388 * http://www.apache.org/licenses/LICENSE-2.0 10389 * 10390 * Unless required by applicable law or agreed to in writing, software 10391 * distributed under the License is distributed on an "AS IS" BASIS, 10392 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10393 * See the License for the specific language governing permissions and 10394 * limitations under the License. 10395 * ============================================================================= 10396 */const qG=h2;function KG(t){const{inputs:e,backend:n,attrs:r}=t,{boxes:s,scores:a}=e,{maxOutputSize:o,iouThreshold:i,scoreThreshold:l,softNmsSigma:u}=r;_e(s,"NonMaxSuppressionWithScore");const c=n.data.get(s.dataId).values,d=n.data.get(a.dataId).values,f=o,p=i,h=l,m=u,{selectedIndices:g,selectedScores:v}=qG(c,d,f,p,h,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([v.length],"float32",new Float32Array(v))]}const XG={kernelName:Yd,backendName:"cpu",kernelFunc:KG};/** 10397 * @license 10398 * Copyright 2020 Google LLC. All Rights Reserved. 10399 * Licensed under the Apache License, Version 2.0 (the "License"); 10400 * you may not use this file except in compliance with the License. 10401 * You may obtain a copy of the License at 10402 * 10403 * http://www.apache.org/licenses/LICENSE-2.0 10404 * 10405 * Unless required by applicable law or agreed to in writing, software 10406 * distributed under the License is distributed on an "AS IS" BASIS, 10407 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10408 * See the License for the specific language governing permissions and 10409 * limitations under the License. 10410 * ============================================================================= 10411 */function YG(t){const{inputs:e,backend:n,attrs:r}=t,{indices:s}=e,{dtype:a,depth:o,onValue:i,offValue:l}=r;_e(s,"oneHot");const u=J(s.shape),c=new Float32Array(u*o);c.fill(l);const d=n.data.get(s.dataId).values;for(let f=0;f<u;++f)d[f]>=0&&d[f]<o&&(c[f*o+d[f]]=i);return n.makeTensorInfo([...s.shape,o],a,c)}const JG={kernelName:Jd,backendName:"cpu",kernelFunc:YG};/** 10412 * @license 10413 * Copyright 2020 Google LLC. All Rights Reserved. 10414 * Licensed under the Apache License, Version 2.0 (the "License"); 10415 * you may not use this file except in compliance with the License. 10416 * You may obtain a copy of the License at 10417 * 10418 * http://www.apache.org/licenses/LICENSE-2.0 10419 * 10420 * Unless required by applicable law or agreed to in writing, software 10421 * distributed under the License is distributed on an "AS IS" BASIS, 10422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10423 * See the License for the specific language governing permissions and 10424 * limitations under the License. 10425 * ============================================================================= 10426 */function wu(t){const{inputs:e,backend:n}=t,{x:r}=e;if(r.dtype==="string")throw new Error("zerosLike is not supported for string tensors");if(r.dtype==="complex64"){const s=qa({inputs:{input:r},backend:n}),a=wu({inputs:{x:s},backend:n}),o=ei({inputs:{input:r},backend:n}),i=wu({inputs:{x:o},backend:n}),l=Qn({inputs:{real:a,imag:i},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}else return Hg({backend:n,attrs:{shape:r.shape,value:0,dtype:r.dtype}})}const QG={kernelName:ug,backendName:"cpu",kernelFunc:wu};/** 10427 * @license 10428 * Copyright 2020 Google LLC. All Rights Reserved. 10429 * Licensed under the Apache License, Version 2.0 (the "License"); 10430 * you may not use this file except in compliance with the License. 10431 * You may obtain a copy of the License at 10432 * 10433 * http://www.apache.org/licenses/LICENSE-2.0 10434 * 10435 * Unless required by applicable law or agreed to in writing, software 10436 * distributed under the License is distributed on an "AS IS" BASIS, 10437 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10438 * See the License for the specific language governing permissions and 10439 * limitations under the License. 10440 * ============================================================================= 10441 */function l_(t){const{inputs:e,backend:n}=t,{x:r}=e;if(r.dtype==="string")throw new Error("onesLike is not supported for string tensors");
vendor: 4,125 bytes, lines 10441-10495
10441if(r.dtype==="complex64"){const s=qa({inputs:{input:r},backend:n}),a=l_({inputs:{x:s},backend:n}),o=ei({inputs:{input:r},backend:n}),i=wu({inputs:{x:o},backend:n}),l=Qn({inputs:{real:a,imag:i},backend:n});return n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(i),l}else return Hg({backend:n,attrs:{shape:r.shape,value:1,dtype:r.dtype}})}const ZG={kernelName:jm,backendName:"cpu",kernelFunc:l_};/** 10442 * @license 10443 * Copyright 2020 Google LLC. All Rights Reserved. 10444 * Licensed under the Apache License, Version 2.0 (the "License"); 10445 * you may not use this file except in compliance with the License. 10446 * You may obtain a copy of the License at 10447 * 10448 * http://www.apache.org/licenses/LICENSE-2.0 10449 * 10450 * Unless required by applicable law or agreed to in writing, software 10451 * distributed under the License is distributed on an "AS IS" BASIS, 10452 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10453 * See the License for the specific language governing permissions and 10454 * limitations under the License. 10455 * ============================================================================= 10456 */function u_(t){const{inputs:e,backend:n,attrs:r}=t,{axis:s}=r;if(e.length===1)return bu({inputs:{input:e[0]},backend:n,attrs:{dim:s}});const a=e[0].shape,o=e[0].dtype;e.forEach(c=>{tr(a,c.shape,"All tensors passed to stack must have matching shapes"),A(o===c.dtype,()=>"All tensors passed to stack must have matching dtypes")});const i=[],l=e.map(c=>{const d=bu({inputs:{input:c},backend:n,attrs:{dim:s}});return i.push(d),d}),u=ti({inputs:l,backend:n,attrs:{axis:s}});return i.forEach(c=>n.disposeIntermediateTensorInfo(c)),u}const eq={kernelName:Gm,backendName:"cpu",kernelFunc:u_};/** 10457 * @license 10458 * Copyright 2020 Google LLC. All Rights Reserved. 10459 * Licensed under the Apache License, Version 2.0 (the "License"); 10460 * you may not use this file except in compliance with the License. 10461 * You may obtain a copy of the License at 10462 * 10463 * http://www.apache.org/licenses/LICENSE-2.0 10464 * 10465 * Unless required by applicable law or agreed to in writing, software 10466 * distributed under the License is distributed on an "AS IS" BASIS, 10467 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10468 * See the License for the specific language governing permissions and 10469 * limitations under the License. 10470 * ============================================================================= 10471 */function tq(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{paddings:a,constantValue:o}=r;_e(s,"pad");const i=a.map((b,w)=>b[0]+s.shape[w]+b[1]),l=a.map(b=>b[0]),u=n.data.get(s.dataId).values,c=J(s.shape),d=s.shape.length,f=Ie(s.shape),p=J(i),h=i.length,m=Ie(i),g=$n(s.dtype,p);o!==0&&g.fill(o);for(let b=0;b<c;b++){const S=ii(b,d,f).map((E,T)=>E+l[T]),I=ts(S,h,m);g[I]=u[b]}return{dataId:n.write(g,i,s.dtype),shape:i,dtype:s.dtype}}const d_={kernelName:Qd,backendName:"cpu",kernelFunc:tq};/** 10472 * @license 10473 * Copyright 2020 Google LLC. All Rights Reserved. 10474 * Licensed under the Apache License, Version 2.0 (the "License"); 10475 * you may not use this file except in compliance with the License. 10476 * You may obtain a copy of the License at 10477 * 10478 * http://www.apache.org/licenses/LICENSE-2.0 10479 * 10480 * Unless required by applicable law or agreed to in writing, software 10481 * distributed under the License is distributed on an "AS IS" BASIS, 10482 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10483 * See the License for the specific language governing permissions and 10484 * limitations under the License. 10485 * ============================================================================= 10486 */const nq=Qt((t,e)=>Math.pow(t,e)),rq=ln(Zd,nq),sq={kernelName:Zd,backendName:"cpu",kernelFunc:rq};/** 10487 * @license 10488 * Copyright 2022 Google LLC. All Rights Reserved. 10489 * Licensed under the Apache License, Version 2.0 (the "License"); 10490 * you may not use this file except in compliance with the License. 10491 * You may obtain a copy of the License at 10492 * 10493 * http://www.apache.org/licenses/LICENSE-2.0 10494 * 10495 * Unless required by applicable law or agreed to in writing, softw
10495are 10496 * distributed under the License is distributed on an "AS IS" BASIS, 10497 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10498 * See the License for the specific language governing permissions and 10499 * limitations under the License. 10500 * ============================================================================= 10501 */function aq(t){const{inputs:e,backend:n,attrs:r}=t,{paramsNestedSplits:s,paramsDenseValues:a,indices:o}=e,i=s.map(g=>n.data.get(g.dataId).values),l=s.map(g=>g.shape),u=n.data.get(a.dataId).values,c=n.data.get(o.dataId).values,[d,f,p]=S7(i,l,u,a.shape,a.dtype,c,o.shape),h=d.map(g=>n.makeTensorInfo([g.length],"int32",g)),m=n.makeTensorInfo(p,a.dtype,f);return h.concat([m])}const oq={kernelName:H1,backendName:"cpu",kernelFunc:aq};/** 10502 * @license 10503 * Copyright 2022 Google LLC. 10504 * Licensed under the Apache License, Version 2.0 (the "License"); 10505 * you may not use this file except in compliance with the License. 10506 * You may obtain a copy of the License at 10507 * 10508 * http://www.apache.org/licenses/LICENSE-2.0 10509 * 10510 * Unless required by applicable law or agreed to in writing, software 10511 * distributed under the License is distributed on an "AS IS" BASIS, 10512 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10513 * See the License for the specific language governing permissions and 10514 * limitations under the License. 10515 * ============================================================================= 10516 */function iq(t){const{inputs:e,backend:n}=t,{starts:r,limits:s,deltas:a}=e,o=n.data.get(r.dataId).values,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,[u,c]=x7(o,r.shape,r.dtype,i,s.shape,l,a.shape),d=n.makeTensorInfo([u.length],"int32",u),f=n.makeTensorInfo([c.length],r.dtype,c);return[d,f]}const cq={kernelName:U1,backendName:"cpu",kernelFunc:iq};/** 10517 * @license 10518 * Copyright 2022 Google LLC. All Rights Reserved. 10519 * Licensed under the Apache License, Version 2.0 (the "License"); 10520 * you may not use this file except in compliance with the License. 10521 * You may obtain a copy of the License at 10522 * 10523 * http://www.apache.org/licenses/LICENSE-2.0 10524 * 10525 * Unless required by applicable law or agreed to in writing, software 10526 * distributed under the License is distributed on an "AS IS" BASIS, 10527 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10528 * See the License for the specific language governing permissions and 10529 * limitations under the License. 10530 * ============================================================================= 10531 */function lq(t){const{inputs:e,backend:n,attrs:r}=t,{shape:s,values:a,defaultValue:o,rowPartitionTensors:i}=e,{rowPartitionTypes:l}=r,u=n.data.get(s.dataId).values,c=n.data.get(a.dataId).values,d=n.data.get(o.dataId).values,f=i.map(g=>n.data.get(g.dataId).values),p=i.map(g=>g.shape),[h,m]=_7(u,s.shape,c,a.shape,a.dtype,d,o.shape,f,p,l);return n.makeTensorInfo(h,a.dtype,m)}const uq={kernelName:V1,backendName:"cpu",kernelFunc:lq};/** 10532 * @license 10533 * Copyright 2020 Google LLC. All Rights Reserved. 10534 * Licensed under the Apache License, Version 2.0 (the "License"); 10535 * you may not use this file except in compliance with the License. 10536 * You may obtain a copy of the License at 10537 * 10538 * http://www.apache.org/licenses/LICENSE-2.0 10539 * 10540 * Unless required by applicable law or agreed to in writing, software 10541 * distributed under the License is distributed on an "AS IS" BASIS, 10542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10543 * See the License for the specific language governing permissions and 10544 * limitations under the License. 10545 * ============================================================================= 10546 */function dq(t){const{backend:e,attrs:n}=t,{start:r,stop:s,dtype:a,step:o}=n,i=gS(r,s,o,a);return e.makeTensorInfo([i.length],a,i)}const fq={kernelName:qm,backendName:"cpu",kernelFunc:dq};/** 10547 * @license 10548 * Copyright 2020 Google LLC. All Rights Reserved. 10549 * Licensed under the Apache License, Version 2.0 (the License); 10550 * you may not use this file except in compliance with the License. 10551 * You may obtain a copy of the License at 10552 * 10553 * http://www.apache.org/licenses/LICENSE-2.0 10554 * 10555 * Unless required by applicable law or agreed to in writing, softw
vendor: 5,206 bytes, lines 10555-10609
10555are 10556 * distributed under the License is distributed on an AS IS BASIS, 10557 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10558 * See the License for the specific language governing permissions and 10559 * limitations under the License. 10560 * ============================================================================= 10561 */const pq=mt(nf,t=>1/t),hq={kernelName:nf,backendName:"cpu",kernelFunc:pq};/** 10562 * @license 10563 * Copyright 2020 Google LLC. All Rights Reserved. 10564 * Licensed under the Apache License, Version 2.0 (the "License"); 10565 * you may not use this file except in compliance with the License. 10566 * You may obtain a copy of the License at 10567 * 10568 * http://www.apache.org/licenses/LICENSE-2.0 10569 * 10570 * Unless required by applicable law or agreed to in writing, software 10571 * distributed under the License is distributed on an "AS IS" BASIS, 10572 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10573 * See the License for the specific language governing permissions and 10574 * limitations under the License. 10575 * ============================================================================= 10576 */function mq(t){const{inputs:e,backend:n,attrs:r}=t,{images:s}=e,{alignCorners:a,halfPixelCenters:o,size:i}=r;_e(s,"resizeBilinear");const l=Ie(s.shape),[u,c]=i,[d,f,p,h]=s.shape,m=n.data.get(s.dataId).values,g=new Float32Array(J([d,u,c,h])),v=[a&&u>1?f-1:f,a&&c>1?p-1:p],b=[a&&u>1?u-1:u,a&&c>1?c-1:c];let w=0;const S=v[0]/b[0],I=v[1]/b[1];for(let E=0;E<d;E++)for(let T=0;T<u;T++){let D;o?D=S*(T+.5)-.5:D=S*T;const R=Math.max(0,Math.floor(D)),$=D-R,M=Math.min(f-1,Math.ceil(D)),B=E*l[0]+R*l[1],z=E*l[0]+M*l[1];for(let H=0;H<c;H++){let V;o?V=I*(H+.5)-.5:V=I*H;const X=Math.max(0,Math.floor(V)),Q=V-X,K=Math.min(p-1,Math.ceil(V)),ee=B+X*l[2],ae=z+X*l[2],ne=B+K*l[2],ce=z+K*l[2];for(let se=0;se<h;se++){const oe=m[ee+se],ie=m[ae+se],pe=m[ne+se],ve=m[ce+se],fe=oe+(pe-oe)*Q,be=ie+(ve-ie)*Q,$e=fe+(be-fe)*$;g[w++]=$e}}}return n.makeTensorInfo([d,u,c,h],"float32",g)}const gq={kernelName:af,backendName:"cpu",kernelFunc:mq};/** 10577 * @license 10578 * Copyright 2020 Google LLC. All Rights Reserved. 10579 * Licensed under the Apache License, Version 2.0 (the "License"); 10580 * you may not use this file except in compliance with the License. 10581 * You may obtain a copy of the License at 10582 * 10583 * http://www.apache.org/licenses/LICENSE-2.0 10584 * 10585 * Unless required by applicable law or agreed to in writing, software 10586 * distributed under the License is distributed on an "AS IS" BASIS, 10587 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10588 * See the License for the specific language governing permissions and 10589 * limitations under the License. 10590 * ============================================================================= 10591 */function yq(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:a}=e,{alignCorners:o}=r;_e([a,s],"resizeBilinearGrad");const i=Ie(s.shape),[l,u,c,d]=s.shape,[,f,p]=a.shape,h=new Float32Array(l*u*c*d),m=[o&&f>1?u-1:u,o&&p>1?c-1:c],g=[o&&f>1?f-1:f,o&&p>1?p-1:p],v=m[0]/g[0],b=m[1]/g[1],w=n.data.get(a.dataId).values;let S=0;for(let I=0;I<l;I++){const E=I*i[0];for(let T=0;T<f;T++){const D=T*v,R=Math.floor(D),$=Math.min(Math.ceil(D),u-1),M=E+R*i[1],B=E+$*i[1],z=D-R,H=1-z;for(let V=0;V<p;V++){const X=V*b,Q=Math.floor(X),K=Math.min(Math.ceil(X),c-1),ee=X-Q,ae=1-ee,ne=M+Q*i[2],ce=M+K*i[2],se=B+Q*i[2],oe=B+K*i[2],ie=H*ae,pe=H*ee,ve=z*ae,fe=z*ee;for(let be=0;be<d;be++){const $e=w[S++];h[ne+be]+=$e*ie,h[ce+be]+=$e*pe,h[se+be]+=$e*ve,h[oe+be]+=$e*fe}}}}return n.makeTensorInfo([l,c,u,d],"float32",h)}const vq={kernelName:Ym,backendName:"cpu",kernelFunc:yq};/** 10592 * @license 10593 * Copyright 2020 Google LLC. All Rights Reserved. 10594 * Licensed under the Apache License, Version 2.0 (the "License"); 10595 * you may not use this file except in compliance with the License. 10596 * You may obtain a copy of the License at 10597 * 10598 * http://www.apache.org/licenses/LICENSE-2.0 10599 * 10600 * Unless required by applicable law or agreed to in writing, software 10601 * distributed under the License is distributed on an "AS IS" BASIS, 10602 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10603 * See the License for the specific language governing permissions and 10604 * limitations under the License. 10605 * ============================================================================= 10606 */function bq(t){const{inputs:e,backend:n,attrs:r}=t,{images:s}=e,{alignCorners:a,halfPixelCenters:o,size:i}=r;_e(s,"resizeNearestNeighbor");const l=Ie(s.shape),[u,c]=i,[d,f,p,h]=s.shape,m=n.data.get(s.dataId).values,g=new Float32Array(d*u*c*h),v=[a&&u>1?f-1:f,a&&c>1?p-1:p],b=[a&&u>1?u-1:u,a&&c>1?c-1:c],w=v[0]/b[0],S=v[1]/b[1];let I=0;for(let E=0;E<d;E++){const T=E*l[0];for(let D=0;D<u;D++){const R=o?w*(D+.5):w*D;let $=Math.min(f-1,a?Math.round(R):Math.floor(R));o&&($=Math.max(0,$));const M=T+$*l[1];for(let B=0;B<c;B++){const z=o?S*(B+.5):S*B;let H=Math.min(p-1,a?Math.round(z):Math.floor(z));o&&(H=Math.max(0,H));const V=M+H*l[2];for(let X=0;X<h;X++){const Q=m[V+X];g[I++]=Q}}}}return n.makeTensorInfo([d,u,c,h],s.dtype,g)}const wq={kernelName:sf,backendName:"cpu",kernelFunc:bq};/** 10607 * @license 10608 * Copyright 2020 Google LLC. All Rights Reserved. 10609 * Licensed under the Apache License, Version 2.0 (the "License");
10610 * you may not use this file except in compliance with the License. 10611 * You may obtain a copy of the License at 10612 * 10613 * http://www.apache.org/licenses/LICENSE-2.0 10614 * 10615 * Unless required by applicable law or agreed to in writing, software 10616 * distributed under the License is distributed on an "AS IS" BASIS, 10617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10618 * See the License for the specific language governing permissions and 10619 * limitations under the License. 10620 * ============================================================================= 10621 */function Sq(t){const{inputs:e,backend:n,attrs:r}=t,{images:s,dy:a}=e,{alignCorners:o}=r;_e([a,s],"resizeNearestNeighborGrad");const i=Ie(s.shape),l=Ie(a.shape),[u,c,d,f]=s.shape,[,p,h]=a.shape,m=new Float32Array(u*c*d*f),g=n.data.get(a.dataId).values,v=[o&&p>1?c-1:c,o&&h>1?d-1:d],b=[o&&p>1?p-1:p,o&&h>1?h-1:h],w=v[0]/b[0],S=v[1]/b[1],I=1/w,E=1/S,T=Math.ceil(I)*2+2,D=Math.ceil(E)*2+2;for(let R=0;R<u;R++){const $=R*i[0];for(let M=0;M<c;M++){const B=$+M*i[1],z=Math.floor(M*I),H=Math.floor(z-T/2);for(let V=0;V<d;V++){const X=B+V*i[2],Q=Math.floor(V*E),K=Math.floor(Q-D/2);for(let ee=0;ee<f;ee++){let ae=0;for(let ne=0;ne<T;ne++){const ce=ne+H;if(ce<0||ce>=p)continue;const se=$+ce*l[1],oe=ce*w,ie=Math.min(c-1,o?Math.round(oe):Math.floor(oe));if(M===ie)for(let pe=0;pe<D;pe++){const ve=pe+K;if(ve<0||ve>=h)continue;const fe=se+ve*l[2],be=ve*S,$e=Math.min(d-1,o?Math.round(be):Math.floor(be));V===$e&&(ae+=g[fe+ee])}}m[X+ee]=ae}}}}return n.makeTensorInfo(s.shape,s.dtype,m)}const xq={kernelName:Xm,backendName:"cpu",kernelFunc:Sq};/** 10622 * @license 10623 * Copyright 2020 Google LLC. All Rights Reserved. 10624 * Licensed under the Apache License, Version 2.0 (the "License"); 10625 * you may not use this file except in compliance with the License. 10626 * You may obtain a copy of the License at 10627 * 10628 * http://www.apache.org/licenses/LICENSE-2.0 10629 * 10630 * Unless required by applicable law or agreed to in writing, software 10631 * distributed under the License is distributed on an "AS IS" BASIS, 10632 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10633 * See the License for the specific language governing permissions and 10634 * limitations under the License. 10635 * ============================================================================= 10636 */function _q(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{dims:a}=r;_e(s,"reverse");const o=s.shape.length,i=Vt(a,s.shape);if(o===0)return ss({inputs:{x:s},backend:n});const l=new on(s.shape,s.dtype),u=n.bufferSync(s);for(let c=0;c<l.size;c++){const d=l.indexToLoc(c),f=d.slice();i.forEach(p=>f[p]=s.shape[p]-1-f[p]),l.set(u.get(...f),...d)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}const Iq={kernelName:cf,backendName:"cpu",kernelFunc:_q};/** 10637 * @license 10638 * Copyright 2020 Google LLC. All Rights Reserved. 10639 * Licensed under the Apache License, Version 2.0 (the "License"); 10640 * you may not use this file except in compliance with the License. 10641 * You may obtain a copy of the License at 10642 * 10643 * http://www.apache.org/licenses/LICENSE-2.0 10644 * 10645 * Unless required by applicable law or agreed to in writing, software 10646 * distributed under the License is distributed on an "AS IS" BASIS, 10647 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10648 * See the License for the specific language governing permissions and 10649 * limitations under the License. 10650 * ============================================================================= 10651 */const kq={kernelName:Rf,backendName:"cpu",kernelFunc:({inputs:t,attrs:e,backend:n})=>{const{image:r}=t,{radians:s,fillValue:a,center:o}=e,i=n,l=$n(r.dtype,J(r.shape)),[u,c,d,f]=r.shape,[p,h]=N2(o,c,d),m=255,g=Math.sin(s),v=Math.cos(s),b=i.data.get(r.dataId).values;for(let S=0;S<u;S++){const I=S*d*c*f;for(let E=0;E<c;E++){const T=E*(d*f);for(let D=0;D<d;D++){const R=D*f;for(let $=0;$<f;$++){const M=[u,E,D,$],B=M[2],z=M[1];let H=(B-p)*v-(z-h)*g,V=(B-p)*g+(z-h)*v;H=Math.round(H+p),V=Math.round(V+h);let X=a;if(typeof a!="number"&&($===3?X=m:X=a[$]),H>=0&&H<d&&V>=0&&V<c){const K=V*(d*f),ee=H*f,ae=I+K+ee+$;X=b[ae]}const Q=I+T+R+$;l[Q]=X}}}}return{dataId:i.write(l,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};/** 10652 * @license 10653 * Copyright 2020 Google LLC. All Rights Reserved. 10654 * Licensed under the Apache License, Version 2.0 (the License);
10655 * you may not use this file except in compliance with the License. 10656 * You may obtain a copy of the License at 10657 * 10658 * http://www.apache.org/licenses/LICENSE-2.0 10659 * 10660 * Unless required by applicable law or agreed to in writing, software 10661 * distributed under the License is distributed on an AS IS BASIS, 10662 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10663 * See the License for the specific language governing permissions and 10664 * limitations under the License. 10665 * ============================================================================= 10666 */const Eq=mt(lf,t=>{const e=Math.floor(t);return t-e<.5?Math.floor(t):t-e>.5?Math.ceil(t):e%2===0?e:e+1}),Tq={kernelName:lf,backendName:"cpu",kernelFunc:Eq};/** 10667 * @license 10668 * Copyright 2020 Google LLC. All Rights Reserved. 10669 * Licensed under the Apache License, Version 2.0 (the "License"); 10670 * you may not use this file except in compliance with the License. 10671 * You may obtain a copy of the License at 10672 * 10673 * http://www.apache.org/licenses/LICENSE-2.0 10674 * 10675 * Unless required by applicable law or agreed to in writing, software 10676 * distributed under the License is distributed on an "AS IS" BASIS, 10677 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10678 * See the License for the specific language governing permissions and 10679 * limitations under the License. 10680 * ============================================================================= 10681 */function Cq(t){const{inputs:e,backend:n,attrs:r}=t,{indices:s,updates:a}=e,{shape:o}=r,{sliceRank:i,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=di(a,s,o),f=!0,p=n.bufferSync(s),h=n.bufferSync(a),m=Fo(p,h,o,d,u,l,i,c,0,f);return n.makeTensorInfo(o,m.dtype,m.values)}const Nq={kernelName:df,backendName:"cpu",kernelFunc:Cq};/** 10682 * @license 10683 * Copyright 2022 Google LLC. All Rights Reserved. 10684 * Licensed under the Apache License, Version 2.0 (the "License"); 10685 * you may not use this file except in compliance with the License. 10686 * You may obtain a copy of the License at 10687 * 10688 * http://www.apache.org/licenses/LICENSE-2.0 10689 * 10690 * Unless required by applicable law or agreed to in writing, software 10691 * distributed under the License is distributed on an "AS IS" BASIS, 10692 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10693 * See the License for the specific language governing permissions and 10694 * limitations under the License. 10695 * ============================================================================= 10696 */function Aq(t,e){let n=0,r=t.length,s=0;for(;n<r;)s=Math.floor((n+r)/2),t[s]<e?n=s+1:r=s;return r}function $q(t,e){let n=0,r=t.length,s=0;for(;n<r;)s=Math.floor((n+r)/2),t[s]<=e?n=s+1:r=s;return r}function Rq(t,e,n,r,s,a){const o=tn("int32",n*s);for(let i=0;i<n;++i){const l=t.slice(i*r,(i+1)*r),u=i*s;for(let c=0;c<s;++c)o[u+c]=a==="left"?Aq(l,e[c+u]):$q(l,e[c+u])}return o}/** 10697 * @license 10698 * Copyright 2022 Google LLC. All Rights Reserved. 10699 * Licensed under the Apache License, Version 2.0 (the "License"); 10700 * you may not use this file except in compliance with the License. 10701 * You may obtain a copy of the License at 10702 * 10703 * http://www.apache.org/licenses/LICENSE-2.0 10704 * 10705 * Unless required by applicable law or agreed to in writing, software 10706 * distributed under the License is distributed on an "AS IS" BASIS, 10707 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10708 * See the License for the specific language governing permissions and 10709 * limitations under the License. 10710 * ============================================================================= 10711 */function Dq(t){const{inputs:e,backend:n,attrs:r}=t,{sortedSequence:s,values:a}=e,{side:o}=r,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,u=Rq(i,l,s.shape[0],s.shape[1],a.shape[1],o);return n.makeTensorInfo(a.shape,"int32",u)}const Fq={kernelName:pf,backendName:"cpu",kernelFunc:Dq};/** 10712 * @license 10713 * Copyright 2020 Google LLC. All Rights Reserved. 10714 * Licensed under the Apache License, Version 2.0 (the "License"); 10715 * you may not use this file except in compliance with the License. 10716 * You may obtain a copy of the License at 10717 * 10718 * http://www.apache.org/licenses/LICENSE-2.0 10719 * 10720 * Unless required by applicable law or agreed to in writing, softw
10720are 10721 * distributed under the License is distributed on an "AS IS" BASIS, 10722 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10723 * See the License for the specific language governing permissions and 10724 * limitations under the License. 10725 * ============================================================================= 10726 */function Mq(t){const{inputs:e,backend:n}=t,{condition:r,t:s,e:a}=e;_e([r,s,a],"select");const o=r.shape.length,i=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,u=n.data.get(a.dataId).values,c=ci(s.dtype,a.dtype),d=xn(J(s.shape),c);let f=0;const p=o===0||o>1||s.shape.length===1?1:J(s.shape.slice(1));for(let h=0;h<i.length;h++)for(let m=0;m<p;m++)i[h]===1?d[f++]=l[h]:d[f++]=u[h];return n.makeTensorInfo(s.shape,c,d)}const Oq={kernelName:Jm,backendName:"cpu",kernelFunc:Mq};/** 10727 * @license 10728 * Copyright 2020 Google LLC. All Rights Reserved. 10729 * Licensed under the Apache License, Version 2.0 (the License); 10730 * you may not use this file except in compliance with the License. 10731 * You may obtain a copy of the License at 10732 * 10733 * http://www.apache.org/licenses/LICENSE-2.0 10734 * 10735 * Unless required by applicable law or agreed to in writing, software 10736 * distributed under the License is distributed on an AS IS BASIS, 10737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10738 * See the License for the specific language governing permissions and 10739 * limitations under the License. 10740 * ============================================================================= 10741 */const Pq=j6,Bq=G6,Lq=mt(hf,t=>t>=0?Bq*t:Pq*(Math.exp(t)-1)),Wq={kernelName:hf,backendName:"cpu",kernelFunc:Lq};/** 10742 * @license 10743 * Copyright 2020 Google LLC. All Rights Reserved. 10744 * Licensed under the Apache License, Version 2.0 (the License); 10745 * you may not use this file except in compliance with the License. 10746 * You may obtain a copy of the License at 10747 * 10748 * http://www.apache.org/licenses/LICENSE-2.0 10749 * 10750 * Unless required by applicable law or agreed to in writing, software 10751 * distributed under the License is distributed on an AS IS BASIS, 10752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10753 * See the License for the specific language governing permissions and 10754 * limitations under the License. 10755 * ============================================================================= 10756 */const zq=mt(yf,t=>t<0?-1:t>0?1:0),Hq={kernelName:yf,backendName:"cpu",kernelFunc:zq};/** 10757 * @license 10758 * Copyright 2020 Google LLC. All Rights Reserved. 10759 * Licensed under the Apache License, Version 2.0 (the License); 10760 * you may not use this file except in compliance with the License. 10761 * You may obtain a copy of the License at 10762 * 10763 * http://www.apache.org/licenses/LICENSE-2.0 10764 * 10765 * Unless required by applicable law or agreed to in writing, software 10766 * distributed under the License is distributed on an AS IS BASIS, 10767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10768 * See the License for the specific language governing permissions and 10769 * limitations under the License. 10770 * ============================================================================= 10771 */const Uq=mt(mf,t=>Math.sin(t)),Vq={kernelName:mf,backendName:"cpu",kernelFunc:Uq};/** 10772 * @license 10773 * Copyright 2020 Google LLC. All Rights Reserved. 10774 * Licensed under the Apache License, Version 2.0 (the License); 10775 * you may not use this file except in compliance with the License. 10776 * You may obtain a copy of the License at 10777 * 10778 * http://www.apache.org/licenses/LICENSE-2.0 10779 * 10780 * Unless required by applicable law or agreed to in writing, software 10781 * distributed under the License is distributed on an AS IS BASIS, 10782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10783 * See the License for the specific language governing permissions and 10784 * limitations under the License. 10785 * ============================================================================= 10786 */const jq=mt(gf,t=>Math.sinh(t)),Gq={kernelName:gf,backendName:"cpu",kernelFunc:jq};/** 10787 * @license 10788 * Copyright 2020 Google LLC. All Rights Reserved. 10789 * Licensed under the Apache License, Version 2.0 (the License);
10790 * you may not use this file except in compliance with the License. 10791 * You may obtain a copy of the License at 10792 * 10793 * http://www.apache.org/licenses/LICENSE-2.0 10794 * 10795 * Unless required by applicable law or agreed to in writing, software 10796 * distributed under the License is distributed on an AS IS BASIS, 10797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10798 * See the License for the specific language governing permissions and 10799 * limitations under the License. 10800 * ============================================================================= 10801 */const qq=11920928955078125e-23,eb=Math.log(qq)+2,Kq=mt(bf,t=>{const e=t>-eb,n=t<eb,r=Math.exp(t);let s;return n?s=r:e?s=t:s=Math.log(1+r),s}),Xq={kernelName:bf,backendName:"cpu",kernelFunc:Kq};/** 10802 * @license 10803 * Copyright 2020 Google LLC. All Rights Reserved. 10804 * Licensed under the Apache License, Version 2.0 (the "License"); 10805 * you may not use this file except in compliance with the License. 10806 * You may obtain a copy of the License at 10807 * 10808 * http://www.apache.org/licenses/LICENSE-2.0 10809 * 10810 * Unless required by applicable law or agreed to in writing, software 10811 * distributed under the License is distributed on an "AS IS" BASIS, 10812 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10813 * See the License for the specific language governing permissions and 10814 * limitations under the License. 10815 * ============================================================================= 10816 */function Yq(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{blockShape:a,paddings:o}=r;_e([s],"spaceToBatchND");const i=J(a),l=[[0,0]];l.push(...o);for(let E=1+a.length;E<s.shape.length;++E)l.push([0,0]);const u=d_.kernelFunc({inputs:{x:s},backend:n,attrs:{paddings:l,constantValue:0}}),c=Uf(u.shape,a,i,!1),d=Vf(c.length,a.length,!1),f=jf(u.shape,a,i,!1),m=Dt({inputs:{x:u},backend:n,attrs:{shape:c}}),b=Un({inputs:{x:m},backend:n,attrs:{perm:d}}),I=Dt({inputs:{x:b},backend:n,attrs:{shape:f}});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(b),I}const Jq={kernelName:Zm,backendName:"cpu",kernelFunc:Yq};/** 10817 * @license 10818 * Copyright 2021 Google LLC. All Rights Reserved. 10819 * Licensed under the Apache License, Version 2.0 (the "License"); 10820 * you may not use this file except in compliance with the License. 10821 * You may obtain a copy of the License at 10822 * 10823 * http://www.apache.org/licenses/LICENSE-2.0 10824 * 10825 * Unless required by applicable law or agreed to in writing, software 10826 * distributed under the License is distributed on an "AS IS" BASIS, 10827 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10828 * See the License for the specific language governing permissions and 10829 * limitations under the License. 10830 * ============================================================================= 10831 */function Qq(t){const{inputs:e,backend:n}=t,{indices:r,values:s,denseShape:a,defaultValue:o}=e;if(a.shape.length!==1)throw new Error("Dense shape must be a vector, saw:\n ".concat(a.shape));if(r.shape.length!==2)throw new Error("Indices must be a matrix, saw:\n ".concat(r.shape));if(s.shape.length!==1)throw new Error("Values must be a vector, saw:\n ".concat(s.shape));if(o.shape.length!==0)throw new Error("Default value must be a scalar, saw:\n ".concat(o.shape));const i=n.data.get(r.dataId).values,l=n.data.get(s.dataId).values,u=n.data.get(a.dataId).values,c=n.data.get(o.dataId).values[0],[d,f,p,h,m]=N7(i,r.shape,r.dtype,l,s.dtype,u,c);return[n.makeTensorInfo(f,r.dtype,d),n.makeTensorInfo([f[0]],s.dtype,p),n.makeTensorInfo([h.length],"bool",new Uint8Array(h.map(g=>Number(g)))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}const Zq={kernelName:tg,backendName:"cpu",kernelFunc:Qq};/** 10832 * @license 10833 * Copyright 2021 Google LLC. All Rights Reserved. 10834 * Licensed under the Apache License, Version 2.0 (the "License"); 10835 * you may not use this file except in compliance with the License. 10836 * You may obtain a copy of the License at 10837 * 10838 * http://www.apache.org/licenses/LICENSE-2.0 10839 * 10840 * Unless required by applicable law or agreed to in writing, softw
10840are 10841 * distributed under the License is distributed on an "AS IS" BASIS, 10842 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10843 * See the License for the specific language governing permissions and 10844 * limitations under the License. 10845 * ============================================================================= 10846 */function eK(t){const{inputs:e,backend:n}=t,{inputIndices:r,inputShape:s,newShape:a}=e;if(r.shape.length!==2)throw new Error("Input indices should be a matrix but received shape\n ".concat(r.shape));if(s.shape.length!==1)throw new Error("Input shape should be a vector but received shape\n ".concat(s.shape));if(a.shape.length!==1)throw new Error("Target shape should be a vector but received shape ".concat(a.shape));const o=Array.from(n.data.get(s.dataId).values),i=n.data.get(r.dataId).values,l=Array.from(n.data.get(a.dataId).values),[u,c,d]=A7(i,r.shape,r.dtype,o,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],a.dtype,new Int32Array(d))]}const tK={kernelName:_f,backendName:"cpu",kernelFunc:eK};/** 10847 * @license 10848 * Copyright 2021 Google LLC. All Rights Reserved. 10849 * Licensed under the Apache License, Version 2.0 (the "License"); 10850 * you may not use this file except in compliance with the License. 10851 * You may obtain a copy of the License at 10852 * 10853 * http://www.apache.org/licenses/LICENSE-2.0 10854 * 10855 * Unless required by applicable law or agreed to in writing, software 10856 * distributed under the License is distributed on an "AS IS" BASIS, 10857 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10858 * See the License for the specific language governing permissions and 10859 * limitations under the License. 10860 * ============================================================================= 10861 */function nK(t){const{inputs:e,backend:n}=t,{data:r,indices:s,segmentIds:a}=e;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error("Indices should be a vector but received shape\n ".concat(s.shape));if(a.shape.length!==1)throw new Error("Segment ids should be a vector but received shape\n ".concat(a.shape));if(s.shape[0]!==a.shape[0])throw new Error("segmentIds and indices should have same size.");const o=n.data.get(r.dataId).values,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,[u,c]=vS(o,r.shape,r.dtype,i,l,!0);return n.makeTensorInfo(c,r.dtype,u)}const rK={kernelName:ng,backendName:"cpu",kernelFunc:nK};/** 10862 * @license 10863 * Copyright 2021 Google LLC. All Rights Reserved. 10864 * Licensed under the Apache License, Version 2.0 (the "License"); 10865 * you may not use this file except in compliance with the License. 10866 * You may obtain a copy of the License at 10867 * 10868 * http://www.apache.org/licenses/LICENSE-2.0 10869 * 10870 * Unless required by applicable law or agreed to in writing, software 10871 * distributed under the License is distributed on an "AS IS" BASIS, 10872 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10873 * See the License for the specific language governing permissions and 10874 * limitations under the License. 10875 * ============================================================================= 10876 */function sK(t){const{inputs:e,backend:n}=t,{data:r,indices:s,segmentIds:a}=e;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(s.shape.length!==1)throw new Error("Indices should be a vector but received shape\n ".concat(s.shape));if(a.shape.length!==1)throw new Error("Segment ids should be a vector but received shape\n ".concat(a.shape));if(s.shape[0]!==a.shape[0])throw new Error("segmentIds and indices should have same size.");const o=n.data.get(r.dataId).values,i=n.data.get(s.dataId).values,l=n.data.get(a.dataId).values,[u,c]=vS(o,r.shape,r.dtype,i,l);return n.makeTensorInfo(c,r.dtype,u)}const aK={kernelName:rg,backendName:"cpu",kernelFunc:sK};/** 10877 * @license 10878 * Copyright 2020 Google LLC. All Rights Reserved. 10879 * Licensed under the Apache License, Version 2.0 (the "License"); 10880 * you may not use this file except in compliance with the License. 10881 * You may obtain a copy of the License at 10882 * 10883 * http://www.apache.org/licenses/LICENSE-2.0 10884 * 10885 * Unless required by applicable law or agreed to in writing, softw
10885are 10886 * distributed under the License is distributed on an "AS IS" BASIS, 10887 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10888 * See the License for the specific language governing permissions and 10889 * limitations under the License. 10890 * ============================================================================= 10891 */function oK(t){const{inputs:e,backend:n,attrs:r}=t,{sparseIndices:s,sparseValues:a,defaultValue:o}=e,{outputShape:i}=r,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:f}=di(a,s,i),p=!1,h=n.bufferSync(s);let m;switch(a.dtype){case"bool":{const g=n.bufferSync(a),v=!!n.data.get(o.dataId).values[0];m=Fo(h,g,i,f,c,u,l,d,v,p);break}case"float32":{const g=n.bufferSync(a),v=n.data.get(o.dataId).values[0];m=Fo(h,g,i,f,c,u,l,d,v,p);break}case"int32":{const g=n.bufferSync(a),v=n.data.get(o.dataId).values[0];m=Fo(h,g,i,f,c,u,l,d,v,p);break}case"string":{const g=n.bufferSync(a),v=bc(n.data.get(o.dataId).values[0]);m=Fo(h,g,i,f,c,u,l,d,v,p);break}default:throw new Error("Unsupported type ".concat(a.dtype))}return n.makeTensorInfo(i,m.dtype,m.values)}const iK={kernelName:If,backendName:"cpu",kernelFunc:oK};/** 10892 * @license 10893 * Copyright 2020 Google LLC. All Rights Reserved. 10894 * Licensed under the Apache License, Version 2.0 (the "License"); 10895 * you may not use this file except in compliance with the License. 10896 * You may obtain a copy of the License at 10897 * 10898 * http://www.apache.org/licenses/LICENSE-2.0 10899 * 10900 * Unless required by applicable law or agreed to in writing, software 10901 * distributed under the License is distributed on an "AS IS" BASIS, 10902 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10903 * See the License for the specific language governing permissions and 10904 * limitations under the License. 10905 * ============================================================================= 10906 */function cK(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{numOrSizeSplits:a,axis:o}=r,i=Vt(o,s.shape)[0],l=D2(s,a,i),u=new Array(s.shape.length).fill(0),c=s.shape.slice();return l.map(d=>{const f=[...c];f[i]=d;const p=Ka({inputs:{x:s},backend:n,attrs:{begin:u,size:f}});return u[i]+=d,p})}const lK={kernelName:eg,backendName:"cpu",kernelFunc:cK};/** 10907 * @license 10908 * Copyright 2019 Google LLC. All Rights Reserved. 10909 * Licensed under the Apache License, Version 2.0 (the "License"); 10910 * you may not use this file except in compliance with the License. 10911 * You may obtain a copy of the License at 10912 * 10913 * http://www.apache.org/licenses/LICENSE-2.0 10914 * 10915 * Unless required by applicable law or agreed to in writing, software 10916 * distributed under the License is distributed on an "AS IS" BASIS, 10917 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10918 * See the License for the specific language governing permissions and 10919 * limitations under the License. 10920 * ============================================================================= 10921 */const uK={kernelName:G1,backendName:"cpu",kernelFunc:({inputs:t,backend:e})=>{const{x:n}=t,r=e;_e(n,"square");const s=r.data.get(n.dataId).values,a=new Float32Array(s.length);for(let i=0;i<s.length;++i){const l=s[i];a[i]=l*l}return{dataId:r.write(a,n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}};/** 10922 * @license 10923 * Copyright 2020 Google LLC. All Rights Reserved. 10924 * Licensed under the Apache License, Version 2.0 (the License); 10925 * you may not use this file except in compliance with the License. 10926 * You may obtain a copy of the License at 10927 * 10928 * http://www.apache.org/licenses/LICENSE-2.0 10929 * 10930 * Unless required by applicable law or agreed to in writing, software 10931 * distributed under the License is distributed on an AS IS BASIS, 10932 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10933 * See the License for the specific language governing permissions and 10934 * limitations under the License. 10935 * ============================================================================= 10936 */const dK=mt(zc,(t,e)=>{const n=e;return isNaN(t)?NaN:t>0?1:n.alpha}),fK={kernelName:zc,backendName:"cpu",kernelFunc:dK};/** 10937 * @license 10938 * Copyright 2020 Google LLC. All Rights Reserved. 10939 * Licensed under the Apache License, Version 2.0 (the "License");
10940 * you may not use this file except in compliance with the License. 10941 * You may obtain a copy of the License at 10942 * 10943 * http://www.apache.org/licenses/LICENSE-2.0 10944 * 10945 * Unless required by applicable law or agreed to in writing, software 10946 * distributed under the License is distributed on an "AS IS" BASIS, 10947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10948 * See the License for the specific language governing permissions and 10949 * limitations under the License. 10950 * ============================================================================= 10951 */function pK(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{begin:a,end:o,strides:i,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:f}=r;_e(s,"stridedSlice");const{finalShapeSparse:p,finalShape:h,isIdentity:m,sliceDim0:g,isSimpleSlice:v,begin:b,end:w,strides:S}=T2(s.shape,a,o,i,l,u,c,d,f);let I;if(m)I=Dt({inputs:{x:s},backend:n,attrs:{shape:h}});else if(g||v){A(s.shape.length>=1,()=>"Input must have rank at least 1, got: ".concat(s.shape.length));const E=_2(b,w,S),T=Ka({inputs:{x:s},backend:n,attrs:{begin:b,size:E}});I=Dt({inputs:{x:T},backend:n,attrs:{shape:h}}),n.disposeIntermediateTensorInfo(T)}else{const E=n.bufferSync(s),T=L7(p,E,S,b);I=n.makeTensorInfo(h,T.dtype,T.values)}return I}const hK={kernelName:Ef,backendName:"cpu",kernelFunc:pK};/** 10952 * @license 10953 * Copyright 2021 Google LLC. All Rights Reserved. 10954 * Licensed under the Apache License, Version 2.0 (the "License"); 10955 * you may not use this file except in compliance with the License. 10956 * You may obtain a copy of the License at 10957 * 10958 * http://www.apache.org/licenses/LICENSE-2.0 10959 * 10960 * Unless required by applicable law or agreed to in writing, software 10961 * distributed under the License is distributed on an "AS IS" BASIS, 10962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10963 * See the License for the specific language governing permissions and 10964 * limitations under the License. 10965 * ============================================================================= 10966 */function mK(t){const{inputs:e,backend:n,attrs:r}=t,{separator:s,nGramWidths:a,leftPad:o,rightPad:i,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=e,f=n.data.get(c.dataId).values,p=n.data.get(d.dataId).values,[h,m]=bS(f,p,s,a,o,i,l,u);return[n.makeTensorInfo([h.length],"string",h),n.makeTensorInfo(d.shape,"int32",m)]}const gK={kernelName:ag,backendName:"cpu",kernelFunc:mK};/** 10967 * @license 10968 * Copyright 2021 Google LLC. All Rights Reserved. 10969 * Licensed under the Apache License, Version 2.0 (the "License"); 10970 * you may not use this file except in compliance with the License. 10971 * You may obtain a copy of the License at 10972 * 10973 * http://www.apache.org/licenses/LICENSE-2.0 10974 * 10975 * Unless required by applicable law or agreed to in writing, software 10976 * distributed under the License is distributed on an "AS IS" BASIS, 10977 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10978 * See the License for the specific language governing permissions and 10979 * limitations under the License. 10980 * ============================================================================= 10981 */function yK(t){const{inputs:e,backend:n,attrs:r}=t,{skipEmpty:s}=r,{input:a,delimiter:o}=e;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(a.shape.length!==1)throw new Error("Input must be a vector, got shape: ".concat(a.shape));if(o.shape.length!==0)throw new Error("Delimiter must be a scalar, got shape: ".concat(o.shape));const i=n.data.get(a.dataId).values,l=n.data.get(o.dataId).values[0],[u,c,d]=wS(i,l,s),f=c.length;return[n.makeTensorInfo([f,2],"int32",u),n.makeTensorInfo([f],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}const vK={kernelName:og,backendName:"cpu",kernelFunc:yK};/** 10982 * @license 10983 * Copyright 2021 Google LLC. All Rights Reserved. 10984 * Licensed under the Apache License, Version 2.0 (the "License"); 10985 * you may not use this file except in compliance with the License. 10986 * You may obtain a copy of the License at 10987 * 10988 * http://www.apache.org/licenses/LICENSE-2.0 10989 * 10990 * Unless required by applicable law or agreed to in writing, softw
10990are 10991 * distributed under the License is distributed on an "AS IS" BASIS, 10992 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10993 * See the License for the specific language governing permissions and 10994 * limitations under the License. 10995 * ============================================================================= 10996 */function bK(t){const{inputs:e,backend:n,attrs:r}=t,{numBuckets:s}=r,{input:a}=e;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(s<=0)throw new Error("Number of buckets must be at least 1");const o=n.data.get(a.dataId).values,i=SS(o,s);return n.makeTensorInfo(a.shape,"int32",i)}const wK={kernelName:ig,backendName:"cpu",kernelFunc:bK};/** 10997 * @license 10998 * Copyright 2020 Google LLC. All Rights Reserved. 10999 * Licensed under the Apache License, Version 2.0 (the License); 11000 * you may not use this file except in compliance with the License. 11001 * You may obtain a copy of the License at 11002 * 11003 * http://www.apache.org/licenses/LICENSE-2.0 11004 * 11005 * Unless required by applicable law or agreed to in writing, software 11006 * distributed under the License is distributed on an AS IS BASIS, 11007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11008 * See the License for the specific language governing permissions and 11009 * limitations under the License. 11010 * ============================================================================= 11011 */const SK=mt(Cf,t=>Math.tan(t)),xK={kernelName:Cf,backendName:"cpu",kernelFunc:SK};/** 11012 * @license 11013 * Copyright 2020 Google LLC. All Rights Reserved. 11014 * Licensed under the Apache License, Version 2.0 (the License); 11015 * you may not use this file except in compliance with the License. 11016 * You may obtain a copy of the License at 11017 * 11018 * http://www.apache.org/licenses/LICENSE-2.0 11019 * 11020 * Unless required by applicable law or agreed to in writing, software 11021 * distributed under the License is distributed on an AS IS BASIS, 11022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11023 * See the License for the specific language governing permissions and 11024 * limitations under the License. 11025 * ============================================================================= 11026 */const _K=mt(Nf,t=>Math.tanh(t)),IK={kernelName:Nf,backendName:"cpu",kernelFunc:_K};/** 11027 * @license 11028 * Copyright 2022 Google LLC. All Rights Reserved. 11029 * Licensed under the Apache License, Version 2.0 (the "License"); 11030 * you may not use this file except in compliance with the License. 11031 * You may obtain a copy of the License at 11032 * 11033 * http://www.apache.org/licenses/LICENSE-2.0 11034 * 11035 * Unless required by applicable law or agreed to in writing, software 11036 * distributed under the License is distributed on an "AS IS" BASIS, 11037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11038 * See the License for the specific language governing permissions and 11039 * limitations under the License. 11040 * ============================================================================= 11041 */function kK(t){const{inputs:e,backend:n}=t,{tensor:r,indices:s,updates:a}=e,{sliceRank:o,numUpdates:i,sliceSize:l,strides:u,outputSize:c}=di(a,s,r.shape),d=!1,f=n.bufferSync(s),p=n.bufferSync(a),h=n.bufferSync(r),m=Fo(f,p,r.shape,c,l,i,o,u,h,d);return n.makeTensorInfo(r.shape,m.dtype,m.values)}const EK={kernelName:ff,backendName:"cpu",kernelFunc:kK};/** 11042 * @license 11043 * Copyright 2020 Google LLC. All Rights Reserved. 11044 * Licensed under the Apache License, Version 2.0 (the "License"); 11045 * you may not use this file except in compliance with the License. 11046 * You may obtain a copy of the License at 11047 * 11048 * http://www.apache.org/licenses/LICENSE-2.0 11049 * 11050 * Unless required by applicable law or agreed to in writing, software 11051 * distributed under the License is distributed on an "AS IS" BASIS, 11052 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11053 * See the License for the specific language governing permissions and 11054 * limitations under the License. 11055 * ============================================================================= 11056 */function TK(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{reps:a}=r;_e(s,"tile");const o=j7(n.bufferSync(s),a);return n.makeTensorInfo(o.shape,o.dtype,o.values)}const CK={kernelName:Wc,backendName:"cpu",kernelFunc:TK};/** 11057 * @license 11058 * Copyright 2020 Google LLC. All Rights Reserved. 11059 * Licensed under the Apache License, Version 2.0 (the "License");
11060 * you may not use this file except in compliance with the License. 11061 * You may obtain a copy of the License at 11062 * 11063 * http://www.apache.org/licenses/LICENSE-2.0 11064 * 11065 * Unless required by applicable law or agreed to in writing, software 11066 * distributed under the License is distributed on an "AS IS" BASIS, 11067 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11068 * See the License for the specific language governing permissions and 11069 * limitations under the License. 11070 * ============================================================================= 11071 */function NK(t){const{inputs:e,backend:n,attrs:r}=t,{x:s}=e,{k:a,sorted:o}=r;_e(s,"topk");const i=n.data.get(s.dataId).values,[l,u]=G7(i,s.shape,s.dtype,a,o);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}const AK={kernelName:Af,backendName:"cpu",kernelFunc:NK};/** 11072 * @license 11073 * Copyright 2021 Google LLC. All Rights Reserved. 11074 * Licensed under the Apache License, Version 2.0 (the "License"); 11075 * you may not use this file except in compliance with the License. 11076 * You may obtain a copy of the License at 11077 * 11078 * http://www.apache.org/licenses/LICENSE-2.0 11079 * 11080 * Unless required by applicable law or agreed to in writing, software 11081 * distributed under the License is distributed on an "AS IS" BASIS, 11082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11083 * See the License for the specific language governing permissions and 11084 * limitations under the License. 11085 * ============================================================================= 11086 */function $K(t){const{inputs:e,attrs:n,backend:r}=t,{image:s,transforms:a}=e,{interpolation:o,fillMode:i,fillValue:l,outputShape:u}=n,[c,d,f,p]=s.shape,[h,m]=u!=null?u:[d,f],g=[c,h,m,p],v=Ie(s.shape),b=v[0],w=v[1],S=v[2],I=Ie(g),E=I[0],T=I[1],D=I[2],R=$n(s.dtype,J(g));R.fill(l);const $=r.data.get(s.dataId).values,M=r.data.get(a.dataId).values;for(let z=0;z<c;++z){const H=a.shape[0]===1?M:M.subarray(z*8,z*8+8);for(let V=0;V<h;++V)for(let X=0;X<m;++X)for(let Q=0;Q<p;++Q){let K;const ee=H[6]*X+H[7]*V+1;if(ee===0)continue;const ae=(H[0]*X+H[1]*V+H[2])/ee,ne=(H[3]*X+H[4]*V+H[5])/ee,ce=tb(ae,f,i),se=tb(ne,d,i);switch(o){case"nearest":K=PK($,d,f,b,w,S,z,se,ce,Q,l);break;case"bilinear":K=BK($,d,f,b,w,S,z,se,ce,Q,l);break;default:throw new Error("Error in Transform: Expect 'nearest' or "+"'bilinear', but got ".concat(o))}const oe=z*E+V*T+X*D+Q;R[oe]=K}return r.makeTensorInfo(g,s.dtype,R)}return{dataId:r.write(R,g,s.dtype),shape:s.shape,dtype:s.dtype}}const RK={kernelName:$f,backendName:"cpu",kernelFunc:$K};function tb(t,e,n){switch(n){case"reflect":return DK(t,e);case"wrap":return FK(t,e);case"nearest":return OK(t,e);case"constant":default:return MK(t)}}function DK(t,e){let n=t;if(n<0)if(e<=1)n=0;else{const r=2*e;n<r&&(n=r*Math.trunc(-n/r)+n),n=n<-e?n+r:-n-1}else if(n>e-1)if(e<=1)n=0;else{const r=2*e;n-=r*Math.trunc(n/r),n>=e&&(n=r-n-1)}return Im(0,n,e-1)}function FK(t,e){let n=t;if(n<0)if(e<=1)n=0;else{const r=e-1;n+=e*(Math.trunc(-n/r)+1)}else if(n>e-1)if(e<=1)n=0;else{const r=e-1;n-=e*Math.trunc(n/r)}return Im(0,n,e-1)}function MK(t,e){return t}function OK(t,e){return Im(0,t,e-1)}function Gi(t,e,n,r,s,a,o,i,l,u,c){const d=o*r+i*s+l*a+u;return 0<=i&&i<e&&0<=l&&l<n?t[d]:c}function PK(t,e,n,r,s,a,o,i,l,u,c){const d=Math.round(i),f=Math.round(l);return Gi(t,e,n,r,s,a,o,d,f,u,c)}function BK(t,e,n,r,s,a,o,i,l,u,c){const d=Math.floor(i),f=Math.floor(l),p=d+1,h=f+1,m=(h-l)*Gi(t,e,n,r,s,a,o,d,f,u,c)+(l-f)*Gi(t,e,n,r,s,a,o,d,h,u,c),g=(h-l)*Gi(t,e,n,r,s,a,o,p,f,u,c)+(l-f)*Gi(t,e,n,r,s,a,o,p,h,u,c);return(p-i)*m+(i-d)*g}/** 11087 * @license 11088 * Copyright 2020 Google LLC. All Rights Reserved. 11089 * Licensed under the Apache License, Version 2.0 (the License); 11090 * you may not use this file except in compliance with the License. 11091 * You may obtain a copy of the License at 11092 * 11093 * http://www.apache.org/licenses/LICENSE-2.0 11094 * 11095 * Unless required by applicable law or agreed to in writing, software 11096 * distributed under the License is distributed on an AS IS BASIS, 11097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11098 * See the License for the specific language governing permissions and 11099 * limitations under the License. 11100 * ============================================================================= 11101 */function LK(t){const{inputs:e,attrs:n,backend:r}=t,{axis:s}=n,{x:a}=e;_e(a,"unique");const o=r.data.get(a.dataId).values,{outputValues:i,outputShape:l,indices:u}=_S(o,s,a.shape,a.dtype);
11101return[r.makeTensorInfo(l,a.dtype,i),r.makeTensorInfo([u.length],"int32",u)]}const WK={kernelName:cg,backendName:"cpu",kernelFunc:LK};/** 11102 * @license 11103 * Copyright 2020 Google LLC. All Rights Reserved. 11104 * Licensed under the Apache License, Version 2.0 (the "License"); 11105 * you may not use this file except in compliance with the License. 11106 * You may obtain a copy of the License at 11107 * 11108 * http://www.apache.org/licenses/LICENSE-2.0 11109 * 11110 * Unless required by applicable law or agreed to in writing, software 11111 * distributed under the License is distributed on an "AS IS" BASIS, 11112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11113 * See the License for the specific language governing permissions and 11114 * limitations under the License. 11115 * ============================================================================= 11116 */function zK(t){const{inputs:e,backend:n,attrs:r}=t,{value:s}=e;let{axis:a}=r;a<0&&(a+=s.shape.length);const o=s.shape.length,i=s.shape[a],l=new Array(o-1);let u=0;for(let p=0;p<o;p++)p!==a&&(l[u++]=s.shape[p]);const c=new Array(o).fill(0),d=s.shape.slice();d[a]=1;const f=new Array(i);for(let p=0;p<f.length;p++){c[a]=p;const h=Ka({inputs:{x:s},backend:n,attrs:{begin:c,size:d}});f[p]=Dt({inputs:{x:h},backend:n,attrs:{shape:l}}),n.disposeIntermediateTensorInfo(h)}return f}const HK={kernelName:lg,backendName:"cpu",kernelFunc:zK};/** 11117 * @license 11118 * Copyright 2020 Google LLC. All Rights Reserved. 11119 * Licensed under the Apache License, Version 2.0 (the "License"); 11120 * you may not use this file except in compliance with the License. 11121 * You may obtain a copy of the License at 11122 * 11123 * http://www.apache.org/licenses/LICENSE-2.0 11124 * 11125 * Unless required by applicable law or agreed to in writing, software 11126 * distributed under the License is distributed on an "AS IS" BASIS, 11127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11128 * See the License for the specific language governing permissions and 11129 * limitations under the License. 11130 * ============================================================================= 11131 */function UK(t){const{inputs:e,backend:n,attrs:r}=t,{x:s,segmentIds:a}=e,{numSegments:o}=r;_e(s,"unsortedSegmentSum");const i=s.shape.length,l=a.shape.length,u=[],c=[],d=i-l;let f=a;for(let h=0;h<d;++h){const m=bu({inputs:{input:f},backend:n,attrs:{dim:h+1}});f=m,c.push(m)}for(let h=0;h<o;++h){const m=fg(h,"int32"),g=n.makeTensorInfo([],"int32",m),v=fS({inputs:{a:g,b:f},backend:n}),b=na({inputs:{x:v},backend:n,attrs:{dtype:"float32"}}),w=qf({inputs:{a:b,b:s},backend:n}),S=jc({inputs:{x:w},backend:n,attrs:{axis:0,keepDims:!1}});u.push(S),c.push(g),c.push(v),c.push(b),c.push(w),c.push(S)}const p=u_({inputs:u,backend:n,attrs:{axis:0}});return c.forEach(h=>n.disposeIntermediateTensorInfo(h)),p}const VK={kernelName:q1,backendName:"cpu",kernelFunc:UK};/** 11132 * @license 11133 * Copyright 2020 Google LLC. All Rights Reserved. 11134 * Licensed under the Apache License, Version 2.0 (the "License"); 11135 * you may not use this file except in compliance with the License. 11136 * You may obtain a copy of the License at 11137 * 11138 * http://www.apache.org/licenses/LICENSE-2.0 11139 * 11140 * Unless required by applicable law or agreed to in writing, software 11141 * distributed under the License is distributed on an "AS IS" BASIS, 11142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11143 * See the License for the specific language governing permissions and 11144 * limitations under the License. 11145 * ============================================================================= 11146 */const jK=[LU,rB,zU,UU,dB,jU,qU,XU,JU,ZU,tV,rV,aV,cV,uV,pV,mV,yV,bV,PU,SV,_V,kV,mB,TV,cB,vB,NV,sB,$V,DV,FV,OV,BV,WV,HV,VV,GV,KV,YV,QV,ej,nj,sj,aj,ij,lj,dj,fj,pj,hj,gj,bj,AU,Sj,wB,Nj,xB,Aj,kB,Oj,Pj,Lj,CB,$B,zj,Uj,jj,qj,OB,LB,aB,Xj,RV,Jj,Zj,tG,$U,HB,jB,rG,XB,aG,cG,uG,pG,mG,yG,vG,ZB,wG,xG,IG,EG,CG,AG,RG,n7,FG,PG,WG,s7,i7,UG,GG,XG,u7,JG,ZG,eq,d_,sq,DU,h7,oq,cq,uq,fq,oB,Kh,hq,FU,MU,OU,gq,vq,wq,xq,Iq,kq,Tq,E7,Nq,Fq,Oq,Wq,T7,Hq,Vq,Gq,C7,BG,Xq,Jq,Zq,tK,rK,aK,iK,lK,R7,uK,M7,B7,fK,hK,gK,vK,wK,V7,yj,xK,IK,EK,CK,AK,RK,d7,WK,HK,VK,QG];for(const t of jK)K1(t);function GK(){try{return!!window.WebAssembly&&(!!window.WebAssembly.compile||!!window.WebAssembly.compileStreaming)}catch(t){return!1}}class qK{constructor(){this._modelLoadTriggered=!1}triggerModelLoading(){if(this._modelLoadTriggered)return;this._modelLoadTriggered=!0;let e;this.modelLoadingPromise=Promise.race([this.loadModels().finally(()=>{clearTimeout(e)}),new Promise((n,r)=>{e=setTimeout(()=>r(new Error("Face detection model loading timed out. Check your network connection and try again.")),g1)})])}}const KK="1.0.2",XK="https://cdn.liveness.rekognition.amazonaws.com/face-detection/tensorflow-models/blazeface/".concat(KK,"/model/model.json"),YK="https://cdn.liveness.rekognition.amazonaws.com/face-detection/tensorflow/tfjs-backend-wasm/".concat(TU,"/");class JK extends qK{constructor(e,n){super(),this.faceModelUrl=n!=null?n:XK,this.binaryPath=e!=null?e:YK}async loadModels(){GK()?await this._loadWebAssemblyBackend():await this._loadCPUBackend();try{await iA(),this._model=await uP(mu.MediaPipeFaceDetector,{runtime:"tfjs",detectorModelUrl:this.faceModelUrl})}catch(e){throw new Error("There was an error loading the blazeface model. If you are using a custom blazeface model url ensure that it is a fully qualified url that returns a json file.")}}async detectFaces(e){const r=await this._model.estimateFaces(e,{flipHorizontal:!0}),s=Date.now();return r.map(o=>{const{box:i,keypoints:l}=o,{xMin:u,yMin:c,width:d,height:f}=i,p=this._getCoordinate(l,"rightEye"),h=this._getCoordinate(l,"leftEye"),m=this._getCoordinate(l,"noseTip"),g=this._getCoordinate(l,"mouthCenter"),v=this._getCoordinate(l,"rightEarTragion"),b=this._getCoordinate(l,"leftEarTragion");return{top:c,left:u,width:d,height:f,timestampMs:s,probability:[90][0],rightEye:p,leftEye:h,mouth:g,nose:m,rightEar:v,leftEar:b}})}_getCoordinate(e,n){const r=e.find(s=>
11146s.name===n);return[r.x,r.y]}async _loadWebAssemblyBackend(){try{kU(this.binaryPath),await UE(async()=>{if(!await kv("wasm"))throw new Error("Initialization of backend wasm failed")},[]),this.modelBackend="wasm"}catch(e){throw new Error('There was an error loading the TFJS WASM backend. If you are using a custom WASM path ensure that it ends with "/" and that it is not the full URL as @tensorflow/tfjs-backend-wasm will append the wasm binary file name. Read more: https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/src/backend_wasm.ts#L475.')}}async _loadCPUBackend(){await kv("cpu"),this.modelBackend="cpu"}}function QK({face:t,ovalDetails:e,initialFaceIntersection:n,parsedSessionInformation:r,frameHeight:s}){let a;const o=r.Challenge.ChallengeConfig;if(!o||!o.OvalIouThreshold||!o.OvalIouHeightThreshold||!o.OvalIouWidthThreshold||!o.FaceIouHeightThreshold||!o.FaceIouWidthThreshold)throw new Error("Challenge information not returned from session information.");const{OvalIouThreshold:i,FaceIouHeightThreshold:l,FaceIouWidthThreshold:u,OvalHeightWidthRatio:c}=o,d=fh({ovalHeightWidthRatio:c,face:t,oval:e,frameHeight:s}),f=d.left,p=d.right,h=d.top,m=d.bottom,{ovalBoundingBox:g,minOvalX:v,minOvalY:b,maxOvalX:w,maxOvalY:S}=y1(e),I=v1(d,g),E=i,T=e.width*u,D=e.height*l,R=Math.max(Math.min(yC,bC*(I-n)/(E-n)+vC),gC)*100,$=v>f&&w>p,M=f>v&&p>w,B=I>E,z=b-h>D||m-S>D||v-f>T&&p-w>T;return B?a=dt.MATCHED:$||M?a=dt.OFF_CENTER:z?a=dt.MATCHED:a=dt.TOO_FAR,{faceMatchState:a,faceMatchPercentage:R}}function Es(t){return t!=null&&!Array.isArray(t)&&typeof t=="object"}function Ya(t){return typeof t=="string"||typeof t=="object"&&Object.prototype.toString.call(t)==="[object String]"}function nc(t){return t===void 0}function ra(t,e){return t!=null&&Object.prototype.hasOwnProperty.call(t,e)}function js(t){return typeof t=="function"}const rs=(t,e)=>e?"".concat(t,"--").concat(e):"",Wa=(t,e,n)=>n?"".concat(t,"--").concat(e):"";function ZK(t,e){const n={},r={};return Object.entries(t).forEach(([s,a])=>{e(s)?n[s]=a:r[s]=a}),[n,r]}function eX(t,e){for(var n=-1,r=t==null?0:t.length,s=Array(r);++n<r;)s[n]=e(t[n],n,t);return s}var tX=eX,nX=typeof cr=="object"&&cr&&cr.Object===Object&&cr,rX=nX,sX=rX,aX=typeof self=="object"&&self&&self.Object===Object&&self,oX=sX||aX||Function("return this")(),iX=oX,cX=iX,lX=cX.Symbol,Ug=lX,nb=Ug,f_=Object.prototype,uX=f_.hasOwnProperty,dX=f_.toString,Ri=nb?nb.toStringTag:void 0;function fX(t){var e=uX.call(t,Ri),n=t[Ri];try{t[Ri]=void 0;var r=!0}catch(a){}var s=dX.call(t);return r&&(e?t[Ri]=n:delete t[Ri]),s}var pX=fX,hX=Object.prototype,mX=hX.toString;
11146function gX(t){return mX.call(t)}var yX=gX,rb=Ug,vX=pX,bX=yX,wX="[object Null]",SX="[object Undefined]",sb=rb?rb.toStringTag:void 0;function xX(t){return t==null?t===void 0?SX:wX:sb&&sb in Object(t)?vX(t):bX(t)}var _X=xX,IX=Array.isArray,kX=IX;function EX(t){return t!=null&&typeof t=="object"}var TX=EX,CX=_X,NX=TX,AX="[object Symbol]";function $X(t){return typeof t=="symbol"||NX(t)&&CX(t)==AX}var RX=$X,ab=Ug,DX=tX,FX=kX,MX=RX,OX=1/0,ob=ab?ab.prototype:void 0,ib=ob?ob.toString:void 0;function p_(t){if(typeof t=="string")return t;if(FX(t))return DX(t,p_)+"";if(MX(t))return ib?ib.call(t):"";var e=t+"";return e=="0"&&1/t==-OX?"-0":e}var PX=p_,BX=PX;function LX(t){return t==null?"":BX(t)}var h_=LX;const m_={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}},g_={red:{10:{value:"hsl(0, 75%, 95%)"},20:{value:"hsl(0, 75%, 85%)"},40:{value:"hsl(0, 75%, 75%)"},60:{value:"hsl(0, 50%, 50%)"},80:{value:"hsl(0, 95%, 30%)"},90:{value:"hsl(0, 100%, 20%)"},100:{value:"hsl(0, 100%, 15%)"}},orange:{10:{value:"hsl(30, 75%, 95%)"},20:{value:"hsl(30, 75%, 85%)"},40:{value:"hsl(30, 75%, 75%)"},60:{value:"hsl(30, 50%, 50%)"},80:{value:"hsl(30, 95%, 30%)"},90:{value:"hsl(30, 100%, 20%)"},100:{value:"hsl(30, 100%, 15%)"}},yellow:{10:{value:"hsl(60, 75%, 95%)"},20:{value:"hsl(60, 75%, 85%)"},40:{value:"hsl(60, 75%, 75%)"},60:{value:"hsl(60, 50%, 50%)"},80:{value:"hsl(60, 95%, 30%)"},90:{value:"hsl(60, 100%, 20%)"},100:{value:"hsl(60, 100%, 15%)"}},green:{10:{value:"hsl(130, 60%, 95%)"},20:{value:"hsl(130, 60%, 90%)"},40:{value:"hsl(130, 44%, 63%)"},60:{value:"hsl(130, 43%, 46%)"},80:{value:"hsl(130, 33%, 37%)"},90:{value:"hsl(130, 27%, 29%)"},100:{value:"hsl(130, 22%, 23%)"}},teal:{10:{value:"hsl(190, 75%, 95%)"},20:{value:"hsl(190, 75%, 85%)"},40:{value:"hsl(190, 70%, 70%)"},60:{value:"hsl(190, 50%, 50%)"},80:{value:"hsl(190, 95%, 30%)"},90:{value:"hsl(190, 100%, 20%)"},100:{value:"hsl(190, 100%, 15%)"}},blue:{10:{value:"hsl(220, 95%, 95%)"},20:{value:"hsl(220, 85%, 85%)"},40:{value:"hsl(220, 70%, 70%)"},60:{value:"hsl(220, 50%, 50%)"},80:{value:"hsl(220, 95%, 30%)"},90:{value:"hsl(220, 100%, 20%)"},100:{value:"hsl(220, 100%, 15%)"}},purple:{10:{value:"hsl(300, 95%, 95%)"},20:{value:"hsl(300, 85%, 85%)"},40:{value:"hsl(300, 70%, 70%)"},60:{value:"hsl(300, 50%, 50%)"},80:{value:"hsl(300, 95%, 30%)"},90:{value:"hsl(300, 100%, 20%)"},100:{value:"hsl(300, 100%, 15%)"}},pink:{10:{value:"hsl(340, 95%, 95%)"},20:{value:"hsl(340, 90%, 85%)"},40:{value:"hsl(340, 70%, 70%)"},60:{value:"hsl(340, 50%, 50%)"},80:{value:"hsl(340, 95%, 30%)"},90:{value:"hsl(340, 100%, 20%)"},100:{value:"hsl(340, 100%, 15%)"}},neutral:{10:{value:"hsl(210, 5%, 98%)"},20:{value:"hsl(210, 5%, 94%)"},40:{value:"hsl(210, 5%, 87%)"},60:{value:"hsl(210, 10%, 58%)"},80:{value:"hsl(210, 10%, 40%)"},90:{value:"hsl(210, 25%, 25%)"},100:{value:"hsl(210, 50%, 10%)"}},primary:{10:{value:"{colors.teal.10.value}"},20:{value:"{colors.teal.20.value}"},40:{value:"{colors.teal.40.value}"},60:{value:"{colors.teal.60.value}"},80:{value:"{colors.teal.80.value}"},90:{value:"{colors.teal.90.value}"},100:{value:"{colors.teal.100.value}"}},secondary:{10:{value:"{colors.purple.10.value}"},20:{value:"{colors.purple.20.value}"},40:{value:"{colors.purple.40.value}"},60:{value:"{colors.purple.60.value}"},80:{value:"{colors.purple.80.value}"},90:{value:"{colors.purple.90.value}"},100:{value:"{colors.purple.100.value}"}},font:{primary:{value:"{colors.neutral.100.value}"},secondary:{value:"{colors.neutral.90.value}"},tertiary:{value:"{colors.neutral.80.value}"},disabled:{value:"{colors.neutral.60.value}"},inverse:{value:"{colors.white.value}"},interactive:{value:"{colors.primary.80.value}"},hover:{value:"{colors.primary.90.value}"},focus:{value:"{colors.primary.100.value}"},active:{value:"{colors.primary.100.value}"},info:{value:"{colors.blue.90.value}"},warning:{value:"{colors.orange.90.value}"},error:{value:"{colors.red.90.value}"},success:{value:"{colors.green.90.value}"}},background:{primary:{value:"{colors.white.value}"},secondary:{value:"{colors.neutral.10.value}"},tertiary:{value:"{colors.neutral.20.value}"},quaternary:{value:"{colors.neutral.60.value}"},disabled:{value:"{colors.background.tertiary.value}"},info:{value:"{colors.blue.10.value}"},warning:{value:"{colors.orange.10.value}"},error:{value:"{colors.red.10.value}"},success:{value:"{colors.green.10.value}"}},border:{primary:{value:"{colors.neutral.60.value}"},secondary:{value:"{colors.neutral.40.value}"},tertiary:{value:"{colors.neutral.20.value}"},disabled:{value:"{colors.border.tertiary.value}"},pressed:{value:"{colors.primary.100.value}"},focus:{value:"{colors.primary.100.value}"},error:{value:"{colors.red.80.value}"},info:{value:"{colors.blue.80.value}"},success:{value:"{colors.green.80.value}"},warning:{value:"{colors.orange.80.value}"}},shadow:{primary:{value:"hsla(210, 50%, 10%, 0.25)"},secondary:{value:"hsla(210, 50%, 10%, 0.15)"},tertiary:{value:"hsla(210, 50%, 10%, 0.05)"}},overlay:{5:{value:"hsla(0, 0%, 0%, 0.05)"},10:{value:"hsla(0, 0%, 0%, 0.1)"},20:{value:"hsla(0, 0%, 0%, 0.2)"},30:{value:"hsla(0, 0%, 0%, 0.3)"},40:{value:"hsla(0, 0%, 0%, 0.4)"},50:{value:"hsla(0, 0%, 0%, 0.5)"}
11146,60:{value:"hsla(0, 0%, 0%, 0.6)"},70:{value:"hsla(0, 0%, 0%, 0.7)"},80:{value:"hsla(0, 0%, 0%, 0.8)"},90:{value:"hsla(0, 0%, 0%, 0.9)"}},black:{value:"hsl(0, 0%, 0%)"},white:{value:"hsl(0, 0%, 100%)"},transparent:{value:"transparent"}},WX={alignItems:{value:"center"},justifyContent:{value:"space-between"},color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.tertiary.value}"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.medium.value}"},icon:{size:{value:"{fontSizes.xl.value}"}},heading:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"}}},zX={message:{backgroundColor:{value:"{colors.background.secondary.value}"},borderRadius:{value:"{radii.large.value}"},gap:{value:"{space.small.value}"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.small.value}"},user:{backgroundColor:{value:"{colors.background.secondary.value}"}},assistant:{backgroundColor:{value:"{colors.primary.10.value}"}},sender:{gap:{value:"{space.small.value}"},username:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"inherit"},fontWeight:{value:"{fontWeights.bold.value}"}},timestamp:{color:{value:"{colors.font.tertiary.value}"},fontSize:{value:"inherit"},fontWeight:{value:"inherit"}}},body:{gap:{value:"{space.xs.value}"}},actions:{gap:{value:"{space.xs.value}"}}},form:{gap:{value:"{space.small.value}"},padding:{value:"{space.small.value}"}},attachment:{borderColor:{value:"{colors.border.secondary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.small.value}"},fontSize:{value:"{fontSizes.small.value}"},paddingBlock:{value:"{space.xxxs.value}"},paddingInline:{value:"{space.xs.value}"},gap:{value:"{space.xs.value}"},list:{padding:{value:"{space.xs.value}"},paddingBlockStart:{value:"0"},gap:{value:"{space.xxs.value}"}},name:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"{fontSizes.small.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},size:{color:{value:"{colors.font.tertiary.value}"},fontSize:{value:"{fontSizes.small.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},remove:{padding:{value:"{space.xxs.value}"}},image:{width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"}}}},HX={menu:{width:{value:"100%"},marginBlockStart:{value:"{space.xxxs}"},backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderWidth:{value:"{borderWidths.small}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.small}"},options:{display:{value:"flex"},flexDirection:{value:"column"},maxHeight:{value:"300px"}},option:{backgroundColor:{value:"{colors.background.primary}"},color:{value:"currentcolor"},cursor:{value:"pointer"},transitionDuration:{value:"{time.short}"},transitionProperty:{value:"background-color, color"},transitionTimingFunction:{value:"ease"},_active:{backgroundColor:{value:"{colors.primary.80}"},color:{value:"{colors.white}"}}},_empty:{display:{value:"flex"}},_loading:{alignItems:{value:"center"},display:{value:"flex"},gap:{value:"{space.xxxs}"}},spaceShared:{paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"}}}},UX={maxWidth:{value:"60rem"},modal:{width:{value:"{space.relative.full}"},height:{value:"{space.relative.full}"},backgroundColor:{value:"{colors.overlay.50.value}"},top:{value:"{space.zero}"},left:{value:"{space.zero}"}},container:{widthMax:{value:"30rem"}},router:{borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},boxShadow:{value:"{shadows.medium.value}"}},footer:{paddingBottom:{value:"{space.medium.value}"}},form:{padding:{value:"{space.xl.value}"}},state:{inactive:{backgroundColor:{value:"{colors.background.secondary.value}"}}},orContainer:{color:{value:"{colors.neutral.80.value}"},orLine:{backgroundColor:{value:"{colors.background.primary.value}"}}}},VX={color:{value:"{colors.font.tertiary.value}"},lineHeight:{value:1},fontWeight:{value:"{fontWeights.semibold.value}"},fontSize:{value:"{fontSizes.small.value}"},textAlign:{value:"center"},width:{value:"{fontSizes.xxl.value}"},height:{value:"{fontSizes.xxl.value}"},backgroundColor:{value:"{colors.background.tertiary}"},borderRadius:{value:"100%"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.medium.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"},borderColor:{value:"{colors.border.info.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"},borderColor:{value:"{colors.border.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"},borderColor:{value:"{colors.border.success.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"},borderColor:{value:"{colors.border.error.value}"}},small:{fontSize:{value:"{fontSizes.xs.value}"},width:{value:"{fontSizes.xl.value}"},height:{value:"{fontSizes.xl.value}"}},large:{fontSize:{value:"{fontSizes.medium.value}"},width:{value:"{fontSizes.xxxl.value}"},height:{value:"{fontSizes.xxxl.value}"}}},jX={color:{value:"{colors.font.primary.value}"},lineHeight:{value:1},fontWeight:{value:"{fontWeights.semibold.value}"},fontSize:{value:"{fontSizes.small.value}"},textAlign:{value:"center"},paddingVertical:{value:"{space.xs.value}"},paddingHorizontal:{value:"{space.small.value}"},backgroundColor:{value:"{colors.background.tertiary.value}"},borderRadius:{value:"{radii.xl.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"}},small:{fontSize:{value:"{fontSizes.xs.value}"},paddingVertical:{value:"{space.xxs.value}"},paddingHorizontal:{value:"{space.xs.value}"}},large:{fontSize:{value:"{fontSizes.medium.value}"},paddingVertical:{value:"{space.small.value}"},paddingHorizontal:{value:"{space.medium.value}"}}},GX={flexDirection:{value:"row"},flexWrap:{value:"wrap"}
11146,gap:{value:"0"},color:{value:"{colors.font.tertiary}"},item:{flexDirection:{value:"row"},color:{value:"inherit"},fontSize:{value:"inherit"},alignItems:{value:"center"},lineHeight:{value:"1"}},separator:{color:{value:"inherit"},fontSize:{value:"inherit"},paddingInline:{value:"{space.xxs}"}},link:{color:{value:"{components.link.color}"},fontSize:{value:"inherit"},fontWeight:{value:"normal"},textDecoration:{value:"none"},paddingInline:{value:"{space.xs}"},paddingBlock:{value:"{space.xxs}"},current:{color:{value:"inherit"},fontSize:{value:"inherit"},fontWeight:{value:"normal"},textDecoration:{value:"none"}}}},qX={fontWeight:{value:"{fontWeights.bold.value}"},transitionDuration:{value:"{components.fieldcontrol.transitionDuration.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},lineHeight:{value:"{components.fieldcontrol.lineHeight.value}"},paddingBlockStart:{value:"{components.fieldcontrol.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.paddingInlineEnd.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},borderWidth:{value:"{components.fieldcontrol.borderWidth.value}"},borderStyle:{value:"{components.fieldcontrol.borderStyle.value}"},borderRadius:{value:"{components.fieldcontrol.borderRadius.value}"},color:{value:"{colors.font.primary.value}"},_hover:{color:{value:"{colors.font.focus.value}"},backgroundColor:{value:"{colors.primary.10.value}"},borderColor:{value:"{colors.primary.60.value}"}},_focus:{color:{value:"{colors.font.focus.value}"},backgroundColor:{value:"{colors.primary.10.value}"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{color:{value:"{colors.font.active.value}"},backgroundColor:{value:"{colors.primary.20.value}"},borderColor:{value:"{colors.primary.100.value}"}},_loading:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"}},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"}},outlined:{info:{borderColor:{value:"{colors.blue.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.blue.100}"},_hover:{borderColor:{value:"{colors.blue.60.value}"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"}},_focus:{borderColor:{value:"{colors.blue.100.value}"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.blue.100.value}"},backgroundColor:{value:"{colors.blue.20.value}"},color:{value:"{colors.blue.100.value}"}}},warning:{borderColor:{value:"{colors.orange.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.orange.100}"},_hover:{borderColor:{value:"{colors.orange.60.value}"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"}},_focus:{borderColor:{value:"{colors.orange.100.value}"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"},boxShadow:{value:"{components.fieldcontrol.warning._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.orange.100.value}"},backgroundColor:{value:"{colors.orange.20.value}"},color:{value:"{colors.orange.100.value}"}}},success:{borderColor:{value:"{colors.green.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.green.100}"},_hover:{borderColor:{value:"{colors.green.60.value}"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"}},_focus:{borderColor:{value:"{colors.green.100.value}"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.green.100.value}"},backgroundColor:{value:"{colors.green.20.value}"},color:{value:"{colors.green.100.value}"}}},error:{borderColor:{value:"{colors.red.80.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.red.100}"},_hover:{borderColor:{value:"{colors.red.80.value}"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"}},_focus:{borderColor:{value:"{colors.red.100.value}"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.red.100.value}"},backgroundColor:{value:"{colors.red.20.value}"},color:{value:"{colors.red.100.value}"}}},overlay:{borderColor:{value:"{colors.overlay.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.primary.value}"},_hover:{borderColor:{value:"{colors.overlay.60.value}"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.neutral.90.value}"}},_focus:{borderColor:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.neutral.90.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.neutral.100.value}"}}}},primary:{borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},backgroundColor:{value:"{colors.primary.80.value}"},color:{value:"{colors.font.inverse.value}"},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.100.value}"},color:{value:"{colors.font.inverse.value}"}},info:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.100.value}"},color:{value:"{colors.font.inverse.value}"}}},warning:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.100.value}"},color:{value:"{colors.font.inverse.value}"}}},error:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.100.value}"},color:{value:"{colors.font.inverse.value}"}}},success:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.100.value}"},color:{value:"{colors.font.inverse.value}"}}},overlay:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.70}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"}}}},menu:{borderWidth:{value:"{space.zero.value}"},backgroundColor:{value:"transparent"},justifyContent:{value:"start"},_hover:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.80.value}"}},_focus:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.80.value}"}},_active:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.90.value}"}},_disabled:{color:{value:"{colors.font.disabled.value}"}}},link:{backgroundColor:{value:"transparent"},borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.interactive.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.10.value}"},color:{value:"{colors.font.hover.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.10.value}"},color:{value:"{colors.font.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.20.value}"},color:{value:"{colors.font.active.value}"}},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled.value}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled.value}"}},info:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.blue.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.20.value}"},color:{value:"{colors.blue.100.value}"}}},warning:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.orange.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"},boxShadow:{value:"{components.fieldcontrol.warning._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.20.value}"},color:{value:"{colors.orange.100.value}"}}},success:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.green.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.20.value}"},color:{value:"{colors.green.100.value}"}}},error:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.red.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.20.value}"},color:{value:"{colors.red.100.value}"}}},overlay:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.neutral.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.overlay.80.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.overlay.90.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.overlay.90.value}"}}}},warning:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.red.60}"},borderWidth:{value:"{borderWidths.small}"},color:{value:"{colors.red.60}"},_hover:{borderColor:{value:"{colors.red.80}"},backgroundColor:{value:"{colors.red.10}"},color:{value:"{colors.font.error}"}},_focus:{borderColor:{value:"{colors.red.80}"},backgroundColor:{value:"{colors.red.10}"},color:{value:"{colors.red.80}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow}"}},_active:{borderColor:{value:"{colors.red.100}"},backgroundColor:{value:"{colors.red.20}"},color:{value:"{colors.red.100}"}},_disabled:{borderColor:{value:"{colors.border.tertiary}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled}"}},_loading:{borderColor:{value:"{colors.border.tertiary}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled}"}}},destructive:{borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small}"},borderStyle:{value:"solid"},backgroundColor:{value:"{colors.red.60}"},color:{value:"{colors.font.inverse}"},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled}"},color:{value:"{colors.font.disabled}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled}"},color:{value:"{colors.font.disabled}"}},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.100}"},color:{value:"{colors.font.inverse}"}}},small:{fontSize:{value:"{components.fieldcontrol.small.fontSize.value}"},paddingBlockStart:{value:"{components.fieldcontrol.small.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.small.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.small.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.small.paddingInlineEnd.value}"}},large:{fontSize:{value:"{components.fieldcontrol.large.fontSize.value}"},paddingBlockStart:{value:"{components.fieldcontrol
11146.large.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.large.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.large.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.large.paddingInlineEnd.value}"}},loaderWrapper:{alignItems:{value:"center"},gap:{value:"{space.xs.value}"}}},KX={backgroundColor:{value:"{colors.background.primary.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"0"},borderStyle:{value:"solid"},borderColor:{value:"transparent"},boxShadow:{value:"none"},padding:{value:"{space.medium.value}"},outlined:{backgroundColor:{value:"{components.card.backgroundColor.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},boxShadow:{value:"{components.card.boxShadow.value}"}},elevated:{backgroundColor:{value:"{components.card.backgroundColor.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"0"},borderStyle:{value:"solid"},borderColor:{value:"transparent"},boxShadow:{value:"{shadows.medium.value}"}}},XX={cursor:{value:"pointer"},alignItems:{value:"center"},_disabled:{cursor:{value:"not-allowed"}},button:{position:{value:"relative"},alignItems:{value:"center"},justifyContent:{value:"center"},color:{value:"{colors.font.inverse.value}"},before:{width:{value:"100%"},height:{value:"100%"},borderWidth:{value:"{borderWidths.medium.value}"},borderRadius:{value:"20%"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"}},_focus:{outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},_focus:{borderColor:{value:"{colors.border.error.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}}},icon:{backgroundColor:{value:"{colors.primary.80.value}"},borderRadius:{value:"20%"},opacity:{value:"{opacities.0.value}"},transform:{value:"scale(0)"},transitionProperty:{value:"all"},transitionDuration:{value:"{time.short.value}"},transitionTimingFunction:{value:"ease-in-out"},_checked:{opacity:{value:"{opacities.100.value}"},transform:{value:"scale(1)"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}},_indeterminate:{opacity:{value:"{opacities.100.value}"},transform:{value:"scale(1)"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}}},label:{color:{value:"{components.text.color.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"}}}},YX={alignItems:{value:"flex-start"},alignContent:{value:"center"},flexDirection:{value:"column"},justifyContent:{value:"center"}},JX={pagination:{current:{color:{value:"{components.pagination.current.color}"},backgroundColor:{value:"{components.pagination.current.backgroundColor}"}},button:{color:{value:"{components.pagination.button.color}"},_hover:{backgroundColor:{value:"{components.pagination.button.hover.backgroundColor}"},color:{value:"{components.pagination.button.hover.color}"}},_disabled:{color:{value:"{components.pagination.button.disabled.color}"}}}},search:{input:{color:{value:"{components.searchfield.color}"}},button:{color:{value:"{components.searchfield.button.color}"},_active:{backgroundColor:{value:"{components.searchfield.button._active.backgroundColor}"},borderColor:{value:"{components.searchfield.button._active.borderColor}"},color:{value:"{components.searchfield.button._active.color}"}},_disabled:{backgroundColor:{value:"{components.searchfield.button._disabled.backgroundColor}"},borderColor:{value:"{components.searchfield.button._disabled.borderColor}"},color:{value:"{components.searchfield.button._disabled.color}"}},_focus:{backgroundColor:{value:"{components.searchfield.button._focus.backgroundColor}"},borderColor:{value:"{components.searchfield.button._focus.borderColor}"},color:{value:"{components.searchfield.button._focus.color}"}},_hover:{backgroundColor:{value:"{components.searchfield.button._hover.backgroundColor}"},borderColor:{value:"{components.searchfield.button._hover.borderColor}"},color:{value:"{components.searchfield.button._hover.color}"}}}}},QX={fontSize:{value:"{fontSizes.xs}"},gap:{value:"{space.relative.medium}"},svg:{path:{fill:{value:"{colors.font.primary}"}}},toolTip:{bottom:{value:"{space.large}"},color:{value:"{colors.teal.100}"},fontSize:{value:"{fontSizes.xxs}"}}},ZX={height:{value:"{space.relative.full.value}"}},eY={borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.medium.value}"},label:{color:{value:"{colors.font.tertiary.value}"},paddingInline:{value:"{space.medium.value}"},fontSize:{value:"{fontSizes.small.value}"},backgroundColor:{value:"{colors.background.primary.value}"}},small:{borderWidth:{value:"{borderWidths.small.value}"}},large:{borderWidth:{value:"{borderWidths.large.value}"}},opacity:{value:"{opacities.60.value}"}},tY={backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},color:{value:"{colors.font.primary}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.primary}"}},_disabled:{backgroundColor:{value:"{colors.background.disabled}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.disabled}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.disabled}"}},accepted:{backgroundColor:{value:"{colors.background.success}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.success}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.success}"}},rejected:{backgroundColor:{value:"{colors.background.error}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.error}"}}},nY={backgroundColor:{value:"{colors.background.primary.value}"},item:{borderColor:{value:"{colors.border.secondary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.small.value}"},trigger:{alignItems:{value:"center"},backgroundColor:{value:"{colors.background.primary.value}"},color:{value:"inherit"},gap:{value:"{space.small.value}"},justifyContent:{value:"space-between"},paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"},_hover:{color:{value:"inherit"},backgroundColor:{value:"{colors.overlay.5.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0",offsetY:"0",blurRadius:"0",spreadRadius:"2px",color:"{colors.border.focus.value}"}}}},content:{color:{value:"inherit"},paddingInline:{value:"{space.small.value}"},paddingBlockEnd:{value:"{space.small.value}"},paddingBlockStart:{value:"{space.xxxs.value}"}},icon:{color:{value:"{colors.font.tertiary.value}"},transitionDuration:{value:"{time.medium.value}"},transitionTimingFunction:{value:"cubic-bezier(0.87, 0, 0.13, 1)"}}}},rY={gap:{value:"{space.xs.value}"},fontSize:{value:"{fontSizes.medium.value}"},flexDirection:{value:"column"},small:{gap:{value:"{space.xxxs.value}"},fontSize:{value:"{fontSizes.small.value}"}},large:{gap:{value:"{space.small.value}"},fontSize:{value:"{fontSizes.large.value}"}},label:{color:{value:"{colors.font.secondary.value}"}}},sY={borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.small.value}"},color:{value:"{colors.font.primary.value}"},paddingBlockStart:{value:"{space.xs.value}"},paddingBlockEnd:{value:"{space.xs.value}"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"},fontSize:{value:"{components.field.fontSize.value}"},lineHeight:{value:"{lineHeights.medium.value}"},transitionDuration:{value:"{time.medium.value}"},outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},small:{fontSize:{value:"{components.field.small.fontSize.value}"},paddingBlockStart:{value:"{space.xxs.value}"},paddingBlockEnd:{value:"{space.xxs.value}"},paddingInlineStart:{value:"{space.small.value}"},paddingInlineEnd:{value:"{space.small.value}"}},large:{fontSize:{value:"{components.field.large.fontSize.value}"},paddingBlockStart:{value:"{space.xs.value}"},paddingBlockEnd:{value:"{space.xs.value}"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"}}
11146,quiet:{borderStyle:{value:"none"},borderInlineStart:{value:"none"},borderInlineEnd:{value:"none"},borderBlockStart:{value:"none"},borderRadius:{value:"0"},_focus:{borderBlockEndColor:{value:"transparent"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_error:{borderBlockEndColor:{value:"{colors.border.error.value}"},_focus:{borderBlockEndColor:{value:"transparent"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.border.focus.value}"}}},_disabled:{color:{value:"{colors.font.disabled.value}"},cursor:{value:"not-allowed"},borderColor:{value:"{colors.transparent.value}"},backgroundColor:{value:"{colors.background.disabled.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},color:{value:"{colors.font.error.value}"},_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.border.error.value}"}}}},info:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.blue.100.value}"}}}},warning:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.orange.100.value}"}}}},success:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.green.100.value}"}}}},overlay:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.overlay.90.value}"}}}}},aY={gap:{value:"{space.zero.value}"},vertical:{alignItems:{value:"center"}},outer:{alignItems:{value:"center"}}},oY={backgroundColor:{value:"transparent"},borderRadius:{value:"{radii.xs.value}"},flexDirection:{value:"column"},gap:{value:"{components.field.gap.value}"},legend:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"{components.field.fontSize.value}"},fontWeight:{value:"{fontWeights.bold.value}"},lineHeight:{value:"{lineHeights.medium.value}"},small:{fontSize:"{components.field.small.fontSize.value}"},large:{fontSize:"{components.field.large.fontSize.value}"}},outlined:{padding:"{space.medium.value}",borderColor:"{colors.neutral.40.value}",borderWidth:"{borderWidths.small.value}",borderStyle:"solid",small:{padding:"{space.small.value}"},large:{padding:"{space.large.value}"}},small:{gap:"{components.field.small.gap.value}"},large:{gap:"{components.field.large.gap.value}"}},iY={error:{color:{value:"{colors.font.error.value}"},fontSize:{value:"{fontSizes.small.value}"}},description:{color:{value:"{colors.font.secondary.value}"},fontStyle:{value:"italic"},fontSize:{value:"{fontSizes.small.value}"}}},cY={dropzone:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.fileuploader.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.fileuploader.dropzone.borderStyle}"},borderWidth:{value:"{borderWidths.medium}"}},icon:{color:{value:"{colors.border.primary}"},fontSize:{value:"{fontSizes.xxl}"}},text:{color:{value:"{colors.font.tertiary}"},fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"}}},file:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"},gap:{value:"{space.small}"},alignItems:{value:"baseline"},name:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},size:{fontSize:{value:"{fontSizes.small}"},fontWeight:{value:"{fontWeights.normal}"},color:{value:"{colors.font.tertiary}"}},image:{width:{value:"{space.xxl}"},height:{value:"{space.xxl}"},backgroundColor:{value:"{colors.background.secondary}"},color:{value:"{colors.font.tertiary}"},borderRadius:{value:"{radii.small}"}}},filelist:{flexDirection:{value:"column"},gap:{value:"{space.small}"}},loader:{strokeLinecap:{value:"round"},strokeEmpty:{value:"{colors.border.secondary}"},strokeFilled:{value:"{components.loader.strokeFilled}"},strokeWidth:{value:"{borderWidths.large}"}},previewer:{backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},borderRadius:{value:"{radii.small}"},paddingBlock:{value:"{space.zero}"},paddingInline:{value:"{space.zero}"},maxHeight:{value:"40rem"},maxWidth:{value:"auto"},text:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},body:{paddingBlock:{value:"{space.medium}"},paddingInline:{value:"{space.medium}"},gap:{value:"{space.small}"}},footer:{justifyContent:{value:"flex-end"}}}},lY={gap:{value:"{space.medium.value}"},justifyContent:{value:"normal"},alignItems:{value:"stretch"},alignContent:{value:"normal"},flexWrap:{value:"nowrap"}},uY={color:{value:"{colors.font.primary.value}"},lineHeight:{value:"{lineHeights.small.value}"},1:{fontSize:{value:"{fontSizes.xxxxl.value}"},fontWeight:{value:"{fontWeights.light.value}"}},2:{fontSize:{value:"{fontSizes.xxxl.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},3:{fontSize:{value:"{fontSizes.xxl.value}"},fontWeight:{value:"{fontWeights.medium.value}"}},4:{fontSize:{value:"{fontSizes.xl.value}"},fontWeight:{value:"{fontWeights.semibold.value}"}},5:{fontSize:{value:"{fontSizes.large.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},6:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.extrabold.value}"}}},dY={highlighted:{fontWeight:{value:"{fontWeights.bold}"}}},fY={lineHeight:{value:1},height:{value:"1em"}},pY={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}},hY={maxWidth:{value:"100%"},height:{value:"auto"},objectFit:{value:"initial"},objectPosition:{value:"initial"}},mY={banner:{height:{value:"150px "},width:{value:"400px "}},button:{backgroundColor:{value:"#e8e8e8"},borderRadius:{value:"5px"},color:{value:"black"}},dialog:{height:{value:"50vh"},minHeight:{value:"400px"},minWidth:{value:"400px"},width:{value:"30vw"}},header:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.extrabold.value}"}}},gY={active:{color:{value:"{colors.font.active.value}"}}
11146,color:{value:"{colors.font.interactive.value}"},focus:{color:{value:"{colors.font.focus.value}"}},hover:{color:{value:"{colors.font.hover.value}"}},visited:{color:{value:"{colors.font.interactive.value}"}}},yY={cameraModule:{backgroundColor:{value:"{colors.background.primary.value}"}}},vY={width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"},fontSize:{value:"{fontSizes.xs.value}"},strokeEmpty:{value:"{colors.neutral.20.value}"},strokeFilled:{value:"{colors.primary.80.value}"},strokeLinecap:{value:"round"},animationDuration:{value:"1s"},small:{width:{value:"{fontSizes.small.value}"},height:{value:"{fontSizes.small.value}"},fontSize:{value:"{fontSizes.xxs.value}"}},large:{width:{value:"{fontSizes.large.value}"},height:{value:"{fontSizes.large.value}"},fontSize:{value:"{fontSizes.small.value}"}},linear:{width:{value:"100%"},minWidth:{value:"5rem"},fontSize:{value:"{fontSizes.xxs.value}"},strokeWidth:{value:"{fontSizes.xxs.value}"},strokeFilled:{value:"{colors.primary.80.value}"},strokeEmpty:{value:"{colors.neutral.20.value}"},strokeLinecap:{value:"round"},animationDuration:{value:"1s"},small:{strokeWidth:{value:"{fontSizes.xxxs.value}"},fontSize:{value:"{fontSizes.xxxs.value}"}},large:{strokeWidth:{value:"{fontSizes.xs.value}"},fontSize:{value:"{fontSizes.xs.value}"}}},text:{fill:{value:"{colors.font.primary.value}"}}},bY={backgroundColor:{value:"{colors.background.primary.value}"},borderRadius:{value:"{radii.medium.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},boxShadow:{value:"{shadows.large.value}"},flexDirection:{value:"column"},gap:{value:"{space.zero.value}"},maxWidth:{value:"30rem"},minWidth:{value:"14rem"},small:{width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"}},large:{width:{value:"{fontSizes.xxxl.value}"},height:{value:"{fontSizes.xxxl.value}"}},item:{minHeight:{value:"2.5rem"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"}}},wY={alignItems:{value:"center"},backgroundColor:{value:"{colors.background.tertiary.value}"},borderColor:{value:"transparent"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.xs.value}"},color:{value:"{colors.font.primary.value}"},justifyContent:{value:"flex-start"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.medium.value}"},lineHeight:{value:"{lineHeights.small.value}"},icon:{size:{value:"{fontSizes.xl.value}"}},heading:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},dismiss:{gap:{value:"{space.xxs.value}"}},plain:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}}},outlined:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.primary.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.info.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.error.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.success.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.warning.value}"}}},filled:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.secondary.value}"},borderColor:{value:"transparent"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"},borderColor:{value:"transparent"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"},borderColor:{value:"transparent"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"},borderColor:{value:"transparent"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"},borderColor:{value:"transparent"}}}},SY={current:{alignItems:{value:"center"},justifyContent:{value:"center"},color:{value:"{colors.font.inverse.value}"},fontSize:{value:"{fontSizes.small.value}"},backgroundColor:{value:"{colors.overlay.40.value}"}},button:{color:{value:"{colors.font.primary.value}"},paddingInlineStart:{value:"{space.xxs.value}"},paddingInlineEnd:{value:"{space.xxs.value}"},transitionProperty:{value:"background-color"},transitionDuration:{value:"{time.medium.value}"},hover:{backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.font.primary.value}"}},disabled:{color:{value:"{colors.font.disabled.value}"}}},ellipsis:{alignItems:{value:"baseline"},justifyContent:{value:"center"},paddingInlineStart:{value:"{space.xs.value}"},paddingInlineEnd:{value:"{space.xs.value}"}},itemContainer:{marginLeft:{value:"{space.xxxs.value}"},marginRight:{value:"{space.xxxs.value}"}}
11146,itemShared:{height:{value:"{fontSizes.xxl.value}"},minWidth:{value:"{fontSizes.xxl.value}"},borderRadius:{value:"{fontSizes.medium.value}"}}},xY={color:{value:"{components.fieldcontrol.color.value}"},button:{color:{value:"{components.button.color.value}"},_active:{backgroundColor:{value:"{components.button._active.backgroundColor.value}"},borderColor:{value:"{components.button._active.borderColor.value}"},color:{value:"{components.button._active.color.value}"}},_disabled:{backgroundColor:{value:"{components.button._disabled.backgroundColor.value}"},borderColor:{value:"{components.button._disabled.borderColor.value}"},color:{value:"{components.button._disabled.color.value}"}},_error:{color:{value:"{components.button.outlined.error.color.value}"},backgroundColor:{value:"{components.button.outlined.error.backgroundColor.value}"},borderColor:{value:"{components.button.outlined.error.borderColor.value}"},_active:{borderColor:{value:"{components.button.outlined.error._active.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._active.backgroundColor.value}"},color:{value:"{components.button.outlined.error._active.color.value}"}},_focus:{borderColor:{value:"{components.button.outlined.error._focus.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._focus.backgroundColor.value}"},color:{value:"{components.button.outlined.error._focus.color.value}"},boxShadow:{value:"{components.button.outlined.error._focus.boxShadow.value}"}},_hover:{borderColor:{value:"{components.button.outlined.error._hover.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._hover.backgroundColor.value}"},color:{value:"{components.button.outlined.error._hover.color.value}"}}},_focus:{backgroundColor:{value:"{components.button._focus.backgroundColor.value}"},borderColor:{value:"{components.button._focus.borderColor.value}"},color:{value:"{components.button._focus.color.value}"}},_hover:{backgroundColor:{value:"{components.button._hover.backgroundColor.value}"},borderColor:{value:"{components.button._hover.borderColor.value}"},color:{value:"{components.button._hover.color.value}"}}}},_Y={color:{value:"{components.fieldcontrol.color}"},borderColor:{value:"{components.fieldcontrol.borderColor}"},fontSize:{value:"{components.fieldcontrol.fontSize}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor}"}}},IY={borderRadius:{value:"{radii.small.value}"},transitionDuration:{value:"{time.long.value}"},startColor:{value:"{colors.background.secondary.value}"},endColor:{value:"{colors.background.tertiary.value}"},small:{height:{value:"{space.small.value}"}},default:{height:{value:"{space.medium.value}"}},large:{height:{value:"{space.large.value}"}}},kY={alignItems:{value:"center"},justifyContent:{value:"flex-start"},gap:{value:"inherit"},_disabled:{cursor:{value:"not-allowed"}},button:{alignItems:{value:"center"},justifyContent:{value:"center"},width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"},boxSizing:{value:"border-box"},borderWidth:{value:"{borderWidths.medium.value}"},borderStyle:{value:"solid"},borderRadius:{value:"50%"},borderColor:{value:"{colors.border.primary.value}"},color:{value:"{colors.background.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},transitionProperty:{value:"all"},transitionDuration:{value:"{time.medium.value}"},outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},padding:{value:"{borderWidths.medium.value}"},small:{width:{value:"{fontSizes.small.value}"},height:{value:"{fontSizes.small.value}"}},large:{width:{value:"{fontSizes.large.value}"},height:{value:"{fontSizes.large.value}"}},_checked:{color:{value:"{colors.primary.80.value}"},_disabled:{color:{value:"{colors.background.disabled.value}"}}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},_focus:{boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"},backgroundColor:{value:"{colors.background.primary.value}"}}},label:{color:{value:"{components.text.color.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"}}}},EY={radio:{borderWidth:{value:"{components.radio.button.borderWidth}"},borderColor:{value:"{components.radio.button.borderColor}"},backgroundColor:{value:"{components.radio.button.backgroundColor}"},_checked:{color:{value:"{components.radio.button._checked.color}"}},label:{color:{value:"{components.radio.label.color}"}}},legend:{color:{value:"{components.fieldset.legend.color}"},fontWeight:{value:"{fontWeights.normal}"}}},TY={large:{size:{value:"{fontSizes.xxxl.value}"}},default:{size:{value:"{fontSizes.xl.value}"}},small:{size:{value:"{fontSizes.small.value}"}},filled:{color:{value:"{colors.secondary.80.value}"}},empty:{color:{value:"{colors.background.tertiary.value}"}}},CY={color:{value:"{components.fieldcontrol.color.value}"},button:{color:{value:"{components.button.color.value}"},backgroundColor:{value:"{colors.background.primary.value}"},_active:{backgroundColor:{value:"{components.button._active.backgroundColor.value}"},borderColor:{value:"{components.button._active.borderColor.value}"},color:{value:"{components.button._active.color.value}"}},_disabled:{backgroundColor:{value:"{components.button._disabled.backgroundColor.value}"},borderColor:{value:"{components.button._disabled.borderColor.value}"},color:{value:"{components.button._disabled.color.value}"}},_focus:{backgroundColor:{value:"{components.button._focus.backgroundColor.value}"},borderColor:{value:"{components.button._focus.borderColor.value}"},color:{value:"{components.button._focus.color.value}"}},_hover:{backgroundColor:{value:"{components.button._hover.backgroundColor.value}"},borderColor:{value:"{components.button._hover.borderColor.value}"},color:{value:"{components.button._hover.color.value}"}}}},NY={color:{value:"{components.fieldcontrol.color}"},backgroundColor:{value:"{colors.background.primary.value}"},paddingInlineEnd:{value:"{space.xxl.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"{colors.background.disabled.value}"}},wrapper:{flex:{value:"1"},display:{value:"block"},position:{value:"relative"},cursor:{value:"pointer"}},iconWrapper:{alignItems:{value:"center"},position:{value:"absolute"},top:{value:"50%"},right:{value:"{space.medium.value}"},transform:{value:"translateY(-50%)"},pointerEvents:{value:"none"},small:{right:{value:"{space.xs.value}"}},large:{right:{value:"{space.medium.value}"}}},option:{backgroundColor:{value:"transparent"},color:{value:"{colors.font.primary.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"}}},whiteSpace:{value:"nowrap"},minWidth:{value:"6.5rem"},small:{minWidth:{value:"5.5rem"},paddingInlineEnd:{value:"{space.xl.value}"}},large:{minWidth:{value:"7.5rem"},paddingInlineEnd:{value:"{space.xxl.value}"}},expanded:{paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"},option:{paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"}}}},AY={borderColor:{value:"{components.fieldcontrol.borderColor}"},color:{value:"{components.fieldcontrol.color}"},flexDirection:{value:"column"},fontSize:{value:"{components.fieldcontrol.fontSize}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor}"}},label:{color:{value:"{components.field.label.color}"}}},$Y={paddingBlock:{value:"{space.xs.value}"},track:{backgroundColor:{value:"{colors.background.quaternary.value}"},borderRadius:{value:"9999px"}
11146,height:{value:"0.375rem"},minWidth:{value:"10rem"}},range:{backgroundColor:{value:"{colors.primary.80.value}"},borderRadius:{value:"9999px"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}},thumb:{width:{value:"1.25rem"},height:{value:"1.25rem"},backgroundColor:{value:"{colors.background.primary.value}"},boxShadow:{value:"{shadows.small.value}"},borderRadius:{value:"50%"},borderWidth:{value:"{borderWidths.medium.value}"},borderColor:{value:"{colors.border.primary.value}"},borderStyle:{value:"solid"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"},borderColor:{value:"transparent"},boxShadow:{value:"none"}},_hover:{backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.focus.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}}},small:{track:{height:{value:"0.25rem"}},thumb:{width:{value:"1rem"},height:{value:"1rem"}}},large:{track:{height:{value:"0.625rem"}},thumb:{width:{value:"1.5rem"},height:{value:"1.5rem"}}}},RY={borderColor:{value:"{components.fieldcontrol.borderColor}"},flexDirection:{value:"column"},input:{color:{value:"{components.fieldcontrol.color}"},fontSize:{value:"{components.fieldcontrol.fontSize}"},textAlign:{value:"center"}},button:{color:{value:"{components.button.color}"},backgroundColor:{value:"{colors.transparent}"},_active:{color:{value:"{components.button._active.color}"},backgroundColor:{value:"{components.button._active.backgroundColor}"}},_focus:{color:{value:"{components.button._focus.color}"},backgroundColor:{value:"{components.button._focus.backgroundColor}"}},_disabled:{color:{value:"{components.button._disabled.color}"},backgroundColor:{value:"{components.fieldcontrol._disabled.backgroundColor}"}},_hover:{color:{value:"{components.button._hover.color}"},backgroundColor:{value:"{components.button._hover.backgroundColor}"}}}},DY={dropzone:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.storagemanager.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.storagemanager.dropzone.borderStyle}"},borderWidth:{value:"{borderWidths.medium}"}},icon:{color:{value:"{colors.border.primary}"},fontSize:{value:"{fontSizes.xxl}"}},text:{color:{value:"{colors.font.tertiary}"},fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"}}},file:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"},gap:{value:"{space.small}"},alignItems:{value:"baseline"},name:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},size:{fontSize:{value:"{fontSizes.small}"},fontWeight:{value:"{fontWeights.normal}"},color:{value:"{colors.font.tertiary}"}},image:{width:{value:"{space.xxl}"},height:{value:"{space.xxl}"},backgroundColor:{value:"{colors.background.secondary}"},color:{value:"{colors.font.tertiary}"},borderRadius:{value:"{radii.small}"}}},filelist:{flexDirection:{value:"column"},gap:{value:"{space.small}"}},loader:{strokeLinecap:{value:"round"},strokeEmpty:{value:"{colors.border.secondary}"},strokeFilled:{value:"{components.loader.strokeFilled}"},strokeWidth:{value:"{borderWidths.large}"}},previewer:{backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},borderRadius:{value:"{radii.small}"},paddingBlock:{value:"{space.zero}"},paddingInline:{value:"{space.zero}"},maxHeight:{value:"40rem"},maxWidth:{value:"auto"},text:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},body:{paddingBlock:{value:"{space.medium}"},paddingInline:{value:"{space.medium}"},gap:{value:"{space.small}"}},footer:{justifyContent:{value:"flex-end"}}}},FY={_disabled:{opacity:{value:"{opacities.60.value}"}},_focused:{shadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},fontSize:{value:"{fontSizes.medium.value}"},large:{fontSize:{value:"{fontSizes.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"}},label:{padding:{value:"{space.xs.value}"}},thumb:{backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.xxxl.value}"},checked:{transform:{value:"{transforms.slideX.medium.value}"}},transition:{duration:{value:"{time.medium.value}"}},width:{value:"{space.relative.medium.value}"}},track:{backgroundColor:{value:"{colors.background.quaternary.value}"},borderRadius:{value:"{radii.xxxl.value}"},checked:{backgroundColor:{value:"{colors.primary.80.value}"}},height:{value:"{space.relative.medium.value}"},padding:{value:"{outlineWidths.medium.value}"},transition:{duration:{value:"{time.short.value}"}},width:{value:"{space.relative.xl.value}"},_error:{backgroundColor:{value:"{colors.background.error.value}"}}}},MY={borderCollapse:{value:"collapse"},display:{value:"table"},width:{value:"100%"},head:{display:{value:"table-header-group"},verticalAlign:{value:"middle"}},body:{display:{value:"table-row-group"},verticalAlign:{value:"middle"}},foot:{display:{value:"table-footer-group"},verticalAlign:{value:"middle"}},row:{display:{value:"table-row"},verticalAlign:{value:"middle"},hover:{backgroundColor:{value:"{colors.background.tertiary.value}"}},striped:{backgroundColor:{value:"{colors.background.secondary.value}"}}},header:{borderColor:{value:"{colors.border.tertiary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.primary.value}"},display:{value:"table-cell"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"},padding:{value:"{space.medium.value}"},verticalAlign:{value:"middle"},large:{fontSize:{value:"{fontSizes.large.value}"},padding:{value:"{space.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"},padding:{value:"{space.xs.value}"}}},data:{borderColor:{value:"{colors.border.tertiary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.primary.value}"},display:{value:"table-cell"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.normal.value}"},padding:{value:"{space.medium.value}"},verticalAlign:{value:"middle"},large:{fontSize:{value:"{fontSizes.large.value}"},padding:{value:"{space.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"},padding:{value:"{space.xs.value}"}}},caption:{captionSide:{value:"bottom"},color:{value:"{colors.font.primary.value}"},display:{value:"table-caption"},fontSize:{value:"{fontSizes.medium.value}"},textAlign:{value:"center"},wordBreak:{value:"break-all"},large:{fontSize:{value:"{fontSizes.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"}}}},OY={backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.secondary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.medium.value}"}
11146,gap:{value:"0"},item:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.secondary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.medium.value}"},color:{value:"{colors.font.secondary.value}"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"},paddingVertical:{value:"{space.small.value}"},paddingHorizontal:{value:"{space.medium.value}"},textAlign:{value:"center"},transitionDuration:{value:"{time.medium.value}"},_hover:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.hover.value}"}},_focus:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"{borderWidths.medium}",color:"{colors.border.focus.value}"}},color:{value:"{colors.font.focus.value}"}},_active:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.font.interactive.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.interactive.value}"}},_disabled:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.disabled.value}"}}},panel:{backgroundColor:{value:"transparent"},paddingInline:{value:"0"},paddingBlock:{value:"{space.small.value}"}}},PY={color:{value:"{colors.font.primary.value}"},primary:{color:{value:"{colors.font.primary.value}"}},secondary:{color:{value:"{colors.font.secondary.value}"}},tertiary:{color:{value:"{colors.font.tertiary.value}"}},error:{color:{value:"{colors.font.error.value}"}},warning:{color:{value:"{colors.font.warning.value}"}},success:{color:{value:"{colors.font.success.value}"}},info:{color:{value:"{colors.font.info.value}"}}},BY={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}},LY={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}},WY={borderColor:{value:"{colors.border.primary.value}"},color:{value:"{colors.font.primary.value}"},_hover:{backgroundColor:{value:"{colors.overlay.10.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},color:{value:"{colors.font.primary.value}"}},_active:{backgroundColor:{value:"{colors.transparent.value}"}},_disabled:{backgroundColor:{value:"{colors.transparent.value}"},borderColor:{value:"{colors.border.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{borderColor:{value:"{colors.border.pressed.value}"},color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.overlay.20.value}"},_hover:{backgroundColor:{value:"{colors.overlay.30.value}"}}},primary:{backgroundColor:{value:"{colors.transparent.value}"},borderWidth:{value:"{borderWidths.small.value}"},_focus:{borderColor:{value:"{colors.border.focus.value}"},backgroundColor:{value:"{colors.transparent.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"},color:{value:"{colors.font.primary.value}"}},_hover:{backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.font.primary.value}"}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{backgroundColor:{value:"{colors.primary.80.value}"},borderColor:{value:"{colors.primary.80.value}"},color:{value:"{colors.background.primary.value}"},_focus:{backgroundColor:{value:"{colors.border.focus.value}"},borderColor:{value:"{colors.border.focus.value}"},color:{value:"{colors.background.primary.value}"}},_hover:{borderColor:{value:"{colors.primary.60.value}"},backgroundColor:{value:"{colors.primary.60.value}"},boxShadow:{value:"{colors.primary.60.value}"},color:{value:"{colors.background.primary.value}"}}}},link:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"},_hover:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"}},_focus:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"}},_disabled:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.90.value}"},_focus:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.90.value}"}},_hover:{color:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.transparent.value}"}}}}},zY={alignItems:{value:"center"},alignContent:{value:"center"},justifyContent:{value:"flex-start"}},HY={accordion:nY,aiConversation:zX,alert:WX,authenticator:UX,autocomplete:HX,avatar:VX,badge:jX,breadcrumbs:GX,button:qX,card:KX,checkbox:XX,checkboxfield:YX,collection:JX,copy:QX,countrycodeselect:ZX,divider:eY,dropzone:tY,field:rY,fieldcontrol:sY,f
11146ieldgroup:aY,fieldmessages:iY,fieldset:oY,fileuploader:cY,flex:lY,heading:uY,icon:fY,highlightmatch:dY,image:hY,inappmessaging:mY,input:pY,link:gY,liveness:yY,loader:vY,menu:bY,message:wY,pagination:SY,passwordfield:xY,phonenumberfield:_Y,placeholder:IY,radio:kY,radiogroup:EY,rating:TY,searchfield:CY,select:NY,selectfield:AY,sliderfield:$Y,stepperfield:RY,storagemanager:DY,switchfield:FY,table:MY,tabs:OY,text:PY,textareafield:BY,textfield:LY,togglebutton:WY,togglebuttongroup:zY},UY={default:{variable:{value:"'InterVariable', 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont,\n 'Helvetica Neue', 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans',\n sans-serif"},static:{value:"'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue',\n 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif"}}},ds={xxxs:{value:"0.375rem"},xxs:{value:"0.5rem"},xs:{value:"0.75rem"},small:{value:"0.875rem"},medium:{value:"1rem"},large:{value:"1.25rem"},xl:{value:"1.5rem"},xxl:{value:"2rem"},xxxl:{value:"2.5rem"},xxxxl:{value:"3rem"}},y_={hairline:{value:100},thin:{value:200},light:{value:300},normal:{value:400},medium:{value:500},semibold:{value:600},bold:{value:700},extrabold:{value:800},black:{value:900}},VY={small:{value:"1.25"},medium:{value:"1.5"},large:{value:"2"}}
11146,v_={0:{value:"0"},10:{value:"0.1"},20:{value:"0.2"},30:{value:"0.3"},40:{value:"0.4"},50:{value:"0.5"},60:{value:"0.6"},70:{value:"0.7"},80:{value:"0.8"},90:{value:"0.9"},100:{value:"1"}},jY={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}},GY={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}},b_={xs:{value:"0.125rem"},small:{value:"0.25rem"},medium:{value:"0.5rem"},large:{value:"1rem"},xl:{value:"2rem"},xxl:{value:"4rem"},xxxl:{value:"8rem"}},qY={small:{value:{offsetX:"0px",offsetY:"2px",blurRadius:"4px",color:"{colors.shadow.tertiary.value}"}},medium:{value:{offsetX:"0px",offsetY:"2px",blurRadius:"6px",color:"{colors.shadow.secondary.value}"}},large:{value:{offsetX:"0px",offsetY:"4px",blurRadius:"12px",color:"{colors.shadow.primary.value}"}}},fs={zero:{value:"0"},xxxs:{value:"0.25rem"},xxs:{value:"0.375rem"},xs:{value:"0.5rem"},small:{value:"0.75rem"},medium:{value:"1rem"},large:{value:"1.5rem"},xl:{value:"2.0rem"},xxl:{value:"3.0rem"},xxxl:{value:"4.5rem"},relative:{xxxs:{value:"0.25em"},xxs:{value:"0.375em"},xs:{value:"0.5em"},small:{value:"0.75em"},medium:{value:"1em"},large:{value:"1.5em"},xl:{value:"2.0em"},xxl:{value:"3.0em"},xxxl:{value:"4.5em"},full:{value:"100%"}}},w_={short:{value:"100ms"},medium:{value:"250ms"},long:{value:"500ms"}},KY={slideX:{small:{value:"translateX(0.5em)"},medium:{value:"translateX(1em)"},large:{value:"translateX(2em)"}}},XY={components:HY,borderWidths:m_,colors:g_,fonts:UY,fontSizes:ds,fontWeights:y_,lineHeights:VY,opacities:v_,outlineOffsets:jY,outlineWidths:GY,radii:b_,shadows:qY,space:fs,time:w_,transforms:KY};ds.xxs,ds.xs,ds.small,ds.medium,ds.large,ds.xl,ds.xxl,ds.xxxl,fs.xxxs,fs.xs,fs.small,fs.medium,fs.large,fs.xl,fs.xxl,fs.xxxl;const YY={values:{base:0,small:480,medium:768,large:992,xl:1280,xxl:1536},defaultBreakpoint:"base"},S_={tokens:XY,breakpoints:YY,name:"default-theme"};function JY(t,e,n,r){var s=-1,a=t==null?0:t.length;for(r&&a&&(n=t[++s]);++s<a;)n=e(n,t[s],s,t);return n}var QY=JY;function ZY(t){return function(e){return t==null?void 0:t[e]}}var eJ=ZY,tJ=eJ,nJ={Ã:"A",Ã:"A",Ã:"A",Ã:"A",Ã:"A",Ã
:"A",à :"a",á:"a",â:"a",ã:"a",ä:"a",Ã¥:"a",Ã:"C",ç:"c",Ã:"D",ð:"d",Ã:"E",Ã:"E",Ã:"E",Ã:"E",è:"e",é:"e",ê:"e",ë:"e",Ã:"I",Ã:"I",Ã:"I",Ã:"I",ì:"i",Ã:"i",î:"i",ï:"i",Ã:"N",ñ:"n",Ã:"O",Ã:"O",Ã:"O",Ã:"O",Ã:"O",Ã:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ã:"U",Ã:"U",Ã:"U",Ã:"U",ù:"u",ú:"u",û:"u",ü:"u",Ã:"Y",ý:"y",ÿ:"y",Ã:"Ae",æ:"ae",Ã:"Th",þ:"th",Ã:"ss",Ä:"A",Ä:"A",Ä:"A",Ä:"a",Ä:"a",Ä
:"a",Ä:"C",Ä:"C",Ä:"C",Ä:"C",Ä:"c",Ä:"c",Ä:"c",Ä:"c",Ä:"D",Ä:"D",Ä:"d",Ä:"d",Ä:"E",Ä:"E",Ä:"E",Ä:"E",Ä:"E",Ä:"e",Ä:"e",Ä:"e",Ä:"e",Ä:"e",Ä:"G",Ä:"G",Ä :"G",Ä¢:"G",Ä:"g",Ä:"g",Ä¡:"g",Ä£:"g",Ĥ:"H",Ħ:"H",Ä¥:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Ä®:"I",İ:"I",Ä©:"i",Ä«:"i",Ä:"i",į:"i",ı:"i",Ä´:"J",ĵ:"j",Ķ:"K",Ä·:"k",ĸ:"k",Ĺ:"L",Ä»:"L",Ľ:"L",Ä¿:"L",Å:"L",ĺ:"l",ļ:"l",ľ:"l",Å:"l",Å:"l",Å:"N",Å
:"N",Å:"N",Å:"N",Å:"n",Å:"n",Å:"n",Å:"n",Å:"O",Å:"O",Å:"O",Å:"o",Å:"o",Å:"o",Å:"R",Å:"R",Å:"R",Å:"r",Å:"r",Å:"r",Å:"S",Å:"S",Å:"S",Å :"S",Å:"s",Å:"s",Å:"s",Å¡:"s",Å¢:"T",Ť:"T",Ŧ:"T",Å£:"t",Å¥:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Å®:"U",Ű:"U",Ų:"U",Å©:"u",Å«:"u",Å:"u",ů:"u",ű:"u",ų:"u",Å´:"W",ŵ:"w",Ŷ:"Y",Å·:"y",Ÿ:"Y",Ź:"Z",Å»:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Å:"Oe",Å:"oe",Å:"'n",Å¿:"s"},rJ=tJ(nJ),sJ=rJ,aJ=sJ,oJ=h_,iJ=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
111467f]/g,cJ="\\u0300-\\u036f",lJ="\\ufe20-\\ufe2f",uJ="\\u20d0-\\u20ff",dJ=cJ+lJ+uJ,fJ="["+dJ+"]",pJ=RegExp(fJ,"g");function hJ(t){return t=oJ(t),t&&t.replace(iJ,aJ).replace(pJ,"")}var mJ=hJ,gJ=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function yJ(t){return t.match(gJ)||[]}var vJ=yJ,bJ=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function wJ(t){return bJ.test(t)}var SJ=wJ,x_="\\ud800-\\udfff",xJ="\\u0300-\\u036f",_J="\\ufe20-\\ufe2f",IJ="\\u20d0-\\u20ff",kJ=xJ+_J+IJ,__="\\u2700-\\u27bf",I_="a-z\\xdf-\\xf6\\xf8-\\xff",EJ="\\xac\\xb1\\xd7\\xf7",TJ="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",CJ="\\u2000-\\u206f",NJ=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",k_="A-Z\\xc0-\\xd6\\xd8-\\xde",AJ="\\ufe0e\\ufe0f",E_=EJ+TJ+CJ+NJ,T_="['â]",cb="["+E_+"]",$J="["+kJ+"]",C_="\\d+",RJ="["+__+"]",N_="["+I_+"]",A_="[^"+x_+E_+C_+__+I_+k_+"]",DJ="\\ud83c[\\udffb-\\udfff]",FJ="(?:"+$J+"|"+DJ+")",MJ="[^"+x_+"]",$_="(?:\\ud83c[\\udde6-\\uddff]){2}",R_="[\\ud800-\\udbff][\\udc00-\\udfff]",Ao="["+k_+"]",OJ="\\u200d",lb="(?:"+N_+"|"+A_+")",PJ="(?:"+Ao+"|"+A_+")",ub="(?:"+T_+"(?:d|ll|m|re|s|t|ve))?",db="(?:"+T_+"(?:D|LL|M|RE|S|T|VE))?",D_=FJ+"?",F_="["+AJ+"]?",BJ="(?:"+OJ+"(?:"+[MJ,$_,R_].join("|")+")"+F_+D_+")*",LJ="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",WJ="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zJ=F_+D_+BJ,HJ="(?:"+[RJ,$_,R_].join("|")+")"+zJ,UJ=RegExp([Ao+"?"+N_+"+"+ub+"(?="+[cb,Ao,"$"].join("|")+")",PJ+"+"+db+"(?="+[cb,Ao+lb,"$"].join("|")+")",Ao+"?"+lb+"+"+ub,Ao+"+"+db,WJ,LJ,C_,HJ].join("|"),"g");function VJ(t){return t.match(UJ)||[]}var jJ=VJ,GJ=vJ,qJ=SJ,KJ=h_,XJ=jJ;function YJ(t,e,n){return t=KJ(t),e=n?void 0:e,e===void 0?qJ(t)?XJ(t):GJ(t):t.match(e)||[]}var JJ=YJ,QJ=QY,ZJ=mJ,eQ=JJ,tQ="['â]",nQ=RegExp(tQ,"g");function rQ(t){return function(e){return QJ(eQ(ZJ(e).replace(nQ,"")),t,"")}}var sQ=rQ,aQ=sQ,oQ=aQ(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),iQ=oQ;const M_=Nu(iQ),cQ=/\{([^}]+)\}/g;function O_(t){const e=new RegExp(cQ);if(typeof t=="string")return e.test(t);if(typeof t=="object"){let n=!1;for(const r in t)if(ra(t,r)){const s=t[r];if(O_(s)){n=!0;break}}return n}return!1}const lQ="amplify";function Yh(t){return Object.entries(t).map(([e,n])=>{const r=Xf(n)?n.toString():P_({value:n});return"".concat(M_(e),":").concat(r,"; ")}).join(" ")}function Vg({path:t=[]}){return"".concat(M_([lQ,...t].join(" ")))}const uQ=["offsetX","offsetY","blurRadius","spreadRadius","color"];function P_(t){const{value:e}=t;return Ya(e)?pb(e):fb(e)?uQ.map(n=>pb(fb(t)?t[n]:e[n])).join(" "):e}function Xf(t){return Es(t)&&ra(t,"value")}function fb(t){return Es(t)&&ra(t,"offsetX")}function pb(t){if(!t)return"";if(O_(t)){const e=t.replace(/\{|\}/g,"").replace(".value","").split(".");return"var(--".concat(Vg({path:e}),")")}return t}const hb=({token:t,path:e})=>{const n="--".concat(Vg({path:e})),{value:r}=t,s=P_(t);return{name:n,original:r,path:e,value:s,toString:()=>"var(".concat(n,")")}};function Jh({tokens:t,path:e=[],setupToken:n}){if(ra(t,"value"))return n({token:t,path:e});const r={};for(const s in t)if(ra(t,s)){const a=t[s],o=Es(a)?a:{value:a};r[s]=Jh({tokens:o,path:e.concat(s),setupToken:n})}return r}function Qh(t,e){e=e||[];for(var n in t)ra(t,n)&&(Es(t[n])&&"value"in t[n]?e.push(t[n]):Es(t[n])&&Qh(t[n],e));return e}function B_(t,e,n){if(t==null)return{};var r,s,a,o,i,l,u=t[0]||{},c=1,d=t.length;for(n=n||[],typeof u!="object"&&(u={});c<d;c++)if((i=t[c])!=null){for(o in i)if(ra(i,o)&&o!=="__proto__"&&(r=u[o],a=i[o],u!==a))if(a&&(Es(a)||(s=Array.isArray(a)))){s?(s=!1,l=r&&Array.isArray(r)?r:[]):l=r&&Es(r)?r:{};var f=n.slice(0);f.push(o),u[o]=B_([l,a],e,f)}else a!==void 0&&(r!=null&&typeof e=="function"&&e({target:u,copy:i,path:n,key:o}),u[o]=a)}return u}function mb(t,e){return e?"".concat(t," { ").concat(Object.entries(e).map(([n,r])=>"--".concat(n,":").concat(r,"; ")).join(" "),"}\n"):""}function Bs(t,e){let n="";const{_modifiers:r={},_element:s={},_vars:a,...o}=e;if(Object.keys(o).length){const[i,l]=ZK(o,u=>u.startsWith(":")||u.startsWith("["));
11146Object.entries(i).forEach(([u,c])=>{const{_modifiers:d={},_element:f={},_vars:p,...h}=c;n+="".concat(t).concat(u," { ").concat(Yh(h)," }\n"),n+=mb("".concat(t).concat(u),p)}),n+="".concat(t," { ").concat(Yh(l)," }\n")}return n+=mb(t,a),Object.entries(r).forEach(([i,l])=>{l&&Object.keys(l).length&&(n+=Bs("".concat(t,"--").concat(i),l))}),Object.entries(s).forEach(([i,l])=>{l&&Object.keys(l).length&&(n+=Bs("".concat(t,"__").concat(i),l))}),n}function dQ({theme:t,components:e}){let n="";const{tokens:r,name:s,breakpoints:a}=t;return e.forEach(({name:o,theme:i,overrides:l})=>{const u="amplify-".concat(o),c='[data-amplify-theme="'.concat(s,'"] .').concat(u),d=js(i)?i(r):i;n+=Bs(c,d),l&&l.forEach(f=>{const p=js(f.theme)?f.theme(r):f.theme;if("mediaQuery"in f&&(n+="@media (".concat(f.mediaQuery,") {\n ").concat(Bs(c,p)," \n}")),"breakpoint"in f){const h=a.values[f.breakpoint];n+="\n@media (min-width: ".concat(h,"px) {\n ").concat(Bs(c,p)," \n}")}"selector"in f&&(n+=Bs("".concat(f.selector," .").concat(u),p)),"colorMode"in f&&(n+="\n@media (prefers-color-scheme: ".concat(f.colorMode,") {\n").concat(Bs('[data-amplify-theme="'.concat(s,'"][data-amplify-color-mode="system"] .').concat(u),p),"\n}\n"),n+=Bs('[data-amplify-theme="'.concat(s,'"][data-amplify-color-mode="').concat(f.colorMode,'"] .').concat(u),p))})}),n}function gb({keys:t,value:e}){return t.reduce((n,r)=>({...n,[r]:{value:"{colors.".concat(e,".").concat(r,".value}")}}),{})}function fQ({animations:t,tokens:e}){let n="";return Object.entries(t).forEach(([r,s])=>{n+="\n @keyframes ".concat(r," {"),Object.entries(s).forEach(([a,o])=>{n+="\n ".concat(a," {\n");const i=js(o)?o(e):o;n+=Yh(i),n+="\n }"}),n+="\n }"}),n}function jg(t,e=S_){const n=B_([{},e,{...t,components:{}}]),{primaryColor:r,secondaryColor:s}=n;Ya(r)&&(n.tokens.colors.primary=gb({keys:Object.keys(n.tokens.colors[r]),value:r})),Ya(s)&&(n.tokens.colors.secondary=gb({keys:Object.keys(n.tokens.colors[s]),value:s}));const a=Jh({tokens:n.tokens,setupToken:hb}),{breakpoints:o,name:i}=n;let l='[data-amplify-theme="'.concat(i,'"] {\n')+Qh(a).map(c=>"".concat(c.name,": ").concat(c.value,";")).join("\n")+"\n}\n";t!=null&&t.components&&(l+=dQ({theme:{...n,tokens:a},components:t.components}));let u=[];return n.animations&&(l+=fQ({animations:n.animations,tokens:a})),n.overrides&&(u=n.overrides.map(c=>{const d=Jh({tokens:c.tokens,setupToken:hb}),f=Qh(d).map(p=>"".concat(p.name,": ").concat(p.value,";")).join("\n");if("selector"in c&&(l+="\n".concat(c.selector," {\n").concat(f,"\n}\n")),"mediaQuery"in c&&(l+="\n@media (".concat(c.mediaQuery,') {\n [data-amplify-theme="').concat(i,'"] {\n ').concat(f,"\n }\n}\n")),"breakpoint"in c){const p=n.breakpoints.values[c.breakpoint];l+="\n@media (min-width: ".concat(p,'px) {\n [data-amplify-theme="').concat(i,'"] {\n ').concat(f,"\n }\n}\n")}return"colorMode"in c&&(l+="\n@media (prefers-color-scheme: ".concat(c.colorMode,') {\n [data-amplify-theme="').concat(i,'"][data-amplify-color-mode="system"] {\n ').concat(f,"\n color-scheme: ").concat(c.colorMode,";\n }\n }\n"),l+='\n[data-amplify-theme="'.concat(i,'"][data-amplify-color-mode="').concat(c.colorMode,'"] {\n ').concat(f,"\n color-scheme: ").concat(c.colorMode,";\n }\n")),{...c,tokens:d}})),{tokens:a,breakpoints:o,name:i,cssText:l,containerProps:({colorMode:c}={})=>({"data-amplify-theme":i,"data-amplify-color-mode":c}),overrides:u}}const Ht=(...t)=>{const e=[];for(const n of t)if(n){if(Ya(n)){e.push(n);continue}if(typeof n=="number"){e.push(n.toString());continue}if(Array.isArray(n)){e.push(Ht(...n));continue}if(Es(n)){if(n.toString!==Object.prototype.toString&&n.toString()!=="[object Object]"){e.push(n.toString());continue}for(const r in n)ra(n,r)&&n[r]&&e.push(r)}}return e.join(" ")},Oe={Accordion:"amplify-accordion",AccordionItem:"amplify-accordion__item",AccordionItemTrigger:"amplify-accordion__item__trigger",AccordionItemContent:"amplify-accordion__item__content",AccordionItemIcon:"amplify-accordion__item__icon",Alert:"amplify-alert",AlertIcon:"amplify-alert__icon",AlertHeading:"amplify-alert__heading",AlertBody:"amplify-alert__body",AlertDismiss:"amplify-alert__dismiss",Autocomplete:"amplify-autocomplete",AutocompleteMenu:"amplify-autocomplete__menu",AutocompleteMenuEmpty:"amplify-autocomplete__menu--empty",AutocompleteMenuFooter:"amplify-autocomplete__menu__footer",AutocompleteMenuHeader:"amplify-autocomplete__menu__header",AutocompleteMenuLoading:"amplify-autocomplete__menu--loading",AutocompleteMenuOption:"amplify-autocomplete__menu__option",AutocompleteMenuOptions:"amplify-autocomplete__menu__options",Avatar:"amplify-avatar",AvatarIcon:"amplify-avatar__icon",AvatarImage:"amplify-avatar__image",AvatarLoader:"amplify-avatar__loader",AIConversation:"amplify-ai-conversation",AIConversationScrollView:"amplify-ai-conversation__scrollview",AIConversationAttachment:"amplify-ai-conversation__attachment",AIConversationAttachmentList:"amplify-ai-conversation__attachment__list",AIConversationAttachmentImage:"amplify-ai-conversation__attachment__image",AIConversationAttachmentName:"amplify-ai-conversation__attachment__name",AIConversationAttachmentSize:"amplify-ai-conversation__attachment__size",AIConversationAttachmentRemove:"amplify-ai-conversation__attachment__remove",AIConversationForm:"amplify-ai-conversation__form",AIConversationFormAttach:"amplify-ai-conversation__form__attach",AIConversationFormError:"amplify-ai-conversation__form__error",AIConversationFormSend:"amplify-ai-conversation__form__send",AIConversationFormField:"amplify-ai-conversation__form__field",AIConversationFormDropzone:"amplify-ai-conversation__form__dropzone",AIConversationMessage:"amplify-ai-conversation__message",AIConversationMessageAvatar:"amplify-ai-conversation__message__avatar",AIConversationMessageSender:"amplify-ai-conversation__message__sender",AIConversationMessageSenderUsername:"amplify-ai-conversation__message__sender__username",AIConversationMessageSenderTimestamp:"amplify-ai-conversation__message__sender__timestamp",AIConversationMessageBody:"amplify-ai-conversation__message__body",AIConversationMessageContent:"amplify-ai-conversation__message__content",AIConversationMessageActions:"amplify-ai-conversation__message__actions",AIConversationMessageList:"amplify-ai-conversation__message__list",AIConversationPrompt:"amplify-ai-conversation__prompt",Badge:"amplify-badge",Breadcrumbs:"amplify-breadcrumbs",BreadcrumbsList:"amplify-breadcrumbs__list",BreadcrumbsItem:"amplify-breadcrumbs__item",BreadcrumbsSeparator:"amplify-breadcrumbs__separator",BreadcrumbsLink:"amplify-breadcrumbs__link",Button:"amplify-button",ButtonGroup:"amplify-buttongroup",ButtonLoaderWrapper:"amplify-button__loader-wrapper",Card:"amplify-card",Checkbox:"amplify-checkbox",CheckboxButton:"amplify-checkbox__button",CheckboxIcon:"amplify-checkbox__icon",CheckboxInput:"amplify-checkbox__input",CheckboxLabel:"amplify-checkbox__label",CheckboxField:"amplify-checkboxfield",Collection:"amplify-collection",CollectionItems:"amplify-collection-items",CollectionSearch:"amplify-collection-search",CollectionPagination:"amplify-collection-
11146pagination",CountryCodeSelect:"amplify-countrycodeselect",DialCodeSelect:"amplify-dialcodeselect",Divider:"amplify-divider",DividerLabel:"amplify-divider--label",DropZone:"amplify-dropzone",Field:"amplify-field",FieldDescription:"amplify-field__description",FieldErrorMessage:"amplify-field__error-message",FieldGroup:"amplify-field-group",FieldGroupControl:"amplify-field-group__control",FieldGroupOuterEnd:"amplify-field-group__outer-end",FieldGroupOuterStart:"amplify-field-group__outer-start",FieldGroupInnerEnd:"amplify-field-group__inner-end",FieldGroupInnerStart:"amplify-field-group__inner-start",FieldGroupIcon:"amplify-field-group__icon",FieldGroupIconButton:"amplify-field-group__icon-button",FieldGroupHasInnerEnd:"amplify-field-group--has-inner-end",FieldGroupHasInnerStart:"amplify-field-group--has-inner-start",FieldShowPassword:"amplify-field__show-password",FieldGroupFieldWrapper:"amplify-field-group__field-wrapper",Fieldset:"amplify-fieldset",FieldsetLegend:"amplify-fieldset__legend",FileUploader:"amplify-fileuploader",FileUploaderDropZone:"amplify-fileuploader__dropzone",FileUploaderDropZoneIcon:"amplify-fileuploader__dropzone__icon",FileUploaderDropZoneText:"amplify-fileuploader__dropzone__text",FileUploaderFilePicker:"amplify-fileuploader__file__picker",FileUploaderFile:"amplify-fileuploader__file",FileUploaderFileWrapper:"amplify-fileuploader__file__wrapper",FileUploaderFileList:"amplify-fileuploader__file__list",FileUploaderFileName:"amplify-fileuploader__file__name",FileUploaderFileSize:"amplify-fileuploader__file__size",FileUploaderFileInfo:"amplify-fileuploader__file__info",FileUploaderFileImage:"amplify-fileuploader__file__image",FileUploaderFileMain:"amplify-fileuploader__file__main",FileUploaderFileStatus:"amplify-fileuploader__file__status",FileUploaderLoader:"amplify-fileuploader__loader",FileUploaderPreviewer:"amplify-fileuploader__previewer",FileUploaderPreviewerText:"amplify-fileuploader__previewer__text",FileUploaderPreviewerActions:"amplify-fileuploader__previewer__actions",FileUploaderPreviewerFooter:"amplify-fileuploader__previewer__footer",Flex:"amplify-flex",Grid:"amplify-grid",Heading:"amplify-heading",HighlightMatch:"amplify-highlightmatch",HighlightMatchHighlighted:"amplify-highlightmatch__highlighted",Icon:"amplify-icon",Image:"amplify-image",Input:"amplify-input",Label:"amplify-label",Link:"amplify-link",Loader:"amplify-loader",LoaderLabel:"amplify-loader__label",MenuContent:"amplify-menu__content",MenuItem:"amplify-menu__content__item",MenuTrigger:"amplify-menu__trigger",MenuWrapper:"amplify-menu__wrapper",Message:"amplify-message",MessageIcon:"amplify-message__icon",MessageHeading:"amplify-message__heading",MessageBody:"amplify-message__body",MessageContent:"amplify-message__content",MessageDismiss:"amplify-message__dismiss",Pagination:"amplify-pagination",PaginationItem:"amplify-pagination__item",PasswordField:"amplify-passwordfield",PhoneNumberField:"amplify-phonenumberfield",Placeholder:"amplify-placeholder",Radio:"amplify-radio",RadioButton:"amplify-radio__button",RadioInput:"amplify-radio__input",RadioLabel:"amplify-radio__label",RadioGroupField:"amplify-radiogroupfield",RadioGroup:"amplify-radiogroup",Rating:"amplify-rating",RatingItem:"amplify-rating__item",RatingIcon:"amplify-rating__icon",RatingLabel:"amplify-rating__label",ScrollView:"amplify-scrollview",SearchField:"amplify-searchfield",SearchFieldClear:"amplify-searchfield__clear",SearchFieldSearch:"amplify-searchfield__search",Select:"amplify-select",SelectField:"amplify-selectfield",SelectWrapper:"amplify-select__wrapper",SelectIcon:"amplify-select__icon",SliderField:"amplify-sliderfield",SliderFieldGroup:"amplify-sliderfield__group",SliderFieldLabel:"amplify-sliderfield__label",SliderFieldRange:"amplify-sliderfield__range",SliderFieldRoot:"amplify-sliderfield__root",SliderFieldThumb:"amplify-sliderfield__thumb",SliderFieldTrack:"amplify-sliderfield__track",StepperField:"amplify-stepperfield",StepperFieldButtonDecrease:"amplify-stepperfield__button--decrease",StepperFieldButtonIncrease:"amplify-stepperfield__button--increase",StepperFieldInput:"amplify-stepperfield__input",StorageImage:"amplify-storageimage",StorageManager:"amplify-storagemanager",StorageManagerDropZone:"amplify-storagemanager__dropzone",StorageManagerDropZoneIcon:"amplify-storagemanager__dropzone__icon",StorageManagerDropZoneText:"amplify-storagemanager__dropzone__text",StorageManagerFilePicker:"amplify-storagemanager__file__picker",StorageManagerFile:"amplify-storagemanager__file",StorageManagerFileWrapper:"amplify-storagemanager__file__wrapper",StorageManagerFileList:"amplify-storagemanager__file__list",StorageManagerFileName:"amplify-storagemanager__file__name",
11146StorageManagerFileSize:"amplify-storagemanager__file__size",StorageManagerFileInfo:"amplify-storagemanager__file__info",StorageManagerFileImage:"amplify-storagemanager__file__image",StorageManagerFileMain:"amplify-storagemanager__file__main",StorageManagerFileStatus:"amplify-storagemanager__file__status",StorageManagerLoader:"amplify-storagemanager__loader",StorageManagerPreviewer:"amplify-storagemanager__previewer",StorageManagerPreviewerText:"amplify-storagemanager__previewer__text",StorageManagerPreviewerActions:"amplify-storagemanager__previewer__actions",StorageManagerPreviewerFooter:"amplify-storagemanager__previewer__footer",SwitchField:"amplify-switchfield",SwitchLabel:"amplify-switch__label",SwitchThumb:"amplify-switch__thumb",SwitchTrack:"amplify-switch__track",SwitchWrapper:"amplify-switch__wrapper",Table:"amplify-table",TableCaption:"amplify-table__caption",TableBody:"amplify-table__body",TableTd:"amplify-table__td",TableTh:"amplify-table__th",TableFoot:"amplify-table__foot",TableHead:"amplify-table__head",TableRow:"amplify-table__row",Tabs:"amplify-tabs",TabsList:"amplify-tabs__list",TabsItem:"amplify-tabs__item",TabsPanel:"amplify-tabs__panel",Text:"amplify-text",Textarea:"amplify-textarea",TextAreaField:"amplify-textareafield",TextField:"amplify-textfield",ToggleButton:"amplify-togglebutton",ToggleButtonGroup:"amplify-togglebuttongroup",VisuallyHidden:"amplify-visually-hidden"};var ps,or,Aa,$o,Nr,Mo,Bl,qi,Ap,wl,L_,yb,Ma;(function(t){t[t.Scrolling=0]="Scrolling",t[t.Flat=1]="Flat"})(Ma||(Ma={}));class pQ{constructor(e){ps.add(this),or.set(this,void 0),Aa.set(this,void 0),$o.set(this,Ma.Flat),Nr.set(this,0),Mo.set(this,void 0),Bl.set(this,!0),qi.set(this,0),At(this,Mo,e,"f"),At(this,or,e[0],"f"),At(this,Aa,e[0],"f")}async startSequences(e){return new Promise(n=>{setTimeout(()=>{xe(this,ps,"m",L_).call(this,{...e,resolve:n})},Math.min(SC))})}}or=new WeakMap,Aa=new WeakMap,$o=new WeakMap,Nr=new WeakMap,Mo=new WeakMap,Bl=new WeakMap,qi=new WeakMap,ps=new WeakSet,Ap=function(){return xe(this,$o,"f")===Ma.Flat},wl=function(){return xe(this,$o,"f")===Ma.Scrolling},L_=function({onSequenceChange:e,onSequenceColorChange:n,onSequenceStart:r,onSequencesComplete:s,resolve:a}){js(r)&&r();const o=Date.now();let i=o-xe(this,qi,"f");if(xe(this,Bl,"f")&&(At(this,qi,Date.now(),"f"),At(this,Bl,!1,"f"),js(e)&&e({prevSequenceColor:xe(this,Aa,"f").color,sequenceColor:xe(this,or,"f").color,sequenceIndex:xe(this,Nr,"f"),sequenceStartTime:o})),(xe(this,ps,"m",Ap).call(this)&&i>=xe(this,or,"f").flatDisplayDuration||xe(this,ps,"m",wl).call(this)&&i>=xe(this,or,"f").downscrollDuration)&&(xe(this,ps,"m",yb).call(this,{sequenceStartTime:o,onSequenceChange:e}),i=0),xe(this,Nr,"f")<xe(this,Mo,"f").length){const u=i/(xe(this,ps,"m",wl).call(this)?xe(this,or,"f").downscrollDuration:xe(this,or,"f").flatDisplayDuration);js(n)&&n({sequenceColor:xe(this,or,"f").color,heightFraction:u,prevSequenceColor:xe(this,Aa,"f").color}),a(!1)}else js(s)&&s(),a(!0)},yb=function({sequenceStartTime:e,onSequenceChange:n}){At(this,Aa,xe(this,or,"f"),"f"),xe(this,ps,"m",Ap).call(this)?(At(this,Nr,xe(this,Nr,"f")+1,"f"),At(this,$o,Ma.Scrolling,"f")):xe(this,ps,"m",wl).call(this)&&(xe(this,Mo,"f")[xe(this,Nr,"f")].flatDisplayDuration>0?At(this,$o,Ma.Flat,"f"):At(this,Nr,xe(this,Nr,"f")+1,"f")),At(this,or,xe(this,Mo,"f")[xe(this,Nr,"f")],"f"),At(this,qi,Date.now(),"f"),xe(this,or,"f")&&js(n)&&n({prevSequenceColor:xe(this,Aa,"f").color,sequenceColor:xe(this,or,"f").color,sequenceIndex:xe(this,Nr,"f"),sequenceStartTime:e})};const hQ=t=>{var e;return((e=t==null?void 0:t.Challenge)==null?void 0:e.Name)==="FaceMovementAndLightChallenge"},mQ=t=>{var e;return((e=t==null?void 0:t.Challenge)==null?void 0:e.Name)==="FaceMovementChallenge"},gQ=t=>!!(t!=null&&t.FaceMovementAndLightChallenge),yQ=t=>!!(t!=null&&t.FaceMovementChallenge),vQ=t=>{let e;if(gQ(t.Challenge))e={...t.Challenge.FaceMovementAndLightChallenge,Name:xm.type};else if(yQ(t.Challenge))e={...t.Challenge.FaceMovementChallenge,Name:Fu.type};else throw new Error("Unsupported challenge type returned from session information.");
11146if(!e.ChallengeConfig||!e.ChallengeConfig.FaceDistanceThreshold||!e.ChallengeConfig.FaceDistanceThresholdMin||!e.ChallengeConfig.OvalHeightWidthRatio)throw new Error("Challenge config not returned from session information.");return{...t,Challenge:e}},bQ=async t=>{const{data:e,type:n}=t;return{VideoChunk:new Uint8Array(n==="streamVideo"?await e.arrayBuffer():[]),TimestampMillis:n==="closeCode"?e:Date.now()}},vb=t=>{const{height:e,width:n}=t.getVideoTracks()[0].getSettings();if(nc(e)||nc(n))throw new Error("Invalid Track Dimensions. height: ".concat(e,", width: ").concat(n," "));return{trackHeight:e,trackWidth:n}};function W_({trackHeight:t,trackWidth:e,height:n,width:r,top:s,left:a}){return{Height:n/t,Width:r/e,Top:s/t,Left:a/e}}const wQ=(t,e,n)=>t-e-n,z_=t=>{const{trackWidth:e,left:n,width:r}=t;return W_({...t,left:wQ(e,n,r)})},SQ=t=>{const{height:e,width:n,centerX:r,centerY:s}=t;return W_({...t,top:s-e/2,left:r-n/2})};function H_({parsedSessionInformation:t,clientChallenge:e}){if(mQ(t))return{Challenge:{FaceMovementChallenge:e}};if(hQ(t))return{Challenge:{FaceMovementAndLightChallenge:e}};throw new Error("Unable to create ClientSessionInformationEvent")}function xQ({parsedSessionInformation:t,challengeId:e,faceMatchAssociatedParams:n,ovalAssociatedParams:r,recordingEndedTimestamp:s,trackHeight:a,trackWidth:o}){const{initialFace:i,ovalDetails:l}=r,{startFace:u,endFace:c}=n,d=z_({trackHeight:a,trackWidth:o,...i}),f=SQ({trackHeight:a,trackWidth:o,...l}),p={ChallengeId:e,InitialFace:{InitialFaceDetectedTimestamp:i.timestampMs,BoundingBox:d},TargetFace:{FaceDetectedInTargetPositionStartTimestamp:u.timestampMs,FaceDetectedInTargetPositionEndTimestamp:c.timestampMs,BoundingBox:f},VideoEndTimestamp:s};return H_({parsedSessionInformation:t,clientChallenge:p})}function _Q({parsedSessionInformation:t,challengeId:e,ovalAssociatedParams:n,recordingStartedTimestamp:r,trackHeight:s,trackWidth:a}){const{initialFace:o}=n,i=z_({trackHeight:s,trackWidth:a,...o}),l={ChallengeId:e,VideoStartTimestamp:r,InitialFace:{InitialFaceDetectedTimestamp:o.timestampMs,BoundingBox:i}};return H_({parsedSessionInformation:t,clientChallenge:l})}const bb=t=>t.slice(t.indexOf("(")+1,t.indexOf(")")).split(",").map(e=>parseInt(e));function IQ({challengeId:t,sequenceStartTime:e,sequenceIndex:n,sequenceColor:r,prevSequenceColor:s}){const a={RGB:bb(r)},o={RGB:bb(s)};return{Challenge:{FaceMovementAndLightChallenge:{ChallengeId:t,ColorDisplayed:{CurrentColor:a,PreviousColor:o,SequenceNumber:n,CurrentColorStartTimestamp:e}}}}}function kQ(t){const e=t.getReader();return{getRequestStream:async function*(){for(;;){const{done:n,value:r}=await e.read();if(n)return;if(r.type==="sessionInfo")yield{ClientSessionInformationEvent:r.data};else{if(r.type==="streamVideo"&&r.data.size<1)continue;yield{VideoEvent:await bQ(r)}}}}}}function EQ(t){const e=t.signer,n=t.signer,r=Object.assign(t,{eventSigner:e,messageSigner:n}),s=r.eventStreamPayloadHandlerProvider(r);return Object.assign(r,{eventStreamPayloadHandler:s})}const U_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wb=Object.entries(U_).reduce((t,[e,n])=>(t[n]=Number(e),t),{}),TQ=U_.split(""),Vo=6,rc=8,CQ=63,Ja=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;const n=new ArrayBuffer(e),r=new DataView(n);for(let s=0;s<t.length;s+=4){let a=0,o=0;for(let u=s,c=s+3;u<=c;u++)if(t[u]!=="="){if(!(t[u]in wb))throw new TypeError("Invalid character ".concat(t[u]," in base64 string."));a|=wb[t[u]]<<(c-u)*Vo,o+=Vo}else a>>=Vo;const i=s/4*3;a>>=o%rc;const l=Math.floor(o/rc);for(let u=0;u<l;u++){const c=(l-u-1)*rc;r.setUint8(i+u,(a&255<<c)>>c)}}return new Uint8Array(n)},Ts=t=>new TextEncoder().encode(t);function Qa(t){let e;typeof t=="string"?e=Ts(t):e=t;const n=typeof e=="object"&&typeof e.length=="number",r=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!n&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let a=0;a<e.length;a+=3){let o=0,i=0;for(let u=a,c=Math.min(a+3,e.length);u<c;u++)o|=e[u]<<(c-u-1)*rc,i+=rc;const l=Math.ceil(i/Vo);o<<=l*Vo-i;for(let u=1;u<=l;u++){const c=(l-u)*Vo;s+=TQ[(o&CQ<<c)>>c]}s+="==".slice(0,4-l)}return s}function NQ(t,e,n,r){return class Ll extends Uint8Array{static fromString(a,o="utf-8"){if(typeof a=="str
11146ing")return o==="base64"?Ll.mutate(r(a)):Ll.mutate(e(a));throw new Error("Unsupported conversion from ".concat(typeof a," to Uint8ArrayBlobAdapter."))}static mutate(a){return Object.setPrototypeOf(a,Ll.prototype),a}transformToString(a="utf-8"){return a==="base64"?n(this):t(this)}}}const pi=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)},Tn=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function AQ(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{const e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Tn[e[0]]+Tn[e[1]]+Tn[e[2]]+Tn[e[3]]+"-"+Tn[e[4]]+Tn[e[5]]+"-"+Tn[e[6]]+Tn[e[7]]+"-"+Tn[e[8]]+Tn[e[9]]+"-"+Tn[e[10]]+Tn[e[11]]+Tn[e[12]]+Tn[e[13]]+Tn[e[14]]+Tn[e[15]]}}const Zh=t=>{if(t!=null){if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&LQ.warn(BQ("Expected number but observed string: ".concat(t))),e}if(typeof t=="number")return t;throw new TypeError("Expected number, got ".concat(typeof t,": ").concat(t))}},$Q=Math.ceil(2**127*(2-2**-23)),Sb=t=>{const e=Zh(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>$Q)throw new TypeError("Expected 32-bit float, got ".concat(t));return e},RQ=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError("Expected integer, got ".concat(typeof t,": ").concat(t))}},xb=t=>V_(t,16),_b=t=>V_(t,8),V_=(t,e)=>{const n=RQ(t);if(n!==void 0&&DQ(n,e)!==n)throw new TypeError("Expected ".concat(e,"-bit integer, got ").concat(t));return n},DQ=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},FQ=t=>Zh(typeof t=="string"?Yf(t):t),MQ=t=>Sb(typeof t=="string"?Yf(t):t),OQ=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Yf=t=>{const e=t.match(OQ);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Su=t=>xb(typeof t=="string"?Yf(t):t),PQ=t=>_b(typeof t=="string"?Yf(t):t),BQ=t=>String(new TypeError(t).stack||t).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),LQ={warn:console.warn},WQ=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Gg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j_(t){const e=t.getUTCFullYear(),n=t.getUTCMonth(),r=t.getUTCDay(),s=t.getUTCDate(),a=t.getUTCHours(),o=t.getUTCMinutes(),i=t.getUTCSeconds(),l=s<10?"0".concat(s):"".concat(s),u=a<10?"0".concat(a):"".concat(a),c=o<10?"0".concat(o):"".concat(o),d=i<10?"0".concat(i):"".concat(i);return"".concat(WQ[r],", ").concat(l," ").concat(Gg[n]," ").concat(e," ").concat(u,":").concat(c,":").concat(d," GMT")}const zQ=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),HQ=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const e=zQ.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");const[n,r,s,a,o,i,l,u,c]=e,d=Su(Ac(r)),f=Js(s,"month",1,12),p=Js(a,"day",1,31),h=Wl(d,f,p,{hours:o,minutes:i,seconds:l,fractionalMilliseconds:u});return c.toUpperCase()!="Z"&&h.setTime(h.getTime()-eZ(c)),h},UQ=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),VQ=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),jQ=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),G_=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=UQ.exec(t);if(e){const[n,r,s,a,o,i,l,u]=e;return Wl(Su(Ac(a)),$p(s),Js(r,"day",1,31),{hours:o,minutes:i,seconds:l,fractionalMilliseconds:u})}if(e=VQ.exec(t),e){const[n,r,s,a,o,i,l,u]=e;return XQ(Wl(qQ(a),$p(s),Js(r,"day",1,31),{hours:o,minutes:i,seconds:l,fractionalMilliseconds:u}))}if(e=jQ.exec(t),e){const[n,r,s,a,o,i,l,u]=e;return Wl(Su(Ac(u)),$p(r),Js(s.trimLeft(),"day",1,31),{hours:a,minutes:o,seconds:i,fractionalMilliseconds:l})}throw new TypeError("Invalid RFC-7231 date-time value")},GQ=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=FQ(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Wl=(t,e,n,r)=>{const s=e-1;return JQ(t,s,n),new Date(Date.UTC(t,s,n,Js(r.hours,"hour",0,23),Js(r.minutes,"minute",0,59),Js(r.seconds,"seconds",0,60),ZQ(r.fractionalMilliseconds)))},qQ=t=>{const e=new Date().getUTCFullYear(),n=Math.floor(e/100)*100+Su(Ac(t));return n<e?n+100:n},KQ=50*365*24*60*60*1e3,XQ=t=>t.getTime()-new Date().getTime()>KQ?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,$p=t=>{const e=Gg.indexOf(t);if(e<0)throw new TypeError("Invalid month: ".concat(t));return e+1},YQ=[31,28,31,30,31,30,31,31,30,31,30,31],JQ=(t,e,n)=>{let r=YQ[e];if(e===1&&QQ(t)&&(r=29),n>r)throw new TypeError("Invalid day for ".concat(Gg[e]," in ").concat(t,": ").concat(n))},QQ=t=>t%4===0&&(t%100!==0||t%400===0),Js=(t,e,n,r)=>{const s=PQ(Ac(t));if(s<n||s>r)throw new TypeError("".concat(e," must be between ").concat(n," and ").concat(r,", inclusive"));return s},ZQ=t=>t==null?0:MQ("0."+t)*1e3,eZ=t=>{const e=t[0];let n=1;if(e=="+")n=1;else if(e=="-")n=-1;else throw new TypeError("Offset direction, ".concat(e,', must be "+" or "-"'));const r=Number(t.substring(1,3)),s=Number(t.substring(4,6));return n*(r*60+s)*60*1e3},Ac=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)},Zr=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};Zr.from=t=>t&&typeof t=="object"&&(t instanceof Zr||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?Zr(String(t)):Zr(JSON.stringify(t));Zr.fromObject=Zr.from;function tZ(t){return(t.includes(",")||t.includes('"'))&&(t='"'.concat(t.replace(/"/g,'\\"'),'"')),t}const qg="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",Kg="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",Xg="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",q_="(\\d?\\d)",K_="(\\d{4})",nZ=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),rZ=new RegExp("^".concat(qg,", ").concat(q_," ").concat(Kg," ").concat(K_," ").concat(Xg," GMT$")),sZ=new RegExp("^".concat(qg,", ").concat(q_,"-").concat(Kg,"-(\\d\\d) ").concat(Xg," GMT$")),aZ=new RegExp("^".concat(qg," ").concat(Kg," ( [1-9]|\\d\\d) ").concat(Xg," ").concat(K_,"$")),oZ=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],iZ=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},cZ=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");const e=nZ.exec(t);if(!e)throw new TypeError("Invalid RFC3339 timestamp format ".concat(t));const[,n,r,s,a,o,i,,l,u]=e;ys(r,1,12),ys(s,1,31),ys(a,0,23),ys(o,0,59),ys(i,0,60);const c=new Date(Date.UTC(Number(n),Number(r)-1,Number(s),Number(a),Number(o),Number(i),Number(l)?Math.round(parseFloat("0.".concat(l))*1e3):0));if(c.setUTCFullYear(Number(n)),u.toUpperCase()!="Z"){const[,d,f,p]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],h=d==="-"?1:-1;c.setTime(c.getTime()+h*(Number(f)*60*60*1e3+Number(p)*60*1e3))}return c},lZ=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,n,r,s,a,o,i,l;if((l=rZ.exec(t))?[,e,n,r,s,a,o,i]=l:(l=sZ.exec(t))?([,e,n,r,s,a,o,i]=l,r=(Number(r)+1900).toString()):(l=aZ.exec(t))&&([,n,e,s,a,o,i,r]=l),r&&o){const u=Date.UTC(Number(r),oZ.indexOf(n),Number(e),Number(s),Number(a),Number(o),i?Math.round(parseFloat("0.".concat(i))*1e3):0);ys(e,1,31),ys(s,0,23),ys(a,0,59),ys(o,0,60);const c=new Date(u);return c.setUTCFullYear(Number(r)),c}throw new TypeError("Invalid RFC7231 date-time value ".concat(t,"."))};function ys(t,e,n){const r=Number(t);if(r<e||r>n)throw new Error("Value ".concat(r," out of range [").concat(e,", ").concat(n,"]"))}function uZ(t,e,n){if(n<=0||!Number.isInteger(n))throw new Error("Invalid number of delimiters ("+n+") for splitEvery.");const r=t.split(e);
11146if(n===1)return r;const s=[];let a="";for(let o=0;o<r.length;o++)a===""?a=r[o]:a+=e+r[o],(o+1)%n===0&&(s.push(a),a="");return a!==""&&s.push(a),s}const X_=t=>{const e=t.length,n=[];let r=!1,s,a=0;for(let o=0;o<e;++o){const i=t[o];switch(i){case'"':s!=="\\"&&(r=!r);break;case",":r||(n.push(t.slice(a,o)),a=o+1);break}s=i}return n.push(t.slice(a)),n.map(o=>{o=o.trim();const i=o.length;return i<2?o:(o[0]==='"'&&o[i-1]==='"'&&(o=o.slice(1,i-1)),o.replace(/\\"/g,'"'))})},Ib=/^-?\d*(\.\d+)?$/;class Dr{constructor(e,n){U(this,"string");U(this,"type");if(this.string=e,this.type=n,!Ib.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;const n=e;return Dr.prototype.isPrototypeOf(e)||n.type==="bigDecimal"&&Ib.test(n.string)}}const Y_={},em={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e="0".concat(e)),Y_[t]=e,em[e]=t}function Jf(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2){const r=t.slice(n,n+2).toLowerCase();if(r in em)e[n/2]=em[r];else throw new Error("Cannot decode unrecognized sequence ".concat(r," as hexadecimal"))}return e}function en(t){let e="";for(let n=0;n<t.byteLength;n++)e+=Y_[t[n]];return e}const kb=typeof TextEncoder=="function"?new TextEncoder:null,dZ=t=>{if(typeof t=="string"){if(kb)return kb.encode(t).byteLength;let e=t.length;for(let n=e-1;n>=0;n--){const r=t.charCodeAt(n);r>127&&r<=2047?e++:r>2047&&r<=65535&&(e+=2),r>=56320&&r<=57343&&n--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error("Body Length computation failed for ".concat(t))},as=t=>typeof t=="string"?Ts(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),J_=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";var $c;(function(t){t.HTTP="http",t.HTTPS="https"})($c||($c={}));var Rc;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Rc||(Rc={}));const tm="__smithy_context",hi=t=>t[tm]||(t[tm]={});class fn{constructor(e){U(this,"method");U(this,"protocol");U(this,"hostname");U(this,"port");U(this,"path");U(this,"query");U(this,"headers");U(this,"username");U(this,"password");U(this,"fragment");U(this,"body");this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?"".concat(e.protocol,":"):e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?"/".concat(e.path):e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const n=new fn({...e,headers:{...e.headers}});return n.query&&(n.query=fZ(n.query)),n}static isInstance(e){if(!e)return!1;const n=e;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n.query=="object"&&typeof n.headers=="object"}clone(){return fn.clone(this)}}function fZ(t){return Object.keys(t).reduce((e,n)=>{const r=t[n];return{...e,[n]:Array.isArray(r)?[...r]:r}},{})}let Za=class{constructor(e){U(this,"statusCode");U(this,"reason");U(this,"headers");U(this,"body");this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const n=e;return typeof n.statusCode=="number"&&typeof n.headers=="object"}};const pZ=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Qf=(t,e=!1)=>{if(!e)return pZ.test(t);const n=t.split(".");for(const r of n)if(!Qf(r))return!1;return!0},Or=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e};function hZ(t){const e={};if(t=t.replace(/^\?/,""),t)for(const n of t.split("&")){let[r,s=null]=n.split("=");r=decodeURIComponent(r),s&&(s=decodeURIComponent(s)),r in e?Array.isArray(e[r])?e[r].push(s):e[r]=[e[r],s]:e[r]=s}return e}const xu=t=>{if(typeof t=="string")return xu(new URL(t));const{hostname:e,pathname:n,port:r,protocol:s,search:a}=t;let o;return a&&(o=hZ(a)),{hostname:e,port:r?parseInt(r):void 0,protocol:s,path:n,query:o}},Yg=t=>
11146{if(typeof t=="object"){if("url"in t){const e=xu(t.url);if(t.headers){e.headers={};for(const n in t.headers)e.headers[n.toLowerCase()]=t.headers[n].join(", ")}return e}return t}return xu(t)},Q_=async t=>{},mZ=async t=>{const e=(t==null?void 0:t.Bucket)||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),wZ(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!bZ(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},gZ=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,yZ=/(\d+\.){3}\d+/,vZ=/\.\./,bZ=t=>gZ.test(t)&&!yZ.test(t)&&!vZ.test(t),wZ=t=>{const[e,n,r,,,s]=t.split(":"),a=e==="arn"&&t.split(":").length>=6,o=!!(a&&n&&r&&s);if(a&&!o)throw new Error("Invalid ARN: ".concat(t," was an invalid ARN."));return o},SZ=(t,e,n,r=!1)=>{const s=async()=>{var o,i;let a;if(r){const l=n.clientContextParams,u=l==null?void 0:l[t];a=(o=u!=null?u:n[t])!=null?o:n[e]}else a=(i=n[t])!=null?i:n[e];return typeof a=="function"?a():a};return t==="credentialScope"||e==="CredentialScope"?async()=>{var i;const a=typeof n.credentials=="function"?await n.credentials():n.credentials;return(i=a==null?void 0:a.credentialScope)!=null?i:a==null?void 0:a.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{var i;const a=typeof n.credentials=="function"?await n.credentials():n.credentials;return(i=a==null?void 0:a.accountId)!=null?i:a==null?void 0:a.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(n.isCustomEndpoint===!1)return;const a=await s();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){const{protocol:o,hostname:i,port:l,path:u}=a;return"".concat(o,"//").concat(i).concat(l?":"+l:"").concat(u)}}return a}:s};function xZ(t){return async(e,n,r,s)=>{var i;if(!r.isCustomEndpoint){let l;r.serviceConfiguredEndpoint?l=await r.serviceConfiguredEndpoint():l=await t(r.serviceId),l&&(r.endpoint=()=>Promise.resolve(Yg(l)),r.isCustomEndpoint=!0)}const a=await _Z(e,n,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");const o=r.endpointProvider(a,s);if(r.isCustomEndpoint&&r.endpoint){const l=await r.endpoint();if(l!=null&&l.headers){(i=o.headers)!=null||(o.headers={});for(const[u,c]of Object.entries(l.headers))o.headers[u]=Array.isArray(c)?c:[c]}}return o}}const _Z=async(t,e,n)=>{var a;const r={},s=((a=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:a.call(e))||{};for(const[o,i]of Object.entries(s))switch(i.type){case"staticContextParams":r[o]=i.value;break;case"contextParams":r[o]=t[i.name];break;case"clientContextParams":case"builtInParams":r[o]=await SZ(i.name,o,n,i.type!=="builtInParams")();break;case"operationContextParams":r[o]=i.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(s).length===0&&Object.assign(r,n),String(n.serviceId).toLowerCase()==="s3"&&await mZ(r),r};function IZ(t,e,n){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=n}function kZ(t){const e=xZ(t);return({config:n,instructions:r})=>(s,a)=>async o=>{var u,c,d;n.isCustomEndpoint&&IZ(a,"ENDPOINT_OVERRIDE","N");const i=await e(o.input,{getEndpointParameterInstructions(){return r}},{...n},a);a.endpointV2=i,a.authSchemes=(u=i.properties)==null?void 0:u.authSchemes;const l=(c=a.authSchemes)==null?void 0:c[0];if(l){a.signing_region=l.signingRegion,a.signing_service=l.signingName;const f=hi(a),p=(d=f==null?void 0:f.selectedHttpAuthScheme)==null?void 0:d.httpAuthOption;p&&(p.signingProperties=Object.assign(p.signingProperties||{},{signing_region:l.signingRegion,signingRegion:l.signingRegion,signing_service:l.signingName,signingName:l.signingName,signingRegionSet:l.signingRegionSet},l.properties))}return s({...o})}}const EZ={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},TZ={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:EZ.name};function CZ(t){const e=kZ(t);return(n,r)=>({applyToStack:s=>{s.addRelativeTo(e({config:n,instructions:r}),TZ)}})}function NZ(t){return e=>{var c;const n=(c=e.tls)!=null?c:!0,{endpoint:r,useDualstackEndpoint:s,useFipsEndpoint:a}=e,o=r!=null?async()=>Yg(await Or(r)()):void 0,l=Object.assign(e,{endpoint:o,tls:n,isCustomEndpoint:!!r,useDualstackEndpoint:Or(s!=null?s:!1),useFipsEndpoint:Or(a!=null?a:!1)});let u;return l.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=t(e.serviceId)),u),l}}class AZ{constructor({size:e,params:n}){U(this,"capacity");U(this,"data",new Map);U(this,"parameters",[]);this.capacity=e!=null?e:50,n&&(this.parameters=n)}get(e,n){const r=this.hash(e);if(r===!1)return n();if(!this.data.has(r)){if(this.data.size>this.capacity+10){const s=this.data.keys();let a=0;for(;;){const{value:o,done:i}=s.next();if(this.data.delete(o),i||++a>10)break}}this.data.set(r,n())}return this.data.get(r)}size(){return this.data.size}hash(e){var s;let n="";const{parameters:r}=this;if(r.length===0)return!1;for(const a of r){const o=String((s=e[a])!=null?s:"");if(o.includes("|;"))return!1;n+=o+"|;"}return n}}
11146class ur extends Error{constructor(e){super(e),this.name="EndpointError"}}const Dc="endpoints";function sa(t){return typeof t!="object"||t==null?t:"ref"in t?"$".concat(sa(t.ref)):"fn"in t?"".concat(t.fn,"(").concat((t.argv||[]).map(sa).join(", "),")"):JSON.stringify(t,null,2)}const Jg={},$Z=(t,e)=>t===e;function RZ(...t){for(const e of t)if(e!=null)return e}const DZ=t=>{const e=t.split("."),n=[];for(const r of e){const s=r.indexOf("[");if(s!==-1){if(r.indexOf("]")!==r.length-1)throw new ur("Path: '".concat(t,"' does not end with ']'"));const a=r.slice(s+1,-1);if(Number.isNaN(parseInt(a)))throw new ur("Invalid array index: '".concat(a,"' in path: '").concat(t,"'"));s!==0&&n.push(r.slice(0,s)),n.push(a)}else n.push(r)}return n},Z_=(t,e)=>DZ(e).reduce((n,r)=>{if(typeof n!="object")throw new ur("Index '".concat(r,"' in '").concat(e,"' not found in '").concat(JSON.stringify(t),"'"));if(Array.isArray(n)){const s=parseInt(r);return n[s<0?n.length+s:s]}return n[r]},t),FZ=t=>t!=null;function MZ(t,e,n){return t?e:n}const OZ=t=>!t,PZ=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),eI=t=>PZ.test(t)||t.startsWith("[")&&t.endsWith("]"),Rp={[$c.HTTP]:80,[$c.HTTPS]:443},BZ=t=>{const e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){const{hostname:f,port:p,protocol:h="",path:m="",query:g={}}=t,v=new URL("".concat(h,"//").concat(f).concat(p?":".concat(p):"").concat(m));return v.search=Object.entries(g).map(([b,w])=>"".concat(b,"=").concat(w)).join("&"),v}return new URL(t)}catch(f){return null}})();if(!e)return console.error("Unable to parse ".concat(JSON.stringify(t)," as a whatwg URL.")),null;const n=e.href,{host:r,hostname:s,pathname:a,protocol:o,search:i}=e;if(i)return null;const l=o.slice(0,-1);if(!Object.values($c).includes(l))return null;const u=eI(s),c=n.includes("".concat(r,":").concat(Rp[l]))||typeof t=="string"&&t.includes("".concat(r,":").concat(Rp[l])),d="".concat(r).concat(c?"
11146:".concat(Rp[l]):"");return{scheme:l,authority:d,path:a,normalizedPath:a.endsWith("/")?a:"".concat(a,"/"),isIp:u}};function LZ(t,e,n){if(n===1)return[t];if(t==="")return[""];const r=t.split(e);return n===0?r:r.slice(0,n-1).concat(r.slice(1).join(e))}const WZ=(t,e)=>t===e,zZ=(t,e,n,r)=>t==null||e>=n||t.length<n||/[^\u0000-\u007f]/.test(t)?null:r?t.substring(t.length-n,t.length-e):t.substring(e,n),HZ=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>"%".concat(e.charCodeAt(0).toString(16).toUpperCase())),UZ={booleanEquals:$Z,coalesce:RZ,getAttr:Z_,isSet:FZ,isValidHostLabel:Qf,ite:MZ,not:OZ,parseURL:BZ,split:LZ,stringEquals:WZ,substring:zZ,uriEncode:HZ},tI=(t,e)=>{var o,i;const n=[],{referenceRecord:r,endpointParams:s}=e;let a=0;for(;a<t.length;){const l=t.indexOf("{",a);if(l===-1){n.push(t.slice(a));break}n.push(t.slice(a,l));const u=t.indexOf("}",l);if(u===-1){n.push(t.slice(l));break}t[l+1]==="{"&&t[u+1]==="}"&&(n.push(t.slice(l+1,u)),a=u+2);const c=t.substring(l+1,u);if(c.includes("#")){const[d,f]=c.split("#");n.push(Z_((o=r[d])!=null?o:s[d],f))}else n.push((i=r[c])!=null?i:s[c]);a=u+1}return n.join("")},VZ=({ref:t},e)=>{var n;return(n=e.referenceRecord[t])!=null?n:e.endpointParams[t]},Zf=(t,e,n)=>{if(typeof t=="string")return tI(t,n);if(t.fn)return rI.callFunction(t,n);if(t.ref)return VZ(t,n);throw new ur("'".concat(e,"': ").concat(String(t)," is not a string, function or reference."))},nI=({fn:t,argv:e},n)=>{const r=Array(e.length);for(let o=0;o<r.length;++o){const i=e[o];typeof i=="boolean"||typeof i=="number"?r[o]=i:r[o]=rI.evaluateExpression(i,"arg",n)}const s=t.indexOf(".");if(s!==-1){const o=Jg[t.slice(0,s)],i=o==null?void 0:o[t.slice(s+1)];if(typeof i=="function")return i(...r)}const a=UZ[t];if(typeof a=="function")return a(...r);throw new Error("function ".concat(t," not loaded in endpointFunctions."))},rI={evaluateExpression:Zf,callFunction:nI},jZ=(t,e)=>{var a,o;const{assign:n}=t;if(n&&n in e.referenceRecord)throw new ur("'".concat(n,"' is already defined in Reference Record."));const r=nI(t,e);(o=(a=e.logger)==null?void 0:a.debug)==null||o.call(a,"".concat(Dc," evaluateCondition: ").concat(sa(t)," = ").concat(sa(r)));const s=r===""?!0:!!r;return n!=null?{result:s,toAssign:{name:n,value:r}}:{result:s}},GZ=(t,e)=>Object.entries(t!=null?t:{}).reduce((n,[r,s])=>(n[r]=s.map(a=>{const o=Zf(a,"Header value entry",e);if(typeof o!="string")throw new ur("Header '".concat(r,"' value '").concat(o,"' is not a string"));return o}
11146),n),{}),sI=(t,e)=>Object.entries(t).reduce((n,[r,s])=>(n[r]=oI.getEndpointProperty(s,e),n),{}),aI=(t,e)=>{if(Array.isArray(t))return t.map(n=>aI(n,e));switch(typeof t){case"string":return tI(t,e);case"object":if(t===null)throw new ur("Unexpected endpoint property: ".concat(t));return oI.getEndpointProperties(t,e);case"boolean":return t;default:throw new ur("Unexpected endpoint property type: ".concat(typeof t))}},oI={getEndpointProperty:aI,getEndpointProperties:sI},qZ=(t,e)=>{const n=Zf(t,"Endpoint URL",e);if(typeof n=="string")try{return new URL(n)}catch(r){throw console.error("Failed to construct URL with ".concat(n),r),r}throw new ur("Endpoint URL must be a string, got ".concat(typeof n))},Qg=(t=[],e)=>{var a,o;const n={},r={...e,referenceRecord:{...e.referenceRecord}};let s=!1;for(const i of t){const{result:l,toAssign:u}=jZ(i,r);if(!l)return{result:l};u&&(s=!0,n[u.name]=u.value,r.referenceRecord[u.name]=u.value,(o=(a=e.logger)==null?void 0:a.debug)==null||o.call(a,"".concat(Dc," assign: ").concat(u.name," := ").concat(sa(u.value))))}return s?{result:!0,referenceRecord:n}:{result:!0}},KZ=(t,e)=>{var d,f;const{conditions:n,endpoint:r}=t,{result:s,referenceRecord:a}=Qg(n,e);if(!s)return;const o=a?{...e,referenceRecord:{...e.referenceRecord,...a}}:e,{url:i,properties:l,headers:u}=r;(f=(d=e.logger)==null?void 0:d.debug)==null||f.call(d,"".concat(Dc," Resolving endpoint from template: ").concat(sa(r)));const c={url:qZ(i,o)};return u!=null&&(c.headers=GZ(u,o)),l!=null&&(c.properties=sI(l,o)),c},XZ=(t,e)=>{const{conditions:n,error:r}=t,{result:s,referenceRecord:a}=Qg(n,e);if(!s)return;const o=a?{...e,referenceRecord:{...e.referenceRecord,...a}}:e;throw new ur(Zf(r,"Error",o))},iI=(t,e)=>{for(const n of t)if(n.type==="endpoint"){const r=KZ(n,e);if(r)return r}else if(n.type==="error")XZ(n,e);else if(n.type==="tree"){const r=cI.evaluateTreeRule(n,e);if(r)return r}else throw new ur("Unknown endpoint rule: ".concat(n));throw new ur("Rules evaluation failed")},YZ=(t,e)=>{const{conditions:n,rules:r}=t,{result:s,referenceRecord:a}=Qg(n,e);if(!s)return;const o=a?{...e,referenceRecord:{...e.referenceRecord,...a}}:e;return cI.evaluateRules(r,o)},cI={evaluateRules:iI,evaluateTreeRule:YZ},JZ=(t,e)=>{var i,l,u,c;const{endpointParams:n,logger:r}=e,{parameters:s,rules:a}=t;(l=(i=e.logger)==null?void 0:i.debug)==null||l.call(i,"".concat(Dc," Initial EndpointParams: ").concat(sa(n)));for(const d in s){const f=s[d],p=n[d];if(p==null&&f.default!=null){n[d]=f.default;continue}if(f.required&&p==null)throw new ur("Missing required parameter: '".concat(d,"'"))}const o=iI(a,{endpointParams:n,logger:r,referenceRecord:{}});return(c=(u=e.logger)==null?void 0:u.debug)==null||c.call(u,"".concat(Dc," Resolved endpoint: ").concat(sa(o))),o},QZ=NZ(Q_),ZZ=CZ(Q_),Eb=t=>{var e;return typeof ReadableStream=="function"&&(((e=t==null?void 0:t.constructor)==null?void 0:e.name)===ReadableStream.name||t instanceof ReadableStream)},eee=async t=>{var e;return typeof Blob=="function"&&t instanceof Blob||((e=t.constructor)==null?void 0:e.name)==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):tee(t):nee(t)};async function tee(t){const e=await ree(t),n=Ja(e);return new Uint8Array(n)}async function nee(t){const e=[],n=t.getReader();let r=!1,s=0;for(;!r;){const{done:i,value:l}=await n.read();l&&(e.push(l),s+=l.length),r=i}const a=new Uint8Array(s);let o=0;for(const i of e)a.set(i,o),o+=i.length;return a}function ree(t){return new Promise((e,n)=>{const r=new FileReader;r.onloadend=()=>{var i;if(r.readyState!==2)return n(new Error("Reader aborted too early"));const s=(i=r.result)!=null?i:"",a=s.indexOf(","),o=a>-1?a+1:s.length;e(s.substring(o))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>
11146n(r.error),r.readAsDataURL(t)})}const Tb="The stream has already been transformed.",see=t=>{var s,a;if(!Cb(t)&&!Eb(t)){const o=((a=(s=t==null?void 0:t.__proto__)==null?void 0:s.constructor)==null?void 0:a.name)||t;throw new Error("Unexpected stream implementation, expect Blob or ReadableStream, got ".concat(o))}let e=!1;const n=async()=>{if(e)throw new Error(Tb);return e=!0,await eee(t)},r=o=>{if(typeof o.stream!="function")throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return o.stream()};return Object.assign(t,{transformToByteArray:n,transformToString:async o=>{const i=await n();if(o==="base64")return Qa(i);if(o==="hex")return en(i);if(o===void 0||o==="utf8"||o==="utf-8")return pi(i);if(typeof TextDecoder=="function")return new TextDecoder(o).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(Tb);if(e=!0,Cb(t))return r(t);if(Eb(t))return t;throw new Error("Cannot transform payload to web stream, got ".concat(t))}})},Cb=t=>typeof Blob=="function"&&t instanceof Blob;class Dp extends NQ(pi,Ts,Qa,Ja){}const aee=t=>crypto.getRandomValues(t),lI=AQ(aee),uI=lI,Ki=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return Dp.mutate(t);if(!t)return Dp.mutate(new Uint8Array);const n=e.streamCollector(t);return Dp.mutate(await n)};function Nb(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const Fp=t=>typeof t=="function"?t():t,dI=(t,e,n,r,s)=>({name:e,namespace:t,traits:n,input:r,output:s}),oee=t=>(e,n)=>async r=>{var d,f,p,h;const{response:s}=await e(r),{operationSchema:a}=hi(n),[,o,i,l,u,c]=a!=null?a:[];try{const m=await t.protocol.deserializeResponse(dI(o,i,l,u,c),{...t,...n},s);return{response:s,output:m}}catch(m){if(Object.defineProperty(m,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in m)){const g="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{m.message+="\n "+g}catch(v){!n.logger||((f=(d=n.logger)==null?void 0:d.constructor)==null?void 0:f.name)==="NoOpLogger"?console.warn(g):(h=(p=n.logger)==null?void 0:p.warn)==null||h.call(p,g)}typeof m.$responseBodyText<"u"&&m.$response&&(m.$response.body=m.$responseBodyText);try{if(Za.isInstance(s)){const{headers:v={},statusCode:b}=s,w=Object.entries(v);m.$metadata={httpStatusCode:b,requestId:Mp(/^x-[\w-]+-request-?id$/,w),extendedRequestId:Mp(/^x-[\w-]+-id-2$/,w),cfId:Mp(/^x-[\w-]+-cf-id$/,w)}}}catch(v){}}throw m}},Mp=(t,e)=>(e.find(([n])=>n.match(t))||[void 0,void 0])[1],iee=t=>
11146(e,n)=>async r=>{const{operationSchema:s}=hi(n),[,a,o,i,l,u]=s!=null?s:[],c=n.endpointV2?async()=>Yg(n.endpointV2):t.endpoint,d=await t.protocol.serializeRequest(dI(a,o,i,l,u),r.input,{...t,...n,endpoint:c});return e({...r,request:d})},cee={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},lee={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function uee(t){return{applyToStack:e=>{e.add(iee(t),lee),e.add(oee(t),cee),t.protocol.setSerdeContext(t)}}}const Op=[];function Oo(t){if(typeof t=="object")return t;if(t=t|0,Op[t])return Op[t];const e={};let n=0;for(const r of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>n++&1)===1&&(e[r]=1);return Op[t]=e}const Di={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},Pp=[],Bp={},Ws=class Ws{constructor(e,n){U(this,"ref");U(this,"memberName");U(this,"symbol",Ws.symbol);U(this,"name");U(this,"schema");U(this,"_isMemberSchema");U(this,"traits");U(this,"memberTraits");U(this,"normalizedTraits");var o;this.ref=e,this.memberName=n;const r=[];let s=e,a=e;for(this._isMemberSchema=!1;Lp(s);)r.push(s[1]),s=s[0],a=Fp(s),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let i=r.length-1;i>=0;--i){const l=r[i];Object.assign(this.memberTraits,Oo(l))}}else this.memberTraits=0;if(a instanceof Ws){const i=this.memberTraits;Object.assign(this,a),this.memberTraits=Object.assign({},i,a.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=n!=null?n:a.memberName;return}if(this.schema=Fp(a),dee(this.schema)?(this.name="".concat(this.schema[1],"#").concat(this.schema[2]),this.traits=this.schema[3]):(this.name=(o=this.memberName)!=null?o:String(a),this.traits=0),this._isMemberSchema&&!n)throw new Error("@smithy/core/schema - NormalizedSchema member init ".concat(this.getName(!0)," missing member name."))}static[Symbol.hasInstance](e){const n=this.prototype.isPrototypeOf(e);return!n&&typeof e=="object"&&e!==null?e.symbol===this.symbol:n}static of(e){const n=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(Pp[e])return Pp[e]}else if(typeof e=="string"){if(Bp[e])return Bp[e]}else if(n&&e[Di.ns])return e[Di.ns];const r=Fp(e);if(r instanceof Ws)return r;if(Lp(r)){const[a,o]=r;if(a instanceof Ws)return Object.assign(a.getMergedTraits(),Oo(o)),a;throw new Error("@smithy/core/schema - may not init unwrapped member schema=".concat(JSON.stringify(e,null,2),"."))}const s=new Ws(r);return n?e[Di.ns]=s:typeof r=="string"?Bp[r]=s:typeof r=="number"?Pp[r]=s:s}getSchema(){const e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){const{name:n}=this;return!e&&n&&n.includes("#")?n.split("#")[1]:n||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){const e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){const e=this.getSchema();if(typeof e!="object")return!1;const n=e[0];return n===3||n===-3||n===4}isUnionSchema(){const e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){const e=this.getSchema();return e===21||e===42}isTimestampSchema(){const e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:e}=this.getMergedTraits();
11146return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){var e;return(e=this.normalizedTraits)!=null?e:this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()}}getMemberTraits(){return Oo(this.memberTraits)}getOwnTraits(){return Oo(this.traits)}getKeySchema(){var a;const[e,n]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!n)throw new Error("@smithy/core/schema - cannot get key for non-map: ".concat(this.getName(!0)));const r=this.getSchema(),s=e?15:(a=r[4])!=null?a:0;return Fi([s,0],"key")}getValueSchema(){const e=this.getSchema(),[n,r,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],a=typeof e=="number"?63&e:e&&typeof e=="object"&&(r||s)?e[3+e[0]]:n?15:void 0;if(a!=null)return Fi([a,0],r?"value":"member");throw new Error("@smithy/core/schema - ".concat(this.getName(!0)," has no value member."))}getMemberSchema(e){const n=this.getSchema();if(this.isStructSchema()&&n[4].includes(e)){const r=n[4].indexOf(e),s=n[5][r];return Fi(Lp(s)?s:[s,0],e)}if(this.isDocumentSchema())return Fi([15,0],e);throw new Error("@smithy/core/schema - ".concat(this.getName(!0)," has no member=").concat(e,"."))}getMemberSchemas(){const e={};try{for(const[n,r]of this.structIterator())e[n]=r}catch(n){}return e}getEventStreamMember(){if(this.isStructSchema()){for(const[e,n]of this.structIterator())if(n.isStreaming()&&n.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema(),n=e[4].length;let r=e[Di.it];if(r&&n===r.length){yield*r;return}r=Array(n);for(let s=0;s<n;++s){const a=e[4][s],o=Fi([e[5][s],0],a);yield r[s]=[a,o]}e[Di.it]=r}};U(Ws,"symbol",Symbol.for("@smithy/nor"));let Kt=Ws;function Fi(t,e){if(t instanceof Kt)return Object.assign(t,{memberName:e,_isMemberSchema:!0});const n=Kt;return new n(t,e)}const Lp=t=>Array.isArray(t)&&t.length===2,dee=t=>Array.isArray(t)&&t.length>=5,qr=class qr{constructor(e,n=new Map,r=new Map){U(this,"namespace");U(this,"schemas");U(this,"exceptions");this.namespace=e,this.schemas=n,this.exceptions=r}static for(e){return qr.registries.has(e)||qr.registries.set(e,new qr(e)),qr.registries.get(e)}copyFrom(e){const{schemas:n,exceptions:r}=this;for(const[s,a]of e.schemas)n.has(s)||n.set(s,a);for(const[s,a]of e.exceptions)r.has(s)||r.set(s,a)}register(e,n){const r=this.normalizeShapeId(e);for(const s of[this,qr.for(r.split("#")[0])])s.schemas.set(r,n)}getSchema(e){const n=this.normalizeShapeId(e);if(!this.schemas.has(n)){if(!e.includes("#")){const r="#"+e,s=[];for(const[a,o]of this.schemas.entries())a.endsWith(r)&&s.push(o);if(s.length===1)return s[0]}throw new Error("@smithy/core/schema - schema not found for ".concat(n))}return this.schemas.get(n)}registerError(e,n){const r=e,s=r[1];for(const a of[this,qr.for(s)])a.schemas.set(s+"#"+r[2],r),a.exceptions.set(r,n)}getErrorCtor(e){const n=e;return this.exceptions.has(n)?this.exceptions.get(n):qr.for(n[1]).exceptions.get(n)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,n,r]=e,s=n+"#"+r;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(const n of this.schemas.values())if(e(n))return n}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};U(qr,"registries",new Map);let er=qr;class ep{constructor(){U(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}class fee extends ep{constructor(n){var r;super();U(this,"options");U(this,"compositeErrorRegistry");this.options=n,this.compositeErrorRegistry=er.for(n.defaultNamespace);for(const s of(r=n.errorTypeRegistries)!=null?r:[])this.compositeErrorRegistry.copyFrom(s)}getRequestType(){return fn}getResponseType(){return Za}setSerdeContext(n){this.serdeContext=n,this.serializer.setSerdeContext(n),this.deserializer.setSerdeContext(n),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(n)}updateServiceEndpoint(n,r){if("url"in r){n.protocol=r.url.protocol,n.hostname=r.url.hostname,n.port=r.url.port?Number(r.url.port):void 0,n.path=r.url.pathname,n.fragment=r.url.hash||void 0,n.username=r.url.username||void 0,n.password=r.url.password||void 0,n.query||(n.query={});
11146for(const[s,a]of r.url.searchParams.entries())n.query[s]=a;if(r.headers)for(const s in r.headers)n.headers[s]=r.headers[s].join(", ");return n}else{if(n.protocol=r.protocol,n.hostname=r.hostname,n.port=r.port?Number(r.port):void 0,n.path=r.path,n.query={...r.query},r.headers)for(const s in r.headers)n.headers[s]=r.headers[s];return n}}setHostPrefix(n,r,s){var i,l,u;if((i=this.serdeContext)!=null&&i.disableHostPrefix)return;const a=Kt.of(r.input),o=Oo((l=r.traits)!=null?l:{});if(o.endpoint){let c=(u=o.endpoint)==null?void 0:u[0];if(typeof c=="string"){for(const[d,f]of a.structIterator()){if(!f.getMergedTraits().hostLabel)continue;const p=s[d];if(typeof p!="string")throw new Error("@smithy/core/schema - ".concat(d," in input must be a string as hostLabel."));c=c.replace("{".concat(d,"}"),p)}n.hostname=c+n.hostname}}}deserializeMetadata(n){var r,s;return{httpStatusCode:n.statusCode,requestId:(s=(r=n.headers["x-amzn-requestid"])!=null?r:n.headers["x-amzn-request-id"])!=null?s:n.headers["x-amz-request-id"],extendedRequestId:n.headers["x-amz-id-2"],cfId:n.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:n,requestSchema:r,initialRequest:s}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:n,requestSchema:r,initialRequest:s})}async deserializeEventStream({response:n,responseSchema:r,initialResponseContainer:s}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:n,responseSchema:r,initialResponseContainer:s})}async loadEventStreamCapability(){const{EventStreamSerde:n,eventStreamSerdeProvider:r}=await v3(()=>import("./index.browser-4b29618d.js"),["static/index.browser-4b29618d.js","static/vendor-4e86cbe6.js","static/index-37dfafe8.js","static/index-e784dbd5.css"]),s=this.resolveEventStreamMarshaller(r);return new n({marshaller:s,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(n){const r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:n(this.serdeContext)}getDefaultContentType(){throw new Error("@smithy/core/protocols - ".concat(this.constructor.name," getDefaultContentType() implementation missing."))}async deserializeHttpMessage(n,r,s,a,o){return[]}getEventStreamMarshaller(){const n=this.serdeContext;if(!n.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return n.eventStreamMarshaller}}class pee extends fee{async serializeRequest(e,n,r){var m,g;const s=n&&typeof n=="object"?n:{},a=this.serializer,o={},i={},l=await r.endpoint(),u=Kt.of(e==null?void 0:e.input),c=[],d=[];let f=!1,p;const h=new fn({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:o,headers:i,body:void 0});if(l){this.updateServiceEndpoint(h,l),this.setHostPrefix(h,e,s);const v=Oo(e.traits);if(v.http){h.method=v.http[0];const[b,w]=v.http[1].split("?");h.path=="/"?h.path=b:h.path+=b;const S=new URLSearchParams(w!=null?w:"");for(const[I,E]of S)o[I]=E}}for(const[v,b]of u.structIterator()){const w=(m=b.getMergedTraits())!=null?m:{},S=s[v];if(S==null&&!b.isIdempotencyToken()){if(w.httpLabel&&(h.path.includes("{".concat(v,"+}"))||h.path.includes("{".concat(v,"}"))))throw new Error("No value provided for input HTTP label: ".concat(v,"."));continue}if(w.httpPayload)b.isStreaming()?b.isStructSchema()?s[v]&&(p=await this.serializeEventStream({eventStream:s[v],requestSchema:u})):p=S:(a.write(b,S),p=a.flush());else if(w.httpLabel){a.write(b,S);const I=a.flush();h.path.includes("{".concat(v,"+}"))?h.path=h.path.replace("{".concat(v,"+}"),I.split("/").map(Nb).join("/")):h.path.includes("{".concat(v,"}"))&&(h.path=h.path.replace("{".concat(v,"}"),Nb(I)))}else if(w.httpHeader)a.write(b,S),i[w.httpHeader.toLowerCase()]=String(a.flush());else if(typeof w.httpPrefixHeaders=="string")for(const I in S){const E=S[I],T=w.httpPrefixHeaders+I;a.write([b.getValueSchema(),{httpHeader:T}],E),i[T.toLowerCase()]=a.flush()}else w.httpQuery||w.httpQueryParams?this.serializeQuery(b,S,o):(f=!0,c.push(v),d.push(b))}if(f&&s){const[v,b]=((g=u.getName(!0))!=null?g:"#Unknown").split("#"),w=u.getSchema()[6],S=[3,v,b,u.getMergedTraits(),c,d,void 0];w?S[6]=w:S.pop(),a.write(S,s),p=a.flush()}return h.headers=i,h.query=o,h.body=p,h}serializeQuery(e,n,r){const s=this.serializer,a=e.getMergedTraits();if(a.httpQueryParams){for(const o in n)if(!(o in r)){const i=n[o],l=e.getValueSchema();Object.assign(l.getMergedTraits(),{...a,httpQuery:o,httpQueryParams:void 0}),this.serializeQuery(l,i,r)}return}if(e.isListSchema()){const o=!!e.getMergedTraits().sparse,i=[];for(const l of n){s.write([e.getValueSchema(),a],l);const u=s.flush();(o||u!==void 0)&&i.push(u)}r[a.httpQuery]=i}else s.write([e,a],n),r[a.httpQuery]=s.flush()}async deserializeResponse(e,n,r){const s=this.deserializer,a=Kt.of(e.output),o={};if(r.statusCode>=300){const l=await Ki(r.body,n);throw l.byteLength>0&&Object.assign(o,await s.read(15,l)),await this.handleError(e,n,r,o,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const l in r.headers){const u=r.headers[l];delete r.headers[l],r.headers[l.toLowerCase()]=u}const i=await this.deserializeHttpMessage(a,n,r,o);if(i.length){const l=await Ki(r.body,n);if(l.byteLength>0){const u=await s.read(a,l);for(const c of i)u[c]!=null&&(o[c]=u[c])}}else i.discardResponseBody&&await Ki(r.body,n);return o.$metadata=this.deserializeMetadata(r),o}async deserializeHttpMessage(e,n,r,s,a){let o;s instanceof Set?o=a:o=s;let i=!0;const l=this.deserializer,u=Kt.of(e),c=[];for(const[d,f]of u.structIterator()){const p=f.getMemberTraits();if(p.httpPayload){if(i=!1,f.isStreaming())f.isStructSchema()?o[d]=await this.deserializeEventStream({response:r,responseSchema:u}):o[d]=see(r.body);else if(r.body){const m=await Ki(r.body,n);m.byteLength>0&&(o[d]=await l.read(f,m))}}else if(p.httpHeader){const h=String(p.httpHeader).toLowerCase(),m=r.headers[h];if(m!=null)if(f.isListSchema()){const g=f.getValueSchema();g.getMergedTraits().httpHeader=h;let v;g.isTimestampSchema()&&g.getSchema()===4?v=uZ(m,",",2):v=X_(m);const b=[];for(const w of v)b.push(await l.read(g,w.trim()));o[d]=b}else o[d]=await l.read(f,m)}
11146else if(p.httpPrefixHeaders!==void 0){o[d]={};for(const h in r.headers)if(h.startsWith(p.httpPrefixHeaders)){const m=r.headers[h],g=f.getValueSchema();g.getMergedTraits().httpHeader=h,o[d][h.slice(p.httpPrefixHeaders.length)]=await l.read(g,m)}}else p.httpResponseCode?o[d]=r.statusCode:c.push(d)}return c.discardResponseBody=i,c}}function tp(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();const{httpLabel:n,httpPrefixHeaders:r,httpHeader:s,httpQuery:a}=t.getMergedTraits(),o=e.httpBindings?typeof r=="string"||s?6:a||n?5:void 0:void 0;return o!=null?o:e.timestampFormat.default}class hee extends ep{constructor(n){super();U(this,"settings");this.settings=n}read(n,r){var a,o;const s=Kt.of(n);if(s.isListSchema())return X_(r).map(i=>this.read(s.getValueSchema(),i));if(s.isBlobSchema())return((o=(a=this.serdeContext)==null?void 0:a.base64Decoder)!=null?o:Ja)(r);if(s.isTimestampSchema())switch(tp(s,this.settings)){case 5:return cZ(r);case 6:return lZ(r);case 7:return iZ(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(s.isStringSchema()){const i=s.getMergedTraits().mediaType;let l=r;if(i)return s.getMergedTraits().httpHeader&&(l=this.base64ToUtf8(l)),(i==="application/json"||i.endsWith("+json"))&&(l=Zr.from(l)),l}return s.isNumericSchema()?Number(r):s.isBigIntegerSchema()?BigInt(r):s.isBigDecimalSchema()?new Dr(r,"bigDecimal"):s.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(n){var r,s,a,o;return((s=(r=this.serdeContext)==null?void 0:r.utf8Encoder)!=null?s:pi)(((o=(a=this.serdeContext)==null?void 0:a.base64Decoder)!=null?o:Ja)(n))}}class mee extends ep{constructor(n,r){super();U(this,"codecDeserializer");U(this,"stringDeserializer");
11146this.codecDeserializer=n,this.stringDeserializer=new hee(r)}setSerdeContext(n){this.stringDeserializer.setSerdeContext(n),this.codecDeserializer.setSerdeContext(n),this.serdeContext=n}read(n,r){var i,l,u,c;const s=Kt.of(n),a=s.getMergedTraits(),o=(l=(i=this.serdeContext)==null?void 0:i.utf8Encoder)!=null?l:pi;if(a.httpHeader||a.httpResponseCode)return this.stringDeserializer.read(s,o(r));if(a.httpPayload){if(s.isBlobSchema()){const d=(c=(u=this.serdeContext)==null?void 0:u.utf8Decoder)!=null?c:Ts;return typeof r=="string"?d(r):r}else if(s.isStringSchema())return"byteLength"in r?o(r):r}return this.codecDeserializer.read(s,r)}}class gee extends ep{constructor(n){super();U(this,"settings");U(this,"stringBuffer","");this.settings=n}write(n,r){var a,o,i,l;const s=Kt.of(n);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(s.isTimestampSchema()){if(!(r instanceof Date))throw new Error("@smithy/core/protocols - received non-Date value ".concat(r," when schema expected Date in ").concat(s.getName(!0)));switch(tp(s,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=j_(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(s.isBlobSchema()&&"byteLength"in r){this.stringBuffer=((o=(a=this.serdeContext)==null?void 0:a.base64Encoder)!=null?o:Qa)(r);return}if(s.isListSchema()&&Array.isArray(r)){let d="";for(const f of r){this.write([s.getValueSchema(),s.getMergedTraits()],f);const p=this.flush(),h=s.getValueSchema().isTimestampSchema()?p:tZ(p);d!==""&&(d+=", "),d+=h}this.stringBuffer=d;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":const u=s.getMergedTraits().mediaType;let c=r;if(u&&((u==="application/json"||u.endsWith("+json"))&&(c=Zr.from(c)),s.getMergedTraits().httpHeader)){this.stringBuffer=((l=(i=this.serdeContext)==null?void 0:i.base64Encoder)!=null?l:Qa)(c.toString());return}this.stringBuffer=r;break;default:s.isIdempotencyToken()?this.stringBuffer=uI():this.stringBuffer=String(r)}}flush(){const n=this.stringBuffer;return this.stringBuffer="",n}}class yee{constructor(e,n,r=new gee(n)){U(this,"codecSerializer");U(this,"stringSerializer");U(this,"buffer");
11146this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,n){const r=Kt.of(e),s=r.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(r,n),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(r,n)}flush(){if(this.buffer!==void 0){const e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}const vee=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,n){var r;(r=t.httpHandler)==null||r.updateHttpClientConfig(e,n)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),bee=t=>({httpHandler:t.httpHandler()}),Ab="content-length";function wee(t){return e=>async n=>{const r=n.request;if(fn.isInstance(r)){const{body:s,headers:a}=r;if(s&&Object.keys(a).map(o=>o.toLowerCase()).indexOf(Ab)===-1)try{const o=t(s);r.headers={...r.headers,[Ab]:String(o)}}catch(o){}}return e({...n,request:r})}}const See={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},xee=t=>({applyToStack:e=>{e.add(wee(t.bodyLengthChecker),See)}}),Pr=t=>encodeURIComponent(t).replace(/[!'()*]/g,_ee),_ee=t=>"%".concat(t.charCodeAt(0).toString(16).toUpperCase());function fI(t){const e=[];for(let n of Object.keys(t).sort()){const r=t[n];if(n=Pr(n),Array.isArray(r))for(let s=0,a=r.length;s<a;s++)e.push("".concat(n,"=").concat(Pr(r[s])));else{let s=n;(r||typeof r=="string")&&(s+="=".concat(Pr(r))),e.push(s)}}return e.join("&")}const Iee=t=>(e,n)=>async r=>{const{request:s}=r;return fn.isInstance(s)?t.eventStreamPayloadHandler.handle(e,r,n):e(r)},kee={tags:["EVENT_STREAM","SIGNATURE","HANDLE"],name:"eventStreamHandlingMiddleware",relation:"after",toMiddleware:"awsAuthMiddleware",override:!0},Eee=t=>async e=>{const{request:n}=e;return fn.isInstance(n)?(n.headers={...n.headers,"content-type":"application/vnd.amazon.eventstream","x-amz-content-sha256":"STREAMING-AWS4-HMAC-SHA256-EVENTS"},t({...e,request:n})):t(e)},Tee={step:"build",tags:["EVENT_STREAM","HEADER","CONTENT_TYPE","CONTENT_SHA256"],name:"eventStreamHeaderMiddleware",override:!0},Cee=t=>({applyToStack:e=>{e.addRelativeTo(Iee(t),kee),e.add(Eee,Tee)}});const Nee=t=>e=>async n=>{if(!fn.isInstance(n.request))return e(n);const{request:r}=n,{handlerProtocol:s=""}=t.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let a=r.hostname;r.port!=null&&(a+=":".concat(r.port)),r.headers.host=a}return e(n)},Aee={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},$ee=t=>({applyToStack:e=>{e.add(Nee(t),Aee)}}),Ree=()=>(t,e)=>async n=>{var r,s;try{const a=await t(n),{clientName:o,commandName:i,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:d}=u,f=c!=null?c:e.inputFilterSensitiveLog,p=d!=null?d:e.outputFilterSensitiveLog,{$metadata:h,...m}=a.output;return(r=l==null?void 0:l.info)==null||r.call(l,{clientName:o,commandName:i,input:f(n.input),output:p(m),metadata:h}),a}catch(a){const{clientName:o,commandName:i,logger:l,dynamoDbDocumentClientOptions:u={}}=e,{overrideInputFilterSensitiveLog:c}=u,d=c!=null?c:e.inputFilterSensitiveLog;throw(s=l==null?void 0:l.error)==null||s.call(l,{clientName:o,commandName:i,input:d(n.input),error:a,metadata:a.$metadata}),a}},Dee={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Fee=t=>({applyToStack:e=>{e.add(Ree(),Dee)}}),Mee={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Oee=()=>t=>async e=>t(e),Pee=t=>({applyToStack:e=>{e.add(Oee(),Mee)}}),Bee=(t,e)=>{if(!e||e.length===0)return t;const n=[];for(const r of e)for(const s of t)s.schemeId.split("#")[1]===r&&n.push(s);for(const r of t)n.find(({schemeId:s})=>s===r.schemeId)||n.push(r);return n};function Lee(t){const e=new Map;for(const n of t)e.set(n.schemeId,n);return e}const Wee=(t,e)=>(n,r)=>async s=>{var d;const a=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,r,s.input)),o=t.authSchemePreference?await t.authSchemePreference():[],i=Bee(a,o),l=Lee(t.httpAuthSchemes),u=hi(r),c=[];for(const f of i){const p=l.get(f.schemeId);if(!p){c.push("HttpAuthScheme `".concat(f.schemeId,"` was not enabled for this service."));continue}
11146const h=p.identityProvider(await e.identityProviderConfigProvider(t));if(!h){c.push("HttpAuthScheme `".concat(f.schemeId,"` did not have an IdentityProvider configured."));continue}const{identityProperties:m={},signingProperties:g={}}=((d=f.propertiesExtractor)==null?void 0:d.call(f,t,r))||{};f.identityProperties=Object.assign(f.identityProperties||{},m),f.signingProperties=Object.assign(f.signingProperties||{},g),u.selectedHttpAuthScheme={httpAuthOption:f,identity:await h(f.identityProperties),signer:p.signer};break}if(!u.selectedHttpAuthScheme)throw new Error(c.join("\n"));return n(s)},zee={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},Hee=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(Wee(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:n}),zee)}}),Uee=t=>e=>{throw e},Vee=(t,e)=>{},jee=t=>(e,n)=>async r=>{if(!fn.isInstance(r.request))return e(r);const a=hi(n).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:i,signer:l}=a,u=await e({...r,request:await l.sign(r.request,i,o)}).catch((l.errorHandler||Uee)(o));return(l.successHandler||Vee)(u.response,o),u},Gee={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},qee=t=>({applyToStack:e=>{e.addRelativeTo(jee(),Gee)}}),sc=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e};class Kee{constructor(e){U(this,"authSchemes",new Map);for(const n in e){const r=e[n];r!==void 0&&this.authSchemes.set(n,r)}}getIdentityProvider(e){return this.authSchemes.get(e)}}const Xee=t=>function(n){return pI(n)&&n.expiration.getTime()-Date.now()<t},Yee=3e5,Jee=Xee(Yee),pI=t=>t.expiration!==void 0,Qee=(t,e,n)=>{if(t===void 0)return;const r=typeof t!="function"?async()=>Promise.resolve(t):t;let s,a,o,i=!1;const l=async u=>{a||(a=r(u));try{s=await a,o=!0,i=!1}finally{a=void 0}return s};return e===void 0?async u=>((!o||u!=null&&u.forceRefresh)&&(s=await l(u)),s):async u=>((!o||u!=null&&u.forceRefresh)&&(s=await l(u)),i?s:n(s)?(e(s)&&await l(u),s):(i=!0,s))},Zee=void 0;function ete(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function tte(t){var r;const e=sc((r=t.userAgentAppId)!=null?r:Zee),{customUserAgent:n}=t;return Object.assign(t,{customUserAgent:typeof n=="string"?[[n]]:n,userAgentAppId:async()=>{var a,o;const s=await e();if(!ete(s)){const i=((o=(a=t.logger)==null?void 0:a.constructor)==null?void 0:o.name)==="NoOpLogger"||!t.logger?console:t.logger;typeof s!="string"?i==null||i.warn("userAgentAppId must be a string or undefined."):s.length>50&&(i==null||i.warn("The provided userAgentAppId exceeds the maximum length of 50 characters."))}return s}})}const hI=(t,e=!1)=>{if(e){for(const n of t.split("."))if(!hI(n))return!1;return!0}return!(!Qf(t)||t.length<3||t.length>63||t!==t.toLowerCase()||eI(t))},$b=":",nte="/",rte=t=>{const e=t.split($b);if(e.length<6)return null;const[n,r,s,a,o,...i]=e;if(n!=="arn"||r===""||s===""||i.join($b)==="")return null;const l=i.map(u=>u.split(nte)).flat();return{partition:r,service:s,region:a,accountId:o,resourceId:l}},ste=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supp
11146ortsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],ate="1.1",ote={partitions:ste,version:ate};let ite=ote;const cte=t=>{const{partitions:e}=ite;for(const r of e){const{regions:s,outputs:a}=r;for(const[o,i]of Object.entries(s))if(o===t)return{...a,...i}}for(const r of e){const{regionRegex:s,outputs:a}=r;if(new RegExp(s).test(t))return{...a}}const n=e.find(r=>r.id==="aws");if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},mI={isVirtualHostableS3Bucket:hI,parseArn:rte,partition:cte};Jg.aws=mI;function lte(t,e,n){return t.$source||(t.$source={}),t.$source[e]=n,t}function jr(t,e,n){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=n}const Rb=t=>{var e,n,r;return Za.isInstance(t)?(r=(e=t.headers)==null?void 0:e.date)!=null?r:(n=t.headers)==null?void 0:n.Date:void 0},gI=t=>new Date(Date.now()+t),ute=(t,e)=>Math.abs(gI(e).getTime()-t)>=3e5,Db=(t,e)=>{const n=Date.parse(t);return ute(n,e)?n-Date.now():e},ac=(t,e)=>{if(!e)throw new Error("Property `".concat(t,"` is not resolved for AWS SDK SigV4Auth"));return e},dte=async t=>{var u,c,d;const e=ac("context",t.context),n=ac("config",t.config),r=(d=(c=(u=e.endpointV2)==null?void 0:u.properties)==null?void 0:c.authSchemes)==null?void 0:d[0],a=await ac("signer",n.signer)(r),o=t==null?void 0:t.signingRegion,i=t==null?void 0:t.signingRegionSet,l=t==null?void 0:t.signingName;return{config:n,signer:a,signingRegion:o,signingRegionSet:i,signingName:l}};class fte{async sign(e,n,r){var d,f,p,h;if(!fn.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await dte(r),{config:a,signer:o}=s;let{signingRegion:i,signingName:l}=s;const u=r.context;if((f=(d=u==null?void 0:u.authSchemes)==null?void 0:d.length)!=null?f:0>1){const[m,g]=u.authSchemes;(m==null?void 0:m.name)==="sigv4a"&&(g==null?void 0:g.name)==="sigv4"&&(i=(p=g==null?void 0:g.signingRegion)!=null?p:i,l=(h=g==null?void 0:g.signingName)!=null?h:l)}return await o.sign(e,{signingDate:gI(a.systemClockOffset),signingRegion:i,signingService:l})}errorHandler(e){return n=>{var s;const r=(s=n.ServerTime)!=null?s:Rb(n.$response);if(r){const a=ac("config",e.config),o=a.systemClockOffset;a.systemClockOffset=Db(r,a.systemClockOffset),a.systemClockOffset!==o&&n.$metadata&&(n.$metadata.clockSkewCorrected=!0)}throw n}}successHandler(e,n){const r=Rb(e);
11146if(r){const s=ac("config",n.config);s.systemClockOffset=Db(r,s.systemClockOffset)}}}const pte=(t,e,n)=>{let r,s,a,o=!1;const i=async()=>{s||(s=t());try{r=await s,a=!0,o=!1}finally{s=void 0}return r};return e===void 0?async l=>((!a||l!=null&&l.forceRefresh)&&(r=await i()),r):async l=>((!a||l!=null&&l.forceRefresh)&&(r=await i()),o?r:n&&!n(r)?(o=!0,r):(e(r)&&await i(),r))},xa=(t,e)=>{const n=[];if(t&&n.push(t),e)for(const r of e)n.push(r);return n},Os=(t,e)=>"".concat(t||"anonymous").concat(e&&e.length>0?" (a.k.a. ".concat(e.join(","),")"):""),_u=()=>{let t=[],e=[],n=!1;const r=new Set,s=d=>d.sort((f,p)=>Fb[p.step]-Fb[f.step]||Mb[p.priority||"normal"]-Mb[f.priority||"normal"]),a=d=>{let f=!1;const p=h=>{const m=xa(h.name,h.aliases);if(m.includes(d)){f=!0;for(const g of m)r.delete(g);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},o=d=>{let f=!1;const p=h=>{if(h.middleware===d){f=!0;for(const m of xa(h.name,h.aliases))r.delete(m);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},i=d=>{var f;return t.forEach(p=>{d.add(p.middleware,{...p})}),e.forEach(p=>{d.addRelativeTo(p.middleware,{...p})}),(f=d.identifyOnResolve)==null||f.call(d,c.identifyOnResolve()),d},l=d=>{const f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...l(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...l(p))}),f},u=(d=!1)=>{const f=[],p=[],h={};return t.forEach(g=>{const v={...g,before:[],after:[]};for(const b of xa(v.name,v.aliases))h[b]=v;f.push(v)}),e.forEach(g=>{const v={...g,before:[],after:[]};for(const b of xa(v.name,v.aliases))h[b]=v;p.push(v)}),p.forEach(g=>{if(g.toMiddleware){const v=h[g.toMiddleware];if(v===void 0){if(d)return;throw new Error("".concat(g.toMiddleware," is not found when adding ")+"".concat(Os(g.name,g.aliases)," ")+"middleware ".concat(g.relation," ").concat(g.toMiddleware))}g.relation==="after"&&v.after.push(g),g.relation==="before"&&v.before.push(g)}}),s(f).map(l).reduce((g,v)=>(g.push(...v),g),[])},c={add:(d,f={})=>{const{name:p,override:h,aliases:m}=f,g={step:"initialize",priority:"normal",middleware:d,...f},v=xa(p,m);if(v.length>0){if(v.some(b=>r.has(b))){if(!h)throw new Error("Duplicate middleware name '".concat(Os(p,m),"'"));for(const b of v){const w=t.findIndex(I=>{var E;return I.name===b||((E=I.aliases)==null?void 0:E.some(T=>T===b))});if(w===-1)continue;const S=t[w];if(S.step!==g.step||g.priority!==S.priority)throw new Error('"'.concat(Os(S.name,S.aliases),'" middleware with ')+"".concat(S.priority," priority in ").concat(S.step," step cannot ")+'be overridden by "'.concat(Os(p,m),'" middleware with ')+"".concat(g.priority," priority in ").concat(g.step," step."));t.splice(w,1)}}for(const b of v)r.add(b)}t.push(g)},addRelativeTo:(d,f)=>{const{name:p,override:h,aliases:m}=f,g={middleware:d,...f},v=xa(p,m);if(v.length>0){if(v.some(b=>r.has(b))){if(!h)throw new Error("Duplicate middleware name '".concat(Os(p,m),"'"));for(const b of v){const w=e.findIndex(I=>{var E;return I.name===b||((E=I.aliases)==null?void 0:E.some(T=>T===b))});if(w===-1)continue;const S=e[w];if(S.toMiddleware!==g.toMiddleware||S.relation!==g.relation)throw new Error('"'.concat(Os(S.name,S.aliases),'" middleware ')+"".concat(S.relation,' "').concat(S.toMiddleware,'" middleware cannot be overridden ')+'by "'.concat(Os(p,m),'" middleware ').concat(g.relation," ")+'"'.concat(g.toMiddleware,'" middleware.'));e.splice(w,1)}}for(const b of v)r.add(b)}e.push(g)},clone:()=>i(_u()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?a(d):o(d),removeByTag:d=>{let f=!1;const p=h=>{const{tags:m,name:g,aliases:v}=h;if(m&&m.includes(d)){const b=xa(g,v);for(const w of b)r.delete(w);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{var p,h;const f=i(_u());return f.use(d),f.identifyOnResolve(n||f.identifyOnResolve()||((h=(p=d.identifyOnResolve)==null?void 0:p.call(d))!=null?h:!1)),f},applyToStack:i,identify:()=>u(!0).map(d=>{var p;const f=(p=d.step)!=null?p:d.relation+" "+d.toMiddleware;return Os(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(n=d),n},resolve:(d,f)=>{for(const p of u().map(h=>h.middleware).reverse())d=p(d,f);return n&&console.log(c.identify()),d}};return c},Fb={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Mb={high:3,normal:2,low:1},hte=t=>()=>Promise.reject(t);class mte{constructor(e){U(this,"config");U(this,"middlewareStack",_u());U(this,"initConfig");U(this,"handlers");this.config=e;const{protocol:n,protocolSettings:r}=e;r&&typeof n=="function"&&(e.protocol=new n(r))}send(e,n,r){const s=typeof n!="function"?n:void 0,a=typeof n=="function"?n:r,o=s===void 0&&this.config.cacheMiddleware===!0;let i;if(o){this.handlers||(this.handlers=new WeakMap);const l=this.handlers;l.has(e.constructor)?i=l.get(e.constructor):(i=e.resolveMiddleware(this.middlewareStack,this.config,s),l.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(a)i(e).then(l=>a(null,l.output),l=>a(l)).catch(()=>{});else return i(e).then(l=>l.output)}destroy(){var e,n,r;(r=(n=(e=this.config)==null?void 0:e.requestHandler)==null?void 0:n.destroy)==null||r.call(n),delete this.handlers}}const Wp="***SensitiveInformation***";function nm(t,e){if(e==null)return e;const n=Kt.of(t);if(n.getMergedTraits().sensitive)return Wp;
11146if(n.isListSchema()){if(!!n.getValueSchema().getMergedTraits().sensitive)return Wp}else if(n.isMapSchema()){if(!!n.getKeySchema().getMergedTraits().sensitive||!!n.getValueSchema().getMergedTraits().sensitive)return Wp}else if(n.isStructSchema()&&typeof e=="object"){const r=e,s={};for(const[a,o]of n.structIterator())r[a]!=null&&(s[a]=nm(o,r[a]));return s}return e}class yI{constructor(){U(this,"middlewareStack",_u());U(this,"schema")}static classBuilder(){return new gte}resolveMiddlewareWithContext(e,n,r,{middlewareFn:s,clientName:a,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:c,CommandCtor:d}){for(const v of s.bind(this)(d,e,n,r))this.middlewareStack.use(v);const f=e.concat(this.middlewareStack),{logger:p}=n,h={logger:p,clientName:a,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:l,[tm]:{commandInstance:this,...u},...c},{requestHandler:m}=n;let g=r!=null?r:{};return u.eventStream&&(g={isEventStream:!0,...g}),f.resolve(v=>m.handle(v.request,g),h)}}class gte{constructor(){U(this,"_init",()=>{});U(this,"_ep",{});U(this,"_middlewareFn",()=>[]);U(this,"_commandName","");U(this,"_clientName","");U(this,"_additionalContext",{});U(this,"_smithyContext",{});U(this,"_inputFilterSensitiveLog");U(this,"_outputFilterSensitiveLog");U(this,"_serializer",null);U(this,"_deserializer",null);U(this,"_operationSchema")}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,n,r={}){return this._smithyContext={service:e,operation:n,...r},this}c(e={}){return this._additionalContext=e,this}n(e,n){return this._clientName=e,this._commandName=n,this}f(e=r=>r,n=r=>r){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=n,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let n;return n=class extends yI{constructor(...[s]){super();U(this,"input");U(this,"serialize",e._serializer);U(this,"deserialize",e._deserializer);this.input=s!=null?s:{},e._init(this),this.schema=e._operationSchema}static getEndpointParameterInstructions(){return e._ep}resolveMiddleware(s,a,o){var c,d,f,p;const i=e._operationSchema,l=(c=i==null?void 0:i[4])!=null?c:i==null?void 0:i.input,u=(d=i==null?void 0:i[5])!=null?d:i==null?void 0:i.output;return this.resolveMiddlewareWithContext(s,a,o,{CommandCtor:n,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:(f=e._inputFilterSensitiveLog)!=null?f:i?nm.bind(null,l):h=>h,outputFilterSensitiveLog:(p=e._outputFilterSensitiveLog)!=null?p:i?nm.bind(null,u):h=>h,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}class Po extends Error{constructor(n){super(n.message);U(this,"$fault");U(this,"$response");U(this,"$retryable");U(this,"$metadata");Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=n.name,this.$fault=n.$fault,this.$metadata=n.$metadata}static isInstance(n){if(!n)return!1;const r=n;return Po.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](n){if(!n)return!1;const r=n;return this===Po?Po.isInstance(n):Po.isInstance(n)?r.name&&this.name?this.prototype.isPrototypeOf(n)||r.name===this.name:this.prototype.isPrototypeOf(n):!1}}const Ob=(t,e={})=>{Object.entries(e).filter(([,r])=>r!==void 0).forEach(([r,s])=>{(t[r]==null||t[r]==="")&&(t[r]=s)});const n=t.message||t.Message||"UnknownError";return t.message=n,delete t.Message,t},yte=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},vI=Object.values(Rc),vte=t=>{var n;const e=[];for(const r in Rc){const s=Rc[r];t[s]!==void 0&&e.push({algorithmId:()=>s,checksumConstructor:()=>t[s]})}for(const[r,s]of Object.entries((n=t.checksumAlgorithms)!=null?n:{}))e.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){var o;t.checksumAlgorithms=(o=t.checksumAlgorithms)!=null?o:{};const s=r.algorithmId(),a=r.checksumConstructor();vI.includes(s)?t.checksumAlgorithms[s.toUpperCase()]=a:t.checksumAlgorithms[s]=a,e.push(r)},checksumAlgorithms(){return e}}},bte=t=>{const e={};
11146return t.checksumAlgorithms().forEach(n=>{const r=n.algorithmId();vI.includes(r)&&(e[r]=n.checksumConstructor())}),e},wte=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),Ste=t=>{const e={};return e.retryStrategy=t.retryStrategy(),e},xte=t=>Object.assign(vte(t),wte(t)),_te=t=>Object.assign(bte(t),Ste(t));class bI{trace(){}debug(){}info(){}warn(){}error(){}}const Pb=new Set,Ite=(t,e=Qf)=>{if(!Pb.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error('Region not accepted: region="'.concat(t,'" is not a valid hostname component.'));else Pb.add(t)},wI=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),kte=t=>wI(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,Ete=t=>{const{region:e,useFipsEndpoint:n}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{const r=typeof e=="function"?await e():e,s=kte(r);return Ite(s),s},useFipsEndpoint:async()=>{const r=typeof e=="string"?e:await e();return wI(r)?!0:typeof n!="function"?Promise.resolve(!!n):n()}})},Tte=["in-region","cross-region","mobile","standard","legacy"],Cte=({defaultsMode:t}={})=>pte(async()=>{const e=typeof t=="function"?await t():t;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(Nte()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e==null?void 0:e.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error('Invalid parameter for "defaultsMode", expect '.concat(Tte.join(", "),", got ").concat(e))}}),Nte=()=>{var e;const t=window==null?void 0:window.navigator;if(t!=null&&t.connection){const{effectiveType:n,rtt:r,downlink:s}=t==null?void 0:t.connection;if(typeof n=="string"&&n!=="4g"||Number(r)>100||Number(s)<10)return!0}return((e=t==null?void 0:t.userAgentData)==null?void 0:e.mobile)||typeof(t==null?void 0:t.maxTouchPoints)=="number"&&(t==null?void 0:t.maxTouchPoints)>1},Ate=!1,$te=!1;let Rte=class{format(e){const n=[];for(const a of Object.keys(e)){const o=Ts(a);n.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[a]))}const r=new Uint8Array(n.reduce((a,o)=>a+o.byteLength,0));let s=0;for(const a of n)r.set(a,s),s+=a.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,e.value,!1),new Uint8Array(n.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(a.buffer);return o.set(e.value,3),o;case"string":const i=Ts(e.value),l=new DataView(new ArrayBuffer(3+i.byteLength));l.setUint8(0,7),l.setUint16(1,i.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(i,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(Fte.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Dte.test(e.value))throw new Error("Invalid UUID received: ".concat(e.value));const d=new Uint8Array(17);return d[0]=9,d.set(Jf(e.value.replace(/\-/g,"")),1),d}}};var Bb;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(Bb||(Bb={}));const Dte=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let Fte=class SI{constructor(e){U(this,"bytes");if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error("".concat(e," is too large (or, if negative, too small) to represent as an Int64"));const n=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)n[r]=s;return e<0&&Lb(n),new SI(n)}valueOf(){const e=this.bytes.slice(0),n=e[0]&128;return n&&Lb(e),parseInt(en(e),16)*(n?-1:1)}toString(){return String(this.valueOf())}};
11146function Lb(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}const Mte="X-Amz-Algorithm",Ote="X-Amz-Credential",xI="X-Amz-Date",Pte="X-Amz-SignedHeaders",Bte="X-Amz-Expires",_I="X-Amz-Signature",II="X-Amz-Security-Token",kI="authorization",EI=xI.toLowerCase(),Lte="date",Wte=[kI,EI,Lte],zte=_I.toLowerCase(),rm="x-amz-content-sha256",Hte=II.toLowerCase(),Ute={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Vte=/^proxy-/,jte=/^sec-/,zp="AWS4-HMAC-SHA256",Gte="AWS4-HMAC-SHA256-PAYLOAD",qte="UNSIGNED-PAYLOAD",Kte=50,TI="aws4_request",Xte=60*60*24*7,Yte=({query:t={}})=>{const e=[],n={};for(const r of Object.keys(t)){if(r.toLowerCase()===zte)continue;const s=Pr(r);e.push(s);const a=t[r];typeof a=="string"?n[s]="".concat(s,"=").concat(Pr(a)):Array.isArray(a)&&(n[s]=a.slice(0).reduce((o,i)=>o.concat(["".concat(s,"=").concat(Pr(i))]),[]).sort().join("&"))}return e.sort().map(r=>n[r]).filter(r=>r).join("&")},Jte=t=>Qte(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Qte=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;let Zte=class{constructor({applyChecksum:e,credentials:n,region:r,service:s,sha256:a,uriEscapePath:o=!0}){U(this,"service");U(this,"regionProvider");U(this,"credentialProvider");U(this,"sha256");U(this,"uriEscapePath");U(this,"applyChecksum");this.service=s,this.sha256=a,this.uriEscapePath=o,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Or(r),this.credentialProvider=Or(n)}createCanonicalRequest(e,n,r){const s=Object.keys(n).sort();return"".concat(e.method,"\n").concat(this.getCanonicalPath(e),"\n").concat(Yte(e),"\n").concat(s.map(a=>"".concat(a,":").concat(n[a])).join("\n"),"\n\n").concat(s.join(";"),"\n").concat(r)}async createStringToSign(e,n,r,s){const a=new this.sha256;a.update(as(r));const o=await a.digest();return"".concat(s,"\n").concat(e,"\n").concat(n,"\n").concat(en(o))}getCanonicalPath({path:e}){if(this.uriEscapePath){const n=[];for(const a of e.split("/"))(a==null?void 0:a.length)!==0&&a!=="."&&(a===".."?n.pop():n.push(a));const r="".concat(e!=null&&e.startsWith("/")?"/":"").concat(n.join("/")).concat(n.length>0&&(e!=null&&e.endsWith("/"))?"/":"");return Pr(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){const n=Jte(e).replace(/[\-:]/g,"");return{longDate:n,shortDate:n.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}};const Sl={},Hp=[],Up=(t,e,n)=>"".concat(t,"/").concat(e,"/").concat(n,"/").concat(TI),ene=async(t,e,n,r,s)=>{const a=await Wb(t,e.secretAccessKey,e.accessKeyId),o="".concat(n,":").concat(r,":").concat(s,":").concat(en(a),":").concat(e.sessionToken);if(o in Sl)return Sl[o];for(Hp.push(o);Hp.length>Kte;)delete Sl[Hp.shift()];let i="AWS4".concat(e.secretAccessKey);for(const l of[n,r,s,TI])i=await Wb(t,i,l);return Sl[o]=i},Wb=(t,e,n)=>{const r=new t(e);return r.update(as(n)),r.digest()},zb=({headers:t},e,n)=>{const r={};for(const s of Object.keys(t).sort()){if(t[s]==null)continue;const a=s.toLowerCase();(a in Ute||e!=null&&e.has(a)||Vte.test(a)||jte.test(a))&&(!n||n&&!n.has(a))||(r[a]=t[s].trim().replace(/\s+/g," "))}return r},Vp=async({headers:t,body:e},n)=>{for(const r of Object.keys(t))if(r.toLowerCase()===rm)return t[r];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||J_(e)){const r=new n;return r.update(as(e)),en(await r.digest())}return qte},tne=(t,e)=>{t=t.toLowerCase();for(const n of Object.keys(e))if(t===n.toLowerCase())return!0;return!1},nne=(t,e={})=>{var s,a;const{headers:n,query:r={}}=fn.clone(t);for(const o of Object.keys(n)){const i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!((s=e.unhoistableHeaders)!=null&&s.has(i))||(a=e.hoistableHeaders)!=null&&a.has(i))&&(r[o]=n[o],delete n[o])}return{...t,headers:n,query:r}},Hb=t=>{t=fn.clone(t);for(const e of Object.keys(t.headers))Wte.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};let Ub=class extends Zte{constructor({applyChecksum:n,credentials:r,region:s,service:a,sha256:o,uriEscapePath:i=!0}){super({applyChecksum:n,credentials:r,region:s,service:a,sha256:o,uriEscapePath:i});U(this,"headerFormatter",new Rte)}async presign(n,r={}
11146){const{signingDate:s=new Date,expiresIn:a=3600,unsignableHeaders:o,unhoistableHeaders:i,signableHeaders:l,hoistableHeaders:u,signingRegion:c,signingService:d}=r,f=await this.credentialProvider();this.validateResolvedCredentials(f);const p=c!=null?c:await this.regionProvider(),{longDate:h,shortDate:m}=this.formatDate(s);if(a>Xte)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const g=Up(m,p,d!=null?d:this.service),v=nne(Hb(n),{unhoistableHeaders:i,hoistableHeaders:u});f.sessionToken&&(v.query[II]=f.sessionToken),v.query[Mte]=zp,v.query[Ote]="".concat(f.accessKeyId,"/").concat(g),v.query[xI]=h,v.query[Bte]=a.toString(10);const b=zb(v,o,l);return v.query[Pte]=this.getCanonicalHeaderList(b),v.query[_I]=await this.getSignature(h,g,this.getSigningKey(f,p,m,d),this.createCanonicalRequest(v,b,await Vp(n,this.sha256))),v}async sign(n,r){return typeof n=="string"?this.signString(n,r):n.headers&&n.payload?this.signEvent(n,r):n.message?this.signMessage(n,r):this.signRequest(n,r)}async signEvent({headers:n,payload:r},{signingDate:s=new Date,priorSignature:a,signingRegion:o,signingService:i,eventStreamCredentials:l}){const u=o!=null?o:await this.regionProvider(),{shortDate:c,longDate:d}=this.formatDate(s),f=Up(c,u,i!=null?i:this.service),p=await Vp({headers:{},body:r},this.sha256),h=new this.sha256;h.update(n);const m=en(await h.digest()),g=[Gte,d,f,a,m,p].join("\n");return this.signString(g,{signingDate:s,signingRegion:u,signingService:i,eventStreamCredentials:l})}async signMessage(n,{signingDate:r=new Date,signingRegion:s,signingService:a,eventStreamCredentials:o}){return this.signEvent({headers:this.headerFormatter.format(n.message.headers),payload:n.message.body},{signingDate:r,signingRegion:s,signingService:a,priorSignature:n.priorSignature,eventStreamCredentials:o}).then(l=>({message:n.message,signature:l}))}async signString(n,{signingDate:r=new Date,signingRegion:s,signingService:a,eventStreamCredentials:o}={}){const i=o!=null?o:await this.credentialProvider();this.validateResolvedCredentials(i);const l=s!=null?s:await this.regionProvider(),{shortDate:u}
11146=this.formatDate(r),c=new this.sha256(await this.getSigningKey(i,l,u,a));return c.update(as(n)),en(await c.digest())}async signRequest(n,{signingDate:r=new Date,signableHeaders:s,unsignableHeaders:a,signingRegion:o,signingService:i}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const u=o!=null?o:await this.regionProvider(),c=Hb(n),{longDate:d,shortDate:f}=this.formatDate(r),p=Up(f,u,i!=null?i:this.service);c.headers[EI]=d,l.sessionToken&&(c.headers[Hte]=l.sessionToken);const h=await Vp(c,this.sha256);!tne(rm,c.headers)&&this.applyChecksum&&(c.headers[rm]=h);const m=zb(c,a,s),g=await this.getSignature(d,p,this.getSigningKey(l,u,f,i),this.createCanonicalRequest(c,m,h));return c.headers[kI]="".concat(zp," ")+"Credential=".concat(l.accessKeyId,"/").concat(p,", ")+"SignedHeaders=".concat(this.getCanonicalHeaderList(m),", ")+"Signature=".concat(g),c}async getSignature(n,r,s,a){const o=await this.createStringToSign(n,r,a,zp),i=new this.sha256(await s);return i.update(as(o)),en(await i.digest())}getSigningKey(n,r,s,a){return ene(this.sha256,n,s,r,a||this.service)}};const rne=t=>{let e=t.credentials,n=!!t.credentials,r;Object.defineProperty(t,"credentials",{set(u){u&&u!==e&&u!==r&&(n=!0),e=u;const c=sne(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),d=ane(t,c);if(n&&!d.attributed){const f=typeof e=="object"&&e!==null;r=async p=>{const m=await d(p);return f&&(!m.$source||Object.keys(m.$source).length===0)?lte(m,"CREDENTIALS_CODE","e"):m},r.memoized=d.memoized,r.configBound=d.configBound,r.attributed=!0}else r=d},get(){return r},enumerable:!0,configurable:!0}),t.credentials=e;const{signingEscapePath:s=!0,systemClockOffset:a=t.systemClockOffset||0,sha256:o}=t;let i;return t.signer?i=sc(t.signer):t.regionInfoProvider?i=()=>sc(t.region)().then(async u=>[await t.regionInfoProvider(u,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},u]).then(([u,c])=>{const{signingRegion:d,signingService:f}=u;t.signingRegion=t.signingRegion||d||c,t.signingName=t.signingName||f||t.serviceId;const p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:s},h=t.signerConstructor||Ub;return new h(p)}):i=async u=>{u=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await sc(t.region)(),properties:{}},u);const c=u.signingRegion,d=u.signingName;t.signingRegion=t.signingRegion||c,t.signingName=t.signingName||d||t.serviceId;const f={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:s},p=t.signerConstructor||Ub;return new p(f)},Object.assign(t,{systemClockOffset:a,signingEscapePath:s,signer:i})};function sne(t,{credentials:e,credentialDefaultProvider:n}){let r;return e?e!=null&&e.memoized?r=e:r=Qee(e,Jee,pI):n?r=sc(n(Object.assign({},t,{parentClientConfig:t}))):r=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},r.memoized=!0,r}function ane(t,e){if(e.configBound)return e;const n=async r=>e({...r,callerClientConfig:t});return n.memoized=e.memoized,n.configBound=!0,n}class one{constructor(e=!1){U(this,"queryCompat");this.queryCompat=e}resolveRestContentType(e,n){const r=n.getMemberSchemas(),s=Object.values(r).find(a=>!!a.getMergedTraits().httpPayload);if(s){const a=s.getMergedTraits().mediaType;return a||(s.isStringSchema()?"text/plain":s.isBlobSchema()?"application/octet-stream":e)}else if(!n.isUnitSchema()&&Object.values(r).find(o=>{const{httpQuery:i,httpQueryParams:l,httpHeader:u,httpLabel:c,httpPrefixHeaders:d}=o.getMergedTraits();return!i&&!l&&!u&&!c&&d===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,n,r,s,a,o){var d,f,p,h;let i=n,l=e;e.includes("#")&&([i,l]=e.split("#"));const u={$metadata:a,$fault:r.statusCode<500?"client":"server"},c=er.for(i);try{return{errorSchema:(d=o==null?void 0:o(c,l))!=null?d:c.getSchema(e),errorMetadata:u}}catch(m){s.message=(p=(f=s.message)!=null?f:s.Message)!=null?p:"UnknownError";const g=er.for("smithy.ts.sdk.synthetic."+i),v=g.getBaseException();if(v){const b=(h=g.getErrorCtor(v))!=null?h:Error;throw this.decorateServiceException(Object.assign(new b({name:l}),u),s)}throw this.decorateServiceException(Object.assign(new Error(l),u),s)}}decorateServiceException(e,n={}){var r,s,a;if(this.queryCompat){const o=(r=e.Message)!=null?r:n.Message,i=Ob(e,n);
11146o&&(i.message=o),i.Error={...i.Error,Type:i.Error.Type,Code:i.Error.Code,Message:(a=(s=i.Error.message)!=null?s:i.Error.Message)!=null?a:o};const l=i.$metadata.requestId;return l&&(i.RequestId=l),i}return Ob(e,n)}setQueryCompatError(e,n){var s;const r=(s=n.headers)==null?void 0:s["x-amzn-query-error"];if(e!==void 0&&r!=null){const[a,o]=r.split(";"),i=Object.entries(e),l={Code:a,Type:o};Object.assign(e,l);for(const[u,c]of i)l[u==="message"?"Message":u]=c;delete l.__type,e.Error=l}}queryCompatOutput(e,n){e.Error&&(n.Error=e.Error),e.Type&&(n.Type=e.Type),e.Code&&(n.Code=e.Code)}findQueryCompatibleError(e,n){try{return e.getSchema(n)}catch(r){return e.find(s=>{var a;return((a=Kt.of(s).getMergedTraits().awsQueryError)==null?void 0:a[0])===n})}}}class Zg{constructor(){U(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}function*ine(t,e){if(t.isUnitSchema())return;const n=t.getSchema();for(let r=0;r<n[4].length;++r){const s=n[4][r],a=n[5][r],o=new Kt([a,0],s);!(s in e)&&!o.isIdempotencyToken()||(yield[s,o])}}function*cne(t,e,n){var a;if(t.isUnitSchema())return;const r=t.getSchema();let s=Object.keys(e).filter(o=>o!=="__type").length;for(let o=0;o<r[4].length&&s!==0;++o){const i=r[4][o],l=r[5][o],u=new Kt([l,0],i);let c=i;n&&(c=(a=u.getMergedTraits()[n])!=null?a:i),c in e&&(yield[i,u],s-=1)}}class lne{constructor(e,n){U(this,"from");U(this,"to");U(this,"keys");this.from=e,this.to=n,this.keys=new Set(Object.keys(this.from).filter(r=>r!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,n=this.from[e];this.to.$unknown=[e,n]}}}function une(t,e,n){if(n!=null&&n.source){const r=n.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||r!==String(e)))return r.includes(".")?new Dr(r,"bigDecimal"):BigInt(r)}return e}const dne=(t,e)=>Ki(t,e).then(n=>{var r;return((r=e==null?void 0:e.utf8Encoder)!=null?r:pi)(n)}),fne=(t,e)=>dne(t,e).then(n=>{if(n.length)try{return JSON.parse(n)}catch(r){throw(r==null?void 0:r.name)==="SyntaxError"&&Object.defineProperty(r,"$responseBodyText",{value:n}),r}return{}}),pne=(t,e)=>{const n=(a,o)=>Object.keys(a).find(i=>i.toLowerCase()===o.toLowerCase()),r=a=>{let o=a;return typeof o=="number"&&(o=o.toString()),o.indexOf(",")>=0&&(o=o.split(",")[0]),o.indexOf(":")>=0&&(o=o.split(":")[0]),o.indexOf("#")>=0&&(o=o.split("#")[1]),o},s=n(t.headers,"x-amzn-errortype");if(s!==void 0)return r(t.headers[s]);if(e&&typeof e=="object"){const a=n(e,"code");if(a&&e[a]!==void 0)return r(e[a]);if(e.__type!==void 0)return r(e.__type)}};class hne extends Zg{constructor(n){super();U(this,"settings");this.settings=n}async read(n,r){return this._read(n,typeof r=="string"?JSON.parse(r,une):await fne(r,this.serdeContext))}readObject(n,r){return this._read(n,r)}_read(n,r){var i;const s=r!==null&&typeof r=="object",a=Kt.of(n);if(s){if(a.isStructSchema()){const l=a.isUnionSchema(),u={};let c;l&&(c=new lne(r,u));for(const[d,f]of cne(a,r,this.settings.jsonName?"jsonName":!1)){const p=this.settings.jsonName&&(i=f.getMergedTraits().jsonName)!=null?i:d;l&&c.mark(p),r[p]!=null&&(u[d]=this._read(f,r[p]))}return l&&c.writeUnknown(),u}if(Array.isArray(r)&&a.isListSchema()){const l=a.getValueSchema(),u=[],c=!!a.getMergedTraits().sparse;for(const d of r)(c||d!=null)&&u.push(this._read(l,d));return u}if(a.isMapSchema()){const l=a.getValueSchema(),u={},c=!!a.getMergedTraits().sparse;for(const[d,f]of Object.entries(r))(c||f!=null)&&(u[d]=this._read(l,f));return u}}if(a.isBlobSchema()&&typeof r=="string")return Ja(r);const o=a.getMergedTraits().mediaType;if(a.isStringSchema()&&typeof r=="string"&&o)return o==="application/json"||o.endsWith("+json")?Zr.from(r):r;if(a.isTimestampSchema()&&r!=null)switch(tp(a,this.settings)){case 5:return HQ(r);case 6:return G_(r);case 7:return GQ(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(a.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(a.isBigDecimalSchema()&&r!=null){if(r instanceof Dr)return r;const l=r;return l.type==="bigDecimal"&&"string"in l?new Dr(l.string,l.type):new Dr(String(r),"bigDecimal")}if(a.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(a.isDocumentSchema())if(s){const l=Array.isArray(r)?[]:{};for(const[u,c]of Object.entries(r))c instanceof Dr?l[u]=c:l[u]=this._read(a,c);return l}else return structuredClone(r);return r}}const Vb=String.fromCharCode(925);class mne{constructor(){U(this,"values",new Map);U(this,"counter",0);U(this,"stage",0)}createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
11146if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,n)=>{if(n instanceof Dr){const r="".concat(Vb+"nv"+this.counter++,"_")+n.string;return this.values.set('"'.concat(r,'"'),n.string),r}if(typeof n=="bigint"){const r=n.toString(),s="".concat(Vb+"b"+this.counter++,"_")+r;return this.values.set('"'.concat(s,'"'),r),s}return n}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(const[n,r]of this.values)e=e.replace(n,r);return e}}class gne extends Zg{constructor(n){super();U(this,"settings");U(this,"buffer");U(this,"useReplacer",!1);U(this,"rootSchema");this.settings=n}write(n,r){this.rootSchema=Kt.of(n),this.buffer=this._write(this.rootSchema,r)}writeDiscriminatedDocument(n,r){this.write(n,r),typeof this.buffer=="object"&&(this.buffer.__type=Kt.of(n).getName(!0))}flush(){const{rootSchema:n,useReplacer:r}=this;if(this.rootSchema=void 0,this.useReplacer=!1,n!=null&&n.isStructSchema()||n!=null&&n.isDocumentSchema()){if
11146(!r)return JSON.stringify(this.buffer);const s=new mne;return s.replaceInJson(JSON.stringify(this.buffer,s.createReplacer(),0))}return this.buffer}_write(n,r,s){var i,l,u,c;const a=r!==null&&typeof r=="object",o=Kt.of(n);if(a){if(o.isStructSchema()){const d={};for(const[f,p]of ine(o,r)){const h=this._write(p,r[f],o);if(h!==void 0){const m=p.getMergedTraits().jsonName,g=this.settings.jsonName&&m!=null?m:f;d[g]=h}}if(o.isUnionSchema()&&Object.keys(d).length===0){const{$unknown:f}=r;if(Array.isArray(f)){const[p,h]=f;d[p]=this._write(15,h)}}return d}if(Array.isArray(r)&&o.isListSchema()){const d=o.getValueSchema(),f=[],p=!!o.getMergedTraits().sparse;for(const h of r)(p||h!=null)&&f.push(this._write(d,h));return f}if(o.isMapSchema()){const d=o.getValueSchema(),f={},p=!!o.getMergedTraits().sparse;for(const[h,m]of Object.entries(r))(p||m!=null)&&(f[h]=this._write(d,m));return f}if(r instanceof Uint8Array&&(o.isBlobSchema()||o.isDocumentSchema()))return o===this.rootSchema?r:((l=(i=this.serdeContext)==null?void 0:i.base64Encoder)!=null?l:Qa)(r);if(r instanceof Date&&(o.isTimestampSchema()||o.isDocumentSchema()))switch(tp(o,this.settings)){case 5:return r.toISOString().replace(".000Z","Z");case 6:return j_(r);case 7:return r.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",r),r.getTime()/1e3}r instanceof Dr&&(this.useReplacer=!0)}if(!(r===null&&(s!=null&&s.isStructSchema()))){if(o.isStringSchema()){if
11146(typeof r>"u"&&o.isIdempotencyToken())return uI();const d=o.getMergedTraits().mediaType;return r!=null&&d&&(d==="application/json"||d.endsWith("+json"))?Zr.from(r):r}if(typeof r=="number"&&o.isNumericSchema())return Math.abs(r)===1/0||isNaN(r)?String(r):r;if(typeof r=="string"&&o.isBlobSchema())return o===this.rootSchema?r:((c=(u=this.serdeContext)==null?void 0:u.base64Encoder)!=null?c:Qa)(r);if(typeof r=="bigint"&&(this.useReplacer=!0),o.isDocumentSchema())if(a){const d=Array.isArray(r)?[]:{};for(const[f,p]of Object.entries(r))p instanceof Dr?(this.useReplacer=!0,d[f]=p):d[f]=this._write(o,p);return d}else return structuredClone(r);return r}}}class yne extends Zg{constructor(n){super();U(this,"settings");this.settings=n}createSerializer(){const n=new gne(this.settings);return n.setSerdeContext(this.serdeContext),n}createDeserializer(){const n=new hne(this.settings);return n.setSerdeContext(this.serdeContext),n}}class vne extends pee{constructor({defaultNamespace:n}){super({defaultNamespace:n});U(this,"serializer");U(this,"deserializer");U(this,"codec");U(this,"mixin",new one);const r={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new yne(r),this.serializer=new yee(this.codec.createSerializer(),r),this.deserializer=new mee(this.codec.createDeserializer(),r)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(n){this.codec.setSerdeContext(n),super.setSerdeContext(n)}async serializeRequest(n,r,s){const a=await super.serializeRequest(n,r,s),o=Kt.of(n.input);if(!a.headers["content-type"]){const i=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);i&&(a.headers["content-type"]=i)}return a.body==null&&a.headers["content-type"]===this.getDefaultContentType()&&(a.body="{}"),a}async deserializeResponse(n,r,s){const a=await super.deserializeResponse(n,r,s),o=Kt.of(n.output);for(const[i,l]of o.structIterator())l.getMemberTraits().httpPayload&&!(i in a)&&(a[i]=null);return a}async handleError(n,r,s,a,o){var m,g,v,b,w;const i=(m=pne(s,a))!=null?m:"Unknown",{errorSchema:l,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,s,a,o),c=Kt.of(l),d=(v=(g=a.message)!=null?g:a.Message)!=null?v:"Unknown",f=(b=er.for(l[1]).getErrorCtor(l))!=null?b:Error,p=new f(d);await this.deserializeHttpMessage(l,r,s,a);const h={};for(const[S,I]of c.structIterator()){const E=(w=I.getMergedTraits().jsonName)!=null?w:S;h[S]=this.codec.createDeserializer().readObject(I,a[E])}throw this.mixin.decorateServiceException(Object.assign(p,u,{$fault:c.getMergedTraits().error,message:d},h),a)}getDefaultContentType(){return"application/json"}}const bne=/\d{12}\.ddb/;async function wne(t,e,n){var a,o,i,l,u,c,d,f;const r=n.request;if(((a=r==null?void 0:r.headers)==null?void 0:a["smithy-protocol"])==="rpc-v2-cbor"&&jr(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){const p=await e.retryStrategy();typeof p.acquireInitialRetryToken=="function"?(i=(o=p.constructor)==null?void 0:o.name)!=null&&i.includes("Adaptive")?jr(t,"RETRY_MODE_ADAPTIVE","F"):jr(t,"RETRY_MODE_STANDARD","E"):jr(t,"RETRY_MODE_LEGACY","D")}if(typeof e.accountIdEndpointMode=="function"){const p=t.endpointV2;switch(String((l=p==null?void 0:p.url)==null?void 0:l.hostname).match(bne)&&jr(t,"ACCOUNT_ID_ENDPOINT","O"),await((u=e.accountIdEndpointMode)==null?void 0:u.call(e))){case"disabled":jr(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":jr(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":jr(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const s=(d=(c=t.__smithy_context)==null?void 0:c.selectedHttpAuthScheme)==null?void 0:d.identity;if(s!=null&&s.$source){const p=s;p.accountId&&jr(t,"RESOLVED_ACCOUNT_ID","T");for(const[h,m]of Object.entries((f=p.$source)!=null?f:{}))jr(t,h,m)}}const jb="user-agent",jp="x-amz-user-agent",Gb=" ",Gp="/",Sne=/[^!$%&'*+\-.^_`|~\w]/g,xne=/[^!$%&'*+\-.^_`|~\w#]/g,qb="-",_ne=1024;function Ine(t){let e="";for(const n in t){const r=t[n];if(e.length+r.length+1<=_ne){e.length?e+=","+r:e+=r;continue}break}return e}const kne=t=>
11146(e,n)=>async r=>{var p,h,m,g;const{request:s}=r;if(!fn.isInstance(s))return e(r);const{headers:a}=s,o=((p=n==null?void 0:n.userAgent)==null?void 0:p.map(xl))||[],i=(await t.defaultUserAgentProvider()).map(xl);await wne(n,t,r);const l=n;i.push("m/".concat(Ine(Object.assign({},(h=n.__smithy_context)==null?void 0:h.features,(m=l.__aws_sdk_context)==null?void 0:m.features))));const u=((g=t==null?void 0:t.customUserAgent)==null?void 0:g.map(xl))||[],c=await t.userAgentAppId();c&&i.push(xl(["app","".concat(c)]));const d=[].concat([...i,...o,...u]).join(Gb),f=[...i.filter(v=>v.startsWith("aws-sdk-")),...u].join(Gb);return t.runtime!=="browser"?(f&&(a[jp]=a[jp]?"".concat(a[jb]," ").concat(f):f),a[jb]=d):a[jp]=d,e({...r,request:s})},xl=t=>{var o;const e=t[0].split(Gp).map(i=>i.replace(Sne,qb)).join(Gp),n=(o=t[1])==null?void 0:o.replace(xne,qb),r=e.indexOf(Gp),s=e.substring(0,r);let a=e.substring(r+1);return s==="api"&&(a=a.toLowerCase()),[s,a,n].filter(i=>i&&i.length>0).reduce((i,l,u)=>{switch(u){case 0:return l;case 1:return"".concat(i,"/").concat(l);default:return"".concat(i,"#").concat(l)}},"")},Ene={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Tne=t=>({applyToStack:e=>{e.add(kne(t),Ene)}});var CI=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var n,r;try{for(var s=h3(e),a=s.next();!a.done;a=s.next()){var o=a.value;this.checksum=this.checksum>>>8^Nne[(this.checksum^o)&255]}}catch(i){n={error:i}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t}(),Cne=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Nne=iE(Cne);let qp=class NI{constructor(e){U(this,"bytes");if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error("".concat(e," is too large (or, if negative, too small) to represent as an Int64"));const n=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)n[r]=s;return e<0&&Kb(n),new NI(n)}valueOf(){const e=this.bytes.slice(0),n=e[0]&128;return n&&Kb(e),parseInt(en(e),16)*(n?-1:1)}toString(){return String(this.valueOf())}};function Kb(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}class Ane{constructor(e,n){U(this,"toUtf8");U(this,"fromUtf8");this.toUtf8=e,this.fromUtf8=n}format(e){const n=[];for(const a of Object.keys(e)){const o=this.fromUtf8(a);n.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[a]))}
11146const r=new Uint8Array(n.reduce((a,o)=>a+o.byteLength,0));let s=0;for(const a of n)r.set(a,s),s+=a.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,e.value,!1),new Uint8Array(n.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(a.buffer);return o.set(e.value,3),o;case"string":const i=this.fromUtf8(e.value),l=new DataView(new ArrayBuffer(3+i.byteLength));l.setUint8(0,7),l.setUint16(1,i.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(i,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(qp.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Lne.test(e.value))throw new Error("Invalid UUID received: ".concat(e.value));const d=new Uint8Array(17);return d[0]=9,d.set(Jf(e.value.replace(/\-/g,"")),1),d}}parse(e){const n={};let r=0;for(;r<e.byteLength;){const s=e.getUint8(r++),a=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,s));switch(r+=s,e.getUint8(r++)){case 0:n[a]={type:Yb,value:!0};break;case 1:n[a]={type:Yb,value:!1};break;case 2:n[a]={type:$ne,value:e.getInt8(r++)};break;case 3:n[a]={type:Rne,value:e.getInt16(r,!1)},r+=2;break;case 4:n[a]={type:Dne,value:e.getInt32(r,!1)},r+=4;break;case 5:n[a]={type:Fne,value:new qp(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const o=e.getUint16(r,!1);r+=2,n[a]={type:Mne,value:new Uint8Array(e.buffer,e.byteOffset+r,o)},r+=o;break;case 7:const i=e.getUint16(r,!1);r+=2,n[a]={type:One,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,i))},r+=i;break;case 8:n[a]={type:Pne,value:new Date(new qp(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const l=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,n[a]={type:Bne,value:"".concat(en(l.subarray(0,4)),"-").concat(en(l.subarray(4,6)),"-").concat(en(l.subarray(6,8)),"-").concat(en(l.subarray(8,10)),"-").concat(en(l.subarray(10)))};break;default:throw new Error("Unrecognized header type tag")}}return n}}var Xb;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(Xb||(Xb={}));const Yb="boolean",$ne="byte",Rne="short",Dne="integer",Fne="long",Mne="binary",One="string",Pne="timestamp",Bne="uuid",Lne=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,AI=4,Ps=AI*2,Ia=4,Wne=Ps+Ia*2;function zne({byteLength:t,byteOffset:e,buffer:n}){if(t<Wne)throw new Error("Provided message too short to accommodate event stream message overhead");const r=new DataView(n,e,t),s=r.getUint32(0,!1);if(t!==s)throw new Error("Reported message length does not match received message length");const a=r.getUint32(AI,!1),o=r.getUint32(Ps,!1),i=r.getUint32(t-Ia,!1),l=new CI().update(new Uint8Array(n,e,Ps));if(o!==l.digest())throw new Error("The prelude checksum specified in the message (".concat(o,") does not match the calculated CRC32 checksum (").concat(l.digest(),")"));if(l.update(new Uint8Array(n,e+Ps,t-(Ps+Ia))),i!==l.digest())throw new Error("The message checksum (".concat(l.digest(),") did not match the expected value of ").concat(i));return{headers:new DataView(n,e+Ps+Ia,a),body:new Uint8Array(n,e+Ps+Ia+a,s-a-(Ps+Ia+Ia))}}class $I{constructor(e,n){U(this,"headerMarshaller");U(this,"messageBuffer");U(this,"isEndOfStream");this.headerMarshaller=new Ane(e,n),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),n=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return n}}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const n=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return n}}}encode({headers:e,body:n}){const r=this.headerMarshaller.format(e),s=r.byteLength+n.byteLength+16,a=new Uint8Array(s),o=new DataView(a.buffer,a.byteOffset,a.byteLength),i=new CI;return o.setUint32(0,s,!1),o.setUint32(4,r.byteLength,!1),o.setUint32(8,i.update(a.subarray(0,8)).digest(),!1),a.set(r,12),a.set(n,r.byteLength+12),o.setUint32(s-4,i.update(a.subarray(8,s-4)).digest(),!1),a}decode(e){const{headers:n,body:r}=zne(e);return{headers:this.headerMarshaller.parse(n),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class Hne{constructor(e){U(this,"options");this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.decoder.decode(e)}}class Une{constructor(e){U(this,"options");this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}class Vne{constructor(e){U(this,"options");this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const n=await this.options.deserializer(e);n!==void 0&&(yield n)}}}class jne{constructor(e){U(this,"options");this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream)yield this.options.serializer(e)}}function Gne(t){let e=0,n=0,r=null,s=null;const a=i=>{if(typeof i!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+i);e=i,n=4,r=new Uint8Array(i),new DataView(r.buffer).setUint32(0,i,!1)},o=async function*(){const i=t[Symbol.asyncIterator]();for(;;){const{value:l,done:u}=await i.next();if(u){if(e)if(e===n)yield r;else throw new Error("Truncated event message received.");else return;return}const c=l.length;let d=0;for(;d<c;){if(!r){const p=c-d;s||(s=new Uint8Array(4));const h=Math.min(4-n,p);if(s.set(l.slice(d,d+h),n),n+=h,d+=h,n<4)break;a(new DataView(s.buffer).getUint32(0,!1)),s=null}const f=Math.min(e-n,c-d);r.set(l.slice(d,d+f),n),n+=f,d+=f,e&&e===n&&(yield r,r=null,e=0,n=0)}}};return{[Symbol.asyncIterator]:o}}function ele(t,e){const n=RI(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(const r of t){const s=e.eventStreamCodec.decode(r),a=await n(s);a!==void 0&&(yield a)}}}}function RI(t,e){return async function(n){const{value:r}=n.headers[":message-type"];if(r==="error"){const s=new Error(n.headers[":error-message"].value||"UnknownError");throw s.name=n.headers[":error-code"].value,s}else if(r==="exception"){const s=n.headers[":exception-type"].value,a={[s]:n},o=await t(a);if(o.$unknown){const i=new Error(e(n.body));throw i.name=s,i}throw o[s]}else if(r==="event"){const s={[n.headers[":event-type"].value]:n},a=await t(s);return a.$unknown?void 0:a}else throw Error("Unrecognizable event type: ".concat(n.headers[":event-type"].value))}}let DI=class{constructor({utf8Encoder:e,utf8Decoder:n}){U(this,"eventStreamCodec");U(this,"utfEncoder");this.eventStreamCodec=new $I(e,n),this.utfEncoder=e}deserialize(e,n){const r=Gne(e);return new Vne({messageStream:new Hne({inputStream:r,decoder:this.eventStreamCodec}),deserializer:RI(n,this.utfEncoder)})}serialize(e,n){return new Une({messageStream:new jne({inputStream:e,serializer:n}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const nle=t=>new DI(t),FI=t=>({[Symbol.asyncIterator]:async function*(){const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)return;yield r}}finally{e.releaseLock()}}}),ey=t=>{const e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(n){const{done:r,value:s}=await e.next();if(r)return n.close();n.enqueue(s)}})};class qne{constructor({utf8Encoder:e,utf8Decoder:n}){U(this,"universalMarshaller");this.universalMarshaller=new DI({utf8Decoder:n,utf8Encoder:e})}deserialize(e,n){const r=Kne(e)?FI(e):e;return this.universalMarshaller.deserialize(r,n)}serialize(e,n){const r=this.universalMarshaller.serialize(e,n);return typeof ReadableStream=="function"?ey(r):r}}const Kne=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream,Xne=t=>new qne(t),Yne=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)}),Jne=(t,e,n,r)=>{let s=t;const a={start(){},async transform(o,i){try{const l=new Date(Date.now()+await r()),u={":date":{type:"timestamp",value:l}},c=await e.sign({message:{body:o,headers:u},priorSignature:s},{signingDate:l});s=c.signature;const d=n.encode({headers:{...u,":chunk-signature":{type:"binary",value:Jf(c.signature)}},body:o});i.enqueue(d)}catch(l){i.error(l)}}};return new TransformStream({...a})};class Qne{constructor(e){U(this,"messageSigner");U(this,"eventStreamCodec");U(this,"systemClockOffsetProvider");this.messageSigner=e.messageSigner,this.eventStreamCodec=new $I(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>{var n;return(n=e.systemClockOffset)!=null?n:0}}async handle(e,n,r={}){const s=n.request,{body:a,headers:o,query:i}=s;if(!(a instanceof ReadableStream))throw new Error("Eventstream payload must be a ReadableStream.");const l=new TransformStream;s.body=l.readable;let u;
11146try{u=await e(n)}catch(h){throw s.body.cancel(),h}const d=((o.authorization||"").match(/Signature=([\w]+)$/)||[])[1]||i&&i["X-Amz-Signature"]||"",f=Jne(d,await this.messageSigner(),this.eventStreamCodec,this.systemClockOffsetProvider);return a.pipeThrough(f).pipeThrough(l),u}}const Zne=t=>new Qne(t),ere=()=>t=>async e=>{const n={...e.input},r=await t(e),s=r.output;return n.SessionId&&s.SessionId==null&&(s.SessionId=n.SessionId),r},tre={step:"initialize",name:"injectSessionIdMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],override:!0},nre=(t,e)=>n=>r=>{var a,o,i;const{request:s}=r;if(fn.isInstance(s)&&((o=(a=t.requestHandler.metadata)==null?void 0:a.handlerProtocol)!=null&&o.toLowerCase().includes("websocket"))){s.protocol="wss:",s.method="GET",s.path="".concat(s.path,"-websocket");const{headers:l}=s;delete l["content-type"],delete l["x-amz-content-sha256"];for(const u of Object.keys(l))if(u.indexOf(e.headerPrefix)===0){const c=u.replace(e.headerPrefix,"");s.query[c]=l[u]}l["x-amz-user-agent"]&&(s.query["user-agent"]=l["x-amz-user-agent"]),s.headers={host:(i=l.host)!=null?i:s.hostname}}return n(r)},rre={name:"websocketEndpointMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],relation:"after",toMiddleware:"eventStreamHeaderMiddleware",override:!0},sre=(t,e)=>({applyToStack:n=>{n.addRelativeTo(nre(t,e),rre),n.add(ere(),tre)}}),MI=t=>t.protocol==="ws:"||t.protocol==="wss:";class are{constructor(e){U(this,"signer");this.signer=e.signer}presign(e,n={}){return this.signer.presign(e,n)}
11146async sign(e,n){return fn.isInstance(e)&&MI(e)?{...await this.signer.presign({...e,body:""},{...n,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter(s=>s!=="host"))}),body:e.body}:this.signer.sign(e,n)}}const ore=t=>{const{signer:e}=t;return Object.assign(t,{signer:async n=>{const r=await e(n);if(ire(r))return new are({signer:r});throw new Error("Expected WebsocketSignatureV4 signer, please check the client constructor.")}})},ire=t=>!!t;function OI(t){var u,c;const{port:e,query:n}=t;let{protocol:r,path:s,hostname:a}=t;r&&r.slice(-1)!==":"&&(r+=":"),e&&(a+=":".concat(e)),s&&s.charAt(0)!=="/"&&(s="/".concat(s));let o=n?fI(n):"";o&&o[0]!=="?"&&(o="?".concat(o));let i="";if(t.username!=null||t.password!=null){const d=(u=t.username)!=null?u:"",f=(c=t.password)!=null?c:"";i="".concat(d,":").concat(f,"@")}let l="";return t.fragment&&(l="#".concat(t.fragment)),"".concat(r,"//").concat(i).concat(a).concat(s).concat(o).concat(l)}const PI=FI;function Jb(t,e){return new Request(t,e)}function cre(t=0){return new Promise((e,n)=>{t&&setTimeout(()=>{const r=new Error("Request did not complete within ".concat(t," ms"));r.name="TimeoutError",n(r)},t)})}const Kp={supported:void 0};class ni{constructor(e){U(this,"config");U(this,"configProvider");typeof e=="function"?this.configProvider=e().then(n=>n||{}):(this.config=e!=null?e:{},this.configProvider=Promise.resolve(this.config)),Kp.supported===void 0&&(Kp.supported=typeof Request<"u"&&"keepalive"in Jb("https://[::1]"))}static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new ni(e)}destroy(){}async handle(e,{abortSignal:n,requestTimeout:r}={}){var b,w,S;this.config||(this.config=await this.configProvider);const s=r!=null?r:this.config.requestTimeout,a=this.config.keepAlive===!0,o=this.config.credentials;if(n!=null&&n.aborted){const I=Qb(n);return Promise.reject(I)}let i=e.path;const l=fI(e.query||{});l&&(i+="?".concat(l)),e.fragment&&(i+="#".concat(e.fragment));let u="";if(e.username!=null||e.password!=null){const I=(b=e.username)!=null?b:"",E=(w=e.password)!=null?w:"";u="".concat(I,":").concat(E,"@")}const{port:c,method:d}=e,f="".concat(e.protocol,"//").concat(u).concat(e.hostname).concat(c?"
11146:".concat(c):"").concat(i),p=d==="GET"||d==="HEAD"?void 0:e.body,h={body:p,headers:new Headers(e.headers),method:d,credentials:o};(S=this.config)!=null&&S.cache&&(h.cache=this.config.cache),p&&(h.duplex="half"),typeof AbortController<"u"&&(h.signal=n),Kp.supported&&(h.keepalive=a),typeof this.config.requestInit=="function"&&Object.assign(h,this.config.requestInit(e));let m=()=>{};const g=Jb(f,h),v=[fetch(g).then(I=>{const E=I.headers,T={};for(const R of E.entries())T[R[0]]=R[1];return I.body!=null?{response:new Za({headers:T,reason:I.statusText,statusCode:I.status,body:I.body})}:I.blob().then(R=>({response:new Za({headers:T,reason:I.statusText,statusCode:I.status,body:R})}))}),cre(s)];return n&&v.push(new Promise((I,E)=>{const T=()=>{const D=Qb(n);E(D)};if(typeof n.addEventListener=="function"){const D=n;D.addEventListener("abort",T,{once:!0}),m=()=>D.removeEventListener("abort",T)}else n.onabort=T})),Promise.race(v).finally(m)}updateHttpClientConfig(e,n){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[e]=n,r))}httpHandlerConfigs(){var e;return(e=this.config)!=null?e:{}}}function Qb(t){const e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){const s=new Error("Request aborted");return s.name="AbortError",s.cause=e,s}const r=new Error(String(e));return r.name="AbortError",r}const n=new Error("Request aborted");return n.name="AbortError",n}const lre=async t=>{var e;return typeof Blob=="function"&&t instanceof Blob||((e=t.constructor)==null?void 0:e.name)==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):ure(t):dre(t)};async function ure(t){const e=await fre(t),n=Ja(e);return new Uint8Array(n)}async function dre(t){const e=[],n=t.getReader();let r=!1,s=0;for(;!r;){const{done:i,value:l}=await n.read();l&&(e.push(l),s+=l.length),r=i}const a=new Uint8Array(s);let o=0;for(const i of e)a.set(i,o),o+=i.length;return a}function fre(t){return new Promise((e,n)=>{const r=new FileReader;r.onloadend=()=>{var i;if(r.readyState!==2)return n(new Error("Reader aborted too early"));const s=(i=r.result)!=null?i:"",a=s.indexOf(","),o=a>-1?a+1:s.length;e(s.substring(o))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>
11146n(r.error),r.readAsDataURL(t)})}const pre=2e3;class ty{constructor(e,n=new ni){U(this,"metadata",{handlerProtocol:"websocket/h1.1"});U(this,"config");U(this,"configPromise");U(this,"httpHandler");U(this,"sockets",{});this.httpHandler=n,typeof e=="function"?(this.config={},this.configPromise=e().then(r=>this.config=r!=null?r:{})):(this.config=e!=null?e:{},this.configPromise=Promise.resolve(this.config))}static create(e,n=new ni){return typeof(e==null?void 0:e.handle)=="function"?e:new ty(e,n)}destroy(){for(const[e,n]of Object.entries(this.sockets)){for(const r of n)r.close(1e3,"Socket closed through destroy() call");delete this.sockets[e]}}async handle(e){if(!MI(e))return this.httpHandler.handle(e);const n=OI(e),r=new WebSocket(n);this.sockets[n]||(this.sockets[n]=[]),this.sockets[n].push(r),r.binaryType="arraybuffer",this.config=await this.configPromise;const{connectionTimeout:s=pre}=this.config;await this.waitForReady(r,s);const{body:a}=e,o=hre(a),i=this.connect(r,o),l=mre(i);return{response:new Za({statusCode:200,body:l})}}updateHttpClientConfig(e,n){this.configPromise=this.configPromise.then(r=>(r[e]=n,r))}httpHandlerConfigs(){var e;return(e=this.config)!=null?e:{}}removeNotUsableSockets(e){var n;this.sockets[e]=((n=this.sockets[e])!=null?n:[]).filter(r=>![WebSocket.CLOSING,WebSocket.CLOSED].includes(r.readyState))}waitForReady(e,n){return new Promise((r,s)=>{const a=setTimeout(()=>{this.removeNotUsableSockets(e.url),s({$metadata:{httpStatusCode:500}})},n);e.onopen=()=>{clearTimeout(a),r()}})}connect(e,n){let r,s=!1,a=()=>{},o=()=>{};e.onmessage=u=>{o({done:!1,value:new Uint8Array(u.data)})},e.onerror=u=>{s=!0,e.close(),a(u)},e.onclose=()=>{this.removeNotUsableSockets(e.url),!s&&(r?a(r):o({done:!0,value:void 0}))};const i={[Symbol.asyncIterator]:()=>({next:()=>new Promise((u,c)=>{o=u,a=c})})};return(async()=>{try{for await(const u of n)e.send(u)}catch(u){r=u}finally{e.close(1e3)}})(),i}}const hre=t=>t[Symbol.asyncIterator]?t:gre(t)?PI(t):{[Symbol.asyncIterator]:async function*(){yield t}},mre=t=>typeof ReadableStream=="function"?ey(t):t,gre=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream,yre=t=>(t==null?void 0:t.body)instanceof ReadableStream,vre=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],bre=["TimeoutError","RequestTimeout","RequestTimeoutException"],wre=[500,502,503,504],Sre=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],xre=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"],_re=t=>(t==null?void 0:t.$retryable)!==void 0,Ire=t=>{var e;return(e=t.$metadata)==null?void 0:e.clockSkewCorrected},kre=t=>{const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},BI=t=>{var e,n;return((e=t.$metadata)==null?void 0:e.httpStatusCode)===429||vre.includes(t.name)||((n=t.$retryable)==null?void 0:n.throttling)==!0},ny=(t,e=0)=>{var n,r;return _re(t)||Ire(t)||t.name==="InvalidSignatureException"&&((n=t.message)==null?void 0:n.includes("Signature expired"))||bre.includes(t.name)||Sre.includes((t==null?void 0:t.code)||"")||xre.includes((t==null?void 0:t.code)||"")||wre.includes(((r=t.$metadata)==null?void 0:r.httpStatusCode)||0)||kre(t)||Tre(t)||t.cause!==void 0&&e<=10&&ny(t.cause,e+1)},Ere=t=>{var e;if(((e=t.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const n=t.$metadata.httpStatusCode;return 500<=n&&n<=599&&!ny(t)}return!1};function Tre(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}const LI=20*1e3,Zb=500,Cre=1,Nre="amz-sdk-invocation-id",Are="amz-sdk-request";function $re(t,e){var n,r,s,a;if(Za.isInstance(t))for(const o of Object.keys(t.headers)){const i=o.toLowerCase();if(i==="retry-after"){const l=t.headers[o];let u=NaN;if(l.endsWith("GMT"))try{u=(G_(l).getTime()-Date.now())/1e3}catch(c){(n=e==null?void 0:e.trace)==null||n.call(e,"Failed to parse retry-after header"),(r=e==null?void 0:e.trace)==null||r.call(e,c)}else l.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?u=Number((s=l.match(/ GMT, ([\d.]+)$/))==null?void 0:s[1]):l.match(/^((\d+)|(\d+\.\d+))$/)?u=Number(l):Date.parse(l)>=Date.now()&&(u=(Date.parse(l)-Date.now())/1e3);return isNaN(u)?void 0:new Date(Date.now()+u*1e3)}else if(i==="x-amz-retry-after"){const l=t.headers[o],u=Number(l);if(isNaN(u)){(a=e==null?void 0:e.trace)==null||a.call(e,"Failed to parse x-amz-retry-after=".concat(l));return}return new Date(Date.now()+u)}}}const Rre=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error("AWS SDK error wrapper for ".concat(t));function Dre(t){return e=>(n,r)=>async s=>{var i,l,u,c;let a=await e.retryStrategy();const o=await e.maxAttempts();if(Mre(a)){a=a;let d=await a.acquireInitialRetryToken(((i=r.partition_id)!=null?i:"")+(r.__retryLongPoll?":longpoll":"")),f=new Error,p=0,h=0;const{request:m}=s,g=fn.isInstance(m);for(g&&(m.headers[Nre]=lI());;)try{g&&(m.headers[Are]="attempt=".concat(p+1,"; max=").concat(o));const{response:v,output:b}=await n(s);return a.recordSuccess(d),b.$metadata.attempts=p+1,b.$metadata.totalRetryDelay=h,{response:v,output:b}}catch(v){const b=Ore(v,e.logger);if(f=Rre(v),g&&t(m))throw(l=r.logger instanceof bI?console:r.logger)==null||l.warn("An error was encountered in a non-retryable streaming request."),f;try{d=await a.refreshRetryTokenForRetry(d,b)}catch(S){throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=p+1,f.$metadata.totalRetryDelay=h,f}p=d.getRetryCount();const w=d.getRetryDelay();h+=((c=(u=d==null?void 0:d.$retryLog)==null?void 0:u.acquisitionDelay)!=null?c:0)+w,w>0&&await Fre(w)}}else return a=a,a!=null&&a.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",a.mode]]),a.retry(n,s)}}const Fre=t=>new Promise(e=>setTimeout(e,t)),Mre=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Ore=(t,e)=>{const n={error:t,errorType:Pre(t)},r=$re(t.$response,e);return r&&(n.retryAfterHint=r),n},Pre=t=>BI(t)?"THROTTLING":ny(t)?"TRANSIENT":Ere(t)?"SERVER_ERROR":"CLIENT_ERROR",Bre={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};function Lre(t){const e=Dre(t);return n=>({applyToStack:r=>{r.add(e(n),Bre)}})}const Cu=class Cu{constructor(e){U(this,"beta");U(this,"minCapacity");U(this,"minFillRate");U(this,"scaleConstant");U(this,"smooth");U(this,"enabled",!1);U(this,"availableTokens",0);U(this,"lastMaxRate",0);U(this,"measuredTxRate",0);U(this,"requestCount",0);U(this,"fillRate");U(this,"lastThrottleTime");U(this,"lastTimestamp",0);U(this,"lastTxRateBucket");U(this,"maxCapacity");U(this,"timeWindow",0);var n,r,s,a,o;this.beta=(n=e==null?void 0:e.beta)!=null?n:.7,this.minCapacity=(r=e==null?void 0:e.minCapacity)!=null?r:1,this.minFillRate=(s=e==null?void 0:e.minFillRate)!=null?s:.5,this.scaleConstant=(a=e==null?void 0:e.scaleConstant)!=null?a:.4,this.smooth=(o=e==null?void 0:e.smooth)!=null?o:.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){var o;let n;this.updateMeasuredRate();const r=e;
11146if((r==null?void 0:r.errorType)==="THROTTLING"||BI((o=r==null?void 0:r.error)!=null?o:e)){const i=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=i,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),n=this.cubicThrottle(i),this.enableTokenBucket()}else this.calculateTimeWindow(),n=this.cubicSuccess(this.getCurrentTimeInSeconds());const a=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const n=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(r=>Cu.setTimeoutFn(r,n)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const n=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+n),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}
11146cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),n=Math.floor(e*2)/2;if(this.requestCount++,n>this.lastTxRateBucket){const r=this.requestCount/(n-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(r*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=n}}getPrecise(e){return parseFloat(e.toFixed(8))}};U(Cu,"setTimeoutFn",(e,n)=>setTimeout(e,n));let sm=Cu;var F0;const zs=class zs{static delay(){return zs.v2026?50:100}static throttlingDelay(){return zs.v2026?1e3:500}static cost(){return zs.v2026?14:5}static throttlingCost(){return zs.v2026?5:10}static modifiedCostType(){return zs.v2026?"THROTTLING":"TRANSIENT"}};U(zs,"v2026",typeof process<"u"&&((F0=process.env)==null?void 0:F0.SMITHY_NEW_RETRIES_2026)==="true");let br=zs;class Wre{constructor(){U(this,"x",br.delay())}computeNextBackoffDelay(e){const n=Math.random(),r=2,s=n*Math.min(this.x*r**e,LI);return Math.floor(s)}setDelayBase(e){this.x=e}}class e0{constructor(e,n,r,s){U(this,"delay");U(this,"count");U(this,"cost");U(this,"longPoll");U(this,"$retryLog",{acquisitionDelay:0});this.delay=e,this.count=n,this.cost=r,this.longPoll=s}getRetryCount(){return this.count}getRetryDelay(){return Math.min(LI,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var ri;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(ri||(ri={}));const oc=3,zre=ri.STANDARD,_l={incompatible:1,attempts:2,capacity:3};class am{constructor(e){U(this,"mode",ri.STANDARD);U(this,"retryBackoffStrategy");U(this,"capacity",Zb);U(this,"maxAttemptsProvider");U(this,"baseDelay");var n,r,s;typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),(n=this.maxAttemptsProvider)!=null||(this.maxAttemptsProvider=async()=>oc),(r=this.baseDelay)!=null||(this.baseDelay=br.delay()),(s=this.retryBackoffStrategy)!=null||(this.retryBackoffStrategy=new Wre)}async acquireInitialRetryToken(e){return new e0(br.delay(),0,void 0,br.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,n){var i,l,u;const r=await this.getMaxAttempts(),s=this.retryCode(e,n,r),a=s===0,o=(i=e.isLongPoll)==null?void 0:i.call(e);if(a||o){const c=n.errorType;this.retryBackoffStrategy.setDelayBase(c==="THROTTLING"?br.throttlingDelay():this.baseDelay);const d=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let f=d;if(n.retryAfterHint instanceof Date&&(f=Math.max(d,Math.min(n.retryAfterHint.getTime()-Date.now(),d+5e3))),a){const p=this.getCapacityCost(c);this.capacity-=p;const h=new e0(0,e.getRetryCount()+1,p,(u=(l=e.isLongPoll)==null?void 0:l.call(e))!=null?u:!1);return await new Promise(m=>setTimeout(m,f)),h.$retryLog.acquisitionDelay=f,h}else{const p=br.v2026&&s===_l.capacity&&o?f:0;p>0&&await new Promise(h=>setTimeout(h,p))}}throw new Error("No retry token available")}recordSuccess(e){var n;this.capacity=Math.min(Zb,this.capacity+((n=e.getRetryCost())!=null?n:Cre))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of ".concat(oc)),oc}}retryCode(e,n,r){const s=e.getRetryCount()+1,a=this.isRetryableError(n.errorType)?0:_l.incompatible,o=s<r?0:_l.attempts,i=this.capacity>=this.getCapacityCost(n.errorType)?0:_l.capacity;return a||o||i}getCapacityCost(e){return e===br.modifiedCostType()?br.throttlingCost():br.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class Hre{constructor(e,n){U(this,"mode",ri.ADAPTIVE);U(this,"rateLimiter");U(this,"standardRetryStrategy");const{rateLimiter:r}=n!=null?n:{};this.rateLimiter=r!=null?r:new sm,this.standardRetryStrategy=n?new am({maxAttempts:typeof e=="number"?e:3,...n}):new am(e)}async acquireInitialRetryToken(e){const n=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),n}async refreshRetryTokenForRetry(e,n){this.rateLimiter.updateClientSendingRate(n);const r=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,n);return await this.rateLimiter.getSendToken(),r}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}
11146async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}const Ure=(t,e)=>{var u;const{retryStrategy:n,retryMode:r}=t,{defaultMaxAttempts:s=oc,defaultBaseDelay:a=br.delay()}=e!=null?e:{},o=Or((u=t.maxAttempts)!=null?u:s);let i=n?Promise.resolve(n):void 0;const l=async()=>{const c=await o();return await Or(r)()===ri.ADAPTIVE?new Hre(o,{maxAttempts:c,baseDelay:a}):new am({maxAttempts:c,baseDelay:a})};return Object.assign(t,{maxAttempts:o,retryStrategy:()=>i!=null?i:i=l()})},Vre=Lre(yre),jre=async(t,e,n)=>({operation:hi(e).operation,region:await Or(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Gre(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"rekognition",region:t.region},propertiesExtractor:(e,n)=>({signingProperties:{config:e,context:n}})}}const qre=t=>{const e=[];switch(t.operation){default:e.push(Gre(t))}return e},Kre=t=>{var n;const e=rne(t);return Object.assign(e,{authSchemePreference:Or((n=t.authSchemePreference)!=null?n:[])})},Xre=t=>{var e,n;return Object.assign(t,{useDualstackEndpoint:(e=t.useDualstackEndpoint)!=null?e:!1,useFipsEndpoint:(n=t.useFipsEndpoint)!=null?n:!1,defaultSigningName:"rekognition"})},Yre={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},Jre="@aws-sdk/client-rekognitionstreaming",Qre="AWS SDK for JavaScript Rekognitionstreaming Client for Node.js, Browser and React Native",Zre="3.967.0",ese={build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-rekognitionstreaming","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo rekognitionstreaming","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},tse="./dist-cjs/index.js",nse="./dist-types/index.d.ts",rse="./dist-es/index.js",sse=!1,ase={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.967.0","@aws-sdk/credential-provider-node":"3.967.0","@aws-sdk/eventstream-handler-node":"3.965.0","@aws-sdk/middleware-eventstream":"3.965.0","@aws-sdk/middleware-host-header":"3.965.0","@aws-sdk/middleware-logger":"3.965.0","@aws-sdk/middleware-recursion-detection":"3.965.0","@aws-sdk/middleware-user-agent":"3.967.0","@aws-sdk/middleware-websocket":"3.965.0","@aws-sdk/region-config-resolver":"3.965.0","@aws-sdk/types":"3.965.0","@aws-sdk/util-endpoints":"3.965.0","@aws-sdk/util-user-agent-browser":"3.965.0","@aws-sdk/util-user-agent-node":"3.967.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.2","@smithy/eventstream-serde-browser":"^4.2.7","@smithy/eventstream-serde-config-resolver":"^4.3.7","@smithy/eventstream-serde-node":"^4.2.7","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.3","@smithy/middleware-retry":"^4.4.19","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.4","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.18","@smithy/util-defaults-mode-node":"^4.2.21","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},ose={"@tsconfig/node18":"18.2.4","@types/node":"^18.19.69",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},ise={node:">=18.0.0"},cse={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},lse=["dist-*/**"],use={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},dse="Apache-2.0",fse={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},pse="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-rekognitionstreaming",hse={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-rekognitionstreaming"},mse={name:Jre,description:Qre,version:Zre,scripts:ese,main:tse,types:nse,module:rse,sideEffects:sse,depen
11146dencies:ase,devDependencies:ose,engines:ise,typesVersions:cse,files:lse,author:use,license:dse,browser:fse,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:pse,repository:hse};var WI={name:"SHA-256"},t0={name:"HMAC",hash:WI},gse=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const yse={};function zl(){return typeof window<"u"?window:typeof self<"u"?self:yse}var vse=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!eh(e)){var n=uc(e),r=new Uint8Array(this.toHash.byteLength+n.byteLength);r.set(this.toHash,0),r.set(n,this.toHash.byteLength),this.toHash=r}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(n){return zl().crypto.subtle.sign(t0,n,e.toHash).then(function(r){return new Uint8Array(r)})}):eh(this.toHash)?Promise.resolve(gse):Promise.resolve().then(function(){return zl().crypto.subtle.digest(WI,e.toHash)}).then(function(n){return Promise.resolve(new Uint8Array(n))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(n,r){zl().crypto.subtle.importKey("raw",uc(e.secret),t0,!1,["sign"]).then(n,r)}),this.key.catch(function(){}))},t}(),bse=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function wse(t){if(Sse(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return xse(e)}return!1}function Sse(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function xse(t){return t&&bse.every(function(e){return typeof t[e]=="function"})}var _se=function(){function t(e){wse(zl())?this.hash=new vse(e):this.hash=new cE(e)}return t.prototype.update=function(e,n){this.hash.update(uc(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}();const Ise=({serviceId:t,clientVersion:e})=>async n=>{var p,h,m,g,v,b,w,S,I,E;const r=typeof window<"u"?window.navigator:void 0,s=(p=r==null?void 0:r.userAgent)!=null?p:"",a=(g=(m=(h=r==null?void 0:r.userAgentData)==null?void 0:h.platform)!=null?m:n0.os(s))!=null?g:"other",o=void 0,i=(b=(v=r==null?void 0:r.userAgentData)==null?void 0:v.brands)!=null?b:[],l=i[i.length-1],u=(S=(w=l==null?void 0:l.brand)!=null?w:n0.browser(s))!=null?S:"unknown",c=(I=l==null?void 0:l.version)!=null?I:"unknown",d=[["aws-sdk-js",e],["ua","2.1"],["os/".concat(a),o],["lang/js"],["md/browser","".concat(u,"_").concat(c)]];t&&d.push(["api/".concat(t),e]);const f=await((E=n==null?void 0:n.userAgentAppId)==null?void 0:E.call(n));return f&&d.push(["app/".concat(f)]),d},n0={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}},zI="required",Yr="fn",Jr="argv",mi="ref",r0=!0,s0="isSet",Fc="booleanEquals",_o="error",Mi="endpoint",Bn="tree",ry="PartitionResult",a0={[zI]:!1,type:"String"},o0={[zI]:!0,default:!1,type:"Boolean"},i0={[mi]:"Endpoint"},HI={[Yr]:Fc,[Jr]:[{[mi]:"UseFIPS"},!0]},UI={[Yr]:Fc,[Jr]:[{[mi]:"UseDualStack"},!0]},Gr={},c0={[Yr]:"getAttr",[Jr]:[{[mi]:ry},"supportsFIPS"]},l0={[Yr]:Fc,[Jr]:[!0,{[Yr]:"getAttr",[Jr]:[{[mi]:ry},"supportsDualStack"]}]},u0=[HI],d0=[UI],f0=[{[mi]:"Region"}],kse={version:"1.0",parameters:{Region:a0,UseDualStack:o0,UseFIPS:o0,Endpoint:a0},rules:[{conditions:[{[Yr]:s0,[Jr]:[i0]}],rules:[{conditions:u0,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:_o},{rules:[{conditions:d0,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:_o},{endpoint:{url:i0,properties:Gr,headers:Gr},type:Mi}],type:Bn}],type:Bn},{rules:[{conditions:[{[Yr]:s0,[Jr]:f0}],rules:[{conditions:[{[Yr]:"aws.partition",[Jr]:f0,assign:ry}],rules:[{conditions:[HI,UI],rules:[{conditions:[{[Yr]:Fc,[Jr]:[r0,c0]},l0],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gr,headers:Gr},type:Mi}],type:Bn}],type:Bn},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:_o}],type:Bn},{conditions:u0,rules:[{conditions:[{[Yr]:Fc,[Jr]:[c0,r0]}],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Gr,headers:Gr},type:Mi}],type:Bn}],type:Bn},{error:"FIPS is enabled but this partition does not support FIPS",type:_o}],type:Bn},{conditions:d0,rules:[{conditions:[l0],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gr,headers:Gr},type:Mi}],type:Bn}],type:Bn},{error:"DualStack is enabled but this partition does not support DualStack",type:_o}],type:Bn},{rules:[{endpoint:{url:"https://streaming-rekognition.{Region}.{PartitionResult#dnsSuffix}",properties:Gr,headers:Gr},type:Mi}],type:Bn}],type:Bn}],type:Bn},{error:"Invalid Configuration: Missing Region",type:_o}],type:Bn}]},Ese=kse,Tse=new AZ({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Cse=(t,e={})=>Tse.get(t,()=>JZ(Ese,{endpointParams:t,logger:e.logger}));Jg.aws=mI;const Nse=t=>{var e,n,r,s,a,o,i,l,u,c,d,f,p,h;return{apiVersion:"2022-05-30",base64Decoder:(e=t==null?void 0:t.base64Decoder)!=null?e:Ja,base64Encoder:(n=t==null?void 0:t.base64Encoder)!=null?n:Qa,disableHostPrefix:(r=t==null?void 0:t.disableHostPrefix)!=null?r:!1,endpointProvider:(s=t==null?void 0:t.endpointProvider)!=null?s:Cse,extensions:(a=t==null?void 0:t.extensions)!=null?a:[],httpAuthSchemeProvider:(o=t==null?void 0:t.httpAuthSchemeProvider)!=null?o:qre,httpAuthSchemes:(i=t==null?void 0:t.httpAuthSchemes)!=null?i:[{schemeId:"aws.auth#sigv4",identityProvi
11146der:m=>m.getIdentityProvider("aws.auth#sigv4"),signer:new fte}],logger:(l=t==null?void 0:t.logger)!=null?l:new bI,protocol:(u=t==null?void 0:t.protocol)!=null?u:vne,protocolSettings:(c=t==null?void 0:t.protocolSettings)!=null?c:{defaultNamespace:"com.amazonaws.rekognitionstreaming",version:"2022-05-30",serviceTarget:"RekognitionStreamingService"},serviceId:(d=t==null?void 0:t.serviceId)!=null?d:"RekognitionStreaming",urlParser:(f=t==null?void 0:t.urlParser)!=null?f:xu,utf8Decoder:(p=t==null?void 0:t.utf8Decoder)!=null?p:Ts,utf8Encoder:(h=t==null?void 0:t.utf8Encoder)!=null?h:pi}},Ase=t=>{var s,a,o,i,l,u,c,d,f,p,h,m,g;const e=Cte(t),n=()=>e().then(yte),r=Nse(t);return{...r,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:(s=t==null?void 0:t.bodyLengthChecker)!=null?s:dZ,credentialDefaultProvider:(a=t==null?void 0:t.credentialDefaultProvider)!=null?a:v=>()=>Promise.reject(new Error("Credential is missing")),defaultUserAgentProvider:(o=t==null?void 0:t.defaultUserAgentProvider)!=null?o:Ise({serviceId:r.serviceId,clientVersion:mse.version}),eventStreamPayloadHandlerProvider:(i=t==null?void 0:t.eventStreamPayloadHandlerProvider)!=null?i:Zne,eventStreamSerdeProvider:(l=t==null?void 0:t.eventStreamSerdeProvider)!=null?l:Xne,maxAttempts:(u=t==null?void 0:t.maxAttempts)!=null?u:oc,region:(c=t==null?void 0:t.region)!=null?c:hte("Region is missing"),requestHandler:ty.create((d=t==null?void 0:t.requestHandler)!=null?d:n,ni.create(n)),retryMode:(f=t==null?void 0:t.retryMode)!=null?f:async()=>(await n()).retryMode||zre,sha256:(p=t==null?void 0:t.sha256)!=null?p:_se,streamCollector:(h=t==null?void 0:t.streamCollector)!=null?h:lre,useDualstackEndpoint:(m=t==null?void 0:t.useDualstackEndpoint)!=null?m:()=>Promise.resolve(Ate),useFipsEndpoint:(g=t==null?void 0:t.useFipsEndpoint)!=null?g:()=>Promise.resolve($te)}},$se=t=>({setRegion(e){t.region=e},region(){return t.region}}),Rse=t=>({region:t.region()}),Dse=t=>{const e=t.httpAuthSchemes;let n=t.httpAuthSchemeProvider,r=t.credentials;return{setHttpAuthScheme(s){const a=e.findIndex(o=>o.schemeId===s.schemeId);a===-1?e.push(s):e.splice(a,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){n=s},httpAuthSchemeProvider(){return n},setCredentials(s){r=s},credentials(){return r}}},Fse=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()}),Mse=(t,e)=>{const n=Object.assign($se(t),xte(t),vee(t),Dse(t));return e.forEach(r=>r.configure(n)),Object.assign(t,Rse(n),_te(n),bee(n),Fse(n))};class Ose extends mte{constructor(...[n]){const r=Ase(n||{});super(r);U(this,"config");this.initConfig=r;const s=Xre(r),a=tte(s),o=Ure(a),i=Ete(o),l=i,u=QZ(l),c=Yne(u),d=Kre(c),f=EQ(d),p=ore(f),h=Mse(p,(n==null?void 0:n.extensions)||[]);this.config=h,this.middlewareStack.use(uee(this.config)),this.middlewareStack.use(Tne(this.config)),this.middlewareStack.use(Vre(this.config)),this.middlewareStack.use(xee(this.config)),this.middlewareStack.use($ee(this.config)),this.middlewareStack.use(Fee(this.config)),this.middlewareStack.use(Pee(this.config)),this.middlewareStack.use(Hee(this.config,{httpAuthSchemeParametersProvider:jre,identityProviderConfigProvider:async m=>new Kee({"aws.auth#sigv4":m.credentials})})),this.middlewareStack.use(qee(this.config))}destroy(){super.destroy()}}class os extends Po{constructor(e){super(e),Object.setPrototypeOf(this,os.prototype)}}class sy extends os{constructor(n){super({name:"AccessDeniedException",$fault:"client",...n});U(this,"name","AccessDeniedException");U(this,"$fault","client");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,sy.prototype),this.Message=n.Message,this.Code=n.Code}}class ay extends os{constructor(n){super({name:"InternalServerException",$fault:"server",...n});U(this,"name","InternalServerException");U(this,"$fault","server");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,ay.prototype),this.Message=n.Message,this.Code=n.Code}}class oy extends os{constructor(n){super({name:"ServiceQuotaExceededException",$fault:"client",...n});U(this,"name","ServiceQuotaExceededException");U(this,"$fault","client");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,oy.prototype),this.Message=n.Message,this.Code=n.Code}}class iy extends os{constructor(n){super({name:"ServiceUnavailableException",$fault:"server",...n});U(this,"name","ServiceUnavailableException");U(this,"$fault","server");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,iy.prototype),this.Message=n.Message,this.Code=n.Code}}class cy extends os{constructor(n){super({name:"ThrottlingException",$fault:"client",...n});U(this,"name","ThrottlingException");U(this,"$fault","client");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,cy.prototype),this.Message=n.Message,this.Code=n.Code}}class ly extends os{constructor(n){super({name:"ValidationException",$fault:"client",...n});U(this,"name","ValidationException");U(this,"$fault","client");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,ly.prototype),this.Message=n.Message,this.Code=n.Code}}class uy extends os{constructor(n){super({name:"SessionNotFoundException",$fault:"client",...n});U(this,"name","SessionNotFoundException");U(this,"$fault","client");U(this,"Message");U(this,"Code");Object.setPrototypeOf(this,uy.prototype),this.Message=n.Message,this.Code=n.Code}}const Pse="AccessDeniedException",dy="BoundingBox",Bse="BlazeFaceDetectionThreshold",oo="Code",fy="ChallengeConfig",Lse="CurrentColorStartTimestamp",Wse="ClientChallenge",zse="CurrentColor",VI="ColorDisplayed",jI="ChallengeEvent",GI="ChallengeId",Hse="ColorSequence",qI="ClientSessionInformationEvent",KI="ColorSequences",Use="ChallengeVersions",Vse="CenterX",jse="CenterY",XI="Challenge",Gse="DownscrollDuration",YI="DisconnectionEvent",JI="FreshnessColor",qse="FlatDisplayDuration",Kse="FaceDetectedInTargetPositionEndTimestamp",Xse="FaceDetectedInTargetPositionStartTimestamp",Yse="FaceDistanceThreshold",Jse="FaceDistanceThresholdMin",Qse="FaceDistanceThresholdMax",Zse="FaceIouHeightThreshold",eae="FaceIouWidthThreshold",QI="FaceMovementAndLightChallenge",tae="FaceMovementAndLightClientChallenge",nae="FaceMovementAndLightServerChallenge",ZI="FaceMovementChallenge",rae="FaceMovementClientChallenge",sae="FaceMovementServerChallenge",ek="Height",py="InitialFace",aae="InitialFaceDetectedTimestamp",tk="InternalServerException",oae="Left",iae="LightChallengeType",nk="LivenessRequestStream",rk="LivenessResponseStream",io="Message",cae="OvalFitTimeout",lae="OvalHeightWidthRatio",uae="OvalIouHeightThreshold",dae="OvalIouThreshold",fae="OvalIouWidthThreshold",hy="OvalParameters",pae="PreviousColor",hae="RGB",mae="ServerChallenge",gae="StartFaceLivenessSession",yae="StartFaceLivenessSessionRequest",vae="StartFaceLivenessSessionResponse",sk="SessionInformation",ak="SessionId",bae="SequenceNumber",wae="SessionNotFoundException",ok="ServiceQuotaExceededException",ik="ServerSessionInformationEvent",ck="ServiceUnavailableException",Sae="Top",lk="ThrottlingException",my="TargetFace",uk="TimestampMillis",xae="Type",_ae="Version",Iae="VideoChunk",dk="ValidationException",fk="VideoEndTimestamp",pk="VideoEvent",kae="VideoHeight",hk="VideoStartTimestamp",Eae="VideoWidth",mk="Width",Gc="client",co="error",Tae="http",lo="httpError",Xi="httpHeader",gk="server",yk="smithy.ts.sdk.synthetic.com.amazonaws.rekognitionstreaming",vk="streaming",Cae="x-amz-rekognition-streaming-liveness-challenge-versions",bk="x-amz-rekognition-streaming-liveness-session-id",Nae="x-amz-rekognition-streaming-liveness-vi
11146deo-height",Aae="x-amz-rekognition-streaming-liveness-video-width",et="com.amazonaws.rekognitionstreaming";var $ae=[-3,et,Pse,{[co]:Gc,[lo]:403},[io,oo],[0,0]];er.for(et).registerError($ae,sy);var wk=[3,et,dy,0,[mk,ek,oae,Sae],[1,1,1,1]],Sk=[3,et,fy,0,[Bse,Jse,Yse,Qse,dae,lae,fae,uae,eae,Zse,cae],[1,1,1,1,1,1,1,1,1,1,1]],Rae=[3,et,jI,0,[_ae,xae],[0,0]],Dae=[3,et,qI,0,[XI],[()=>Xae]],Fae=[3,et,VI,0,[zse,pae,bae,Lse],[()=>om,()=>om,1,1]],Mae=[3,et,Hse,0,[JI,Gse,qse],[()=>om,1,1]],Oae=[3,et,YI,0,[uk],[1]],Pae=[3,et,tae,0,[GI,hk,fk,py,my,VI],[0,1,1,()=>xk,()=>Tk,()=>Fae]],Bae=[3,et,nae,0,[hy,iae,fy,KI],[()=>Ik,0,()=>Sk,()=>Kae]],Lae=[3,et,rae,0,[GI,hk,fk,py,my],[0,1,1,()=>xk,()=>Tk]],Wae=[3,et,sae,0,[hy,fy],[()=>Ik,()=>Sk]],om=[3,et,JI,0,[hae],[65]],xk=[3,et,py,0,[dy,aae],[()=>wk,1]],_k=[-3,et,tk,{[co]:gk,[lo]:500},[io,oo],[0,0]];er.for(et).registerError(_k,ay);var Ik=[3,et,hy,0,[mk,ek,Vse,jse],[1,1,1,1]],zae=[3,et,ik,0,[sk],[()=>Hae]],kk=[-3,et,ok,{[co]:Gc,[lo]:429},[io,oo],[0,0]];er.for(et).registerError(kk,oy);var Ek=[-3,et,ck,{[co]:gk,[lo]:503},[io,oo],[0,0]];er.for(et).registerError(Ek,iy);var Hae=[3,et,sk,0,[XI],[()=>Qae]],Uae=[-3,et,wae,{[co]:Gc,[lo]:400},[io,oo],[0,0]];er.for(et).registerError(Uae,uy);var Vae=[3,et,yae,0,[ak,Eae,kae,Use,nk],[[0,{[Xi]:bk}],[0,{[Xi]:Aae}],[0,{[Xi]:Nae}],[0,{[Xi]:Cae}],[()=>Yae,16]]],jae=[3,et,vae,0,[ak,rk],[[0,{[Xi]:bk}],[()=>Jae,16]]],Tk=[3,et,my,0,[dy,Xse,Kse],[()=>wk,1,1]],Ck=[-3,et,lk,{[co]:Gc,[lo]:429},[io,oo],[0,0]];er.for(et).registerError(Ck,cy);var Nk=[-3,et,dk,{[co]:Gc,[lo]:400},[io,oo],[0,0]];er.for(et).registerError(Nk,ly);var Gae=[3,et,pk,0,[Iae,uk],[21,1]],qae=[-3,yk,"RekognitionStreamingServiceException",0,[],[]];er.for(yk).registerError(qae,os);var Kae=[1,et,KI,0,()=>Mae],Xae=[4,et,Wse,0,[QI,ZI],[()=>Pae,()=>Lae]],Yae=[4,et,nk,{[vk]:1},[pk,qI],[()=>Gae,()=>Dae]],Jae=[4,et,rk,{[vk]:1},[ik,YI,jI,dk,tk,lk,ok,ck],[()=>zae,()=>Oae,()=>Rae,[()=>Nk,0],[()=>_k,0],[()=>Ck,0],[()=>kk,0],[()=>Ek,0]]],Qae=[4,et,mae,0,[QI,ZI],[()=>Bae,()=>Wae]],Zae=[9,et,gae,{[Tae]:["POST","/start-face-liveness-session",200]},()=>Vae,()=>jae];class eoe extends yI.classBuilder().ep(Yre).m(function(e,n,r,s){return[ZZ(r,e.getEndpointParameterInstructions()),Cee(r),sre(r,{headerPrefix:"x-amz-rekognition-streaming-liveness-"})]}).s("RekognitionStreamingService","StartFaceLivenessSession",{eventStream:{input:!0,output:!0}}).n("RekognitionStreamingClient","StartFaceLivenessSessionCommand").sc(Zae).build(){}const toe="3.6.7",noe="ui-react-liveness/".concat(toe),roe=()=>noe;var p0;(function(t){t.HEADER="header",t.QUERY="query"})(p0||(p0={}));var h0;(function(t){t.HEADER="header",t.QUERY="query"})(h0||(h0={}));var m0;(function(t){t.HTTP="http",t.HTTPS="https"})(m0||(m0={}));var g0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(g0||(g0={}));var y0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(y0||(y0={}));var v0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(v0||(v0={}));var b0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(b0||(b0={}));class soe{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const n=e;return typeof n.statusCode=="number"&&typeof n.headers=="object"}}const aoe=2e3,Ak="Websocket connection timeout",ooe=t=>t.protocol==="ws:"||t.protocol==="wss:",ioe=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream,coe=t=>t[Symbol.asyncIterator]?t:ioe(t)?PI(t):{[Symbol.asyncIterator]:async function*(){yield t}},loe=t=>typeof ReadableStream=="function"?ey(t):t;class uoe{constructor(e,n=new ni){this.metadata={handlerProtocol:"websocket/h1.1"},this.sockets={},this.utf8decoder=new TextDecoder,this.httpHandler=n,typeof e=="function"?(this.config={},this.configPromise=e().then(r=>this.config=r!=null?r:{})):(this.config=e!=null?e:{},this.configPromise=Promise.resolve(this.config))}destroy(){for(const[e,n]of Object.entries(this.sockets)){for(const r of n)r.close(1e3,"Socket closed through destroy() call");delete this.sockets[e]}}async handle(e){if(!ooe(e))return this.httpHandler.handle(e);const n=OI(e),r=new WebSocket(n);this.sockets[n]||(this.sockets[n]=[]),this.sockets[n].push(r),r.binaryType="arraybuffer";const{connectionTimeout:s=aoe}=await this.configPromise;await this.waitForReady(r,s);const{body:a}=e,o=coe(a),i=this.connect(r,o),l=loe(i);return{response:new soe({statusCode:200,body:l})}}updateHttpClientConfig(e,n){this.configPromise=this.configPromise.then(r=>({...r,[e]:n}))}httpHandlerConfigs(){var e;return(e=this.config)!=null?e:{}}removeNotUsableSockets(e){var n;this.sockets[e]=((n=this.sockets[e])!=null?n:[]).filter(r=>!(r.readyState===WebSocket.CLOSING||r.readyState===WebSocket.CLOSED))}waitForReady(e,n){return new Promise((r,s)=>{const a=setTimeout(()=>{this.removeNotUsableSockets(e.url),s(new Error(Ak))},n);e.onopen=()=>{clearTimeout(a),r()}})}connect(e,n){let r,s=!1;const a=[];let o=null,i=null,l=!1,u;e.onmessage=f=>{const p=new Uint8Array(f.data);if(o){const h=o;o=null,i=null,h({done:!1,value:p})}else a.push(p)},e.onerror=f=>{if(s=!0,e.close(),l=!0,u=f,i){const p=i;o=null,i=null,p(f)}},e.onclose=f=>{if(this.removeNotUsableSockets(e.url),!s&&(l=!0,r?u=r:f.code!==ka.SUCCESS_CODE&&f.code!==1001&&(u=new Error("Server ended the connection unexpectedly (code ".concat(f.code)+(f.reason?": ".concat(f.reason):"")+")")),o))if(u){const p=i;o=null,i=null,p(u)}else{const p=o;o=null,i=null,p({done:!0,value:void 0})}};const c={[Symbol.asyncIterator]:()=>({next:()=>a.length>0?Promise.resolve({done:!1,value:a.shift()}):l?u?Promise.reject(u instanceof Error?u:new Error("Stream ended with an error")):Promise.resolve({done:!0,value:void 0}):new Promise((f,p)=>{o=f,i=p})})};return(async()=>{try{for await(const f of n){const p=this.utf8decoder.decode(f);if(p.includes("closeCode")){const h=p.match(/"closeCode":([0-9]*)/);if(h){const m=h[1];e.close(parseInt(m))}continue}e.send(f)}}catch(f){f instanceof Error&&(r=f)}finally{e.close(ka.SUCCESS_CODE)}})(),c}}const doe=t=>typeof t=="function",foe=t=>!!(t!=null&&t.accessKeyId&&(t!=null&&t.secretAccessKey));async function poe(t){const e=doe(t);if(t&&!e)throw new Error("Invalid credentialsProvider");if(e)return t;try{const n=(await zE()).credentials;if(foe(n))return n;throw new Error("Missing credentials")}catch(n){const{message:r}=n;throw new Error("Invalid credentials: ".concat(r))}}
11146const hoe="X-Amz-Algorithm",moe="X-Amz-Credential",$k="X-Amz-Date",goe="X-Amz-SignedHeaders",yoe="X-Amz-Expires",Rk="X-Amz-Signature",Dk="X-Amz-Security-Token",Fk="authorization",Mk=$k.toLowerCase(),voe="date",boe=[Fk,Mk,voe],woe=Rk.toLowerCase(),im="x-amz-content-sha256",Soe=Dk.toLowerCase(),xoe={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},_oe=/^proxy-/,Ioe=/^sec-/,Xp="AWS4-HMAC-SHA256",koe="AWS4-HMAC-SHA256-PAYLOAD",Eoe="UNSIGNED-PAYLOAD",Toe=50,Ok="aws4_request",Coe=60*60*24*7,Il={},Yp=[],Jp=(t,e,n)=>"".concat(t,"/").concat(e,"/").concat(n,"/").concat(Ok),Noe=async(t,e,n,r,s)=>{const a=await w0(t,e.secretAccessKey,e.accessKeyId),o="".concat(n,":").concat(r,":").concat(s,":").concat(en(a),":").concat(e.sessionToken);if(o in Il)return Il[o];for(Yp.push(o);Yp.length>Toe;)delete Il[Yp.shift()];let i="AWS4".concat(e.secretAccessKey);for(const l of[n,r,s,Ok])i=await w0(t,i,l);return Il[o]=i},w0=(t,e,n)=>{const r=new t(e);return r.update(as(n)),r.digest()},S0=({headers:t},e,n)=>{const r={};for(const s of Object.keys(t).sort()){if(t[s]==null)continue;const a=s.toLowerCase();(a in xoe||e!=null&&e.has(a)||_oe.test(a)||Ioe.test(a))&&(!n||n&&!n.has(a))||(r[a]=t[s].trim().replace(/\s+/g," "))}return r},Qp=async({headers:t,body:e},n)=>{for(const r of Object.keys(t))if(r.toLowerCase()===im)return t[r];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||J_(e)){const r=new n;return r.update(as(e)),en(await r.digest())}return Eoe};class Aoe{format(e){const n=[];for(const a of Object.keys(e)){const o=Ts(a);n.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[a]))}const r=new Uint8Array(n.reduce((a,o)=>a+o.byteLength,0));let s=0;for(const a of n)r.set(a,s),s+=a.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,e.value,!1),new Uint8Array(n.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(a.buffer);return o.set(e.value,3),o;case"string":const i=Ts(e.value),l=new DataView(new ArrayBuffer(3+i.byteLength));l.setUint8(0,7),l.setUint16(1,i.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(i,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(gy.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!$oe.test(e.value))throw new Error("Invalid UUID received: ".concat(e.value));const d=new Uint8Array(17);return d[0]=9,d.set(Jf(e.value.replace(/\-/g,"")),1),d}}}var x0;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(x0||(x0={}));const $oe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class gy{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error("".concat(e," is too large (or, if negative, too small) to represent as an Int64"));const n=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)n[r]=s;return e<0&&_0(n),new gy(n)}valueOf(){const e=this.bytes.slice(0),n=e[0]&128;return n&&_0(e),parseInt(en(e),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function _0(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}const Roe=(t,e)=>{t=t.toLowerCase();for(const n of Object.keys(e))if(t===n.toLowerCase())return!0;return!1},Doe=(t,e={})=>{var s,a;const{headers:n,query:r={}}=fn.clone(t);for(const o of Object.keys(n)){const i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!((s=e.unhoistableHeaders)!=null&&s.has(i))||(a=e.hoistableHeaders)!=null&&a.has(i))&&(r[o]=n[o],delete n[o])}return{...t,headers:n,query:r}},I0=t=>{t=fn.clone(t);for(const e of Object.keys(t.headers))boe.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},Foe=({query:t={}})=>{const e=[],n={};for(const r of Object.keys(t)){if(r.toLowerCase()===woe)continue;const s=Pr(r);e.push(s);const a=t[r];
11146typeof a=="string"?n[s]="".concat(s,"=").concat(Pr(a)):Array.isArray(a)&&(n[s]=a.slice(0).reduce((o,i)=>o.concat(["".concat(s,"=").concat(Pr(i))]),[]).sort().join("&"))}return e.sort().map(r=>n[r]).filter(r=>r).join("&")},Moe=t=>Ooe(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Ooe=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;class Poe{constructor({applyChecksum:e,credentials:n,region:r,service:s,sha256:a,uriEscapePath:o=!0}){this.service=s,this.sha256=a,this.uriEscapePath=o,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Or(r),this.credentialProvider=Or(n)}createCanonicalRequest(e,n,r){const s=Object.keys(n).sort();return"".concat(e.method,"\n").concat(this.getCanonicalPath(e),"\n").concat(Foe(e),"\n").concat(s.map(a=>"".concat(a,":").concat(n[a])).join("\n"),"\n\n").concat(s.join(";"),"\n").concat(r)}async createStringToSign(e,n,r,s){const a=new this.sha256;a.update(as(r));const o=await a.digest();return"".concat(s,"\n").concat(e,"\n").concat(n,"\n").concat(en(o))}getCanonicalPath({path:e}){if(this.uriEscapePath){const n=[];for(const a of e.split("/"))(a==null?void 0:a.length)!==0&&a!=="."&&(a===".."?n.pop():n.push(a));const r="".concat(e!=null&&e.startsWith("/")?"/":"").concat(n.join("/")).concat(n.length>0&&(e!=null&&e.endsWith("/"))?"/":"");return Pr(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){const n=Moe(e).replace(/[\-:]/g,"");return{longDate:n,shortDate:n.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class Boe extends Poe{constructor({applyChecksum:e,credentials:n,region:r,service:s,sha256:a,uriEscapePath:o=!0}){super({applyChecksum:e,credentials:n,region:r,service:s,sha256:a,uriEscapePath:o}),this.headerFormatter=new Aoe}async presign(e,n={}
11146){const{signingDate:r=new Date,expiresIn:s=3600,unsignableHeaders:a,unhoistableHeaders:o,signableHeaders:i,hoistableHeaders:l,signingRegion:u,signingService:c}=n,d=await this.credentialProvider();this.validateResolvedCredentials(d);const f=u!=null?u:await this.regionProvider(),{longDate:p,shortDate:h}=this.formatDate(r);if(s>Coe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=Jp(h,f,c!=null?c:this.service),g=Doe(I0(e),{unhoistableHeaders:o,hoistableHeaders:l});d.sessionToken&&(g.query[Dk]=d.sessionToken),g.query[hoe]=Xp,g.query[moe]="".concat(d.accessKeyId,"/").concat(m),g.query[$k]=p,g.query[yoe]=s.toString(10);const v=S0(g,a,i);return g.query[goe]=this.getCanonicalHeaderList(v),g.query[Rk]=await this.getSignature(p,m,this.getSigningKey(d,f,h,c),this.createCanonicalRequest(g,v,await Qp(e,this.sha256))),g}async sign(e,n){return typeof e=="string"?this.signString(e,n):e.headers&&e.payload?this.signEvent(e,n):e.message?this.signMessage(e,n):this.signRequest(e,n)}async signEvent({headers:e,payload:n},{signingDate:r=new Date,priorSignature:s,signingRegion:a,signingService:o}){const i=a!=null?a:await this.regionProvider(),{shortDate:l,longDate:u}=this.formatDate(r),c=Jp(l,i,o!=null?o:this.service),d=await Qp({headers:{},body:n},this.sha256),f=new this.sha256;f.update(e);const p=en(await f.digest()),h=[koe,u,c,s,p,d].join("\n");return this.signString(h,{signingDate:r,signingRegion:i,signingService:o})}async signMessage(e,{signingDate:n=new Date,signingRegion:r,signingService:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:n,signingRegion:r,signingService:s,priorSignature:e.priorSignature}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:n=new Date,signingRegion:r,signingService:s}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const o=r!=null?r:await this.regionProvider(),{shortDate:i}
11146=this.formatDate(n),l=new this.sha256(await this.getSigningKey(a,o,i,s));return l.update(as(e)),en(await l.digest())}async signRequest(e,{signingDate:n=new Date,signableHeaders:r,unsignableHeaders:s,signingRegion:a,signingService:o}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const l=a!=null?a:await this.regionProvider(),u=I0(e),{longDate:c,shortDate:d}=this.formatDate(n),f=Jp(d,l,o!=null?o:this.service);u.headers[Mk]=c,i.sessionToken&&(u.headers[Soe]=i.sessionToken);const p=await Qp(u,this.sha256);!Roe(im,u.headers)&&this.applyChecksum&&(u.headers[im]=p);const h=S0(u,s,r),m=await this.getSignature(c,f,this.getSigningKey(i,l,d,o),this.createCanonicalRequest(u,h,p));return u.headers[Fk]="".concat(Xp," ")+"Credential=".concat(i.accessKeyId,"/").concat(f,", ")+"SignedHeaders=".concat(this.getCanonicalHeaderList(h),", ")+"Signature=".concat(m),u}async getSignature(e,n,r,s){const a=await this.createStringToSign(e,n,s,Xp),o=new this.sha256(await r);return o.update(as(a)),en(await o.digest())}getSigningKey(e,n,r,s){return Noe(this.sha256,e,r,n,s||this.service)}}class Loe extends Boe{presign(e,n){return super.presign(e,{...n,expiresIn:xC,unsignableHeaders:new Set(Object.keys(e.headers).filter(r=>r!=="host"))})}}const Woe=3e5;class vs{static getAttemptCountAndUpdateTimestamp(){return Date.now()-vs.timestamp>Woe?vs.attemptCount=1:vs.attemptCount+=1,vs.timestamp=Date.now(),vs.attemptCount}}vs.attemptCount=0;vs.timestamp=Date.now();const zoe=(t,e)=>n=>async r=>(r.request.query["attempt-count"]=t.toString(),r.request.query["precheck-view-enabled"]=e?"1":"0",await n(r)),Hoe="".concat(OE()," ").concat(roe());async function Uoe({credentialsProvider:t,endpointOverride:e,region:n,systemClockOffset:r}){const s={credentials:await poe(t),customUserAgent:Hoe,region:n,requestHandler:new uoe({connectionTimeout:g1}),signerConstructor:Loe,systemClockOffset:r};return Ya(e)&&(s.endpointProvider=()=>({url:new URL(e)})),new Ose(s)}const Voe=({requestStream:t,sessionId:e,videoWidth:n,videoHeight:r})=>({ChallengeVersions:IC,SessionId:e,LivenessRequestStream:t,VideoWidth:n,VideoHeight:r});async function joe(t){const e=await Uoe(t);return e.middlewareStack.add(zoe(t.attemptCount,t.preCheckViewEnabled),{step:"build",name:"telemetryMiddleware",tags:["liveness","amplify-ui"]}),{async getResponseStream(n){const r=new eoe(Voe(n)),{LivenessResponseStream:s}=await e.send(r);return s}}}var Gs,Oa,Ln,Ls,Iu,ku,ic,cc,Ro,Eu,Hl,$a,Pk,Bk,cm,k0,Lk;class Goe{constructor(e){if(Gs.add(this),Oa.set(this,void 0),Ln.set(this,void 0),Ls.set(this,void 0),Iu.set(this,!1),ku.set(this,void 0),ic.set(this,void 0),cc.set(this,void 0),Ro.set(this,void 0),Eu.set(this,void 0),Hl.set(this,void 0),$a.set(this,void 0),typeof MediaRecorder>"u")throw Error("MediaRecorder is not supported by this browser");At(this,Oa,[],"f"),At(this,Ln,new MediaRecorder(e,{bitsPerSecond:1e6}),"f"),At(this,Ls,xe(this,Ln,"f"),"f"),At(this,Hl,xe(this,Gs,"m",Bk).call(this),"f"),At(this,$a,{},"f")}getVideoStream(){return xe(this,Hl,"f")}setNewVideoStream(e){xe(this,Gs,"m",Lk).call(this),At(this,Ln,new MediaRecorder(e,{bitsPerSecond:1e6}),"f"),xe(this,Gs,"m",cm).call(this,xe(this,Ln,"f"))}dispatchStreamEvent(e){const{type:n}=e,r=n==="streamStop"?void 0:e.data;xe(this,Ln,"f").dispatchEvent(new MessageEvent(n,{data:r}))}getRecordingStartTimestamp(){if(nc(xe(this,cc,"f"))||nc(xe(this,Ro,"f")))throw new Error("Recording has not started");return Math.round(.73*(xe(this,cc,"f")-xe(this,Ro,"f"))+xe(this,Ro,"f"))}getRecordingEndedTimestamp(){if(nc(xe(this,ic,"f")))throw new Error("Recording has not ended");return xe(this,ic,"f")}startRecording(){xe(this,Gs,"m",Pk).call(this),At(this,Ro,Date.now(),"f"),xe(this,Ln,"f").start(wC)}isRecording(){return xe(this,Ln,"f").state==="recording"}getChunksLength(){return xe(this,Oa,"f").length}hasRecordingStarted(){return xe(this,Iu,"f")&&xe(this,ku,"f")!==void 0}async stopRecording(){return this.isRecording()&&xe(this,Ln,"f").stop(),xe(this,Eu,"f")}}Oa=new WeakMap,Ln=new WeakMap,Ls=new WeakMap,Iu=new WeakMap,ku=new WeakMap,ic=new WeakMap,cc=new WeakMap,Ro=new WeakMap,Eu=new WeakMap,Hl
11146=new WeakMap,$a=new WeakMap,Gs=new WeakSet,Pk=function(){At(this,Oa,[],"f")},Bk=function(){return new ReadableStream({start:e=>{xe(this,Gs,"m",cm).call(this,xe(this,Ln,"f"),e)}})},cm=function(e,n){const r=n?({data:l})=>{l&&l.size>0&&(xe(this,Oa,"f").length===0&&At(this,ku,Date.now(),"f"),xe(this,Oa,"f").push(l),n.enqueue({type:"streamVideo",data:l}))}:({data:l})=>{xe(this,Ls,"f").dispatchEvent(new MessageEvent("dataavailable",{data:l}))};e.ondataavailable=r;const s=n?l=>{const{data:u}=l;n.enqueue({type:"sessionInfo",data:u})}:l=>{const{data:u}=l;xe(this,Ls,"f").dispatchEvent(new MessageEvent("sessionInfo",{data:u}))};e.addEventListener("sessionInfo",s);const a=n?()=>{n.enqueue({type:"streamStop"})}:()=>{xe(this,Ls,"f").dispatchEvent(new MessageEvent("streamStop"))};e.addEventListener("streamStop",a);const o=n?l=>{const{data:u}=l;n.enqueue({type:"closeCode",data:u})}:l=>{const{data:u}=l;xe(this,Ls,"f").dispatchEvent(new MessageEvent("closeCode",{data:u}))};e.addEventListener("closeCode",o);const i=n?()=>{n.close()}:()=>{xe(this,Ls,"f").dispatchEvent(new MessageEvent("endStream"))};e.addEventListener("endStream",i),xe(this,Gs,"m",k0).call(this),At(this,$a,{endStream:i,closeCode:o,streamStop:a,sessionInfo:s,dataavailable:r},"f")},k0=function(){xe(this,Ln,"f").onstart=()=>{At(this,Iu,!0,"f"),At(this,cc,Date.now(),"f")},At(this,Eu,new Promise(e=>{xe(this,Ln,"f").onstop=()=>{At(this,ic,Date.now(),"f"),e()}}),"f"),xe(this,Ln,"f").onerror=()=>{this.stopRecording()}},Lk=function(){Object.keys(xe(this,$a,"f")).forEach(n=>{xe(this,Ln,"f").removeEventListener(n,xe(this,$a,"f")[n])}),At(this,$a,{},"f")};const qoe=t=>!!(t!=null&&t.ServerSessionInformationEvent),Koe=t=>{const{message:e}=t;return e.includes(Ak)},Xoe=t=>!!(t!=null&&t.DisconnectionEvent),Yoe=t=>!!(t!=null&&t.ValidationException),Joe=t=>!!(t!=null&&t.InternalServerException),Qoe=t=>!!(t!=null&&t.ThrottlingException),Zoe=t=>!!(t!=null&&t.ServiceQuotaExceededException),eie=t=>{const{message:e,name:n}=t;return n==="InvalidSignatureException"&&e.includes("valid region")},Tu={width:{min:320,ideal:640},height:{min:240,ideal:480},frameRate:{min:15,ideal:30,max:60},facingMode:"user"},yy="AmplifyLivenessCameraId",tie=7e3;let Wk;const Oi=t=>{var n,r,s;const e=(r=(n=t.videoAssociatedParams)==null?void 0:n.selectableDevices)==null?void 0:r.find(a=>{var o;return a.deviceId===((o=t.videoAssociatedParams)==null?void 0:o.selectedDeviceId)});return e?{deviceId:e.deviceId,groupId:e.groupId,label:(s=e.label)!=null?s:""}:void 0},nie=async t=>{try{const e=await Wk;for await(const n of e)qoe(n)?t({type:"SET_SESSION_INFO",data:{serverSessionInformation:n.ServerSessionInformationEvent.SessionInformation}}):Xoe(n)?t({type:"DISCONNECT_EVENT"}):Yoe(n)?t({type:"SERVER_ERROR",data:{error:{...n.ValidationException}}}):Joe(n)?t({type:"SERVER_ERROR",data:{error:{...n.InternalServerException}}}):Qoe(n)?t({type:"SERVER_ERROR",data:{error:{...n.ThrottlingException}}}):Zoe(n)&&t({type:"SERVER_ERROR",data:{error:{...n.ServiceQuotaExceededException}}})}catch(e){eie(e)?t({type:"SERVER_ERROR",data:{error:new Error("Invalid region in FaceLivenessDetector or credentials are scoped to the wrong region.")}}):e instanceof Error&&t({type:Koe(e)?"CONNECTION_TIMEOUT":"SERVER_ERROR",data:{error:e}})}};function rie(){return localStorage.getItem(yy)}function E0(t){localStorage.setItem(yy,t)}const sie=rC({id:"livenessMachine",initial:"initCamera",predictableActionArguments:!0,context:{challengeId:My(),errorMessage:void 0,maxFailedAttempts:0,failedAttempts:0,componentProps:void 0,parsedSessionInformation:void 0,serverSessionInformation:void 0,videoAssociatedParams:{videoConstraints:Tu,selectableDevices:[]},ovalAssociatedParams:void 0,faceMatchAssociatedParams:{illuminationState:void 0,faceMatchState:void 0,faceMatchPercentage:25,currentDetectedFace:void 0,startFace:void 0,endFace:void 0},freshnessColorAssociatedParams:{freshnessColorEl:void 0,freshnessColors:[],freshnessColorsComplete:!1},colorSequenceDisplay:void 0,errorState:void 0,livenessStreamProvider:void 0,responseStreamActorRef:void 0,shouldDisconnect:!1,faceMatchStateBeforeStart:void 0,isFaceFarEnoughBeforeRecording:void 0,isRecordingStopped:!1},on:{CANCEL:"userCancel",TIMEOUT:{target:"retryableTimeout",actions:"updateErrorStateForTimeout"},SET_SESSION_INFO:{internal:!0,actions:"updateSessionInfo"},DISCONNECT_EVENT:{internal:!0,actions:"updateShouldDisconnect"},SET_DOM_AND_CAMERA_DETAILS:{actions:"setDOMAndCameraDetails"},UPDATE_DEVICE_AND_STREAM:{actions:"updateDeviceAndStream",target:"start"},SERVER_ERROR:{target:"error",actions:"updateErrorStateForServer"},CONNECTION_TIMEOUT:{target:"error",actions:"updateErrorStateForConnectionTimeout"},RUNTIME_ERROR:{target:"error",actions:"updateErrorStateForRuntime"},MOBILE_LANDSCAPE_WARNING:{target:"mobileLandscapeWarning",actions:"updateErrorStateForServer"}}
11146,states:{initCamera:{initial:"cameraCheck",on:{SET_DOM_AND_CAMERA_DETAILS:{actions:"setDOMAndCameraDetails",target:"#livenessMachine.initWebsocket"}},states:{cameraCheck:{entry:"resetErrorState",invoke:{src:"checkVirtualCameraAndGetStream",onDone:{target:"waitForDOMAndCameraDetails",actions:"updateVideoMediaStream"},onError:{target:"#livenessMachine.permissionDenied"}}},waitForDOMAndCameraDetails:{}}},initWebsocket:{entry:()=>{},initial:"initializeLivenessStream",states:{initializeLivenessStream:{invoke:{src:"openLivenessStreamConnection",onDone:{target:"waitForSessionInfo",actions:["updateLivenessStreamProvider","spawnResponseStreamActor"]},onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},waitForSessionInfo:{entry:()=>{},after:{0:{target:"#livenessMachine.start",cond:"hasParsedSessionInfo"},100:{target:"waitForSessionInfo"}}}}},start:{entry:["initializeFaceDetector",()=>{}],always:[{target:"detectFaceBeforeStart",cond:"shouldSkipStartScreen"}],on:{BEGIN:"detectFaceBeforeStart"}},detectFaceBeforeStart:{invoke:{src:"detectFace",onDone:{target:"checkFaceDetectedBeforeStart",actions:"updateFaceMatchBeforeStartDetails"},onError:{target:"error",actions:"updateErrorStateForRuntime"}}},checkFaceDetectedBeforeStart:{after:{0:{target:"detectFaceDistanceBeforeRecording",cond:"hasSingleFaceBeforeStart"},100:{target:"detectFaceBeforeStart"}}},detectFaceDistanceBeforeRecording:{invoke:{src:"detectFaceDistance",onDone:{target:"checkFaceDistanceBeforeRecording",actions:"updateFaceDistanceBeforeRecording"},onError:{target:"error",actions:"updateErrorStateForRuntime"}}},checkFaceDistanceBeforeRecording:{after:{0:{target:"recording",cond:"hasEnoughFaceDistanceBeforeRecording"},100:{target:"detectFaceDistanceBeforeRecording"}}},recording:{entry:["clearErrorState","startRecording","sendTimeoutAfterOvalDrawingDelay"],initial:"ovalDrawing",states:{ovalDrawing:{invoke:{src:"detectInitialFaceAndDrawOval",onDone:{target:"checkFaceDetected",actions:["updateOvalAndFaceDetailsPostDraw","sendTimeoutAfterOvalMatchDelay"]},onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},checkFaceDetected:{after:{0:{target:"cancelOvalDrawingTimeout",cond:"hasSingleFace"},100:{target:"ovalDrawing"}}},cancelOvalDrawingTimeout:{entry:["cancelOvalDrawingTimeout","sendTimeoutAfterRecordingDelay"],after:{0:{target:"checkRecordingStarted"}}},checkRecordingStarted:{entry:()=>{},after:{0:{target:"ovalMatching",cond:"hasRecordingStarted",actions:"updateRecordingStartTimestamp"},100:{target:"checkRecordingStarted"}}},ovalMatching:{entry:"cancelRecordingTimeout",invoke:{src:"detectFaceAndMatchOval",onDone:{target:"checkMatch",actions:"updateFaceDetailsPostMatch"}}},checkMatch:{entry:()=>{},after:{0:{target:"handleChallenge",cond:"hasFaceMatchedInOval",actions:["setFaceMatchTimeAndStartFace","updateEndFaceMatch","setColorDisplay","cancelOvalMatchTimeout","cancelOvalDrawingTimeout"]},1:{target:"ovalMatching"}}},handleChallenge:{entry:()=>{},always:[{target:"delayBeforeFlash",cond:"isFaceMovementAndLightChallenge"},{target:"success",cond:"isFaceMovementChallenge"}]},delayBeforeFlash:{entry:()=>{},after:{1e3:"flashFreshnessColors"}},flashFreshnessColors:{invoke:{src:"flashColors",onDone:[{target:"success",cond:"hasFreshnessColorShown"},{target:"flashFreshnessColors",actions:"updateFreshnessDetails"}]}},success:{entry:"stopRecording",type:"final"}},onDone:"uploading"},uploading:{initial:"pending",states:{pending:{entry:["pauseVideoStream"],invoke:{src:"stopVideo",onDone:"waitForDisconnectEvent",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},waitForDisconnectEvent:{entry:()=>{},after:{0:{cond:"getShouldDisconnect",target:"getLivenessResult"},100:{target:"waitForDisconnectEvent"}}},getLivenessResult:{entry:["freezeStream"],invoke:{src:"getLiveness",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForServer"}}}}},retryableTimeout:{entry:"updateFailedAttempts",always:[{target:"timeout",cond:"shouldTimeoutOnFailedAttempts"},{target:"start"}]},permissionDenied:{entry:"callUserPermissionDeniedCallback",on:{RETRY_CAMERA_CHECK:"initCamera"}},mobileLandscapeWarning:{entry:"callMobileLandscapeWarningCallback",always:{target:"error"}}
11146,timeout:{entry:["cleanUpResources","callUserTimeoutCallback","freezeStream"]},error:{entry:["cleanUpResources","callErrorCallback","cancelOvalDrawingTimeout","cancelOvalMatchTimeout","cancelRecordingTimeout","freezeStream"]},userCancel:{entry:["cleanUpResources","callUserCancelCallback","freezeStream","resetContext"],always:{target:"initCamera"}}}},{actions:{spawnResponseStreamActor:wt({responseStreamActorRef:()=>ZT(nie)}),updateFailedAttempts:wt({failedAttempts:t=>t.failedAttempts+1}),updateVideoMediaStream:wt({videoAssociatedParams:(t,e)=>{var n,r,s;return{...t.videoAssociatedParams,videoMediaStream:(n=e.data)==null?void 0:n.stream,selectedDeviceId:(r=e.data)==null?void 0:r.selectedDeviceId,selectableDevices:(s=e.data)==null?void 0:s.selectableDevices}}}),initializeFaceDetector:wt({ovalAssociatedParams:t=>{const{componentProps:e}=t,{faceModelUrl:n,binaryPath:r}=e.config,s=new JK(r,n);return s.triggerModelLoading(),{...t.ovalAssociatedParams,faceDetector:s}}}),updateLivenessStreamProvider:wt({livenessStreamProvider:(t,e)=>{var n;return(n=e.data)==null?void 0:n.livenessStreamProvider}}),setDOMAndCameraDetails:wt({videoAssociatedParams:(t,e)=>{var n,r,s;return{...t.videoAssociatedParams,videoEl:(n=e.data)==null?void 0:n.videoEl,canvasEl:(r=e.data)==null?void 0:r.canvasEl,isMobile:(s=e.data)==null?void 0:s.isMobile}},freshnessColorAssociatedParams:(t,e)=>{var n;return{...t.freshnessColorAssociatedParams,freshnessColorEl:(n=e.data)==null?void 0:n.freshnessColorEl}}}),updateDeviceAndStream:wt({videoAssociatedParams:(t,e)=>{var n,r,s,a,o;return E0((n=e.data)==null?void 0:n.newDeviceId),(s=t.livenessStreamProvider)==null||s.setNewVideoStream((r=e.data)==null?void 0:r.newStream),{...t.videoAssociatedParams,selectedDeviceId:(a=e.data)==null?void 0:a.newDeviceId,videoMediaStream:(o=e.data)==null?void 0:o.newStream}}}),updateRecordingStartTimestamp:wt({videoAssociatedParams:t=>{const{challengeId:e,ovalAssociatedParams:n,videoAssociatedParams:r,livenessStreamProvider:s,parsedSessionInformation:a}=t,{videoMediaStream:o}=r,i=s.getRecordingStartTimestamp();return t.livenessStreamProvider.dispatchStreamEvent({type:"sessionInfo",data:_Q({parsedSessionInformation:a,...vb(o),challengeId:e,ovalAssociatedParams:n,recordingStartedTimestamp:i})}),{...t.videoAssociatedParams,recordingStartedTimestamp:i}}}),startRecording:wt({videoAssociatedParams:t=>(t.livenessStreamProvider&&!t.livenessStreamProvider.isRecording()&&t.livenessStreamProvider.startRecording(),{...t.videoAssociatedParams})}),stopRecording:()=>{},updateFaceMatchBeforeStartDetails:wt({faceMatchStateBeforeStart:(t,e)=>e.data.faceMatchState}),updateFaceDistanceBeforeRecording:wt({isFaceFarEnoughBeforeRecording:(t,e)=>!!e.data.isFaceFarEnoughBeforeRecording}),updateFaceDistanceWhileLoading:wt({isFaceFarEnoughBeforeRecording:(t,e)=>!!e.data.isFaceFarEnoughBeforeRecording,errorState:(t,e)=>{var n;return(n=e.data)==null?void 0:n.error}}),updateOvalAndFaceDetailsPostDraw:wt({ovalAssociatedParams:(t,e)=>({...t.ovalAssociatedParams,initialFace:e.data.initialFace,ovalDetails:e.data.ovalDetails,scaleFactor:e.data.scaleFactor}),faceMatchAssociatedParams:(t,e)=>({...t.faceMatchAssociatedParams,faceMatchState:e.data.faceMatchState,illuminationState:e.data.illuminationState})}),updateFaceDetailsPostMatch:wt({faceMatchAssociatedParams:(t,e)=>({...t.faceMatchAssociatedParams,faceMatchState:e.data.faceMatchState,faceMatchPercentage:e.data.faceMatchPercentage,illuminationState:e.data.illuminationState,currentDetectedFace:e.data.detectedFace})}),updateEndFaceMatch:wt({faceMatchAssociatedParams:t=>({...t.faceMatchAssociatedParams,endFace:t.faceMatchAssociatedParams.currentDetectedFace})}),setFaceMatchTimeAndStartFace:wt({faceMatchAssociatedParams:t=>({...t.faceMatchAssociatedParams,startFace:t.faceMatchAssociatedParams.startFace===void 0?t.faceMatchAssociatedParams.currentDetectedFace:t.faceMatchAssociatedParams.startFace})}),resetErrorState:wt({errorState:t=>{}}),updateErrorStateForConnectionTimeout:wt({errorState:t=>St.CONNECTION_TIMEOUT}),updateErrorStateForTimeout:wt({errorState:(t,e)=>{var n;return((n=e.data)==null?void 0:n.errorState)||St.TIMEOUT},errorMessage:(t,e)=>{var n;return(n=e.data)==null?void 0:n.message}}),updateErrorStateForRuntime:wt({errorState:(t,e)=>{var n;return((n=e.data)==null?void 0:n.errorState)||St.RUNTIME_ERROR}}),updateErrorStateForServer:wt({errorState:t=>St.SERVER_ERROR}),clearErrorState:wt({errorState:t=>{}}),updateSessionInfo:wt({parsedSessionInformation:(t,e)=>{const{serverSessionInformation:n}=e.data;return vQ(n)}}),updateShouldDisconnect:wt({shouldDisconnect:()=>!0}
11146),updateFreshnessDetails:wt({freshnessColorAssociatedParams:(t,e)=>({...t.freshnessColorAssociatedParams,freshnessColorsComplete:e.data.freshnessColorsComplete})}),setColorDisplay:wt({colorSequenceDisplay:({parsedSessionInformation:t})=>new pQ(RC(t))}),sendTimeoutAfterOvalDrawingDelay:Nl({type:"RUNTIME_ERROR",data:{message:"Client failed to draw oval."}},{delay:5e3,id:"ovalDrawingTimeout"}),cancelOvalDrawingTimeout:Al("ovalDrawingTimeout"),sendTimeoutAfterRecordingDelay:Nl({type:"RUNTIME_ERROR",data:{message:"Client failed to start recording."}},{delay:5e3,id:"recordingTimeout"}),cancelRecordingTimeout:Al("recordingTimeout"),sendTimeoutAfterOvalMatchDelay:Nl({type:"TIMEOUT",data:{message:"Client timed out waiting for face to match oval."}},{delay:t=>{var e,n;return(n=(e=t.parsedSessionInformation.Challenge.ChallengeConfig)==null?void 0:e.OvalFitTimeout)!=null?n:tie},id:"ovalMatchTimeout"}),cancelOvalMatchTimeout:Al("ovalMatchTimeout"),callUserPermissionDeniedCallback:wt({errorState:(t,e)=>{var o,i;let n;e.data.message.includes("15 fps")?n=St.CAMERA_FRAMERATE_ERROR:e.data.message.includes(St.DEFAULT_CAMERA_NOT_FOUND_ERROR)?n=St.DEFAULT_CAMERA_NOT_FOUND_ERROR:n=St.CAMERA_ACCESS_ERROR;const r=e.data.message||e.data.Message,s=new Error(r),a={state:n,error:s};return(i=(o=t.componentProps).onError)==null||i.call(o,a,Oi(t)),n}}),callMobileLandscapeWarningCallback:wt({errorState:()=>St.MOBILE_LANDSCAPE_ERROR}),getSelectedDeviceInfo:t=>Oi(t),callUserCancelCallback:t=>{var n;const{onUserCancel:e}=(n=t.componentProps)!=null?n:{};if(e)try{e()}catch(r){console.error("Error in onUserCancel callback:",r)}},callUserTimeoutCallback:t=>{var r,s,a;const e=new Error((r=t.errorMessage)!=null?r:"Client Timeout");e.name=t.errorState;const n={state:t.errorState,error:e};(a=(s=t.componentProps).onError)==null||a.call(s,n,Oi(t))},callErrorCallback:(t,e)=>{var r,s,a;const n={state:t.errorState,error:((r=e.data)==null?void 0:r.error)||e.data};(a=(s=t.componentProps).onError)==null||a.call(s,n,Oi(t))},cleanUpResources:t=>{var r;const{freshnessColorEl:e}=t.freshnessColorAssociatedParams;e&&(e.style.display="none");let n=ka.DEFAULT_ERROR_CODE;t.errorState===St.TIMEOUT?n=ka.FACE_FIT_TIMEOUT:t.errorState===St.RUNTIME_ERROR?n=ka.RUNTIME_ERROR:t.errorState===St.FACE_DISTANCE_ERROR||t.errorState===St.MULTIPLE_FACES_ERROR?n=ka.USER_ERROR_DURING_CONNECTION:t.errorState===void 0&&(n=ka.USER_CANCEL),(r=t.livenessStreamProvider)==null||r.stopRecording().then(()=>{var s;(s=t.livenessStreamProvider)==null||s.dispatchStreamEvent({type:"closeCode",data:{closeCode:n}})})},freezeStream:t=>{const{videoMediaStream:e,videoEl:n}=t.videoAssociatedParams;t.isRecordingStopped=!0,n==null||n.pause(),e==null||e.getTracks().forEach(function(r){r.stop()})},pauseVideoStream:t=>{const{videoEl:e}=t.videoAssociatedParams;t.isRecordingStopped=!0,e.pause()},resetContext:wt({challengeId:My(),maxFailedAttempts:0,failedAttempts:0,componentProps:t=>t.componentProps,parsedSessionInformation:t=>{},videoAssociatedParams:t=>({videoConstraints:Tu}),ovalAssociatedParams:t=>{},errorState:t=>{},livenessStreamProvider:t=>{},responseStreamActorRef:t=>{},shouldDisconnect:!1,faceMatchStateBeforeStart:t=>{},isFaceFarEnoughBeforeRecording:t=>{},isRecordingStopped:!1})},guards:{shouldTimeoutOnFailedAttempts:t=>t.failedAttempts>=t.maxFailedAttempts,hasFaceMatchedInOval:t=>t.faceMatchAssociatedParams.faceMatchState===dt.MATCHED,hasSingleFace:t=>t.faceMatchAssociatedParams.faceMatchState===dt.FACE_IDENTIFIED,hasSingleFaceBeforeStart:t=>t.faceMatchStateBeforeStart===dt.FACE_IDENTIFIED,hasEnoughFaceDistanceBeforeRecording:t=>t.isFaceFarEnoughBeforeRecording,hasNotEnoughFaceDistanceBeforeRecording:t=>!t.isFaceFarEnoughBeforeRecording,hasFreshnessColorShown:t=>t.freshnessColorAssociatedParams.freshnessColorsComplete,hasParsedSessionInfo:t=>t.parsedSessionInformation!==void 0,hasDOMAndCameraDetails:t=>t.videoAssociatedParams.videoEl!==void 0&&t.videoAssociatedParams.canvasEl!==void 0&&t.freshnessColorAssociatedParams.freshnessColorEl!==void 0,isFaceMovementChallenge:t=>{var e,n;return((n=(e=t.parsedSessionInformation)==null?void 0:e.Challenge)==null?void 0:n.Name)===Fu.type},isFaceMovementAndLightChallenge:t=>{var e,n;return((n=(e=t.parsedSessionInformation)==null?void 0:e.Challenge)==null?void 0:n.Name)===xm.type},getShouldDisconnect:t=>!!t.shouldDisconnect,hasRecordingStarted:t=>t.livenessStreamProvider.hasRecordingStarted(),shouldSkipStartScreen:t=>{var e;return!!((e=t.componentProps)!=null&&e.disableStartScreen)}},services:{async checkVirtualCameraAndGetStream(t){var m,g,v;const{videoConstraints:e}=t.videoAssociatedParams,{componentProps:n}=t;let r;const s=!!((m=n==null?void 0:n.config)!=null&&m.deviceId);let a=!1;s?r=(g=n==null?void 0:n.config)==null?void 0:g.deviceId:r=(v=rie())!=null?v:void 0;const o=await navigator.mediaDevices.getUserMedia({video:{...e,...r?{deviceId:s?{exact:r}:{ideal:r}}:{}},audio:!1}).catch(b=>{if(b instanceof DOMException&&(b.name==="NotFoundError"||b.name==="OverconstrainedError"))return r&&!a&&(a=!0),navigator.mediaDevices.getUserMedia({video:{...e},audio:!1});throw b}),l=(await navigator.mediaDevices.enumerateDevices()).filter(b=>b.kind==="videoinput").filter(b=>!TC(b));if(!l.length)throw new Error("No real video devices found");const u=o.getTracks().filter(b=>{var S;return((S=b.getSettings().frameRate)!=null?S:0)>=15});if(u.length<1)throw new Error("No camera found with more than 15 fps");const c=u[0].getSettings().deviceId,d=l.some(b=>b.deviceId===c),f=d?c:l[0].deviceId;let p=o;d||(p=await navigator.mediaDevices.getUserMedia({video:{...e,deviceId:{exact:f}},audio:!1})),E0(f);const h={stream:p,selectedDeviceId:c,selectableDevices:l};if(a){if(s)throw new Error(St.DEFAULT_CAMERA_NOT_FOUND_ERROR);localStorage.removeItem(yy)}return h},async openLivenessStreamConnection(t){const{config:e,disableStartScreen:n}=t.componentProps,{credentialProvider:r,endpointOverride:s,systemClockOffset:a}=e,{videoHeight:o,videoWidth:i}=t.videoAssociatedParams.videoEl,l=new Goe(t.videoAssociatedParams.videoMediaStream),u=kQ(l.getVideoStream()).getRequestStream(),{getResponseStream:c}=await joe({credentialsProvider:r,endpointOverride:s,region:t.componentProps.region,attemptCount:vs.getAttemptCountAndUpdateTimestamp(),preCheckViewEnabled:!n,systemClockOffset:a});return Wk=c({requestStream:u,sessionId:t.componentProps.sessionId,videoHeight:o.toString(),videoWidth:i.toString()}),{livenessStreamProvider:l}},async detectFace(t){const{videoEl:e}=t.videoAssociatedParams,{faceDetector:n}=t.ovalAssociatedParams;return await n.modelLoadingPromise,{faceMatchState:await DC(n,e)}},async detectFaceDistance(t){const{parsedSessionInformation:e,isFaceFarEnoughBeforeRecording:n}=t,{videoEl:r,videoMediaStream:s}=t.videoAssociatedParams,{faceDetector:a}=t.ovalAssociatedParams,{width:o,height:i}=s.getTracks()[0].getSettings(),l=e.Challenge.ChallengeConfig,u=b1({width:o,height:i,ovalHeightWidthRatio:l.OvalHeightWidthRatio}),{isDistanceBelowThreshold:c}=await FC({parsedSessionInformation:e,faceDetector:a,videoEl:r,ovalDetails:u,reduceThreshold:n});return{isFaceFarEnoughBeforeRecording:c}},async detectInitialFaceAndDrawOval(t){const{parsedSessionInformation:e}=t,{videoEl:n,canvasEl:r,isMobile:s}=t.videoAssociatedParams,{faceDetector:a}=t.ovalAssociatedParams;await a.modelLoadingPromise;const o=await a.detectFaces(n);let i,l,u;switch(o.length){case 0:{l=dt.CANT_IDENTIFY,u=cv(n);break}case 1:{l=dt.FACE_IDENTIFIED,i=o[0];break}default:{l=dt.TOO_MANY;break}}if(!i)return{faceMatchState:l,illuminationState:u};const{width:c,height:d}=n.getBoundingClientRect();s?(r.width=window.innerWidth,r.height=window.innerHeight):(r.width=c,r.height=d);const f=c/n.videoWidth,p=kC({parsedSessionInformation:e,videoWidth:n.width}),h=e.Challenge.ChallengeConfig,m=fh({ovalHeightWidthRatio:h.OvalHeightWidthRatio,face:i,oval:p,frameHeight:n.videoHeight});return i.top=m.top,i.left=m.left,i.height=m.bottom-m.top,i.width=m.right-m.left,w1({canvas:r,oval:p,scaleFactor:f,videoEl:n}),{faceMatchState:l,ovalDetails:p,scaleFactor:f,initialFace:i}},async detectFaceAndMatchOval(t){const{parsedSessionInformation:e}=t,{videoEl:n}=t.videoAssociatedParams,{faceDetector:r,ovalDetails:s,initialFace:a}=t.ovalAssociatedParams,o=await r.detectFaces(n);let i,l=0,u,c;const d=e.Challenge.ChallengeConfig,f=fh({ovalHeightWidthRatio:d.OvalHeightWidthRatio,face:a,oval:s,frameHeight:n.videoHeight}),{ovalBoundingBox:p}=y1(s),h=v1(f,p);switch(o.length){case 0:{i=dt.CANT_IDENTIFY,c=cv(n);break}case 1:{u=o[0];const{faceMatchState:m,faceMatchPercentage:g}=QK({face:u,ovalDetails:s,initialFaceIntersection:h,parsedSessionInformation:e,frameHeight:n.videoHeight});i=m,l=g;break}default:{i=dt.TOO_MANY;break}}return{faceMatchState:i,faceMatchPercentage:l,illuminationState:c,detectedFace:u}},async flashColors({challengeId:t,colorSequenceDisplay:e,freshnessColorAssociatedParams:n,livenessStreamProvider:r,ovalAssociatedParams:s,videoAssociatedParams:a}){const{freshnessColorsComplete:o,freshnessColorEl:i}=n;if(o)return;const{ovalDetails:l,scaleFactor:u}=s,{videoEl:c}=a;return{freshnessColorsComplete:await e.startSequences({onSequenceColorChange:({sequenceColor:f,prevSequenceColor:p,heightFraction:h})=>{AC({heightFraction:h,overlayCanvas:i,ovalDetails:l,nextColor:f,prevColor:p,scaleFactor:u,videoEl:c})},onSequenceStart:()=>{i.style.display="block"},onSequencesComplete:()=>{i.style.display="none"},onSequenceChange:f=>{r.dispatchStreamEvent({type:"sessionInfo",data:IQ({...f,challengeId:t})})}})}},async stopVideo(t){const{challengeId:e,parsedSessionInformation:n,faceMatchAssociatedParams:r,ovalAssociatedParams:s,livenessStreamProvider:a,videoAssociatedParams:o}=t,{videoMediaStream:i}=o;if(await a.stopRecording(),a.getChunksLength()===0)throw new Error("Video chunks not recorded successfully.");a.dispatchStreamEvent({type:"sessionInfo",data:xQ({...vb(i),parsedSessionInformation:n,challengeId:e,faceMatchAssociatedParams:r,ovalAssociatedParams:s,recordingEndedTimestamp:a.getRecordingEndedTimestamp()})}),a.dispatchStreamEvent({type:"streamStop"})},async getLiveness(t){var n;const{onAnalysisComplete:e}=(n=t.componentProps)!=null?n:{};if(e)try{const r=Oi(t);await e(r)}catch(r){throw console.error("Error in onAnalysisComplete callback:",r),r}}}}),vy=G.createContext({theme:jg(),colorMode:void 0}),by={alignContent:"alignContent",alignItems:"alignItems",alignSelf:"alignSelf",area:"gridArea",aspectRatio:"aspectRatio",autoColumns:"gridAutoColumns",autoFlow:"gridAutoFlow",autoRows:"gridAutoRows",backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",basis:"flexBasis",border:"border",borderRadius:"borderRadius",borderColor:"borderColor",borderWidth:"borderWidth",borderStyle:"borderStyle",bottom:"bottom",boxShadow:"boxShadow",color:"color",column:"gridColumn",columnEnd:"gridColumnEnd",columnGap:"columnGap",columnSpan:"gridColumn",columnStart:"gridColumnStart",direction:"flexDirection",display:"display",flex:"flex",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",gap:"gap",grow:"flexGrow",height:"height",justifyContent:"justifyContent",left:"left",letterSpacing:"letterSpacing",lineHeight:"lineHeight",margin:"margin",marginBlock:"marginBlock",marginBlockEnd:"marginBlockEnd",marginBlockStart:"marginBlockStart",marginBottom:"marginBlockEnd",marginInline:"marginInline",marginInlineEnd:"marginInlineEnd",marginInlineStart:"marginInlineStart",marginLeft:"marginInlineStart",marginRight:"marginInlineEnd",marginTop:"marginBlockStart",maxHeight:"maxHeight",maxWidth:"maxWidth",minHeight:"minHeight",minWidth:"minWidth",objectFit:"objectFit",objectPosition:"objectPosition",opacity:"opacity",order:"order",overflow:"overflow",padding:"padding",paddingBlock:"paddingBlock",paddingBlockEnd:"paddingBlockEnd",paddingBlockStart:"paddingBlockStart",paddingBottom:"paddingBlockEnd",paddingInline:"paddingInline",paddingInlineEnd:"paddingInlineEnd",paddingInlineStart:"paddingInlineStart",paddingLeft:"paddingInlineStart",paddingRight:"paddingInlineEnd",paddingTop:"paddingBlockStart",position:"position",resize:"resize",right:"right",row:"gridRow",rowEnd:"gridRowEnd",rowGap:"rowGap",rowSpan:"gridRow",rowStart:"gridRowStart",shrink:"flexShrink",templateAreas:"gridTemplateAreas",templateColumns:"gridTemplateColumns",templateRows:"gridTemplateRows",textAlign:"textAlign",textDecoration:"textDecoration",textTransform:"textTransform",top:"top",transform:"transform",transformOrigin:"transformOrigin",width:"width",whiteSpace:"whiteSpace",wrap:"flexWrap"},lm={backgroundColor:"colors",borderColor:"colors",borderWidth:"borderWidths",color:"colors",borderRadius:"radii",fontSize:"fontSizes",fontWeight:"fontWeights",fontFamily:"fonts",lineHeight:"lineHeights",opacity:"opacities",boxShadow:"shadows",transform:"transforms",left:"space",right:"space",top:"space",bottom:"space",height:"space",width:"space",letterSpacing:"space",margin:"space",marginBlock:"space",marginBlockEnd:"space",marginBlockStart:"space",marginInline:"space",marginInlineEnd:"space",marginInlineStart:"space",marginLeft:"space",marginRight:"space",marginTop:"space",marginBottom:"space",maxHeight:"space",maxWidth:"space",minHeight:"space",minWidth:"space",padding:"space",paddingBlock:"space",paddingBlockEnd:"space",paddingBlockStart:"space",paddingInline:"space",paddingInlineEnd:"space",paddingInlineStart:"space",paddingLeft:"space",paddingRight:"space",paddingTop:"space",paddingBottom:"space",gap:"space",columnGap:"space",rowGap:"space"},aie=t=>t in lm,zk=t=>typeof t=="string"&&t.length===0,T0=t=>t==null||zk(t),np=t=>Object.keys(t),wy=(t,e,n)=>{if(typeof e!="string")return e;if(e.includes(" "))return e.split(" ").map(r=>wy(t,r,n)).join(" ");if(aie(t)){const r=e.split("."),s=lm[t];let a=n[s];for(let o=0;o<r.length;o++){if(a){a=a[r[o]];continue}break}return Xf(a)?"var(--".concat(Vg({path:[lm[t],...r]}),")"):e}return e},oie=({breakpoint:t,breakpoints:e,values:n})=>{const r=n[t];if(r!==void 0)return r;const s=np(e).sort((o,i)=>e[i]-e[o]),a=s.slice(s.indexOf(t));for(const o of a){const i=n[o];if(i!==void 0)return i}return null},iie=t=>np(t).reduce((e,n)=>n in S_.breakpoints.values?{...e,[n]:t[n]}:e,{}),cie=({breakpoint:t,breakpoints:e,values:n})=>{let r={};const s=np(e).sort((a,o)=>e[a]-e[o]);
11146return Array.isArray(n)?n.forEach((a,o)=>{r[s[o]]=a}):typeof n=="object"&&(r=iie(n)),oie({breakpoint:t,breakpoints:e,values:r})},lie=({breakpoints:t})=>{const e=np(t).sort((n,r)=>t[r]-t[n]);return e.map((n,r)=>{let s="";const a=t[n],o=e[r-1],i=o?t[o]-1:null;return a>=0&&(s="(min-width: ".concat(a,"px)")),i!==null&&(s&&(s+=" and "),s+="(max-width: ".concat(i,"px)")),{breakpoint:n,query:s,maxWidth:i,minWidth:a}})},uie=typeof window>"u"?G.useEffect:G.useLayoutEffect,Hk=({breakpoints:t,defaultBreakpoint:e})=>{const r=typeof window<"u"&&typeof window.matchMedia<"u"?window.matchMedia:null,s=G.useMemo(()=>lie({breakpoints:t}),[t]),[a,o]=G.useState(e),i=G.useCallback((l,u)=>{l&&o(u)},[o]);return uie(()=>{if(!r)return;const l=s.map(({query:u,breakpoint:c})=>{const d=r(u);i(d.matches,c);const f=p=>{p.matches&&o(c)};return d.addEventListener("change",f),()=>d.removeEventListener("change",f)});return()=>{l.forEach(u=>u())}},[t,o,r,s]),G.useDebugValue(a,l=>l),a},die=t=>typeof t>"u"||typeof t.theme>"u"?jg():t.theme,Sy=()=>{const t=G.useContext(vy);return die(t)},fie=()=>G.useContext(vy).colorMode,pie=({value:t,propKey:e,tokens:n})=>Xf(t)?t.toString():Ya(t)?Ya(e)?wy(e,t,n):t:null,hie=t=>t==="auto"||typeof t=="number"&&!isNaN(t)||typeof t=="string"&&!isNaN(parseFloat(t)),Zp=t=>t==="auto"?"auto":"span ".concat(t),C0=t=>hie(t)?Zp(t):Array.isArray(t)?t.map(e=>Zp(e)):typeof t=="object"&&t!=null?Object.entries(t).reduce((e,[n,r])=>({...e,[n]:Zp(r)}),{}):null,mie=t=>{const{rowSpan:e,columnSpan:n,row:r,column:s,...a}=t,{rowFromSpanValue:o,columnFromSpanValue:i}=G.useMemo(()=>({rowFromSpanValue:C0(e),columnFromSpanValue:C0(n)}),[e,n]);return{row:T0(r)?o:r,column:T0(s)?i:s,...a}},gie=t=>t in by,yie=({props:t={},style:e={},breakpoint:n,breakpoints:r,tokens:s})=>{const a={};return Object.keys(t).filter(o=>t[o]!==null).forEach(o=>{if(gie(o)){const i=t[o];if(i==null||zk(i))return;const l=by[o];let u="";Xf(i)?u=i.toString():typeof i=="string"?u=wy(o,i,s):typeof i=="number"?u=i:typeof i=="object"&&(u=pie({propKey:o,tokens:s,value:cie({values:i,breakpoint:n,breakpoints:r})})),e={...e,[l]:u}}else typeof t[o]<"u"&&(a[o]=t[o])}),{propStyles:e,nonStyleProps:a}},vie=(t,e)=>{const{breakpoints:{values:n,defaultBreakpoint:r},tokens:s}=Sy(),a=Hk({breakpoints:n,defaultBreakpoint:r}),o=mie(t);return G.useMemo(()=>yie({props:o,style:e,breakpoint:a,breakpoints:n,tokens:s}),[o,e,n,a,s])},is=t=>G.forwardRef(t),bie=({as:t="div",children:e,testId:n,ariaLabel:r,isDisabled:s,style:a,inert:o,...i},l)=>{const{propStyles:u,nonStyleProps:c}=vie(i,a);return G.createElement(t,{"aria-label":r,"data-testid":n,disabled:s,ref:l,inert:o?"":null,style:u,...c},e)},ft=is(bie);ft.displayName="View";const Pi={minX:0,minY:0,width:24,height:24},wie=({className:t,as:e="svg",fill:n="currentColor",pathData:r,viewBox:s=Pi,children:a,paths:o,...i},l)=>{var h,m,g,v;const u=(h=s.minX)!=null?h:Pi.minX,c=(m=s.minY)!=null?m:Pi.minY,d=(g=s.width)!=null?g:Pi.width,f=(v=s.height)!=null?v:Pi.height;let p;return a&&(p=a),o&&(p=o.map((b,w)=>G.createElement("path",{...b,key:w}))),r&&(p=G.createElement("path",{d:r,fill:n})),G.createElement(ft,{as:e,className:Ht(Oe.Icon,t),ref:l,viewBox:"".concat(u," ").concat(c," ").concat(d," ").concat(f),...i},p)},Uk=is(wie);Uk.displayName="Icon";const Sie=G.createContext({});function Vk(t){const e=G.useContext(Sie);if(t&&e)return e[t]}const xie=t=>{const{className:e,...n}=t;return G.createElement(ft,{as:"span",width:"1em",height:"1em",className:Ht(Oe.Icon,e),...n},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z",fill:"currentColor"})))},_ie=t=>{const{className:e,...n}=t;return G.createElement(ft,{as:"span",width:"1em",height:"1em",className:Ht(Oe.Icon,e),...n},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V15H13V17ZM13 13H11V7H13V13Z",fill:"currentColor"})))},Iie=t=>{const{className:e,...n}=t;return G.createElement(ft,{as:"span",width:"1em",height:"1em",className:Ht(Oe.Icon,e),...n},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G.createElement("path",{d:"M11 7H13V9H11V7ZM11 11H13V17H11V11ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z",fill:"currentColor"})))},kie=t=>{const{className:e,...n}=t;return G.createElement(ft,{as:"span",width:"1em",height:"1em",className:Ht(Oe.Icon,e),...n},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G.createElement("path",{d:"M1 21H23L12 2L1 21ZM13 18H11V16H13V18ZM13 14H11V10H13V14Z",fill:"currentColor"})))},xy=({variation:t,ariaHidden:e,ariaLabel:n,role:r})=>{var o,i,l,u;const s=Vk("alert");let a;switch(t){case"info":a=(o=s==null?void 0:s.info)!=null?o:G.createElement(Iie,{"aria-hidden":e,"aria-label":n,role:r});break;case"error":a=(i=s==null?void 0:s.error)!=null?i:G.createElement(_ie,{"aria-hidden":e,"aria-label":n,role:r});break;case"warning":a=(l=s==null?void 0:s.warning)!=null?l:G.createElement(kie,{"aria-hidden":e,"aria-label":n,role:r});break;case"success":a=(u=s==null?void 0:s.success)!=null?u:G.createElement(xie,{"aria-hidden":e,"aria-label":n,role:r});break}return a?G.createElement("span",{className:Oe.AlertIcon},a):null};xy.displayName="AlertIcon";const Eie=globalThis!=null&&globalThis.document?G.useLayoutEffect:()=>{},Tie="amplify-id",Cie=m3["useId".toString()]||(()=>{});let Nie=0;const N0=t=>{const[e,n]=G.useState(Cie());return Eie(()=>{t||n(r=>r!=null?r:String(Nie++))},[t]),t!=null?t:e?"".concat(Tie,"-").concat(e):""},Aie=G.createContext({isFieldsetDisabled:!1}),jk=t=>{let n=G.useContext(Aie).isFieldsetDisabled;return(n===void 0||n===!1)&&(n=t),{isFieldsetDisabled:n}},$ie=({className:t,children:e,...n},r)=>G.createElement(ft,{className:Ht(Oe.Flex,t),ref:r,...n},e),_t=is($ie);_t.displayName="Flex";const Rie="linear-empty",Die="linear-filled",Fie="circular-empty",Mie
11146="circular-filled",A0=8,um=42,kl=2*um*Math.PI,Oie=({className:t,filledColor:e,emptyColor:n,size:r,variation:s,isDeterminate:a=!1,isPercentageTextHidden:o=!1,percentage:i=0,...l},u)=>{i=Math.min(i,100),i=Math.max(i,0);const c="".concat(i,"%"),d=Ht(Oe.Loader,rs(Oe.Loader,r),rs(Oe.Loader,s),Wa(Oe.Loader,"determinate",a),t),f=G.createElement("g",null,G.createElement("line",{x1:"0",x2:"100%",y1:"50%",y2:"50%",style:{stroke:String(n)},"data-testid":Rie}),G.createElement("line",{x1:"0",x2:a?c:"100%",y1:"50%",y2:"50%",style:{stroke:a&&i===0?"none":e?String(e):void 0},"data-testid":Die}),a?G.createElement("text",{"aria-live":"polite",className:Ht(Oe.LoaderLabel,o?Oe.VisuallyHidden:null),x:"".concat(-1+i,"%"),y:"200%"},c):null),p=G.createElement("g",null,G.createElement("circle",{cx:"50%",cy:"50%",r:"".concat(um,"%"),strokeWidth:"".concat(A0,"%"),style:{stroke:String(n)},"data-testid":Fie}),G.createElement("circle",{cx:"50%",cy:"50%",r:"".concat(um,"%"),strokeWidth:"".concat(A0,"%"),style:{stroke:String(e),strokeDasharray:a?"".concat(kl,"% ").concat(kl,"%"):void 0,strokeDashoffset:a?"".concat(kl-kl*i/100,"%"):void 0},"data-testid":Mie}),a?G.createElement("text",{"aria-live":"polite",className:Ht(Oe.LoaderLabel,o?Oe.VisuallyHidden:null),x:"130%",y:"80%"},c):null);return G.createElement(ft,{as:"svg","aria-valuenow":a?i:void 0,className:d,ref:u,role:"progressbar",...l},s==="linear"?f:p)},Mc=is(Oie);Mc.displayName="Loader";const Pie=["link","primary",void 0],Bie=({className:t,children:e,colorTheme:n,isFullWidth:r=!1,isDisabled:s,isLoading:a,loadingText:o="",size:i,type:l="button",variation:u,...c},d)=>{var m;const f=Pie.includes(u)&&n?"".concat(u!=null?u:"outlined","--").concat(n):void 0,{isFieldsetDisabled:p}=jk((m=s!=null?s:a)!=null?m:c.disabled),h=Ht(Oe.Button,Oe.FieldGroupControl,rs(Oe.Button,u),rs(Oe.Button,f),rs(Oe.Button,i),Wa(Oe.Button,"disabled",p),Wa(Oe.Button,"loading",a),Wa(Oe.Button,"fullwidth",r),t);return G.createElement(ft,{ref:d,as:"button",className:h,isDisabled:p,type:l,...c},a?G.createElement(_t,{as:"span",className:Oe.ButtonLoaderWrapper},G.createElement(Mc,{size:i}),o||null):e)},uo=is(Bie);uo.displayName="Button";const Lie=t=>{const{className:e,size:n,...r}=t;return G.createElement(ft,{as:"span",width:n!=null?n:"1em",height:n!=null?n:"1em",className:Ht(Oe.Icon,e),...r},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:n?{width:n,height:n}:void 0},G.createElement("path",{d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z",fill:"currentColor"})))},Wie=({as:t="p",className:e,children:n,isTruncated:r,variation:s,...a},o)=>{const i=Ht(Oe.Text,rs(Oe.Text,s),Wa(Oe.Text,"truncated",r),e);return G.createElement(ft,{as:t,className:i,ref:o,...a},n)},Er=is(Wie);Er.displayName="Text";const zie="qa-field-description",Gk=({descriptiveText:t,labelHidden:e,...n})=>t?G.createElement(Er,{"data-testid":zie,className:Ht(Oe.FieldDescription,{[Oe.VisuallyHidden]:e}),...n},t):null;Gk.displayName="FieldDescription";const qk=({errorMessage:t,hasError:e,...n})=>e&&t?G.createElement(Er,{className:Oe.FieldErrorMessage,...n},t):null;qk.displayName="FieldErrorMessage";const Hie=({children:t,className:e,visuallyHidden:n,...r},s)=>G.createElement(ft,{as:"label",className:Ht(Oe.Label,e,{[Oe.VisuallyHidden]:n}),ref:s,...r},t),_y=is(Hie);_y.displayName="Label";const $0=(t,e)=>t&&e?"".concat(t,"-").concat(e):void 0,Uie=t=>t in by,Vie=t=>{const e={styleProps:{},rest:{}};return Object.keys(t).forEach(n=>{Uie(n)?e.styleProps={...e.styleProps,[n]:t[n]}:e.rest={...e.rest,[n]:t[n]}}),e},jie=t=>{const e=t.filter(n=>n!==void 0).join(" ");return e.length>0?e:void 0},Gie="error",qie="description",Kie=({as:t="span",children:e,className:n,...r},s)=>G.createElement(ft,{as:t,className:Ht(Oe.VisuallyHidden,n),ref:s,...r},e),Ul=is(Kie);Ul.displayName="VisuallyHidden";const Xie=t=>{const{className:e,...n}=t;return G.createElement(ft,{as:"span",width:"1em",height:"1em",className:Ht(Oe.Icon,e),...n},G.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G.createElement("path",{d:"M16.59 8.58984L12 13.1698L7.41 8.58984L6 9.99984L12 15.9998L18 9.99984L16.59 8.58984Z",fill:"currentColor"})))};var Yie=G.createContext(void 0),Jie=t=>{const{dir:e,children:n}=t;return ko.jsx(Yie.Provider,{value:e,children:n})};
11146const Qie=({autoComplete:t,className:e,size:n,variation:r,value:s,defaultValue:a,hasError:o,icon:i,iconColor:l,children:u,placeholder:c,isDisabled:d,isRequired:f,isMultiple:p=!1,selectSize:h=1,...m},g)=>{var T;const v="",b=s===void 0&&a===void 0&&c,w=p||h>1,S=Ht(Oe.Select,Oe.FieldGroupControl,rs(Oe.Select,n),rs(Oe.Select,r),Wa(Oe.Select,"error",o),Wa(Oe.Select,"expanded",w),e),I=Vk("select"),{isFieldsetDisabled:E}=jk(d);return G.createElement(ft,{className:Oe.SelectWrapper},G.createElement(ft,{"aria-invalid":o,as:"select",autoComplete:t,value:s,defaultValue:b?v:a,isDisabled:E,multiple:p,size:h,required:f,className:S,ref:g,...m},c&&G.createElement("option",{value:""},c),u),w?null:G.createElement(_t,{className:Ht(Oe.SelectIcon,rs(Oe.SelectIcon,n)),color:l,"aria-hidden":"true"},(T=i!=null?i:I==null?void 0:I.expand)!=null?T:G.createElement(Xie,null)))},Kk=is(Qie);Kk.displayName="Select";const Zie=({children:t,options:e})=>t?(e!=null&&e.length&&console.warn("Amplify UI: <SelectField> component defaults to rendering children over `options`. When using the `options` prop, omit children."),t):e==null?void 0:e.map((n,r)=>G.createElement("option",{label:n,value:n,key:"".concat(n,"-").concat(r)},n)),ece=(t,e)=>{const{children:n,className:r,descriptiveText:s,errorMessage:a,hasError:o=!1,id:i,label:l,labelHidden:u=!1,options:c,size:d,testId:f,inputStyles:p,...h}=t,m=N0(i),g=N0(),v=s?$0(g,qie):void 0,b=o?$0(g,Gie):void 0,w=jie([b,v]),{styleProps:S,rest:I}=Vie(h);return G.createElement(_t,{className:Ht(Oe.Field,rs(Oe.Field,d),Oe.SelectField,r),testId:f,...S},G.createElement(_y,{htmlFor:m,visuallyHidden:u},l),G.createElement(Gk,{id:v,labelHidden:u,descriptiveText:s}),G.createElement(Kk,{"aria-describedby":w,hasError:o,id:m,ref:e,size:d,...I,...p},Zie({children:n,options:c})),G.createElement(qk,{id:b,hasError:o,errorMessage:a}))},Xk=is(ece);Xk.displayName="SelectField";const Yk=({cssText:t,...e})=>t===void 0||/<\/style/i.test(t)?null:G.createElement("style",{...e,dangerouslySetInnerHTML:{__html:t}});Yk.displayName="Style";const Jk=({theme:t,...e})=>{if(!t)return null;const{name:n,cssText:r}=t;return G.createElement(Yk,{...e,cssText:r,id:"amplify-theme-".concat(n)})};Jk.displayName="ThemeStyle";function tce({children:t,colorMode:e,direction:n="ltr",nonce:r,theme:s}){const a=G.useMemo(()=>({theme:jg(s),colorMode:e}),[s,e]);return G.createElement(vy.Provider,{value:a},G.createElement(Jie,{dir:n},G.createElement("div",{"data-amplify-theme":a.theme.name,"data-amplify-color-mode":e,dir:n},t),s?G.createElement(Jk,{theme:a.theme,nonce:r}):null))}const Qk=Se.createContext(null);function nce({children:t,...e}){return Se.createElement(Qk.Provider,{value:e},t)}function Zk(){const t=Se.useContext(Qk);if(t===null)throw new Error("useFaceLivenessDetector must be used within a FaceLivenessDetectorProvider");return t}const rce=()=>{const{breakpoints:{values:t,defaultBreakpoint:e}}=Sy();return Hk({breakpoints:t,defaultBreakpoint:e})};function rp(){const{service:t}=Zk();return fC(t)}function Cn(t){const{service:e}=Zk();return mC(e,t)}function sce(t){const e=Tu.height.ideal,n=Tu.width.ideal,r=G.useRef(null),[s,a]=G.useState(e),[o,i]=G.useState(n);return G.useEffect(()=>{var l,u;if(t){Es(r.current)&&(r.current.srcObject=t);const c=(u=(l=t.getTracks())==null?void 0:l[0])==null?void 0:u.getSettings();c&&(a(c.height),i(c.width))}return()=>{t&&t.getTracks().forEach(c=>{t.removeTrack(c),c.stop()})}},[t]),{videoRef:r,videoHeight:s,videoWidth:o}}var Be;(function(t){t.CameraModule="amplify-liveness-camera-module",t.CancelContainer="amplify-liveness-cancel-container",t.CancelButton="amplify-liveness-cancel-button",t.CenteredLoader="amplify-liveness-centered-loader",t.ConnectingLoader="amplify-liveness-connecting-loader",t.CountdownContainer="amplify-liveness-countdown-container",t.DescriptionBullet="amplify-liveness-description-bullet",t.DescriptionBulletIndex="amplify-liveness-description-bullet__index",t.DescriptionBulletIndexText="amplify-liveness-description-bullet__index__text",t.DescriptionBulletMessage="amplify-liveness-description-bullet__message",t.ErrorModal="amplify-liveness-error-modal",t.ErrorModalHeading="amplify-liveness-error-modal__heading",t.FadeOut="amplify-liveness-fade-out",t.FreshnessCanvas="amplify-liveness-freshness-canvas",t.InstructionList="amplify-liveness-instruction-list",t.InstructionOverlay="amplify-liveness-instruction-overlay",t.Hint="amplify-liveness-hint",t.HintText="amplify-liveness-hint__text",t.LandscapeErrorModal="amplify-liveness-landscape-error-modal",t.LandscapeErrorModalButton="amplify-liveness-landscape-error-modal__button",t.LandscapeErrorModalHeader="amplify-liveness-landscape-error-modal__header",t.Loader="amplify-liveness-loader",t.MatchIndicator="amplify-liveness-match-indicator",t.OvalCanvas="amplify-liveness-oval-canvas",t.OpaqueOverlay="amplify-liveness-overlay-opaque",t.Overlay="amplify-liveness-overlay",t.Popover="amplify-liveness-popover",t.PopoverContainer="amplify-liveness-popover__container",t.PopoverAnchor="amplify-liveness-popover__anchor",t.PopoverAnchorSecondary="amplify-liveness-popover__anchor-secondary",t.RecordingIconContainer="amplify-liveness-recording-icon-container",t.RecordingIcon="amplify-liveness-recording-icon",t.StartScreenCameraSelect="amplify-liveness-start-screen-camera-select",t.StartScreenCameraSelectContainer="amplify-liveness-start-screen-camera-select__container",t.StartScreenCameraWaiting="amplify-liveness-start-screen-camera-waiting",t.StartScreenHeader="amplify-liveness-start-screen-header",t.StartScreenHeaderBody="amplify-liveness-start-screen-header__body",t.StartScreenHeaderHeading="amplify-liveness-start-screen-header__heading",t.StartScreenWarning="amplify-liveness-start-screen-warning",t.StartScreenInstructions="amplify-liveness-start-screen-instru
11146ctions",t.StartScreenInstructionsHeading="amplify-liveness-start-screen-instructions__heading",t.Toast="amplify-liveness-toast",t.ToastContainer="amplify-liveness-toast__container",t.ToastMessage="amplify-liveness-toast__message",t.UserFacingVideo="amplify-liveness-video--user-facing",t.Video="amplify-liveness-video",t.VideoAnchor="amplify-liveness-video-anchor"})(Be||(Be={}));const sp=({variation:t="default",size:e="medium",children:n,isInitial:r=!1,...s})=>{const{tokens:a}=Sy();return G.createElement(ft,{className:"".concat(Be.Toast," ").concat(Be.Toast,"--").concat(t," ").concat(Be.Toast,"--").concat(e),...r&&{backgroundColor:a.colors.background.primary},...s},G.createElement(_t,{className:Be.ToastContainer},G.createElement(_t,{className:Be.ToastMessage,...r?{color:a.colors.font.primary}:{}},n)))},ace=({displayText:t})=>G.createElement(sp,{"aria-live":"polite"},G.createElement(_t,{className:Be.HintText},G.createElement(Mc,null),G.createElement(ft,null,t))),Iy=t=>t.context.errorState,oce=t=>t.context.faceMatchAssociatedParams.faceMatchState,ice=t=>t.context.faceMatchAssociatedParams.illuminationState,cce=t=>t.context.isFaceFarEnoughBeforeRecording,lce=t=>t.context.faceMatchStateBeforeStart,uce=t=>{var e;return(e=t.context.faceMatchAssociatedParams)==null?void 0:e.faceMatchPercentage},Io=({text:t,isInitial:e=!1})=>G.createElement(sp,{size:"large",variation:"primary",isInitial:e},G.createElement(ft,{"aria-live":"assertive"},t)),dce=({hintDisplayText:t})=>{const[e]=rp(),n=Cn(Iy),r=Cn(oce),s=Cn(ice),a=Cn(lce),o=Cn(cce),i=Cn(uce),l=e.matches("checkFaceDetectedBeforeStart")||e.matches("detectFaceBeforeStart"),u=e.matches("checkFaceDistanceBeforeRecording")||e.matches("detectFaceDistanceBeforeRecording"),c=e.matches("start")||e.matches("userCancel"),d=e.matches("recording"),f=e.matches("uploading"),p=e.matches("checkSucceeded"),h=e.matches("checkFailed"),m=e.matches({recording:"flashFreshnessColors"}),g={[dt.CANT_IDENTIFY]:t.hintCanNotIdentifyText,[dt.FACE_IDENTIFIED]:t.hintTooFarText,[dt.TOO_MANY]:t.hintTooManyFacesText,[dt.TOO_FAR]:t.hintTooFarText,[dt.MATCHED]:t.hintHoldFaceForFreshnessText,[dt.OFF_CENTER]:t.hintFaceOffCenterText},v={[bs.BRIGHT]:t.hintIlluminationTooBrightText,[bs.DARK]:t.hintIlluminationTooDarkText,[bs.NORMAL]:t.hintIlluminationNormalText};if(c)return G.createElement(G.Fragment,null,G.createElement(Ul,{role:"alert"},t.hintCenterFaceInstructionText),G.createElement(Io,{text:t.hintCenterFaceText,isInitial:!0}));if(n!=null?n:h||p)return null;if(!d){if(l)return a===dt.TOO_MANY?G.createElement(Io,{text:t.hintTooManyFacesText}):G.createElement(Io,{text:t.hintMoveFaceFrontOfCameraText});if(u&&o===!1)return G.createElement(Io,{text:t.hintTooCloseText});if(f)return G.createElement(G.Fragment,null,G.createElement(Ul,{"aria-live":"assertive"},t.hintCheckCompleteText),G.createElement(ace,{displayText:t.hintVerifyingText}));if(s&&s!==bs.NORMAL)return G.createElement(Io,{text:v[s]})}if(m)return G.createElement(Io,{text:t.hintHoldFaceForFreshnessText});if(d&&!m){let b=g[dt.TOO_FAR];r===dt.MATCHED&&(b=g[r]);let w=b;return r===dt.OFF_CENTER?w=g[r]:r===dt.TOO_FAR&&i>50&&(w=t.hintMatchIndicatorText),G.createElement(sp,{size:"large",variation:"primary"},G.createElement(Ul,{"aria-live":"assertive"},w),G.createElement(ft,{"aria-label":w},b))}return null},fce=({percentage:t,initialPercentage:e=25,testId:n})=>{const[r,s]=Se.useState(e);Se.useEffect(()=>{t<0?s(0):t>100?s(100):s(t)},[t]);const a={"--percentage":"".concat(r,"%")};return Se.createElement("div",{className:Be.MatchIndicator,"data-testid":n},Se.createElement("div",{className:"".concat(Be.MatchIndicator,"__bar"),style:a,role:"progressbar","aria-label":"MatchIndicator","aria-valuenow":t,"aria-valuetext":"".concat(t,"% face fit")}))},e3=({children:t,horizontal:e="center",vertical:n="center",className:r,...s})=>G.createElement(_t,{className:"".concat(Be.Overlay," ").concat(r),alignItems:e,justifyContent:n,...s},t);function pce(){return/Macintosh/i.test(navigator.userAgent)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>1}function hce(){return/Android|iPhone|iPad/i.test(navigator.userAgent)||pce()}async function mce(t){var r;const e=await((r=navigator.mediaDevices)==null?void 0:r.enumerateDevices()),n=e==null?void 0:e.find(s=>
11146s.deviceId===t&&s.kind==="videoinput");return n?!n.label.toLowerCase().includes("back"):!0}function t3(){return window.matchMedia("(orientation: landscape)")}const ap={errorLabelText:"Error",connectionTimeoutHeaderText:"Connection time out",connectionTimeoutMessageText:"Connection has timed out.",timeoutHeaderText:"Time out",timeoutMessageText:"Face didn't fit inside oval in time limit. Try again and completely fill the oval with face in it.",faceDistanceHeaderText:"Forward movement detected",faceDistanceMessageText:"Avoid moving closer when connecting.",multipleFacesHeaderText:"Multiple faces detected",multipleFacesMessageText:"Ensure only one face is present in front of the camera when connecting.",clientHeaderText:"Client error",clientMessageText:"Check failed due to client issue",serverHeaderText:"Server issue",serverMessageText:"Cannot complete check due to server issue",landscapeHeaderText:"Landscape orientation not supported",landscapeMessageText:"Rotate your device to portrait (vertical) orientation.",portraitMessageText:"Ensure your device remains in portrait (vertical) orientation for the checkâs duration.",tryAgainText:"Try again"},Vl={cameraMinSpecificationsHeadingText:"Camera does not meet minimum specifications",cameraMinSpecificationsMessageText:"Camera must support at least 320*240 resolution and 15 frames per second.",cameraNotFoundHeadingText:"Camera is not accessible.",cameraNotFoundMessageText:"Check that a camera is connected and there is not another application using the camera. You may have to go into settings to grant camera permissions and close out all instances of your browser and retry.",a11yVideoLabelText:"Webcam for liveness check",cancelLivenessCheckText:"Cancel Liveness check",goodFitCaptionText:"Good fit",goodFitAltText:"Ilustration of a person's face, perfectly fitting inside of an oval.",hintCenterFaceText:"Center your face",hintCenterFaceInstructionText:"Instruction: Before starting the check, make sure your camera is at the center top of your screen and center your face to the camera. When the check starts an oval will show up in the center. You will be prompted to move forward into the oval and then prompted to hold still. After holding still for a few seconds, you should hear check complete.",hintFaceOffCenterText:"Face is not in the oval, center your face to the camera.",hintMoveFaceFrontOfCameraText:"Move face in front of camera",hintTooManyFacesText:"Ensure only one face is in front of camera",hintFaceDetectedText:"Face detected",hintCanNotIdentifyText:"Move face in front of camera",hintTooCloseText:"Move back",hintTooFarText:"Move closer",hintConnectingText:"Connecting...",hintVerifyingText:"Verifying...",hintCheckCompleteText:"Check complete",hintIlluminationTooBrightText:"Move to dimmer area",hintIlluminationTooDarkText:"Move to brighter area",hintIlluminationNormalText:"Lighting conditions normal",hintHoldFaceForFreshnessText:"Hold still",hintMatchIndicatorText:"50% completed. Keep moving closer.",photosensitivityWarningBodyText:"This check flashes different colors. Use caution if you are photosensitive.",photosensitivityWarningHeadingText:"Photosensitivity warning",photosensitivityWarningInfoText:"Some people may experience epileptic seizures when exposed to colored lights. Use caution if you, or anyone in your family, have an epileptic condition.",photosensitivityWarningLabelText:"More information about photosensitivity",photosensitivyWarningBodyText:"This check flashes different colors. Use caution if you are photosensitive.",photosensitivyWarningHeadingText:"Photosensitivity warning",photosensitivyWarningInfoText:"Some people may experience epileptic seizures when exposed to colored lights. Use caution if you, or anyone in your family, have an epileptic condition.",photosensitivyWarningLabelText:"More information about photosensitivity",retryCameraPermissionsText:"Retry",recordingIndicatorText:"Rec",startScreenBeginCheckText:"Start video check",tooFarCaptionText:"Too far",tooFarAltText:"Illustration of a person's face inside of an oval; there is a gap between the perimeter of the face and the boundaries of the oval.",waitingCameraPermissionText:"Waiting for you to allow camera permission.",...ap},gce=t=>{const{error:e,displayText:n}=t,{connectionTimeoutHeaderText:r,connectionTimeoutMessageText:s,errorLabelText:a,timeoutHeaderText:o,timeoutMessageText:i,faceDistanceHeaderText:l,faceDistanceMessageText:u,multipleFacesHeaderText:c,multipleFacesMessageText:d,clientHeaderText:f,clientMessageText:p,serverHeaderText:h,serverMessageText:m}=n;let g,v;switch(e){case St.CONNECTION_TIMEOUT:g=r,v=s;break;case St.TIMEOUT:g=o,v=i;break;case St.FACE_DISTANCE_ERROR:g=l,v=u;break;case St.MULTIPLE_FACES_ERROR:g=c,v=d;break;case St.RUNTIME_ERROR:g=f,v=p;break;case St.SERVER_ERROR:default:g=h,v=m}return Se.createElement(Se.Fragment,null,Se.createElement(_t,{className:Be.ErrorModal},Se.createElement(xy,{ariaLabel:a,role:"img",variation:"error"}),Se.createElement(Er,{className:Be.ErrorModalHeading,id:"amplify-liveness-error-heading"},g)),Se.createElement(Er,{id:"amplify-liveness-error-message"},v))},yce=({errorState:t,overrideErrorDisplayText:e})=>{const n={...ap,...e};return t===St.CAMERA_ACCESS_ERROR||t===St.CAMERA_FRAMERATE_ERROR||t===St.MOBILE_LANDSCAPE_ERROR?null:gce({error:t,displayText:n})},vce=t=>{const{children:e,onRetry:n,displayText:r}=t,s={...ap,...r},{tryAgainText:a}=s;return Se.createElement(e3,{className:Be.OpaqueOverlay},Se.createElement(sp,{"aria-labelledby":"amplify-liveness-error-heading","aria-describedby":"amplify-liveness-error-message",role:"alertdialog"},e,Se.createElement(_t,{justifyContent:"center"},Se.createElement(uo,{variation:"primary",type:"button",onClick:n},a))))},n3=({ariaLabel:t})=>{const[e,n]=rp(),r=e.done,s=()=>{n({type:"CANCEL"})};return r?null:Se.createElement(uo,{autoFocus:!0,variation:"link",onClick:s,size:"large",className:Be.CancelButton,"aria-label":t},Se.createElement(Lie,{"aria-hidden":"true","data-testid":"close-icon"}))},bce=({children:t})=>Se.createElement(_t,{className:Be.RecordingIcon},Se.createElement(_t,{"data-testid":"rec-icon",justifyContent:"center"},Se.createElement(Uk,{viewBox:{width:20,height:20},width:"20",height:"20"}
11146,Se.createElement("circle",{cx:"10",cy:"10",r:"8",fill:"red"}))),Se.createElement(Er,{as:"span",fontWeight:"bold"},t)),r3=({children:t,headingText:e,labelText:n})=>{const r=rce(),[s,a]=G.useState(!1),o=G.useRef(null),i=r==="base";return G.useEffect(()=>{function l(u){s&&o.current&&!o.current.contains(u.target)&&a(!1)}return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[o,s]),G.createElement("div",{className:Be.Popover,ref:o},G.createElement(uo,{"aria-controls":"photosensitivity-description","aria-expanded":s,role:"alertdialog","aria-label":n,"aria-describedby":"photosensitivity-description",colorTheme:"info",id:"popover-button",onClick:()=>a(!s),testId:"popover-icon"},G.createElement(xy,{ariaHidden:!0,variation:"info"})),s&&G.createElement(G.Fragment,null,G.createElement(_t,{className:Be.PopoverAnchor}),G.createElement(_t,{className:Be.PopoverAnchorSecondary}),G.createElement(_t,{"aria-hidden":!s,"aria-label":e,className:Be.PopoverContainer,"data-testid":"popover-text",id:"photosensitivity-description",left:i?-190:-108,role:"alertdialog"},t)))};r3.displayName="LivenessIconWithPopover";const wce=({bodyText:t,headingText:e,infoText:n,labelText:r})=>Se.createElement(_t,{className:"".concat(Oe.Alert," ").concat(Be.StartScreenWarning),style:{zIndex:"3"}},Se.createElement(ft,{flex:"1"},Se.createElement(ft,{className:Oe.AlertHeading},e),Se.createElement(ft,{className:Oe.AlertBody},t)),Se.createElement(r3,{labelText:r,headingText:e},n)),Sce=({recordingIndicatorText:t})=>Se.createElement(ft,{className:Be.RecordingIconContainer},Se.createElement(bce,null,t)),xce=({cancelLivenessCheckText:t})=>Se.createElement(ft,{className:Be.CancelContainer},Se.createElement(n3,{ariaLabel:t})),_ce=t=>{const{onSelect:e,devices:n,deviceId:r}=t;return Se.createElement(_t,{className:Be.StartScreenCameraSelect},Se.createElement(ft,{className:Be.StartScreenCameraSelectContainer},Se.createElement(_y,{htmlFor:"amplify-liveness-camera-select",className:"".concat(Be.StartScreenCameraSelect,"__label")},"Camera:"),Se.createElement(Xk,{id:"amplify-liveness-camera-select",testId:"amplify-liveness-camera-select",label:"Camera",labelHidden:!0,value:r,onChange:e},n.map(s=>Se.createElement("option",{value:s.deviceId,key:s.deviceId},s.label)))))},Ice=t=>{var e,n;return(n=(e=t.context.parsedSessionInformation)==null?void 0:e.Challenge)==null?void 0:n.Name},kce=t=>{var e;return(e=t.context.videoAssociatedParams)==null?void 0:e.videoConstraints},Ece=t=>{var e;return(e=t.context.videoAssociatedParams)==null?void 0:e.videoMediaStream},Tce=t=>{var e;return(e=t.context.faceMatchAssociatedParams)==null?void 0:e.faceMatchPercentage},Cce=t=>{var e;return(e=t.context.faceMatchAssociatedParams)==null?void 0:e.faceMatchState},Nce=t=>{var e;return(e=t.context.videoAssociatedParams)==null?void 0:e.selectedDeviceId},Ace=t=>{var e;return(e=t.context.videoAssociatedParams)==null?void 0:e.selectableDevices},$ce=[dt.TOO_FAR,dt.CANT_IDENTIFY,dt.FACE_IDENTIFIED,dt.OFF_CENT
11146ER],Rce=Se.memo(fce),Dce=t=>{const{isMobileScreen:e,isRecordingStopped:n,instructionDisplayText:r,streamDisplayText:s,hintDisplayText:a,errorDisplayText:o,cameraDisplayText:i,components:l,testId:u}=t,{cancelLivenessCheckText:c,recordingIndicatorText:d}=s,{ErrorView:f=vce,PhotosensitiveWarning:p=wce}=l!=null?l:{},[h,m]=rp(),g=Cn(Ice)===Fu.type,v=Cn(Ece),b=Cn(kce),w=Cn(Nce),S=Cn(Ace),I=Cn(Tce),E=Cn(Cce),T=Cn(Iy),D=fie(),{videoRef:R,videoWidth:$,videoHeight:M}=sce(v),B=G.useRef(null),z=G.useRef(null),[H,V]=G.useState(!1),[X,Q]=G.useState(!1),[K,ee]=G.useState(!0),ae=h.matches("initCamera"),ne=h.matches("initWebsocket"),ce=h.matches({initCamera:"cameraCheck"}),se=h.matches({initCamera:"waitForDOMAndCameraDetails"}),oe=h.matches("start")||h.matches("userCancel"),ie=h.matches("detectFaceBeforeStart"),pe=h.matches("recording"),ve=h.matches("checkSucceeded"),fe=h.matches({recording:"flashFreshnessColors"}),[be,$e]=G.useState($),[Re,De]=G.useState(M),[Pe,je]=G.useState(()=>$&&M?$/M:0),Ue=!!(S!=null&&S.length)&&S.length>1,Ce=oe&&Ue&&(!e||g);Se.useEffect(()=>{async function yt(){const Tt=await mce(w);ee(Tt)}yt()},[w]),Se.useEffect(()=>{const yt=(B==null?void 0:B.current)&&(R==null?void 0:R.current)&&v&&oe&&X;yt&&iv(B.current,R.current,v);const Tt=rn=>{rn.matches&&yt&&iv(B.current,R.current,v)},Yt=window.matchMedia("(prefers-color-scheme: dark)"),vt=window.matchMedia("(prefers-color-scheme: light)");return Yt.addEventListener("change",Tt),vt.addEventListener("change",Tt),()=>{Yt.removeEventListener("change",Tt),vt.addEventListener("change",Tt)}},[R,v,D,oe,X]),Se.useLayoutEffect(()=>{H&&m({type:"SET_DOM_AND_CAMERA_DETAILS",data:{videoEl:R.current,canvasEl:B.current,freshnessColorEl:z.current,isMobile:e}}),R.current&&($e(R.current.videoWidth),De(R.current.videoHeight),je(R.current.videoWidth/R.current.videoHeight))},[m,R,H,e]),Se.useEffect(()=>{ie&&EC({canvas:B.current})},[ie]);const Ze=Se.useMemo(()=>Se.createElement(ft,{style:{visibility:oe?"visible":"hidden"}},Se.createElement(p,{bodyText:r.photosensitivityWarningBodyText,headingText:r.photosensitivityWarningHeadingText,infoText:r.photosensitivityWarningInfoText,labelText:r.photosensitivityWarningLabelText})),[p,r,oe]),Ke=()=>{V(!0)},Ne=()=>{Q(!0)},Ge=Se.useCallback(()=>{m({type:"BEGIN"})},[m]),jt=Se.useCallback(yt=>{const Tt=yt.target.value;(async()=>{Q(!1);const vt=await navigator.mediaDevices.getUserMedia({video:{...b,deviceId:{exact:Tt}},audio:!1});m({type:"UPDATE_DEVICE_AND_STREAM",data:{newDeviceId:Tt,newStream:vt}})})()},[b,m]);if(ce)return Se.createElement(_t,{justifyContent:"center",className:Be.StartScreenCameraWaiting},Se.createElement(Mc,{size:"large",className:Be.CenteredLoader,"data-testid":"centered-loader",position:"unset"}),Se.createElement(Er,{fontSize:"large",fontWeight:"bold","data-testid":"waiting-camera-permission",className:"".concat(Be.StartScreenCameraWaiting,"__text")},i.waitingCameraPermissionText));const gt=ae||ne,It=e&&!oe&&!gt;return Se.createElement(Se.Fragment,null,!g&&Ze,gt&&Se.createElement(_t,{className:Be.ConnectingLoader},Se.createElement(Mc,{size:"large",className:Be.Loader,"data-testid":"centered-loader"}),Se.createElement(Er,{className:Be.LandscapeErrorModalHeader},a.hintConnectingText)),Se.createElement(_t,{className:Ht(Be.CameraModule,It&&"".concat(Be.CameraModule,"--mobile")),"data-testid":u,gap:"zero"},Se.createElement(e3,{horizontal:"center",vertical:pe&&!fe?"start":"space-between",className:Be.InstructionOverlay},pe&&Se.createElement(Sce,{recordingIndicatorText:d}),!oe&&!se&&!ve&&Se.createElement(xce,{cancelLivenessCheckText:c}),Se.createElement(_t,{className:Ht(Be.Hint,It&&"".concat(Be.Hint,"--mobile"))},Se.createElement(dce,{hintDisplayText:a})),T&&Se.createElement(f,{onRetry:()=>{m({type:"CANCEL"})},displayText:o},yce({errorState:T,overrideErrorDisplayText:o})),pe&&!fe&&$ce.includes(E)?Se.createElement(Rce,{percentage:Math.ceil(I)}):null),Se.createElement(ft,{as:"canvas",ref:z,className:Be.FreshnessCanvas,hidden:!0}),Se.createElement(ft,{className:Be.VideoAnchor,style:{aspectRatio:"".concat(Pe)}}
11146,Se.createElement("video",{ref:R,muted:!0,autoPlay:!0,playsInline:!0,width:be,height:Re,onCanPlay:Ke,onLoadedMetadata:Ne,"data-testid":"video",className:Ht(Be.Video,K&&Be.UserFacingVideo,n&&Be.FadeOut),"aria-label":i.a11yVideoLabelText}),Se.createElement(_t,{className:Ht(Be.OvalCanvas,It&&"".concat(Be.OvalCanvas,"--mobile"),n&&Be.FadeOut)},Se.createElement(ft,{as:"canvas",ref:B})),Ce?Se.createElement(_ce,{onSelect:jt,devices:S,deviceId:w}):null)),oe&&Se.createElement(_t,{justifyContent:"center"},Se.createElement(uo,{variation:"primary",type:"button",onClick:Ge},r.startScreenBeginCheckText)))},Fce=t=>{const{onRetry:e,header:n,portraitMessage:r,landscapeMessage:s,tryAgainText:a}=t,[o,i]=G.useState(!0);return G.useLayoutEffect(()=>{const l=t3();return i(l.matches),l.addEventListener("change",u=>{i(u.matches)}),()=>{l.removeEventListener("change",u=>i(u.matches))}},[]),G.createElement(_t,{className:Be.LandscapeErrorModal,height:o?"auto":480},G.createElement(Er,{className:Be.LandscapeErrorModalHeader},n),G.createElement(Er,null,o?s:r),o?null:G.createElement(_t,{className:Be.LandscapeErrorModalButton},G.createElement(uo,{variation:"primary",type:"button",onClick:e},a)))},R0="liveness-detector-check",Mce=420,Oce=t=>t.context.isRecordingStopped,Pce=({instructionDisplayText:t,hintDisplayText:e,cameraDisplayText:n,streamDisplayText:r,errorDisplayText:s,components:a})=>{const[o,i]=rp(),l=Cn(Iy),u=Cn(Oce),c=o.matches("permissionDenied"),d=hce(),f=()=>{i({type:"RETRY_CAMERA_CHECK"})},{cameraMinSpecificationsHeadingText:p,cameraMinSpecificationsMessageText:h,cameraNotFoundHeadingText:m,cameraNotFoundMessageText:g,retryCameraPermissionsText:v}=n,{cancelLivenessCheckText:b}=r;G.useLayoutEffect(()=>{if(d){const S=E=>{E&&i({type:"MOBILE_LANDSCAPE_WARNING"})},I=t3();return S(I.matches),I.addEventListener("change",E=>{S(E.matches)}),()=>{I.removeEventListener("change",E=>S(E.matches))}}},[d,i]);const w=()=>{if(l===St.MOBILE_LANDSCAPE_ERROR){const S={...ap,...s},{landscapeHeaderText:I,portraitMessageText:E,landscapeMessageText:T,tryAgainText:D}=S;return G.createElement(_t,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",position:"absolute",width:"100%"},G.createElement(Fce,{header:I,portraitMessage:E,landscapeMessage:T,tryAgainText:D,onRetry:()=>{i({type:"CANCEL"})}}))}else return c?G.createElement(_t,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",width:"100%",height:480},G.createElement(Er,{fontSize:"large",fontWeight:"bold"},l===St.CAMERA_FRAMERATE_ERROR?p:m),G.createElement(Er,{maxWidth:Mce},l===St.CAMERA_FRAMERATE_ERROR?h:g),G.createElement(uo,{variation:"primary",type:"button",onClick:f},v),G.createElement(ft,{position:"absolute",top:"medium",right:"medium"},G.createElement(n3,{ariaLabel:b}))):G.createElement(Dce,{isMobileScreen:d,isRecordingStopped:u,instructionDisplayText:t,streamDisplayText:r,hintDisplayText:e,errorDisplayText:s,cameraDisplayText:n,components:a})};return G.createElement(_t,{direction:"column",position:"relative",testId:R0,className:R0,gap:"xl"},w())};function Bce(t){const e=(n,r)=>t[n]&&t[n]!==Vl[n]?t[n]:t[r]&&t[r]!==Vl[n]?t[r]:Vl[n];return{photosensitivityWarningBodyText:e("photosensitivityWarningBodyText","photosensitivyWarningBodyText"),photosensitivityWarningHeadingText:e("photosensitivityWarningHeadingText","photosensitivyWarningHeadingText"),photosensitivityWarningInfoText:e("photosensitivityWarningInfoText","photosensitivyWarningInfoText"),photosensitivityWarningLabelText:e("photosensitivityWarningLabelText","photosensitivyWarningLabelText")}}function Lce(t){const e=Bce(t!=null?t:{}),n={...Vl,...t,...e},{a11yVideoLabelText:r,cameraMinSpecificationsHeadingText:s,cameraMinSpecificationsMessageText:a,cameraNotFoundHeadingText:o,cameraNotFoundMessageText:i,cancelLivenessCheckText:l,connectionTimeoutHeaderText:u,connectionTimeoutMessageText:c,clientHeaderText:d,clientMessageText:f,errorLabelText:p,hintCanNotIdentifyText:h,hintCenterFaceText:m,hintCenterFaceInstructionText:g,hintFaceOffCenterText:v,hintConnectingText:b,hintFaceDetectedText:w,hintHoldFaceForFreshnessText:S,hintIlluminationNormalText:I,hintIlluminationTooBrightText:E,hintIlluminationTooDarkText:T,hintMoveFaceFrontOfCameraText:D,hintTooManyFacesText:R,hintTooCloseText:$,hintTooFarText:M,hintVerifyingText:B,hintCheckCompleteText:z,hintMatchIndicatorText:H,faceDistanceHeaderText:V,faceDistanceMessageText:X,goodFitCaptionText:Q,goodFitAltText:K,landscapeHeaderText:ee,landscapeMessageText:ae,multipleFacesHeaderText:ne,multipleFacesMessageText:ce,photosensitivityWarningBodyText:se,photosensitivityWarningHeadingText:oe,photosensitivityWarningInfoText:ie,photosensitivityWarningLabelText:pe,photosensitivyWarningBodyText:ve,photosensitivyWarningHeadingText:fe,photosensitivyWarningInfoText:be,photosensitivyWarningLabelText:$e,portraitMessageText:Re,retryCameraPermissionsText:De,recordingIndicatorText:Pe,serverHeaderText:je,serverMessageText:Ue,startScreenBeginCheckText:Ce,timeoutHeaderText:Ze,timeoutMessageText:Ke,tooFarCaptionText:Ne,tooFarAltText:Ge,tryAgainText:jt,waitingCameraPermissionText:gt}=n;return{hintDisplayText:{hintMoveFaceFrontOfCameraText:D,hintTooManyFacesText:R,hintFaceDetectedText:w,hintCanNotIdentifyText:h,hintTooCloseText:$,hintTooFarText:M,hintConnectingText:b,hintVerifyingText:B,hintCheckCompleteText:z,hintIlluminationTooBrightText:E,hintIlluminationTooDarkText:T,hintIlluminationNormalText:I,hintHoldFaceForFreshnessText:S,hintCenterFaceText:m,hintCenterFaceInstru
11146ctionText:g,hintFaceOffCenterText:v,hintMatchIndicatorText:H},cameraDisplayText:{cameraMinSpecificationsHeadingText:s,cameraMinSpecificationsMessageText:a,cameraNotFoundHeadingText:o,cameraNotFoundMessageText:i,retryCameraPermissionsText:De,waitingCameraPermissionText:gt,a11yVideoLabelText:r},instructionDisplayText:{photosensitivityWarningBodyText:se,photosensitivityWarningHeadingText:oe,photosensitivityWarningInfoText:ie,photosensitivityWarningLabelText:pe,photosensitivyWarningBodyText:ve,photosensitivyWarningHeadingText:fe,photosensitivyWarningInfoText:be,photosensitivyWarningLabelText:$e,goodFitCaptionText:Q,goodFitAltText:K,tooFarCaptionText:Ne,tooFarAltText:Ge,startScreenBeginCheckText:Ce},streamDisplayText:{cancelLivenessCheckText:l,recordingIndicatorText:Pe},errorDisplayText:{connectionTimeoutHeaderText:u,connectionTimeoutMessageText:c,errorLabelText:p,timeoutHeaderText:Ze,timeoutMessageText:Ke,faceDistanceHeaderText:V,faceDistanceMessageText:X,multipleFacesHeaderText:ne,multipleFacesMessageText:ce,clientHeaderText:d,clientMessageText:f,serverHeaderText:je,serverMessageText:Ue,landscapeHeaderText:ee,landscapeMessageText:ae,portraitMessageText:Re,tryAgainText:jt}}}const D0="liveness-detector";function Wce(t){const{components:e,config:n,displayText:r}=t,s=G.useRef(null),{hintDisplayText:a,cameraDisplayText:o,instructionDisplayText:i,streamDisplayText:l,errorDisplayText:u}=Lce(r),c=iC(sie,{devTools:!1,context:{componentProps:{...t,config:n!=null?n:{}}}});return G.createElement(ft,{className:D0,testId:D0},G.createElement(nce,{componentProps:t,service:c},G.createElement(_t,{direction:"column",ref:s},G.createElement(Pce,{instructionDisplayText:i,hintDisplayText:a,cameraDisplayText:o,streamDisplayText:l,errorDisplayText:u,components:e}))))}const zce=t=>({hintMoveFaceFrontOfCameraText:t("aws_liveness.hintMoveFaceFrontOfCameraText"),hintTooManyFacesText:t("aws_liveness.hintTooManyFacesText"),hintFaceDetectedText:t("aws_liveness.hintFaceDetectedText"),hintCanNotIdentifyText:t("aws_liveness.hintCanNotIdentifyText"),hintTooCloseText:t("aws_liveness.hintTooCloseText"),hintTooFarText:t("aws_liveness.hintTooFarText"),hintConnectingText:t("aws_liveness.hintConnectingText"),hintVerifyingText:t("aws_liveness.hintVerifyingText"),hintCheckCompleteText:t("aws_liveness.hintCheckCompleteText"),hintIlluminationTooBrightText:t("aws_liveness.hintIlluminationTooBrightText"),hintIlluminationTooDarkText:t("aws_liveness.hintIlluminationTooDarkText"),hintIlluminationNormalText:t("aws_liveness.hintIlluminationNormalText"),hintHoldFaceForFreshnessText:t("aws_liveness.hintHoldFaceForFreshnessText"),hintCenterFaceText:t("aws_liveness.hintCenterFaceText"),hintCenterFaceInstructionText:t("aws_liveness.hintCenterFaceInstructionText"),hintFaceOffCenterText:t("aws_liveness.hintFaceOffCenterText"),hintMatchIndicatorText:t("aws_liveness.hintMatchIndicatorText"),cameraMinSpecificationsHeadingText:t("aws_liveness.cameraMinSpecificationsHeadingText"),cameraMinSpecificationsMessageText:t("aws_liveness.cameraMinSpecificationsMessageText"),cameraNotFoundHeadingText:t("aws_liveness.cameraNotFoundHeadingText"),cameraNotFoundMessageText:t("aws_liveness.cameraNotFoundMessageText"),retryCameraPermissionsText:t("aws_liveness.retryCameraPermissionsText"),waitingCameraPermissionText:t("aws_liveness.waitingCameraPermissionText"),a11yVideoLabelText:t("aws_liveness.a11yVideoLabelText"),recordingIndicatorText:t("aws_liveness.recordingIndicatorText"),errorLabelText:t("aws_liveness.errorLabelText"),connectionTimeoutHeaderText:t("aws_liveness.connectionTimeoutHeaderText"),connectionTimeoutMessageText:t("aws_liveness.connectionTimeoutMessageText"),timeoutHeaderText:t("aws_liveness.timeoutHeaderText"),timeoutMessageText:t("aws_liveness.timeoutMessageText"),faceDistanceHeaderText:t("aws_liveness.faceDistanceHeaderText"),faceDistanceMessageText:t("aws_liveness.faceDistanceMessageText"),multipleFacesHeaderText:t("aws_liveness.multipleFacesHeaderText"),multipleFacesMessageText:t("aws_liveness.multipleFacesMessageText"),clientHeaderText:t("aws_liveness.clientHeaderText"),clientMessageText:t("aws_liveness.clientMessageText"),serverHeaderText:t("aws_liveness.serverHeaderText"),serverMessageText:t("aws_liveness.serverMessageText"),landscapeHeaderText:t("aws_liveness.landscapeHeaderText"),landscapeMessageText:t("aws_liveness.landscapeMessageText"),portraitMessageText:t("aws_liveness.portraitMessageText"),tryAgainText:t("aws_liveness.tryAgainText")}),Hce=t=>{var e,n;try{const r=(n=(e=JSON.parse(t))==null?void 0:e.ReferenceImage)==null?void 0:n.Bytes;return r?"data:image/jpeg;base64,".concat(r):null}catch(r){return null}},Uce=t=>{try{const e=JSON.parse(t.data);return delete e.AuditImages,delete e.ReferenceImage,{...t,data:e}}catch(e){return t}}
11146,Vce=["CAMERA_ACCESS_ERROR","DEFAULT_CAMERA_NOT_FOUND_ERROR"],jce={PhotosensitiveWarning:()=>null};var M0;const Gce=t=>{const{isShowSelfieInstructionsDialog:e,onClose:n,defaultUploadFileState:r,sendLog:s,setStateComponent:a,setValue:o,onSubmitHandler:i,handleAccessDeniedAfterRequest:l,handleShowIfAccessDeniedDialog:u,setIsLoadingSDK:c}=t,{t:d}=g3(),f=b3(),[p,h]=G.useState(null),[m,g]=G.useState(null),v=G.useRef(!1),b=G.useRef(null),w=($,M)=>{a({...r,error:$}),s(M,pp.AWS_REKOGNITION),Ay(bo.liveness_check,$),f($y(!0)),h(null)};G.useEffect(()=>{e&&(c==null||c(!0),Promise.all([f(Ny()).unwrap(),f(w3()).unwrap()]).then(([$,M])=>{c==null||c(!1),n(),b.current=$,g($.region),h(M.session_id),ul(bo.selfie_camera_opened),ul(bo.liveness_check_started)}).catch($=>{c==null||c(!1),n(),w("liveness_loading_error",{error:$,is_webview:fp()})}))},[e]);const S=G.useCallback(async()=>{try{const $=b.current,B=$&&new Date($.expiration).getTime()>Date.now()?$:await f(Ny()).unwrap();return b.current=B,{accessKeyId:B.access_key_id,secretAccessKey:B.secret_access_key,sessionToken:B.session_token,expiration:new Date(B.expiration)}}catch($){throw new Error("AWS credentials request failed: ".concat(JSON.stringify($)))}},[]),I=G.useMemo(()=>({credentialProvider:S}),[S]),E=G.useMemo(()=>zce(d),[d]),T=async()=>{if(p){v.current=!0,ul(bo.make_selfie_photo);try{const $=await f(x3(p)).unwrap(),M=Uce($),B=$.state?Hce($.data):null;if(!B){w("please_make_new_selfie",M);return}ul(bo.liveness_check),o(_3.Selfie,B),s(M,pp.AWS_REKOGNITION).then(z=>i(z.id)(),()=>i()()),h(null)}catch($){w("liveness_loading_error",{error:$,is_webview:fp()})}}},D=$=>{var M;if(s({error:$,is_webview:fp()},pp.AWS_REKOGNITION),($==null?void 0:$.state)==="MOBILE_LANDSCAPE_ERROR"){v.current=!0,a({...r,error:"selfie_landscape_error"}),h(null);return}if(f($y(!0)),Vce.includes($==null?void 0:$.state)){if(I3($.state==="DEFAULT_CAMERA_NOT_FOUND_ERROR"?"not_available":"denied"),y3){l();return}u==null||u(),a({...r}),h(null);return}v.current=!0,a({...r}),Ay(bo.liveness_check,String((M=$==null?void 0:$.state)!=null?M:"aws_error")),h(null)},R=()=>{if(v.current){v.current=!1,h(null);return}a({...r}),h(null)};return ko.jsx(S3,{isOpenModal:!!p,onClose:R,title:d(M0||(M0=Cy(["capture_selfie"]))),isShowClose:!0,isUsePortal:!0,content:p&&m?ko.jsx(tce,{children:ko.jsx(Wce,{sessionId:p,region:m,disableStartScreen:!0,components:jce,displayText:E,onAnalysisComplete:T,onError:D,onUserCancel:R,config:I})}):ko.jsx(ko.Fragment,{})})},rle=Object.freeze(Object.defineProperty({__proto__:null,AWSRekognition:Gce},Symbol.toStringTag,{value:"Module"}));export{rle as A,$I as E,Ane as H,qp as I,Hne as M,Vne as S,Une as a,jne as b,qne as c,DI as d,Xne as e,Ts as f,nle as g,Gne as h,ey as i,ele as j,RI as k,Yne as l,FI as r,pi as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.