(()=>{if(window.ethereum&&window.ethereum.isWorldLandWallet)return;let e=0;const t=new Map,r=new Map,o={isWorldLandWallet:!0,isMetaMask:!1,_initialized:!0,request:r=>new Promise((o,n)=>{const s=++e;t.set(s,{resolve:o,reject:n}),window.postMessage({source:"worldland-wallet-inpage",type:"provider-request",payload:{id:s,method:r.method,params:r.params||[]}},"*"),setTimeout(()=>{t.has(s)&&(t.delete(s),n(new Error("Request timed out")))},3e5)}),on:(e,t)=>(r.has(e)||r.set(e,[]),r.get(e).push(t),o),removeListener(e,t){const n=r.get(e);if(n){const e=n.indexOf(t);e>-1&&n.splice(e,1)}return o},emit(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];const s=r.get(e);s&&s.forEach(e=>{try{e(...o)}catch(e){console.error("Provider event error:",e)}})},enable:()=>o.request({method:"eth_requestAccounts"}),send(e,t){if("string"==typeof e)return o.request({method:e,params:t||[]})},sendAsync(e,t){o.request({method:e.method,params:e.params}).then(r=>t(null,{id:e.id,jsonrpc:"2.0",result:r})).catch(e=>t(e))}};window.addEventListener("message",e=>{if(e.source!==window)return;if(!e.data||"worldland-wallet-content-script"!==e.data.source)return;const{type:r,payload:n}=e.data;if("provider-response"===r){const e=t.get(n.id);if(e)if(t.delete(n.id),n.error){const t=new Error(n.error.message||"Unknown error");t.code=n.error.code||4001,e.reject(t)}else e.resolve(n.result)}else"provider-event"===r&&o.emit(n.eventName,n.data)}),Object.defineProperty(window,"ethereum",{value:o,writable:!1,configurable:!1}),window.dispatchEvent(new CustomEvent("eip6963:announceProvider",{detail:{info:{uuid:"worldland-wallet-extension",name:"WorldLand Wallet",icon:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><text y="32" font-size="32">🌍</text></svg>',rdns:"foundation.worldland.wallet"},provider:o}})),console.log("[WorldLand Wallet] Provider injected")})();