(function(){function e(e,t){try{const r=window.webkit;delete window["webkit"];window.webkit.messageHandlers[e].postMessage(t);window.webkit=r}catch(e){}}function t(){const e=new Uint32Array(4);window.crypto.getRandomValues(e);return e.reduce(((e="",t)=>e+t.toString(16).padStart(8,"0")),"")}class r{registeredApis={};frameId=t();registerApi(e,t){if(this.registeredApis[e]!==undefined){throw new Error(`API ${e} already registered.`)}this.registeredApis[e]=t}getRegisteredApi(e){return this.registeredApis[e]}getFrameId(){if(!this.frameId){this.frameId=t()}return this.frameId}registerFrame(){e("FrameBecameAvailable",{crwFrameId:this.getFrameId()})}}if(!window.__gCrWeb){window.__gCrWeb=new r}const n=window.__gCrWeb;const i=window.__gCrWeb;const o="FormHandlersMessage";let s=null;let a=null;let f=null;let d=null;let l=0;let u={dropCount:0};function m(t){if(!a){setTimeout((function(){e(o,a);a=null}),0)}a=t}function c(e){const t=["FORM","INPUT","OPTION","SELECT","TEXTAREA"];if(!e.target){return}let r=e.target;if(!t.includes(r.tagName)){const n=e.composedPath();let i=false;if(n){for(const e of n){if(t.includes(e.tagName)){r=e;i=true;break}}}if(!i){return}}if(e.type!=="blur"){f=document.activeElement}if(["change","input"].includes(e.type)&&n.form.wasEditedByUser!==null){n.form.wasEditedByUser.set(r,e.isTrusted)}if(e.target!==f){return}const o=r.tagName==="FORM"?r:r["form"];const s=r.tagName==="FORM"?null:r;const a=n.fill.getUniqueID(o);const d=n.fill.getUniqueID(s);const l="type"in r?r.type:"";const u="value"in r?r.value:"";const c={command:"form.activity",frameID:i.getFrameId(),formName:n.form.getFormIdentifier(o),formRendererID:a,fieldIdentifier:n.form.getFieldIdentifier(s),fieldRendererID:d,fieldType:l,type:e.type,value:u,hasUserGesture:e.isTrusted};m(c)}function g(e){const t=n.autofill_form_features.isAutofillAllowDefaultPreventedSubmission();if(e["defaultPrevented"]&&!t){return}if(!e.target||e.target.tagName!=="FORM"){return}n.form.formSubmitted(e.target,o,false)}function p(t,r,n=false){if(l>0){return false}t.forEach(((t,i)=>{++l;setTimeout((function(){--l;if(n&&l===0){const e=i+1;t={...t,metadata:{dropCount:u.dropCount,size:isNaN(e)?null:e}};u={dropCount:0}}e(o,t)}),r*(1+i))}));return true}function I(e){if(n.autofill_form_features.isAutofillAcrossIframesEnabled()){n.remoteFrameRegistration.processChildFrameMessage(e)}}function w(){document.addEventListener("focus",c,true);document.addEventListener("blur",c,true);document.addEventListener("change",c,true);document.addEventListener("input",c,true);document.addEventListener("reset",c,true);document.addEventListener("keyup",c,false);document.addEventListener("submit",g,false);window.addEventListener("message",I);if(d===null){d=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){if(!n.autofill_form_features.isAutofillIsolatedContentWorldEnabled()){try{n.form.formSubmitted(this,o,true)}catch(e){}}d.call(this)}}}w();setTimeout(w,1e3);function h(e){return[...e].filter((e=>e.nodeType===Node.ELEMENT_NODE)).map((e=>[e,...e.getElementsByTagName("*")])).map((e=>e.filter((e=>e.tagName.match(/^(FORM|INPUT|SELECT|OPTION|TEXTAREA)$/))))).flat()}function E(e){return e.filter((e=>n.fill.isAutofillableElement(e)&&!e.form)).map(n.fill.getUniqueID)}function y(e){if(s){s.disconnect();s=null}if(!e)return;s=new MutationObserver((function(t){let r=null;let o=null;for(const e of t){if(e.type!=="childList"){continue}const t=h(e.addedNodes).length>0;if(!r&&t){r={command:"form.activity",frameID:i.getFrameId(),formName:"",formRendererID:"",fieldIdentifier:"",fieldRendererID:"",fieldType:"",type:"form_changed",value:"",hasUserGesture:false}}else if(t){++u.dropCount}const s=h(e.removedNodes);if(s.length===0){continue}const a=s.filter((e=>e.tagName==="FORM"));const f=E(s);const d=f.length>0;if(a.length>0||d){if(o){++u.dropCount;continue}else{const e=a.map((e=>n.fill.getUniqueID(e)));o={command:"form.removal",frameID:i.getFrameId(),removedFormIDs:n.stringify(e),removedFieldIDs:n.stringify(f)};continue}}if(!o&&d){o={command:"form.removal",frameID:i.getFrameId(),removedFieldIDs:n.stringify(f)};continue}else if(d){++u.dropCount;continue}if(!r){r={command:"form.activity",frameID:i.getFrameId(),formName:"",formRendererID:"",fieldIdentifier:"",fieldRendererID:"",fieldType:"",type:"form_changed",value:"",hasUserGesture:false}}else{++u.dropCount}}const s=[o,r].filter((e=>!!e)).map((e=>e));if(s.length>0&&!p(s,e,true)){u.dropCount+=s.length}}));s.observe(document,{childList:true,subtree:true})}n.formHandlers={trackFormMutations:y}})();