@powerhousedao/connect 4.1.0-dev.18 → 4.1.0-dev.19

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.
Files changed (71) hide show
  1. package/dist/assets/{AddDriveModal.Cg4TqLU6.js → AddDriveModal.atIXkYDv.js} +2 -2
  2. package/dist/assets/{AddDriveModal.Cg4TqLU6.js.map → AddDriveModal.atIXkYDv.js.map} +1 -1
  3. package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js → CookiesPolicyModal.CSr2nTWu.js} +2 -2
  4. package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js.map → CookiesPolicyModal.CSr2nTWu.js.map} +1 -1
  5. package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js → CreateDocumentModal.hCyyznzw.js} +2 -2
  6. package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js.map → CreateDocumentModal.hCyyznzw.js.map} +1 -1
  7. package/dist/assets/{DebugSettingsModal.BYAH2kLg.js → DebugSettingsModal.CgAXBUpR.js} +2 -2
  8. package/dist/assets/{DebugSettingsModal.BYAH2kLg.js.map → DebugSettingsModal.CgAXBUpR.js.map} +1 -1
  9. package/dist/assets/{DeleteDriveModal.D2WirfE-.js → DeleteDriveModal.Ba1pkRrp.js} +2 -2
  10. package/dist/assets/{DeleteDriveModal.D2WirfE-.js.map → DeleteDriveModal.Ba1pkRrp.js.map} +1 -1
  11. package/dist/assets/{DeleteItemModal.Czi0wE_6.js → DeleteItemModal.59EW1OYd.js} +2 -2
  12. package/dist/assets/{DeleteItemModal.Czi0wE_6.js.map → DeleteItemModal.59EW1OYd.js.map} +1 -1
  13. package/dist/assets/{DisclaimerModal.cBHngnNt.js → DisclaimerModal.CMaIiFx2.js} +2 -2
  14. package/dist/assets/{DisclaimerModal.cBHngnNt.js.map → DisclaimerModal.CMaIiFx2.js.map} +1 -1
  15. package/dist/assets/{DriveSettingsModal.DltE5rSu.js → DriveSettingsModal.G8tppGWb.js} +2 -2
  16. package/dist/assets/{DriveSettingsModal.DltE5rSu.js.map → DriveSettingsModal.G8tppGWb.js.map} +1 -1
  17. package/dist/assets/{SettingsModal.CZmfov8g.js → SettingsModal.CLpRdHfo.js} +2 -2
  18. package/dist/assets/{SettingsModal.CZmfov8g.js.map → SettingsModal.CLpRdHfo.js.map} +1 -1
  19. package/dist/assets/{Trans.GeuewYUs.js → Trans.CBZW5Jpo.js} +2 -2
  20. package/dist/assets/{Trans.GeuewYUs.js.map → Trans.CBZW5Jpo.js.map} +1 -1
  21. package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js → UpgradeDriveModal.ooyxdViv.js} +2 -2
  22. package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js.map → UpgradeDriveModal.ooyxdViv.js.map} +1 -1
  23. package/dist/assets/{atlas-import.Tq-cGz94.js → atlas-import.Bvmc6eu-.js} +2 -2
  24. package/dist/assets/{atlas-import.Tq-cGz94.js.map → atlas-import.Bvmc6eu-.js.map} +1 -1
  25. package/dist/assets/{content.C38XllGR.js → content.B_2fQ3XO.js} +2 -2
  26. package/dist/assets/content.B_2fQ3XO.js.map +1 -0
  27. package/dist/assets/{cookie-banner.CA1rcZYO.js → cookie-banner.CQrIFtr9.js} +2 -2
  28. package/dist/assets/{cookie-banner.CA1rcZYO.js.map → cookie-banner.CQrIFtr9.js.map} +1 -1
  29. package/dist/assets/{index.tjOyiWN1.js → index.BWsvZ6s-.js} +2 -2
  30. package/dist/assets/{index.tjOyiWN1.js.map → index.BWsvZ6s-.js.map} +1 -1
  31. package/dist/assets/{index.CupF3yfn.js → index.BbKJCE01.js} +2 -2
  32. package/dist/assets/{index.CupF3yfn.js.map → index.BbKJCE01.js.map} +1 -1
  33. package/dist/assets/{index.D4rIKeA_.js → index.BfgjawT0.js} +2 -2
  34. package/dist/assets/{index.D4rIKeA_.js.map → index.BfgjawT0.js.map} +1 -1
  35. package/dist/assets/index.DoxG1d4A.js +31 -0
  36. package/dist/assets/index.DoxG1d4A.js.map +1 -0
  37. package/dist/assets/{index.DqaPdXs7.js → index.EpI4H1M9.js} +2 -2
  38. package/dist/assets/{index.DqaPdXs7.js.map → index.EpI4H1M9.js.map} +1 -1
  39. package/dist/assets/{index.DqtagVhW.js → index.lZCfN3WH.js} +2 -2
  40. package/dist/assets/{index.DqtagVhW.js.map → index.lZCfN3WH.js.map} +1 -1
  41. package/dist/assets/{index.Beg62ngn.js → index.wkpkULnU.js} +2 -2
  42. package/dist/assets/{index.Beg62ngn.js.map → index.wkpkULnU.js.map} +1 -1
  43. package/dist/assets/{main.DTZCxlJU.js → main.C-z7q4Cv.js} +3 -3
  44. package/dist/assets/{main.DTZCxlJU.js.map → main.C-z7q4Cv.js.map} +1 -1
  45. package/dist/assets/{modal.B9PP9n2B.js → modal.BizsZF2D.js} +3 -3
  46. package/dist/assets/{modal.B9PP9n2B.js.map → modal.BizsZF2D.js.map} +1 -1
  47. package/dist/assets/{modals.BVvUIuNm.js → modals.Bh5aGAsh.js} +2 -2
  48. package/dist/assets/{modals.BVvUIuNm.js.map → modals.Bh5aGAsh.js.map} +1 -1
  49. package/dist/assets/{nodefs.DG9XiPrJ.js → nodefs.DRM5jodc.js} +2 -2
  50. package/dist/assets/{nodefs.DG9XiPrJ.js.map → nodefs.DRM5jodc.js.map} +1 -1
  51. package/dist/assets/{nodes.bF-gqvzp.js → nodes.1z5U6LVM.js} +2 -2
  52. package/dist/assets/{nodes.bF-gqvzp.js.map → nodes.1z5U6LVM.js.map} +1 -1
  53. package/dist/assets/{opfs-ahp.CQz3T4kD.js → opfs-ahp.CIwZIbNR.js} +2 -2
  54. package/dist/assets/{opfs-ahp.CQz3T4kD.js.map → opfs-ahp.CIwZIbNR.js.map} +1 -1
  55. package/dist/assets/{registerServiceWorker.DZCbK6MJ.js → registerServiceWorker.BNf1b8wD.js} +2 -2
  56. package/dist/assets/{registerServiceWorker.DZCbK6MJ.js.map → registerServiceWorker.BNf1b8wD.js.map} +1 -1
  57. package/dist/assets/{root.MjuhTv80.js → root.SqECa_nN.js} +2 -2
  58. package/dist/assets/{root.MjuhTv80.js.map → root.SqECa_nN.js.map} +1 -1
  59. package/dist/assets/{useAcceptedCookies.BwmKLuW0.js → useAcceptedCookies.BwfkDBue.js} +2 -2
  60. package/dist/assets/{useAcceptedCookies.BwmKLuW0.js.map → useAcceptedCookies.BwfkDBue.js.map} +1 -1
  61. package/dist/assets/useDefaultDocumentModelEditor.DmNu7Xm0.js +2 -0
  62. package/dist/assets/{useDefaultDocumentModelEditor.CjlFHIbF.js.map → useDefaultDocumentModelEditor.DmNu7Xm0.js.map} +1 -1
  63. package/dist/assets/{useInitSentry.DAHyudtD.js → useInitSentry.BsZC-0d6.js} +6 -6
  64. package/dist/assets/{useInitSentry.DAHyudtD.js.map → useInitSentry.BsZC-0d6.js.map} +1 -1
  65. package/dist/index.html +1 -1
  66. package/dist/vite-envs.sh +1 -1
  67. package/package.json +10 -10
  68. package/dist/assets/content.C38XllGR.js.map +0 -1
  69. package/dist/assets/index.DJX9_IxB.js +0 -31
  70. package/dist/assets/index.DJX9_IxB.js.map +0 -1
  71. package/dist/assets/useDefaultDocumentModelEditor.CjlFHIbF.js +0 -2
@@ -1,31 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.D4rIKeA_.js","./index.u4lctn3H.js","./index.CupF3yfn.js","./browser.BkwNmV2Z.js","./app-skeleton.js","./useInitSentry.DAHyudtD.js","./useAcceptedCookies.BwmKLuW0.js","./registerServiceWorker.DZCbK6MJ.js","./cookie-banner.CA1rcZYO.js","./i18next.CqOP20KE.js","./modal.B9PP9n2B.js","./Trans.GeuewYUs.js"])))=>i.map(i=>d[i]);
2
- var Bi=Object.defineProperty;var Fi=(e,t,n)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t,n)=>Fi(e,typeof t!="symbol"?t+"":t,n);import{createRoot as Vi}from"react-dom/client";import{L as dt,s as ji,l as te,P as zi,a as Hi,i as Yi,g as Oo,c as zn,b as Le,I as Wi,d as Gi,e as Ki,f as Ji,h as Nt,j as Tt,r as qi,k as Tr,D as Ot,m as Xi,n as Qi,o as Or,p as Zi,q as ea,t as Cr,u as ta,R as na,v as ra,E as oa,w as sa,_ as Te,x as ia,y as aa,z as ca,B as ua,F as da,G as la,J as Lr,K as fa,M as ha,N as Rr,O as pa,Q as ga,S as _a,T as ma,U as va,V as wa,W as ya,X as Ea,Y as ba,Z as Sa,$ as Da,a0 as Ia,a1 as Pr,a2 as Ln,a3 as Aa,a4 as Na,a5 as Ta,a6 as Oa,a7 as hn}from"./index.u4lctn3H.js";import{jsxs as kt,jsx as ye}from"react/jsx-runtime";import Gt,{useRef as Me,createElement as Ca,createContext as Hn,useReducer as Co,useEffect as ae,useDebugValue as Lo,useContext as Yn,useCallback as J,useState as He,useMemo as pt,StrictMode as La,Suspense as xr,lazy as Wn}from"react";import{g as Ra}from"./browser.BkwNmV2Z.js";import{A as Pa}from"./app-skeleton.js";const xa="@powerhousedao/connect",Ma="Powerhouse-Connect",$a="4.1.0-dev.18",Ua="Powerhouse Connect",ka="./dist/index.html",Ba="module",Fa={node:">=22.0.0"},Va=["dist","nginx.conf","nginx.sh","scripts"],ja="AGPL-3.0-only",za="acaldas@powerhouse.inc",Ha={type:"git",url:"https://github.com/powerhouse-inc/powerhouse"},Ya={url:"https://github.com/powerhouse-inc/powerhouse/issues"},Wa="https://github.com/powerhouse-inc/powerhouse#readme",Ga={"build:tsc":"tsc --build",start:"electron-forge start",package:"electron-forge package",make:"PH_CONNECT_BASE_HREF=./ electron-forge make","make:mac":"PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin","make:linux":"PH_CONNECT_BASE_HREF=./ electron-forge make -p linux","make:windows":"PH_CONNECT_BASE_HREF=./ electron-forge make -p win32","publish:electron":"electron-forge publish",prepublishOnly:"npm run build",lint:"eslint .","lint:fix":"eslint --fix .","lint:nx":"eslint --quiet --fix .",format:'prettier --write "**/*.+(js|ts|jsx|tsx|json)"',dev:"vite -c vite.renderer.config.mts","dev:nocache":"rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev",prebuild:"npm run clean && tsc --build --noEmit",build:"NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts",preview:"vite preview -c vite.renderer.config.mts",e2e:"playwright test","cy:open":"cypress open","build:service-worker":"tsc --build ./tsconfig.sw.json",clean:"rimraf dist","clean:node_modules":"rimraf node_modules","docker:build":"docker build -f ./Dockerfile --tag connect-test-dev --build-arg TAG=dev .","docker:run":"docker run -it -p 4000:4000 -v $(realpath ../../../monorepo):/monorepo -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf.template -e PH_USE_LOCAL=true -e PH_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev"},Ka={"@didtools/key-webcrypto":"^0.2.0","@electron-forge/cli":"^6.1.1","@electron-forge/maker-deb":"^6.1.1","@electron-forge/maker-rpm":"^6.1.1","@electron-forge/maker-squirrel":"^6.1.1","@electron-forge/maker-zip":"^6.1.1","@electron-forge/plugin-vite":"^6.1.1","@electron-forge/publisher-electron-release-server":"^6.2.1","@electron-forge/publisher-github":"^7.2.0","@electron-forge/shared-types":"^7.7.0","@playwright/test":"^1.41.2","@powerhousedao/builder-tools":"workspace:*","@powerhousedao/common":"workspace:*","@powerhousedao/config":"workspace:*","@powerhousedao/design-system":"workspace:*","@powerhousedao/diff-analyzer":"^0.0.0-dev.10","@powerhousedao/reactor-browser":"workspace:*","@powerhousedao/state":"workspace:*","@renown/sdk":"workspace:*","@rollup/plugin-node-resolve":"^15.2.3","@sentry/browser":"^9.1.0","@sentry/react":"^7.109.0","@sentry/vite-plugin":"^2.23.0","@tailwindcss/vite":"^4.1.4","@tanstack/react-virtual":"^3.8.1","@types/node":"^22.15.17","@types/react":"^18.2.79","@types/react-dom":"^18.2.18","@types/uuid":"^9.0.7","@types/wicg-file-system-access":"^2020.9.6","@vitejs/plugin-basic-ssl":"^2.0.0","@vitejs/plugin-react":"^4.4.1",asar:"^3.2.0","did-jwt":"^8.0.14","did-jwt-vc":"^4.0.12","did-key-creator":"^1.2.0","document-drive":"workspace:*","document-model":"workspace:*",electron:"30.0.0","electron-is-dev":"^3.0.1","electron-playwright-helpers":"^1.7.1","electron-squirrel-startup":"^1.0.0","electron-store":"^8.1.0",esbuild:"^0.24.0","fast-deep-equal":"^3.1.3",graphql:"^16.11.0","graphql-request":"^6.1.0",i18next:"^23.7.6",jotai:"^2.1.0","jotai-devtools":"^0.12.0","jotai-effect":"^1.1.6",localforage:"^1.10.0",playwright:"^1.41.2","playwright-core":"^1.41.2",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.11","react-hotkeys-hook":"^4.5.0","react-i18next":"^13.5.0","react-router-dom":"^6.11.2","tailwind-merge":"^3.0.2",tailwindcss:"^4.1.4",uint8arrays:"^5.1.0",uuid:"^9.0.1",viem:"^2.8.13",vite:"^6.3.3","vite-envs":"^4.6.0","vite-plugin-html":"^3.2.2","vite-plugin-node-polyfills":"^0.23.0","vite-plugin-svgr":"^4.3.0","vite-tsconfig-paths":"^5.1.4","xvfb-maybe":"^0.2.1"},Ja={"@esbuild/linux-x64":"^0.21.4","@rollup/rollup-linux-x64-musl":"4.14.3"},qa={name:xa,productName:Ma,version:$a,description:Ua,main:ka,type:Ba,engines:Fa,files:Va,license:ja,author:za,repository:Ha,bugs:Ya,homepage:Wa,scripts:Ga,devDependencies:Ka,optionalDependencies:Ja},Xa=qa.version,Qa=window.__VITE_ENVS.APP_VERSION||Xa,Za=window.__VITE_ENVS.PH_CONNECT_WARN_OUTDATED_APP||"false",ec=window.__VITE_ENVS.PH_CONNECT_STUDIO_MODE||"false",tc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_DRIVE||"false",nc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES||void 0,rc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES||void 0,oc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES||void 0,sc=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES||void 0,ic=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES||void 0,ac=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES||void 0,cc=window.__VITE_ENVS.PH_CONNECT_LOCAL_DRIVES_ENABLED||void 0,uc=window.__VITE_ENVS.PH_CONNECT_CLOUD_DRIVES_ENABLED||void 0,dc=window.__VITE_ENVS.PH_CONNECT_PUBLIC_DRIVES_ENABLED||void 0,lc=window.__VITE_ENVS.PH_CONNECT_SEARCH_BAR_ENABLED||void 0,fc=window.__VITE_ENVS.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS||"false",Ro=Ra()||"/",hc=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",pc=window.__VITE_ENVS.PH_CONNECT_SENTRY_ENV||"dev",gc=window.__VITE_ENVS.PH_CONNECT_SENTRY_TRACING_ENABLED||"false",_c=window.__VITE_ENVS.PH_CONNECT_GA_TRACKING_ID,mc=window.__VITE_ENVS.PH_CONNECT_CLI_VERSION||void 0,vc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${Ro.replace(/\//g,"")}:analytics`,wc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED||"false",yc=window.__VITE_ENVS.PH_CONNECT_DIFF_ANALYTICS_ENABLED||"false",Ec=window.__VITE_ENVS.PH_CONNECT_DRIVE_ANALYTICS_ENABLED||"false",bc=window.__VITE_ENVS.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED||"true",Sc=Yi(window.__VITE_ENVS.LOG_LEVEL)?window.__VITE_ENVS.LOG_LEVEL:"info";ji(Sc);te.debug(`Setting log level to ${window.__VITE_ENVS.LOG_LEVEL}.`);const gt={appVersion:Qa,studioMode:ec.toString()==="true",warnOutdatedApp:Za==="true",routerBasename:Ro,analytics:{databaseName:vc,useWorker:wc!=="true",driveAnalyticsEnabled:Ec==="true",diffProcessorEnabled:yc==="true",externalProcessorsEnabled:bc==="true"},sentry:{dsn:hc,env:pc,tracing:gc==="true"},content:{showSearchBar:lc!=="false",showDocumentModelSelectionSetting:fc!=="true"},drives:{addDriveEnabled:tc!=="true",sections:{[dt]:{enabled:cc!=="false",allowAdd:oc!=="true",allowDelete:ac!=="true"},[Hi]:{enabled:uc!=="false",allowAdd:rc!=="true",allowDelete:ic!=="true"},[zi]:{enabled:dc!=="false",allowAdd:nc!=="true",allowDelete:sc!=="true"}}},gaTrackingId:_c,phCliVersion:mc},ot={},Mr=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,$r=e=>"init"in e,pn=e=>!!e.write,Ur=e=>"v"in e||"e"in e,Ct=e=>{if("e"in e)throw e.e;if((ot?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},Bt=new WeakMap,kr=e=>{var t;return Ft(e)&&!!((t=Bt.get(e))!=null&&t[0])},Dc=e=>{const t=Bt.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))},Po=(e,t)=>{let n=Bt.get(e);if(!n){n=[!0,new Set],Bt.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)},Ft=e=>typeof(e==null?void 0:e.then)=="function",xo=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},gn=(e,t,n)=>{const r=n(e),o="v"in r,s=r.v;if(Ft(t))for(const i of r.d.keys())xo(e,t,n(i));r.v=t,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,Ft(s)&&Dc(s))},Br=(e,t,n)=>{var r;const o=new Set;for(const s of((r=n.get(e))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of t.p)o.add(s);return o},Ic=()=>{const e=new Set,t=()=>{e.forEach(n=>n())};return t.add=n=>(e.add(n),()=>{e.delete(n)}),t},_n=()=>{const e={},t=new WeakMap,n=r=>{var o,s;(o=t.get(e))==null||o.forEach(i=>i(r)),(s=t.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||e,i=(t.has(s)?t:t.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||t.delete(s)}},n},Ac=e=>(e.c||(e.c=_n()),e.m||(e.m=_n()),e.u||(e.u=_n()),e.f||(e.f=Ic()),e),Nc=Symbol(),Tc=(e=new WeakMap,t=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(w,...y)=>w.read(...y),u=(w,...y)=>w.write(...y),d=(w,y)=>{var N;return(N=w.unstable_onInit)==null?void 0:N.call(w,y)},_=(w,y)=>{var N;return(N=w.onMount)==null?void 0:N.call(w,y)},...f)=>{const w=f[0]||(v=>{if((ot?"production":void 0)!=="production"&&!v)throw new Error("Atom is undefined or null");let A=e.get(v);return A||(A={d:new Map,p:new Set,n:0},e.set(v,A),d==null||d(v,B)),A}),y=f[1]||(()=>{const v=[],A=S=>{try{S()}catch(D){v.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=t.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(v.length)throw new AggregateError(v)}),N=f[2]||(()=>{const v=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=w(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)v.push([b,I]);else if((ot?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const H of Br(b,I,t))A.has(H)||D.push(H)}for(let b=v.length-1;b>=0;--b){const[I,H]=v[b];let K=!1;for(const re of H.d.keys())if(re!==I&&r.has(re)){K=!0;break}K&&(F(I),z(I)),n.delete(I)}}),F=f[3]||(v=>{var A;const S=w(v);if(Ur(S)&&(t.has(v)&&n.get(v)!==S.n||Array.from(S.d).every(([j,x])=>F(j).n===x)))return S;S.d.clear();let D=!0;const b=()=>{t.has(v)&&(z(v),N(),y())},I=j=>{var x;if(Mr(v,j)){const $=w(j);if(!Ur($))if($r(j))gn(j,j.init,w);else throw new Error("no atom init");return Ct($)}const M=F(j);try{return Ct(M)}finally{S.d.set(j,M.n),kr(S.v)&&xo(v,S.v,M),(x=t.get(j))==null||x.t.add(v),D||b()}};let H,K;const re={get signal(){return H||(H=new AbortController),H.signal},get setSelf(){return(ot?"production":void 0)!=="production"&&!pn(v)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&pn(v)&&(K=(...j)=>{if((ot?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(v,...j)}finally{N(),y()}}),K}},pe=S.n;try{const j=c(v,I,re);return gn(v,j,w),Ft(j)&&(Po(j,()=>H==null?void 0:H.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,pe!==S.n&&n.get(v)===pe&&(n.set(v,S.n),r.add(v),(A=i.c)==null||A.call(i,v))}}),P=f[4]||(v=>{const A=[v];for(;A.length;){const S=A.pop(),D=w(S);for(const b of Br(S,D,t)){const I=w(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((v,...A)=>{let S=!0;const D=I=>Ct(F(I)),b=(I,...H)=>{var K;const re=w(I);try{if(Mr(v,I)){if(!$r(I))throw new Error("atom not writable");const pe=re.n,j=H[0];gn(I,j,w),z(I),pe!==re.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...H)}finally{S||(N(),y())}};try{return u(v,D,b,...A)}finally{S=!1}}),z=f[6]||(v=>{var A;const S=w(v),D=t.get(v);if(D&&!kr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const H=w(b);k(b).t.add(v),D.d.add(b),I!==H.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=Y(b);I==null||I.t.delete(v)}}}),k=f[7]||(v=>{var A;const S=w(v);let D=t.get(v);if(!D){F(v);for(const b of S.d.keys())k(b).t.add(v);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},t.set(v,D),(A=i.m)==null||A.call(i,v),pn(v)){const b=()=>{let I=!0;const H=(...K)=>{try{return V(v,...K)}finally{I||(N(),y())}};try{const K=_(v,H);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),Y=f[8]||(v=>{var A;const S=w(v);let D=t.get(v);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=t.get(b))==null?void 0:I.d.has(v)})){D.u&&s.add(D.u),D=void 0,t.delete(v),(A=i.u)==null||A.call(i,v);for(const b of S.d.keys()){const I=Y(b);I==null||I.t.delete(v)}return}return D}),O=[e,t,n,r,o,s,i,c,u,d,_,w,y,N,F,P,V,z,k,Y],B={get:v=>Ct(F(v)),set:(v,...A)=>{try{return V(v,...A)}finally{N(),y()}},sub:(v,A)=>{const D=k(v).l;return D.add(A),y(),()=>{D.delete(A),Y(v),y()}}};return Object.defineProperty(B,Nc,{value:O}),B},Mo=Tc,Oc=Ac,Fr=Po,Gn={};let Cc=0;function ue(e,t){const n=`atom${++Cc}`,r={toString(){return(Gn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=Lc,r.write=Rc),t&&(r.write=t),r}function Lc(e){return e(this)}function Rc(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const Pc=()=>{let e=0;const t=Oc({}),n=new WeakMap,r=new WeakMap,o=Mo(n,r,void 0,void 0,void 0,void 0,t,void 0,(c,u,d,..._)=>e?d(c,..._):c.write(u,d,..._)),s=new Set;return t.m.add(void 0,c=>{s.add(c);const u=n.get(c);u.m=r.get(c)}),t.u.add(void 0,c=>{s.delete(c);const u=n.get(c);delete u.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const u={read:()=>null,write:(d,_)=>{++e;try{for(const[f,w]of c)"init"in f&&_(f,w)}finally{--e}}};o.set(u)}})};function $o(){return(Gn?"production":void 0)!=="production"?Pc():Mo()}let tt;function xc(){return tt||(tt=$o(),(Gn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=tt),globalThis.__JOTAI_DEFAULT_STORE__!==tt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),tt}const Mc={},Uo=Hn(void 0);function ko(e){return Yn(Uo)||xc()}function $c({children:e,store:t}){const n=Me(void 0);return!t&&!n.current&&(n.current=$o()),Ca(Uo.Provider,{value:t||n.current},e)}const Rn=e=>typeof(e==null?void 0:e.then)=="function",Pn=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},Uc=Gt.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(Pn(e),e)}),mn=new WeakMap,Vr=(e,t)=>{let n=mn.get(e);return n||(n=new Promise((r,o)=>{let s=e;const i=d=>_=>{s===d&&r(_)},c=d=>_=>{s===d&&o(_)},u=()=>{try{const d=t();Rn(d)?(mn.set(d,n),s=d,d.then(i(d),c(d)),Fr(d,u)):r(d)}catch(d){o(d)}};e.then(i(e),c(e)),Fr(e,u)}),mn.set(e,n)),n};function Oe(e,t){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=ko(),[[s,i,c],u]=Co(_=>{const f=o.get(e);return Object.is(_[0],f)&&_[1]===o&&_[2]===e?_:[f,o,e]},void 0,()=>[o.get(e),o,e]);let d=s;if((i!==o||c!==e)&&(u(),d=o.get(e)),ae(()=>{const _=o.sub(e,()=>{if(r)try{const f=o.get(e);Rn(f)&&Pn(Vr(f,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(u,n);return}u()});return u(),_},[o,e,n,r]),Lo(d),Rn(d)){const _=Vr(d,()=>o.get(e));return r&&Pn(_),Uc(_)}return d}function kc(e,t){const n=ko();return J((...o)=>{if((Mc?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function $e(e,t){return[Oe(e),kc(e)]}const Bc=ue(gt);function Fc(){return $e(Bc)}const st={},jr=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,zr=e=>"init"in e,vn=e=>!!e.write,Hr=e=>"v"in e||"e"in e,Lt=e=>{if("e"in e)throw e.e;if((st?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},Vt=new WeakMap,Yr=e=>{var t;return jt(e)&&!!((t=Vt.get(e))!=null&&t[0])},Vc=e=>{const t=Vt.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))},Bo=(e,t)=>{let n=Vt.get(e);if(!n){n=[!0,new Set],Vt.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)},jt=e=>typeof(e==null?void 0:e.then)=="function",Fo=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},wn=(e,t,n)=>{const r=n(e),o="v"in r,s=r.v;if(jt(t))for(const i of r.d.keys())Fo(e,t,n(i));r.v=t,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,jt(s)&&Vc(s))},Wr=(e,t,n)=>{var r;const o=new Set;for(const s of((r=n.get(e))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of t.p)o.add(s);return o},jc=()=>{const e=new Set,t=()=>{e.forEach(n=>n())};return t.add=n=>(e.add(n),()=>{e.delete(n)}),t},yn=()=>{const e={},t=new WeakMap,n=r=>{var o,s;(o=t.get(e))==null||o.forEach(i=>i(r)),(s=t.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||e,i=(t.has(s)?t:t.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||t.delete(s)}},n},zc=e=>(e.c||(e.c=yn()),e.m||(e.m=yn()),e.u||(e.u=yn()),e.f||(e.f=jc()),e),Hc=Symbol(),Yc=(e=new WeakMap,t=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(w,...y)=>w.read(...y),u=(w,...y)=>w.write(...y),d=(w,y)=>{var N;return(N=w.unstable_onInit)==null?void 0:N.call(w,y)},_=(w,y)=>{var N;return(N=w.onMount)==null?void 0:N.call(w,y)},...f)=>{const w=f[0]||(v=>{if((st?"production":void 0)!=="production"&&!v)throw new Error("Atom is undefined or null");let A=e.get(v);return A||(A={d:new Map,p:new Set,n:0},e.set(v,A),d==null||d(v,B)),A}),y=f[1]||(()=>{const v=[],A=S=>{try{S()}catch(D){v.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=t.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(v.length)throw new AggregateError(v)}),N=f[2]||(()=>{const v=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=w(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)v.push([b,I]);else if((st?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const H of Wr(b,I,t))A.has(H)||D.push(H)}for(let b=v.length-1;b>=0;--b){const[I,H]=v[b];let K=!1;for(const re of H.d.keys())if(re!==I&&r.has(re)){K=!0;break}K&&(F(I),z(I)),n.delete(I)}}),F=f[3]||(v=>{var A;const S=w(v);if(Hr(S)&&(t.has(v)&&n.get(v)!==S.n||Array.from(S.d).every(([j,x])=>F(j).n===x)))return S;S.d.clear();let D=!0;const b=()=>{t.has(v)&&(z(v),N(),y())},I=j=>{var x;if(jr(v,j)){const $=w(j);if(!Hr($))if(zr(j))wn(j,j.init,w);else throw new Error("no atom init");return Lt($)}const M=F(j);try{return Lt(M)}finally{S.d.set(j,M.n),Yr(S.v)&&Fo(v,S.v,M),(x=t.get(j))==null||x.t.add(v),D||b()}};let H,K;const re={get signal(){return H||(H=new AbortController),H.signal},get setSelf(){return(st?"production":void 0)!=="production"&&!vn(v)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&vn(v)&&(K=(...j)=>{if((st?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(v,...j)}finally{N(),y()}}),K}},pe=S.n;try{const j=c(v,I,re);return wn(v,j,w),jt(j)&&(Bo(j,()=>H==null?void 0:H.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,pe!==S.n&&n.get(v)===pe&&(n.set(v,S.n),r.add(v),(A=i.c)==null||A.call(i,v))}}),P=f[4]||(v=>{const A=[v];for(;A.length;){const S=A.pop(),D=w(S);for(const b of Wr(S,D,t)){const I=w(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((v,...A)=>{let S=!0;const D=I=>Lt(F(I)),b=(I,...H)=>{var K;const re=w(I);try{if(jr(v,I)){if(!zr(I))throw new Error("atom not writable");const pe=re.n,j=H[0];wn(I,j,w),z(I),pe!==re.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...H)}finally{S||(N(),y())}};try{return u(v,D,b,...A)}finally{S=!1}}),z=f[6]||(v=>{var A;const S=w(v),D=t.get(v);if(D&&!Yr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const H=w(b);k(b).t.add(v),D.d.add(b),I!==H.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=Y(b);I==null||I.t.delete(v)}}}),k=f[7]||(v=>{var A;const S=w(v);let D=t.get(v);if(!D){F(v);for(const b of S.d.keys())k(b).t.add(v);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},t.set(v,D),(A=i.m)==null||A.call(i,v),vn(v)){const b=()=>{let I=!0;const H=(...K)=>{try{return V(v,...K)}finally{I||(N(),y())}};try{const K=_(v,H);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),Y=f[8]||(v=>{var A;const S=w(v);let D=t.get(v);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=t.get(b))==null?void 0:I.d.has(v)})){D.u&&s.add(D.u),D=void 0,t.delete(v),(A=i.u)==null||A.call(i,v);for(const b of S.d.keys()){const I=Y(b);I==null||I.t.delete(v)}return}return D}),O=[e,t,n,r,o,s,i,c,u,d,_,w,y,N,F,P,V,z,k,Y],B={get:v=>Lt(F(v)),set:(v,...A)=>{try{return V(v,...A)}finally{N(),y()}},sub:(v,A)=>{const D=k(v).l;return D.add(A),y(),()=>{D.delete(A),Y(v),y()}}};return Object.defineProperty(B,Hc,{value:O}),B},Vo=Yc,Wc=zc,Gr=Bo,Kn={};let Gc=0;function ne(e,t){const n=`atom${++Gc}`,r={toString(){return(Kn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=Kc,r.write=Jc),t&&(r.write=t),r}function Kc(e){return e(this)}function Jc(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const qc=()=>{let e=0;const t=Wc({}),n=new WeakMap,r=new WeakMap,o=Vo(n,r,void 0,void 0,void 0,void 0,t,void 0,(c,u,d,..._)=>e?d(c,..._):c.write(u,d,..._)),s=new Set;return t.m.add(void 0,c=>{s.add(c);const u=n.get(c);u.m=r.get(c)}),t.u.add(void 0,c=>{s.delete(c);const u=n.get(c);delete u.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const u={read:()=>null,write:(d,_)=>{++e;try{for(const[f,w]of c)"init"in f&&_(f,w)}finally{--e}}};o.set(u)}})};function Xc(){return(Kn?"production":void 0)!=="production"?qc():Vo()}let nt;function Qc(){return nt||(nt=Xc(),(Kn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=nt),globalThis.__JOTAI_DEFAULT_STORE__!==nt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),nt}const Zc={},eu=Hn(void 0);function jo(e){return Yn(eu)||Qc()}const xn=e=>typeof(e==null?void 0:e.then)=="function",Mn=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},tu=Gt.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(Mn(e),e)}),En=new WeakMap,Kr=(e,t)=>{let n=En.get(e);return n||(n=new Promise((r,o)=>{let s=e;const i=d=>_=>{s===d&&r(_)},c=d=>_=>{s===d&&o(_)},u=()=>{try{const d=t();xn(d)?(En.set(d,n),s=d,d.then(i(d),c(d)),Gr(d,u)):r(d)}catch(d){o(d)}};e.then(i(e),c(e)),Gr(e,u)}),En.set(e,n)),n};function De(e,t){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=jo(),[[s,i,c],u]=Co(_=>{const f=o.get(e);return Object.is(_[0],f)&&_[1]===o&&_[2]===e?_:[f,o,e]},void 0,()=>[o.get(e),o,e]);let d=s;if((i!==o||c!==e)&&(u(),d=o.get(e)),ae(()=>{const _=o.sub(e,()=>{if(r)try{const f=o.get(e);xn(f)&&Mn(Kr(f,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(u,n);return}u()});return u(),_},[o,e,n,r]),Lo(d),xn(d)){const _=Kr(d,()=>o.get(e));return r&&Mn(_),tu(_)}return d}function Ue(e,t){const n=jo();return J((...o)=>{if((Zc?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}var bn,Jr;function nu(){return Jr||(Jr=1,bn=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}),bn}var ru=nu();const zo=Oo(ru),lt={},ou=e=>typeof(e==null?void 0:e.then)=="function";function su(e=()=>{try{return window.localStorage}catch(n){(lt?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},t){var n;let r,o;const s={getItem:(u,d)=>{var _,f;const w=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return d}r=N}return o},y=(f=(_=e())==null?void 0:_.getItem(u))!=null?f:null;return ou(y)?y.then(w):w(y)},setItem:(u,d)=>{var _;return(_=e())==null?void 0:_.setItem(u,JSON.stringify(d,void 0))},removeItem:u=>{var d;return(d=e())==null?void 0:d.removeItem(u)}},i=u=>(d,_,f)=>u(d,w=>{let y;try{y=JSON.parse(w||"")}catch{y=f}_(y)});let c;try{c=(n=e())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(u,d)=>{if(!(e()instanceof window.Storage))return()=>{};const _=f=>{f.storageArea===e()&&f.key===u&&d(f.newValue)};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}),c&&(s.subscribe=i(c)),s}su();const Sn=new WeakMap,iu=(e,t)=>(Sn.has(t)?Sn:Sn.set(t,e())).get(t),au=e=>typeof(e==null?void 0:e.then)=="function",qr={state:"loading"};function Be(e){return iu(()=>{const t=new WeakMap,n=ne(0);(lt?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=ne((o,{setSelf:s})=>{o(n);let i;try{i=o(e)}catch(_){return{state:"hasError",error:_}}if(!au(i))return{state:"hasData",data:i};const c=i,u=t.get(c);if(u)return u;c.then(_=>{t.set(c,{state:"hasData",data:_}),s()},_=>{t.set(c,{state:"hasError",error:_}),s()});const d=t.get(c);return d||(t.set(c,qr),qr)},(o,s)=>{s(n,i=>i+1)});return(lt?"production":void 0)!=="production"&&(r.debugPrivate=!0),ne(o=>o(r))},e)}const Xr=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),cu=new WeakMap,uu=(e,t,n)=>{const r=Xr(()=>new WeakMap,cu,t);return Xr(e,r,n)},du=e=>typeof(e==null?void 0:e.then)=="function",lu=()=>{};function Fe(e,t=lu){return uu(()=>{const n=new WeakMap,r=new WeakMap,o=ne(0);(lt?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=ne((i,{setSelf:c})=>{i(o);const u=i(s),d=i(e);if(!du(d))return{v:d};if(d!==(u==null?void 0:u.p)&&d.then(_=>{r.set(d,_),c()},_=>{n.set(d,_),c()}),n.has(d))throw n.get(d);return r.has(d)?{p:d,v:r.get(d)}:u&&"v"in u?{p:d,f:t(u.v),v:u.v}:{p:d,f:t()}},(i,c)=>{c(o,u=>u+1)});return s.init=void 0,(lt?"production":void 0)!=="production"&&(s.debugPrivate=!0),ne(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...u)=>c(e,...u))},e,t)}function $n(e){if(!e)return"PUBLIC";const t="readContext"in e,{sharingType:n}=t?{sharingType:"PUBLIC"}:e.state.local,r=n==null?void 0:n.toUpperCase();return r==="PRIVATE"?"LOCAL":r}function fu(e){if(!e)return!1;const t="readContext"in e,{availableOffline:n}=t?{availableOffline:!1}:e.state.local;return n??!1}function eh(e){if(e)return{id:e.header.id,name:e.state.global.name,kind:"FOLDER",parentFolder:null}}async function hu(e,t){if(!e||!t)return[];const n=await e.getDocuments(t);return await Promise.all(n.map(o=>e.getDocument(o)))}async function pu(e){if(!e)return[];const t=await e.getDrives();return await Promise.all(t.map(r=>e.getDrive(r)))}function th(e){return e.toSorted((t,n)=>t.name.localeCompare(n.name))}function nh(e){return e?e.kind.toUpperCase()==="FILE":!1}function gu(e){return e?e.kind.toUpperCase()==="FOLDER":!1}const _e="NOT_SET";function _t(){return new Promise(()=>{})}const zt=ne(_e);zt.debugLabel="baseProcessorManagerAtom";const Ho=ne(e=>e(zt)!==_e);Ho.debugLabel="processorManagerInitializedAtom";const Kt=ne(e=>{const t=e(zt);return t===_e?_t():t},(e,t,n)=>{t(zt,n)});Kt.debugLabel="processorManagerAtom";const _u=Be(Kt);_u.debugLabel="loadableProcessorManagerAtom";const mu=Fe(Kt);mu.debugLabel="unwrappedProcessorManagerAtom";const at=ne(_e);at.debugLabel="baseDrivesAtom";const Yo=ne(e=>e(at)!==_e);Yo.debugLabel="drivesInitializedAtom";const mt=ne(async e=>{const t=e(at);return t===_e?_t():t},async(e,t)=>{const n=e(at),r=window.reactor,o=await pu(r);zo(o,n)||t(at,o)});mt.debugLabel="drivesAtom";const vu=Be(mt);vu.debugLabel="loadableDrivesAtom";const Wo=Fe(mt);Wo.debugLabel="unwrappedDrivesAtom";const Ht=ne(_e);Ht.debugLabel="selectedDriveIdAtom";const Jn=ne(e=>e(Ht)!==_e);Jn.debugLabel="driveIdInitializedAtom";const Ye=ne(async e=>{const t=e(Ht),n=await e(mt);return t===_e?_t():n==null?void 0:n.find(o=>o.header.id===t)},(e,t,n)=>{t(Ht,n),t(ft,void 0)});Ye.debugLabel="selectedDriveAtom";const Go=Be(Ye);Go.debugLabel="loadableSelectedDriveAtom";const Ko=Fe(Ye);Ko.debugLabel="unwrappedSelectedDriveAtom";const vt=ne(async e=>{const t=await e(Ye);return t==null?void 0:t.state.global.nodes});vt.debugLabel="nodesAtom";const wu=Be(vt);wu.debugLabel="loadableNodesAtom";const yu=Fe(vt);yu.debugLabel="unwrappedNodesAtom";const ft=ne(_e);ft.debugLabel="selectedNodeIdAtom";const Jo=ne(e=>e(ft)!==_e);Jo.debugLabel="selectedNodeIdInitializedAtom";const wt=ne(async e=>{const t=e(ft),n=await e(vt);return t===_e?_t():n==null?void 0:n.find(r=>r.id===t)},(e,t,n)=>{t(ft,n)});wt.debugLabel="selectedNodeAtom";const qn=ne(async e=>{const t=await e(vt),n=await e(wt),r=t==null?void 0:t.filter(gu);return r==null?void 0:r.find(o=>o.id===(n==null?void 0:n.id))});qn.debugLabel="selectedFolderAtom";const Eu=Be(qn);Eu.debugLabel="loadableSelectedFolderAtom";const bu=Fe(qn);bu.debugLabel="unwrappedSelectedFolderAtom";const ct=ne(_e);ct.debugLabel="baseDocumentsAtom";const qo=ne(e=>e(ct)!==_e);qo.debugLabel="documentsInitializedAtom";const yt=ne(e=>{const t=e(ct);return t===_e?_t():t},async(e,t,n)=>{const r=e(ct),o=window.reactor,s=await hu(o,n);zo(s,r)||t(ct,s)});yt.debugLabel="documentsAtom";const Su=Be(yt);Su.debugLabel="loadableDocumentsAtom";const Du=Fe(yt);Du.debugLabel="unwrappedDocumentsAtom";const Xn=ne(async e=>{const t=await e(yt),n=await e(wt);return t==null?void 0:t.find(r=>r.header.id===(n==null?void 0:n.id))});Xn.debugLabel="selectedDocumentAtom";const Iu=Be(Xn);Iu.debugLabel="loadableSelectedDocumentAtom";const Au=Fe(Xn);Au.debugLabel="unwrappedSelectedDocumentAtom";let Mt;typeof window<"u"?window.btoa?Mt=function(e){return btoa(unescape(encodeURIComponent(e)))}:Mt=function(e){const t=unescape(encodeURIComponent(e+""));let n="";for(let r,o,s=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(s|0)||(i="=",s%1);n+=i.charAt(63&r>>8-s%1*8)){if(o=t.charCodeAt(s+=3/4),o>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return n}:Mt=function(e){return Buffer.from(e).toString("base64")};function Z(e,t){let n=Qr(e,t);return(t&&t.fallback!==void 0?t.fallback:Z.defaults.fallback)===!0&&n===""&&(n=Qr(Mt(e),t)),n}const Xo={bg:{Й:"Y",й:"y",X:"H",x:"h",Ц:"Ts",ц:"ts",Щ:"Sht",щ:"sht",Ъ:"A",ъ:"a",Ь:"Y",ь:"y"},de:{Ä:"AE",ä:"ae",Ö:"OE",ö:"oe",Ü:"UE",ü:"ue"},sr:{đ:"dj",Đ:"DJ"},uk:{И:"Y",и:"y",Й:"Y",й:"y",Ц:"Ts",ц:"ts",Х:"Kh",х:"kh",Щ:"Shch",щ:"shch",Г:"H",г:"h"}};let Qn={};function Qr(e,t){if(typeof e!="string")throw new Error("slug() requires a string argument, received "+typeof e);if(!e.isWellFormed())throw new Error("slug() received a malformed string with lone surrogates");typeof t=="string"&&(t={replacement:t}),t=t?Object.assign({},t):{},t.mode=t.mode||Z.defaults.mode;const n=Z.defaults.modes[t.mode],r=["replacement","multicharmap","charmap","remove","lower","trim"];for(let u,d=0,_=r.length;d<_;d++)u=r[d],t[u]=u in t?t[u]:n[u];const o=Xo[t.locale]||Qn;let s=[];for(const u in t.multicharmap){if(!Object.prototype.hasOwnProperty.call(t.multicharmap,u))continue;const d=u.length;s.indexOf(d)===-1&&s.push(d)}s=s.sort(function(u,d){return d-u});const i=t.mode==="rfc3986"?/[^\w\s\-.~]/:/[^A-Za-z0-9\s]/;let c="";for(let u,d=0,_=e.length;d<_;d++){u=e[d];let f=!1;for(let w=0;w<s.length;w++){const y=s[w],N=e.substr(d,y);if(t.multicharmap[N]){d+=y-1,u=t.multicharmap[N],f=!0;break}}f||(o[u]?u=o[u]:t.charmap[u]?u=t.charmap[u].replace(t.replacement," "):u.includes(t.replacement)?u=u.replace(t.replacement," "):u=u.replace(i,"")),c+=u}return t.remove&&(c=c.replace(t.remove,"")),t.trim&&(c=c.trim()),c=c.replace(/\s+/g,t.replacement),t.lower&&(c=c.toLowerCase()),c}const Qo={फ़:"Fi",ग़:"Ghi",ख़:"Khi",क़:"Qi",ड़:"ugDha",ढ़:"ugDhha",य़:"Yi",ज़:"Za",בִי:"i",בֵ:"e",בֵי:"e",בֶ:"e",בַ:"a",בָ:"a",בֹ:"o",וֹ:"o",בֻ:"u",וּ:"u",בּ:"b",כּ:"k",ךּ:"k",פּ:"p",שׁ:"sh",שׂ:"s",בְ:"e",חֱ:"e",חֲ:"a",חֳ:"o",בִ:"i"},Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Æ:"AE",Ç:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ő:"O",Ø:"O",Ō:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ű:"U",Ý:"Y",Þ:"TH",ß:"ss",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",æ:"ae",ç:"c",è:"e",é:"e",ê:"e",ë:"e",ì:"i",í:"i",î:"i",ï:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ő:"o",ø:"o",ō:"o",Œ:"OE",œ:"oe",ù:"u",ú:"u",û:"u",ü:"u",ű:"u",ý:"y",þ:"th",ÿ:"y","ẞ":"SS",α:"a",β:"b",γ:"g",δ:"d",ε:"e",ζ:"z",η:"h",θ:"th",ι:"i",κ:"k",λ:"l",μ:"m",ν:"n",ξ:"3",ο:"o",π:"p",ρ:"r",σ:"s",τ:"t",υ:"y",φ:"f",χ:"x",ψ:"ps",ω:"w",ά:"a",έ:"e",ί:"i",ό:"o",ύ:"y",ή:"h",ώ:"w",ς:"s",ϊ:"i",ΰ:"y",ϋ:"y",ΐ:"i",Α:"A",Β:"B",Γ:"G",Δ:"D",Ε:"E",Ζ:"Z",Η:"H",Θ:"Th",Ι:"I",Κ:"K",Λ:"L",Μ:"M",Ν:"N",Ξ:"3",Ο:"O",Π:"P",Ρ:"R",Σ:"S",Τ:"T",Υ:"Y",Φ:"F",Χ:"X",Ψ:"PS",Ω:"W",Ά:"A",Έ:"E",Ί:"I",Ό:"O",Ύ:"Y",Ή:"H",Ώ:"W",Ϊ:"I",Ϋ:"Y",ş:"s",Ş:"S",ı:"i",İ:"I",ğ:"g",Ğ:"G",а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"yo",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"u",ы:"y",ь:"",э:"e",ю:"yu",я:"ya",А:"A",Б:"B",В:"V",Г:"G",Д:"D",Е:"E",Ё:"Yo",Ж:"Zh",З:"Z",И:"I",Й:"J",К:"K",Л:"L",М:"M",Н:"N",О:"O",П:"P",Р:"R",С:"S",Т:"T",У:"U",Ф:"F",Х:"H",Ц:"C",Ч:"Ch",Ш:"Sh",Щ:"Sh",Ъ:"U",Ы:"Y",Ь:"",Э:"E",Ю:"Yu",Я:"Ya",Є:"Ye",І:"I",Ї:"Yi",Ґ:"G",є:"ye",і:"i",ї:"yi",ґ:"g",č:"c",ď:"d",ě:"e",ň:"n",ř:"r",š:"s",ť:"t",ů:"u",ž:"z",Č:"C",Ď:"D",Ě:"E",Ň:"N",Ř:"R",Š:"S",Ť:"T",Ů:"U",Ž:"Z",ľ:"l",ĺ:"l",ŕ:"r",Ľ:"L",Ĺ:"L",Ŕ:"R",ą:"a",ć:"c",ę:"e",ł:"l",ń:"n",ś:"s",ź:"z",ż:"z",Ą:"A",Ć:"C",Ę:"E",Ł:"L",Ń:"N",Ś:"S",Ź:"Z",Ż:"Z",ā:"a",ē:"e",ģ:"g",ī:"i",ķ:"k",ļ:"l",ņ:"n",ū:"u",Ā:"A",Ē:"E",Ģ:"G",Ī:"I",Ķ:"K",Ļ:"L",Ņ:"N",Ū:"U",أ:"a",إ:"i",ب:"b",ت:"t",ث:"th",ج:"g",ح:"h",خ:"kh",د:"d",ذ:"th",ر:"r",ز:"z",س:"s",ش:"sh",ص:"s",ض:"d",ط:"t",ظ:"th",ع:"aa",غ:"gh",ف:"f",ق:"k",ك:"k",ل:"l",م:"m",ن:"n",ه:"h",و:"o",ي:"y",ء:"aa",ة:"a",آ:"a",ا:"a",پ:"p",ژ:"zh",گ:"g",چ:"ch",ک:"k",ی:"i",ė:"e",į:"i",ų:"u",Ė:"E",Į:"I",Ų:"U",ț:"t",Ț:"T",ţ:"t",Ţ:"T",ș:"s",Ș:"S",ă:"a",Ă:"A",Ạ:"A",Ả:"A",Ầ:"A",Ấ:"A",Ậ:"A",Ẩ:"A",Ẫ:"A",Ằ:"A",Ắ:"A",Ặ:"A",Ẳ:"A",Ẵ:"A",Ẹ:"E",Ẻ:"E",Ẽ:"E",Ề:"E",Ế:"E",Ệ:"E",Ể:"E",Ễ:"E",Ị:"I",Ỉ:"I",Ĩ:"I",Ọ:"O",Ỏ:"O",Ồ:"O",Ố:"O",Ộ:"O",Ổ:"O",Ỗ:"O",Ơ:"O",Ờ:"O",Ớ:"O",Ợ:"O",Ở:"O",Ỡ:"O",Ụ:"U",Ủ:"U",Ũ:"U",Ư:"U",Ừ:"U",Ứ:"U",Ự:"U",Ử:"U",Ữ:"U",Ỳ:"Y",Ỵ:"Y",Ỷ:"Y",Ỹ:"Y",Đ:"D",ạ:"a",ả:"a",ầ:"a",ấ:"a",ậ:"a",ẩ:"a",ẫ:"a",ằ:"a",ắ:"a",ặ:"a",ẳ:"a",ẵ:"a",ẹ:"e",ẻ:"e",ẽ:"e",ề:"e",ế:"e",ệ:"e",ể:"e",ễ:"e",ị:"i",ỉ:"i",ĩ:"i",ọ:"o",ỏ:"o",ồ:"o",ố:"o",ộ:"o",ổ:"o",ỗ:"o",ơ:"o",ờ:"o",ớ:"o",ợ:"o",ở:"o",ỡ:"o",ụ:"u",ủ:"u",ũ:"u",ư:"u",ừ:"u",ứ:"u",ự:"u",ử:"u",ữ:"u",ỳ:"y",ỵ:"y",ỷ:"y",ỹ:"y",đ:"d",Ә:"AE",ә:"ae",Ғ:"GH",ғ:"gh",Қ:"KH",қ:"kh",Ң:"NG",ң:"ng",Ү:"UE",ү:"ue",Ұ:"U",ұ:"u",Һ:"H",һ:"h",Ө:"OE",ө:"oe",ђ:"dj",ј:"j",љ:"lj",њ:"nj",ћ:"c",џ:"dz",Ђ:"Dj",Ј:"j",Љ:"Lj",Њ:"Nj",Ћ:"C",Џ:"Dz",nj:"nj",lj:"lj",Nj:"NJ",Lj:"LJ",अ:"a",आ:"aa",ए:"e",ई:"ii",ऍ:"ei",ऎ:"ae",ऐ:"ai",इ:"i",ओ:"o",ऑ:"oi",ऒ:"oii",ऊ:"uu",औ:"ou",उ:"u",ब:"B",भ:"Bha",च:"Ca",छ:"Chha",ड:"Da",ढ:"Dha",फ:"Fa",ग:"Ga",घ:"Gha",ग़:"Ghi",ह:"Ha",ज:"Ja",झ:"Jha",क:"Ka",ख:"Kha",ख़:"Khi",ल:"L",ळ:"Li",ऌ:"Li",ऴ:"Lii",ॡ:"Lii",म:"Ma",न:"Na",ङ:"Na",ञ:"Nia",ण:"Nae",ऩ:"Ni",ॐ:"oms",प:"Pa",क़:"Qi",र:"Ra",ऋ:"Ri",ॠ:"Ri",ऱ:"Ri",स:"Sa",श:"Sha",ष:"Shha",ट:"Ta",त:"Ta",ठ:"Tha",द:"Tha",थ:"Tha",ध:"Thha",ड़:"ugDha",ढ़:"ugDhha",व:"Va",य:"Ya",य़:"Yi",ज़:"Za",ə:"e",Ə:"E",ა:"a",ბ:"b",გ:"g",დ:"d",ე:"e",ვ:"v",ზ:"z",თ:"t",ი:"i",კ:"k",ლ:"l",მ:"m",ნ:"n",ო:"o",პ:"p",ჟ:"zh",რ:"r",ს:"s",ტ:"t",უ:"u",ფ:"p",ქ:"k",ღ:"gh",ყ:"q",შ:"sh",ჩ:"ch",ც:"ts",ძ:"dz",წ:"ts",ჭ:"ch",ხ:"kh",ჯ:"j",ჰ:"h",ב:"v",גּ:"g",ג:"g",ד:"d",דּ:"d",ה:"h",ו:"v",ז:"z",ח:"h",ט:"t",י:"y",כ:"kh",ך:"kh",ל:"l",מ:"m",ם:"m",נ:"n",ן:"n",ס:"s",פ:"f",ף:"f",ץ:"ts",צ:"ts",ק:"k",ר:"r",תּ:"t",ת:"t"};Z.charmap=Object.assign({},Zo);Z.multicharmap=Object.assign({},Qo);Z.defaults={charmap:Z.charmap,mode:"pretty",modes:{rfc3986:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0},pretty:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0}},multicharmap:Z.multicharmap,fallback:!0};Z.reset=function(){Z.defaults.modes.rfc3986.charmap=Z.defaults.modes.pretty.charmap=Z.charmap=Z.defaults.charmap=Object.assign({},Zo),Z.defaults.modes.rfc3986.multicharmap=Z.defaults.modes.pretty.multicharmap=Z.multicharmap=Z.defaults.multicharmap=Object.assign({},Qo),Qn=""};Z.extend=function(e){const t=Object.keys(e),n={},r={};for(let o=0;o<t.length;o++)t[o].length>1?n[t[o]]=e[t[o]]:r[t[o]]=e[t[o]];Object.assign(Z.charmap,r),Object.assign(Z.multicharmap,n)};Z.setLocale=function(e){Qn=Xo[e]||{}};function Nu(e){return e?`/d/${Z(e.header.slug)}`:""}function Tu(e){if(!e)return"";const t=e.name;return Z(t?`${t}-${e.id}`:e.id)}function Ou(e){const t=/^\/d\/[^/]+\/([^/]+)$/.exec(e);return t?t[1]:void 0}function Cu(e){if(!e)return;const n=/\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/.exec(e);return n?n[0]:void 0}function Lu(e){const t=Ou(e),n=Cu(t);return n||t}function es(e){const t=/^\/d\/([^/]+)/.exec(e);return t?t[1]:null}function Ru(e){return e.replaceAll(/\s/g,"-")}function Pu(e){const t=new CustomEvent("ph:setDrive",{detail:{driveId:e}});window.dispatchEvent(t)}function xu(e,t){const n=e.detail.driveId;if(t(n),typeof window>"u")return;if(!n){window.history.pushState(null,"","/");return}const r=window.reactor;r&&r.getDrive(n).then(o=>{const s=Nu(o);window.history.pushState(null,"",s)}).catch(o=>te.error(o))}function rh(e){const t=new CustomEvent("ph:setNode",{detail:{nodeId:e}});window.dispatchEvent(t)}function Mu(e,t){const n=e.detail.nodeId;if(t(n),typeof window>"u")return;const r=window.reactor;if(!r)return;const o=es(window.location.pathname);if(o){if(!n){window.history.pushState(null,"",`/d/${o}`);return}r.getDriveBySlug(o).then(s=>{const c=s.state.global.nodes.find(d=>d.id===n),u=Tu(c);window.history.pushState(null,"",`/d/${o}/${u}`)}).catch(s=>te.error(s))}}function Et(){return De(Wo)}function Jt(e){const t=Et();if(e)return t==null?void 0:t.find(n=>n.header.id===e)}function ts(){return De(Ko)}function oh(){return De(Go)}function sh(){return J(e=>{Pu(e)},[])}function ns(){const e=ts();return e==null?void 0:e.header.id}function $u(e){const t=Jt(e),n=Uu(e);if(t){if("remoteUrl"in t.state.global){const r=t.state.global.remoteUrl;if(typeof r=="string")return r}return n}}function rs(e){const t=Jt(e);return t==null?void 0:t.state.local.triggers.find(r=>r.type==="PullResponder")}function Uu(e){var n;const t=rs(e);return(n=t==null?void 0:t.data)==null?void 0:n.url}function ih(e){const t=$u(e),n=rs(e);return t!==void 0||n!==void 0}function ah(e){const t=Jt(e);if(t)return $n(t)}function ch(e){const t=Jt(e);return t?fu(t):!1}function We(){return window.reactor}const Zn={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},os={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},ss=new globalThis.TextEncoder;function ku(e,t){const n=Zn[t];let r=os[t];for(let o=0;o<e.length;o++)r^=BigInt(e[o]),r=BigInt.asUintN(t,r*n);return r}function Bu(e,t,n){if(n.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");const r=Zn[t];let o=os[t],s=e;for(;s.length>0;){const i=ss.encodeInto(s,n);s=s.slice(i.read);for(let c=0;c<i.written;c++)o^=BigInt(n[c]),o=BigInt.asUintN(t,o*r)}return o}function Fu(e,{size:t=32,utf8Buffer:n}={}){if(!Zn[t])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof e=="string"){if(n)return Bu(e,t,n);e=ss.encode(e)}return ku(e,t)}const Vu=[32,64,128,256,512,1024],ju=Math.log2(26);function is(e,t=10,n="fnv1a"){if(n==="fnv1a"){const r=Math.ceil(t*ju),o=Vu.find(i=>i&&i>=r)??1024,s=Fu(e,{size:o});return zu(s,t)}else throw new Error(`Unsupported hashing algorithm: ${n}`)}function zu(e,t=10){const n="abcdefghijklmnopqrstuvwxyz";let r="";for(;e>0n&&r.length<t;)r=n[Number(e%26n)]+r,e/=26n;return r.padStart(t,"a")}function uh(e,t){const n=e;return n.createNamespace=(r,o)=>Hu(e,r,o??t),n.queryNamespace=(r,o)=>Yu(e,r,o??t),n}async function Hu(e,t,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(t):t;return await e.schema.createSchema(o).ifNotExists().execute(),e.withSchema(o)}function Yu(e,t,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(t):t,s=e.withSchema(o);return er(s)}function er(e){return{selectFrom:e.selectFrom.bind(e),selectNoFrom:e.selectNoFrom.bind(e),with:e.with.bind(e),withRecursive:e.withRecursive.bind(e),withSchema:t=>er(e.withSchema(t))}}function Zr(e){return as.is(e)}const eo=Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");var To;To=eo;class as{constructor(t,n,r){fe(this,"_namespace");fe(this,"_filter");fe(this,"relationalDb");this._namespace=t,this._filter=n,this.relationalDb=r}static is(t){var r;let n=Object.getPrototypeOf(t);for(;n;){if((r=n.constructor)!=null&&r[eo])return!0;n=Object.getPrototypeOf(n)}return!1}static getNamespace(t){return`${this.name}_${t.replaceAll("-","_")}`}static query(t,n){return n.queryNamespace(this.getNamespace(t))}get filter(){return this._filter}get namespace(){return this._namespace}get query(){return er(this.relationalDb)}}fe(as,To,!0);class Wu{constructor(t,n){fe(this,"listeners");fe(this,"drive");fe(this,"logger",zn(["document-drive","processor-manager"]));fe(this,"processorsByDrive",new Map);fe(this,"idToFactory",new Map);fe(this,"identifierToListeners",new Map);this.listeners=t,this.drive=n}async registerFactory(t,n){this.logger.debug(`Registering factory '${t}'.`),this.idToFactory.set(t,n);const r=await this.drive.getDrives();for(const o of r)await this.createProcessors(o,t,n)}async unregisterFactory(t){var r;const n=this.identifierToListeners.get(t)??[];for(const o of n)await this.listeners.removeListener(o.driveId,o.listenerId).catch(this.logger.error),(r=o.transmitter)!=null&&r.disconnect&&await o.transmitter.disconnect();this.identifierToListeners.set(t,[])}async registerDrive(t){this.logger.debug(`Registering drive '${t}'.`);for(const[n,r]of this.idToFactory)await this.createProcessors(t,n,r)}async createProcessors(t,n,r){let o=this.identifierToListeners.get(n);o||(o=[],this.identifierToListeners.set(n,o));let s=this.processorsByDrive.get(t);s||(s=[],this.processorsByDrive.set(t,s));let i=[];try{i=await r(t)}catch(c){this.logger.error(`Error creating processors for drive ${t}:`,c);return}for(const{filter:c,processor:u}of i){const d=Zr(u);if(d&&s.some(w=>Zr(w.processor)&&w.processor.namespace===u.namespace)){this.logger.warn(`Processor with namespace '${u.namespace}' already registered for drive '${t}'.`);continue}d&&await u.initAndUpgrade();const _=Le(),f={driveId:t,listenerId:_,block:!1,system:!1,filter:c,callInfo:void 0,transmitter:new Wi(this.drive,u)};await this.listeners.setListener(t,f),o.push(f),s.push({filter:c,processor:u})}}}function Gu(){const e=We(),t=De(Ho),n=Ue(Kt);ae(()=>{if(t||!e)return;const r=new Wu(e.listeners,e);e.on("driveAdded",async o=>{await r.registerDrive(o.header.id)}),n(r)},[t,e,n])}function cs(){return Ue(yt)}function Ku(){const e=ns(),t=cs();return J(()=>{t(e).catch(n=>te.error(n))},[t,e])}function us(){return Ue(mt)}function Ju(){const e=us();return J(()=>{e().catch(t=>te.error(t))},[e])}function qu(e){const[t,n]=He(!!window.reactor),r=De(Yo),o=De(Jn),s=ns(),i=De(qo),c=us(),u=cs();ae(()=>{if(t)return;async function d(){const _=await(e==null?void 0:e());window.reactor=_,n(!0)}d().catch(te.error)},[e,t]),ae(()=>{if(!t||r)return;async function d(){await c()}d().catch(te.error)},[t,c,r]),ae(()=>{if(!t||!o||i)return;async function d(){await u(s)}d().catch(te.error)},[t,i,o,s,u])}function Xu(){const e=Ue(Ye),t=Ue(wt),n=J(o=>{xu(o,e)},[e]),r=J(o=>{Mu(o,t)},[t]);ae(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setDrive",n),()=>{window.removeEventListener("ph:setDrive",n)}},[n]),ae(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setNode",r),()=>{window.removeEventListener("ph:setNode",r)}},[r])}function Qu(){const e=Ju(),t=Ku(),n=We();ae(()=>{if(!n)return;const r=[n.on("syncStatus",(...o)=>{te.verbose("syncStatus",...o),e(),t()}),n.on("strandUpdate",(...o)=>{te.verbose("strandUpdate",...o),e(),t()}),n.on("defaultRemoteDrive",(...o)=>{te.verbose("defaultRemoteDrive",...o),e(),t()}),n.on("clientStrandsError",(...o)=>{te.verbose("clientStrandsError",...o),e(),t()}),n.on("driveAdded",(...o)=>{te.verbose("driveAdded",...o),e(),t()}),n.on("driveDeleted",(...o)=>{te.verbose("driveDeleted",...o),e(),t()}),n.on("documentModelModules",(...o)=>{te.verbose("documentModelModules",...o),e(),t()}),n.on("documentOperationsAdded",(...o)=>{te.verbose("documentOperationsAdded",...o),e(),t()}),n.on("driveOperationsAdded",(...o)=>{console.log("driveOperationsAdded",...o),te.verbose("driveOperationsAdded",...o),e(),t()}),n.on("operationsAdded",(...o)=>{console.log("operationsAdded",...o),te.verbose("operationsAdded",...o),e(),t()})];return()=>{r.forEach(o=>o())}},[e,t,n])}function Zu(){const e=Ue(Ye),t=Ue(wt),n=De(Jn),r=De(Jo),o=We();ae(()=>{async function s(){if(typeof window>"u"||!o||n)return;const i=window.location.pathname,c=await ed(o,i,e);c&&(r||td(c,i,t))}s().catch(te.error)},[o,n,r,e,t])}async function ed(e,t,n){const r=es(t),o=await e.getDrives(),i=(await Promise.all(o.map(c=>e.getDrive(c)))).find(c=>c.header.slug===r||c.header.id===r);return n(i==null?void 0:i.header.id),i}function td(e,t,n){const r=Lu(t),o=e==null?void 0:e.state.global.nodes,s=o==null?void 0:o.find(i=>i.id===r||Ru(i.name)===r);n(s==null?void 0:s.id)}function nd(e){qu(e),Qu(),Xu(),Gu(),Zu()}const it=zn(["utils/document-model",Math.floor(Math.random()*999).toString()]),rd=parseInt(window.__VITE_ENVS.FILE_UPLOAD_OPERATIONS_CHUNK_SIZE||"50");function dh(e,t,n=it.error){const[r,o]=He(t),[s,i]=He(),c=d=>{i(d),n(d)};return ae(()=>{o(t),i(void 0)},[t]),[r,(d,_,f)=>{i(void 0),o(w=>{if(!e||!w)return w;try{const y=e(w,d),N=d.scope??"global",F=y.operations[N],P=F[F.length-1];if(P.error){const V=new Error(P.error);c(V),f==null||f(V)}return _==null||_(P,{prevState:{...w},newState:{...y}}),y}catch(y){return c(y),f==null||f(y),w}})},s]}async function od(e,t,n,r){const o=(r==null?void 0:r.operationsLimit)||rd;it.verbose(`uploadDocumentOperations(documentId:${e}, ops: ${Object.keys(t.operations).join(",")}, limit:${o})`);for(const s of Object.values(t.operations))for(let i=0;i<s.length;i+=o){it.verbose(`uploadDocumentOperations:for(i:${i}, ops:${s.length}, limit:${o}): START`);const c=s.slice(i,i+o),u=c.at(-1);if(!u)break;const{scope:d}=u;await n(e,c),it.verbose(`uploadDocumentOperations:for:waitForUpdate(${e}:${d} rev ${u.index}): NEXT`)}it.verbose(`uploadDocumentOperations:for:waitForUpdate(${e}): END`)}const sd=async e=>{Ji(e).generateAsync({type:"blob"}).then(n=>{const r=window.document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(n),r.download=`${e.header.name||"Untitled"}.zip`,window.document.body.appendChild(r),r.click(),window.document.body.removeChild(r)}).catch(te.error)};async function lh(e,t){var o,s;const n=t(e.header.documentType);if(!n)throw new Error(`Document model not supported: ${e.header.documentType}`);const r=n.documentModel.extension;if(!window.showSaveFilePicker){await sd(e);return}try{const i=await window.showSaveFilePicker({suggestedName:`${e.name||((o=e.state.global)==null?void 0:o.name)||"Untitled"}.${r?`${r}.`:""}zip`});await Ki(e,i);const c=(await i.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(e,c)),c}catch(i){if(!(i instanceof DOMException&&i.name==="AbortError"))throw i}}async function id(e,t){const n=await Gi(e,o=>o,{checkHashes:!0}),r=t(n.header.documentType);if(!r)throw new Error(`Document "${n.header.documentType}" is not supported`);return r.utils.loadFromInput(e)}function to(e){let t=!1;const n=Object.entries(e.operations).reduce((r,[o,s])=>{const i=o;for(const c of s){const u=ad(c);r[i].push(u),u!==c&&(t=!0)}return r},{global:[],local:[]});return t?{...e,operations:n}:e}function ad(e){var s,i,c;let t=!1,n={...e};const r=(s=e.context)==null?void 0:s.signer,o=(c=(i=e.action)==null?void 0:i.context)==null?void 0:c.signer;if(r){if("signature"in r){const u=r.signature;n={...n,context:{...n.context,signer:{user:r.user,app:r.app,signatures:u!=null&&u.length?[u]:[]}}},t=!0}else if(r.signatures){const u=r.signatures.filter(d=>d&&d.length>0);u.length!==r.signatures.length&&(n={...n,context:{...n.context,signer:{...r,signatures:u}}},t=!0)}}if(o){if("signature"in o){const u=o.signature,d={...n.action.context,signer:{user:o.user,app:o.app,signatures:u!=null&&u.length?[u]:[]}};n={...n,action:{...n.action,context:d},context:d},t=!0}else if(o.signatures){const u=o.signatures.filter(d=>d&&d.length>0);if(u.length!==o.signatures.length){const d={...n.action.context,signer:{...o,signatures:u}};n={...n,action:{...n.action,context:d},context:d},t=!0}}}return t?n:e}var Dn={exports:{}};/*!
3
- localForage -- Offline Storage, Improved
4
- Version 1.10.0
5
- https://localforage.github.io/localForage
6
- (c) 2013-2017 Mozilla, Apache License 2.0
7
- */var no;function cd(){return no||(no=1,function(e,t){(function(n){e.exports=n()})(function(){return function n(r,o,s){function i(d,_){if(!o[d]){if(!r[d]){var f=typeof Nt=="function"&&Nt;if(!_&&f)return f(d,!0);if(c)return c(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var y=o[d]={exports:{}};r[d][0].call(y.exports,function(N){var F=r[d][1][N];return i(F||N)},y,y.exports,n,r,o,s)}return o[d].exports}for(var c=typeof Nt=="function"&&Nt,u=0;u<s.length;u++)i(s[u]);return i}({1:[function(n,r,o){(function(s){var i=s.MutationObserver||s.WebKitMutationObserver,c;if(i){var u=0,d=new i(N),_=s.document.createTextNode("");d.observe(_,{characterData:!0}),c=function(){_.data=u=++u%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=N,c=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var P=s.document.createElement("script");P.onreadystatechange=function(){N(),P.onreadystatechange=null,P.parentNode.removeChild(P),P=null},s.document.documentElement.appendChild(P)}:c=function(){setTimeout(N,0)};var w,y=[];function N(){w=!0;for(var P,V,z=y.length;z;){for(V=y,y=[],P=-1;++P<z;)V[P]();z=y.length}w=!1}r.exports=F;function F(P){y.push(P)===1&&!w&&c()}}).call(this,typeof Tt<"u"?Tt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,o){var s=n(1);function i(){}var c={},u=["REJECTED"],d=["FULFILLED"],_=["PENDING"];r.exports=f;function f(O){if(typeof O!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,O!==i&&F(this,O)}f.prototype.catch=function(O){return this.then(null,O)},f.prototype.then=function(O,B){if(typeof O!="function"&&this.state===d||typeof B!="function"&&this.state===u)return this;var v=new this.constructor(i);if(this.state!==_){var A=this.state===d?O:B;y(v,A,this.outcome)}else this.queue.push(new w(v,O,B));return v};function w(O,B,v){this.promise=O,typeof B=="function"&&(this.onFulfilled=B,this.callFulfilled=this.otherCallFulfilled),typeof v=="function"&&(this.onRejected=v,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(O){c.resolve(this.promise,O)},w.prototype.otherCallFulfilled=function(O){y(this.promise,this.onFulfilled,O)},w.prototype.callRejected=function(O){c.reject(this.promise,O)},w.prototype.otherCallRejected=function(O){y(this.promise,this.onRejected,O)};function y(O,B,v){s(function(){var A;try{A=B(v)}catch(S){return c.reject(O,S)}A===O?c.reject(O,new TypeError("Cannot resolve promise with itself")):c.resolve(O,A)})}c.resolve=function(O,B){var v=P(N,B);if(v.status==="error")return c.reject(O,v.value);var A=v.value;if(A)F(O,A);else{O.state=d,O.outcome=B;for(var S=-1,D=O.queue.length;++S<D;)O.queue[S].callFulfilled(B)}return O},c.reject=function(O,B){O.state=u,O.outcome=B;for(var v=-1,A=O.queue.length;++v<A;)O.queue[v].callRejected(B);return O};function N(O){var B=O&&O.then;if(O&&(typeof O=="object"||typeof O=="function")&&typeof B=="function")return function(){B.apply(O,arguments)}}function F(O,B){var v=!1;function A(I){v||(v=!0,c.reject(O,I))}function S(I){v||(v=!0,c.resolve(O,I))}function D(){B(S,A)}var b=P(D);b.status==="error"&&A(b.value)}function P(O,B){var v={};try{v.value=O(B),v.status="success"}catch(A){v.status="error",v.value=A}return v}f.resolve=V;function V(O){return O instanceof this?O:c.resolve(new this(i),O)}f.reject=z;function z(O){var B=new this(i);return c.reject(B,O)}f.all=k;function k(O){var B=this;if(Object.prototype.toString.call(O)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=O.length,A=!1;if(!v)return this.resolve([]);for(var S=new Array(v),D=0,b=-1,I=new this(i);++b<v;)H(O[b],b);return I;function H(K,re){B.resolve(K).then(pe,function(j){A||(A=!0,c.reject(I,j))});function pe(j){S[re]=j,++D===v&&!A&&(A=!0,c.resolve(I,S))}}}f.race=Y;function Y(O){var B=this;if(Object.prototype.toString.call(O)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=O.length,A=!1;if(!v)return this.resolve([]);for(var S=-1,D=new this(i);++S<v;)b(O[S]);return D;function b(I){B.resolve(I).then(function(H){A||(A=!0,c.resolve(D,H))},function(H){A||(A=!0,c.reject(D,H))})}}},{1:1}],3:[function(n,r,o){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof Tt<"u"?Tt:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,o){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function i(a,h){if(!(a instanceof h))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var u=c();function d(){try{if(!u||!u.open)return!1;var a=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),h=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!a||h)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function _(a,h){a=a||[],h=h||{};try{return new Blob(a,h)}catch(p){if(p.name!=="TypeError")throw p;for(var l=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,g=new l,m=0;m<a.length;m+=1)g.append(a[m]);return g.getBlob(h.type)}}typeof Promise>"u"&&n(3);var f=Promise;function w(a,h){h&&a.then(function(l){h(null,l)},function(l){h(l)})}function y(a,h,l){typeof h=="function"&&a.then(h),typeof l=="function"&&a.catch(l)}function N(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}function F(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var P="local-forage-detect-blob-support",V=void 0,z={},k=Object.prototype.toString,Y="readonly",O="readwrite";function B(a){for(var h=a.length,l=new ArrayBuffer(h),g=new Uint8Array(l),m=0;m<h;m++)g[m]=a.charCodeAt(m);return l}function v(a){return new f(function(h){var l=a.transaction(P,O),g=_([""]);l.objectStore(P).put(g,"key"),l.onabort=function(m){m.preventDefault(),m.stopPropagation(),h(!1)},l.oncomplete=function(){var m=navigator.userAgent.match(/Chrome\/(\d+)/),p=navigator.userAgent.match(/Edge\//);h(p||!m||parseInt(m[1],10)>=43)}}).catch(function(){return!1})}function A(a){return typeof V=="boolean"?f.resolve(V):v(a).then(function(h){return V=h,V})}function S(a){var h=z[a.name],l={};l.promise=new f(function(g,m){l.resolve=g,l.reject=m}),h.deferredOperations.push(l),h.dbReady?h.dbReady=h.dbReady.then(function(){return l.promise}):h.dbReady=l.promise}function D(a){var h=z[a.name],l=h.deferredOperations.pop();if(l)return l.resolve(),l.promise}function b(a,h){var l=z[a.name],g=l.deferredOperations.pop();if(g)return g.reject(h),g.promise}function I(a,h){return new f(function(l,g){if(z[a.name]=z[a.name]||W(),a.db)if(h)S(a),a.db.close();else return l(a.db);var m=[a.name];h&&m.push(a.version);var p=u.open.apply(u,m);h&&(p.onupgradeneeded=function(E){var T=p.result;try{T.createObjectStore(a.storeName),E.oldVersion<=1&&T.createObjectStore(P)}catch(C){if(C.name==="ConstraintError")console.warn('The database "'+a.name+'" has been upgraded from version '+E.oldVersion+" to version "+E.newVersion+', but the storage "'+a.storeName+'" already exists.');else throw C}}),p.onerror=function(E){E.preventDefault(),g(p.error)},p.onsuccess=function(){var E=p.result;E.onversionchange=function(T){T.target.close()},l(E),D(a)}})}function H(a){return I(a,!1)}function K(a){return I(a,!0)}function re(a,h){if(!a.db)return!0;var l=!a.db.objectStoreNames.contains(a.storeName),g=a.version<a.db.version,m=a.version>a.db.version;if(g&&(a.version!==h&&console.warn('The database "'+a.name+`" can't be downgraded from version `+a.db.version+" to version "+a.version+"."),a.version=a.db.version),m||l){if(l){var p=a.db.version+1;p>a.version&&(a.version=p)}return!0}return!1}function pe(a){return new f(function(h,l){var g=new FileReader;g.onerror=l,g.onloadend=function(m){var p=btoa(m.target.result||"");h({__local_forage_encoded_blob:!0,data:p,type:a.type})},g.readAsBinaryString(a)})}function j(a){var h=B(atob(a.data));return _([h],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function M(a){var h=this,l=h._initReady().then(function(){var g=z[h._dbInfo.name];if(g&&g.dbReady)return g.dbReady});return y(l,a,a),l}function $(a){S(a);for(var h=z[a.name],l=h.forages,g=0;g<l.length;g++){var m=l[g];m._dbInfo.db&&(m._dbInfo.db.close(),m._dbInfo.db=null)}return a.db=null,H(a).then(function(p){return a.db=p,re(a)?K(a):p}).then(function(p){a.db=h.db=p;for(var E=0;E<l.length;E++)l[E]._dbInfo.db=p}).catch(function(p){throw b(a,p),p})}function G(a,h,l,g){g===void 0&&(g=1);try{var m=a.db.transaction(a.storeName,h);l(null,m)}catch(p){if(g>0&&(!a.db||p.name==="InvalidStateError"||p.name==="NotFoundError"))return f.resolve().then(function(){if(!a.db||p.name==="NotFoundError"&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),K(a)}).then(function(){return $(a).then(function(){G(a,h,l,g-1)})}).catch(l);l(p)}}function W(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function se(a){var h=this,l={db:null};if(a)for(var g in a)l[g]=a[g];var m=z[l.name];m||(m=W(),z[l.name]=m),m.forages.push(h),h._initReady||(h._initReady=h.ready,h.ready=M);var p=[];function E(){return f.resolve()}for(var T=0;T<m.forages.length;T++){var C=m.forages[T];C!==h&&p.push(C._initReady().catch(E))}var L=m.forages.slice(0);return f.all(p).then(function(){return l.db=m.db,H(l)}).then(function(R){return l.db=R,re(l,h._defaultConfig.version)?K(l):R}).then(function(R){l.db=m.db=R,h._dbInfo=l;for(var U=0;U<L.length;U++){var q=L[U];q!==h&&(q._dbInfo.db=l.db,q._dbInfo.version=l.version)}})}function ge(a,h){var l=this;a=N(a);var g=new f(function(m,p){l.ready().then(function(){G(l._dbInfo,Y,function(E,T){if(E)return p(E);try{var C=T.objectStore(l._dbInfo.storeName),L=C.get(a);L.onsuccess=function(){var R=L.result;R===void 0&&(R=null),x(R)&&(R=j(R)),m(R)},L.onerror=function(){p(L.error)}}catch(R){p(R)}})}).catch(p)});return w(g,h),g}function le(a,h){var l=this,g=new f(function(m,p){l.ready().then(function(){G(l._dbInfo,Y,function(E,T){if(E)return p(E);try{var C=T.objectStore(l._dbInfo.storeName),L=C.openCursor(),R=1;L.onsuccess=function(){var U=L.result;if(U){var q=U.value;x(q)&&(q=j(q));var X=a(q,U.key,R++);X!==void 0?m(X):U.continue()}else m()},L.onerror=function(){p(L.error)}}catch(U){p(U)}})}).catch(p)});return w(g,h),g}function be(a,h,l){var g=this;a=N(a);var m=new f(function(p,E){var T;g.ready().then(function(){return T=g._dbInfo,k.call(h)==="[object Blob]"?A(T.db).then(function(C){return C?h:pe(h)}):h}).then(function(C){G(g._dbInfo,O,function(L,R){if(L)return E(L);try{var U=R.objectStore(g._dbInfo.storeName);C===null&&(C=void 0);var q=U.put(C,a);R.oncomplete=function(){C===void 0&&(C=null),p(C)},R.onabort=R.onerror=function(){var X=q.error?q.error:q.transaction.error;E(X)}}catch(X){E(X)}})}).catch(E)});return w(m,l),m}function de(a,h){var l=this;a=N(a);var g=new f(function(m,p){l.ready().then(function(){G(l._dbInfo,O,function(E,T){if(E)return p(E);try{var C=T.objectStore(l._dbInfo.storeName),L=C.delete(a);T.oncomplete=function(){m()},T.onerror=function(){p(L.error)},T.onabort=function(){var R=L.error?L.error:L.transaction.error;p(R)}}catch(R){p(R)}})}).catch(p)});return w(g,h),g}function Je(a){var h=this,l=new f(function(g,m){h.ready().then(function(){G(h._dbInfo,O,function(p,E){if(p)return m(p);try{var T=E.objectStore(h._dbInfo.storeName),C=T.clear();E.oncomplete=function(){g()},E.onabort=E.onerror=function(){var L=C.error?C.error:C.transaction.error;m(L)}}catch(L){m(L)}})}).catch(m)});return w(l,a),l}function qe(a){var h=this,l=new f(function(g,m){h.ready().then(function(){G(h._dbInfo,Y,function(p,E){if(p)return m(p);try{var T=E.objectStore(h._dbInfo.storeName),C=T.count();C.onsuccess=function(){g(C.result)},C.onerror=function(){m(C.error)}}catch(L){m(L)}})}).catch(m)});return w(l,a),l}function Xe(a,h){var l=this,g=new f(function(m,p){if(a<0){m(null);return}l.ready().then(function(){G(l._dbInfo,Y,function(E,T){if(E)return p(E);try{var C=T.objectStore(l._dbInfo.storeName),L=!1,R=C.openKeyCursor();R.onsuccess=function(){var U=R.result;if(!U){m(null);return}a===0||L?m(U.key):(L=!0,U.advance(a))},R.onerror=function(){p(R.error)}}catch(U){p(U)}})}).catch(p)});return w(g,h),g}function Qe(a){var h=this,l=new f(function(g,m){h.ready().then(function(){G(h._dbInfo,Y,function(p,E){if(p)return m(p);try{var T=E.objectStore(h._dbInfo.storeName),C=T.openKeyCursor(),L=[];C.onsuccess=function(){var R=C.result;if(!R){g(L);return}L.push(R.key),R.continue()},C.onerror=function(){m(C.error)}}catch(R){m(R)}})}).catch(m)});return w(l,a),l}function Xs(a,h){h=F.apply(this,arguments);var l=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||l.name,a.storeName=a.storeName||l.storeName);var g=this,m;if(!a.name)m=f.reject("Invalid arguments");else{var p=a.name===l.name&&g._dbInfo.db,E=p?f.resolve(g._dbInfo.db):H(a).then(function(T){var C=z[a.name],L=C.forages;C.db=T;for(var R=0;R<L.length;R++)L[R]._dbInfo.db=T;return T});a.storeName?m=E.then(function(T){if(T.objectStoreNames.contains(a.storeName)){var C=T.version+1;S(a);var L=z[a.name],R=L.forages;T.close();for(var U=0;U<R.length;U++){var q=R[U];q._dbInfo.db=null,q._dbInfo.version=C}var X=new f(function(Q,ce){var ie=u.open(a.name,C);ie.onerror=function(ve){var et=ie.result;et.close(),ce(ve)},ie.onupgradeneeded=function(){var ve=ie.result;ve.deleteObjectStore(a.storeName)},ie.onsuccess=function(){var ve=ie.result;ve.close(),Q(ve)}});return X.then(function(Q){L.db=Q;for(var ce=0;ce<R.length;ce++){var ie=R[ce];ie._dbInfo.db=Q,D(ie._dbInfo)}}).catch(function(Q){throw(b(a,Q)||f.resolve()).catch(function(){}),Q})}}):m=E.then(function(T){S(a);var C=z[a.name],L=C.forages;T.close();for(var R=0;R<L.length;R++){var U=L[R];U._dbInfo.db=null}var q=new f(function(X,Q){var ce=u.deleteDatabase(a.name);ce.onerror=function(){var ie=ce.result;ie&&ie.close(),Q(ce.error)},ce.onblocked=function(){console.warn('dropInstance blocked for database "'+a.name+'" until all open connections are closed')},ce.onsuccess=function(){var ie=ce.result;ie&&ie.close(),X(ie)}});return q.then(function(X){C.db=X;for(var Q=0;Q<L.length;Q++){var ce=L[Q];D(ce._dbInfo)}}).catch(function(X){throw(b(a,X)||f.resolve()).catch(function(){}),X})})}return w(m,h),m}var Qs={_driver:"asyncStorage",_initStorage:se,_support:d(),iterate:le,getItem:ge,setItem:be,removeItem:de,clear:Je,length:qe,key:Xe,keys:Qe,dropInstance:Xs};function Zs(){return typeof openDatabase=="function"}var Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ei="~~local_forage_type~",ur=/^~~local_forage_type~([^~]+)~/,It="__lfsc__:",rn=It.length,on="arbf",sn="blob",dr="si08",lr="ui08",fr="uic8",hr="si16",pr="si32",gr="ur16",_r="ui32",mr="fl32",vr="fl64",wr=rn+on.length,yr=Object.prototype.toString;function Er(a){var h=a.length*.75,l=a.length,g,m=0,p,E,T,C;a[a.length-1]==="="&&(h--,a[a.length-2]==="="&&h--);var L=new ArrayBuffer(h),R=new Uint8Array(L);for(g=0;g<l;g+=4)p=Ae.indexOf(a[g]),E=Ae.indexOf(a[g+1]),T=Ae.indexOf(a[g+2]),C=Ae.indexOf(a[g+3]),R[m++]=p<<2|E>>4,R[m++]=(E&15)<<4|T>>2,R[m++]=(T&3)<<6|C&63;return L}function an(a){var h=new Uint8Array(a),l="",g;for(g=0;g<h.length;g+=3)l+=Ae[h[g]>>2],l+=Ae[(h[g]&3)<<4|h[g+1]>>4],l+=Ae[(h[g+1]&15)<<2|h[g+2]>>6],l+=Ae[h[g+2]&63];return h.length%3===2?l=l.substring(0,l.length-1)+"=":h.length%3===1&&(l=l.substring(0,l.length-2)+"=="),l}function ti(a,h){var l="";if(a&&(l=yr.call(a)),a&&(l==="[object ArrayBuffer]"||a.buffer&&yr.call(a.buffer)==="[object ArrayBuffer]")){var g,m=It;a instanceof ArrayBuffer?(g=a,m+=on):(g=a.buffer,l==="[object Int8Array]"?m+=dr:l==="[object Uint8Array]"?m+=lr:l==="[object Uint8ClampedArray]"?m+=fr:l==="[object Int16Array]"?m+=hr:l==="[object Uint16Array]"?m+=gr:l==="[object Int32Array]"?m+=pr:l==="[object Uint32Array]"?m+=_r:l==="[object Float32Array]"?m+=mr:l==="[object Float64Array]"?m+=vr:h(new Error("Failed to get type for BinaryArray"))),h(m+an(g))}else if(l==="[object Blob]"){var p=new FileReader;p.onload=function(){var E=ei+a.type+"~"+an(this.result);h(It+sn+E)},p.readAsArrayBuffer(a)}else try{h(JSON.stringify(a))}catch(E){console.error("Couldn't convert value into a JSON string: ",a),h(null,E)}}function ni(a){if(a.substring(0,rn)!==It)return JSON.parse(a);var h=a.substring(wr),l=a.substring(rn,wr),g;if(l===sn&&ur.test(h)){var m=h.match(ur);g=m[1],h=h.substring(m[0].length)}var p=Er(h);switch(l){case on:return p;case sn:return _([p],{type:g});case dr:return new Int8Array(p);case lr:return new Uint8Array(p);case fr:return new Uint8ClampedArray(p);case hr:return new Int16Array(p);case gr:return new Uint16Array(p);case pr:return new Int32Array(p);case _r:return new Uint32Array(p);case mr:return new Float32Array(p);case vr:return new Float64Array(p);default:throw new Error("Unkown type: "+l)}}var cn={serialize:ti,deserialize:ni,stringToBuffer:Er,bufferToString:an};function br(a,h,l,g){a.executeSql("CREATE TABLE IF NOT EXISTS "+h.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],l,g)}function ri(a){var h=this,l={db:null};if(a)for(var g in a)l[g]=typeof a[g]!="string"?a[g].toString():a[g];var m=new f(function(p,E){try{l.db=openDatabase(l.name,String(l.version),l.description,l.size)}catch(T){return E(T)}l.db.transaction(function(T){br(T,l,function(){h._dbInfo=l,p()},function(C,L){E(L)})},E)});return l.serializer=cn,m}function Ne(a,h,l,g,m,p){a.executeSql(l,g,m,function(E,T){T.code===T.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[h.storeName],function(C,L){L.rows.length?p(C,T):br(C,h,function(){C.executeSql(l,g,m,p)},p)},p):p(E,T)},p)}function oi(a,h){var l=this;a=N(a);var g=new f(function(m,p){l.ready().then(function(){var E=l._dbInfo;E.db.transaction(function(T){Ne(T,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[a],function(C,L){var R=L.rows.length?L.rows.item(0).value:null;R&&(R=E.serializer.deserialize(R)),m(R)},function(C,L){p(L)})})}).catch(p)});return w(g,h),g}function si(a,h){var l=this,g=new f(function(m,p){l.ready().then(function(){var E=l._dbInfo;E.db.transaction(function(T){Ne(T,E,"SELECT * FROM "+E.storeName,[],function(C,L){for(var R=L.rows,U=R.length,q=0;q<U;q++){var X=R.item(q),Q=X.value;if(Q&&(Q=E.serializer.deserialize(Q)),Q=a(Q,X.key,q+1),Q!==void 0){m(Q);return}}m()},function(C,L){p(L)})})}).catch(p)});return w(g,h),g}function Sr(a,h,l,g){var m=this;a=N(a);var p=new f(function(E,T){m.ready().then(function(){h===void 0&&(h=null);var C=h,L=m._dbInfo;L.serializer.serialize(h,function(R,U){U?T(U):L.db.transaction(function(q){Ne(q,L,"INSERT OR REPLACE INTO "+L.storeName+" (key, value) VALUES (?, ?)",[a,R],function(){E(C)},function(X,Q){T(Q)})},function(q){if(q.code===q.QUOTA_ERR){if(g>0){E(Sr.apply(m,[a,C,l,g-1]));return}T(q)}})})}).catch(T)});return w(p,l),p}function ii(a,h,l){return Sr.apply(this,[a,h,l,1])}function ai(a,h){var l=this;a=N(a);var g=new f(function(m,p){l.ready().then(function(){var E=l._dbInfo;E.db.transaction(function(T){Ne(T,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[a],function(){m()},function(C,L){p(L)})})}).catch(p)});return w(g,h),g}function ci(a){var h=this,l=new f(function(g,m){h.ready().then(function(){var p=h._dbInfo;p.db.transaction(function(E){Ne(E,p,"DELETE FROM "+p.storeName,[],function(){g()},function(T,C){m(C)})})}).catch(m)});return w(l,a),l}function ui(a){var h=this,l=new f(function(g,m){h.ready().then(function(){var p=h._dbInfo;p.db.transaction(function(E){Ne(E,p,"SELECT COUNT(key) as c FROM "+p.storeName,[],function(T,C){var L=C.rows.item(0).c;g(L)},function(T,C){m(C)})})}).catch(m)});return w(l,a),l}function di(a,h){var l=this,g=new f(function(m,p){l.ready().then(function(){var E=l._dbInfo;E.db.transaction(function(T){Ne(T,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[a+1],function(C,L){var R=L.rows.length?L.rows.item(0).key:null;m(R)},function(C,L){p(L)})})}).catch(p)});return w(g,h),g}function li(a){var h=this,l=new f(function(g,m){h.ready().then(function(){var p=h._dbInfo;p.db.transaction(function(E){Ne(E,p,"SELECT key FROM "+p.storeName,[],function(T,C){for(var L=[],R=0;R<C.rows.length;R++)L.push(C.rows.item(R).key);g(L)},function(T,C){m(C)})})}).catch(m)});return w(l,a),l}function fi(a){return new f(function(h,l){a.transaction(function(g){g.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(m,p){for(var E=[],T=0;T<p.rows.length;T++)E.push(p.rows.item(T).name);h({db:a,storeNames:E})},function(m,p){l(p)})},function(g){l(g)})})}function hi(a,h){h=F.apply(this,arguments);var l=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||l.name,a.storeName=a.storeName||l.storeName);var g=this,m;return a.name?m=new f(function(p){var E;a.name===l.name?E=g._dbInfo.db:E=openDatabase(a.name,"","",0),a.storeName?p({db:E,storeNames:[a.storeName]}):p(fi(E))}).then(function(p){return new f(function(E,T){p.db.transaction(function(C){function L(X){return new f(function(Q,ce){C.executeSql("DROP TABLE IF EXISTS "+X,[],function(){Q()},function(ie,ve){ce(ve)})})}for(var R=[],U=0,q=p.storeNames.length;U<q;U++)R.push(L(p.storeNames[U]));f.all(R).then(function(){E()}).catch(function(X){T(X)})},function(C){T(C)})})}):m=f.reject("Invalid arguments"),w(m,h),m}var pi={_driver:"webSQLStorage",_initStorage:ri,_support:Zs(),iterate:si,getItem:oi,setItem:ii,removeItem:ai,clear:ci,length:ui,key:di,keys:li,dropInstance:hi};function gi(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Dr(a,h){var l=a.name+"/";return a.storeName!==h.storeName&&(l+=a.storeName+"/"),l}function _i(){var a="_localforage_support_test";try{return localStorage.setItem(a,!0),localStorage.removeItem(a),!1}catch{return!0}}function mi(){return!_i()||localStorage.length>0}function vi(a){var h=this,l={};if(a)for(var g in a)l[g]=a[g];return l.keyPrefix=Dr(a,h._defaultConfig),mi()?(h._dbInfo=l,l.serializer=cn,f.resolve()):f.reject()}function wi(a){var h=this,l=h.ready().then(function(){for(var g=h._dbInfo.keyPrefix,m=localStorage.length-1;m>=0;m--){var p=localStorage.key(m);p.indexOf(g)===0&&localStorage.removeItem(p)}});return w(l,a),l}function yi(a,h){var l=this;a=N(a);var g=l.ready().then(function(){var m=l._dbInfo,p=localStorage.getItem(m.keyPrefix+a);return p&&(p=m.serializer.deserialize(p)),p});return w(g,h),g}function Ei(a,h){var l=this,g=l.ready().then(function(){for(var m=l._dbInfo,p=m.keyPrefix,E=p.length,T=localStorage.length,C=1,L=0;L<T;L++){var R=localStorage.key(L);if(R.indexOf(p)===0){var U=localStorage.getItem(R);if(U&&(U=m.serializer.deserialize(U)),U=a(U,R.substring(E),C++),U!==void 0)return U}}});return w(g,h),g}function bi(a,h){var l=this,g=l.ready().then(function(){var m=l._dbInfo,p;try{p=localStorage.key(a)}catch{p=null}return p&&(p=p.substring(m.keyPrefix.length)),p});return w(g,h),g}function Si(a){var h=this,l=h.ready().then(function(){for(var g=h._dbInfo,m=localStorage.length,p=[],E=0;E<m;E++){var T=localStorage.key(E);T.indexOf(g.keyPrefix)===0&&p.push(T.substring(g.keyPrefix.length))}return p});return w(l,a),l}function Di(a){var h=this,l=h.keys().then(function(g){return g.length});return w(l,a),l}function Ii(a,h){var l=this;a=N(a);var g=l.ready().then(function(){var m=l._dbInfo;localStorage.removeItem(m.keyPrefix+a)});return w(g,h),g}function Ai(a,h,l){var g=this;a=N(a);var m=g.ready().then(function(){h===void 0&&(h=null);var p=h;return new f(function(E,T){var C=g._dbInfo;C.serializer.serialize(h,function(L,R){if(R)T(R);else try{localStorage.setItem(C.keyPrefix+a,L),E(p)}catch(U){(U.name==="QuotaExceededError"||U.name==="NS_ERROR_DOM_QUOTA_REACHED")&&T(U),T(U)}})})});return w(m,l),m}function Ni(a,h){if(h=F.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var l=this.config();a.name=a.name||l.name,a.storeName=a.storeName||l.storeName}var g=this,m;return a.name?m=new f(function(p){a.storeName?p(Dr(a,g._defaultConfig)):p(a.name+"/")}).then(function(p){for(var E=localStorage.length-1;E>=0;E--){var T=localStorage.key(E);T.indexOf(p)===0&&localStorage.removeItem(T)}}):m=f.reject("Invalid arguments"),w(m,h),m}var Ti={_driver:"localStorageWrapper",_initStorage:vi,_support:gi(),iterate:Ei,getItem:yi,setItem:Ai,removeItem:Ii,clear:wi,length:Di,key:bi,keys:Si,dropInstance:Ni},Oi=function(h,l){return h===l||typeof h=="number"&&typeof l=="number"&&isNaN(h)&&isNaN(l)},Ci=function(h,l){for(var g=h.length,m=0;m<g;){if(Oi(h[m],l))return!0;m++}return!1},Ir=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},Ze={},Ar={},Ve={INDEXEDDB:Qs,WEBSQL:pi,LOCALSTORAGE:Ti},Li=[Ve.INDEXEDDB._driver,Ve.WEBSQL._driver,Ve.LOCALSTORAGE._driver],At=["dropInstance"],un=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(At),Ri={description:"",driver:Li.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Pi(a,h){a[h]=function(){var l=arguments;return a.ready().then(function(){return a[h].apply(a,l)})}}function dn(){for(var a=1;a<arguments.length;a++){var h=arguments[a];if(h)for(var l in h)h.hasOwnProperty(l)&&(Ir(h[l])?arguments[0][l]=h[l].slice():arguments[0][l]=h[l])}return arguments[0]}var xi=function(){function a(h){i(this,a);for(var l in Ve)if(Ve.hasOwnProperty(l)){var g=Ve[l],m=g._driver;this[l]=m,Ze[m]||this.defineDriver(g)}this._defaultConfig=dn({},Ri),this._config=dn({},this._defaultConfig,h),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return a.prototype.config=function(l){if((typeof l>"u"?"undefined":s(l))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var g in l){if(g==="storeName"&&(l[g]=l[g].replace(/\W/g,"_")),g==="version"&&typeof l[g]!="number")return new Error("Database version must be a number.");this._config[g]=l[g]}return"driver"in l&&l.driver?this.setDriver(this._config.driver):!0}else return typeof l=="string"?this._config[l]:this._config},a.prototype.defineDriver=function(l,g,m){var p=new f(function(E,T){try{var C=l._driver,L=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!l._driver){T(L);return}for(var R=un.concat("_initStorage"),U=0,q=R.length;U<q;U++){var X=R[U],Q=!Ci(At,X);if((Q||l[X])&&typeof l[X]!="function"){T(L);return}}var ce=function(){for(var et=function(Ui){return function(){var ki=new Error("Method "+Ui+" is not implemented by the current driver"),Nr=f.reject(ki);return w(Nr,arguments[arguments.length-1]),Nr}},ln=0,$i=At.length;ln<$i;ln++){var fn=At[ln];l[fn]||(l[fn]=et(fn))}};ce();var ie=function(et){Ze[C]&&console.info("Redefining LocalForage driver: "+C),Ze[C]=l,Ar[C]=et,E()};"_support"in l?l._support&&typeof l._support=="function"?l._support().then(ie,T):ie(!!l._support):ie(!0)}catch(ve){T(ve)}});return y(p,g,m),p},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(l,g,m){var p=Ze[l]?f.resolve(Ze[l]):f.reject(new Error("Driver not found."));return y(p,g,m),p},a.prototype.getSerializer=function(l){var g=f.resolve(cn);return y(g,l),g},a.prototype.ready=function(l){var g=this,m=g._driverSet.then(function(){return g._ready===null&&(g._ready=g._initDriver()),g._ready});return y(m,l,l),m},a.prototype.setDriver=function(l,g,m){var p=this;Ir(l)||(l=[l]);var E=this._getSupportedDrivers(l);function T(){p._config.driver=p.driver()}function C(U){return p._extend(U),T(),p._ready=p._initStorage(p._config),p._ready}function L(U){return function(){var q=0;function X(){for(;q<U.length;){var Q=U[q];return q++,p._dbInfo=null,p._ready=null,p.getDriver(Q).then(C).catch(X)}T();var ce=new Error("No available storage method found.");return p._driverSet=f.reject(ce),p._driverSet}return X()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=R.then(function(){var U=E[0];return p._dbInfo=null,p._ready=null,p.getDriver(U).then(function(q){p._driver=q._driver,T(),p._wrapLibraryMethodsWithReady(),p._initDriver=L(E)})}).catch(function(){T();var U=new Error("No available storage method found.");return p._driverSet=f.reject(U),p._driverSet}),y(this._driverSet,g,m),this._driverSet},a.prototype.supports=function(l){return!!Ar[l]},a.prototype._extend=function(l){dn(this,l)},a.prototype._getSupportedDrivers=function(l){for(var g=[],m=0,p=l.length;m<p;m++){var E=l[m];this.supports(E)&&g.push(E)}return g},a.prototype._wrapLibraryMethodsWithReady=function(){for(var l=0,g=un.length;l<g;l++)Pi(this,un[l])},a.prototype.createInstance=function(l){return new a(l)},a}(),Mi=new xi;r.exports=Mi},{3:3}]},{},[4])(4)})}(Dn)),Dn.exports}var ud=cd();const ro=Oo(ud),ee=class ee{constructor(t){fe(this,"db");this.db=ro.ready().then(()=>ro.createInstance({name:t?`${t}:${ee.DBName}`:ee.DBName}))}async findStorageUnitsBy(t,n,r){const o=[],{parentId:s,documentId:i,documentModelType:c,scope:u}=qi(t),f=(await(await this.db).keys()).filter(P=>P.startsWith(`${ee.DOCUMENT_KEY}${ee.SEP}`)).map(P=>P.slice(ee.DOCUMENT_KEY.length+ee.SEP.length));let w;if(s){const P=new Set;for(const V of s)(await this.getChildren(V)).forEach(k=>P.add(k));w=s.union(P)}else w=new Set(f);w=i?i.intersection(w):w;for(const P of w){const V=await this.get(P).catch(()=>null);if(V&&!(c&&!c.has(V.header.documentType)))for(const[z]of Object.entries(V.state))u&&!u.has(z)||o.push({documentId:P,documentModelType:V.header.documentType,scope:z,branch:"main"})}let y=0;if(r){const P=o.findIndex(V=>V.documentId===r);P!==-1&&(y=P)}const N=Math.min(y+n,o.length),F=N<o.length?o[N].documentId:void 0;return{units:o.slice(y,N),nextCursor:F}}async resolveIds(t,n){const r=await this.getSlugManifest();if(n!=null&&n.aborted)throw new Tr("Aborted");const o=[];for(const s of t){const i=r.slugToId[s];if(!i)throw new Ot(s);o.push(i)}return Promise.resolve(o)}async resolveSlugs(t,n){const r=await this.getSlugManifest();if(n!=null&&n.aborted)throw new Tr("Aborted");const o=[];for(const s of t){let i=!1;for(const[c,u]of Object.entries(r.slugToId))if(u===s){o.push(c),i=!0;break}if(!i)throw new Ot(s)}return Promise.resolve(o)}async clear(){await(await this.db).clear()}async exists(t){return!!await(await this.db).getItem(this.buildDocumentKey(t))}async create(t){const n=t.header.id;if(!Xi(n))throw new Qi(n);const r=await this.db;if(await this.exists(n))throw new Or(n);const o=t.header.slug&&t.header.slug.length>0?t.header.slug:n;if(!Zi(o))throw new ea(o);if((await this.getSlugManifest()).slugToId[o])throw new Or(n);if(t.header.slug=o,await r.setItem(this.buildDocumentKey(n),t),o){const i=await this.getSlugManifest();if(i.slugToId[o])throw new Error(`Document with slug ${o} already exists`);i.slugToId[o]=n,await this.updateSlugManifest(i)}t.header.documentType==="powerhouse/document-drive"&&this.updateDriveManifest(n,{documentIds:[]})}async get(t){const r=await(await this.db).getItem(this.buildDocumentKey(t));return r||Promise.reject(new Ot(t))}async getBySlug(t){const r=(await this.getSlugManifest()).slugToId[t];return r?this.get(r):Promise.reject(new Ot(t))}async findByType(t,n=100,r){const o=await this.db,i=(await o.keys()).filter(f=>f.startsWith(`${ee.DOCUMENT_KEY}${ee.SEP}`)),c=[];for(const f of i){const w=f.slice(ee.DOCUMENT_KEY.length+ee.SEP.length);try{const y=await o.getItem(f);if(!y||y.header.documentType!==t)continue;c.push({id:w,document:y})}catch{continue}}c.sort((f,w)=>{const y=new Date(f.document.header.createdAtUtcIso),N=new Date(w.document.header.createdAtUtcIso);return y.getTime()===N.getTime()?f.id.localeCompare(w.id):y.getTime()-N.getTime()});let u=0;if(r){const f=c.findIndex(({id:w})=>w===r);f!==-1&&(u=f)}const d=Math.min(u+n,c.length);let _;return d<c.length&&(_=c[d].id),{documents:c.slice(u,d).map(({id:f})=>f),nextCursor:_}}async delete(t){var i;const n=await this.db,r=await n.getItem(this.buildDocumentKey(t));if(!r)return!1;const o=((i=r.header.slug)==null?void 0:i.length)>0?r.header.slug:t;try{if(o){const c=await this.getSlugManifest();c.slugToId[o]===t&&(delete c.slugToId[o],await this.updateSlugManifest(c))}}catch{}const s=await this.getParents(t);for(const c of s)await this.removeChild(c,t);return await n.removeItem(this.buildManifestKey(t)),await n.removeItem(this.buildDocumentKey(t)),!0}async removeChild(t,n){const r=await this.getManifest(t),o=r.documentIds.indexOf(n);return o!==-1?(r.documentIds.splice(o,1),await this.updateDriveManifest(t,r),!0):!1}async addChild(t,n){if(t===n)throw new Error("Cannot associate a document with itself");if((await this.getChildren(n)).includes(t))throw new Error("Cannot associate a document with its child");const o=await this.getManifest(t);o.documentIds.includes(n)||(o.documentIds.push(n),await this.updateDriveManifest(t,o))}async getChildren(t){return(await this.getManifest(t)).documentIds}async getParents(t){const r=await(await this.db).keys(),o=[],s=r.filter(i=>i.startsWith(`${ee.MANIFEST_KEY}${ee.SEP}`));for(const i of s){const c=i.slice(ee.MANIFEST_KEY.length+ee.SEP.length);(await this.getManifest(c)).documentIds.includes(t)&&o.push(c)}return o}async getManifest(t){return await(await this.db).getItem(this.buildManifestKey(t))||{documentIds:[]}}async updateDriveManifest(t,n){await(await this.db).setItem(this.buildManifestKey(t),n)}async getSlugManifest(){return await(await this.db).getItem(ee.SLUG_MANIFEST_KEY)||{slugToId:{}}}async updateSlugManifest(t){await(await this.db).setItem(ee.SLUG_MANIFEST_KEY,t)}async addDocumentOperations(t,n,r){const o=await this.get(t);if(!o)throw new Error(`Document with id ${t} not found`);const s=Cr(o.operations,n);await(await this.db).setItem(this.buildDocumentKey(t),{...o,...r,operations:s})}async addDriveOperations(t,n,r){const o=await this.get(t),s=Cr(o.operations,n);await(await this.db).setItem(this.buildDocumentKey(t),{...o,...r,operations:s})}async getSynchronizationUnitsRevision(t){return(await Promise.allSettled(t.map(async r=>{var o;try{const s=await this.get(r.documentId);if(!s||!s.operations[r.scope])return;const i=s.operations[r.scope];return{documentId:r.documentId,documentType:r.documentType,scope:r.scope,branch:r.branch,lastUpdated:((o=i.at(-1))==null?void 0:o.timestamp)??s.header.createdAtUtcIso,revision:ta(i)}}catch{return}}))).reduce((r,o)=>(o.status==="fulfilled"&&o.value!==void 0&&r.push(o.value),r),[])}async migrateOperationSignatures(){let t;do{const{documents:n,nextCursor:r}=await this.findByType("powerhouse/document-drive",100,t);for(const o of n){await this.migrateDrive(o);const s=await this.getChildren(o);await Promise.all(s.map(async i=>this.migrateDocument(o,i)))}t=r}while(t)}async migrateDrive(t){const n=await this.get(t),r=to(n);if(r!==n)return(await this.db).setItem(this.buildDocumentKey(t),r)}async migrateDocument(t,n){const r=await this.get(n),o=to(r);if(o!==r)return(await this.db).setItem(this.buildDocumentKey(n),o)}buildDocumentKey(t){return`${ee.DOCUMENT_KEY}${ee.SEP}${t}`}buildManifestKey(t){return`${ee.MANIFEST_KEY}${ee.SEP}${t}`}};fe(ee,"DBName","DOCUMENT_DRIVES"),fe(ee,"SEP",":"),fe(ee,"DOCUMENT_KEY","DOCUMENT"),fe(ee,"MANIFEST_KEY","MANIFEST"),fe(ee,"SLUG_MANIFEST_KEY","SLUG_MANIFEST");let Un=ee;const oo=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,In=oo?oo.split(","):[],dd=()=>({defaultDrives:{remoteDrives:In.map(t=>({url:t,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:t,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]}})),removeOldRemoteDrives:In.length>0?{strategy:"preserve-by-url-and-detach",urls:In}:{strategy:"preserve-all"}}});function ld(e){return new Un(e)}function fd(e,t){return new na(e).withStorage(t).withCache(new ra).withQueueManager(new oa).withOptions({...dd()}).build()}async function hd(e,t,n,r,o,s){var u;if(!s||!e.action||!((u=e.action)!=null&&u.context)||!e.action.context.signer)return e;if(!o)return te.error(`Document model '${r.header.documentType}' does not have a reducer`),e;const i=e.action.context.signer;return await sa(e.action,o,r,i,t)}function pd(e,t,n){return n?{context:{signer:{app:{name:"Connect",key:t||""},user:{address:n.address,networkId:n.networkId,chainId:n.chainId},signatures:[]}},...e}:e}async function qt(){if(import.meta.hot)return import.meta.hot;try{return(await Te(()=>import("../hmr.js"),[],import.meta.url)).hmr}catch{return}}async function fh(e){const t=await qt();if(!t)throw new Error("HMR not available.");return new Promise(n=>{function r(o){e===o.name&&(n(),t==null||t.off("studio:external-package-added",r))}t.on("studio:external-package-added",r),t.send("studio:add-external-package",{name:e})})}async function hh(e){const t=await qt();if(!t)throw new Error("HMR not available.");return new Promise(n=>{function r(o){e===o.name&&(n(),t==null||t.off("studio:external-package-removed",r))}t.on("studio:external-package-removed",r),t.send("studio:remove-external-package",{name:e})})}async function gd(e){const t=await qt(),n=r=>{const o=Te(()=>import(`${r.url}?t=${r.timestamp}`),[],import.meta.url);e(o.then(s=>s.default))};return t==null||t.on("studio:external-packages-updated",n),()=>{t==null||t.off("studio:external-packages-updated",n)}}const ds=Object.prototype.toString;function _d(e){switch(ds.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Xt(e,Error)}}function Ge(e,t){return ds.call(e)===`[object ${t}]`}function ph(e){return Ge(e,"ErrorEvent")}function gh(e){return Ge(e,"DOMError")}function _h(e){return Ge(e,"DOMException")}function Yt(e){return Ge(e,"String")}function md(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function mh(e){return e===null||md(e)||typeof e!="object"&&typeof e!="function"}function tr(e){return Ge(e,"Object")}function vd(e){return typeof Event<"u"&&Xt(e,Event)}function wd(e){return typeof Element<"u"&&Xt(e,Element)}function yd(e){return Ge(e,"RegExp")}function nr(e){return!!(e&&e.then&&typeof e.then=="function")}function Ed(e){return tr(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function bd(e){return typeof e=="number"&&e!==e}function Xt(e,t){try{return e instanceof t}catch{return!1}}function ls(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function ut(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function An(e,t){let n=e;const r=n.length;if(r<=150)return n;t>r&&(t=r);let o=Math.max(t-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function vh(e,t){if(!Array.isArray(e))return"";const n=[];for(let r=0;r<e.length;r++){const o=e[r];try{ls(o)?n.push("[VueViewModel]"):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Sd(e,t,n=!1){return Yt(e)?yd(t)?t.test(e):Yt(t)?n?e===t:e.includes(t):!1:!1}function wh(e,t=[],n=!1){return t.some(r=>Sd(e,r,n))}function Rt(e){return e&&e.Math==Math?e:void 0}const me=typeof globalThis=="object"&&Rt(globalThis)||typeof window=="object"&&Rt(window)||typeof self=="object"&&Rt(self)||typeof global=="object"&&Rt(global)||function(){return this}()||{};function Dd(){return me}function fs(e,t,n){const r=n||me,o=r.__SENTRY__=r.__SENTRY__||{};return o[e]||(o[e]=t())}const je=Dd(),Id=80;function Ad(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,o=[];let s=0,i=0;const c=" > ",u=c.length;let d;const _=Array.isArray(t)?t:t.keyAttrs,f=!Array.isArray(t)&&t.maxStringLength||Id;for(;n&&s++<r&&(d=Nd(n,_),!(d==="html"||s>1&&i+o.length*u+d.length>=f));)o.push(d),i+=d.length,n=n.parentNode;return o.reverse().join(c)}catch{return"<unknown>"}}function Nd(e,t){const n=e,r=[];let o,s,i,c,u;if(!n||!n.tagName)return"";if(je.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const d=t&&t.length?t.filter(f=>n.getAttribute(f)).map(f=>[f,n.getAttribute(f)]):null;if(d&&d.length)d.forEach(f=>{r.push(`[${f[0]}="${f[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),o=n.className,o&&Yt(o))for(s=o.split(/\s+/),u=0;u<s.length;u++)r.push(`.${s[u]}`);const _=["aria-label","type","name","title","alt"];for(u=0;u<_.length;u++)i=_[u],c=n.getAttribute(i),c&&r.push(`[${i}="${c}"]`);return r.join("")}function yh(){try{return je.document.location.href}catch{return""}}function Eh(e){return je.document&&je.document.querySelector?je.document.querySelector(e):null}function bh(e){if(!je.HTMLElement)return null;let t=e;const n=5;for(let r=0;r<n;r++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}const rr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Td="Sentry Logger ",so=["debug","info","warn","error","log","assert","trace"],io={};function hs(e){if(!("console"in me))return e();const t=me.console,n={},r=Object.keys(io);r.forEach(o=>{const s=io[o];n[o]=t[o],t[o]=s});try{return e()}finally{r.forEach(o=>{t[o]=n[o]})}}function Od(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return rr?so.forEach(n=>{t[n]=(...r)=>{e&&hs(()=>{me.console[n](`${Td}[${n}]:`,...r)})}}):so.forEach(n=>{t[n]=()=>{}}),t}const we=Od();function Sh(e,t,n){if(!(t in e))return;const r=e[t],o=n(r);typeof o=="function"&&Cd(o,r),e[t]=o}function ps(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{rr&&we.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Cd(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,ps(e,"__sentry_original__",t)}catch{}}function Dh(e){return e.__sentry_original__}function Ih(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function gs(e){if(_d(e))return{message:e.message,name:e.name,stack:e.stack,...co(e)};if(vd(e)){const t={type:e.type,target:ao(e.target),currentTarget:ao(e.currentTarget),...co(e)};return typeof CustomEvent<"u"&&Xt(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function ao(e){try{return wd(e)?Ad(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function co(e){if(typeof e=="object"&&e!==null){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Ah(e,t=40){const n=Object.keys(gs(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return ut(n[0],t);for(let r=n.length;r>0;r--){const o=n.slice(0,r).join(", ");if(!(o.length>t))return r===n.length?o:ut(o,t)}return""}function xe(e){return kn(e,new Map)}function kn(e,t){if(Ld(e)){const n=t.get(e);if(n!==void 0)return n;const r={};t.set(e,r);for(const o of Object.keys(e))typeof e[o]<"u"&&(r[o]=kn(e[o],t));return r}if(Array.isArray(e)){const n=t.get(e);if(n!==void 0)return n;const r=[];return t.set(e,r),e.forEach(o=>{r.push(kn(o,t))}),r}return e}function Ld(e){if(!tr(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}const _s=50,uo=/\(error: (.*)\)/,lo=/captureMessage|captureException/;function Rd(...e){const t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{const o=[],s=n.split(`
8
- `);for(let i=r;i<s.length;i++){const c=s[i];if(c.length>1024)continue;const u=uo.test(c)?c.replace(uo,"$1"):c;if(!u.match(/\S*Error: /)){for(const d of t){const _=d(u);if(_){o.push(_);break}}if(o.length>=_s)break}}return Pd(o)}}function Nh(e){return Array.isArray(e)?Rd(...e):e}function Pd(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),lo.test(t[t.length-1].function||"")&&(t.pop(),lo.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,_s).map(n=>({...n,filename:n.filename||t[t.length-1].filename,function:n.function||"?"}))}const Nn="<anonymous>";function xd(e){try{return!e||typeof e!="function"?Nn:e.name||Nn}catch{return Nn}}function oe(){const e=me,t=e.crypto||e.msCrypto;let n=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function ms(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function Th(e){const{message:t,event_id:n}=e;if(t)return t;const r=ms(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Oh(e,t,n){const r=e.exception=e.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=t||""),s.type||(s.type="Error")}function Md(e,t){const n=ms(e);if(!n)return;const r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...t},t&&"data"in t){const s={...o&&o.data,...t.data};n.mechanism.data=s}}function Ch(e,t,n=5){if(t.lineno===void 0)return;const r=e.length,o=Math.max(Math.min(r-1,t.lineno-1),0);t.pre_context=e.slice(Math.max(0,o-n),o).map(s=>An(s,0)),t.context_line=An(e[Math.min(r-1,o)],t.colno||0),t.post_context=e.slice(Math.min(o+1,r),o+1+n).map(s=>An(s,0))}function Lh(e){if(e&&e.__sentry_captured__)return!0;try{ps(e,"__sentry_captured__",!0)}catch{}return!1}function $d(e){return Array.isArray(e)?e:[e]}function Ud(){const e=typeof WeakSet=="function",t=e?new WeakSet:[];function n(o){if(e)return t.has(o)?!0:(t.add(o),!1);for(let s=0;s<t.length;s++)if(t[s]===o)return!0;return t.push(o),!1}function r(o){if(e)t.delete(o);else for(let s=0;s<t.length;s++)if(t[s]===o){t.splice(s,1);break}}return[n,r]}function Ce(e,t=100,n=1/0){try{return Bn("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function kd(e,t=3,n=100*1024){const r=Ce(e,t);return jd(r)>n?kd(e,t-1,n):r}function Bn(e,t,n=1/0,r=1/0,o=Ud()){const[s,i]=o;if(t==null||["number","boolean","string"].includes(typeof t)&&!bd(t))return t;const c=Bd(e,t);if(!c.startsWith("[object "))return c;if(t.__sentry_skip_normalization__)return t;const u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(u===0)return c.replace("object ","");if(s(t))return"[Circular ~]";const d=t;if(d&&typeof d.toJSON=="function")try{const y=d.toJSON();return Bn("",y,u-1,r,o)}catch{}const _=Array.isArray(t)?[]:{};let f=0;const w=gs(t);for(const y in w){if(!Object.prototype.hasOwnProperty.call(w,y))continue;if(f>=r){_[y]="[MaxProperties ~]";break}const N=w[y];_[y]=Bn(y,N,u-1,r,o),f++}return i(t),_}function Bd(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(ls(t))return"[VueViewModel]";if(Ed(t))return"[SyntheticEvent]";if(typeof t=="number"&&t!==t)return"[NaN]";if(typeof t=="function")return`[Function: ${xd(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=Fd(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Fd(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function Vd(e){return~-encodeURI(e).split(/%..|./).length}function jd(e){return Vd(JSON.stringify(e))}var Se;(function(e){e[e.PENDING=0]="PENDING";const n=1;e[e.RESOLVED=n]="RESOLVED";const r=2;e[e.REJECTED=r]="REJECTED"})(Se||(Se={}));function Rh(e){return new Ee(t=>{t(e)})}function Ph(e){return new Ee((t,n)=>{n(e)})}class Ee{constructor(t){Ee.prototype.__init.call(this),Ee.prototype.__init2.call(this),Ee.prototype.__init3.call(this),Ee.prototype.__init4.call(this),this._state=Se.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(n){this._reject(n)}}then(t,n){return new Ee((r,o)=>{this._handlers.push([!1,s=>{if(!t)r(s);else try{r(t(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new Ee((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,t&&t()},i=>{s=!0,o=i,t&&t()}).then(()=>{if(s){r(o);return}n(o)})})}__init(){this._resolve=t=>{this._setResult(Se.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(Se.REJECTED,t)}}__init3(){this._setResult=(t,n)=>{if(this._state===Se.PENDING){if(nr(n)){n.then(this._resolve,this._reject);return}this._state=t,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Se.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===Se.RESOLVED&&n[1](this._value),this._state===Se.REJECTED&&n[2](this._value),n[0]=!0)})}}}const vs=1e3;function Qt(){return Date.now()/vs}function zd(){const{performance:e}=me;if(!e||!e.now)return Qt;const t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/vs}const or=zd(),xh=(()=>{const{performance:e}=me;if(!e||!e.now)return;const t=3600*1e3,n=e.now(),r=Date.now(),o=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,s=o<t,i=e.timing&&e.timing.navigationStart,u=typeof i=="number"?Math.abs(i+n-r):t,d=u<t;return s||d?o<=u?e.timeOrigin:i:r})(),Mh="baggage",ws="sentry-",Hd=/^sentry-/,Yd=8192;function ys(e){if(!Yt(e)&&!Array.isArray(e))return;let t={};if(Array.isArray(e))t=e.reduce((r,o)=>{const s=fo(o);for(const i of Object.keys(s))r[i]=s[i];return r},{});else{if(!e)return;t=fo(e)}const n=Object.entries(t).reduce((r,[o,s])=>{if(o.match(Hd)){const i=o.slice(ws.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function $h(e){if(!e)return;const t=Object.entries(e).reduce((n,[r,o])=>(o&&(n[`${ws}${r}`]=o),n),{});return Wd(t)}function fo(e){return e.split(",").map(t=>t.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((t,[n,r])=>(t[n]=r,t),{})}function Wd(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],o)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${t},${s}`;return i.length>Yd?(rr&&we.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):i},"")}const Gd=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Es(e){if(!e)return;const t=e.match(Gd);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Uh(e,t){const n=Es(e),r=ys(t),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceparentData:n,dynamicSamplingContext:r||{},propagationContext:{traceId:o||oe(),parentSpanId:s||oe().substring(16),spanId:oe().substring(16),sampled:i,dsc:r||{}}}:{traceparentData:n,dynamicSamplingContext:void 0,propagationContext:{traceId:o||oe(),spanId:oe().substring(16)}}}function kh(e,t){const n=Es(e),r=ys(t),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceId:o||oe(),parentSpanId:s||oe().substring(16),spanId:oe().substring(16),sampled:i,dsc:r||{}}:{traceId:o||oe(),spanId:oe().substring(16)}}function Kd(e=oe(),t=oe().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}const ze=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Zt="production";function sr(){return fs("globalEventProcessors",()=>[])}function Bh(e){sr().push(e)}function Wt(e,t,n,r=0){return new Ee((o,s)=>{const i=e[r];if(t===null||typeof i!="function")o(t);else{const c=i({...t},n);ze&&i.id&&c===null&&we.log(`Event processor "${i.id}" dropped event`),nr(c)?c.then(u=>Wt(e,u,n,r+1).then(o)).then(null,s):Wt(e,c,n,r+1).then(o).then(null,s)}})}function bs(e){const t=or(),n={sid:oe(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Jd(n)};return e&&bt(n,e),n}function bt(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||or(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:oe()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Ss(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),bt(e,n)}function Jd(e){return xe({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}const Fh=0,qd=1;function Xd(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:o,parent_span_id:s,status:i,tags:c,origin:u}=ht(e);return xe({data:r,op:o,parent_span_id:s,span_id:t,status:i,tags:c,trace_id:n,origin:u})}function Vh(e){const{traceId:t,spanId:n}=e.spanContext(),r=Ds(e);return Kd(t,n,r)}function jh(e){return typeof e=="number"?ho(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ho(e.getTime()):or()}function ho(e){return e>9999999999?e/1e3:e}function ht(e){return Qd(e)?e.getSpanJSON():typeof e.toJSON=="function"?e.toJSON():{}}function Qd(e){return typeof e.getSpanJSON=="function"}function Ds(e){const{traceFlags:t}=e.spanContext();return!!(t&qd)}function zh(e,t,n,r,o,s){const{normalizeDepth:i=3,normalizeMaxBreadth:c=1e3}=e,u={...t,event_id:t.event_id||n.event_id||oe(),timestamp:t.timestamp||Qt()},d=n.integrations||e.integrations.map(P=>P.name);Zd(u,e),nl(u,d),t.type===void 0&&el(u,e.stackParser);const _=ol(r,n.captureContext);n.mechanism&&Md(u,n.mechanism);const f=o&&o.getEventProcessors?o.getEventProcessors():[],w=wl().getScopeData();if(s){const P=s.getScopeData();go(w,P)}if(_){const P=_.getScopeData();go(w,P)}const y=[...n.attachments||[],...w.attachments];y.length&&(n.attachments=y),Ts(u,w);const N=[...f,...sr(),...w.eventProcessors];return Wt(N,u,n).then(P=>(P&&tl(P),typeof i=="number"&&i>0?rl(P,i,c):P))}function Zd(e,t){const{environment:n,release:r,dist:o,maxValueLength:s=250}=t;"environment"in e||(e.environment="environment"in t?n:Zt),e.release===void 0&&r!==void 0&&(e.release=r),e.dist===void 0&&o!==void 0&&(e.dist=o),e.message&&(e.message=ut(e.message,s));const i=e.exception&&e.exception.values&&e.exception.values[0];i&&i.value&&(i.value=ut(i.value,s));const c=e.request;c&&c.url&&(c.url=ut(c.url,s))}const po=new WeakMap;function el(e,t){const n=me._sentryDebugIds;if(!n)return;let r;const o=po.get(t);o?r=o:(r=new Map,po.set(t,r));const s=Object.keys(n).reduce((i,c)=>{let u;const d=r.get(c);d?u=d:(u=t(c),r.set(c,u));for(let _=u.length-1;_>=0;_--){const f=u[_];if(f.filename){i[f.filename]=n[c];break}}return i},{});try{e.exception.values.forEach(i=>{i.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function tl(e){const t={};try{e.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:t[r]})})}function nl(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function rl(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:Ce(o.data,t,n)}}))},...e.user&&{user:Ce(e.user,t,n)},...e.contexts&&{contexts:Ce(e.contexts,t,n)},...e.extra&&{extra:Ce(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ce(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(o=>{const s=ht(o).data;return s&&(o.data=Ce(s,t,n)),o})),r}function ol(e,t){if(!t)return e;const n=e?e.clone():new Ie;return n.update(t),n}function sl(e){if(e)return il(e)?{captureContext:e}:cl(e)?{captureContext:e}:e}function il(e){return e instanceof Ie||typeof e=="function"}const al=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function cl(e){return Object.keys(e).some(t=>al.includes(t))}function Hh(e,t){return he().captureException(e,sl(t))}function Yh(e,t){const n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return he().captureMessage(e,n,r)}function Wh(e,t){return he().captureEvent(e,t)}function Gh(e){he().configureScope(e)}function Kh(e,t){he().addBreadcrumb(e,t)}function Jh(e,t){he().setContext(e,t)}function qh(e){he().setExtras(e)}function Xh(e,t){he().setExtra(e,t)}function Qh(e){he().setTags(e)}function Zh(e,t){he().setTag(e,t)}function ul(e){he().setUser(e)}function dl(...e){const t=he();if(e.length===2){const[n,r]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,r(n))):t.withScope(r)}return t.withScope(e[0])}function ep(e){return Sl(()=>e(tn()))}function tp(e,t){return dl(n=>(n.setSpan(e),t(n)))}function np(e,t){return he().startTransaction({...e},t)}async function rp(e){const t=Ke();return t?t.flush(e):(ze&&we.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function op(e){const t=Ke();return t?t.close(e):(ze&&we.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function sp(){return he().lastEventId()}function Ke(){return he().getClient()}function ip(){return!!Ke()}function en(){return he().getScope()}function ap(e){const t=Ke(),n=tn(),r=en(),{release:o,environment:s=Zt}=t&&t.getOptions()||{},{userAgent:i}=me.navigator||{},c=bs({release:o,environment:s,user:r.getUser()||n.getUser(),...i&&{userAgent:i},...e}),u=n.getSession();return u&&u.status==="ok"&&bt(u,{status:"exited"}),Is(),n.setSession(c),r.setSession(c),c}function Is(){const e=tn(),t=en(),n=t.getSession()||e.getSession();n&&Ss(n),As(),e.setSession(),t.setSession()}function As(){const e=tn(),t=en(),n=Ke(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function cp(e=!1){if(e){Is();return}As()}function Ns(e){return e.transaction}function ll(e,t,n){const r=t.getOptions(),{publicKey:o}=t.getDsn()||{},{segment:s}=n&&n.getUser()||{},i=xe({environment:r.environment||Zt,release:r.release,user_segment:s,public_key:o,trace_id:e});return t.emit&&t.emit("createDsc",i),i}function fl(e){const t=Ke();if(!t)return{};const n=ll(ht(e).trace_id||"",t,en()),r=Ns(e);if(!r)return n;const o=r&&r._frozenDynamicSamplingContext;if(o)return o;const{sampleRate:s,source:i}=r.metadata;s!=null&&(n.sample_rate=`${s}`);const c=ht(r);return i&&i!=="url"&&(n.transaction=c.description),n.sampled=String(Ds(r)),t.emit&&t.emit("createDsc",n),n}function Ts(e,t){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=t;hl(e,t),r&&_l(e,r),ml(e,n),pl(e,o),gl(e,s)}function go(e,t){const{extra:n,tags:r,user:o,contexts:s,level:i,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:_,attachments:f,propagationContext:w,transactionName:y,span:N}=t;rt(e,"extra",n),rt(e,"tags",r),rt(e,"user",o),rt(e,"contexts",s),rt(e,"sdkProcessingMetadata",c),i&&(e.level=i),y&&(e.transactionName=y),N&&(e.span=N),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),_.length&&(e.eventProcessors=[...e.eventProcessors,..._]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...w}}function rt(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}function hl(e,t){const{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:c}=t,u=xe(n);u&&Object.keys(u).length&&(e.extra={...u,...e.extra});const d=xe(r);d&&Object.keys(d).length&&(e.tags={...d,...e.tags});const _=xe(o);_&&Object.keys(_).length&&(e.user={..._,...e.user});const f=xe(s);f&&Object.keys(f).length&&(e.contexts={...f,...e.contexts}),i&&(e.level=i),c&&(e.transaction=c)}function pl(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function gl(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function _l(e,t){e.contexts={trace:Xd(t),...e.contexts};const n=Ns(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:fl(t),...e.sdkProcessingMetadata};const r=ht(n).description;r&&(e.tags={transaction:r,...e.tags})}}function ml(e,t){e.fingerprint=e.fingerprint?$d(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}const vl=100;let Tn;class Ie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=_o()}static clone(t){return t?t.clone():new Ie}clone(){const t=new Ie;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._span=this._span,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t}setClient(t){this._client=t}getClient(){return this._client}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&bt(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this._span;return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t;if(n instanceof Ie){const r=n.getScopeData();this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&Object.keys(r.user).length&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint.length&&(this._fingerprint=r.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),r.propagationContext&&(this._propagationContext=r.propagationContext)}else if(tr(n)){const r=t;this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint&&(this._fingerprint=r.fingerprint),r.requestSession&&(this._requestSession=r.requestSession),r.propagationContext&&(this._propagationContext=r.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=_o(),this}addBreadcrumb(t,n){const r=typeof n=="number"?n:vl;if(r<=0)return this;const o={timestamp:Qt(),...t},s=this._breadcrumbs;return s.push(o),this._breadcrumbs=s.length>r?s.slice(-r):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:t,_attachments:n,_contexts:r,_tags:o,_extra:s,_user:i,_level:c,_fingerprint:u,_eventProcessors:d,_propagationContext:_,_sdkProcessingMetadata:f,_transactionName:w,_span:y}=this;return{breadcrumbs:t,attachments:n,contexts:r,tags:o,extra:s,user:i,level:c,fingerprint:u||[],eventProcessors:d,propagationContext:_,sdkProcessingMetadata:f,transactionName:w,span:y}}applyToEvent(t,n={},r=[]){Ts(t,this.getScopeData());const o=[...r,...sr(),...this._eventProcessors];return Wt(o,t,n)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=n&&n.event_id?n.event_id:oe();if(!this._client)return we.warn("No client configured on scope - will not capture exception!"),r;const o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureMessage(t,n,r){const o=r&&r.event_id?r.event_id:oe();if(!this._client)return we.warn("No client configured on scope - will not capture message!"),o;const s=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:s,...r,event_id:o},this),o}captureEvent(t,n){const r=n&&n.event_id?n.event_id:oe();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(we.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function wl(){return Tn||(Tn=new Ie),Tn}function _o(){return{traceId:oe(),spanId:oe().substring(16)}}const yl="7.120.3",Os=parseFloat(yl),El=100;class Cs{constructor(t,n,r,o=Os){this._version=o;let s;n?s=n:(s=new Ie,s.setClient(t));let i;r?i=r:(i=new Ie,i.setClient(t)),this._stack=[{scope:s}],t&&this.bindClient(t),this._isolationScope=i}isOlderThan(t){return this._version<t}bindClient(t){const n=this.getStackTop();n.client=t,n.scope.setClient(t),t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(t){const n=this.pushScope();let r;try{r=t(n)}catch(o){throw this.popScope(),o}return nr(r)?r.then(o=>(this.popScope(),o),o=>{throw this.popScope(),o}):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:oe(),o=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:o,...n,event_id:r}),r}captureMessage(t,n,r){const o=this._lastEventId=r&&r.event_id?r.event_id:oe(),s=new Error(t);return this.getScope().captureMessage(t,n,{originalException:t,syntheticException:s,...r,event_id:o}),o}captureEvent(t,n){const r=n&&n.event_id?n.event_id:oe();return t.type||(this._lastEventId=r),this.getScope().captureEvent(t,{...n,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(t,n){const{scope:r,client:o}=this.getStackTop();if(!o)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=El}=o.getOptions&&o.getOptions()||{};if(i<=0)return;const u={timestamp:Qt(),...t},d=s?hs(()=>s(u,n)):u;d!==null&&(o.emit&&o.emit("beforeAddBreadcrumb",d,n),r.addBreadcrumb(d,i))}setUser(t){this.getScope().setUser(t),this.getIsolationScope().setUser(t)}setTags(t){this.getScope().setTags(t),this.getIsolationScope().setTags(t)}setExtras(t){this.getScope().setExtras(t),this.getIsolationScope().setExtras(t)}setTag(t,n){this.getScope().setTag(t,n),this.getIsolationScope().setTag(t,n)}setExtra(t,n){this.getScope().setExtra(t,n),this.getIsolationScope().setExtra(t,n)}setContext(t,n){this.getScope().setContext(t,n),this.getIsolationScope().setContext(t,n)}configureScope(t){const{scope:n,client:r}=this.getStackTop();r&&t(n)}run(t){const n=mo(this);try{t(this)}finally{mo(n)}}getIntegration(t){const n=this.getClient();if(!n)return null;try{return n.getIntegration(t)}catch{return ze&&we.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,n){const r=this._callExtensionMethod("startTransaction",t,n);return ze&&!r&&(this.getClient()?we.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
9
- Sentry.addTracingExtensions();
10
- Sentry.init({...});
11
- `):we.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Ss(r),this._sendSessionUpdate(),n.setSession()}startSession(t){const{scope:n,client:r}=this.getStackTop(),{release:o,environment:s=Zt}=r&&r.getOptions()||{},{userAgent:i}=me.navigator||{},c=bs({release:o,environment:s,user:n.getUser(),...i&&{userAgent:i},...t}),u=n.getSession&&n.getSession();return u&&u.status==="ok"&&bt(u,{status:"exited"}),this.endSession(),n.setSession(c),c}shouldSendDefaultPii(){const t=this.getClient(),n=t&&t.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:n}=this.getStackTop(),r=t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(t,...n){const o=St().__SENTRY__;if(o&&o.extensions&&typeof o.extensions[t]=="function")return o.extensions[t].apply(this,n);ze&&we.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function St(){return me.__SENTRY__=me.__SENTRY__||{extensions:{},hub:void 0},me}function mo(e){const t=St(),n=Fn(t);return Ls(t,e),n}function he(){const e=St();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return bl(e)}function tn(){return he().getIsolationScope()}function bl(e=St()){return(!Dl(e)||Fn(e).isOlderThan(Os))&&Ls(e,new Cs),Fn(e)}function Sl(e,t={}){const n=St();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(e,t):e()}function Dl(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function Fn(e){return fs("hub",()=>new Cs,e)}function Ls(e,t){if(!e)return!1;const n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}const Il=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",Al=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",Nl=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",ke={},Tl=Symbol((ke?"production":void 0)!=="production"?"RESET":""),Rs=e=>typeof(e==null?void 0:e.then)=="function";function Ol(e=()=>{try{return window.localStorage}catch(n){(ke?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},t){var n;let r,o;const s={getItem:(u,d)=>{var _,f;const w=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return d}r=N}return o},y=(f=(_=e())==null?void 0:_.getItem(u))!=null?f:null;return Rs(y)?y.then(w):w(y)},setItem:(u,d)=>{var _;return(_=e())==null?void 0:_.setItem(u,JSON.stringify(d,void 0))},removeItem:u=>{var d;return(d=e())==null?void 0:d.removeItem(u)}},i=u=>(d,_,f)=>u(d,w=>{let y;try{y=JSON.parse(w||"")}catch{y=f}_(y)});let c;try{c=(n=e())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(u,d)=>{if(!(e()instanceof window.Storage))return()=>{};const _=f=>{f.storageArea===e()&&f.key===u&&d(f.newValue)};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}),c&&(s.subscribe=i(c)),s}const Cl=Ol();function Ps(e,t,n=Cl,r){const o=ue(t);return(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0),o.onMount=i=>{i(n.getItem(e,t));let c;return n.subscribe&&(c=n.subscribe(e,i,t)),c},ue(i=>i(o),(i,c,u)=>{const d=typeof u=="function"?u(i(o)):u;return d===Tl?(c(o,t),n.removeItem(e)):Rs(d)?d.then(_=>(c(o,_),n.setItem(e,_))):(c(o,d),n.setItem(e,d))})}const On=new WeakMap,Ll=(e,t)=>(On.has(t)?On:On.set(t,e())).get(t),Rl=e=>typeof(e==null?void 0:e.then)=="function",vo={state:"loading"};function up(e){return Ll(()=>{const t=new WeakMap,n=ue(0);(ke?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=ue((o,{setSelf:s})=>{o(n);let i;try{i=o(e)}catch(_){return{state:"hasError",error:_}}if(!Rl(i))return{state:"hasData",data:i};const c=i,u=t.get(c);if(u)return u;c.then(_=>{t.set(c,{state:"hasData",data:_}),s()},_=>{t.set(c,{state:"hasError",error:_}),s()});const d=t.get(c);return d||(t.set(c,vo),vo)},(o,s)=>{s(n,i=>i+1)});return(ke?"production":void 0)!=="production"&&(r.debugPrivate=!0),ue(o=>o(r))},e)}const wo=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),Pl=new WeakMap,xl=(e,t,n)=>{const r=wo(()=>new WeakMap,Pl,t);return wo(e,r,n)},Ml=e=>typeof(e==null?void 0:e.then)=="function",$l=()=>{};function Ul(e,t=$l){return xl(()=>{const n=new WeakMap,r=new WeakMap,o=ue(0);(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=ue((i,{setSelf:c})=>{i(o);const u=i(s),d=i(e);if(!Ml(d))return{v:d};if(d!==(u==null?void 0:u.p)&&d.then(_=>{r.set(d,_),c()},_=>{n.set(d,_),c()}),n.has(d))throw n.get(d);return r.has(d)?{p:d,v:r.get(d)}:u&&"v"in u?{p:d,f:t(u.v),v:u.v}:{p:d,f:t()}},(i,c)=>{c(o,u=>u+1)});return s.init=void 0,(ke?"production":void 0)!=="production"&&(s.debugPrivate=!0),ue(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...u)=>c(e,...u))},e,t)}function kl(e){const t=ue(void 0);return delete t.init,Object.defineProperty(t,"init",{get(){return e()}}),t}const Bl=gt.routerBasename+"external-packages.js",Fl=window.__VITE_ENVS.PROD;async function Vl(){try{return Fl?(await import(Bl)).default??[]:[]}catch(e){return console.error(e),[]}}const xs=ue(async()=>typeof await qt()<"u");xs.debugLabel="hmrAvailableAtom";const dp=()=>Oe(xs),Dt=kl(Vl);Dt.debugLabel="externalPackagesAtomInConnect";let yo;Dt.onMount=e=>{yo||(yo=gd(t=>{e(t)}))};const jl=()=>Oe(Dt),zl={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},Ms=ue(async e=>{const t=await e(Dt);return[zl,...t.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]});Ms.debugLabel="appsAtomInConnect";const Hl=()=>Oe(Ms),lp=()=>{const e=Hl();return J(t=>{if(!t)return;const n=e.find(r=>r.driveEditor===t);return n==null?void 0:n.name},[e])},fp=e=>{const t=jl();return pt(()=>{if(!e)return;const n=t.find(r=>{var o;return(o=r.manifest.apps)==null?void 0:o.find(s=>s.driveEditor===e)});return n==null?void 0:n.editors.find(r=>r.config.id===e)},[t,e])};let Pt;async function Yl(){const{ConnectCrypto:e}=await Te(async()=>{const{ConnectCrypto:r}=await import("./index.D4rIKeA_.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),{BrowserKeyStorage:t}=await Te(async()=>{const{BrowserKeyStorage:r}=await import("./index.D4rIKeA_.js");return{BrowserKeyStorage:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),n=new e(new t);return await n.did(),n}function Re(){return window.connectCrypto?Promise.resolve(window.connectCrypto):Pt||(Pt=Yl(),Pt)}function ir(){return pt(()=>({async regenerateDid(){return(await Re()).regenerateDid()},async did(){return(await Re()).did()},sign:async e=>await(await Re()).sign(e),async getIssuer(){return(await Re()).getIssuer()},async getBearerToken(e,t,n=!1){return(await Re()).getBearerToken(e,t,n)}}),[])}const $s=ue(void 0);$s.debugLabel="didAtomInConnect";function Wl(){const[e,t]=$e($s);return ae(()=>{e||Re().then(n=>n.did()).then(n=>t(n)).catch(te.error)}),e}const Us=ue("idle");Us.debugLabel="renownStatusAtomInConnect";const ks=ue(window.renown?Promise.resolve(window.renown):void 0);ks.debugLabel="renownAtomInConnect";function nn(){const[e,t]=$e(ks),[n,r]=$e(Us),{did:o}=ir();async function s(i){r("loading");try{const c=await i();if(!c){r("error");return}const{initRenownBrowser:u}=await Te(async()=>{const{initRenownBrowser:f}=await import("./index.CupF3yfn.js").then(w=>w.b);return{initRenownBrowser:f}},__vite__mapDeps([2,1]),import.meta.url),d=u(c),_={user:function(){return Promise.resolve(d.user)},login:function(f){return d.login(f)},logout(){return Promise.resolve(d.logout())},on:{user(f){return d.on("user",f)}}};return r("finished"),_}catch(c){console.error("Error initializing renown:",c instanceof Error?c.message:"Unknown error"),r("error");return}}return!e&&n==="idle"&&t(s(o)),e}function Gl(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const Eo={};function Vn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Eo[t[0]]||(typeof t[0]=="string"&&(Eo[t[0]]=new Date),Gl(...t))}const Bs=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function bo(e,t,n){e.loadNamespaces(t,Bs(e,n))}function So(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,Bs(e,r))}function Kl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],o=t.options?t.options.fallbackLng:!1,s=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(c,u)=>{const d=t.services.backendConnector.state[`${c}|${u}`];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!i(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||i(r,e)&&(!o||i(s,e)))}function Jl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Vn("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(o,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,e))return!1}}):Kl(e,t,n)}const ql=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Xl={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Ql=e=>Xl[e],Zl=e=>e.replace(ql,Ql);let jn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Zl};function hp(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jn={...jn,...e}}function ef(){return jn}let Fs;function pp(e){Fs=e}function tf(){return Fs}const nf=Hn();class rf{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const of=(e,t)=>{const n=Me();return ae(()=>{n.current=e},[e,t]),n.current};function Vs(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:o}=Yn(nf)||{},s=n||r||tf();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new rf),!s){Vn("You will need to pass in an i18next instance by using initReactI18next");const k=(O,B)=>typeof B=="string"?B:B&&typeof B=="object"&&typeof B.defaultValue=="string"?B.defaultValue:Array.isArray(O)?O[O.length-1]:O,Y=[k,{},!1];return Y.t=k,Y.i18n={},Y.ready=!1,Y}s.options.react&&s.options.react.wait!==void 0&&Vn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...ef(),...s.options.react,...t},{useSuspense:c,keyPrefix:u}=i;let d=o||s.options&&s.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(d);const _=(s.isInitialized||s.initializedStoreOnce)&&d.every(k=>Jl(k,s,i));function f(){return s.getFixedT(t.lng||null,i.nsMode==="fallback"?d:d[0],u)}const[w,y]=He(f);let N=d.join();t.lng&&(N=`${t.lng}${N}`);const F=of(N),P=Me(!0);ae(()=>{const{bindI18n:k,bindI18nStore:Y}=i;P.current=!0,!_&&!c&&(t.lng?So(s,t.lng,d,()=>{P.current&&y(f)}):bo(s,d,()=>{P.current&&y(f)})),_&&F&&F!==N&&P.current&&y(f);function O(){P.current&&y(f)}return k&&s&&s.on(k,O),Y&&s&&s.store.on(Y,O),()=>{P.current=!1,k&&s&&k.split(" ").forEach(B=>s.off(B,O)),Y&&s&&Y.split(" ").forEach(B=>s.store.off(B,O))}},[s,N]);const V=Me(!0);ae(()=>{P.current&&!V.current&&y(f),V.current=!1},[s,u]);const z=[w,s,_];if(z.t=w,z.i18n=s,z.ready=_,_||!_&&!c)return z;throw new Promise(k=>{t.lng?So(s,t.lng,d,()=>k()):bo(s,d,()=>k())})}const sf="connect";function Cn(e,t){const{type:n="default",containerId:r=sf,...o}=t||{};return ia(e,{type:n,containerId:r,...o})}const Pe=gt.routerBasename,af=(e,t,n,r)=>{const o=Ps(`${Pe}:${e}`,t,void 0);return o.debugLabel=`storageAtom:${Pe}:${e}`,o},gp=(e,t,n)=>{const r=Ps(e,t,{getItem(o,s){const i=localStorage.getItem(`${Pe}:${o}`);return i?JSON.parse(i):s},setItem(o,s){localStorage.setItem(`${Pe}:${o}`,JSON.stringify(s)),n(s)},removeItem(o){localStorage.removeItem(`${Pe}:${o}`)},subscribe(o,s){if(typeof window.addEventListener>"u")return()=>null;function i(c){c.storageArea===localStorage&&c.key===`${Pe}:${o}`&&s(c.newValue??"")}return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)}});return r.debugLabel=`storageAtomWithCallback:${Pe}:${e}`,r},cf=[aa,ca],uf=cf;function df(...e){const t=new Map;for(const n of e)t.set(n.documentModel.id,n);return Array.from(t.values())}function lf(e){return e.map(t=>t.documentModels).reduce((t,n)=>t.concat(n),[])}const ar=ue(async e=>{const t=await e(Dt),n=lf(t);return df(...uf,...n)});ar.debugLabel="documentModelsAtomInConnect";const js=Ul(ar);js.debugLabel="unwrappedDocumentModelsAtomInConnect";const zs=()=>Oe(js);function ff(e,t){return t==null?void 0:t.find(n=>n.documentModel.id===e)}const hf=()=>{const e=zs();return t=>ff(t,e)},_p=()=>{const e=zs(),{config:t}=Pf(),{enabledEditors:n,disabledEditors:r}=t.editors;if(!e)return;const o=e.filter(s=>s.documentModel.id!=="powerhouse/document-drive");return n==="*"?e:r==="*"?[]:r?o.filter(s=>!r.includes(s.documentModel.id)):n?o.filter(s=>n.includes(s.documentModel.id)):o};async function pf(e,t){await _f(e,t);const n=await e.initialize(),r=n==null?void 0:n.at(0);if(r)throw r}function gf(){const e=gt.drives.sections.LOCAL.enabled,t=We(),n=Et(),r=Me(!1);ae(()=>{r.current||e&&t!==void 0&&n!==void 0&&(n.length>0||(t.addDrive({id:Le(),slug:"my-local-drive",global:{name:"My Local Drive",icon:null},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(te.error),r.current=!0))},[e,t,n])}async function _f(e,t){const n=await(t==null?void 0:t.user()),r=await Re();n!=null&&n.address&&e.setGenerateJwtHandler(async o=>r.getBearerToken(o,n.address))}async function mf(e,t,n){const r=fd(t,e);return await pf(r,n),r}const cr=ue(ld(gt.routerBasename));cr.debugLabel="storageAtomInConnect";const vf=()=>Oe(cr);let xt=!1;const Hs=ue(void 0);Hs.debugLabel="userAtomInConnect";const Ys=()=>{const[e,t]=$e(Hs),n=nn();return ae(()=>{var o;let r=null;if(e){const{credential:s,...i}=e;r={id:i.did,username:(o=i.ens)==null?void 0:o.name,...i}}ul(r)},[e]),ae(()=>{if(xt)return;xt=!0,n==null||n.user().then(o=>{t(o||null)}).catch(()=>{t(null)});const r=n==null?void 0:n.on.user(o=>{t(o||null)});return()=>{r==null||r(),xt=!1}},[n,xt]),e};async function Do(e,t){if(!e)return;const n=e.split("/");n.pop(),n.pop(),n.push("drives");const r=n.join("/");return(await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
12
- query getDriveIdBySlug($slug: String!) {
13
- driveIdBySlug(slug: $slug)
14
- }
15
- `,variables:{slug:t}})})).json()).data.driveIdBySlug}function wf(e){return e.split("/").pop()}function yf(e){const t=e.split("/");return t.pop(),t.pop(),t.push("graphql"),t.join("/")}function Ef(e){const t=la(e,"document");return`query getDocument($documentId: PHID!, $driveId: String) {
16
- ${e.name} {
17
- getDocument(docId: $documentId, driveId: $driveId) {
18
- id
19
- created
20
- lastModified
21
- name
22
- revision
23
- state {
24
- ${t}
25
- }
26
- }
27
- }
28
- }`}function bf(e,t,n){const r=wf(e),o=Ef(n),s={documentId:t,driveId:r};return da.compressToEncodedURIComponent(JSON.stringify({document:o.trim(),variables:JSON.stringify(s,null,2)}))}function mp(e,t,n){const r=yf(e),o=ua(n.name),s=bf(e,t,n);return`${r}/${o}?explorerURLState=${s}`}const Sf=()=>{const{t:e}=Vs();return kt("div",{children:[ye("p",{className:"font-medium",children:e("notifications.reloadApp")}),kt("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[e("common.reloadConnect")," 🔄"]})]})},Ws=ue("initial");Ws.debugLabel="loginStatusAtomInConnect";const Df=()=>{const[e,t]=$e(Ws),n=Ys(),r=nn(),{did:o,getBearerToken:s}=ir(),i=We(),c=J(async()=>{var w;const _=await o(),f=new URL(Il);if(f.searchParams.set("connect",_),f.searchParams.set("network",Al),f.searchParams.set("chain",Nl),window.electronAPI){const y=await window.electronAPI.protocol();f.searchParams.set("deeplink",y),await window.electronAPI.openURL(f.toString())}else{const y=new URL(window.location.pathname,window.location.origin);f.searchParams.set("returnUrl",y.toJSON()),(w=window.open(f,"_self"))==null||w.focus()}},[o]),u=J(async _=>{if(r)try{t("checking");const f=await r.user();if((f==null?void 0:f.did)===_)return t("authorized"),f;const w=await r.login(_);if(w)return t("authorized"),i==null||i.setGenerateJwtHandler(async y=>s(y,w.address)),w;t("not-authorized")}catch(f){t("not-authorized"),te.error(f)}},[r,i,s]);ae(()=>{n&&e!=="authorized"&&t("authorized")},[n,e]);const d=J(async()=>{t("initial"),await(r==null?void 0:r.logout()),i==null||i.removeJwtHandler()},[r,i]);return pt(()=>({openRenown:c,user:n,status:n?"authorized":e,login:r?u:void 0,logout:d}),[r,c,n,e,u,d])};function If(){const{user:e,status:t}=Df(),n=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,r=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,o=!!n&&n!=="",s=!!r&&r!=="";if(o&&s)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!o&&!s)return{isAllowed:!0,allowListType:"none"};if(e!==void 0){if(o){const i=n.split(",");return t!=="authorized"||!e?{isAllowed:!1,allowListType:"arbitrum"}:i.includes(e.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(s){const i=r.split(",");return t!=="authorized"||!e?{isAllowed:!1,allowListType:"rwa"}:i.includes(e.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function Af(){const e=If();if(!e)return;const{allowListType:t,isAllowed:n}=e;return t==="arbitrum"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:!0}:t==="rwa"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:n}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function Io(e,t){const n={};for(const i of Object.keys(e))n[i]=new Set(e[i].map(c=>c.index));const r=[];for(const i of t){const c=i.scope,u=i.index;if(n[c].has(u)){const d=e[c].find(f=>f.index===u),_=r.find(f=>f.index===u);console.warn("skipping duplicate operation"),d&&console.warn("duplicate existing operation",d),_&&console.warn("duplicate new operation",_);continue}r.push(i),n[c].add(u)}const o=new Set,s=[];for(const[i,c]of Object.entries(e))for(const u of c){const d=u.hash;if(o.has(d)){console.warn("skipping existing operation with duplicate hash in scope",i,u);continue}o.add(d)}for(const i of r){const c=i.hash;if(o.has(c)){console.warn("skipping new operation with duplicate hash in scope",i.scope,i);continue}o.add(c),s.push(i)}return s}function Gs(){const e=zn(["useDocumentDriveServer",Math.floor(Math.random()*999).toString()]),{isAllowedToCreateDocuments:t}=Af()||{isAllowedToCreateDocuments:!1},n=Ys()||void 0,r=Wl(),{sign:o}=ir(),s=We(),i=vf(),c=hf(),u=Et(),d=ts(),_=J(async(x,M)=>s?await s.getDocument(x,M):void 0,[s]),f=J(async(x,M)=>{if(!s)return;const $=u==null?void 0:u.find(de=>de.header.id===x);if(!$)return;const G={...$},W=Lr($,pd(M,r,n)),se=M.scope,le=W.operations[se].findLast(de=>de.type===M.type);if(!le)throw new Error("There was an error applying the operation");const be=await hd(le,o,x,G,Lr,n);try{const de=await s.queueOperation(x,be);return de.status!=="SUCCESS"&&e.error(de.error),de.document}catch(de){return e.error(de),$}},[s,u,o,n,r]),w=J(async(x,M)=>{if(!s)return;const $=await s.getDrive(x),G=Io($.operations,M),W=await s.queueOperations(x,G);return W.status!=="SUCCESS"&&e.error(W.error),W.document},[s]),y=J(async(x,M)=>{if(!s)return;const $=await s.getDocument(x),G=Io($.operations,M),W=await s.queueOperations(x,G);return W.status!=="SUCCESS"&&e.error(W.error),W.document},[s]),N=J(async(x,M,$,G,W,se)=>{if(!s)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create documents");if(!(u==null?void 0:u.find(Qe=>Qe.header.id===x)))return;const le=se??Le(),be=c($);if(!be)throw new Error(`Document model module for type ${$} not found`);const de=be.utils.createDocument({...W});de.header=fa(le,$),de.header.name=M,await s.addDocument(de);const Je=ha({id:le,name:M,documentType:$,parentFolder:G??null}),qe=await f(x,Je),Xe=qe==null?void 0:qe.state.global.nodes.find(Qe=>Qe.id===le);if(!Xe||!Rr(Xe))throw new Error("There was an error adding document");return Xe},[f,u,t]),F=J(async(x,M,$,G)=>{if(e.verbose(`addFile(drive: ${M}, name: ${$}, folder: ${G})`),!s)return;if(!t)throw new Error("User is not allowed to create files");const W=await id(x,c),se={header:W.header,history:W.history,initialState:W.initialState,state:W.initialState.state,operations:{global:[],local:[]},clipboard:[]},ge=await N(M,$||(typeof x=="string"?W.header.name:x.name),W.header.documentType,G,se);if(!ge)throw new Error("There was an error adding file");u==null||u.find(le=>le.header.id===M),od(ge.id,W,y,{}).catch(le=>{throw le})},[N,y,c,u,t,s]),P=J(async(x,M,$,G,W)=>{if(!t)throw new Error("User is not allowed to update files");const se=await f(x,pa({id:M,name:G||void 0,parentFolder:W,documentType:$})),ge=se==null?void 0:se.state.global.nodes.find(le=>le.id===M);if(!ge||!Rr(ge))throw new Error("There was an error updating document");return ge},[f,t]),V=J(async(x,M,$)=>{if(!t)throw new Error("User is not allowed to create folders");const G=Le(),W=await f(x,ga({id:G,name:M,parentFolder:$})),se=W==null?void 0:W.state.global.nodes.find(ge=>ge.id===G);if(!se||!_a(se))throw new Error("There was an error adding folder");return se},[f,t]),z=J(async(x,M)=>{if(!t)throw new Error("User is not allowed to delete documents");await f(x,ma({id:M}))},[f,t]),k=J(async(x,M,$)=>{if(!t)throw new Error("User is not allowed to rename documents");const G=await f(x,va({id:M,name:$})),W=G==null?void 0:G.state.global.nodes.find(se=>se.id===M);if(!W)throw new Error("There was an error renaming node");return W},[f,t]),Y=J(async(x,M)=>{if(!t)throw new Error("User is not allowed to move documents");d!=null&&d.header.id&&await f(d.header.id,wa({srcFolder:x.id,targetParentFolder:M==null?void 0:M.id}))},[f,t,d==null?void 0:d.header.id]),O=J(async(x,M)=>{if(!s||!d)return;if(!t)throw new Error("User is not allowed to copy documents");const G=ya({srcId:x.id,targetParentFolder:M==null?void 0:M.id,targetName:x.name},()=>Le(),d.state.global.nodes).map(se=>Ea(se)),W=await s.addActions(d.header.id,G);return W.status!=="SUCCESS"&&e.error(`Error copying files: ${W.status}`,W.error),W.document},[t,s,d]),B=J(async(x,M)=>{if(!s)return;if(!t)throw new Error("User is not allowed to create drives");const $=x.id||Le(),G=ba(x);return await s.addDrive({global:G.global,local:G.local,id:$},M)},[t,s]),v=J(async(x,M)=>s?await s.addRemoteDrive(x,M):void 0,[t,s]),A=J(async x=>{if(s){if(!t)throw new Error("User is not allowed to delete drives");await s.deleteDrive(x)}},[t,s]),S=J(async(x,M)=>{if(!t)throw new Error("User is not allowed to rename drives");return await f(x,Sa({name:M}))},[f,t]),D=J(async(x,M)=>{if(!t)throw new Error("User is not allowed to change drive availability");return await f(x,Da({availableOffline:M}))},[f,t]),b=J(async(x,M)=>{if(!t)throw new Error("User is not allowed to change drive availability");return await f(x,Ia({type:M}))},[f,t]),I=J(async(x,M)=>{if(M!==dt&&s)try{const $=s.getSyncStatus(x);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Ln}},[s]),H=J((x,M)=>{if(M!==dt&&s)try{const $=s.getSyncStatus(x);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Ln}},[s]),K=J(async()=>{s&&await i.clear()},[s,i]),re=J(async(x,M)=>{const $=await f(x,Aa({triggerId:M}));if($==null?void 0:$.state.local.triggers.find(W=>W.id===M))throw new Error(`There was an error removing trigger ${M}`)},[f]),pe=J(async(x,M,$)=>{var ge,le,be,de;if(!s)return;const G=Le(),W={driveId:x,listenerId:G,block:!1,filter:{branch:((ge=$.pullFilter)==null?void 0:ge.branch)??[],documentId:((le=$.pullFilter)==null?void 0:le.documentId)??[],documentType:((be=$.pullFilter)==null?void 0:be.documentType)??[],scope:((de=$.pullFilter)==null?void 0:de.scope)??[]},system:!1,label:`Pullresponder #${G}`,callInfo:{data:"",name:"PullResponder",transmitterType:"PullResponder"}},se=s.listeners;W.transmitter=new Na(W,se);try{await se.setListener(x,W)}catch(Je){throw new Error(`Listener couldn't be registered: ${Je}`)}return{driveId:x,filter:W.filter,data:{interval:`${$.pullInterval}`||"1000",listenerId:G,url:M},id:G,type:"PullResponder"}},[s]),j=J(async(x,M)=>{const $=await f(x,Ta({trigger:M}));if(!($==null?void 0:$.state.local.triggers.find(W=>W.id===W.id)))throw new Error(`There was an error adding the trigger ${M.id}`)},[f]);return pt(()=>({addDocument:N,addDocumentOperations:y,addDriveOperation:f,addDriveOperations:w,addFile:F,addFolder:V,openFile:_,updateFile:P,deleteNode:z,renameNode:k,moveNode:Y,copyNode:O,addDrive:B,addRemoteDrive:v,deleteDrive:A,renameDrive:S,setDriveAvailableOffline:D,setDriveSharingType:b,getSyncStatus:I,getSyncStatusSync:H,clearStorage:K,removeTrigger:re,addTrigger:j,registerNewPullResponderTrigger:pe}),[N,y,f,w,F,V,_,P,z,k,Y,O,B,v,A,S,D,b,I,H,K,re,j,pe])}const Nf=1e5,Tf=(e,t)=>t?e.toLocaleLowerCase().includes(`transmitter ${t} not found`):!1,Of=()=>{const[e,t]=He([]),[n,r]=He(new Map),{addTrigger:o,removeTrigger:s,registerNewPullResponderTrigger:i,renameDrive:c,addRemoteDrive:u,setDriveSharingType:d}=Gs(),_=Et(),f=Me(new Map),w=J(async(F,P,V)=>{t(k=>[...k,V]);const z=P.data;if(z)try{let k=n.get(V);if(!k){if(k=await i(F,z.url,{pullInterval:Number(z.interval)||3e3}),!k)return;n.set(V,k),r(n)}await s(F,P.id),await o(F,k),f.current.delete(V)}catch(k){const Y=f.current.get(V)||1;f.current.set(V,Y===Nf?Y:Y*10),te.error(k)}finally{t(k=>k.filter(Y=>Y!==V))}},[n,s,o,f,i]),y=J(async(F,P,V)=>{var z;t(k=>[...k,V]);try{const k=_==null?void 0:_.find(Y=>Y.header.id===F);if(!k)return;if(await s(F,P.id),await c(F,k.state.global.name+` (${k.header.id})`),await d(F,dt),(z=P.data)!=null&&z.url&&k.header.slug){const Y=await Do(P.data.url,k.header.slug);if(Y){const O=P.data.url.split("/");O[O.length-1]=Y;const B=O.join("/");await u(B,{availableOffline:!0,sharingType:"PUBLIC",listeners:[],triggers:[]})}}}catch(k){te.error(k)}finally{t(k=>k.filter(Y=>Y!==V))}},[_,s,c,d,Do,u]),N=J(async(F,P,V,z)=>{var k;switch(V){case 400:{if(Tf(z,(k=P.data)==null?void 0:k.listenerId)){if(!(localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false"))return;const O=`strands:${F}:${V}`;if(e.includes(O)||!P.data)return;const B=f.current.get(O)||0;setTimeout(()=>w(F,P,O),B)}break}case 404:{const Y=`strands:${F}:${V}`;if(e.includes(Y))return;setTimeout(()=>y(F,P,Y),0);break}}},[y,w,e]);return pt(()=>({strandsErrorHandler:N}),[N])},Cf="feature-flags-config",$t=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,Lf=$t==null?void 0:$t.split(","),Ut=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||"powerhouse/document-drive",Rf=Ut==null?void 0:Ut.split(","),Ks={editors:{enabledEditors:$t==="*"?"*":Lf,disabledEditors:Ut==="*"?"*":Rf}},Js=af(Cf,Ks);Js.debugLabel="featureFlagAtomInConnect";const Pf=()=>{const[e,t]=$e(Js);return{config:{...Ks,...e},setConfig:t}},Ao=window.__VITE_ENVS.APP_VERSION,vp=window.navigator.userAgent.includes("Electron"),wp=window.navigator.appVersion.includes("Mac"),No={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},xf=()=>{const e="https://raw.githubusercontent.com/powerhouse-inc/connect",t=window.location.href,n=Object.keys(No).find(o=>t.includes(o)),r=n?No[n]:void 0;if(r)return`${e}/${r}/package.json`},Mf=async()=>{const e=xf();if(!e)return;const n=await(await fetch(e)).json(),{version:r}=n;return r},$f=async()=>{const e=await Mf();return e?{isLatest:e===Ao,currentVersion:Ao,latestVersion:e}:null},Uf=()=>{const{t:e}=Vs(),{getSyncStatusSync:t}=Gs(),n=Me([]),r=Et();Of();const[o]=Fc();async function s(){const c=await $f();if(c!==null){if(c.isLatest||c.currentVersion.includes("-"))return!0;window.__VITE_ENVS.MODE==="development"||o.studioMode||!o.warnOutdatedApp?te.warn(`Connect is outdated:
29
- Current: ${c.currentVersion}
30
- Latest: ${c.latestVersion}`):Cn(ye(Sf,{}),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}ae(()=>{s().catch(console.error)},[]);const i=J(async(c,u)=>{c.forEach(d=>{const _=n.current.find(N=>N.header.id===d.header.id);if(!_)return;const f=$n(d),w=t(_.header.id,f),y=t(d.header.id,f);if(f!==dt&&y===Oa&&n.current.includes(d))return n.current=n.current.filter(N=>N.header.id!==d.header.id),Cn(u("notifications.driveSyncSuccess"),{type:"connect-success"});(y===hn||y===Ln)&&y!==w&&n.current.push(d)}),n.current.length>0&&await s()&&n.current.forEach(_=>{const f=$n(_),w=t(_.header.id,f);Cn(u(`notifications.${w===hn?"driveSyncConflict":"driveSyncError"}`,{drive:_.header.name}),{type:"connect-warning",toastId:`${w===hn?"driveSyncConflict":"driveSyncError"}-${_.header.id}`})})},[]);ae(()=>{i(r??[],e).catch(console.error)},[r,e,i])};var kf=()=>null;function Bf(){const e=Oe(cr),t=Oe(ar),n=nn();nd(()=>mf(e,t,n)),gf()}const Ff=Wn(()=>Te(()=>import("./useInitSentry.DAHyudtD.js").then(e=>e.r),__vite__mapDeps([5,1,6,7]),import.meta.url)),Vf=Wn(()=>Te(()=>import("./cookie-banner.CA1rcZYO.js"),__vite__mapDeps([8,6,9,10,1,11,3,4]),import.meta.url).then(e=>({default:e.CookieBanner}))),jf=Wn(()=>Te(()=>import("./modal.B9PP9n2B.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>({default:e.ModalManager})));function zf(){return Uf(),Bf(),nn(),null}const Hf=ye(La,{children:kt($c,{children:[window.__VITE_ENVS.DEV&&ye(kf,{}),kt(xr,{fallback:ye(Pa,{}),name:"AppLoader",children:[ye(zf,{}),ye(Ff,{})]}),ye(xr,{name:"CookieBanner",children:ye(jf,{children:ye(Vf,{})})})]})});function Yf(e){Vi(e).render(Hf)}const qs=document.getElementById("app");if(!qs)throw new Error("#app element not found!");Yf(qs);const yp=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{rr as $,ir as A,hf as B,dh as C,Af as D,pd as E,hd as F,Gs as G,ih as H,$u as I,lh as J,mp as K,_p as L,fp as M,We as N,Et as O,oh as P,sh as Q,Il as R,lp as S,Df as T,vp as U,wp as V,Hl as W,Cn as X,Xt as Y,ut as Z,hs as _,De as a,Hh as a$,we as a0,xd as a1,me as a2,so as a3,Sh as a4,io as a5,ps as a6,oe as a7,Dd as a8,Yt as a9,bd as aA,St as aB,Ih as aC,$d as aD,Bh as aE,Lh as aF,mh as aG,bt as aH,zh as aI,ll as aJ,md as aK,tr as aL,yl as aM,Th as aN,wh as aO,Dh as aP,xh as aQ,Ad as aR,bh as aS,Kd as aT,$h as aU,Mh as aV,kh as aW,Eh as aX,Cd as aY,Oh as aZ,Md as a_,Ee as aa,Rh as ab,Ph as ac,xe as ad,Ce as ae,Qt as af,Es as ag,he as ah,ze as ai,nr as aj,Ke as ak,en as al,Uh as am,Sl as an,jh as ao,tn as ap,fl as aq,Ds as ar,dl as as,ht as at,or as au,qd as av,Fh as aw,Ns as ax,Vh as ay,Xd as az,mu as b,ph as b0,gh as b1,_h as b2,_d as b3,vd as b4,kd as b5,Ah as b6,Rd as b7,Kh as b8,vh as b9,np as bA,ep as bB,ah as bC,ch as bD,qa as bE,jl as bF,dp as bG,af as bH,$e as bI,Au as bJ,Iu as bK,rh as bL,bu as bM,gu as bN,yu as bO,Eu as bP,th as bQ,nh as bR,Vn as bS,tf as bT,ef as bU,Gl as bV,nf as bW,yp as bX,Wh as ba,yh as bb,Nh as bc,ap as bd,cp as be,Jh as bf,Yh as bg,Ch as bh,Zt as bi,tp as bj,wl as bk,Cs as bl,Ie as bm,op as bn,Gh as bo,Is as bp,rp as bq,Fn as br,ip as bs,sp as bt,mo as bu,Xh as bv,qh as bw,Zh as bx,Qh as by,ul as bz,uh as c,Oe as d,ue as e,Dt as f,gt as g,pp as h,Vs as i,qt as j,fh as k,gd as l,Al as m,Nl as n,gp as o,Ul as p,kl as q,hh as r,hp as s,up as t,Fc as u,ts as v,$n as w,eh as x,Ys as y,Wl as z};
31
- //# sourceMappingURL=index.DJX9_IxB.js.map