@latticexyz/entrykit 2.2.18-88949aaf197da3a62782ffd0c29b7dd677425fac → 2.2.18-88af9325733387259f29dfdafd2fdbc23f2ab499

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- function Gt(e){return{...e,appName:e.appName??document.title,appIcon:e.appIcon??document.querySelector("link[rel~='icon']")?.getAttribute("href")??"/favico.ico"}}import{Root as Ar,DialogPortal as Pr,DialogContent as Ur}from"@radix-ui/react-dialog";import{forwardRef as br,useEffect as wr,useRef as Fe,useState as Le}from"react";import xr from"react-dom";var ke=`*, ::before, ::after {
1
+ function Xt(e){return{...e,appName:e.appName??document.title,appIcon:e.appIcon??document.querySelector("link[rel~='icon']")?.getAttribute("href")??"/favico.ico"}}import{Root as Tr,DialogPortal as Ir,DialogContent as Mr}from"@radix-ui/react-dialog";import{forwardRef as Sr,useEffect as Pr,useRef as Ye,useState as _e}from"react";import Ar from"react-dom";var Te=`*, ::before, ::after {
2
2
  --tw-border-spacing-x: 0;
3
3
  --tw-border-spacing-y: 0;
4
4
  --tw-translate-x: 0;
@@ -569,10 +569,22 @@ video {
569
569
  position: relative;
570
570
  }
571
571
 
572
+ .sticky {
573
+ position: sticky;
574
+ }
575
+
572
576
  .inset-0 {
573
577
  inset: 0px;
574
578
  }
575
579
 
580
+ .bottom-0 {
581
+ bottom: 0px;
582
+ }
583
+
584
+ .left-0 {
585
+ left: 0px;
586
+ }
587
+
576
588
  .right-0 {
577
589
  right: 0px;
578
590
  }
@@ -621,6 +633,10 @@ video {
621
633
  margin-left: -0.75rem;
622
634
  }
623
635
 
636
+ .-mt-2 {
637
+ margin-top: -0.5rem;
638
+ }
639
+
624
640
  .block {
625
641
  display: block;
626
642
  }
@@ -649,6 +665,14 @@ video {
649
665
  display: contents;
650
666
  }
651
667
 
668
+ .hidden {
669
+ display: none;
670
+ }
671
+
672
+ .h-12 {
673
+ height: 3rem;
674
+ }
675
+
652
676
  .h-16 {
653
677
  height: 4rem;
654
678
  }
@@ -661,6 +685,10 @@ video {
661
685
  height: 1.5rem;
662
686
  }
663
687
 
688
+ .h-64 {
689
+ height: 16rem;
690
+ }
691
+
664
692
  .h-\\[1\\.25em\\] {
665
693
  height: 1.25em;
666
694
  }
@@ -673,8 +701,8 @@ video {
673
701
  height: 100%;
674
702
  }
675
703
 
676
- .max-h-32 {
677
- max-height: 8rem;
704
+ .max-h-full {
705
+ max-height: 100%;
678
706
  }
679
707
 
680
708
  .min-h-\\[22rem\\] {
@@ -689,6 +717,10 @@ video {
689
717
  width: 4rem;
690
718
  }
691
719
 
720
+ .w-24 {
721
+ width: 6rem;
722
+ }
723
+
692
724
  .w-28 {
693
725
  width: 7rem;
694
726
  }
@@ -733,11 +765,26 @@ video {
733
765
  flex-grow: 1;
734
766
  }
735
767
 
768
+ .-translate-y-2 {
769
+ --tw-translate-y: -0.5rem;
770
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
771
+ }
772
+
773
+ .-translate-y-4 {
774
+ --tw-translate-y: -1rem;
775
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
776
+ }
777
+
736
778
  .translate-x-2 {
737
779
  --tw-translate-x: 0.5rem;
738
780
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
739
781
  }
740
782
 
783
+ .translate-y-0 {
784
+ --tw-translate-y: 0px;
785
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
786
+ }
787
+
741
788
  .scale-100 {
742
789
  --tw-scale-x: 1;
743
790
  --tw-scale-y: 1;
@@ -817,17 +864,18 @@ video {
817
864
  gap: 1.5rem;
818
865
  }
819
866
 
867
+ .space-y-6 > :not([hidden]) ~ :not([hidden]) {
868
+ --tw-space-y-reverse: 0;
869
+ margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
870
+ margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
871
+ }
872
+
820
873
  .divide-y > :not([hidden]) ~ :not([hidden]) {
821
874
  --tw-divide-y-reverse: 0;
822
875
  border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
823
876
  border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
824
877
  }
825
878
 
826
- .divide-neutral-700 > :not([hidden]) ~ :not([hidden]) {
827
- --tw-divide-opacity: 1;
828
- border-color: rgb(64 64 64 / var(--tw-divide-opacity));
829
- }
830
-
831
879
  .divide-neutral-800 > :not([hidden]) ~ :not([hidden]) {
832
880
  --tw-divide-opacity: 1;
833
881
  border-color: rgb(38 38 38 / var(--tw-divide-opacity));
@@ -837,24 +885,20 @@ video {
837
885
  align-self: auto;
838
886
  }
839
887
 
840
- .self-end {
841
- align-self: flex-end;
842
- }
843
-
844
888
  .self-center {
845
889
  align-self: center;
846
890
  }
847
891
 
848
- .overflow-y-scroll {
849
- overflow-y: scroll;
892
+ .overflow-auto {
893
+ overflow: auto;
850
894
  }
851
895
 
852
- .whitespace-break-spaces {
853
- white-space: break-spaces;
896
+ .overflow-clip {
897
+ overflow: clip;
854
898
  }
855
899
 
856
- .break-all {
857
- word-break: break-all;
900
+ .whitespace-pre-wrap {
901
+ white-space: pre-wrap;
858
902
  }
859
903
 
860
904
  .rounded-full {
@@ -869,20 +913,11 @@ video {
869
913
  border-width: 4px;
870
914
  }
871
915
 
872
- .border-l-4 {
873
- border-left-width: 4px;
874
- }
875
-
876
916
  .border-neutral-300 {
877
917
  --tw-border-opacity: 1;
878
918
  border-color: rgb(212 212 212 / var(--tw-border-opacity));
879
919
  }
880
920
 
881
- .border-red-500 {
882
- --tw-border-opacity: 1;
883
- border-color: rgb(239 68 68 / var(--tw-border-opacity));
884
- }
885
-
886
921
  .border-transparent {
887
922
  border-color: transparent;
888
923
  }
@@ -891,6 +926,20 @@ video {
891
926
  background-color: rgb(0 0 0 / 0.1);
892
927
  }
893
928
 
929
+ .bg-blue-600 {
930
+ --tw-bg-opacity: 1;
931
+ background-color: rgb(37 99 235 / var(--tw-bg-opacity));
932
+ }
933
+
934
+ .bg-blue-700 {
935
+ --tw-bg-opacity: 1;
936
+ background-color: rgb(29 78 216 / var(--tw-bg-opacity));
937
+ }
938
+
939
+ .bg-blue-700\\/60 {
940
+ background-color: rgb(29 78 216 / 0.6);
941
+ }
942
+
894
943
  .bg-neutral-100 {
895
944
  --tw-bg-opacity: 1;
896
945
  background-color: rgb(245 245 245 / var(--tw-bg-opacity));
@@ -925,9 +974,18 @@ video {
925
974
  background-color: rgb(234 88 12 / var(--tw-bg-opacity));
926
975
  }
927
976
 
928
- .bg-red-100 {
929
- --tw-bg-opacity: 1;
930
- background-color: rgb(254 226 226 / var(--tw-bg-opacity));
977
+ .bg-gradient-to-b {
978
+ background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
979
+ }
980
+
981
+ .from-transparent {
982
+ --tw-gradient-from: transparent var(--tw-gradient-from-position);
983
+ --tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);
984
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
985
+ }
986
+
987
+ .to-blue-700 {
988
+ --tw-gradient-to: #1d4ed8 var(--tw-gradient-to-position);
931
989
  }
932
990
 
933
991
  .bg-cover {
@@ -962,10 +1020,6 @@ video {
962
1020
  padding: 1rem;
963
1021
  }
964
1022
 
965
- .p-5 {
966
- padding: 1.25rem;
967
- }
968
-
969
1023
  .p-6 {
970
1024
  padding: 1.5rem;
971
1025
  }
@@ -974,11 +1028,6 @@ video {
974
1028
  padding: .75em;
975
1029
  }
976
1030
 
977
- .px-3 {
978
- padding-left: 0.75rem;
979
- padding-right: 0.75rem;
980
- }
981
-
982
1031
  .px-8 {
983
1032
  padding-left: 2rem;
984
1033
  padding-right: 2rem;
@@ -994,6 +1043,14 @@ video {
994
1043
  padding-bottom: 2rem;
995
1044
  }
996
1045
 
1046
+ .pb-8 {
1047
+ padding-bottom: 2rem;
1048
+ }
1049
+
1050
+ .pt-8 {
1051
+ padding-top: 2rem;
1052
+ }
1053
+
997
1054
  .text-left {
998
1055
  text-align: left;
999
1056
  }
@@ -1020,6 +1077,11 @@ video {
1020
1077
  line-height: 1.5rem;
1021
1078
  }
1022
1079
 
1080
+ .text-lg {
1081
+ font-size: 1.125rem;
1082
+ line-height: 1.75rem;
1083
+ }
1084
+
1023
1085
  .text-sm {
1024
1086
  font-size: 0.875rem;
1025
1087
  line-height: 1.25rem;
@@ -1030,12 +1092,12 @@ video {
1030
1092
  line-height: 1rem;
1031
1093
  }
1032
1094
 
1033
- .font-medium {
1034
- font-weight: 500;
1095
+ .font-bold {
1096
+ font-weight: 700;
1035
1097
  }
1036
1098
 
1037
- .font-semibold {
1038
- font-weight: 600;
1099
+ .font-medium {
1100
+ font-weight: 500;
1039
1101
  }
1040
1102
 
1041
1103
  .leading-none {
@@ -1056,26 +1118,11 @@ video {
1056
1118
  color: rgb(163 163 163 / var(--tw-text-opacity));
1057
1119
  }
1058
1120
 
1059
- .text-neutral-500 {
1060
- --tw-text-opacity: 1;
1061
- color: rgb(115 115 115 / var(--tw-text-opacity));
1062
- }
1063
-
1064
- .text-neutral-700 {
1065
- --tw-text-opacity: 1;
1066
- color: rgb(64 64 64 / var(--tw-text-opacity));
1067
- }
1068
-
1069
1121
  .text-orange-500 {
1070
1122
  --tw-text-opacity: 1;
1071
1123
  color: rgb(249 115 22 / var(--tw-text-opacity));
1072
1124
  }
1073
1125
 
1074
- .text-red-900 {
1075
- --tw-text-opacity: 1;
1076
- color: rgb(127 29 29 / var(--tw-text-opacity));
1077
- }
1078
-
1079
1126
  .text-transparent {
1080
1127
  color: transparent;
1081
1128
  }
@@ -1085,6 +1132,14 @@ video {
1085
1132
  color: rgb(255 255 255 / var(--tw-text-opacity));
1086
1133
  }
1087
1134
 
1135
+ .text-white\\/20 {
1136
+ color: rgb(255 255 255 / 0.2);
1137
+ }
1138
+
1139
+ .text-white\\/80 {
1140
+ color: rgb(255 255 255 / 0.8);
1141
+ }
1142
+
1088
1143
  .opacity-0 {
1089
1144
  opacity: 0;
1090
1145
  }
@@ -1212,6 +1267,11 @@ video {
1212
1267
  content: var(--tw-content);
1213
1268
  }
1214
1269
 
1270
+ .hover\\:bg-blue-500:hover {
1271
+ --tw-bg-opacity: 1;
1272
+ background-color: rgb(59 130 246 / var(--tw-bg-opacity));
1273
+ }
1274
+
1215
1275
  .hover\\:bg-neutral-200:hover {
1216
1276
  --tw-bg-opacity: 1;
1217
1277
  background-color: rgb(229 229 229 / var(--tw-bg-opacity));
@@ -1222,16 +1282,15 @@ video {
1222
1282
  background-color: rgb(251 146 60 / var(--tw-bg-opacity));
1223
1283
  }
1224
1284
 
1225
- .hover\\:text-neutral-500:hover {
1226
- --tw-text-opacity: 1;
1227
- color: rgb(115 115 115 / var(--tw-text-opacity));
1228
- }
1229
-
1230
1285
  .hover\\:text-white:hover {
1231
1286
  --tw-text-opacity: 1;
1232
1287
  color: rgb(255 255 255 / var(--tw-text-opacity));
1233
1288
  }
1234
1289
 
1290
+ .hover\\:text-white\\/40:hover {
1291
+ color: rgb(255 255 255 / 0.4);
1292
+ }
1293
+
1235
1294
  .hover\\:brightness-125:hover {
1236
1295
  --tw-brightness: brightness(1.25);
1237
1296
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
@@ -1262,15 +1321,15 @@ video {
1262
1321
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1263
1322
  }
1264
1323
 
1265
- .group:hover .group-hover\\:text-black {
1266
- --tw-text-opacity: 1;
1267
- color: rgb(0 0 0 / var(--tw-text-opacity));
1268
- }
1269
-
1270
1324
  .aria-busy\\:pointer-events-none[aria-busy="true"] {
1271
1325
  pointer-events: none;
1272
1326
  }
1273
1327
 
1328
+ .aria-busy\\:bg-blue-500[aria-busy="true"] {
1329
+ --tw-bg-opacity: 1;
1330
+ background-color: rgb(59 130 246 / var(--tw-bg-opacity));
1331
+ }
1332
+
1274
1333
  .aria-disabled\\:pointer-events-none[aria-disabled="true"] {
1275
1334
  pointer-events: none;
1276
1335
  }
@@ -1279,6 +1338,14 @@ video {
1279
1338
  opacity: 0.5;
1280
1339
  }
1281
1340
 
1341
+ .group[aria-busy="true"] .group-aria-busy\\:inline {
1342
+ display: inline;
1343
+ }
1344
+
1345
+ .group[aria-busy="true"] .group-aria-busy\\:hidden {
1346
+ display: none;
1347
+ }
1348
+
1282
1349
  .group\\/button[aria-busy="true"] .group-aria-busy\\/button\\:translate-x-0 {
1283
1350
  --tw-translate-x: 0px;
1284
1351
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -1359,25 +1426,10 @@ video {
1359
1426
  background-color: rgb(38 38 38 / var(--tw-bg-opacity));
1360
1427
  }
1361
1428
 
1362
- .dark\\:bg-red-900:where([data-theme="dark"], [data-theme="dark"] *) {
1363
- --tw-bg-opacity: 1;
1364
- background-color: rgb(127 29 29 / var(--tw-bg-opacity));
1365
- }
1366
-
1367
1429
  .dark\\:bg-white\\/10:where([data-theme="dark"], [data-theme="dark"] *) {
1368
1430
  background-color: rgb(255 255 255 / 0.1);
1369
1431
  }
1370
1432
 
1371
- .dark\\:text-neutral-400:where([data-theme="dark"], [data-theme="dark"] *) {
1372
- --tw-text-opacity: 1;
1373
- color: rgb(163 163 163 / var(--tw-text-opacity));
1374
- }
1375
-
1376
- .dark\\:text-red-50:where([data-theme="dark"], [data-theme="dark"] *) {
1377
- --tw-text-opacity: 1;
1378
- color: rgb(254 242 242 / var(--tw-text-opacity));
1379
- }
1380
-
1381
1433
  .dark\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {
1382
1434
  --tw-text-opacity: 1;
1383
1435
  color: rgb(255 255 255 / var(--tw-text-opacity));
@@ -1387,12 +1439,7 @@ video {
1387
1439
  --tw-bg-opacity: 1;
1388
1440
  background-color: rgb(64 64 64 / var(--tw-bg-opacity));
1389
1441
  }
1442
+ `;import{useResizeObserver as Ur}from"usehooks-ts";import{mergeRefs as Nr}from"react-merge-refs";import{createContext as jt,useContext as Zt}from"react";import{jsx as Jt}from"react/jsx-runtime";var Ie=jt(null);function Me({frame:e,children:t}){if(Zt(Ie))throw new Error("`FrameProvider` can only be used once.");return Jt(Ie.Provider,{value:{frame:e},children:t})}import{useMediaQuery as kr}from"usehooks-ts";import"@rainbow-me/rainbowkit/styles.css";import{createContext as wr,useContext as Qe}from"react";import{RainbowKitProvider as vr,midnightTheme as xr}from"@rainbow-me/rainbowkit";import{useChains as Cr}from"wagmi";import{transactionQueue as mr}from"@latticexyz/common/actions";import{createClient as ur,fallback as fr,http as Ke,keccak256 as gr,stringToHex as hr,webSocket as yr}from"viem";import{privateKeyToAccount as br}from"viem/accounts";import{createTransport as lr,numberToHex as dr,parseEther as cr}from"viem";import{entryPoint07Address as Le}from"viem/account-abstraction";import{formatUserOperationRequest as er}from"viem/account-abstraction";async function Oe(e){return er({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}import{parseEventLogs as tr}from"viem";import{formatUserOperation as rr,toPackedUserOperation as or,getUserOperationHash as nr,entryPoint07Address as He,entryPoint07Abi as ze}from"viem/account-abstraction";import{waitForTransactionReceipt as ar,writeContract as ir}from"viem/actions";import{getAction as qe}from"viem/utils";async function Be({executor:e,rpcUserOp:t}){let r=rr(t),o=or(r),n=nr({userOperation:r,chainId:e.chain.id,entryPointVersion:"0.7",entryPointAddress:He}),a=await qe(e,ir,"writeContract")({abi:ze,address:He,functionName:"handleOps",args:[[o],e.account.address],chain:e.chain,account:e.account}),i=await qe(e,ar,"waitForTransactionReceipt")({hash:a});return{success:tr({logs:i.logs,abi:ze,eventName:"UserOperationEvent"})[0].args.success,userOpHash:n,receipt:i}}import Fe from"debug";var ge=Fe("mud:entrykit"),sr=Fe("mud:entrykit");ge.log=console.debug.bind(console);sr.log=console.error.bind(console);var T=ge.extend("quarry");import{setBalance as pr}from"viem/actions";function De({executor:e}){return()=>{T("using a local user op executor",e.account.address),e.chain.id===31337&&(T("setting executor balance"),pr(e.extend(()=>({mode:"anvil"})),{address:e.account.address,value:cr("100")}));let t=new Map;return lr({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:o,params:n})=>{if(o==="eth_chainId")return dr(e.chain.id);if(o==="eth_supportedEntryPoints")return[Le];if(o==="eth_sendUserOperation"){let[a,i]=n;if(i===Le){let l=await Be({executor:e,rpcUserOp:a});return t.set(l.userOpHash,l),l.userOpHash}}if(o==="eth_getUserOperationReceipt"){let[a]=n;return t.get(a)??null}if(o==="eth_estimateUserOperationGas")return await Oe(n);throw new Error("Method not implemented.")}})}}function Y(e){let t=e.rpcUrls.bundler?.http[0],r=t?Ke(t):e.id===31337?De({executor:ur({chain:e,transport:fr([yr(),Ke()]),account:br(gr(hr("local user op executor"))),pollingInterval:10}).extend(mr())}):null;if(!r)throw new Error(`Chain ${e.id} config did not include a bundler RPC URL.`);return r}import{jsx as Ge}from"react/jsx-runtime";var he=wr(null);function Ve({config:e,children:t}){if(Qe(he))throw new Error("`EntryKitProvider` can only be used once.");let n=Cr().find(({id:a})=>a===e.chainId);if(!n)throw new Error(`Could not find configured chain for chain ID ${e.chainId}.`);return Y(n),Ge(vr,{initialChain:0,appInfo:{appName:e.appName},theme:xr({borderRadius:"none"}),children:Ge(he.Provider,{value:{...e,chain:n},children:t})})}function s(){let e=Qe(he);if(!e)throw new Error("`useEntryKitConfig` can only be used within a `EntryKitProvider`.");return e}function We(){let{theme:e}=s(),t=kr("(prefers-color-scheme: dark)");return e??(t?"dark":"light")}import{jsx as B,jsxs as Rr}from"react/jsx-runtime";function Er({onSize:e,...t}){let r=Ye(null);return Ur({ref:r,onResize:e}),B("div",{ref:r,...t,style:{...t.style,display:"inline-grid"}})}var X=Sr(function({mode:t,children:r},o){let n=Ye(null),[a,i]=_e(!1),l=a?n.current:null,[c,f]=_e({width:void 0,height:void 0}),m=l?.contentDocument,d=We();Pr(()=>{m&&m.body.setAttribute("data-theme",d)},[m,d]);let p=t==="modal"?{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",zIndex:"2147483646"}:c.width&&c.height?{all:"unset",display:"inline-grid",width:`${c.width}px`,height:`${c.height}px`}:{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",opacity:0,pointerEvents:"none"};return B("iframe",{ref:Nr([o,n]),style:p,onLoad:()=>i(!0),srcDoc:"<!doctype html><title>\u2026</title>",children:m?Ar.createPortal(Rr(Me,{frame:l,children:[B("div",{children:t==="modal"?r:B(Er,{onSize:f,children:r})}),B("style",{dangerouslySetInnerHTML:{__html:Te}})]}),m.body):null})});import{twMerge as Xe}from"tailwind-merge";import{jsx as I,jsxs as Or}from"react/jsx-runtime";function $e({open:e,onOpenChange:t,children:r}){return I(Tr,{open:e,onOpenChange:t,children:I(Ir,{children:Or(X,{mode:"modal",children:[I("div",{className:Xe("fixed inset-0","bg-neutral-800/85","animate-in animate-duration-300 fade-in")}),I("div",{className:Xe("fixed inset-0","grid items-end sm:items-center","animate-in animate-duration-300 fade-in slide-in-from-bottom-16"),children:I("div",{children:I(Mr,{className:"outline-none w-full max-w-[26rem] mx-auto","aria-describedby":void 0,onOpenAutoFocus:o=>{o.preventDefault()},children:r})})})]})})})}import{useCallback as ye,useMemo as Hr}from"react";import{useStore as zr}from"zustand";import{createStore as qr}from"zustand/vanilla";var $=qr(()=>({open:!1}));function x(){let e=zr($,n=>n.open),t=ye(()=>{$.setState({open:!0})},[]),r=ye(()=>{$.setState({open:!1})},[]),o=ye(n=>{$.setState({open:n})},[]);return Hr(()=>({accountModalOpen:e,openAccountModal:t,closeAccountModal:r,toggleAccountModal:o}),[e,t,r,o])}import{twMerge as Ft}from"tailwind-merge";import{useAccount as Bn,useConnectorClient as Fn}from"wagmi";import{useAccount as Wr}from"wagmi";import{twMerge as L}from"tailwind-merge";import{twMerge as Br}from"tailwind-merge";import{jsx as je,jsxs as Fr}from"react/jsx-runtime";function S({className:e,...t}){return Fr("svg",{className:Br("-my-[0.125em] h-[1.25em] w-[1.25em] animate-spin",e),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[je("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),je("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}import{jsx as F,jsxs as Dr}from"react/jsx-runtime";var Lr=({variant:e="secondary"}={})=>L("group/button self-center leading-none outline-none border-4 border-transparent","transition hover:brightness-125 active:brightness-150","focus:border-orange-500","aria-disabled:pointer-events-none aria-busy:pointer-events-none","aria-disabled:opacity-50","p-[.75em] font-medium",{primary:L("bg-orange-600 text-white focus:border-yellow-400"),secondary:L("bg-neutral-700 text-white focus:border-orange-500"),tertiary:L("bg-neutral-800 text-white focus:border-orange-500")}[e]),y=({pending:e,variant:t,type:r,className:o,children:n,disabled:a,...i})=>F("button",{type:r||"button",className:L(Lr({variant:t,pending:e}),o),"aria-busy":e,"aria-disabled":a,disabled:a||e,...i,children:Dr("span",{className:"grid grid-cols-[1fr_auto_1fr] gap-2",children:[F("span",{className:"flex items-center justify-end text-[.75em]",children:F("span",{className:"transition opacity-0 translate-x-2 group-aria-busy/button:opacity-100 group-aria-busy/button:translate-x-0 duration-100 group-aria-busy/button:duration-300",children:F(S,{})})}),F("span",{children:n})]})});import{useConnectModal as _r}from"@rainbow-me/rainbowkit";import{twMerge as Kr}from"tailwind-merge";import{jsx as be,jsxs as Gr}from"react/jsx-runtime";function P({className:e,...t}){return Gr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8",fill:"currentColor",shapeRendering:"crispEdges",className:Kr("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...t,children:[be("path",{d:"M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z"}),be("path",{d:"M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z",opacity:".5"}),be("path",{d:"M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"})]})}import{useQuery as Qr}from"@tanstack/react-query";function j(e){return Qr({enabled:!!e,retry:!1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,queryKey:["preloadImage",e],queryFn:()=>new Promise((t,r)=>{if(!e)throw new Error("usePreloadImage: Must provide `url` to preload image.");let o=new Image;o.onload=()=>t(o),o.onerror=()=>r(new Error(`usePreloadImage: Could not load image.
1390
1443
 
1391
- .group:hover .dark\\:group-hover\\:text-white:where([data-theme="dark"], [data-theme="dark"] *) {
1392
- --tw-text-opacity: 1;
1393
- color: rgb(255 255 255 / var(--tw-text-opacity));
1394
- }
1395
- `;import{useResizeObserver as vr}from"usehooks-ts";import{mergeRefs as Cr}from"react-merge-refs";import{createContext as Vt,useContext as Wt}from"react";import{jsx as _t}from"react/jsx-runtime";var Se=Vt(null);function Ae({frame:e,children:t}){if(Wt(Se))throw new Error("`FrameProvider` can only be used once.");return _t(Se.Provider,{value:{frame:e},children:t})}import{useMediaQuery as yr}from"usehooks-ts";import"@rainbow-me/rainbowkit/styles.css";import{createContext as ur,useContext as ze}from"react";import{RainbowKitProvider as gr,midnightTheme as fr}from"@rainbow-me/rainbowkit";import{useChains as hr}from"wagmi";import{transactionQueue as ir}from"@latticexyz/common/actions";import{createClient as sr,fallback as lr,http as He,keccak256 as dr,stringToHex as cr,webSocket as pr}from"viem";import{privateKeyToAccount as mr}from"viem/accounts";import{createTransport as rr,numberToHex as or,parseEther as nr}from"viem";import{entryPoint07Address as Me}from"viem/account-abstraction";import{formatUserOperationRequest as Yt}from"viem/account-abstraction";async function Pe(e){return Yt({callGasLimit:20000000n,preVerificationGas:200000n,verificationGasLimit:2000000n,paymasterVerificationGasLimit:200000n,paymasterPostOpGasLimit:200000n})}import{parseEventLogs as Xt}from"viem";import{formatUserOperation as jt,toPackedUserOperation as $t,getUserOperationHash as Zt,entryPoint07Address as Ue,entryPoint07Abi as Ne}from"viem/account-abstraction";import{waitForTransactionReceipt as Jt,writeContract as er}from"viem/actions";import{getAction as Ee}from"viem/utils";async function Re({executor:e,rpcUserOp:t}){let r=jt(t),o=$t(r),n=Zt({userOperation:r,chainId:e.chain.id,entryPointVersion:"0.7",entryPointAddress:Ue}),a=await Ee(e,er,"writeContract")({abi:Ne,address:Ue,functionName:"handleOps",args:[[o],e.account.address],chain:e.chain,account:e.account}),i=await Ee(e,Jt,"waitForTransactionReceipt")({hash:a});return{success:Xt({logs:i.logs,abi:Ne,eventName:"UserOperationEvent"})[0].args.success,userOpHash:n,receipt:i}}import Te from"debug";var ie=Te("mud:entrykit"),tr=Te("mud:entrykit");ie.log=console.debug.bind(console);tr.log=console.error.bind(console);var E=ie.extend("quarry");import{setBalance as ar}from"viem/actions";function Ie({executor:e}){return()=>{E("using a local user op executor",e.account.address),e.chain.id===31337&&(E("setting executor balance"),ar(e.extend(()=>({mode:"anvil"})),{address:e.account.address,value:nr("100")}));let t=new Map;return rr({key:"userOpExecutor",type:"userOpExecutor",name:"User Operation Executor Transport",request:async({method:o,params:n})=>{if(o==="eth_chainId")return or(e.chain.id);if(o==="eth_supportedEntryPoints")return[Me];if(o==="eth_sendUserOperation"){let[a,i]=n;if(i===Me){let s=await Re({executor:e,rpcUserOp:a});return t.set(s.userOpHash,s),s.userOpHash}}if(o==="eth_getUserOperationReceipt"){let[a]=n;return t.get(a)??null}if(o==="eth_estimateUserOperationGas")return await Pe(n);throw new Error("Method not implemented.")}})}}function Q(e){let t=e.rpcUrls.bundler?.http[0],r=t?He(t):e.id===31337?Ie({executor:sr({chain:e,transport:lr([pr(),He()]),account:mr(dr(cr("local user op executor"))),pollingInterval:10}).extend(ir())}):null;if(!r)throw new Error(`Chain ${e.id} config did not include a bundler RPC URL.`);return r}import{jsx as Oe}from"react/jsx-runtime";var se=ur(null);function qe({config:e,children:t}){if(ze(se))throw new Error("`EntryKitProvider` can only be used once.");let n=hr().find(({id:a})=>a===e.chainId);if(!n)throw new Error(`Could not find configured chain for chain ID ${e.chainId}.`);return Q(n),Oe(gr,{initialChain:0,appInfo:{appName:e.appName},theme:fr({borderRadius:"none"}),children:Oe(se.Provider,{value:{...e,chain:n},children:t})})}function l(){let e=ze(se);if(!e)throw new Error("`useEntryKitConfig` can only be used within a `EntryKitProvider`.");return e}function Be(){let{theme:e}=l(),t=yr("(prefers-color-scheme: dark)");return e??(t?"dark":"light")}import{jsx as O,jsxs as Sr}from"react/jsx-runtime";function kr({onSize:e,...t}){let r=Fe(null);return vr({ref:r,onResize:e}),O("div",{ref:r,...t,style:{...t.style,display:"inline-grid"}})}var V=br(function({mode:t,children:r},o){let n=Fe(null),[a,i]=Le(!1),s=a?n.current:null,[c,g]=Le({width:void 0,height:void 0}),m=s?.contentDocument,d=Be();wr(()=>{m&&m.body.setAttribute("data-theme",d)},[m,d]);let p=t==="modal"?{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",zIndex:"2147483646"}:c.width&&c.height?{all:"unset",display:"inline-grid",width:`${c.width}px`,height:`${c.height}px`}:{all:"unset",display:"block",position:"fixed",inset:"0",width:"100%",height:"100%",opacity:0,pointerEvents:"none"};return O("iframe",{ref:Cr([o,n]),style:p,onLoad:()=>i(!0),srcDoc:"<!doctype html><title>\u2026</title>",children:m?xr.createPortal(Sr(Ae,{frame:s,children:[O("div",{children:t==="modal"?r:O(kr,{onSize:g,children:r})}),O("style",{dangerouslySetInnerHTML:{__html:ke}})]}),m.body):null})});import{twMerge as Ke}from"tailwind-merge";import{jsx as R,jsxs as Nr}from"react/jsx-runtime";function De({open:e,onOpenChange:t,children:r}){return R(Ar,{open:e,onOpenChange:t,children:R(Pr,{children:Nr(V,{mode:"modal",children:[R("div",{className:Ke("fixed inset-0","bg-neutral-800/85","animate-in animate-duration-300 fade-in")}),R("div",{className:Ke("fixed inset-0","grid items-end sm:items-center","animate-in animate-duration-300 fade-in slide-in-from-bottom-16"),children:R("div",{children:R(Ur,{className:"outline-none w-full max-w-[26rem] mx-auto","aria-describedby":void 0,onOpenAutoFocus:o=>{o.preventDefault()},children:r})})})]})})})}import{useCallback as le,useMemo as Er}from"react";import{useStore as Rr}from"zustand";import{createStore as Tr}from"zustand/vanilla";var W=Tr(()=>({open:!1}));function v(){let e=Rr(W,n=>n.open),t=le(()=>{W.setState({open:!0})},[]),r=le(()=>{W.setState({open:!1})},[]),o=le(n=>{W.setState({open:n})},[]);return Er(()=>({accountModalOpen:e,openAccountModal:t,closeAccountModal:r,toggleAccountModal:o}),[e,t,r,o])}import{twMerge as It}from"tailwind-merge";import{useAccount as En,useConnectorClient as Rn}from"wagmi";import{useAccount as Fr}from"wagmi";import{twMerge as q}from"tailwind-merge";import{twMerge as Mr}from"tailwind-merge";import{jsx as Ge,jsxs as Ir}from"react/jsx-runtime";function b({className:e,...t}){return Ir("svg",{className:Mr("-my-[0.125em] h-[1.25em] w-[1.25em] animate-spin",e),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[Ge("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),Ge("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}import{jsx as z,jsxs as Or}from"react/jsx-runtime";var Hr=({variant:e="secondary"}={})=>q("group/button self-center leading-none outline-none border-4 border-transparent","transition hover:brightness-125 active:brightness-150","focus:border-orange-500","aria-disabled:pointer-events-none aria-busy:pointer-events-none","aria-disabled:opacity-50","p-[.75em] font-medium",{primary:q("bg-orange-600 text-white focus:border-yellow-400"),secondary:q("bg-neutral-700 text-white focus:border-orange-500"),tertiary:q("bg-neutral-800 text-white focus:border-orange-500")}[e]),y=({pending:e,variant:t,type:r,className:o,children:n,disabled:a,...i})=>z("button",{type:r||"button",className:q(Hr({variant:t,pending:e}),o),"aria-busy":e,"aria-disabled":a,disabled:a||e,...i,children:Or("span",{className:"grid grid-cols-[1fr_auto_1fr] gap-2",children:[z("span",{className:"flex items-center justify-end text-[.75em]",children:z("span",{className:"transition opacity-0 translate-x-2 group-aria-busy/button:opacity-100 group-aria-busy/button:translate-x-0 duration-100 group-aria-busy/button:duration-300",children:z(b,{})})}),z("span",{children:n})]})});import{useConnectModal as Kr}from"@rainbow-me/rainbowkit";import{twMerge as zr}from"tailwind-merge";import{jsx as de,jsxs as qr}from"react/jsx-runtime";function S({className:e,...t}){return qr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8",fill:"currentColor",shapeRendering:"crispEdges",className:zr("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...t,children:[de("path",{d:"M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z"}),de("path",{d:"M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z",opacity:".5"}),de("path",{d:"M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"})]})}import{useQuery as Br}from"@tanstack/react-query";function _(e){return Br({enabled:!!e,retry:!1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,queryKey:["preloadImage",e],queryFn:()=>new Promise((t,r)=>{if(!e)throw new Error("usePreloadImage: Must provide `url` to preload image.");let o=new Image;o.onload=()=>t(o),o.onerror=()=>r(new Error(`usePreloadImage: Could not load image.
1396
-
1397
- URL: ${e}`)),o.src=e})})}import{jsx as Y,jsxs as Lr}from"react/jsx-runtime";function Qe(){let{appName:e,appIcon:t}=l(),{data:r,isLoading:o}=_(t);return Lr("div",{className:"flex-grow flex flex-col items-center justify-center gap-2",children:[Y("div",{className:"w-16 h-16 m-2",children:o?null:r?Y("img",{src:t,className:"w-full h-full object-cover"}):Y(S,{className:"w-full h-full text-orange-500 dark:bg-neutral-800"})}),Y("div",{className:"text-2xl text-white text-center",children:e})]})}import{twMerge as Dr}from"tailwind-merge";import{useEffect as Gr,useState as Qr}from"react";import{jsx as X,jsxs as Vr}from"react/jsx-runtime";function Ve(){let e=Fr(),{openConnectModal:t,connectModalOpen:r}=Kr(),[o,n]=Qr(!1);return Gr(()=>{!r&&!o&&(t?.(),n(!0))},[r,o,t]),Vr("div",{className:Dr("flex flex-col gap-6 p-6","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:[X("div",{className:"p-4",children:X(Qe,{})}),X("div",{className:"self-center flex flex-col gap-2 w-60",children:X(y,{variant:"secondary",className:"self-auto flex justify-center",disabled:e.status==="connecting",onClick:t,autoFocus:!0,children:"Connect wallet"},"create")})]})}import{useEffect as Ct,useMemo as Pn,useRef as Un,useState as Nn}from"react";import{twMerge as we}from"tailwind-merge";import{parseEther as Wr}from"viem";var P=Wr("0.01");import{useClient as to}from"wagmi";import{queryOptions as ro,useQuery as oo}from"@tanstack/react-query";import{numberToHex as jr}from"viem";import{defineStore as _r}from"@latticexyz/store";import{parseAbi as Yr}from"viem";var ce=Yr(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),Xr=_r({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),T=Xr.namespaces.root.tables;import{getRecord as $r,getStaticDataLocation as Zr}from"@latticexyz/store/internal";import{getKeyTuple as Jr}from"@latticexyz/protocol-parser/internal";import{setStorageAt as eo}from"viem/actions";function h(e){let t=e.contracts??{};if("quarryPaymaster"in t&&t.quarryPaymaster!=null&&"address"in t.quarryPaymaster)return{type:"quarry",address:t.quarryPaymaster.address};if("paymaster"in t&&t.paymaster!=null&&"address"in t.paymaster)return{type:"simple",address:t.paymaster.address}}async function We({client:e,userAddress:t}){let r=h(e.chain);return r?.type!=="quarry"?null:(await $r(e,{address:r.address,table:T.Allowance,key:{user:t},blockTag:"pending"})).allowance}async function _e({client:e,userAddress:t,allowance:r}){let o=h(e.chain);if(o?.type!=="quarry")return;let n=Zr(T.Allowance.tableId,Jr(T.Allowance,{user:t}));await eo(e.extend(()=>({mode:"anvil"})),{address:o.address,index:n,value:jr(r,{size:32})})}function pe({client:e,userAddress:t}){let r=["getAllowance",e?.chain.id,t];return ro(e&&t?{queryKey:r,queryFn:()=>We({client:e,userAddress:t})}:{queryKey:r,enabled:!1})}function Ye(e){let{chainId:t}=l(),r=to({chainId:t});return oo(pe({client:r,userAddress:e}))}import{useClient as xs}from"wagmi";import{queryOptions as ao,useQuery as Cs}from"@tanstack/react-query";import{getRecord as no}from"@latticexyz/store/internal";async function Xe({client:e,userAddress:t,sessionAddress:r}){let o=h(e.chain);return o?.type!=="quarry"?null:(await no(e,{address:o.address,table:T.Spender,key:{spender:r},blockTag:"pending"})).user.toLowerCase()===t.toLowerCase()}function je({client:e,userAddress:t,sessionAddress:r}){let o=["getSpender",e?.chain.id,t,r];return ao(e&&t&&r?{queryKey:o,queryFn:()=>Xe({client:e,userAddress:t,sessionAddress:r})}:{queryKey:o,enabled:!1})}import{useClient as Fs}from"wagmi";import{queryOptions as po,useQuery as Ds}from"@tanstack/react-query";import{getRecord as co}from"@latticexyz/store/internal";import{resourceToHex as io}from"@latticexyz/common";import{parseAbi as so}from"viem";import lo from"@latticexyz/world/mud.config";var $e={pollingInterval:250},B=io({type:"system",namespace:"",name:"unlimited"}),Ze=lo.namespaces.world.tables,Je=so(["function registerDelegation(address delegatee, bytes32 delegationControlId, bytes initCallData)"]);async function et({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){return(await co(e,{address:t,table:Ze.UserDelegationControl,key:{delegator:r,delegatee:o},blockTag:"pending"})).delegationControlId===B}function tt({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){let n=["getDelegation",e?.chain.id,t,r,o];return po(e&&r&&o?{queryKey:n,queryFn:()=>et({client:e,worldAddress:t,userAddress:r,sessionAddress:o})}:{queryKey:n,enabled:!1})}import{queryOptions as Co,useQuery as ko,useQueryClient as So}from"@tanstack/react-query";import{useClient as Ao,useConfig as Po}from"wagmi";import{useClient as wo}from"wagmi";import{queryOptions as xo,useQuery as vo}from"@tanstack/react-query";import{toSimpleSmartAccount as bo}from"permissionless/accounts";import{isHex as fo}from"viem";import{createStore as mo}from"zustand/vanilla";import{persist as uo}from"zustand/middleware";var L=mo(uo(()=>({signers:{}}),{name:"mud:entrykit",partialize:({signers:e})=>({signers:e})}));function go(e){e.key===L.persist.getOptions().name&&L.persist.rehydrate()}window.addEventListener("storage",go);import{generatePrivateKey as ho,privateKeyToAccount as yo}from"viem/accounts";function rt(e){let t=e.toLowerCase(),r=L.getState().signers[t]??(()=>{let o=localStorage.getItem(`mud:appSigner:privateKey:${e.toLowerCase()}`)?.replace(/^"(.*)"$/,"$1"),n=fo(o)?o:ho();return L.setState(a=>({signers:{...a.signers,[t]:n}})),n})();return yo(r)}async function ot({client:e,userAddress:t}){let r=rt(t);return await bo({client:e,owner:r})}function me({client:e,userAddress:t}){let r=["getSessionAccount",e?.chain.id,t];return xo(e&&t?{queryKey:r,queryFn:()=>ot({client:e,userAddress:t}),staleTime:1/0}:{queryKey:r,enabled:!1})}function nt(e){let{chainId:t}=l(),r=wo({chainId:t});return vo(me({userAddress:e,client:r}))}import{getBalanceQueryOptions as Uo}from"wagmi/query";function No({queryClient:e,config:t,client:r,userAddress:o,worldAddress:n}){let a=["getPrerequisites",r?.chain.id,o];return Co(r&&o?{queryKey:a,queryFn:async()=>{let i=h(r.chain),{address:s}=await e.fetchQuery(me({client:r,userAddress:o})),[c,g,m,d]=await Promise.all([i?null:e.fetchQuery(Uo(t,{chainId:r.chain.id,address:s})),i?.type==="quarry"?e.fetchQuery(pe({client:r,userAddress:o})):null,i?.type==="quarry"?e.fetchQuery(je({client:r,userAddress:o,sessionAddress:s})):null,e.fetchQuery(tt({client:r,worldAddress:n,userAddress:o,sessionAddress:s}))]),p=g==null||g>=P,f=m??!0,G=c==null||c.value>=P;return{sessionAddress:s,hasAllowance:p,isSpender:f,hasGasBalance:G,hasDelegation:d,complete:p&&f&&d}}}:{queryKey:a,enabled:!1})}function M(e){let t=So(),{chainId:r,worldAddress:o}=l(),n=Po(),a=Ao({chainId:r});return ko(No({config:n,queryClient:t,client:a,userAddress:e,worldAddress:o}),t)}import{useDisconnect as To}from"wagmi";import{useQuery as Eo}from"@tanstack/react-query";function j(e){let t=e?.toLowerCase();return Eo({enabled:!!t,queryKey:["ens",t],queryFn:async()=>{let r=await fetch(`https://api.ensideas.com/ens/resolve/${t}`).then(o=>o.json());return{address:r.address??void 0,name:r.name??void 0,displayName:r.displayName??void 0,avatar:r.avatar??void 0}}})}import{jsx as ue,jsxs as Ro}from"react/jsx-runtime";function I({hex:e}){return e.length<=10?ue("span",{title:e,children:e}):Ro("span",{title:e,children:[ue("span",{className:"after:select-none after:content-['\u2026']",children:e.slice(0,6)}),ue("span",{className:"tracking-[-1ch] text-transparent",children:e.slice(6,-4)}),e.slice(-4)]})}import{useEffect as Mo}from"react";import{jsx as F,jsxs as ge}from"react/jsx-runtime";function at({isActive:e,isExpanded:t,userAddress:r}){let{data:o,error:n}=j(r);Mo(()=>{n&&console.log("Could not get ENS",n)},[n]);let{disconnect:a,isPending:i}=To(),{closeAccountModal:s}=v();return ge("div",{className:"flex flex-col gap-4",children:[ge("div",{className:"flex justify-between gap-4",children:[ge("div",{children:[F("div",{children:"Account"}),F("div",{className:"font-mono text-white",children:o?.name??F(I,{hex:r})})]}),F(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:i,onClick:()=>{s(),a()},children:"Sign out"})]}),t?F("p",{className:"text-sm",children:"Each of your onchain actions in this app is associated with your account."}):null]})}import{parseEther as Ho}from"viem";import{useMutation as Oo,useQueryClient as zo}from"@tanstack/react-query";import{http as Io}from"viem";function it(){return({chain:e})=>{if(!e)throw new Error("No chain provided to issuer transport.");let t="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!t)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${e.id}.`);return Io(t)({chain:e,retryCount:0})}}async function st({chain:e,userAddress:t}){let r=it()({chain:e});E("Issuing gas pass to",t),await r.request({method:"quarry_issuePass",params:["0x01",t]}),E("Claiming gas allowance for",t),await r.request({method:"quarry_claimAllowance",params:["0x01",t]})}import{useClient as qo}from"wagmi";function lt(){let e=zo(),{chain:t}=l(),r=qo({chainId:t.id}),o=["claimGasPass",t.id];return Oo({mutationKey:o,onError:n=>console.error(n),mutationFn:async n=>{if(t.id===31337){if(!r)throw new Error("No client?");await _e({client:r,userAddress:n,allowance:Ho("1")})}else await st({chain:t,userAddress:n});await Promise.all([e.invalidateQueries({queryKey:["getAllowance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])},retry:0})}import{twMerge as Bo}from"tailwind-merge";import{jsx as $,jsxs as Lo}from"react/jsx-runtime";function dt({className:e,...t}){return Lo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 263 428",fill:"currentColor",className:Bo("w-[0.6em] h-[1em]",e),...t,children:[$("path",{d:"M132 321V428L263 243L132 321Z"}),$("path",{d:"M0 243L132 321V428",fillOpacity:"0.5"}),$("path",{d:"M132 0V296L263 218"}),$("path",{d:"M0 218L132 296V0L0 218Z",fillOpacity:"0.5"})]})}import{formatEther as Fo}from"viem";function ct(e){let t=Fo(e),r=Math.floor(parseFloat(t)).toString().length;return parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:Math.max(0,6-r)})}import{formatEther as Ko}from"viem";import{jsx as Do,jsxs as Go}from"react/jsx-runtime";function Z({wei:e}){return Go("span",{className:"inline-flex items-center gap-1",title:Ko(e),children:[ct(e)," ",Do(dt,{})]})}import{useEffect as Qo}from"react";import{jsx as H,jsxs as fe}from"react/jsx-runtime";function pt({isActive:e,isExpanded:t,userAddress:r}){let o=Ye(r),n=lt();return Qo(()=>{let a=setTimeout(()=>{e&&n.status==="idle"&&o.isSuccess&&o.data!=null&&o.data<P&&n.mutate(r)});return()=>clearTimeout(a)},[o.data,o.isSuccess,n,e,r]),fe("div",{className:"flex flex-col gap-4",children:[fe("div",{className:"flex justify-between gap-4",children:[fe("div",{children:[H("div",{children:"Allowance"}),H("div",{className:"font-mono text-white",children:o.data!=null?H(Z,{wei:o.data}):H(b,{className:"text-sm"})})]}),H(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:o.status==="pending"||n.status==="pending",onClick:()=>n.mutate(r),children:"Top up"})]}),t?H("p",{className:"text-sm",children:"Your allowance is used to pay for onchain computation."}):null]})}import{encodeFunctionData as ut}from"viem";import{useMutation as tn,useQueryClient as rn}from"@tanstack/react-query";import{getAction as ye}from"viem/utils";import{sendUserOperation as on,waitForUserOperationReceipt as nn}from"viem/account-abstraction";import{waitForTransactionReceipt as an}from"viem/actions";import{useClient as sn}from"wagmi";import{resourceToHex as gt}from"@latticexyz/common";import ln from"@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";import{writeContract as Zo}from"viem/actions";import{getAction as Jo}from"viem/utils";import{toHex as Vo}from"viem";import{signTypedData as Wo}from"viem/actions";import{callWithSignatureTypes as _o}from"@latticexyz/world-module-callwithsignature/internal";import{getRecord as Yo}from"@latticexyz/store/internal";import Xo from"@latticexyz/world-module-callwithsignature/mud.config";import{hexToResource as jo}from"@latticexyz/common";import{getAction as $o}from"viem/utils";async function mt({userClient:e,worldAddress:t,systemId:r,callData:o,nonce:n,client:a}){let i=n??(a?(await Yo(a,{address:t,table:Xo.tables.CallWithSignatureNonces,key:{signer:e.account.address},blockTag:"pending"})).nonce:0n),{namespace:s,name:c}=jo(r);return await $o(e,Wo,"signTypedData")({account:e.account,domain:{verifyingContract:t,salt:Vo(e.chain.id,{size:32})},types:_o,primaryType:"Call",message:{signer:e.account.address,systemNamespace:s,systemName:c,callData:o,nonce:i}})}import en from"@latticexyz/world-module-callwithsignature/out/CallWithSignatureSystem.sol/CallWithSignatureSystem.abi.json";async function he({sessionClient:e,...t}){let r=await mt(t);return Jo(e,Zo,"writeContract")({address:t.worldAddress,abi:en,functionName:"callWithSignature",args:[t.userClient.account.address,t.systemId,t.callData,r]})}function ft({userClient:e}){let t=rn(),{chainId:r,worldAddress:o}=l(),n=sn({chainId:r}),a=["setupSession",n?.chain.id,e.account.address];return tn({mutationKey:a,onError:i=>console.error(i),mutationFn:async({sessionClient:i,registerSpender:s,registerDelegation:c})=>{if(!n)throw new Error("Client not ready.");let g=h(n.chain),m=i.account.address;if(console.log("setting up session"),e.account.type==="smart"){let d=[];if(s&&g?.type==="quarry"&&(console.log("registering spender"),d.push({to:g.address,abi:ce,functionName:"registerSpender",args:[m]})),c&&(console.log("registering delegation"),d.push({to:o,abi:Je,functionName:"registerDelegation",args:[m,B,"0x"]})),!d.length)return;console.log("setting up account with",d,e);let p=await ye(e,on,"sendUserOperation")({calls:d});console.log("got user op hash",p);let f=await ye(e,nn,"waitForUserOperationReceipt")({hash:p});console.log("got user op receipt",f),f.success||console.error("not successful?",f)}else{let d=[];if(s&&g?.type==="quarry"){console.log("registering spender");let p=await he({client:n,userClient:e,sessionClient:i,worldAddress:g.address,systemId:gt({type:"system",namespace:"",name:"SpenderSystem"}),callData:ut({abi:ce,functionName:"registerSpender",args:[m]})});console.log("got spender tx",p),d.push(p)}if(c){console.log("registering delegation");let p=await he({client:n,userClient:e,sessionClient:i,worldAddress:o,systemId:gt({type:"system",namespace:"",name:"Registration"}),callData:ut({abi:ln,functionName:"registerDelegation",args:[m,B,"0x"]})});console.log("got delegation tx",p),d.push(p)}if(!d.length)return;console.log("waiting for",d.length,"receipts");for(let p of d){let f=await ye(n,an,"waitForTransactionReceipt")({hash:p});console.log("got tx receipt",f),f.status==="reverted"&&console.error("tx reverted?",f)}}await Promise.all([t.invalidateQueries({queryKey:["getSpender"]}),t.invalidateQueries({queryKey:["getDelegation"]}),t.invalidateQueries({queryKey:["getPrerequisites"]})])},retry:0})}import{useEffect as bn}from"react";import{useClient as un}from"wagmi";import{queryOptions as gn,useQuery as fn}from"@tanstack/react-query";import{smartAccountActions as pn}from"permissionless";import{callFrom as mn}from"@latticexyz/world/internal";import{createBundlerClient as dn}from"viem/account-abstraction";var cn=new Set([31337,17420,17069,690]);function ht(e){let t=e.chain??e.client?.chain,r=t?h(t):void 0;return dn({...$e,paymaster:r?{getPaymasterData:async()=>({paymaster:r.address,paymasterData:"0x"})}:void 0,userOperation:{estimateFeesPerGas:t&&cn.has(t.id)?async()=>({maxFeePerGas:100000n,maxPriorityFeePerGas:0n}):void 0},...e})}async function yt({client:e,userAddress:t,sessionAccount:r,worldAddress:o}){let n=Q(e.chain);return ht({transport:n,client:e,account:r}).extend(pn).extend(mn({worldAddress:o,delegatorAddress:t,publicClient:e})).extend(()=>({userAddress:t}))}import{useEffect as hn}from"react";function yn({sessionAccount:e,client:t,userAddress:r,worldAddress:o}){let n=["getSessionClient",t?.uid,r,e?.address,o];return gn(t&&r&&e?{queryKey:n,queryFn:()=>yt({sessionAccount:e,client:t,userAddress:r,worldAddress:o}),staleTime:1/0}:{queryKey:n,enabled:!1})}function J(e){let{chainId:t,worldAddress:r}=l(),o=un({chainId:t}),{data:n,error:a}=nt(e);return hn(()=>{a&&console.error("Could not get session account",a)},[a]),fn(yn({sessionAccount:n,userAddress:e,client:o,worldAddress:r}))}import{jsx as K,jsxs as be}from"react/jsx-runtime";function bt({isActive:e,isExpanded:t,userClient:r,registerSpender:o,registerDelegation:n}){let a=J(r.account.address),i=ft({userClient:r}),s=!n&&!n;return bn(()=>{let c=setTimeout(()=>{e&&i.status==="idle"&&a.data&&!s&&i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n})});return()=>clearTimeout(c)},[s,e,n,o,a,i]),be("div",{className:"flex flex-col gap-4",children:[be("div",{className:"flex justify-between gap-4",children:[be("div",{children:[K("div",{children:"Session"}),K("div",{className:"font-mono text-white",children:s?"Enabled":"Set up"})]}),s?K(y,{variant:"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,disabled:!0,children:"Enabled"}):K(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:!a.data||i.status==="pending",onClick:a.data?()=>i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n}):void 0,children:"Enable"})]}),t?K("p",{className:"text-sm",children:"You can perform actions in this app without interruptions for approvals."}):null]})}import{useBalance as Sn}from"wagmi";var wt={"1":{bridgeUrl:"https://relay.link/bridge/ethereum"},"10":{bridgeUrl:"https://relay.link/bridge/optimism"},"56":{bridgeUrl:"https://relay.link/bridge/bnb"},"100":{bridgeUrl:"https://relay.link/bridge/gnosis"},"111":{bridgeUrl:"https://testnets.relay.link/bridge/bob"},"137":{bridgeUrl:"https://relay.link/bridge/polygon"},"185":{bridgeUrl:"https://relay.link/bridge/mint"},"288":{bridgeUrl:"https://relay.link/bridge/boba"},"324":{bridgeUrl:"https://relay.link/bridge/zksync"},"360":{bridgeUrl:"https://relay.link/bridge/shape"},"480":{bridgeUrl:"https://relay.link/bridge/world-chain"},"690":{bridgeUrl:"https://relay.link/bridge/redstone"},"919":{bridgeUrl:"https://testnets.relay.link/bridge/mode-testnet"},"1101":{bridgeUrl:"https://relay.link/bridge/polygon-zkevm"},"1135":{bridgeUrl:"https://relay.link/bridge/lisk"},"1301":{bridgeUrl:"https://testnets.relay.link/bridge/unichain-sepolia"},"1329":{bridgeUrl:"https://relay.link/bridge/sei"},"1625":{bridgeUrl:"https://relay.link/bridge/gravity"},"1868":{bridgeUrl:"https://relay.link/bridge/soneium"},"1993":{bridgeUrl:"https://testnets.relay.link/bridge/b3"},"1996":{bridgeUrl:"https://relay.link/bridge/sanko"},"2741":{bridgeUrl:"https://relay.link/bridge/abstract"},"2911":{bridgeUrl:"https://relay.link/bridge/hychain"},"4202":{bridgeUrl:"https://testnets.relay.link/bridge/lisk-sepolia"},"4321":{bridgeUrl:"https://relay.link/bridge/echos"},"5000":{bridgeUrl:"https://relay.link/bridge/mantle"},"5112":{bridgeUrl:"https://relay.link/bridge/ham"},"7560":{bridgeUrl:"https://relay.link/bridge/cyber"},"7865":{bridgeUrl:"https://relay.link/bridge/powerloom"},"7897":{bridgeUrl:"https://relay.link/bridge/arena-z"},"8333":{bridgeUrl:"https://relay.link/bridge/B3"},"8453":{bridgeUrl:"https://relay.link/bridge/base"},"9897":{bridgeUrl:"https://testnets.relay.link/bridge/arena-z-testnet"},"11011":{bridgeUrl:"https://testnets.relay.link/bridge/shape-sepolia"},"11124":{bridgeUrl:"https://testnets.relay.link/bridge/abstract"},"13746":{bridgeUrl:"https://testnets.relay.link/bridge/game7-testnet"},"17000":{bridgeUrl:"https://testnets.relay.link/bridge/holesky"},"17069":{bridgeUrl:"https://testnets.relay.link/bridge/garnet"},"17071":{bridgeUrl:"https://relay.link/bridge/onchain-points"},"33139":{bridgeUrl:"https://relay.link/bridge/apechain"},"33979":{bridgeUrl:"https://relay.link/bridge/funki"},"34443":{bridgeUrl:"https://relay.link/bridge/mode"},"42161":{bridgeUrl:"https://relay.link/bridge/arbitrum"},"42170":{bridgeUrl:"https://relay.link/bridge/arbitrum-nova"},"43114":{bridgeUrl:"https://relay.link/bridge/avalanche"},"55244":{bridgeUrl:"https://relay.link/bridge/superposition"},"57073":{bridgeUrl:"https://relay.link/bridge/ink"},"59144":{bridgeUrl:"https://relay.link/bridge/linea"},"60808":{bridgeUrl:"https://relay.link/bridge/bob"},"70700":{bridgeUrl:"https://relay.link/bridge/apex"},"70701":{bridgeUrl:"https://relay.link/bridge/boss"},"70800":{bridgeUrl:"https://testnets.relay.link/bridge/apex-testnet"},"70805":{bridgeUrl:"https://testnets.relay.link/bridge/cloud"},"80002":{bridgeUrl:"https://testnets.relay.link/bridge/amoy"},"81457":{bridgeUrl:"https://relay.link/bridge/blast"},"84532":{bridgeUrl:"https://testnets.relay.link/bridge/base-sepolia"},"167009":{bridgeUrl:"https://testnets.relay.link/bridge/hekla"},"421614":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-sepolia"},"534352":{bridgeUrl:"https://relay.link/bridge/scroll"},"543210":{bridgeUrl:"https://relay.link/bridge/zero-network"},"660279":{bridgeUrl:"https://relay.link/bridge/xai"},"911867":{bridgeUrl:"https://testnets.relay.link/bridge/odyssey"},"984122":{bridgeUrl:"https://relay.link/bridge/forma"},"1118190":{bridgeUrl:"https://testnets.relay.link/bridge/eclipse-testnet"},"3397901":{bridgeUrl:"https://testnets.relay.link/bridge/funki-testnet"},"4457845":{bridgeUrl:"https://testnets.relay.link/bridge/zero-sepolia"},"7777777":{bridgeUrl:"https://relay.link/bridge/zora"},"8253038":{bridgeUrl:"https://relay.link/bridge/bitcoin"},"9092725":{bridgeUrl:"https://testnets.relay.link/bridge/bitcoin-testnet4"},"9286185":{bridgeUrl:"https://relay.link/bridge/eclipse"},"11155111":{bridgeUrl:"https://testnets.relay.link/bridge/sepolia"},"11155420":{bridgeUrl:"https://testnets.relay.link/bridge/op-sepolia"},"666666666":{bridgeUrl:"https://relay.link/bridge/degen"},"792703809":{bridgeUrl:"https://relay.link/bridge/solana"},"888888888":{bridgeUrl:"https://relay.link/bridge/ancient8"},"999999999":{bridgeUrl:"https://testnets.relay.link/bridge/zora-sepolia"},"1380012617":{bridgeUrl:"https://relay.link/bridge/rari"},"1936682084":{bridgeUrl:"https://testnets.relay.link/bridge/solana-devnet"},"88153591557":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-blueberry"}};import{useQueryClient as xn,useMutation as vn}from"@tanstack/react-query";import{setBalance as Cn}from"viem/actions";import{useClient as kn}from"wagmi";function xt(){let e=xn(),{chainId:t}=l(),r=kn({chainId:t});return vn({mutationKey:["setBalance",t],onError:o=>console.error(o),mutationFn:async o=>(r&&(await Cn({...r,mode:"anvil"},o),await Promise.all([e.invalidateQueries({queryKey:["balance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])),null),retry:0})}import{Fragment as An,jsx as w,jsxs as D}from"react/jsx-runtime";function vt({isActive:e,isExpanded:t,sessionAddress:r}){let{chain:o}=l(),n=Sn({chainId:o.id,address:r,query:{refetchInterval:2e3}}),a=xt(),i=wt[o.id];return D("div",{className:"flex flex-col gap-4",children:[D("div",{className:"flex justify-between gap-4",children:[D("div",{children:[w("div",{children:"Gas balance"}),w("div",{className:"font-mono text-white",children:n.data!=null?w(Z,{wei:n.data.value}):w(b,{className:"text-sm"})})]}),o.id===31337?w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending"||a.status==="pending",onClick:()=>a.mutate({address:r,value:P+(n.data?.value??0n)}),children:"Top up"}):i!=null?w("a",{href:`${i.bridgeUrl}?${new URLSearchParams({toAddress:r})}`,target:"_blank",rel:"noopener noreferrer",children:w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending",children:"Top up"})}):null]}),t?D(An,{children:[w("p",{className:"text-sm",children:"Your session's gas balance is used to pay for onchain computation."}),D("p",{className:"text-sm",children:["Send funds to"," ",w("span",{className:"font-mono text-white",children:w(I,{hex:r})})," ","on ",o.name," to top up your session balance."]})]}):null]})}import{jsx as U}from"react/jsx-runtime";function kt({userClient:e,initialUserAddress:t}){let{chain:r}=l(),o=h(r),n=e.account.address,{data:a,error:i}=M(n);Ct(()=>{i&&console.error("Could not get prerequisites",i)},[i]);let{closeAccountModal:s}=v(),c=n!==t,g=Un(a);Ct(()=>{a!=null&&(g.current==null&&(g.current=a),a.complete&&(c||!g.current.complete)&&s())},[s,c,a]);let{sessionAddress:m,hasAllowance:d,isSpender:p,hasDelegation:f,hasGasBalance:G}=a??{},A=Pn(()=>{if(!n)return[{id:"wallet",isComplete:!1,content:()=>null}];let u=[{id:"wallet",isComplete:!0,content:x=>U(at,{...x,userAddress:n})}];return o?o.type==="quarry"&&u.push({id:"allowance",isComplete:!!d,content:x=>U(pt,{...x,userAddress:n})}):m!=null&&u.push({id:"gasBalance",isComplete:!!G,content:x=>U(vt,{...x,sessionAddress:m})}),u.push({id:"session",isComplete:!!p&&!!f,content:x=>U(bt,{...x,userClient:e,registerSpender:!p,registerDelegation:!f})}),u},[d,f,G,p,o,m,n,e]),[ve]=Nn(null),Ft=A.find(u=>u.content!=null&&!u.isComplete),oe=A.filter(u=>u.isComplete),ne=(ve!=null?A.find(u=>u.id===ve):null)??Ft??(oe.length<A.length?oe.at(-1):null),Ce=ne?A.indexOf(ne):-1;return U("div",{className:we("px-8 flex flex-col divide-y divide-neutral-800","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:A.map((u,x)=>{let ae=u===ne,Kt=ae||oe.length===A.length,Dt=!u.isComplete&&Ce!==-1&&x>Ce;return U("div",{className:we("py-8 flex flex-col justify-center",ae?"flex-grow":null),children:U("div",{className:we("flex flex-col",Dt?"opacity-30 pointer-events-none":null),children:u.content({isActive:ae,isExpanded:Kt})})},u.id)})})}import{useRef as Tn}from"react";import{jsx as St}from"react/jsx-runtime";function At(){let{chainId:e}=l(),t=Rn({chainId:e}),{address:r}=En(),o=Tn(r);return t.status!=="success"?St(Ve,{}):St(kt,{userClient:t.data,initialUserAddress:o.current})}import{useState as zn}from"react";import{ErrorBoundary as qn}from"react-error-boundary";import{twMerge as Mn}from"tailwind-merge";import{BaseError as In,UserRejectedRequestError as Hn}from"viem";import{jsx as Pt,jsxs as On}from"react/jsx-runtime";function Ut({title:e,error:t}){if(!t||t instanceof In&&t.walk(n=>n instanceof Hn)!=null)return null;let r=e??"Error",o=typeof t=="string"?t:t instanceof Error?String(t):"Something unexpected happened.";return On("div",{className:Mn("text-sm border-l-4 border-red-500","bg-red-100 text-red-900","dark:bg-red-900 dark:text-red-50"),children:[Pt("div",{className:"p-3 font-semibold",children:r}),Pt("div",{className:"px-3 whitespace-break-spaces break-all max-h-32 overflow-y-scroll",children:o})]})}import{wait as Bn}from"@latticexyz/common/utils";import{twMerge as Ln}from"tailwind-merge";import{useIsMounted as Fn}from"usehooks-ts";import{jsx as ee,jsxs as Nt}from"react/jsx-runtime";function Et({children:e}){let t=Fn(),[r,o]=zn(1);return ee(qn,{fallbackRender:({error:n,resetErrorBoundary:a})=>Nt("div",{className:Ln("flex-grow flex flex-col justify-center p-5 gap-2"),children:[ee(Ut,{error:n instanceof Error?n.stack??n.message:n}),r>0?Nt("button",{type:"button",onClick:async i=>{i.currentTarget.ariaBusy="true",await Bn(1e3),a(),t()&&(o(s=>s-1),i.currentTarget.ariaBusy=null)},className:"group aria-busy:pointer-events-none self-end flex items-center gap-1",children:[ee(b,{className:"transition opacity-0 group-aria-busy:opacity-100 text-xs text-neutral-500 dark:text-neutral-400"}),ee("span",{className:"text-sm text-neutral-500 dark:text-neutral-400 group-hover:text-black dark:group-hover:text-white",children:"Retry?"})]}):null]}),children:e})}import{DialogClose as Gn,DialogTitle as Qn}from"@radix-ui/react-dialog";import{twMerge as Kn}from"tailwind-merge";import{jsx as Dn}from"react/jsx-runtime";function Rt({className:e,children:t,...r}){return Dn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:Kn("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...r,children:t})}import{jsx as Tt}from"react/jsx-runtime";function Mt(e){return Tt(Rt,{strokeWidth:"2",stroke:"currentColor",...e,children:Tt("path",{d:"M6 18L18 6M6 6L18 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as C,jsxs as xe}from"react/jsx-runtime";function Ht(){let{accountModalOpen:e,toggleAccountModal:t}=v();return xe(De,{open:e,onOpenChange:t,children:[C(Qn,{className:"sr-only",children:"Connect with EntryKit"}),e?xe("div",{className:It("relative py-2 ring-1","bg-neutral-900 text-neutral-400 ring-neutral-700/50 divide-neutral-700","links:font-medium links:underline links:underline-offset-4","links:text-white","links:decoration-neutral-500 hover:links:decoration-orange-500"),children:[C(Et,{children:C(At,{})}),xe("a",{href:"https://mud.dev",target:"_blank",rel:"noreferrer noopener",className:"group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",children:[C("span",{className:"block w-4 h-4",children:C(S,{className:"w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300"})}),C("span",{children:"Powered by MUD"})]}),C("div",{className:"absolute top-0 right-0",children:C(Gn,{className:It("pointer-events-auto leading-none p-2 transition","text-neutral-700 hover:text-neutral-500"),title:"Close",children:C(Mt,{className:"m-0"})})})]}):null]})}import{jsx as Wn,jsxs as _n}from"react/jsx-runtime";function Vn({config:e,children:t}){return _n(qe,{config:e,children:[t,Wn(Ht,{})]})}import{useAccount as jn}from"wagmi";import{twMerge as N}from"tailwind-merge";import{twMerge as Ot}from"tailwind-merge";import{useEffect as Yn}from"react";import{Fragment as Xn,jsx as te,jsxs as zt}from"react/jsx-runtime";function qt({address:e}){let{data:t,error:r}=j(e),o=_(t?.avatar);return Yn(()=>{r&&console.log("Could not get ENS",r)},[r]),zt(Xn,{children:[zt("span",{className:"flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center",children:[te("img",{src:t?.avatar&&o.isSuccess?t.avatar:void 0,className:Ot("col-start-1 row-start-1","inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center","transtion duration-300",o.isSuccess?"opacity-100":"opacity-0")}),te(S,{className:Ot("col-start-1 row-start-1 text-orange-500","transition duration-300",t&&(!t.avatar||o.isError)?"opacity-100":"opacity-0")})]}),te("span",{className:"flex-grow",children:t?.name??te(I,{hex:e})})]})}import{useRef as $n}from"react";import{jsx as k,jsxs as Lt}from"react/jsx-runtime";var Bt=N("w-48 p-3 inline-flex outline-none transition","border border-transparent","text-base leading-none"),Zn=N("bg-neutral-100 border-neutral-300 text-black","dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"),Jn=N("cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700");function ea(){let{openAccountModal:e,accountModalOpen:t}=v(),{status:r,address:o}=jn(),n=$n(o),a=M(o),i=r==="connected"||r==="reconnecting"&&o,s=o!==n.current,c=a.isSuccess?a.data.complete:s?!1:i,g=(()=>{if(a.isSuccess){if(!a.data.hasAllowance)return"Top up";if(!a.data.hasDelegation||!a.data.isSpender)return"Set up"}return"Sign in"})();return k(V,{mode:"child",children:c?k("button",{type:"button",className:N(Bt,Zn,Jn),onClick:e,children:k("span",{className:"flex-grow inline-flex gap-2.5 items-center text-left font-medium",children:o?k(qt,{address:o}):null})},"connected"):Lt("button",{type:"button",className:N(Bt,"group","items-center justify-center gap-2.5","bg-orange-500 text-white font-medium","hover:bg-orange-400","active:bg-orange-600"),"aria-busy":t,onClick:e,children:[Lt("span",{className:"pointer-events-none inline-grid place-items-center -ml-3",children:[k("span",{className:N("col-start-1 row-start-1 leading-none","scale-100 opacity-100 transition duration-300","group-aria-busy:scale-125 group-aria-busy:opacity-0"),children:k(S,{})}),k("span",{"aria-hidden":!0,className:N("col-start-1 row-start-1","scale-50 opacity-0 transition duration-300 delay-50","group-aria-busy:scale-100 group-aria-busy:opacity-100"),children:k(b,{})})]}),k("span",{className:"font-medium",children:g})]},"sign in")})}import{useConnectorClient as ta}from"wagmi";function ra(){let{chainId:e}=l(),t=ta({chainId:e});t.error&&console.error("Error retrieving user client",t.error);let r=t.data?.account.address,o=M(r),n=J(r);return t.isSuccess?!o.isSuccess||!o.data.complete?{...o,data:void 0}:n:{...t,data:void 0}}import{connectorsForWallets as na}from"@rainbow-me/rainbowkit";import{createConfig as aa}from"wagmi";import{getDefaultWallets as oa}from"@rainbow-me/rainbowkit";function re(e){let{wallets:t}=oa();return[...t]}function ia(e){let t=re(e),r=na(t,{appName:e.appName,projectId:e.walletConnectProjectId});return aa({connectors:r,chains:e.chains,transports:e.transports,pollingInterval:e.pollingInterval})}import{connectorsForWallets as sa}from"@rainbow-me/rainbowkit";function Pm({wallets:e,...t}){return sa(e??re(t),{appName:t.appName,projectId:t.walletConnectProjectId})}export{ea as AccountButton,Vn as EntryKitProvider,ia as createWagmiConfig,Gt as defineConfig,Pm as getConnectors,re as getWallets,v as useAccountModal,l as useEntryKitConfig,ra as useSessionClient};
1444
+ URL: ${e}`)),o.src=e})})}import{jsx as Z,jsxs as Vr}from"react/jsx-runtime";function Ze(){let{appName:e,appIcon:t}=s(),{data:r,isLoading:o}=j(t);return Vr("div",{className:"flex-grow flex flex-col items-center justify-center gap-2",children:[Z("div",{className:"w-16 h-16 m-2",children:o?null:r?Z("img",{src:t,className:"w-full h-full object-cover"}):Z(P,{className:"w-full h-full text-orange-500 dark:bg-neutral-800"})}),Z("div",{className:"text-2xl text-white text-center",children:e})]})}import{twMerge as Yr}from"tailwind-merge";import{useEffect as Xr,useState as $r}from"react";import{jsx as J,jsxs as jr}from"react/jsx-runtime";function Je(){let e=Wr(),{openConnectModal:t,connectModalOpen:r}=_r(),[o,n]=$r(!1);return Xr(()=>{!r&&!o&&(t?.(),n(!0))},[r,o,t]),jr("div",{className:Yr("flex flex-col gap-6 p-6","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:[J("div",{className:"p-4",children:J(Ze,{})}),J("div",{className:"self-center flex flex-col gap-2 w-60",children:J(y,{variant:"secondary",className:"self-auto flex justify-center",disabled:e.status==="connecting",onClick:t,autoFocus:!0,children:"Connect wallet"},"create")})]})}import{useEffect as Et,useMemo as Hn,useRef as zn,useState as qn}from"react";import{twMerge as Ne}from"tailwind-merge";import{parseEther as Zr}from"viem";var N=Zr("0.01");import{useClient as so}from"wagmi";import{queryOptions as lo,useQuery as co}from"@tanstack/react-query";import{numberToHex as ro}from"viem";import{defineStore as Jr}from"@latticexyz/store";import{parseAbi as eo}from"viem";var we=eo(["error SpenderSystem_AlreadyRegistered(address spender, address user)","error SpenderSystem_HasOwnBalance(address spender)","function registerSpender(address spender)"]),to=Jr({namespaces:{root:{namespace:"",tables:{Allowance:{schema:{user:"address",allowance:"uint256"},key:["user"]},Grantor:{schema:{grantor:"address",allowance:"uint256"},key:["grantor"]},PassHolder:{schema:{user:"address",passId:"bytes32",lastRenewed:"uint256",lastClaimed:"uint256"},key:["user","passId"]},PassConfig:{schema:{passId:"bytes32",claimAmount:"uint256",claimInterval:"uint256",validityPeriod:"uint256",grantor:"address"},key:["passId"]},Spender:{schema:{spender:"address",user:"address"},key:["spender"]},SystemConfig:{schema:{entryPoint:"address"},key:[]}}}}}),M=to.namespaces.root.tables;import{getRecord as oo,getStaticDataLocation as no}from"@latticexyz/store/internal";import{getKeyTuple as ao}from"@latticexyz/protocol-parser/internal";import{setStorageAt as io}from"viem/actions";function h(e){let t=e.contracts??{};if("quarryPaymaster"in t&&t.quarryPaymaster!=null&&"address"in t.quarryPaymaster)return{type:"quarry",address:t.quarryPaymaster.address};if("paymaster"in t&&t.paymaster!=null&&"address"in t.paymaster)return{type:"simple",address:t.paymaster.address}}async function et({client:e,userAddress:t}){let r=h(e.chain);return r?.type!=="quarry"?null:(await oo(e,{address:r.address,table:M.Allowance,key:{user:t},blockTag:"pending"})).allowance}async function tt({client:e,userAddress:t,allowance:r}){let o=h(e.chain);if(o?.type!=="quarry")return;let n=no(M.Allowance.tableId,ao(M.Allowance,{user:t}));await io(e.extend(()=>({mode:"anvil"})),{address:o.address,index:n,value:ro(r,{size:32})})}function ve({client:e,userAddress:t}){let r=["getAllowance",e?.uid,t];return lo(e&&t?{queryKey:r,queryFn:()=>et({client:e,userAddress:t})}:{queryKey:r,enabled:!1})}function rt(e){let{chainId:t}=s(),r=so({chainId:t});return co(ve({client:r,userAddress:e}))}import{useClient as Ps}from"wagmi";import{queryOptions as mo,useQuery as Us}from"@tanstack/react-query";import{getRecord as po}from"@latticexyz/store/internal";async function ot({client:e,userAddress:t,sessionAddress:r}){let o=h(e.chain);return o?.type!=="quarry"?null:(await po(e,{address:o.address,table:M.Spender,key:{spender:r},blockTag:"pending"})).user.toLowerCase()===t.toLowerCase()}function nt({client:e,userAddress:t,sessionAddress:r}){let o=["getSpender",e?.uid,t,r];return mo(e&&t&&r?{queryKey:o,queryFn:()=>ot({client:e,userAddress:t,sessionAddress:r})}:{queryKey:o,enabled:!1})}import{useClient as Vs}from"wagmi";import{queryOptions as yo,useQuery as _s}from"@tanstack/react-query";import{getRecord as ho}from"@latticexyz/store/internal";import{resourceToHex as uo}from"@latticexyz/common";import{parseAbi as fo}from"viem";import go from"@latticexyz/world/mud.config";var at={pollingInterval:250},D=uo({type:"system",namespace:"",name:"unlimited"}),it=go.namespaces.world.tables,st=fo(["function registerDelegation(address delegatee, bytes32 delegationControlId, bytes initCallData)"]);async function lt({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){return(await ho(e,{address:t,table:it.UserDelegationControl,key:{delegator:r,delegatee:o},blockTag:"pending"})).delegationControlId===D}function dt({client:e,worldAddress:t,userAddress:r,sessionAddress:o}){let n=["getDelegation",e?.uid,t,r,o];return yo(e&&r&&o?{queryKey:n,queryFn:()=>lt({client:e,worldAddress:t,userAddress:r,sessionAddress:o})}:{queryKey:n,enabled:!1})}import{queryOptions as Ao,useQuery as Uo,useQueryClient as No}from"@tanstack/react-query";import{useClient as Eo,useConfig as Ro}from"wagmi";import{useClient as dl}from"wagmi";import{queryOptions as Po,useQuery as ul}from"@tanstack/react-query";import{toSimpleSmartAccount as So}from"permissionless/accounts";import{isHex as xo}from"viem";import{createStore as bo}from"zustand/vanilla";import{persist as wo}from"zustand/middleware";var K=bo(wo(()=>({signers:{}}),{name:"mud:entrykit",partialize:({signers:e})=>({signers:e})}));function vo(e){e.key===K.persist.getOptions().name&&K.persist.rehydrate()}window.addEventListener("storage",vo);import{generatePrivateKey as Co,privateKeyToAccount as ko}from"viem/accounts";function ct(e){let t=e.toLowerCase(),r=K.getState().signers[t]??(()=>{let o=localStorage.getItem(`mud:appSigner:privateKey:${e.toLowerCase()}`)?.replace(/^"(.*)"$/,"$1"),n=xo(o)?o:Co();return K.setState(a=>({signers:{...a.signers,[t]:n}})),n})();return ko(r)}async function pt({client:e,userAddress:t}){let r=ct(t);return await So({client:e,owner:r})}function ee({client:e,userAddress:t}){let r=["getSessionAccount",e?.uid,t];return Po(e&&t?{queryKey:r,queryFn:()=>pt({client:e,userAddress:t}),staleTime:1/0,retry:!1}:{queryKey:r,enabled:!1})}import{getBalanceQueryOptions as To}from"wagmi/query";function Io({queryClient:e,config:t,client:r,userAddress:o,worldAddress:n}){let a=["getPrerequisites",r?.uid,o];return Ao(r&&o?{queryKey:a,async queryFn(){let i=h(r.chain),{address:l}=await e.fetchQuery(ee({client:r,userAddress:o})),[c,f,m,d]=await Promise.all([i?null:e.fetchQuery(To(t,{chainId:r.chain.id,address:l})),i?.type==="quarry"?e.fetchQuery(ve({client:r,userAddress:o})):null,i?.type==="quarry"?e.fetchQuery(nt({client:r,userAddress:o,sessionAddress:l})):null,e.fetchQuery(dt({client:r,worldAddress:n,userAddress:o,sessionAddress:l}))]),p=f==null||f>=N,g=m??!0,_=c==null||c.value>=N;return{sessionAddress:l,hasAllowance:p,isSpender:g,hasGasBalance:_,hasDelegation:d,complete:p&&g&&d}},retry:!1}:{queryKey:a,enabled:!1})}function O(e){let t=No(),r=Ro(),{chainId:o,worldAddress:n}=s(),a=Eo({chainId:o});return Uo(Io({queryClient:t,config:r,client:a,userAddress:e,worldAddress:n}),t)}import{useDisconnect as Bo}from"wagmi";import{useQuery as Mo}from"@tanstack/react-query";function te(e){let t=e?.toLowerCase();return Mo({enabled:!!t,queryKey:["ens",t],queryFn:async()=>{let r=await fetch(`https://api.ensideas.com/ens/resolve/${t}`).then(o=>o.json());return{address:r.address??void 0,name:r.name??void 0,displayName:r.displayName??void 0,avatar:r.avatar??void 0}}})}import{jsx as xe,jsxs as Oo}from"react/jsx-runtime";function H({hex:e}){return e.length<=10?xe("span",{title:e,children:e}):Oo("span",{title:e,children:[xe("span",{className:"after:select-none after:content-['\u2026']",children:e.slice(0,6)}),xe("span",{className:"tracking-[-1ch] text-transparent",children:e.slice(6,-4)}),e.slice(-4)]})}import{findCause as Ho}from"@latticexyz/common";import{createStore as zo}from"zustand/vanilla";var re=zo(()=>({lastId:0,errors:[]}));function oe({error:e,retry:t,dismiss:r}){if(!Ho(e,({name:o})=>o==="UserRejectedRequestError"))return re.setState(o=>{if(o.errors.some(a=>a.error===e))return{};let n=o.lastId+1;return{lastId:n,errors:[...o.errors,{id:n,error:e,dismiss:r?()=>{Ce(e),r()}:void 0,retry:t?async()=>{Ce(e),await t()}:void 0}]}}),()=>{Ce(e)}}function Ce(e){re.setState(t=>({errors:t.errors.filter(r=>r.error!==e)}))}import{useEffect as qo}from"react";function A(e){let{error:t,reset:r}=e;return qo(()=>{if(t)return oe({error:t,dismiss:r})},[t,r]),e}import{jsx as G,jsxs as ke}from"react/jsx-runtime";function mt({isActive:e,isExpanded:t,userAddress:r}){let{data:o}=te(r),{disconnect:n,isPending:a}=A(Bo()),{closeAccountModal:i}=x();return ke("div",{className:"flex flex-col gap-4",children:[ke("div",{className:"flex justify-between gap-4",children:[ke("div",{children:[G("div",{children:"Account"}),G("div",{className:"font-mono text-white",children:o?.name??G(H,{hex:r})})]}),G(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:a,onClick:()=>{i(),n()},children:"Sign out"})]}),t?G("p",{className:"text-sm",children:"Each of your onchain actions in this app is associated with your account."}):null]})}import{parseEther as Lo}from"viem";import{useMutation as Do,useQueryClient as Ko}from"@tanstack/react-query";import{http as Fo}from"viem";function ut(){return({chain:e})=>{if(!e)throw new Error("No chain provided to issuer transport.");let t="quarryPassIssuer"in e.rpcUrls?e.rpcUrls.quarryPassIssuer.http[0]:void 0;if(!t)throw new Error(`No \`quarryPassIssuer\` RPC URL found for chain ${e.id}.`);return Fo(t)({chain:e,retryCount:0})}}async function ft({chain:e,userAddress:t}){let r=ut()({chain:e});T("Issuing gas pass to",t),await r.request({method:"quarry_issuePass",params:["0x01",t]}),T("Claiming gas allowance for",t),await r.request({method:"quarry_claimAllowance",params:["0x01",t]})}import{useClient as Go}from"wagmi";function gt(){let e=Ko(),{chain:t}=s(),r=Go({chainId:t.id}),o=["claimGasPass",t.id];return Do({retry:0,mutationKey:o,mutationFn:async n=>{if(t.id===31337){if(!r)throw new Error("No client?");await tt({client:r,userAddress:n,allowance:Lo("1")})}else await ft({chain:t,userAddress:n});await Promise.all([e.invalidateQueries({queryKey:["getAllowance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])}})}import{twMerge as Qo}from"tailwind-merge";import{jsx as ne,jsxs as Vo}from"react/jsx-runtime";function ht({className:e,...t}){return Vo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 263 428",fill:"currentColor",className:Qo("w-[0.6em] h-[1em]",e),...t,children:[ne("path",{d:"M132 321V428L263 243L132 321Z"}),ne("path",{d:"M0 243L132 321V428",fillOpacity:"0.5"}),ne("path",{d:"M132 0V296L263 218"}),ne("path",{d:"M0 218L132 296V0L0 218Z",fillOpacity:"0.5"})]})}import{formatEther as Wo}from"viem";function yt(e){let t=Wo(e),r=Math.floor(parseFloat(t)).toString().length;return parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:Math.max(0,6-r)})}import{formatEther as _o}from"viem";import{jsx as Yo,jsxs as Xo}from"react/jsx-runtime";function ae({wei:e}){return Xo("span",{className:"inline-flex items-center gap-1",title:_o(e),children:[yt(e)," ",Yo(ht,{})]})}import{useEffect as jo}from"react";import{useEffect as $o}from"react";function z(e){let{error:t,refetch:r}=e;return $o(()=>{if(t)return oe({error:t,retry:r,dismiss:()=>{}})},[t,r]),e}import{jsx as q,jsxs as Se}from"react/jsx-runtime";function bt({isActive:e,isExpanded:t,userAddress:r}){let o=z(rt(r)),n=A(gt());return jo(()=>{let a=setTimeout(()=>{e&&n.status==="idle"&&o.isSuccess&&o.data!=null&&o.data<N&&n.mutate(r)});return()=>clearTimeout(a)},[o.data,o.isSuccess,n,e,r]),Se("div",{className:"flex flex-col gap-4",children:[Se("div",{className:"flex justify-between gap-4",children:[Se("div",{children:[q("div",{children:"Allowance"}),q("div",{className:"font-mono text-white",children:o.data!=null?q(ae,{wei:o.data}):q(S,{className:"text-sm"})})]}),q(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:o.status==="pending"||n.status==="pending",onClick:()=>n.mutate(r),children:"Top up"})]}),t?q("p",{className:"text-sm",children:"Your allowance is used to pay for onchain computation."}):null]})}import{encodeFunctionData as vt}from"viem";import{useMutation as dn,useQueryClient as cn}from"@tanstack/react-query";import{getAction as Ae}from"viem/utils";import{sendUserOperation as pn,waitForUserOperationReceipt as mn}from"viem/account-abstraction";import{waitForTransactionReceipt as un}from"viem/actions";import{useClient as fn}from"wagmi";import{resourceToHex as xt}from"@latticexyz/common";import gn from"@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";import{writeContract as an}from"viem/actions";import{getAction as sn}from"viem/utils";import{toHex as Zo}from"viem";import{signTypedData as Jo}from"viem/actions";import{callWithSignatureTypes as en}from"@latticexyz/world-module-callwithsignature/internal";import{getRecord as tn}from"@latticexyz/store/internal";import rn from"@latticexyz/world-module-callwithsignature/mud.config";import{hexToResource as on}from"@latticexyz/common";import{getAction as nn}from"viem/utils";async function wt({userClient:e,worldAddress:t,systemId:r,callData:o,nonce:n,client:a}){let i=n??(a?(await tn(a,{address:t,table:rn.tables.CallWithSignatureNonces,key:{signer:e.account.address},blockTag:"pending"})).nonce:0n),{namespace:l,name:c}=on(r);return await nn(e,Jo,"signTypedData")({account:e.account,domain:{verifyingContract:t,salt:Zo(e.chain.id,{size:32})},types:en,primaryType:"Call",message:{signer:e.account.address,systemNamespace:l,systemName:c,callData:o,nonce:i}})}import ln from"@latticexyz/world-module-callwithsignature/out/CallWithSignatureSystem.sol/CallWithSignatureSystem.abi.json";async function Pe({sessionClient:e,...t}){let r=await wt(t);return sn(e,an,"writeContract")({address:t.worldAddress,abi:ln,functionName:"callWithSignature",args:[t.userClient.account.address,t.systemId,t.callData,r]})}function Ct({userClient:e}){let t=cn(),{chainId:r,worldAddress:o}=s(),n=fn({chainId:r}),a=["setupSession",n?.chain.id,e.account.address];return dn({retry:0,mutationKey:a,mutationFn:async({sessionClient:i,registerSpender:l,registerDelegation:c})=>{if(!n)throw new Error("Client not ready.");let f=h(n.chain),m=i.account.address;if(console.log("setting up session"),e.account.type==="smart"){let d=[];if(l&&f?.type==="quarry"&&(console.log("registering spender"),d.push({to:f.address,abi:we,functionName:"registerSpender",args:[m]})),c&&(console.log("registering delegation"),d.push({to:o,abi:st,functionName:"registerDelegation",args:[m,D,"0x"]})),!d.length)return;console.log("setting up account with",d,e);let p=await Ae(e,pn,"sendUserOperation")({calls:d});console.log("got user op hash",p);let g=await Ae(e,mn,"waitForUserOperationReceipt")({hash:p});console.log("got user op receipt",g),g.success||console.error("not successful?",g)}else{let d=[];if(l&&f?.type==="quarry"){console.log("registering spender");let p=await Pe({client:n,userClient:e,sessionClient:i,worldAddress:f.address,systemId:xt({type:"system",namespace:"",name:"SpenderSystem"}),callData:vt({abi:we,functionName:"registerSpender",args:[m]})});console.log("got spender tx",p),d.push(p)}if(c){console.log("registering delegation");let p=await Pe({client:n,userClient:e,sessionClient:i,worldAddress:o,systemId:xt({type:"system",namespace:"",name:"Registration"}),callData:vt({abi:gn,functionName:"registerDelegation",args:[m,D,"0x"]})});console.log("got delegation tx",p),d.push(p)}if(!d.length)return;console.log("waiting for",d.length,"receipts");for(let p of d){let g=await Ae(n,un,"waitForTransactionReceipt")({hash:p});console.log("got tx receipt",g),g.status==="reverted"&&console.error("tx reverted?",g)}}await Promise.all([t.invalidateQueries({queryKey:["getSpender"]}),t.invalidateQueries({queryKey:["getDelegation"]}),t.invalidateQueries({queryKey:["getPrerequisites"]})])}})}import{useEffect as An}from"react";import{useClient as xn}from"wagmi";import{queryOptions as Cn,useQuery as kn,useQueryClient as Sn}from"@tanstack/react-query";import{smartAccountActions as bn}from"permissionless";import{callFrom as wn}from"@latticexyz/world/internal";import{createBundlerClient as hn}from"viem/account-abstraction";var yn=new Set([31337,17420,17069,690]);function kt(e){let t=e.chain??e.client?.chain,r=t?h(t):void 0;return hn({...at,paymaster:r?{getPaymasterData:async()=>({paymaster:r.address,paymasterData:"0x"})}:void 0,userOperation:{estimateFeesPerGas:t&&yn.has(t.id)?async()=>({maxFeePerGas:100000n,maxPriorityFeePerGas:0n}):void 0},...e})}async function St({userAddress:e,sessionAccount:t,worldAddress:r}){let o=t.client;if(!vn(o))throw new Error("Session account client had no associated chain.");let n=Y(o.chain);return kt({transport:n,client:o,account:t}).extend(bn).extend(wn({worldAddress:r,delegatorAddress:e,publicClient:o})).extend(()=>({userAddress:e}))}function vn(e){return e.chain!=null}function Pn({queryClient:e,client:t,userAddress:r,worldAddress:o}){let n=["getSessionClient",t?.uid,r,o];return Cn(r?{queryKey:n,async queryFn(){let a=await e.fetchQuery(ee({client:t,userAddress:r}));return await St({sessionAccount:a,userAddress:r,worldAddress:o})},staleTime:1/0,retry:!1}:{queryKey:n,enabled:!1})}function ie(e){let t=Sn(),{chainId:r,worldAddress:o}=s(),n=xn({chainId:r});return kn(Pn({queryClient:t,client:n,userAddress:e,worldAddress:o}))}import{jsx as Q,jsxs as Ue}from"react/jsx-runtime";function Pt({isActive:e,isExpanded:t,userClient:r,registerSpender:o,registerDelegation:n}){let a=z(ie(r.account.address)),i=A(Ct({userClient:r})),l=!n&&!n;return An(()=>{let c=setTimeout(()=>{e&&i.status==="idle"&&a.data&&!l&&i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n})});return()=>clearTimeout(c)},[l,e,n,o,a,i]),Ue("div",{className:"flex flex-col gap-4",children:[Ue("div",{className:"flex justify-between gap-4",children:[Ue("div",{children:[Q("div",{children:"Session"}),Q("div",{className:"font-mono text-white",children:l?"Enabled":"Set up"})]}),l?Q(y,{variant:"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,disabled:!0,children:"Enabled"}):Q(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e,pending:!a.data||i.status==="pending",onClick:a.data?()=>i.mutate({sessionClient:a.data,registerSpender:o,registerDelegation:n}):void 0,children:"Enable"})]}),t?Q("p",{className:"text-sm",children:"You can perform actions in this app without interruptions for approvals."}):null]})}import{useBalance as In,useWatchBlockNumber as Mn}from"wagmi";var At={"1":{bridgeUrl:"https://relay.link/bridge/ethereum"},"10":{bridgeUrl:"https://relay.link/bridge/optimism"},"56":{bridgeUrl:"https://relay.link/bridge/bnb"},"100":{bridgeUrl:"https://relay.link/bridge/gnosis"},"111":{bridgeUrl:"https://testnets.relay.link/bridge/bob"},"137":{bridgeUrl:"https://relay.link/bridge/polygon"},"185":{bridgeUrl:"https://relay.link/bridge/mint"},"288":{bridgeUrl:"https://relay.link/bridge/boba"},"324":{bridgeUrl:"https://relay.link/bridge/zksync"},"360":{bridgeUrl:"https://relay.link/bridge/shape"},"480":{bridgeUrl:"https://relay.link/bridge/world-chain"},"690":{bridgeUrl:"https://relay.link/bridge/redstone"},"919":{bridgeUrl:"https://testnets.relay.link/bridge/mode-testnet"},"1101":{bridgeUrl:"https://relay.link/bridge/polygon-zkevm"},"1135":{bridgeUrl:"https://relay.link/bridge/lisk"},"1301":{bridgeUrl:"https://testnets.relay.link/bridge/unichain-sepolia"},"1329":{bridgeUrl:"https://relay.link/bridge/sei"},"1625":{bridgeUrl:"https://relay.link/bridge/gravity"},"1868":{bridgeUrl:"https://relay.link/bridge/soneium"},"1993":{bridgeUrl:"https://testnets.relay.link/bridge/b3"},"1996":{bridgeUrl:"https://relay.link/bridge/sanko"},"2741":{bridgeUrl:"https://relay.link/bridge/abstract"},"2911":{bridgeUrl:"https://relay.link/bridge/hychain"},"4202":{bridgeUrl:"https://testnets.relay.link/bridge/lisk-sepolia"},"4321":{bridgeUrl:"https://relay.link/bridge/echos"},"5000":{bridgeUrl:"https://relay.link/bridge/mantle"},"5112":{bridgeUrl:"https://relay.link/bridge/ham"},"7560":{bridgeUrl:"https://relay.link/bridge/cyber"},"7865":{bridgeUrl:"https://relay.link/bridge/powerloom"},"7897":{bridgeUrl:"https://relay.link/bridge/arena-z"},"8333":{bridgeUrl:"https://relay.link/bridge/B3"},"8453":{bridgeUrl:"https://relay.link/bridge/base"},"9897":{bridgeUrl:"https://testnets.relay.link/bridge/arena-z-testnet"},"11011":{bridgeUrl:"https://testnets.relay.link/bridge/shape-sepolia"},"11124":{bridgeUrl:"https://testnets.relay.link/bridge/abstract"},"13746":{bridgeUrl:"https://testnets.relay.link/bridge/game7-testnet"},"17000":{bridgeUrl:"https://testnets.relay.link/bridge/holesky"},"17069":{bridgeUrl:"https://testnets.relay.link/bridge/garnet"},"17071":{bridgeUrl:"https://relay.link/bridge/onchain-points"},"33139":{bridgeUrl:"https://relay.link/bridge/apechain"},"33979":{bridgeUrl:"https://relay.link/bridge/funki"},"34443":{bridgeUrl:"https://relay.link/bridge/mode"},"42161":{bridgeUrl:"https://relay.link/bridge/arbitrum"},"42170":{bridgeUrl:"https://relay.link/bridge/arbitrum-nova"},"43114":{bridgeUrl:"https://relay.link/bridge/avalanche"},"55244":{bridgeUrl:"https://relay.link/bridge/superposition"},"57073":{bridgeUrl:"https://relay.link/bridge/ink"},"59144":{bridgeUrl:"https://relay.link/bridge/linea"},"60808":{bridgeUrl:"https://relay.link/bridge/bob"},"70700":{bridgeUrl:"https://relay.link/bridge/apex"},"70701":{bridgeUrl:"https://relay.link/bridge/boss"},"70800":{bridgeUrl:"https://testnets.relay.link/bridge/apex-testnet"},"70805":{bridgeUrl:"https://testnets.relay.link/bridge/cloud"},"80002":{bridgeUrl:"https://testnets.relay.link/bridge/amoy"},"81457":{bridgeUrl:"https://relay.link/bridge/blast"},"84532":{bridgeUrl:"https://testnets.relay.link/bridge/base-sepolia"},"167009":{bridgeUrl:"https://testnets.relay.link/bridge/hekla"},"421614":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-sepolia"},"534352":{bridgeUrl:"https://relay.link/bridge/scroll"},"543210":{bridgeUrl:"https://relay.link/bridge/zero-network"},"660279":{bridgeUrl:"https://relay.link/bridge/xai"},"911867":{bridgeUrl:"https://testnets.relay.link/bridge/odyssey"},"984122":{bridgeUrl:"https://relay.link/bridge/forma"},"1118190":{bridgeUrl:"https://testnets.relay.link/bridge/eclipse-testnet"},"3397901":{bridgeUrl:"https://testnets.relay.link/bridge/funki-testnet"},"4457845":{bridgeUrl:"https://testnets.relay.link/bridge/zero-sepolia"},"7777777":{bridgeUrl:"https://relay.link/bridge/zora"},"8253038":{bridgeUrl:"https://relay.link/bridge/bitcoin"},"9092725":{bridgeUrl:"https://testnets.relay.link/bridge/bitcoin-testnet4"},"9286185":{bridgeUrl:"https://relay.link/bridge/eclipse"},"11155111":{bridgeUrl:"https://testnets.relay.link/bridge/sepolia"},"11155420":{bridgeUrl:"https://testnets.relay.link/bridge/op-sepolia"},"666666666":{bridgeUrl:"https://relay.link/bridge/degen"},"792703809":{bridgeUrl:"https://relay.link/bridge/solana"},"888888888":{bridgeUrl:"https://relay.link/bridge/ancient8"},"999999999":{bridgeUrl:"https://testnets.relay.link/bridge/zora-sepolia"},"1380012617":{bridgeUrl:"https://relay.link/bridge/rari"},"1936682084":{bridgeUrl:"https://testnets.relay.link/bridge/solana-devnet"},"88153591557":{bridgeUrl:"https://testnets.relay.link/bridge/arbitrum-blueberry"}};import{useQueryClient as Nn,useMutation as En}from"@tanstack/react-query";import{setBalance as Rn}from"viem/actions";import{useClient as Tn}from"wagmi";function Ut(){let e=Nn(),{chainId:t}=s(),r=Tn({chainId:t});return En({retry:0,mutationKey:["setBalance",t],mutationFn:async o=>(r&&(await Rn({...r,mode:"anvil"},o),await Promise.all([e.invalidateQueries({queryKey:["balance"]}),e.invalidateQueries({queryKey:["getPrerequisites"]})])),null)})}import{Fragment as On,jsx as w,jsxs as V}from"react/jsx-runtime";function Nt({isActive:e,isExpanded:t,sessionAddress:r}){let{chain:o}=s(),n=z(In({chainId:o.id,address:r}));Mn({onBlockNumber:()=>n.refetch()});let a=A(Ut()),i=At[o.id];return V("div",{className:"flex flex-col gap-4",children:[V("div",{className:"flex justify-between gap-4",children:[V("div",{children:[w("div",{children:"Gas balance"}),w("div",{className:"font-mono text-white",children:n.data!=null?w(ae,{wei:n.data.value}):w(S,{className:"text-sm"})})]}),o.id===31337?w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending"||a.status==="pending",onClick:()=>a.mutate({address:r,value:N+(n.data?.value??0n)}),children:"Top up"}):i!=null?w("a",{href:`${i.bridgeUrl}?${new URLSearchParams({toAddress:r})}`,target:"_blank",rel:"noopener noreferrer",children:w(y,{variant:e?"primary":"tertiary",className:"flex-shrink-0 text-sm p-1 w-28",autoFocus:e||t,pending:n.status==="pending",children:"Top up"})}):null]}),t?V(On,{children:[w("p",{className:"text-sm",children:"Your session's gas balance is used to pay for onchain computation."}),V("p",{className:"text-sm",children:["Send funds to"," ",w("span",{className:"font-mono text-white",children:w(H,{hex:r})})," ","on ",o.name," to top up your session balance."]})]}):null]})}import{jsx as E}from"react/jsx-runtime";function Rt({userClient:e,initialUserAddress:t}){let{chain:r}=s(),o=h(r),n=e.account.address,{data:a,error:i}=O(n);Et(()=>{i&&console.error("Could not get prerequisites",i)},[i]);let{closeAccountModal:l}=x(),c=n!==t,f=zn(a);Et(()=>{a!=null&&(f.current==null&&(f.current=a),a.complete&&(c||!f.current.complete)&&l())},[l,c,a]);let{sessionAddress:m,hasAllowance:d,isSpender:p,hasDelegation:g,hasGasBalance:_}=a??{},U=Hn(()=>{if(!n)return[{id:"wallet",isComplete:!1,content:()=>null}];let u=[{id:"wallet",isComplete:!0,content:v=>E(mt,{...v,userAddress:n})}];return o?o.type==="quarry"&&u.push({id:"allowance",isComplete:!!d,content:v=>E(bt,{...v,userAddress:n})}):m!=null&&u.push({id:"gasBalance",isComplete:!!_,content:v=>E(Nt,{...v,sessionAddress:m})}),u.push({id:"session",isComplete:!!p&&!!g,content:v=>E(Pt,{...v,userClient:e,registerSpender:!p,registerDelegation:!g})}),u},[d,g,_,p,o,m,n,e]),[Ee]=qn(null),Wt=U.find(u=>u.content!=null&&!u.isComplete),me=U.filter(u=>u.isComplete),ue=(Ee!=null?U.find(u=>u.id===Ee):null)??Wt??(me.length<U.length?me.at(-1):null),Re=ue?U.indexOf(ue):-1;return E("div",{className:Ne("px-8 flex flex-col divide-y divide-neutral-800","animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),children:U.map((u,v)=>{let fe=u===ue,_t=fe||me.length===U.length,Yt=!u.isComplete&&Re!==-1&&v>Re;return E("div",{className:Ne("py-8 flex flex-col justify-center",fe?"flex-grow":null),children:E("div",{className:Ne("flex flex-col",Yt?"opacity-30 pointer-events-none":null),children:u.content({isActive:fe,isExpanded:_t})})},u.id)})})}import{useRef as Ln}from"react";import{jsx as Tt}from"react/jsx-runtime";function It(){let{chainId:e}=s(),t=Fn({chainId:e}),{address:r}=Bn(),o=Ln(r);return t.status!=="success"?Tt(Je,{}):Tt(Rt,{userClient:t.data,initialUserAddress:o.current})}import{DialogClose as Yn,DialogTitle as Xn}from"@radix-ui/react-dialog";import{twMerge as Dn}from"tailwind-merge";import{jsx as Kn}from"react/jsx-runtime";function Mt({className:e,children:t,...r}){return Kn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:Dn("-my-[0.125em] h-[1.25em] w-[1.25em]",e),...r,children:t})}import{jsx as Ot}from"react/jsx-runtime";function Ht(e){return Ot(Mt,{strokeWidth:"2",stroke:"currentColor",...e,children:Ot("path",{d:"M6 18L18 6M6 6L18 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{ErrorBoundary as $n}from"react-error-boundary";import{wait as Gn}from"@latticexyz/common/utils";import{useEffect as Qn}from"react";import{twMerge as se}from"tailwind-merge";import{Fragment as Vn,jsx as b,jsxs as W}from"react/jsx-runtime";function le({error:e,retry:t,dismiss:r}){return Qn(()=>{e&&console.error(e)},[e]),W("div",{className:"pointer-events-none absolute inset-0 overflow-clip",children:[b("div",{className:se("absolute inset-0 bg-blue-700/60","transition duration-300",e?"opacity-100 pointer-events-auto":"opacity-0")}),b("div",{className:se("absolute inset-0 pb-8","transition duration-300",e?"translate-y-0 opacity-100 pointer-events-auto":"-translate-y-4 opacity-0"),children:e?b(Vn,{children:W("div",{className:"w-full max-h-full bg-blue-700 text-white/80 overflow-auto",children:[W("div",{className:"space-y-6 px-8 pt-8",children:[b("div",{className:"text-white text-lg font-bold",children:"Oops! It broke :("}),b("div",{className:"font-mono text-xs whitespace-pre-wrap",children:e.message.trim()}),b("div",{className:"text-sm",children:"See the console for more info."})]}),W("div",{className:"pointer-events-none sticky bottom-0 left-0 -mt-2",children:[b("div",{className:"w-full h-12 bg-gradient-to-b from-transparent to-blue-700"}),t?b("div",{className:"bg-blue-700 text-center",children:W("button",{type:"button",className:se("pointer-events-auto group w-24 p-1 -translate-y-2 transition","bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500","text-white text-sm font-medium","aria-busy:pointer-events-none"),onClick:async o=>{o.currentTarget.ariaBusy="true",await Gn(500),t(),o.currentTarget&&(o.currentTarget.ariaBusy=null)},children:[b("span",{className:"group-aria-busy:hidden",children:"Retry"}),b("span",{className:"hidden group-aria-busy:inline",children:"Retrying\u2026"})]})}):r?b("div",{className:"bg-blue-700 text-center",children:b("button",{type:"button",className:se("pointer-events-auto group w-24 p-1 -translate-y-2 transition","bg-blue-600 hover:bg-blue-500 aria-busy:bg-blue-500","text-white text-sm font-medium","aria-busy:pointer-events-none"),onClick:r,children:"Dismiss"})}):null]})]})}):null})]})}import{jsx as zt}from"react/jsx-runtime";function qt({error:e,resetErrorBoundary:t}){return zt("div",{className:"h-64",children:zt(le,{error:e,retry:t})})}import{useStore as Wn}from"zustand";import{jsx as _n}from"react/jsx-runtime";function Bt(){let e=Wn(re,t=>t.errors.at(0));return _n(le,{error:e?.error,retry:e?.retry,dismiss:e?.dismiss})}import{jsx as C,jsxs as de}from"react/jsx-runtime";function Lt(){let{accountModalOpen:e,toggleAccountModal:t}=x();return de($e,{open:e,onOpenChange:t,children:[C(Xn,{className:"sr-only",children:"Connect with EntryKit"}),e?de("div",{className:Ft("relative py-2 ring-1","bg-neutral-900 text-neutral-400 ring-neutral-700/50","links:font-medium links:underline links:underline-offset-4","links:text-white","links:decoration-neutral-500 hover:links:decoration-orange-500"),children:[C("div",{className:"absolute top-0 right-0",children:C(Yn,{className:Ft("pointer-events-auto leading-none p-2 transition","text-white/20 hover:text-white/40"),title:"Close",children:C(Ht,{className:"m-0"})})}),de($n,{FallbackComponent:qt,children:[C(It,{}),C(Bt,{})]}),de("a",{href:"https://mud.dev",target:"_blank",rel:"noreferrer noopener",className:"group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",children:[C("span",{className:"block w-4 h-4",children:C(P,{className:"w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300"})}),C("span",{children:"Powered by MUD"})]})]}):null]})}import{jsx as Zn,jsxs as Jn}from"react/jsx-runtime";function jn({config:e,children:t}){return Jn(Ve,{config:e,children:[t,Zn(Lt,{})]})}import{useAccount as ta}from"wagmi";import{twMerge as R}from"tailwind-merge";import{twMerge as Dt}from"tailwind-merge";import{Fragment as ea,jsx as ce,jsxs as Kt}from"react/jsx-runtime";function Gt({address:e}){let{data:t}=te(e),r=j(t?.avatar);return Kt(ea,{children:[Kt("span",{className:"flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center",children:[ce("img",{src:t?.avatar&&r.isSuccess?t.avatar:void 0,className:Dt("col-start-1 row-start-1","inline-flex w-full h-full rounded-full bg-black/10 dark:bg-white/10 bg-cover bg-no-repeat bg-center","transtion duration-300",r.isSuccess?"opacity-100":"opacity-0")}),ce(P,{className:Dt("col-start-1 row-start-1 text-orange-500","transition duration-300",t&&(!t.avatar||r.isError)?"opacity-100":"opacity-0")})]}),ce("span",{className:"flex-grow",children:t?.name??ce(H,{hex:e})})]})}import{useRef as ra}from"react";import{jsx as k,jsxs as Vt}from"react/jsx-runtime";var Qt=R("w-48 p-3 inline-flex outline-none transition","border border-transparent","text-base leading-none"),oa=R("bg-neutral-100 border-neutral-300 text-black","dark:bg-neutral-800 dark:border-neutral-700 dark:text-white"),na=R("cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700");function aa(){let{openAccountModal:e,accountModalOpen:t}=x(),{status:r,address:o}=ta(),n=ra(o),a=O(o),i=r==="connected"||r==="reconnecting"&&o,l=o!==n.current,c=a.isSuccess?a.data.complete:l?!1:i,f=(()=>{if(a.isSuccess){if(!a.data.hasAllowance)return"Top up";if(!a.data.hasDelegation||!a.data.isSpender)return"Set up"}return"Sign in"})();return k(X,{mode:"child",children:c?k("button",{type:"button",className:R(Qt,oa,na),onClick:e,children:k("span",{className:"flex-grow inline-flex gap-2.5 items-center text-left font-medium",children:o?k(Gt,{address:o}):null})},"connected"):Vt("button",{type:"button",className:R(Qt,"group","items-center justify-center gap-2.5","bg-orange-500 text-white font-medium","hover:bg-orange-400","active:bg-orange-600"),"aria-busy":t,onClick:e,children:[Vt("span",{className:"pointer-events-none inline-grid place-items-center -ml-3",children:[k("span",{className:R("col-start-1 row-start-1 leading-none","scale-100 opacity-100 transition duration-300","group-aria-busy:scale-125 group-aria-busy:opacity-0"),children:k(P,{})}),k("span",{"aria-hidden":!0,className:R("col-start-1 row-start-1","scale-50 opacity-0 transition duration-300 delay-50","group-aria-busy:scale-100 group-aria-busy:opacity-100"),children:k(S,{})})]}),k("span",{className:"font-medium",children:f})]},"sign in")})}import{useConnectorClient as ia}from"wagmi";function sa(){let{chainId:e}=s(),t=ia({chainId:e});t.error&&console.error("Error retrieving user client",t.error);let r=t.data?.account.address,o=O(r),n=ie(r);return t.isSuccess?!o.isSuccess||!o.data.complete?{...o,data:void 0}:n:{...t,data:void 0}}import{connectorsForWallets as da}from"@rainbow-me/rainbowkit";import{createConfig as ca}from"wagmi";import{getDefaultWallets as la}from"@rainbow-me/rainbowkit";function pe(e){let{wallets:t}=la();return[...t]}function pa(e){let t=pe(e),r=da(t,{appName:e.appName,projectId:e.walletConnectProjectId});return ca({connectors:r,chains:e.chains,transports:e.transports,pollingInterval:e.pollingInterval})}import{connectorsForWallets as ma}from"@rainbow-me/rainbowkit";function $m({wallets:e,...t}){return ma(e??pe(t),{appName:t.appName,projectId:t.walletConnectProjectId})}export{aa as AccountButton,jn as EntryKitProvider,pa as createWagmiConfig,Xt as defineConfig,$m as getConnectors,pe as getWallets,x as useAccountModal,s as useEntryKitConfig,sa as useSessionClient};
1398
1445
  //# sourceMappingURL=internal.js.map