@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.
- package/dist/assets/{AddDriveModal.Cg4TqLU6.js → AddDriveModal.atIXkYDv.js} +2 -2
- package/dist/assets/{AddDriveModal.Cg4TqLU6.js.map → AddDriveModal.atIXkYDv.js.map} +1 -1
- package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js → CookiesPolicyModal.CSr2nTWu.js} +2 -2
- package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js.map → CookiesPolicyModal.CSr2nTWu.js.map} +1 -1
- package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js → CreateDocumentModal.hCyyznzw.js} +2 -2
- package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js.map → CreateDocumentModal.hCyyznzw.js.map} +1 -1
- package/dist/assets/{DebugSettingsModal.BYAH2kLg.js → DebugSettingsModal.CgAXBUpR.js} +2 -2
- package/dist/assets/{DebugSettingsModal.BYAH2kLg.js.map → DebugSettingsModal.CgAXBUpR.js.map} +1 -1
- package/dist/assets/{DeleteDriveModal.D2WirfE-.js → DeleteDriveModal.Ba1pkRrp.js} +2 -2
- package/dist/assets/{DeleteDriveModal.D2WirfE-.js.map → DeleteDriveModal.Ba1pkRrp.js.map} +1 -1
- package/dist/assets/{DeleteItemModal.Czi0wE_6.js → DeleteItemModal.59EW1OYd.js} +2 -2
- package/dist/assets/{DeleteItemModal.Czi0wE_6.js.map → DeleteItemModal.59EW1OYd.js.map} +1 -1
- package/dist/assets/{DisclaimerModal.cBHngnNt.js → DisclaimerModal.CMaIiFx2.js} +2 -2
- package/dist/assets/{DisclaimerModal.cBHngnNt.js.map → DisclaimerModal.CMaIiFx2.js.map} +1 -1
- package/dist/assets/{DriveSettingsModal.DltE5rSu.js → DriveSettingsModal.G8tppGWb.js} +2 -2
- package/dist/assets/{DriveSettingsModal.DltE5rSu.js.map → DriveSettingsModal.G8tppGWb.js.map} +1 -1
- package/dist/assets/{SettingsModal.CZmfov8g.js → SettingsModal.CLpRdHfo.js} +2 -2
- package/dist/assets/{SettingsModal.CZmfov8g.js.map → SettingsModal.CLpRdHfo.js.map} +1 -1
- package/dist/assets/{Trans.GeuewYUs.js → Trans.CBZW5Jpo.js} +2 -2
- package/dist/assets/{Trans.GeuewYUs.js.map → Trans.CBZW5Jpo.js.map} +1 -1
- package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js → UpgradeDriveModal.ooyxdViv.js} +2 -2
- package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js.map → UpgradeDriveModal.ooyxdViv.js.map} +1 -1
- package/dist/assets/{atlas-import.Tq-cGz94.js → atlas-import.Bvmc6eu-.js} +2 -2
- package/dist/assets/{atlas-import.Tq-cGz94.js.map → atlas-import.Bvmc6eu-.js.map} +1 -1
- package/dist/assets/{content.C38XllGR.js → content.B_2fQ3XO.js} +2 -2
- package/dist/assets/content.B_2fQ3XO.js.map +1 -0
- package/dist/assets/{cookie-banner.CA1rcZYO.js → cookie-banner.CQrIFtr9.js} +2 -2
- package/dist/assets/{cookie-banner.CA1rcZYO.js.map → cookie-banner.CQrIFtr9.js.map} +1 -1
- package/dist/assets/{index.tjOyiWN1.js → index.BWsvZ6s-.js} +2 -2
- package/dist/assets/{index.tjOyiWN1.js.map → index.BWsvZ6s-.js.map} +1 -1
- package/dist/assets/{index.CupF3yfn.js → index.BbKJCE01.js} +2 -2
- package/dist/assets/{index.CupF3yfn.js.map → index.BbKJCE01.js.map} +1 -1
- package/dist/assets/{index.D4rIKeA_.js → index.BfgjawT0.js} +2 -2
- package/dist/assets/{index.D4rIKeA_.js.map → index.BfgjawT0.js.map} +1 -1
- package/dist/assets/index.DoxG1d4A.js +31 -0
- package/dist/assets/index.DoxG1d4A.js.map +1 -0
- package/dist/assets/{index.DqaPdXs7.js → index.EpI4H1M9.js} +2 -2
- package/dist/assets/{index.DqaPdXs7.js.map → index.EpI4H1M9.js.map} +1 -1
- package/dist/assets/{index.DqtagVhW.js → index.lZCfN3WH.js} +2 -2
- package/dist/assets/{index.DqtagVhW.js.map → index.lZCfN3WH.js.map} +1 -1
- package/dist/assets/{index.Beg62ngn.js → index.wkpkULnU.js} +2 -2
- package/dist/assets/{index.Beg62ngn.js.map → index.wkpkULnU.js.map} +1 -1
- package/dist/assets/{main.DTZCxlJU.js → main.C-z7q4Cv.js} +3 -3
- package/dist/assets/{main.DTZCxlJU.js.map → main.C-z7q4Cv.js.map} +1 -1
- package/dist/assets/{modal.B9PP9n2B.js → modal.BizsZF2D.js} +3 -3
- package/dist/assets/{modal.B9PP9n2B.js.map → modal.BizsZF2D.js.map} +1 -1
- package/dist/assets/{modals.BVvUIuNm.js → modals.Bh5aGAsh.js} +2 -2
- package/dist/assets/{modals.BVvUIuNm.js.map → modals.Bh5aGAsh.js.map} +1 -1
- package/dist/assets/{nodefs.DG9XiPrJ.js → nodefs.DRM5jodc.js} +2 -2
- package/dist/assets/{nodefs.DG9XiPrJ.js.map → nodefs.DRM5jodc.js.map} +1 -1
- package/dist/assets/{nodes.bF-gqvzp.js → nodes.1z5U6LVM.js} +2 -2
- package/dist/assets/{nodes.bF-gqvzp.js.map → nodes.1z5U6LVM.js.map} +1 -1
- package/dist/assets/{opfs-ahp.CQz3T4kD.js → opfs-ahp.CIwZIbNR.js} +2 -2
- package/dist/assets/{opfs-ahp.CQz3T4kD.js.map → opfs-ahp.CIwZIbNR.js.map} +1 -1
- package/dist/assets/{registerServiceWorker.DZCbK6MJ.js → registerServiceWorker.BNf1b8wD.js} +2 -2
- package/dist/assets/{registerServiceWorker.DZCbK6MJ.js.map → registerServiceWorker.BNf1b8wD.js.map} +1 -1
- package/dist/assets/{root.MjuhTv80.js → root.SqECa_nN.js} +2 -2
- package/dist/assets/{root.MjuhTv80.js.map → root.SqECa_nN.js.map} +1 -1
- package/dist/assets/{useAcceptedCookies.BwmKLuW0.js → useAcceptedCookies.BwfkDBue.js} +2 -2
- package/dist/assets/{useAcceptedCookies.BwmKLuW0.js.map → useAcceptedCookies.BwfkDBue.js.map} +1 -1
- package/dist/assets/useDefaultDocumentModelEditor.DmNu7Xm0.js +2 -0
- package/dist/assets/{useDefaultDocumentModelEditor.CjlFHIbF.js.map → useDefaultDocumentModelEditor.DmNu7Xm0.js.map} +1 -1
- package/dist/assets/{useInitSentry.DAHyudtD.js → useInitSentry.BsZC-0d6.js} +6 -6
- package/dist/assets/{useInitSentry.DAHyudtD.js.map → useInitSentry.BsZC-0d6.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/vite-envs.sh +1 -1
- package/package.json +10 -10
- package/dist/assets/content.C38XllGR.js.map +0 -1
- package/dist/assets/index.DJX9_IxB.js +0 -31
- package/dist/assets/index.DJX9_IxB.js.map +0 -1
- package/dist/assets/useDefaultDocumentModelEditor.CjlFHIbF.js +0 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.BfgjawT0.js","./index.u4lctn3H.js","./index.BbKJCE01.js","./browser.BkwNmV2Z.js","./app-skeleton.js","./useInitSentry.BsZC-0d6.js","./useAcceptedCookies.BwfkDBue.js","./registerServiceWorker.BNf1b8wD.js","./cookie-banner.CQrIFtr9.js","./i18next.CqOP20KE.js","./modal.BizsZF2D.js","./Trans.CBZW5Jpo.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Bi=Object.defineProperty;var Fi=(t,e,n)=>e in t?Bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var fe=(t,e,n)=>Fi(t,typeof e!="symbol"?e+"":e,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 Hn,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 Or,D as Ot,m as Xi,n as Qi,o as Cr,p as Zi,q as ea,t as Lr,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 pn,K as fa,M as pa,N as Rr,O as ha,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 Rn,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 Yn,useReducer as Co,useEffect as ce,useDebugValue as Lo,useContext as Wn,useCallback as J,useState as He,useMemo as ht,StrictMode as La,Suspense as xr,lazy as Gn}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.19",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()||"/",pc=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",hc=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:pc,env:hc,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=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,$r=t=>"init"in t,gn=t=>!!t.write,Ur=t=>"v"in t||"e"in t,Ct=t=>{if("e"in t)throw t.e;if((ot?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Bt=new WeakMap,kr=t=>{var e;return Ft(t)&&!!((e=Bt.get(t))!=null&&e[0])},Dc=t=>{const e=Bt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Po=(t,e)=>{let n=Bt.get(t);if(!n){n=[!0,new Set],Bt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},Ft=t=>typeof(t==null?void 0:t.then)=="function",xo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},_n=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(Ft(e))for(const i of r.d.keys())xo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,Ft(s)&&Dc(s))},Br=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},Ic=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},mn=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},Ac=t=>(t.c||(t.c=mn()),t.m||(t.m=mn()),t.u||(t.u=mn()),t.f||(t.f=Ic()),t),Nc=Symbol(),Tc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((ot?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.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(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.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 Y of Br(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Ur(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(Mr(w,j)){const $=_(j);if(!Ur($))if($r(j))_n(j,j.init,_);else throw new Error("no atom init");return Ct($)}const x=F(j);try{return Ct(x)}finally{S.d.set(j,x.n),kr(S.v)&&xo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(ot?"production":void 0)!=="production"&&!gn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&gn(w)&&(K=(...j)=>{if((ot?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return _n(w,j,_),Ft(j)&&(Po(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Br(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Ct(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(Mr(w,I)){if(!$r(I))throw new Error("atom not writable");const he=se.n,j=Y[0];_n(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!kr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.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=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),gn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Ct(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Nc,{value:O}),B},Mo=Tc,Oc=Ac,Fr=Po,Kn={};let Cc=0;function de(t,e){const n=`atom${++Cc}`,r={toString(){return(Kn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Lc,r.write=Rc),e&&(r.write=e),r}function Lc(t){return t(this)}function Rc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const Pc=()=>{let t=0;const e=Oc({}),n=new WeakMap,r=new WeakMap,o=Mo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.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 d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function $o(){return(Kn?"production":void 0)!=="production"?Pc():Mo()}let tt;function xc(){return tt||(tt=$o(),(Kn?"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=Yn(void 0);function ko(t){return Wn(Uo)||xc()}function $c({children:t,store:e}){const n=Me(void 0);return!e&&!n.current&&(n.current=$o()),Ca(Uo.Provider,{value:e||n.current},t)}const Pn=t=>typeof(t==null?void 0:t.then)=="function",xn=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},Uc=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(xn(t),t)}),vn=new WeakMap,Vr=(t,e)=>{let n=vn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Pn(l)?(vn.set(l,n),s=l,l.then(i(l),c(l)),Fr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Fr(t,d)}),vn.set(t,n)),n};function Oe(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=ko(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Pn(f)&&xn(Vr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Pn(l)){const m=Vr(l,()=>o.get(t));return r&&xn(m),Uc(m)}return l}function kc(t,e){const n=ko();return J((...o)=>{if((Mc?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function $e(t,e){return[Oe(t),kc(t)]}const Bc=de(gt);function Fc(){return $e(Bc)}const st={},jr=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,zr=t=>"init"in t,wn=t=>!!t.write,Hr=t=>"v"in t||"e"in t,Lt=t=>{if("e"in t)throw t.e;if((st?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Vt=new WeakMap,Yr=t=>{var e;return jt(t)&&!!((e=Vt.get(t))!=null&&e[0])},Vc=t=>{const e=Vt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Bo=(t,e)=>{let n=Vt.get(t);if(!n){n=[!0,new Set],Vt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},jt=t=>typeof(t==null?void 0:t.then)=="function",Fo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},yn=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(jt(e))for(const i of r.d.keys())Fo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,jt(s)&&Vc(s))},Wr=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},jc=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},En=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},zc=t=>(t.c||(t.c=En()),t.m||(t.m=En()),t.u||(t.u=En()),t.f||(t.f=jc()),t),Hc=Symbol(),Yc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((st?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.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(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.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 Y of Wr(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Hr(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(jr(w,j)){const $=_(j);if(!Hr($))if(zr(j))yn(j,j.init,_);else throw new Error("no atom init");return Lt($)}const x=F(j);try{return Lt(x)}finally{S.d.set(j,x.n),Yr(S.v)&&Fo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(st?"production":void 0)!=="production"&&!wn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&wn(w)&&(K=(...j)=>{if((st?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return yn(w,j,_),jt(j)&&(Bo(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Wr(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Lt(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(jr(w,I)){if(!zr(I))throw new Error("atom not writable");const he=se.n,j=Y[0];yn(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!Yr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.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=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),wn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Lt(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Hc,{value:O}),B},Vo=Yc,Wc=zc,Gr=Bo,Jn={};let Gc=0;function oe(t,e){const n=`atom${++Gc}`,r={toString(){return(Jn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Kc,r.write=Jc),e&&(r.write=e),r}function Kc(t){return t(this)}function Jc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const qc=()=>{let t=0;const e=Wc({}),n=new WeakMap,r=new WeakMap,o=Vo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.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 d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function Xc(){return(Jn?"production":void 0)!=="production"?qc():Vo()}let nt;function Qc(){return nt||(nt=Xc(),(Jn?"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=Yn(void 0);function jo(t){return Wn(eu)||Qc()}const Mn=t=>typeof(t==null?void 0:t.then)=="function",$n=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},tu=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:($n(t),t)}),bn=new WeakMap,Kr=(t,e)=>{let n=bn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Mn(l)?(bn.set(l,n),s=l,l.then(i(l),c(l)),Gr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Gr(t,d)}),bn.set(t,n)),n};function De(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=jo(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Mn(f)&&$n(Kr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Mn(l)){const m=Kr(l,()=>o.get(t));return r&&$n(m),tu(m)}return l}function Ue(t,e){const n=jo();return J((...o)=>{if((Zc?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}var Sn,Jr;function nu(){return Jr||(Jr=1,Sn=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),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(!t(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}),Sn}var ru=nu();const zo=Oo(ru),lt={},ou=t=>typeof(t==null?void 0:t.then)=="function";function su(t=()=>{try{return window.localStorage}catch(n){(lt?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return ou(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}su();const Dn=new WeakMap,iu=(t,e)=>(Dn.has(e)?Dn:Dn.set(e,t())).get(e),au=t=>typeof(t==null?void 0:t.then)=="function",qr={state:"loading"};function Be(t){return iu(()=>{const e=new WeakMap,n=oe(0);(lt?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=oe((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!au(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,qr),qr)},(o,s)=>{s(n,i=>i+1)});return(lt?"production":void 0)!=="production"&&(r.debugPrivate=!0),oe(o=>o(r))},t)}const Xr=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),cu=new WeakMap,uu=(t,e,n)=>{const r=Xr(()=>new WeakMap,cu,e);return Xr(t,r,n)},du=t=>typeof(t==null?void 0:t.then)=="function",lu=()=>{};function Fe(t,e=lu){return uu(()=>{const n=new WeakMap,r=new WeakMap,o=oe(0);(lt?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=oe((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!du(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(lt?"production":void 0)!=="production"&&(s.debugPrivate=!0),oe(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function Un(t){if(!t)return"PUBLIC";const e="readContext"in t,{sharingType:n}=e?{sharingType:"PUBLIC"}:t.state.local,r=n==null?void 0:n.toUpperCase();return r==="PRIVATE"?"LOCAL":r}function fu(t){if(!t)return!1;const e="readContext"in t,{availableOffline:n}=e?{availableOffline:!1}:t.state.local;return n??!1}function tp(t){if(t)return{id:t.header.id,name:t.state.global.name,kind:"FOLDER",parentFolder:null}}async function pu(t,e){if(!t||!e)return[];const n=await t.getDocuments(e);return await Promise.all(n.map(o=>t.getDocument(o)))}async function hu(t){if(!t)return[];const e=await t.getDrives();return await Promise.all(e.map(r=>t.getDrive(r)))}function np(t){return t.toSorted((e,n)=>e.name.localeCompare(n.name))}function rp(t){return t?t.kind.toUpperCase()==="FILE":!1}function gu(t){return t?t.kind.toUpperCase()==="FOLDER":!1}const ge="NOT_SET";function _t(){return new Promise(()=>{})}const zt=oe(ge);zt.debugLabel="baseProcessorManagerAtom";const Ho=oe(t=>t(zt)!==ge);Ho.debugLabel="processorManagerInitializedAtom";const Kt=oe(t=>{const e=t(zt);return e===ge?_t():e},(t,e,n)=>{e(zt,n)});Kt.debugLabel="processorManagerAtom";const _u=Be(Kt);_u.debugLabel="loadableProcessorManagerAtom";const mu=Fe(Kt);mu.debugLabel="unwrappedProcessorManagerAtom";const at=oe(ge);at.debugLabel="baseDrivesAtom";const Yo=oe(t=>t(at)!==ge);Yo.debugLabel="drivesInitializedAtom";const mt=oe(async t=>{const e=t(at);return e===ge?_t():e},async(t,e)=>{const n=t(at),r=window.reactor,o=await hu(r);zo(o,n)||e(at,o)});mt.debugLabel="drivesAtom";const vu=Be(mt);vu.debugLabel="loadableDrivesAtom";const Wo=Fe(mt);Wo.debugLabel="unwrappedDrivesAtom";const Ht=oe(ge);Ht.debugLabel="selectedDriveIdAtom";const qn=oe(t=>t(Ht)!==ge);qn.debugLabel="driveIdInitializedAtom";const Ye=oe(async t=>{const e=t(Ht),n=await t(mt);return e===ge?_t():n==null?void 0:n.find(o=>o.header.id===e)},(t,e,n)=>{e(Ht,n),e(ft,void 0)});Ye.debugLabel="selectedDriveAtom";const Go=Be(Ye);Go.debugLabel="loadableSelectedDriveAtom";const Ko=Fe(Ye);Ko.debugLabel="unwrappedSelectedDriveAtom";const vt=oe(async t=>{const e=await t(Ye);return e==null?void 0:e.state.global.nodes});vt.debugLabel="nodesAtom";const wu=Be(vt);wu.debugLabel="loadableNodesAtom";const yu=Fe(vt);yu.debugLabel="unwrappedNodesAtom";const ft=oe(ge);ft.debugLabel="selectedNodeIdAtom";const Jo=oe(t=>t(ft)!==ge);Jo.debugLabel="selectedNodeIdInitializedAtom";const wt=oe(async t=>{const e=t(ft),n=await t(vt);return e===ge?_t():n==null?void 0:n.find(r=>r.id===e)},(t,e,n)=>{e(ft,n)});wt.debugLabel="selectedNodeAtom";const Xn=oe(async t=>{const e=await t(vt),n=await t(wt),r=e==null?void 0:e.filter(gu);return r==null?void 0:r.find(o=>o.id===(n==null?void 0:n.id))});Xn.debugLabel="selectedFolderAtom";const Eu=Be(Xn);Eu.debugLabel="loadableSelectedFolderAtom";const bu=Fe(Xn);bu.debugLabel="unwrappedSelectedFolderAtom";const ct=oe(ge);ct.debugLabel="baseDocumentsAtom";const qo=oe(t=>t(ct)!==ge);qo.debugLabel="documentsInitializedAtom";const yt=oe(t=>{const e=t(ct);return e===ge?_t():e},async(t,e,n)=>{const r=t(ct),o=window.reactor,s=await pu(o,n);zo(s,r)||e(ct,s)});yt.debugLabel="documentsAtom";const Su=Be(yt);Su.debugLabel="loadableDocumentsAtom";const Du=Fe(yt);Du.debugLabel="unwrappedDocumentsAtom";const Qn=oe(async t=>{const e=await t(yt),n=await t(wt);return e==null?void 0:e.find(r=>r.header.id===(n==null?void 0:n.id))});Qn.debugLabel="selectedDocumentAtom";const Iu=Be(Qn);Iu.debugLabel="loadableSelectedDocumentAtom";const Au=Fe(Qn);Au.debugLabel="unwrappedSelectedDocumentAtom";let Mt;typeof window<"u"?window.btoa?Mt=function(t){return btoa(unescape(encodeURIComponent(t)))}:Mt=function(t){const e=unescape(encodeURIComponent(t+""));let n="";for(let r,o,s=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.charAt(s|0)||(i="=",s%1);n+=i.charAt(63&r>>8-s%1*8)){if(o=e.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(t){return Buffer.from(t).toString("base64")};function Z(t,e){let n=Qr(t,e);return(e&&e.fallback!==void 0?e.fallback:Z.defaults.fallback)===!0&&n===""&&(n=Qr(Mt(t),e)),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 Zn={};function Qr(t,e){if(typeof t!="string")throw new Error("slug() requires a string argument, received "+typeof t);if(!t.isWellFormed())throw new Error("slug() received a malformed string with lone surrogates");typeof e=="string"&&(e={replacement:e}),e=e?Object.assign({},e):{},e.mode=e.mode||Z.defaults.mode;const n=Z.defaults.modes[e.mode],r=["replacement","multicharmap","charmap","remove","lower","trim"];for(let d,l=0,m=r.length;l<m;l++)d=r[l],e[d]=d in e?e[d]:n[d];const o=Xo[e.locale]||Zn;let s=[];for(const d in e.multicharmap){if(!Object.prototype.hasOwnProperty.call(e.multicharmap,d))continue;const l=d.length;s.indexOf(l)===-1&&s.push(l)}s=s.sort(function(d,l){return l-d});const i=e.mode==="rfc3986"?/[^\w\s\-.~]/:/[^A-Za-z0-9\s]/;let c="";for(let d,l=0,m=t.length;l<m;l++){d=t[l];let f=!1;for(let _=0;_<s.length;_++){const y=s[_],N=t.substr(l,y);if(e.multicharmap[N]){l+=y-1,d=e.multicharmap[N],f=!0;break}}f||(o[d]?d=o[d]:e.charmap[d]?d=e.charmap[d].replace(e.replacement," "):d.includes(e.replacement)?d=d.replace(e.replacement," "):d=d.replace(i,"")),c+=d}return e.remove&&(c=c.replace(e.remove,"")),e.trim&&(c=c.trim()),c=c.replace(/\s+/g,e.replacement),e.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),Zn=""};Z.extend=function(t){const e=Object.keys(t),n={},r={};for(let o=0;o<e.length;o++)e[o].length>1?n[e[o]]=t[e[o]]:r[e[o]]=t[e[o]];Object.assign(Z.charmap,r),Object.assign(Z.multicharmap,n)};Z.setLocale=function(t){Zn=Xo[t]||{}};function Nu(t){return t?`/d/${Z(t.header.slug)}`:""}function Tu(t){if(!t)return"";const e=t.name;return Z(e?`${e}-${t.id}`:t.id)}function Ou(t){const e=/^\/d\/[^/]+\/([^/]+)$/.exec(t);return e?e[1]:void 0}function Cu(t){if(!t)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(t);return n?n[0]:void 0}function Lu(t){const e=Ou(t),n=Cu(e);return n||e}function es(t){const e=/^\/d\/([^/]+)/.exec(t);return e?e[1]:null}function Ru(t){return t.replaceAll(/\s/g,"-")}function Pu(t){const e=new CustomEvent("ph:setDrive",{detail:{driveId:t}});window.dispatchEvent(e)}function xu(t,e){const n=t.detail.driveId;if(e(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 op(t){const e=new CustomEvent("ph:setNode",{detail:{nodeId:t}});window.dispatchEvent(e)}function Mu(t,e){const n=t.detail.nodeId;if(e(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(l=>l.id===n),d=Tu(c);window.history.pushState(null,"",`/d/${o}/${d}`)}).catch(s=>te.error(s))}}function Et(){return De(Wo)}function Jt(t){const e=Et();if(t)return e==null?void 0:e.find(n=>n.header.id===t)}function ts(){return De(Ko)}function sp(){return De(Go)}function ip(){return J(t=>{Pu(t)},[])}function ns(){const t=ts();return t==null?void 0:t.header.id}function $u(t){const e=Jt(t),n=Uu(t);if(e){if("remoteUrl"in e.state.global){const r=e.state.global.remoteUrl;if(typeof r=="string")return r}return n}}function rs(t){const e=Jt(t);return e==null?void 0:e.state.local.triggers.find(r=>r.type==="PullResponder")}function Uu(t){var n;const e=rs(t);return(n=e==null?void 0:e.data)==null?void 0:n.url}function ap(t){const e=$u(t),n=rs(t);return e!==void 0||n!==void 0}function cp(t){const e=Jt(t);if(e)return Un(e)}function up(t){const e=Jt(t);return e?fu(e):!1}function We(){return window.reactor}const er={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(t,e){const n=er[e];let r=os[e];for(let o=0;o<t.length;o++)r^=BigInt(t[o]),r=BigInt.asUintN(e,r*n);return r}function Bu(t,e,n){if(n.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");const r=er[e];let o=os[e],s=t;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(e,o*r)}return o}function Fu(t,{size:e=32,utf8Buffer:n}={}){if(!er[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof t=="string"){if(n)return Bu(t,e,n);t=ss.encode(t)}return ku(t,e)}const Vu=[32,64,128,256,512,1024],ju=Math.log2(26);function is(t,e=10,n="fnv1a"){if(n==="fnv1a"){const r=Math.ceil(e*ju),o=Vu.find(i=>i&&i>=r)??1024,s=Fu(t,{size:o});return zu(s,e)}else throw new Error(`Unsupported hashing algorithm: ${n}`)}function zu(t,e=10){const n="abcdefghijklmnopqrstuvwxyz";let r="";for(;t>0n&&r.length<e;)r=n[Number(t%26n)]+r,t/=26n;return r.padStart(e,"a")}function dp(t,e){const n=t;return n.createNamespace=(r,o)=>Hu(t,r,o??e),n.queryNamespace=(r,o)=>Yu(t,r,o??e),n}async function Hu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e;return await t.schema.createSchema(o).ifNotExists().execute(),t.withSchema(o)}function Yu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e,s=t.withSchema(o);return tr(s)}function tr(t){return{selectFrom:t.selectFrom.bind(t),selectNoFrom:t.selectNoFrom.bind(t),with:t.with.bind(t),withRecursive:t.withRecursive.bind(t),withSchema:e=>tr(t.withSchema(e))}}function Zr(t){return as.is(t)}const eo=Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");var To;To=eo;class as{constructor(e,n,r){fe(this,"_namespace");fe(this,"_filter");fe(this,"relationalDb");this._namespace=e,this._filter=n,this.relationalDb=r}static is(e){var r;let n=Object.getPrototypeOf(e);for(;n;){if((r=n.constructor)!=null&&r[eo])return!0;n=Object.getPrototypeOf(n)}return!1}static getNamespace(e){return`${this.name}_${e.replaceAll("-","_")}`}static query(e,n){return n.queryNamespace(this.getNamespace(e))}get filter(){return this._filter}get namespace(){return this._namespace}get query(){return tr(this.relationalDb)}}fe(as,To,!0);class Wu{constructor(e,n){fe(this,"listeners");fe(this,"drive");fe(this,"logger",Hn(["document-drive","processor-manager"]));fe(this,"processorsByDrive",new Map);fe(this,"idToFactory",new Map);fe(this,"identifierToListeners",new Map);this.listeners=e,this.drive=n}async registerFactory(e,n){this.logger.debug(`Registering factory '${e}'.`),this.idToFactory.set(e,n);const r=await this.drive.getDrives();for(const o of r)await this.createProcessors(o,e,n)}async unregisterFactory(e){var r;const n=this.identifierToListeners.get(e)??[];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(e,[])}async registerDrive(e){this.logger.debug(`Registering drive '${e}'.`);for(const[n,r]of this.idToFactory)await this.createProcessors(e,n,r)}async createProcessors(e,n,r){let o=this.identifierToListeners.get(n);o||(o=[],this.identifierToListeners.set(n,o));let s=this.processorsByDrive.get(e);s||(s=[],this.processorsByDrive.set(e,s));let i=[];try{i=await r(e)}catch(c){this.logger.error(`Error creating processors for drive ${e}:`,c);return}for(const{filter:c,processor:d}of i){const l=Zr(d);if(l&&s.some(_=>Zr(_.processor)&&_.processor.namespace===d.namespace)){this.logger.warn(`Processor with namespace '${d.namespace}' already registered for drive '${e}'.`);continue}l&&await d.initAndUpgrade();const m=Le(),f={driveId:e,listenerId:m,block:!1,system:!1,filter:c,callInfo:void 0,transmitter:new Wi(this.drive,d)};await this.listeners.setListener(e,f),o.push(f),s.push({filter:c,processor:d})}}}function Gu(){const t=We(),e=De(Ho),n=Ue(Kt);ce(()=>{if(e||!t)return;const r=new Wu(t.listeners,t);t.on("driveAdded",async o=>{await r.registerDrive(o.header.id)}),n(r)},[e,t,n])}function cs(){return Ue(yt)}function Ku(){const t=ns(),e=cs();return J(()=>{e(t).catch(n=>te.error(n))},[e,t])}function us(){return Ue(mt)}function Ju(){const t=us();return J(()=>{t().catch(e=>te.error(e))},[t])}function qu(t){const[e,n]=He(!!window.reactor),r=De(Yo),o=De(qn),s=ns(),i=De(qo),c=us(),d=cs();ce(()=>{if(e)return;async function l(){const m=await(t==null?void 0:t());window.reactor=m,n(!0)}l().catch(te.error)},[t,e]),ce(()=>{if(!e||r)return;async function l(){await c()}l().catch(te.error)},[e,c,r]),ce(()=>{if(!e||!o||i)return;async function l(){await d(s)}l().catch(te.error)},[e,i,o,s,d])}function Xu(){const t=Ue(Ye),e=Ue(wt),n=J(o=>{xu(o,t)},[t]),r=J(o=>{Mu(o,e)},[e]);ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setDrive",n),()=>{window.removeEventListener("ph:setDrive",n)}},[n]),ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setNode",r),()=>{window.removeEventListener("ph:setNode",r)}},[r])}function Qu(){const t=Ju(),e=Ku(),n=We();ce(()=>{if(!n)return;const r=[n.on("syncStatus",(...o)=>{te.verbose("syncStatus",...o),t(),e()}),n.on("strandUpdate",(...o)=>{te.verbose("strandUpdate",...o),t(),e()}),n.on("defaultRemoteDrive",(...o)=>{te.verbose("defaultRemoteDrive",...o),t(),e()}),n.on("clientStrandsError",(...o)=>{te.verbose("clientStrandsError",...o),t(),e()}),n.on("driveAdded",(...o)=>{te.verbose("driveAdded",...o),t(),e()}),n.on("driveDeleted",(...o)=>{te.verbose("driveDeleted",...o),t(),e()}),n.on("documentModelModules",(...o)=>{te.verbose("documentModelModules",...o),t(),e()}),n.on("documentOperationsAdded",(...o)=>{te.verbose("documentOperationsAdded",...o),t(),e()}),n.on("driveOperationsAdded",(...o)=>{console.log("driveOperationsAdded",...o),te.verbose("driveOperationsAdded",...o),t(),e()}),n.on("operationsAdded",(...o)=>{console.log("operationsAdded",...o),te.verbose("operationsAdded",...o),t(),e()})];return()=>{r.forEach(o=>o())}},[t,e,n])}function Zu(){const t=Ue(Ye),e=Ue(wt),n=De(qn),r=De(Jo),o=We();ce(()=>{async function s(){if(typeof window>"u"||!o||n)return;const i=window.location.pathname,c=await ed(o,i,t);c&&(r||td(c,i,e))}s().catch(te.error)},[o,n,r,t,e])}async function ed(t,e,n){const r=es(e),o=await t.getDrives(),i=(await Promise.all(o.map(c=>t.getDrive(c)))).find(c=>c.header.slug===r||c.header.id===r);return n(i==null?void 0:i.header.id),i}function td(t,e,n){const r=Lu(e),o=t==null?void 0:t.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(t){qu(t),Qu(),Xu(),Gu(),Zu()}const it=Hn(["utils/document-model",Math.floor(Math.random()*999).toString()]),rd=parseInt(window.__VITE_ENVS.FILE_UPLOAD_OPERATIONS_CHUNK_SIZE||"50");function lp(t,e,n=it.error){const[r,o]=He(e),[s,i]=He(),c=l=>{i(l),n(l)};return ce(()=>{o(e),i(void 0)},[e]),[r,(l,m,f)=>{i(void 0),o(_=>{if(!t||!_)return _;try{const y=t(_,l),N=l.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 m==null||m(P,{prevState:{..._},newState:{...y}}),y}catch(y){return c(y),f==null||f(y),_}})},s]}async function od(t,e,n,r){const o=(r==null?void 0:r.operationsLimit)||rd;it.verbose(`uploadDocumentOperations(documentId:${t}, ops: ${Object.keys(e.operations).join(",")}, limit:${o})`);for(const s of Object.values(e.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),d=c.at(-1);if(!d)break;const{scope:l}=d;await n(t,c),it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}:${l} rev ${d.index}): NEXT`)}it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}): END`)}const sd=async t=>{Ji(t).generateAsync({type:"blob"}).then(n=>{const r=window.document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(n),r.download=`${t.header.name||"Untitled"}.zip`,window.document.body.appendChild(r),r.click(),window.document.body.removeChild(r)}).catch(te.error)};async function fp(t,e){var o,s;const n=e(t.header.documentType);if(!n)throw new Error(`Document model not supported: ${t.header.documentType}`);const r=n.documentModel.extension;if(!window.showSaveFilePicker){await sd(t);return}try{const i=await window.showSaveFilePicker({suggestedName:`${t.name||((o=t.state.global)==null?void 0:o.name)||"Untitled"}.${r?`${r}.`:""}zip`});await Ki(t,i);const c=(await i.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,c)),c}catch(i){if(!(i instanceof DOMException&&i.name==="AbortError"))throw i}}async function id(t,e){const n=await Gi(t,o=>o,{checkHashes:!0}),r=e(n.header.documentType);if(!r)throw new Error(`Document "${n.header.documentType}" is not supported`);return r.utils.loadFromInput(t)}function to(t){let e=!1;const n=Object.entries(t.operations).reduce((r,[o,s])=>{const i=o;for(const c of s){const d=ad(c);r[i].push(d),d!==c&&(e=!0)}return r},{global:[],local:[]});return e?{...t,operations:n}:t}function ad(t){var s,i,c;let e=!1,n={...t};const r=(s=t.context)==null?void 0:s.signer,o=(c=(i=t.action)==null?void 0:i.context)==null?void 0:c.signer;if(r){if("signature"in r){const d=r.signature;n={...n,context:{...n.context,signer:{user:r.user,app:r.app,signatures:d!=null&&d.length?[d]:[]}}},e=!0}else if(r.signatures){const d=r.signatures.filter(l=>l&&l.length>0);d.length!==r.signatures.length&&(n={...n,context:{...n.context,signer:{...r,signatures:d}}},e=!0)}}if(o){if("signature"in o){const d=o.signature,l={...n.action.context,signer:{user:o.user,app:o.app,signatures:d!=null&&d.length?[d]:[]}};n={...n,action:{...n.action,context:l},context:l},e=!0}else if(o.signatures){const d=o.signatures.filter(l=>l&&l.length>0);if(d.length!==o.signatures.length){const l={...n.action.context,signer:{...o,signatures:d}};n={...n,action:{...n.action,context:l},context:l},e=!0}}}return e?n:t}var In={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(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,s){function i(l,m){if(!o[l]){if(!r[l]){var f=typeof Nt=="function"&&Nt;if(!m&&f)return f(l,!0);if(c)return c(l,!0);var _=new Error("Cannot find module '"+l+"'");throw _.code="MODULE_NOT_FOUND",_}var y=o[l]={exports:{}};r[l][0].call(y.exports,function(N){var F=r[l][1][N];return i(F||N)},y,y.exports,n,r,o,s)}return o[l].exports}for(var c=typeof Nt=="function"&&Nt,d=0;d<s.length;d++)i(s[d]);return i}({1:[function(n,r,o){(function(s){var i=s.MutationObserver||s.WebKitMutationObserver,c;if(i){var d=0,l=new i(N),m=s.document.createTextNode("");l.observe(m,{characterData:!0}),c=function(){m.data=d=++d%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 _,y=[];function N(){_=!0;for(var P,V,H=y.length;H;){for(V=y,y=[],P=-1;++P<H;)V[P]();H=y.length}_=!1}r.exports=F;function F(P){y.push(P)===1&&!_&&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={},d=["REJECTED"],l=["FULFILLED"],m=["PENDING"];r.exports=f;function f(O){if(typeof O!="function")throw new TypeError("resolver must be a function");this.state=m,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===l||typeof B!="function"&&this.state===d)return this;var w=new this.constructor(i);if(this.state!==m){var A=this.state===l?O:B;y(w,A,this.outcome)}else this.queue.push(new _(w,O,B));return w};function _(O,B,w){this.promise=O,typeof B=="function"&&(this.onFulfilled=B,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}_.prototype.callFulfilled=function(O){c.resolve(this.promise,O)},_.prototype.otherCallFulfilled=function(O){y(this.promise,this.onFulfilled,O)},_.prototype.callRejected=function(O){c.reject(this.promise,O)},_.prototype.otherCallRejected=function(O){y(this.promise,this.onRejected,O)};function y(O,B,w){s(function(){var A;try{A=B(w)}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 w=P(N,B);if(w.status==="error")return c.reject(O,w.value);var A=w.value;if(A)F(O,A);else{O.state=l,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=d,O.outcome=B;for(var w=-1,A=O.queue.length;++w<A;)O.queue[w].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 w=!1;function A(I){w||(w=!0,c.reject(O,I))}function S(I){w||(w=!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 w={};try{w.value=O(B),w.status="success"}catch(A){w.status="error",w.value=A}return w}f.resolve=V;function V(O){return O instanceof this?O:c.resolve(new this(i),O)}f.reject=H;function H(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 w=O.length,A=!1;if(!w)return this.resolve([]);for(var S=new Array(w),D=0,b=-1,I=new this(i);++b<w;)Y(O[b],b);return I;function Y(K,se){B.resolve(K).then(he,function(j){A||(A=!0,c.reject(I,j))});function he(j){S[se]=j,++D===w&&!A&&(A=!0,c.resolve(I,S))}}}f.race=W;function W(O){var B=this;if(Object.prototype.toString.call(O)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=O.length,A=!1;if(!w)return this.resolve([]);for(var S=-1,D=new this(i);++S<w;)b(O[S]);return D;function b(I){B.resolve(I).then(function(Y){A||(A=!0,c.resolve(D,Y))},function(Y){A||(A=!0,c.reject(D,Y))})}}},{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,p){if(!(a instanceof p))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 d=c();function l(){try{if(!d||!d.open)return!1;var a=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!a||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function m(a,p){a=a||[],p=p||{};try{return new Blob(a,p)}catch(h){if(h.name!=="TypeError")throw h;for(var u=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,g=new u,v=0;v<a.length;v+=1)g.append(a[v]);return g.getBlob(p.type)}}typeof Promise>"u"&&n(3);var f=Promise;function _(a,p){p&&a.then(function(u){p(null,u)},function(u){p(u)})}function y(a,p,u){typeof p=="function"&&a.then(p),typeof u=="function"&&a.catch(u)}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,H={},k=Object.prototype.toString,W="readonly",O="readwrite";function B(a){for(var p=a.length,u=new ArrayBuffer(p),g=new Uint8Array(u),v=0;v<p;v++)g[v]=a.charCodeAt(v);return u}function w(a){return new f(function(p){var u=a.transaction(P,O),g=m([""]);u.objectStore(P).put(g,"key"),u.onabort=function(v){v.preventDefault(),v.stopPropagation(),p(!1)},u.oncomplete=function(){var v=navigator.userAgent.match(/Chrome\/(\d+)/),h=navigator.userAgent.match(/Edge\//);p(h||!v||parseInt(v[1],10)>=43)}}).catch(function(){return!1})}function A(a){return typeof V=="boolean"?f.resolve(V):w(a).then(function(p){return V=p,V})}function S(a){var p=H[a.name],u={};u.promise=new f(function(g,v){u.resolve=g,u.reject=v}),p.deferredOperations.push(u),p.dbReady?p.dbReady=p.dbReady.then(function(){return u.promise}):p.dbReady=u.promise}function D(a){var p=H[a.name],u=p.deferredOperations.pop();if(u)return u.resolve(),u.promise}function b(a,p){var u=H[a.name],g=u.deferredOperations.pop();if(g)return g.reject(p),g.promise}function I(a,p){return new f(function(u,g){if(H[a.name]=H[a.name]||z(),a.db)if(p)S(a),a.db.close();else return u(a.db);var v=[a.name];p&&v.push(a.version);var h=d.open.apply(d,v);p&&(h.onupgradeneeded=function(E){var T=h.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}}),h.onerror=function(E){E.preventDefault(),g(h.error)},h.onsuccess=function(){var E=h.result;E.onversionchange=function(T){T.target.close()},u(E),D(a)}})}function Y(a){return I(a,!1)}function K(a){return I(a,!0)}function se(a,p){if(!a.db)return!0;var u=!a.db.objectStoreNames.contains(a.storeName),g=a.version<a.db.version,v=a.version>a.db.version;if(g&&(a.version!==p&&console.warn('The database "'+a.name+`" can't be downgraded from version `+a.db.version+" to version "+a.version+"."),a.version=a.db.version),v||u){if(u){var h=a.db.version+1;h>a.version&&(a.version=h)}return!0}return!1}function he(a){return new f(function(p,u){var g=new FileReader;g.onerror=u,g.onloadend=function(v){var h=btoa(v.target.result||"");p({__local_forage_encoded_blob:!0,data:h,type:a.type})},g.readAsBinaryString(a)})}function j(a){var p=B(atob(a.data));return m([p],{type:a.type})}function M(a){return a&&a.__local_forage_encoded_blob}function x(a){var p=this,u=p._initReady().then(function(){var g=H[p._dbInfo.name];if(g&&g.dbReady)return g.dbReady});return y(u,a,a),u}function $(a){S(a);for(var p=H[a.name],u=p.forages,g=0;g<u.length;g++){var v=u[g];v._dbInfo.db&&(v._dbInfo.db.close(),v._dbInfo.db=null)}return a.db=null,Y(a).then(function(h){return a.db=h,se(a)?K(a):h}).then(function(h){a.db=p.db=h;for(var E=0;E<u.length;E++)u[E]._dbInfo.db=h}).catch(function(h){throw b(a,h),h})}function G(a,p,u,g){g===void 0&&(g=1);try{var v=a.db.transaction(a.storeName,p);u(null,v)}catch(h){if(g>0&&(!a.db||h.name==="InvalidStateError"||h.name==="NotFoundError"))return f.resolve().then(function(){if(!a.db||h.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,p,u,g-1)})}).catch(u);u(h)}}function z(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function ne(a){var p=this,u={db:null};if(a)for(var g in a)u[g]=a[g];var v=H[u.name];v||(v=z(),H[u.name]=v),v.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=x);var h=[];function E(){return f.resolve()}for(var T=0;T<v.forages.length;T++){var C=v.forages[T];C!==p&&h.push(C._initReady().catch(E))}var L=v.forages.slice(0);return f.all(h).then(function(){return u.db=v.db,Y(u)}).then(function(R){return u.db=R,se(u,p._defaultConfig.version)?K(u):R}).then(function(R){u.db=v.db=R,p._dbInfo=u;for(var U=0;U<L.length;U++){var q=L[U];q!==p&&(q._dbInfo.db=u.db,q._dbInfo.version=u.version)}})}function le(a,p){var u=this;a=N(a);var g=new f(function(v,h){u.ready().then(function(){G(u._dbInfo,W,function(E,T){if(E)return h(E);try{var C=T.objectStore(u._dbInfo.storeName),L=C.get(a);L.onsuccess=function(){var R=L.result;R===void 0&&(R=null),M(R)&&(R=j(R)),v(R)},L.onerror=function(){h(L.error)}}catch(R){h(R)}})}).catch(h)});return _(g,p),g}function re(a,p){var u=this,g=new f(function(v,h){u.ready().then(function(){G(u._dbInfo,W,function(E,T){if(E)return h(E);try{var C=T.objectStore(u._dbInfo.storeName),L=C.openCursor(),R=1;L.onsuccess=function(){var U=L.result;if(U){var q=U.value;M(q)&&(q=j(q));var X=a(q,U.key,R++);X!==void 0?v(X):U.continue()}else v()},L.onerror=function(){h(L.error)}}catch(U){h(U)}})}).catch(h)});return _(g,p),g}function be(a,p,u){var g=this;a=N(a);var v=new f(function(h,E){var T;g.ready().then(function(){return T=g._dbInfo,k.call(p)==="[object Blob]"?A(T.db).then(function(C){return C?p:he(p)}):p}).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),h(C)},R.onabort=R.onerror=function(){var X=q.error?q.error:q.transaction.error;E(X)}}catch(X){E(X)}})}).catch(E)});return _(v,u),v}function me(a,p){var u=this;a=N(a);var g=new f(function(v,h){u.ready().then(function(){G(u._dbInfo,O,function(E,T){if(E)return h(E);try{var C=T.objectStore(u._dbInfo.storeName),L=C.delete(a);T.oncomplete=function(){v()},T.onerror=function(){h(L.error)},T.onabort=function(){var R=L.error?L.error:L.transaction.error;h(R)}}catch(R){h(R)}})}).catch(h)});return _(g,p),g}function Je(a){var p=this,u=new f(function(g,v){p.ready().then(function(){G(p._dbInfo,O,function(h,E){if(h)return v(h);try{var T=E.objectStore(p._dbInfo.storeName),C=T.clear();E.oncomplete=function(){g()},E.onabort=E.onerror=function(){var L=C.error?C.error:C.transaction.error;v(L)}}catch(L){v(L)}})}).catch(v)});return _(u,a),u}function qe(a){var p=this,u=new f(function(g,v){p.ready().then(function(){G(p._dbInfo,W,function(h,E){if(h)return v(h);try{var T=E.objectStore(p._dbInfo.storeName),C=T.count();C.onsuccess=function(){g(C.result)},C.onerror=function(){v(C.error)}}catch(L){v(L)}})}).catch(v)});return _(u,a),u}function Xe(a,p){var u=this,g=new f(function(v,h){if(a<0){v(null);return}u.ready().then(function(){G(u._dbInfo,W,function(E,T){if(E)return h(E);try{var C=T.objectStore(u._dbInfo.storeName),L=!1,R=C.openKeyCursor();R.onsuccess=function(){var U=R.result;if(!U){v(null);return}a===0||L?v(U.key):(L=!0,U.advance(a))},R.onerror=function(){h(R.error)}}catch(U){h(U)}})}).catch(h)});return _(g,p),g}function Qe(a){var p=this,u=new f(function(g,v){p.ready().then(function(){G(p._dbInfo,W,function(h,E){if(h)return v(h);try{var T=E.objectStore(p._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(){v(C.error)}}catch(R){v(R)}})}).catch(v)});return _(u,a),u}function Xs(a,p){p=F.apply(this,arguments);var u=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||u.name,a.storeName=a.storeName||u.storeName);var g=this,v;if(!a.name)v=f.reject("Invalid arguments");else{var h=a.name===u.name&&g._dbInfo.db,E=h?f.resolve(g._dbInfo.db):Y(a).then(function(T){var C=H[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?v=E.then(function(T){if(T.objectStoreNames.contains(a.storeName)){var C=T.version+1;S(a);var L=H[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,ue){var ae=d.open(a.name,C);ae.onerror=function(ve){var et=ae.result;et.close(),ue(ve)},ae.onupgradeneeded=function(){var ve=ae.result;ve.deleteObjectStore(a.storeName)},ae.onsuccess=function(){var ve=ae.result;ve.close(),Q(ve)}});return X.then(function(Q){L.db=Q;for(var ue=0;ue<R.length;ue++){var ae=R[ue];ae._dbInfo.db=Q,D(ae._dbInfo)}}).catch(function(Q){throw(b(a,Q)||f.resolve()).catch(function(){}),Q})}}):v=E.then(function(T){S(a);var C=H[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 ue=d.deleteDatabase(a.name);ue.onerror=function(){var ae=ue.result;ae&&ae.close(),Q(ue.error)},ue.onblocked=function(){console.warn('dropInstance blocked for database "'+a.name+'" until all open connections are closed')},ue.onsuccess=function(){var ae=ue.result;ae&&ae.close(),X(ae)}});return q.then(function(X){C.db=X;for(var Q=0;Q<L.length;Q++){var ue=L[Q];D(ue._dbInfo)}}).catch(function(X){throw(b(a,X)||f.resolve()).catch(function(){}),X})})}return _(v,p),v}var Qs={_driver:"asyncStorage",_initStorage:ne,_support:l(),iterate:re,getItem:le,setItem:be,removeItem:me,clear:Je,length:qe,key:Xe,keys:Qe,dropInstance:Xs};function Zs(){return typeof openDatabase=="function"}var Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ei="~~local_forage_type~",dr=/^~~local_forage_type~([^~]+)~/,It="__lfsc__:",rn=It.length,on="arbf",sn="blob",lr="si08",fr="ui08",pr="uic8",hr="si16",gr="si32",_r="ur16",mr="ui32",vr="fl32",wr="fl64",yr=rn+on.length,Er=Object.prototype.toString;function br(a){var p=a.length*.75,u=a.length,g,v=0,h,E,T,C;a[a.length-1]==="="&&(p--,a[a.length-2]==="="&&p--);var L=new ArrayBuffer(p),R=new Uint8Array(L);for(g=0;g<u;g+=4)h=Ae.indexOf(a[g]),E=Ae.indexOf(a[g+1]),T=Ae.indexOf(a[g+2]),C=Ae.indexOf(a[g+3]),R[v++]=h<<2|E>>4,R[v++]=(E&15)<<4|T>>2,R[v++]=(T&3)<<6|C&63;return L}function an(a){var p=new Uint8Array(a),u="",g;for(g=0;g<p.length;g+=3)u+=Ae[p[g]>>2],u+=Ae[(p[g]&3)<<4|p[g+1]>>4],u+=Ae[(p[g+1]&15)<<2|p[g+2]>>6],u+=Ae[p[g+2]&63];return p.length%3===2?u=u.substring(0,u.length-1)+"=":p.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function ti(a,p){var u="";if(a&&(u=Er.call(a)),a&&(u==="[object ArrayBuffer]"||a.buffer&&Er.call(a.buffer)==="[object ArrayBuffer]")){var g,v=It;a instanceof ArrayBuffer?(g=a,v+=on):(g=a.buffer,u==="[object Int8Array]"?v+=lr:u==="[object Uint8Array]"?v+=fr:u==="[object Uint8ClampedArray]"?v+=pr:u==="[object Int16Array]"?v+=hr:u==="[object Uint16Array]"?v+=_r:u==="[object Int32Array]"?v+=gr:u==="[object Uint32Array]"?v+=mr:u==="[object Float32Array]"?v+=vr:u==="[object Float64Array]"?v+=wr:p(new Error("Failed to get type for BinaryArray"))),p(v+an(g))}else if(u==="[object Blob]"){var h=new FileReader;h.onload=function(){var E=ei+a.type+"~"+an(this.result);p(It+sn+E)},h.readAsArrayBuffer(a)}else try{p(JSON.stringify(a))}catch(E){console.error("Couldn't convert value into a JSON string: ",a),p(null,E)}}function ni(a){if(a.substring(0,rn)!==It)return JSON.parse(a);var p=a.substring(yr),u=a.substring(rn,yr),g;if(u===sn&&dr.test(p)){var v=p.match(dr);g=v[1],p=p.substring(v[0].length)}var h=br(p);switch(u){case on:return h;case sn:return m([h],{type:g});case lr:return new Int8Array(h);case fr:return new Uint8Array(h);case pr:return new Uint8ClampedArray(h);case hr:return new Int16Array(h);case _r:return new Uint16Array(h);case gr:return new Int32Array(h);case mr:return new Uint32Array(h);case vr:return new Float32Array(h);case wr:return new Float64Array(h);default:throw new Error("Unkown type: "+u)}}var cn={serialize:ti,deserialize:ni,stringToBuffer:br,bufferToString:an};function Sr(a,p,u,g){a.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,g)}function ri(a){var p=this,u={db:null};if(a)for(var g in a)u[g]=typeof a[g]!="string"?a[g].toString():a[g];var v=new f(function(h,E){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(T){return E(T)}u.db.transaction(function(T){Sr(T,u,function(){p._dbInfo=u,h()},function(C,L){E(L)})},E)});return u.serializer=cn,v}function Ne(a,p,u,g,v,h){a.executeSql(u,g,v,function(E,T){T.code===T.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(C,L){L.rows.length?h(C,T):Sr(C,p,function(){C.executeSql(u,g,v,h)},h)},h):h(E,T)},h)}function oi(a,p){var u=this;a=N(a);var g=new f(function(v,h){u.ready().then(function(){var E=u._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)),v(R)},function(C,L){h(L)})})}).catch(h)});return _(g,p),g}function si(a,p){var u=this,g=new f(function(v,h){u.ready().then(function(){var E=u._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){v(Q);return}}v()},function(C,L){h(L)})})}).catch(h)});return _(g,p),g}function Dr(a,p,u,g){var v=this;a=N(a);var h=new f(function(E,T){v.ready().then(function(){p===void 0&&(p=null);var C=p,L=v._dbInfo;L.serializer.serialize(p,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(Dr.apply(v,[a,C,u,g-1]));return}T(q)}})})}).catch(T)});return _(h,u),h}function ii(a,p,u){return Dr.apply(this,[a,p,u,1])}function ai(a,p){var u=this;a=N(a);var g=new f(function(v,h){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(T){Ne(T,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[a],function(){v()},function(C,L){h(L)})})}).catch(h)});return _(g,p),g}function ci(a){var p=this,u=new f(function(g,v){p.ready().then(function(){var h=p._dbInfo;h.db.transaction(function(E){Ne(E,h,"DELETE FROM "+h.storeName,[],function(){g()},function(T,C){v(C)})})}).catch(v)});return _(u,a),u}function ui(a){var p=this,u=new f(function(g,v){p.ready().then(function(){var h=p._dbInfo;h.db.transaction(function(E){Ne(E,h,"SELECT COUNT(key) as c FROM "+h.storeName,[],function(T,C){var L=C.rows.item(0).c;g(L)},function(T,C){v(C)})})}).catch(v)});return _(u,a),u}function di(a,p){var u=this,g=new f(function(v,h){u.ready().then(function(){var E=u._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;v(R)},function(C,L){h(L)})})}).catch(h)});return _(g,p),g}function li(a){var p=this,u=new f(function(g,v){p.ready().then(function(){var h=p._dbInfo;h.db.transaction(function(E){Ne(E,h,"SELECT key FROM "+h.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){v(C)})})}).catch(v)});return _(u,a),u}function fi(a){return new f(function(p,u){a.transaction(function(g){g.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(v,h){for(var E=[],T=0;T<h.rows.length;T++)E.push(h.rows.item(T).name);p({db:a,storeNames:E})},function(v,h){u(h)})},function(g){u(g)})})}function pi(a,p){p=F.apply(this,arguments);var u=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||u.name,a.storeName=a.storeName||u.storeName);var g=this,v;return a.name?v=new f(function(h){var E;a.name===u.name?E=g._dbInfo.db:E=openDatabase(a.name,"","",0),a.storeName?h({db:E,storeNames:[a.storeName]}):h(fi(E))}).then(function(h){return new f(function(E,T){h.db.transaction(function(C){function L(X){return new f(function(Q,ue){C.executeSql("DROP TABLE IF EXISTS "+X,[],function(){Q()},function(ae,ve){ue(ve)})})}for(var R=[],U=0,q=h.storeNames.length;U<q;U++)R.push(L(h.storeNames[U]));f.all(R).then(function(){E()}).catch(function(X){T(X)})},function(C){T(C)})})}):v=f.reject("Invalid arguments"),_(v,p),v}var hi={_driver:"webSQLStorage",_initStorage:ri,_support:Zs(),iterate:si,getItem:oi,setItem:ii,removeItem:ai,clear:ci,length:ui,key:di,keys:li,dropInstance:pi};function gi(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Ir(a,p){var u=a.name+"/";return a.storeName!==p.storeName&&(u+=a.storeName+"/"),u}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 p=this,u={};if(a)for(var g in a)u[g]=a[g];return u.keyPrefix=Ir(a,p._defaultConfig),mi()?(p._dbInfo=u,u.serializer=cn,f.resolve()):f.reject()}function wi(a){var p=this,u=p.ready().then(function(){for(var g=p._dbInfo.keyPrefix,v=localStorage.length-1;v>=0;v--){var h=localStorage.key(v);h.indexOf(g)===0&&localStorage.removeItem(h)}});return _(u,a),u}function yi(a,p){var u=this;a=N(a);var g=u.ready().then(function(){var v=u._dbInfo,h=localStorage.getItem(v.keyPrefix+a);return h&&(h=v.serializer.deserialize(h)),h});return _(g,p),g}function Ei(a,p){var u=this,g=u.ready().then(function(){for(var v=u._dbInfo,h=v.keyPrefix,E=h.length,T=localStorage.length,C=1,L=0;L<T;L++){var R=localStorage.key(L);if(R.indexOf(h)===0){var U=localStorage.getItem(R);if(U&&(U=v.serializer.deserialize(U)),U=a(U,R.substring(E),C++),U!==void 0)return U}}});return _(g,p),g}function bi(a,p){var u=this,g=u.ready().then(function(){var v=u._dbInfo,h;try{h=localStorage.key(a)}catch{h=null}return h&&(h=h.substring(v.keyPrefix.length)),h});return _(g,p),g}function Si(a){var p=this,u=p.ready().then(function(){for(var g=p._dbInfo,v=localStorage.length,h=[],E=0;E<v;E++){var T=localStorage.key(E);T.indexOf(g.keyPrefix)===0&&h.push(T.substring(g.keyPrefix.length))}return h});return _(u,a),u}function Di(a){var p=this,u=p.keys().then(function(g){return g.length});return _(u,a),u}function Ii(a,p){var u=this;a=N(a);var g=u.ready().then(function(){var v=u._dbInfo;localStorage.removeItem(v.keyPrefix+a)});return _(g,p),g}function Ai(a,p,u){var g=this;a=N(a);var v=g.ready().then(function(){p===void 0&&(p=null);var h=p;return new f(function(E,T){var C=g._dbInfo;C.serializer.serialize(p,function(L,R){if(R)T(R);else try{localStorage.setItem(C.keyPrefix+a,L),E(h)}catch(U){(U.name==="QuotaExceededError"||U.name==="NS_ERROR_DOM_QUOTA_REACHED")&&T(U),T(U)}})})});return _(v,u),v}function Ni(a,p){if(p=F.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var u=this.config();a.name=a.name||u.name,a.storeName=a.storeName||u.storeName}var g=this,v;return a.name?v=new f(function(h){a.storeName?h(Ir(a,g._defaultConfig)):h(a.name+"/")}).then(function(h){for(var E=localStorage.length-1;E>=0;E--){var T=localStorage.key(E);T.indexOf(h)===0&&localStorage.removeItem(T)}}):v=f.reject("Invalid arguments"),_(v,p),v}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(p,u){return p===u||typeof p=="number"&&typeof u=="number"&&isNaN(p)&&isNaN(u)},Ci=function(p,u){for(var g=p.length,v=0;v<g;){if(Oi(p[v],u))return!0;v++}return!1},Ar=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},Ze={},Nr={},Ve={INDEXEDDB:Qs,WEBSQL:hi,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,p){a[p]=function(){var u=arguments;return a.ready().then(function(){return a[p].apply(a,u)})}}function dn(){for(var a=1;a<arguments.length;a++){var p=arguments[a];if(p)for(var u in p)p.hasOwnProperty(u)&&(Ar(p[u])?arguments[0][u]=p[u].slice():arguments[0][u]=p[u])}return arguments[0]}var xi=function(){function a(p){i(this,a);for(var u in Ve)if(Ve.hasOwnProperty(u)){var g=Ve[u],v=g._driver;this[u]=v,Ze[v]||this.defineDriver(g)}this._defaultConfig=dn({},Ri),this._config=dn({},this._defaultConfig,p),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(u){if((typeof u>"u"?"undefined":s(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var g in u){if(g==="storeName"&&(u[g]=u[g].replace(/\W/g,"_")),g==="version"&&typeof u[g]!="number")return new Error("Database version must be a number.");this._config[g]=u[g]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},a.prototype.defineDriver=function(u,g,v){var h=new f(function(E,T){try{var C=u._driver,L=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._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||u[X])&&typeof u[X]!="function"){T(L);return}}var ue=function(){for(var et=function(Ui){return function(){var ki=new Error("Method "+Ui+" is not implemented by the current driver"),Tr=f.reject(ki);return _(Tr,arguments[arguments.length-1]),Tr}},ln=0,$i=At.length;ln<$i;ln++){var fn=At[ln];u[fn]||(u[fn]=et(fn))}};ue();var ae=function(et){Ze[C]&&console.info("Redefining LocalForage driver: "+C),Ze[C]=u,Nr[C]=et,E()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(ae,T):ae(!!u._support):ae(!0)}catch(ve){T(ve)}});return y(h,g,v),h},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(u,g,v){var h=Ze[u]?f.resolve(Ze[u]):f.reject(new Error("Driver not found."));return y(h,g,v),h},a.prototype.getSerializer=function(u){var g=f.resolve(cn);return y(g,u),g},a.prototype.ready=function(u){var g=this,v=g._driverSet.then(function(){return g._ready===null&&(g._ready=g._initDriver()),g._ready});return y(v,u,u),v},a.prototype.setDriver=function(u,g,v){var h=this;Ar(u)||(u=[u]);var E=this._getSupportedDrivers(u);function T(){h._config.driver=h.driver()}function C(U){return h._extend(U),T(),h._ready=h._initStorage(h._config),h._ready}function L(U){return function(){var q=0;function X(){for(;q<U.length;){var Q=U[q];return q++,h._dbInfo=null,h._ready=null,h.getDriver(Q).then(C).catch(X)}T();var ue=new Error("No available storage method found.");return h._driverSet=f.reject(ue),h._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 h._dbInfo=null,h._ready=null,h.getDriver(U).then(function(q){h._driver=q._driver,T(),h._wrapLibraryMethodsWithReady(),h._initDriver=L(E)})}).catch(function(){T();var U=new Error("No available storage method found.");return h._driverSet=f.reject(U),h._driverSet}),y(this._driverSet,g,v),this._driverSet},a.prototype.supports=function(u){return!!Nr[u]},a.prototype._extend=function(u){dn(this,u)},a.prototype._getSupportedDrivers=function(u){for(var g=[],v=0,h=u.length;v<h;v++){var E=u[v];this.supports(E)&&g.push(E)}return g},a.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,g=un.length;u<g;u++)Pi(this,un[u])},a.prototype.createInstance=function(u){return new a(u)},a}(),Mi=new xi;r.exports=Mi},{3:3}]},{},[4])(4)})}(In)),In.exports}var ud=cd();const ro=Oo(ud),ee=class ee{constructor(e){fe(this,"db");this.db=ro.ready().then(()=>ro.createInstance({name:e?`${e}:${ee.DBName}`:ee.DBName}))}async findStorageUnitsBy(e,n,r){const o=[],{parentId:s,documentId:i,documentModelType:c,scope:d}=qi(e),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 _;if(s){const P=new Set;for(const V of s)(await this.getChildren(V)).forEach(k=>P.add(k));_=s.union(P)}else _=new Set(f);_=i?i.intersection(_):_;for(const P of _){const V=await this.get(P).catch(()=>null);if(V&&!(c&&!c.has(V.header.documentType)))for(const[H]of Object.entries(V.state))d&&!d.has(H)||o.push({documentId:P,documentModelType:V.header.documentType,scope:H,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(e,n){const r=await this.getSlugManifest();if(n!=null&&n.aborted)throw new Or("Aborted");const o=[];for(const s of e){const i=r.slugToId[s];if(!i)throw new Ot(s);o.push(i)}return Promise.resolve(o)}async resolveSlugs(e,n){const r=await this.getSlugManifest();if(n!=null&&n.aborted)throw new Or("Aborted");const o=[];for(const s of e){let i=!1;for(const[c,d]of Object.entries(r.slugToId))if(d===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(e){return!!await(await this.db).getItem(this.buildDocumentKey(e))}async create(e){const n=e.header.id;if(!Xi(n))throw new Qi(n);const r=await this.db;if(await this.exists(n))throw new Cr(n);const o=e.header.slug&&e.header.slug.length>0?e.header.slug:n;if(!Zi(o))throw new ea(o);if((await this.getSlugManifest()).slugToId[o])throw new Cr(n);if(e.header.slug=o,await r.setItem(this.buildDocumentKey(n),e),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)}e.header.documentType==="powerhouse/document-drive"&&this.updateDriveManifest(n,{documentIds:[]})}async get(e){const r=await(await this.db).getItem(this.buildDocumentKey(e));return r||Promise.reject(new Ot(e))}async getBySlug(e){const r=(await this.getSlugManifest()).slugToId[e];return r?this.get(r):Promise.reject(new Ot(e))}async findByType(e,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 _=f.slice(ee.DOCUMENT_KEY.length+ee.SEP.length);try{const y=await o.getItem(f);if(!y||y.header.documentType!==e)continue;c.push({id:_,document:y})}catch{continue}}c.sort((f,_)=>{const y=new Date(f.document.header.createdAtUtcIso),N=new Date(_.document.header.createdAtUtcIso);return y.getTime()===N.getTime()?f.id.localeCompare(_.id):y.getTime()-N.getTime()});let d=0;if(r){const f=c.findIndex(({id:_})=>_===r);f!==-1&&(d=f)}const l=Math.min(d+n,c.length);let m;return l<c.length&&(m=c[l].id),{documents:c.slice(d,l).map(({id:f})=>f),nextCursor:m}}async delete(e){var i;const n=await this.db,r=await n.getItem(this.buildDocumentKey(e));if(!r)return!1;const o=((i=r.header.slug)==null?void 0:i.length)>0?r.header.slug:e;try{if(o){const c=await this.getSlugManifest();c.slugToId[o]===e&&(delete c.slugToId[o],await this.updateSlugManifest(c))}}catch{}const s=await this.getParents(e);for(const c of s)await this.removeChild(c,e);return await n.removeItem(this.buildManifestKey(e)),await n.removeItem(this.buildDocumentKey(e)),!0}async removeChild(e,n){const r=await this.getManifest(e),o=r.documentIds.indexOf(n);return o!==-1?(r.documentIds.splice(o,1),await this.updateDriveManifest(e,r),!0):!1}async addChild(e,n){if(e===n)throw new Error("Cannot associate a document with itself");if((await this.getChildren(n)).includes(e))throw new Error("Cannot associate a document with its child");const o=await this.getManifest(e);o.documentIds.includes(n)||(o.documentIds.push(n),await this.updateDriveManifest(e,o))}async getChildren(e){return(await this.getManifest(e)).documentIds}async getParents(e){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(e)&&o.push(c)}return o}async getManifest(e){return await(await this.db).getItem(this.buildManifestKey(e))||{documentIds:[]}}async updateDriveManifest(e,n){await(await this.db).setItem(this.buildManifestKey(e),n)}async getSlugManifest(){return await(await this.db).getItem(ee.SLUG_MANIFEST_KEY)||{slugToId:{}}}async updateSlugManifest(e){await(await this.db).setItem(ee.SLUG_MANIFEST_KEY,e)}async addDocumentOperations(e,n,r){const o=await this.get(e);if(!o)throw new Error(`Document with id ${e} not found`);const s=Lr(o.operations,n);await(await this.db).setItem(this.buildDocumentKey(e),{...o,...r,operations:s})}async addDriveOperations(e,n,r){const o=await this.get(e),s=Lr(o.operations,n);await(await this.db).setItem(this.buildDocumentKey(e),{...o,...r,operations:s})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.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 e;do{const{documents:n,nextCursor:r}=await this.findByType("powerhouse/document-drive",100,e);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)))}e=r}while(e)}async migrateDrive(e){const n=await this.get(e),r=to(n);if(r!==n)return(await this.db).setItem(this.buildDocumentKey(e),r)}async migrateDocument(e,n){const r=await this.get(n),o=to(r);if(o!==r)return(await this.db).setItem(this.buildDocumentKey(n),o)}buildDocumentKey(e){return`${ee.DOCUMENT_KEY}${ee.SEP}${e}`}buildManifestKey(e){return`${ee.MANIFEST_KEY}${ee.SEP}${e}`}};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 kn=ee;const oo=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,An=oo?oo.split(","):[],dd=()=>({defaultDrives:{remoteDrives:An.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]}})),removeOldRemoteDrives:An.length>0?{strategy:"preserve-by-url-and-detach",urls:An}:{strategy:"preserve-all"}}});function ld(t){return new kn(t)}function fd(t,e){return new na(t).withStorage(e).withCache(new ra).withQueueManager(new oa).withOptions({...dd()}).build()}async function so(t,e,n,r,o,s){var d;if(!s||!t.action||!((d=t.action)!=null&&d.context)||!t.action.context.signer)return t;if(!o)return te.error(`Document model '${r.header.documentType}' does not have a reducer`),t;const i=t.action.context.signer;return await sa(t.action,o,r,i,e)}function pd(t,e,n){return n?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:n.address,networkId:n.networkId,chainId:n.chainId},signatures:[]}},...t}:t}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 pp(t){const e=await qt();if(!e)throw new Error("HMR not available.");return new Promise(n=>{function r(o){t===o.name&&(n(),e==null||e.off("studio:external-package-added",r))}e.on("studio:external-package-added",r),e.send("studio:add-external-package",{name:t})})}async function hp(t){const e=await qt();if(!e)throw new Error("HMR not available.");return new Promise(n=>{function r(o){t===o.name&&(n(),e==null||e.off("studio:external-package-removed",r))}e.on("studio:external-package-removed",r),e.send("studio:remove-external-package",{name:t})})}async function hd(t){const e=await qt(),n=r=>{const o=Te(()=>import(`${r.url}?t=${r.timestamp}`),[],import.meta.url);t(o.then(s=>s.default))};return e==null||e.on("studio:external-packages-updated",n),()=>{e==null||e.off("studio:external-packages-updated",n)}}const ds=Object.prototype.toString;function gd(t){switch(ds.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Xt(t,Error)}}function Ge(t,e){return ds.call(t)===`[object ${e}]`}function gp(t){return Ge(t,"ErrorEvent")}function _p(t){return Ge(t,"DOMError")}function mp(t){return Ge(t,"DOMException")}function Yt(t){return Ge(t,"String")}function _d(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function vp(t){return t===null||_d(t)||typeof t!="object"&&typeof t!="function"}function nr(t){return Ge(t,"Object")}function md(t){return typeof Event<"u"&&Xt(t,Event)}function vd(t){return typeof Element<"u"&&Xt(t,Element)}function wd(t){return Ge(t,"RegExp")}function rr(t){return!!(t&&t.then&&typeof t.then=="function")}function yd(t){return nr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Ed(t){return typeof t=="number"&&t!==t}function Xt(t,e){try{return t instanceof e}catch{return!1}}function ls(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function ut(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Nn(t,e){let n=t;const r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-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 wp(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const o=t[r];try{ls(o)?n.push("[VueViewModel]"):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function bd(t,e,n=!1){return Yt(t)?wd(e)?e.test(t):Yt(e)?n?t===e:t.includes(e):!1:!1}function yp(t,e=[],n=!1){return e.some(r=>bd(t,r,n))}function Rt(t){return t&&t.Math==Math?t:void 0}const _e=typeof globalThis=="object"&&Rt(globalThis)||typeof window=="object"&&Rt(window)||typeof self=="object"&&Rt(self)||typeof global=="object"&&Rt(global)||function(){return this}()||{};function Sd(){return _e}function fs(t,e,n){const r=n||_e,o=r.__SENTRY__=r.__SENTRY__||{};return o[t]||(o[t]=e())}const je=Sd(),Dd=80;function Id(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,o=[];let s=0,i=0;const c=" > ",d=c.length;let l;const m=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Dd;for(;n&&s++<r&&(l=Ad(n,m),!(l==="html"||s>1&&i+o.length*d+l.length>=f));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(c)}catch{return"<unknown>"}}function Ad(t,e){const n=t,r=[];let o,s,i,c,d;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 l=e&&e.length?e.filter(f=>n.getAttribute(f)).map(f=>[f,n.getAttribute(f)]):null;if(l&&l.length)l.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+/),d=0;d<s.length;d++)r.push(`.${s[d]}`);const m=["aria-label","type","name","title","alt"];for(d=0;d<m.length;d++)i=m[d],c=n.getAttribute(i),c&&r.push(`[${i}="${c}"]`);return r.join("")}function Ep(){try{return je.document.location.href}catch{return""}}function bp(t){return je.document&&je.document.querySelector?je.document.querySelector(t):null}function Sp(t){if(!je.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement&&e.dataset.sentryComponent)return e.dataset.sentryComponent;e=e.parentNode}return null}const or=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Nd="Sentry Logger ",io=["debug","info","warn","error","log","assert","trace"],ao={};function ps(t){if(!("console"in _e))return t();const e=_e.console,n={},r=Object.keys(ao);r.forEach(o=>{const s=ao[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function Td(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return or?io.forEach(n=>{e[n]=(...r)=>{t&&ps(()=>{_e.console[n](`${Nd}[${n}]:`,...r)})}}):io.forEach(n=>{e[n]=()=>{}}),e}const we=Td();function Dp(t,e,n){if(!(e in t))return;const r=t[e],o=n(r);typeof o=="function"&&Od(o,r),t[e]=o}function hs(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{or&&we.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Od(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,hs(t,"__sentry_original__",e)}catch{}}function Ip(t){return t.__sentry_original__}function Ap(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function gs(t){if(gd(t))return{message:t.message,name:t.name,stack:t.stack,...uo(t)};if(md(t)){const e={type:t.type,target:co(t.target),currentTarget:co(t.currentTarget),...uo(t)};return typeof CustomEvent<"u"&&Xt(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function co(t){try{return vd(t)?Id(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function uo(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function Np(t,e=40){const n=Object.keys(gs(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return ut(n[0],e);for(let r=n.length;r>0;r--){const o=n.slice(0,r).join(", ");if(!(o.length>e))return r===n.length?o:ut(o,e)}return""}function xe(t){return Bn(t,new Map)}function Bn(t,e){if(Cd(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const o of Object.keys(t))typeof t[o]<"u"&&(r[o]=Bn(t[o],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(o=>{r.push(Bn(o,e))}),r}return t}function Cd(t){if(!nr(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const _s=50,lo=/\(error: (.*)\)/,fo=/captureMessage|captureException/;function Ld(...t){const e=t.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 d=lo.test(c)?c.replace(lo,"$1"):c;if(!d.match(/\S*Error: /)){for(const l of e){const m=l(d);if(m){o.push(m);break}}if(o.length>=_s)break}}return Rd(o)}}function Tp(t){return Array.isArray(t)?Ld(...t):t}function Rd(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),fo.test(e[e.length-1].function||"")&&(e.pop(),fo.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,_s).map(n=>({...n,filename:n.filename||e[e.length-1].filename,function:n.function||"?"}))}const Tn="<anonymous>";function Pd(t){try{return!t||typeof t!="function"?Tn:t.name||Tn}catch{return Tn}}function ie(){const t=_e,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function ms(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Op(t){const{message:e,event_id:n}=t;if(e)return e;const r=ms(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Cp(t,e,n){const r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function xd(t,e){const n=ms(t);if(!n)return;const r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){const s={...o&&o.data,...e.data};n.mechanism.data=s}}function Lp(t,e,n=5){if(e.lineno===void 0)return;const r=t.length,o=Math.max(Math.min(r-1,e.lineno-1),0);e.pre_context=t.slice(Math.max(0,o-n),o).map(s=>Nn(s,0)),e.context_line=Nn(t[Math.min(r-1,o)],e.colno||0),e.post_context=t.slice(Math.min(o+1,r),o+1+n).map(s=>Nn(s,0))}function Rp(t){if(t&&t.__sentry_captured__)return!0;try{hs(t,"__sentry_captured__",!0)}catch{}return!1}function Md(t){return Array.isArray(t)?t:[t]}function $d(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(o){if(t)return e.has(o)?!0:(e.add(o),!1);for(let s=0;s<e.length;s++)if(e[s]===o)return!0;return e.push(o),!1}function r(o){if(t)e.delete(o);else for(let s=0;s<e.length;s++)if(e[s]===o){e.splice(s,1);break}}return[n,r]}function Ce(t,e=100,n=1/0){try{return Fn("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Ud(t,e=3,n=100*1024){const r=Ce(t,e);return Vd(r)>n?Ud(t,e-1,n):r}function Fn(t,e,n=1/0,r=1/0,o=$d()){const[s,i]=o;if(e==null||["number","boolean","string"].includes(typeof e)&&!Ed(e))return e;const c=kd(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;const d=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(d===0)return c.replace("object ","");if(s(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const y=l.toJSON();return Fn("",y,d-1,r,o)}catch{}const m=Array.isArray(e)?[]:{};let f=0;const _=gs(e);for(const y in _){if(!Object.prototype.hasOwnProperty.call(_,y))continue;if(f>=r){m[y]="[MaxProperties ~]";break}const N=_[y];m[y]=Fn(y,N,d-1,r,o),f++}return i(e),m}function kd(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(ls(e))return"[VueViewModel]";if(yd(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${Pd(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=Bd(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Bd(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Fd(t){return~-encodeURI(t).split(/%..|./).length}function Vd(t){return Fd(JSON.stringify(t))}var Se;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(Se||(Se={}));function Pp(t){return new Ee(e=>{e(t)})}function xp(t){return new Ee((e,n)=>{n(t)})}class Ee{constructor(e){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{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Ee((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Ee((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}__init(){this._resolve=e=>{this._setResult(Se.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Se.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===Se.PENDING){if(rr(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Se.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.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 jd(){const{performance:t}=_e;if(!t||!t.now)return Qt;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/vs}const sr=jd(),Mp=(()=>{const{performance:t}=_e;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=o<e,i=t.timing&&t.timing.navigationStart,d=typeof i=="number"?Math.abs(i+n-r):e,l=d<e;return s||l?o<=d?t.timeOrigin:i:r})(),$p="baggage",ws="sentry-",zd=/^sentry-/,Hd=8192;function ys(t){if(!Yt(t)&&!Array.isArray(t))return;let e={};if(Array.isArray(t))e=t.reduce((r,o)=>{const s=po(o);for(const i of Object.keys(s))r[i]=s[i];return r},{});else{if(!t)return;e=po(t)}const n=Object.entries(e).reduce((r,[o,s])=>{if(o.match(zd)){const i=o.slice(ws.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Up(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${ws}${r}`]=o),n),{});return Yd(e)}function po(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(e[n]=r,e),{})}function Yd(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>Hd?(or&&we.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}const Wd=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Es(t){if(!t)return;const e=t.match(Wd);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function kp(t,e){const n=Es(t),r=ys(e),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceparentData:n,dynamicSamplingContext:r||{},propagationContext:{traceId:o||ie(),parentSpanId:s||ie().substring(16),spanId:ie().substring(16),sampled:i,dsc:r||{}}}:{traceparentData:n,dynamicSamplingContext:void 0,propagationContext:{traceId:o||ie(),spanId:ie().substring(16)}}}function Bp(t,e){const n=Es(t),r=ys(e),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceId:o||ie(),parentSpanId:s||ie().substring(16),spanId:ie().substring(16),sampled:i,dsc:r||{}}:{traceId:o||ie(),spanId:ie().substring(16)}}function Gd(t=ie(),e=ie().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}const ze=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Zt="production";function ir(){return fs("globalEventProcessors",()=>[])}function Fp(t){ir().push(t)}function Wt(t,e,n,r=0){return new Ee((o,s)=>{const i=t[r];if(e===null||typeof i!="function")o(e);else{const c=i({...e},n);ze&&i.id&&c===null&&we.log(`Event processor "${i.id}" dropped event`),rr(c)?c.then(d=>Wt(t,d,n,r+1).then(o)).then(null,s):Wt(t,c,n,r+1).then(o).then(null,s)}})}function bs(t){const e=sr(),n={sid:ie(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Kd(n)};return t&&bt(n,t),n}function bt(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||sr(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:ie()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ss(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),bt(t,n)}function Kd(t){return xe({sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}const Vp=0,Jd=1;function qd(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,tags:c,origin:d}=pt(t);return xe({data:r,op:o,parent_span_id:s,span_id:e,status:i,tags:c,trace_id:n,origin:d})}function jp(t){const{traceId:e,spanId:n}=t.spanContext(),r=Ds(t);return Gd(e,n,r)}function zp(t){return typeof t=="number"?ho(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?ho(t.getTime()):sr()}function ho(t){return t>9999999999?t/1e3:t}function pt(t){return Xd(t)?t.getSpanJSON():typeof t.toJSON=="function"?t.toJSON():{}}function Xd(t){return typeof t.getSpanJSON=="function"}function Ds(t){const{traceFlags:e}=t.spanContext();return!!(e&Jd)}function Hp(t,e,n,r,o,s){const{normalizeDepth:i=3,normalizeMaxBreadth:c=1e3}=t,d={...e,event_id:e.event_id||n.event_id||ie(),timestamp:e.timestamp||Qt()},l=n.integrations||t.integrations.map(P=>P.name);Qd(d,t),tl(d,l),e.type===void 0&&Zd(d,t.stackParser);const m=rl(r,n.captureContext);n.mechanism&&xd(d,n.mechanism);const f=o&&o.getEventProcessors?o.getEventProcessors():[],_=vl().getScopeData();if(s){const P=s.getScopeData();_o(_,P)}if(m){const P=m.getScopeData();_o(_,P)}const y=[...n.attachments||[],..._.attachments];y.length&&(n.attachments=y),Ts(d,_);const N=[...f,...ir(),..._.eventProcessors];return Wt(N,d,n).then(P=>(P&&el(P),typeof i=="number"&&i>0?nl(P,i,c):P))}function Qd(t,e){const{environment:n,release:r,dist:o,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?n:Zt),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=ut(t.message,s));const i=t.exception&&t.exception.values&&t.exception.values[0];i&&i.value&&(i.value=ut(i.value,s));const c=t.request;c&&c.url&&(c.url=ut(c.url,s))}const go=new WeakMap;function Zd(t,e){const n=_e._sentryDebugIds;if(!n)return;let r;const o=go.get(e);o?r=o:(r=new Map,go.set(e,r));const s=Object.keys(n).reduce((i,c)=>{let d;const l=r.get(c);l?d=l:(d=e(c),r.set(c,d));for(let m=d.length-1;m>=0;m--){const f=d[m];if(f.filename){i[f.filename]=n[c];break}}return i},{});try{t.exception.values.forEach(i=>{i.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function el(t){const e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.keys(e).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:e[r]})})}function tl(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function nl(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Ce(o.data,e,n)}}))},...t.user&&{user:Ce(t.user,e,n)},...t.contexts&&{contexts:Ce(t.contexts,e,n)},...t.extra&&{extra:Ce(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Ce(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>{const s=pt(o).data;return s&&(o.data=Ce(s,e,n)),o})),r}function rl(t,e){if(!e)return t;const n=t?t.clone():new Ie;return n.update(e),n}function ol(t){if(t)return sl(t)?{captureContext:t}:al(t)?{captureContext:t}:t}function sl(t){return t instanceof Ie||typeof t=="function"}const il=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function al(t){return Object.keys(t).some(e=>il.includes(e))}function Yp(t,e){return pe().captureException(t,ol(e))}function Wp(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return pe().captureMessage(t,n,r)}function Gp(t,e){return pe().captureEvent(t,e)}function Kp(t){pe().configureScope(t)}function Jp(t,e){pe().addBreadcrumb(t,e)}function qp(t,e){pe().setContext(t,e)}function Xp(t){pe().setExtras(t)}function Qp(t,e){pe().setExtra(t,e)}function Zp(t){pe().setTags(t)}function eh(t,e){pe().setTag(t,e)}function cl(t){pe().setUser(t)}function ul(...t){const e=pe();if(t.length===2){const[n,r]=t;return n?e.withScope(()=>(e.getStackTop().scope=n,r(n))):e.withScope(r)}return e.withScope(t[0])}function th(t){return bl(()=>t(tn()))}function nh(t,e){return ul(n=>(n.setSpan(t),e(n)))}function rh(t,e){return pe().startTransaction({...t},e)}async function oh(t){const e=Ke();return e?e.flush(t):(ze&&we.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function sh(t){const e=Ke();return e?e.close(t):(ze&&we.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function ih(){return pe().lastEventId()}function Ke(){return pe().getClient()}function ah(){return!!Ke()}function en(){return pe().getScope()}function ch(t){const e=Ke(),n=tn(),r=en(),{release:o,environment:s=Zt}=e&&e.getOptions()||{},{userAgent:i}=_e.navigator||{},c=bs({release:o,environment:s,user:r.getUser()||n.getUser(),...i&&{userAgent:i},...t}),d=n.getSession();return d&&d.status==="ok"&&bt(d,{status:"exited"}),Is(),n.setSession(c),r.setSession(c),c}function Is(){const t=tn(),e=en(),n=e.getSession()||t.getSession();n&&Ss(n),As(),t.setSession(),e.setSession()}function As(){const t=tn(),e=en(),n=Ke(),r=e.getSession()||t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function uh(t=!1){if(t){Is();return}As()}function Ns(t){return t.transaction}function dl(t,e,n){const r=e.getOptions(),{publicKey:o}=e.getDsn()||{},{segment:s}=n&&n.getUser()||{},i=xe({environment:r.environment||Zt,release:r.release,user_segment:s,public_key:o,trace_id:t});return e.emit&&e.emit("createDsc",i),i}function ll(t){const e=Ke();if(!e)return{};const n=dl(pt(t).trace_id||"",e,en()),r=Ns(t);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=pt(r);return i&&i!=="url"&&(n.transaction=c.description),n.sampled=String(Ds(r)),e.emit&&e.emit("createDsc",n),n}function Ts(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;fl(t,e),r&&gl(t,r),_l(t,n),pl(t,o),hl(t,s)}function _o(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,sdkProcessingMetadata:c,breadcrumbs:d,fingerprint:l,eventProcessors:m,attachments:f,propagationContext:_,transactionName:y,span:N}=e;rt(t,"extra",n),rt(t,"tags",r),rt(t,"user",o),rt(t,"contexts",s),rt(t,"sdkProcessingMetadata",c),i&&(t.level=i),y&&(t.transactionName=y),N&&(t.span=N),d.length&&(t.breadcrumbs=[...t.breadcrumbs,...d]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,..._}}function rt(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function fl(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:c}=e,d=xe(n);d&&Object.keys(d).length&&(t.extra={...d,...t.extra});const l=xe(r);l&&Object.keys(l).length&&(t.tags={...l,...t.tags});const m=xe(o);m&&Object.keys(m).length&&(t.user={...m,...t.user});const f=xe(s);f&&Object.keys(f).length&&(t.contexts={...f,...t.contexts}),i&&(t.level=i),c&&(t.transaction=c)}function pl(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function hl(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function gl(t,e){t.contexts={trace:qd(e),...t.contexts};const n=Ns(e);if(n){t.sdkProcessingMetadata={dynamicSamplingContext:ll(e),...t.sdkProcessingMetadata};const r=pt(n).description;r&&(t.tags={transaction:r,...t.tags})}}function _l(t,e){t.fingerprint=t.fingerprint?Md(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}const ml=100;let On;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=mo()}static clone(e){return e?e.clone():new Ie}clone(){const e=new Ie;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&bt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e;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(nr(n)){const r=e;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=mo(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:ml;if(r<=0)return this;const o={timestamp:Qt(),...e},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(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:n,_contexts:r,_tags:o,_extra:s,_user:i,_level:c,_fingerprint:d,_eventProcessors:l,_propagationContext:m,_sdkProcessingMetadata:f,_transactionName:_,_span:y}=this;return{breadcrumbs:e,attachments:n,contexts:r,tags:o,extra:s,user:i,level:c,fingerprint:d||[],eventProcessors:l,propagationContext:m,sdkProcessingMetadata:f,transactionName:_,span:y}}applyToEvent(e,n={},r=[]){Ts(e,this.getScopeData());const o=[...r,...ir(),...this._eventProcessors];return Wt(o,e,n)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:ie();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(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){const o=r&&r.event_id?r.event_id:ie();if(!this._client)return we.warn("No client configured on scope - will not capture message!"),o;const s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:ie();return this._client?(this._client.captureEvent(e,{...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(e=>{e(this)}),this._notifyingListeners=!1)}}function vl(){return On||(On=new Ie),On}function mo(){return{traceId:ie(),spanId:ie().substring(16)}}const wl="7.120.3",Os=parseFloat(wl),yl=100;class Cs{constructor(e,n,r,o=Os){this._version=o;let s;n?s=n:(s=new Ie,s.setClient(e));let i;r?i=r:(i=new Ie,i.setClient(e)),this._stack=[{scope:s}],e&&this.bindClient(e),this._isolationScope=i}isOlderThan(e){return this._version<e}bindClient(e){const n=this.getStackTop();n.client=e,n.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(e){const n=this.pushScope();let r;try{r=e(n)}catch(o){throw this.popScope(),o}return rr(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(e,n){const r=this._lastEventId=n&&n.event_id?n.event_id:ie(),o=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:o,...n,event_id:r}),r}captureMessage(e,n,r){const o=this._lastEventId=r&&r.event_id?r.event_id:ie(),s=new Error(e);return this.getScope().captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o}),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:ie();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...n,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,n){const{scope:r,client:o}=this.getStackTop();if(!o)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=yl}=o.getOptions&&o.getOptions()||{};if(i<=0)return;const d={timestamp:Qt(),...e},l=s?ps(()=>s(d,n)):d;l!==null&&(o.emit&&o.emit("beforeAddBreadcrumb",l,n),r.addBreadcrumb(l,i))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,n){this.getScope().setTag(e,n),this.getIsolationScope().setTag(e,n)}setExtra(e,n){this.getScope().setExtra(e,n),this.getIsolationScope().setExtra(e,n)}setContext(e,n){this.getScope().setContext(e,n),this.getIsolationScope().setContext(e,n)}configureScope(e){const{scope:n,client:r}=this.getStackTop();r&&e(n)}run(e){const n=vo(this);try{e(this)}finally{vo(n)}}getIntegration(e){const n=this.getClient();if(!n)return null;try{return n.getIntegration(e)}catch{return ze&&we.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,n){const r=this._callExtensionMethod("startTransaction",e,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(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Ss(r),this._sendSessionUpdate(),n.setSession()}startSession(e){const{scope:n,client:r}=this.getStackTop(),{release:o,environment:s=Zt}=r&&r.getOptions()||{},{userAgent:i}=_e.navigator||{},c=bs({release:o,environment:s,user:n.getUser(),...i&&{userAgent:i},...e}),d=n.getSession&&n.getSession();return d&&d.status==="ok"&&bt(d,{status:"exited"}),this.endSession(),n.setSession(c),c}shouldSendDefaultPii(){const e=this.getClient(),n=e&&e.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:n}=this.getStackTop(),r=e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(e,...n){const o=St().__SENTRY__;if(o&&o.extensions&&typeof o.extensions[e]=="function")return o.extensions[e].apply(this,n);ze&&we.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function St(){return _e.__SENTRY__=_e.__SENTRY__||{extensions:{},hub:void 0},_e}function vo(t){const e=St(),n=Vn(e);return Ls(e,t),n}function pe(){const t=St();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return El(t)}function tn(){return pe().getIsolationScope()}function El(t=St()){return(!Sl(t)||Vn(t).isOlderThan(Os))&&Ls(t,new Cs),Vn(t)}function bl(t,e={}){const n=St();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(t,e):t()}function Sl(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function Vn(t){return fs("hub",()=>new Cs,t)}function Ls(t,e){if(!t)return!1;const n=t.__SENTRY__=t.__SENTRY__||{};return n.hub=e,!0}const Dl=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",Il=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",Al=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",ke={},Nl=Symbol((ke?"production":void 0)!=="production"?"RESET":""),Rs=t=>typeof(t==null?void 0:t.then)=="function";function Tl(t=()=>{try{return window.localStorage}catch(n){(ke?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return Rs(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}const Ol=Tl();function Ps(t,e,n=Ol,r){const o=de(e);return(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0),o.onMount=i=>{i(n.getItem(t,e));let c;return n.subscribe&&(c=n.subscribe(t,i,e)),c},de(i=>i(o),(i,c,d)=>{const l=typeof d=="function"?d(i(o)):d;return l===Nl?(c(o,e),n.removeItem(t)):Rs(l)?l.then(m=>(c(o,m),n.setItem(t,m))):(c(o,l),n.setItem(t,l))})}const Cn=new WeakMap,Cl=(t,e)=>(Cn.has(e)?Cn:Cn.set(e,t())).get(e),Ll=t=>typeof(t==null?void 0:t.then)=="function",wo={state:"loading"};function dh(t){return Cl(()=>{const e=new WeakMap,n=de(0);(ke?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=de((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!Ll(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,wo),wo)},(o,s)=>{s(n,i=>i+1)});return(ke?"production":void 0)!=="production"&&(r.debugPrivate=!0),de(o=>o(r))},t)}const yo=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),Rl=new WeakMap,Pl=(t,e,n)=>{const r=yo(()=>new WeakMap,Rl,e);return yo(t,r,n)},xl=t=>typeof(t==null?void 0:t.then)=="function",Ml=()=>{};function $l(t,e=Ml){return Pl(()=>{const n=new WeakMap,r=new WeakMap,o=de(0);(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=de((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!xl(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(ke?"production":void 0)!=="production"&&(s.debugPrivate=!0),de(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function Ul(t){const e=de(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const kl=gt.routerBasename+"external-packages.js",Bl=window.__VITE_ENVS.PROD;async function Fl(){try{return Bl?(await import(kl)).default??[]:[]}catch(t){return console.error(t),[]}}const xs=de(async()=>typeof await qt()<"u");xs.debugLabel="hmrAvailableAtom";const lh=()=>Oe(xs),Dt=Ul(Fl);Dt.debugLabel="externalPackagesAtomInConnect";let Eo;Dt.onMount=t=>{Eo||(Eo=hd(e=>{t(e)}))};const Vl=()=>Oe(Dt),jl={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},Ms=de(async t=>{const e=await t(Dt);return[jl,...e.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]});Ms.debugLabel="appsAtomInConnect";const zl=()=>Oe(Ms),fh=()=>{const t=zl();return J(e=>{if(!e)return;const n=t.find(r=>r.driveEditor===e);return n==null?void 0:n.name},[t])},ph=t=>{const e=Vl();return ht(()=>{if(!t)return;const n=e.find(r=>{var o;return(o=r.manifest.apps)==null?void 0:o.find(s=>s.driveEditor===t)});return n==null?void 0:n.editors.find(r=>r.config.id===t)},[e,t])};let Pt;async function Hl(){const{ConnectCrypto:t}=await Te(async()=>{const{ConnectCrypto:r}=await import("./index.BfgjawT0.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),{BrowserKeyStorage:e}=await Te(async()=>{const{BrowserKeyStorage:r}=await import("./index.BfgjawT0.js");return{BrowserKeyStorage:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),n=new t(new e);return await n.did(),n}function Re(){return window.connectCrypto?Promise.resolve(window.connectCrypto):Pt||(Pt=Hl(),Pt)}function ar(){return ht(()=>({async regenerateDid(){return(await Re()).regenerateDid()},async did(){return(await Re()).did()},sign:async t=>await(await Re()).sign(t),async getIssuer(){return(await Re()).getIssuer()},async getBearerToken(t,e,n=!1){return(await Re()).getBearerToken(t,e,n)}}),[])}const $s=de(void 0);$s.debugLabel="didAtomInConnect";function Yl(){const[t,e]=$e($s);return ce(()=>{t||Re().then(n=>n.did()).then(n=>e(n)).catch(te.error)}),t}const Us=de("idle");Us.debugLabel="renownStatusAtomInConnect";const ks=de(window.renown?Promise.resolve(window.renown):void 0);ks.debugLabel="renownAtomInConnect";function nn(){const[t,e]=$e(ks),[n,r]=$e(Us),{did:o}=ar();async function s(i){r("loading");try{const c=await i();if(!c){r("error");return}const{initRenownBrowser:d}=await Te(async()=>{const{initRenownBrowser:f}=await import("./index.BbKJCE01.js").then(_=>_.b);return{initRenownBrowser:f}},__vite__mapDeps([2,1]),import.meta.url),l=d(c),m={user:function(){return Promise.resolve(l.user)},login:function(f){return l.login(f)},logout(){return Promise.resolve(l.logout())},on:{user(f){return l.on("user",f)}}};return r("finished"),m}catch(c){console.error("Error initializing renown:",c instanceof Error?c.message:"Unknown error"),r("error");return}}return!t&&n==="idle"&&e(s(o)),t}function Wl(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const bo={};function jn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&bo[e[0]]||(typeof e[0]=="string"&&(bo[e[0]]=new Date),Wl(...e))}const Bs=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function So(t,e,n){t.loadNamespaces(e,Bs(t,n))}function Do(t,e,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,Bs(t,r))}function Gl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],o=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(c,d)=>{const l=e.services.backendConnector.state[`${c}|${d}`];return l===-1||l===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!i(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||i(r,t)&&(!o||i(s,t)))}function Kl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(jn("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(o,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,t))return!1}}):Gl(t,e,n)}const Jl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ql={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Xl=t=>ql[t],Ql=t=>t.replace(Jl,Xl);let zn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Ql};function hh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};zn={...zn,...t}}function Zl(){return zn}let Fs;function gh(t){Fs=t}function ef(){return Fs}const tf=Yn();class nf{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const rf=(t,e)=>{const n=Me();return ce(()=>{n.current=t},[t,e]),n.current};function Vs(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:o}=Wn(tf)||{},s=n||r||ef();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new nf),!s){jn("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,W=[k,{},!1];return W.t=k,W.i18n={},W.ready=!1,W}s.options.react&&s.options.react.wait!==void 0&&jn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...Zl(),...s.options.react,...e},{useSuspense:c,keyPrefix:d}=i;let l=o||s.options&&s.options.defaultNS;l=typeof l=="string"?[l]:l||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(l);const m=(s.isInitialized||s.initializedStoreOnce)&&l.every(k=>Kl(k,s,i));function f(){return s.getFixedT(e.lng||null,i.nsMode==="fallback"?l:l[0],d)}const[_,y]=He(f);let N=l.join();e.lng&&(N=`${e.lng}${N}`);const F=rf(N),P=Me(!0);ce(()=>{const{bindI18n:k,bindI18nStore:W}=i;P.current=!0,!m&&!c&&(e.lng?Do(s,e.lng,l,()=>{P.current&&y(f)}):So(s,l,()=>{P.current&&y(f)})),m&&F&&F!==N&&P.current&&y(f);function O(){P.current&&y(f)}return k&&s&&s.on(k,O),W&&s&&s.store.on(W,O),()=>{P.current=!1,k&&s&&k.split(" ").forEach(B=>s.off(B,O)),W&&s&&W.split(" ").forEach(B=>s.store.off(B,O))}},[s,N]);const V=Me(!0);ce(()=>{P.current&&!V.current&&y(f),V.current=!1},[s,d]);const H=[_,s,m];if(H.t=_,H.i18n=s,H.ready=m,m||!m&&!c)return H;throw new Promise(k=>{e.lng?Do(s,e.lng,l,()=>k()):So(s,l,()=>k())})}const of="connect";function Ln(t,e){const{type:n="default",containerId:r=of,...o}=e||{};return ia(t,{type:n,containerId:r,...o})}const Pe=gt.routerBasename,sf=(t,e,n,r)=>{const o=Ps(`${Pe}:${t}`,e,void 0);return o.debugLabel=`storageAtom:${Pe}:${t}`,o},_h=(t,e,n)=>{const r=Ps(t,e,{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}:${t}`,r},af=[aa,ca],cf=af;function uf(...t){const e=new Map;for(const n of t)e.set(n.documentModel.id,n);return Array.from(e.values())}function df(t){return t.map(e=>e.documentModels).reduce((e,n)=>e.concat(n),[])}const cr=de(async t=>{const e=await t(Dt),n=df(e);return uf(...cf,...n)});cr.debugLabel="documentModelsAtomInConnect";const js=$l(cr);js.debugLabel="unwrappedDocumentModelsAtomInConnect";const zs=()=>Oe(js);function lf(t,e){return e==null?void 0:e.find(n=>n.documentModel.id===t)}const ff=()=>{const t=zs();return e=>lf(e,t)},mh=()=>{const t=zs(),{config:e}=xf(),{enabledEditors:n,disabledEditors:r}=e.editors;if(!t)return;const o=t.filter(s=>s.documentModel.id!=="powerhouse/document-drive");return n==="*"?t:r==="*"?[]:r?o.filter(s=>!r.includes(s.documentModel.id)):n?o.filter(s=>n.includes(s.documentModel.id)):o};async function pf(t,e){await gf(t,e);const n=await t.initialize(),r=n==null?void 0:n.at(0);if(r)throw r}function hf(){const t=gt.drives.sections.LOCAL.enabled,e=We(),n=Et(),r=Me(!1);ce(()=>{r.current||t&&e!==void 0&&n!==void 0&&(n.length>0||(e.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))},[t,e,n])}async function gf(t,e){const n=await(e==null?void 0:e.user()),r=await Re();n!=null&&n.address&&t.setGenerateJwtHandler(async o=>r.getBearerToken(o,n.address))}async function _f(t,e,n){const r=fd(e,t);return await pf(r,n),r}const ur=de(ld(gt.routerBasename));ur.debugLabel="storageAtomInConnect";const mf=()=>Oe(ur);let xt=!1;const Hs=de(void 0);Hs.debugLabel="userAtomInConnect";const Ys=()=>{const[t,e]=$e(Hs),n=nn();return ce(()=>{var o;let r=null;if(t){const{credential:s,...i}=t;r={id:i.did,username:(o=i.ens)==null?void 0:o.name,...i}}cl(r)},[t]),ce(()=>{if(xt)return;xt=!0,n==null||n.user().then(o=>{e(o||null)}).catch(()=>{e(null)});const r=n==null?void 0:n.on.user(o=>{e(o||null)});return()=>{r==null||r(),xt=!1}},[n,xt]),t};async function Io(t,e){if(!t)return;const n=t.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:e}})})).json()).data.driveIdBySlug}function vf(t){return t.split("/").pop()}function wf(t){const e=t.split("/");return e.pop(),e.pop(),e.push("graphql"),e.join("/")}function yf(t){const e=la(t,"document");return`query getDocument($documentId: PHID!, $driveId: String) {
|
|
16
|
+
${t.name} {
|
|
17
|
+
getDocument(docId: $documentId, driveId: $driveId) {
|
|
18
|
+
id
|
|
19
|
+
created
|
|
20
|
+
lastModified
|
|
21
|
+
name
|
|
22
|
+
revision
|
|
23
|
+
state {
|
|
24
|
+
${e}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}`}function Ef(t,e,n){const r=vf(t),o=yf(n),s={documentId:e,driveId:r};return da.compressToEncodedURIComponent(JSON.stringify({document:o.trim(),variables:JSON.stringify(s,null,2)}))}function vh(t,e,n){const r=wf(t),o=ua(n.name),s=Ef(t,e,n);return`${r}/${o}?explorerURLState=${s}`}const bf=()=>{const{t}=Vs();return kt("div",{children:[ye("p",{className:"font-medium",children:t("notifications.reloadApp")}),kt("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},Ws=de("initial");Ws.debugLabel="loginStatusAtomInConnect";const Sf=()=>{const[t,e]=$e(Ws),n=Ys(),r=nn(),{did:o,getBearerToken:s}=ar(),i=We(),c=J(async()=>{var _;const m=await o(),f=new URL(Dl);if(f.searchParams.set("connect",m),f.searchParams.set("network",Il),f.searchParams.set("chain",Al),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()),(_=window.open(f,"_self"))==null||_.focus()}},[o]),d=J(async m=>{if(r)try{e("checking");const f=await r.user();if((f==null?void 0:f.did)===m)return e("authorized"),f;const _=await r.login(m);if(_)return e("authorized"),i==null||i.setGenerateJwtHandler(async y=>s(y,_.address)),_;e("not-authorized")}catch(f){e("not-authorized"),te.error(f)}},[r,i,s]);ce(()=>{n&&t!=="authorized"&&e("authorized")},[n,t]);const l=J(async()=>{e("initial"),await(r==null?void 0:r.logout()),i==null||i.removeJwtHandler()},[r,i]);return ht(()=>({openRenown:c,user:n,status:n?"authorized":t,login:r?d:void 0,logout:l}),[r,c,n,t,d,l])};function Df(){const{user:t,status:e}=Sf(),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(t!==void 0){if(o){const i=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:i.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(s){const i=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:i.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function If(){const t=Df();if(!t)return;const{allowListType:e,isAllowed:n}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:n}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function Af(t){const e=new Map;for(const n of t){const r=n.scope,o=e.get(r)??new Array;o.push(n),e.set(r,o)}return e}function Nf(t){const e=new Map;for(const[n,r]of t){const o=e.get(n)??new Array;for(const s of r){const i=o.find(c=>c.index===s.index);if(i){i.action.type===s.action.type&&JSON.stringify(i.action.input)===JSON.stringify(s.action.input)?console.warn(`skipping duplicate operations with index '${s.index}'`,i,s):console.warn(`skipping duplicate operations with index '${s.index}' but different actions`,i,s);continue}o.push(s)}e.set(n,o)}return e}function Gs(){const t=Hn(["useDocumentDriveServer",Math.floor(Math.random()*999).toString()]),{isAllowedToCreateDocuments:e}=If()||{isAllowedToCreateDocuments:!1},n=Ys()||void 0,r=Yl(),{sign:o}=ar(),s=We(),i=mf(),c=ff(),d=Et(),l=ts(),m=J(async(M,x)=>s?await s.getDocument(M,x):void 0,[s]),f=J(async(M,x)=>{if(!s)return;const $=d==null?void 0:d.find(re=>re.header.id===M);if(!$)return;const G=pd(x.action,r,n),z={...x,action:{...x.action,context:{...x.action.context,...G.context}}},ne={...$},le=await so(z,o,M,ne,pn,n);try{const re=await s.queueOperation(M,le);return re.status!=="SUCCESS"&&t.error(re.error),re.document}catch(re){return t.error(re),$}},[s,d,o,n,r]),_=J(async(M,x)=>{if(!s)return;const $=d==null?void 0:d.find(me=>me.header.id===M);if(!$)return;const G={...$},z=pn($,x),ne=x.scope,re=z.operations[ne].findLast(me=>me.type===x.type);if(!re)throw new Error("There was an error applying the action");const be=await so(re,o,M,G,pn,n);return f(M,be)},[s,d,o,n,r,f]),y=J(async(M,x)=>{if(!s)return;const $=Af(x),G=Nf($);let z;for(const ne of G.values())if(z=await s.queueOperations(M,ne),z.status!=="SUCCESS")break;return(z==null?void 0:z.status)!=="SUCCESS"&&t.error(z==null?void 0:z.error),z==null?void 0:z.document},[s]),N=J(async(M,x,$,G,z,ne)=>{if(!s)throw new Error("Reactor is not loaded");if(!e)throw new Error("User is not allowed to create documents");if(!(d==null?void 0:d.find(Qe=>Qe.header.id===M)))return;const re=ne??Le(),be=c($);if(!be)throw new Error(`Document model module for type ${$} not found`);const me=be.utils.createDocument({...z});me.header=fa(re,$),me.header.name=x,await s.addDocument(me);const Je=pa({id:re,name:x,documentType:$,parentFolder:G??null}),qe=await _(M,Je),Xe=qe==null?void 0:qe.state.global.nodes.find(Qe=>Qe.id===re);if(!Xe||!Rr(Xe))throw new Error("There was an error adding document");return Xe},[f,d,e]),F=J(async(M,x,$,G)=>{if(t.verbose(`addFile(drive: ${x}, name: ${$}, folder: ${G})`),!s)return;if(!e)throw new Error("User is not allowed to create files");const z=await id(M,c),ne={header:z.header,history:z.history,initialState:z.initialState,state:z.initialState.state,operations:{global:[],local:[]},clipboard:[]},le=await N(x,$||(typeof M=="string"?z.header.name:M.name),z.header.documentType,G,ne);if(!le)throw new Error("There was an error adding file");d==null||d.find(re=>re.header.id===x),od(le.id,z,y,{}).catch(re=>{throw re})},[N,y,c,d,e,s]),P=J(async(M,x,$,G,z)=>{if(!e)throw new Error("User is not allowed to update files");const ne=await _(M,ha({id:x,name:G||void 0,parentFolder:z,documentType:$})),le=ne==null?void 0:ne.state.global.nodes.find(re=>re.id===x);if(!le||!Rr(le))throw new Error("There was an error updating document");return le},[f,e]),V=J(async(M,x,$)=>{if(!e)throw new Error("User is not allowed to create folders");const G=Le(),z=await _(M,ga({id:G,name:x,parentFolder:$})),ne=z==null?void 0:z.state.global.nodes.find(le=>le.id===G);if(!ne||!_a(ne))throw new Error("There was an error adding folder");return ne},[f,e]),H=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to delete documents");await _(M,ma({id:x}))},[f,e]),k=J(async(M,x,$)=>{if(!e)throw new Error("User is not allowed to rename documents");const G=await _(M,va({id:x,name:$})),z=G==null?void 0:G.state.global.nodes.find(ne=>ne.id===x);if(!z)throw new Error("There was an error renaming node");return z},[f,e]),W=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to move documents");l!=null&&l.header.id&&await _(l.header.id,wa({srcFolder:M.id,targetParentFolder:x==null?void 0:x.id}))},[f,e,l==null?void 0:l.header.id]),O=J(async(M,x)=>{if(!s||!l)return;if(!e)throw new Error("User is not allowed to copy documents");const G=ya({srcId:M.id,targetParentFolder:x==null?void 0:x.id,targetName:M.name},()=>Le(),l.state.global.nodes).map(ne=>Ea(ne)),z=await s.addActions(l.header.id,G);return z.status!=="SUCCESS"&&t.error(`Error copying files: ${z.status}`,z.error),z.document},[e,s,l]),B=J(async(M,x)=>{if(!s)return;if(!e)throw new Error("User is not allowed to create drives");const $=M.id||Le(),G=ba(M);return await s.addDrive({global:G.global,local:G.local,id:$},x)},[e,s]),w=J(async(M,x)=>s?await s.addRemoteDrive(M,x):void 0,[e,s]),A=J(async M=>{if(s){if(!e)throw new Error("User is not allowed to delete drives");await s.deleteDrive(M)}},[e,s]),S=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to rename drives");return await _(M,Sa({name:x}))},[f,e]),D=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to change drive availability");return await _(M,Da({availableOffline:x}))},[f,e]),b=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to change drive availability");return await _(M,Ia({type:x}))},[f,e]),I=J(async(M,x)=>{if(x!==dt&&s)try{const $=s.getSyncStatus(M);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Rn}},[s]),Y=J((M,x)=>{if(x!==dt&&s)try{const $=s.getSyncStatus(M);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Rn}},[s]),K=J(async()=>{s&&await i.clear()},[s,i]),se=J(async(M,x)=>{const $=await _(M,Aa({triggerId:x}));if($==null?void 0:$.state.local.triggers.find(z=>z.id===x))throw new Error(`There was an error removing trigger ${x}`)},[f]),he=J(async(M,x,$)=>{var le,re,be,me;if(!s)return;const G=Le(),z={driveId:M,listenerId:G,block:!1,filter:{branch:((le=$.pullFilter)==null?void 0:le.branch)??[],documentId:((re=$.pullFilter)==null?void 0:re.documentId)??[],documentType:((be=$.pullFilter)==null?void 0:be.documentType)??[],scope:((me=$.pullFilter)==null?void 0:me.scope)??[]},system:!1,label:`Pullresponder #${G}`,callInfo:{data:"",name:"PullResponder",transmitterType:"PullResponder"}},ne=s.listeners;z.transmitter=new Na(z,ne);try{await ne.setListener(M,z)}catch(Je){throw new Error(`Listener couldn't be registered: ${Je}`)}return{driveId:M,filter:z.filter,data:{interval:`${$.pullInterval}`||"1000",listenerId:G,url:x},id:G,type:"PullResponder"}},[s]),j=J(async(M,x)=>{const $=await _(M,Ta({trigger:x}));if(!($==null?void 0:$.state.local.triggers.find(z=>z.id===z.id)))throw new Error(`There was an error adding the trigger ${x.id}`)},[f]);return ht(()=>({addDocument:N,addDocumentOperations:y,addDriveOperation:f,addFile:F,addFolder:V,openFile:m,updateFile:P,deleteNode:H,renameNode:k,moveNode:W,copyNode:O,addDrive:B,addRemoteDrive:w,deleteDrive:A,renameDrive:S,setDriveAvailableOffline:D,setDriveSharingType:b,getSyncStatus:I,getSyncStatusSync:Y,clearStorage:K,removeTrigger:se,addTrigger:j,registerNewPullResponderTrigger:he}),[N,y,f,F,V,m,P,H,k,W,O,B,w,A,S,D,b,I,Y,K,se,j,he])}const Tf=1e5,Of=(t,e)=>e?t.toLocaleLowerCase().includes(`transmitter ${e} not found`):!1,Cf=()=>{const[t,e]=He([]),[n,r]=He(new Map),{addTrigger:o,removeTrigger:s,registerNewPullResponderTrigger:i,renameDrive:c,addRemoteDrive:d,setDriveSharingType:l}=Gs(),m=Et(),f=Me(new Map),_=J(async(F,P,V)=>{e(k=>[...k,V]);const H=P.data;if(H)try{let k=n.get(V);if(!k){if(k=await i(F,H.url,{pullInterval:Number(H.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 W=f.current.get(V)||1;f.current.set(V,W===Tf?W:W*10),te.error(k)}finally{e(k=>k.filter(W=>W!==V))}},[n,s,o,f,i]),y=J(async(F,P,V)=>{var H;e(k=>[...k,V]);try{const k=m==null?void 0:m.find(W=>W.header.id===F);if(!k)return;if(await s(F,P.id),await c(F,k.state.global.name+` (${k.header.id})`),await l(F,dt),(H=P.data)!=null&&H.url&&k.header.slug){const W=await Io(P.data.url,k.header.slug);if(W){const O=P.data.url.split("/");O[O.length-1]=W;const B=O.join("/");await d(B,{availableOffline:!0,sharingType:"PUBLIC",listeners:[],triggers:[]})}}}catch(k){te.error(k)}finally{e(k=>k.filter(W=>W!==V))}},[m,s,c,l,Io,d]),N=J(async(F,P,V,H)=>{var k;switch(V){case 400:{if(Of(H,(k=P.data)==null?void 0:k.listenerId)){if(!(localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false"))return;const O=`strands:${F}:${V}`;if(t.includes(O)||!P.data)return;const B=f.current.get(O)||0;setTimeout(()=>_(F,P,O),B)}break}case 404:{const W=`strands:${F}:${V}`;if(t.includes(W))return;setTimeout(()=>y(F,P,W),0);break}}},[y,_,t]);return ht(()=>({strandsErrorHandler:N}),[N])},Lf="feature-flags-config",$t=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,Rf=$t==null?void 0:$t.split(","),Ut=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||"powerhouse/document-drive",Pf=Ut==null?void 0:Ut.split(","),Ks={editors:{enabledEditors:$t==="*"?"*":Rf,disabledEditors:Ut==="*"?"*":Pf}},Js=sf(Lf,Ks);Js.debugLabel="featureFlagAtomInConnect";const xf=()=>{const[t,e]=$e(Js);return{config:{...Ks,...t},setConfig:e}},Ao=window.__VITE_ENVS.APP_VERSION,wh=window.navigator.userAgent.includes("Electron"),yh=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"},Mf=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,n=Object.keys(No).find(o=>e.includes(o)),r=n?No[n]:void 0;if(r)return`${t}/${r}/package.json`},$f=async()=>{const t=Mf();if(!t)return;const n=await(await fetch(t)).json(),{version:r}=n;return r},Uf=async()=>{const t=await $f();return t?{isLatest:t===Ao,currentVersion:Ao,latestVersion:t}:null},kf=()=>{const{t}=Vs(),{getSyncStatusSync:e}=Gs(),n=Me([]),r=Et();Cf();const[o]=Fc();async function s(){const c=await Uf();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}`):Ln(ye(bf,{}),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}ce(()=>{s().catch(console.error)},[]);const i=J(async(c,d)=>{c.forEach(l=>{const m=n.current.find(N=>N.header.id===l.header.id);if(!m)return;const f=Un(l),_=e(m.header.id,f),y=e(l.header.id,f);if(f!==dt&&y===Oa&&n.current.includes(l))return n.current=n.current.filter(N=>N.header.id!==l.header.id),Ln(d("notifications.driveSyncSuccess"),{type:"connect-success"});(y===hn||y===Rn)&&y!==_&&n.current.push(l)}),n.current.length>0&&await s()&&n.current.forEach(m=>{const f=Un(m),_=e(m.header.id,f);Ln(d(`notifications.${_===hn?"driveSyncConflict":"driveSyncError"}`,{drive:m.header.name}),{type:"connect-warning",toastId:`${_===hn?"driveSyncConflict":"driveSyncError"}-${m.header.id}`})})},[]);ce(()=>{i(r??[],t).catch(console.error)},[r,t,i])};var Bf=()=>null;function Ff(){const t=Oe(ur),e=Oe(cr),n=nn();nd(()=>_f(t,e,n)),hf()}const Vf=Gn(()=>Te(()=>import("./useInitSentry.BsZC-0d6.js").then(t=>t.r),__vite__mapDeps([5,1,6,7]),import.meta.url)),jf=Gn(()=>Te(()=>import("./cookie-banner.CQrIFtr9.js"),__vite__mapDeps([8,6,9,10,1,11,3,4]),import.meta.url).then(t=>({default:t.CookieBanner}))),zf=Gn(()=>Te(()=>import("./modal.BizsZF2D.js"),__vite__mapDeps([10,1]),import.meta.url).then(t=>({default:t.ModalManager})));function Hf(){return kf(),Ff(),nn(),null}const Yf=ye(La,{children:kt($c,{children:[window.__VITE_ENVS.DEV&&ye(Bf,{}),kt(xr,{fallback:ye(Pa,{}),name:"AppLoader",children:[ye(Hf,{}),ye(Vf,{})]}),ye(xr,{name:"CookieBanner",children:ye(zf,{children:ye(jf,{})})})]})});function Wf(t){Vi(t).render(Yf)}const qs=document.getElementById("app");if(!qs)throw new Error("#app element not found!");Wf(qs);const Eh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{or as $,ar as A,ff as B,lp as C,If as D,pd as E,so as F,Gs as G,ap as H,$u as I,fp as J,vh as K,mh as L,ph as M,We as N,Et as O,sp as P,ip as Q,Dl as R,fh as S,Sf as T,wh as U,yh as V,zl as W,Ln as X,Xt as Y,ut as Z,ps as _,De as a,Yp as a$,we as a0,Pd as a1,_e as a2,io as a3,Dp as a4,ao as a5,hs as a6,ie as a7,Sd as a8,Yt as a9,Ed as aA,St as aB,Ap as aC,Md as aD,Fp as aE,Rp as aF,vp as aG,bt as aH,Hp as aI,dl as aJ,_d as aK,nr as aL,wl as aM,Op as aN,yp as aO,Ip as aP,Mp as aQ,Id as aR,Sp as aS,Gd as aT,Up as aU,$p as aV,Bp as aW,bp as aX,Od as aY,Cp as aZ,xd as a_,Ee as aa,Pp as ab,xp as ac,xe as ad,Ce as ae,Qt as af,Es as ag,pe as ah,ze as ai,rr as aj,Ke as ak,en as al,kp as am,bl as an,zp as ao,tn as ap,ll as aq,Ds as ar,ul as as,pt as at,sr as au,Jd as av,Vp as aw,Ns as ax,jp as ay,qd as az,mu as b,gp as b0,_p as b1,mp as b2,gd as b3,md as b4,Ud as b5,Np as b6,Ld as b7,Jp as b8,wp as b9,rh as bA,th as bB,cp as bC,up as bD,qa as bE,Vl as bF,lh as bG,sf as bH,$e as bI,Au as bJ,Iu as bK,op as bL,bu as bM,gu as bN,yu as bO,Eu as bP,np as bQ,rp as bR,jn as bS,ef as bT,Zl as bU,Wl as bV,tf as bW,Eh as bX,Gp as ba,Ep as bb,Tp as bc,ch as bd,uh as be,qp as bf,Wp as bg,Lp as bh,Zt as bi,nh as bj,vl as bk,Cs as bl,Ie as bm,sh as bn,Kp as bo,Is as bp,oh as bq,Vn as br,ah as bs,ih as bt,vo as bu,Qp as bv,Xp as bw,eh as bx,Zp as by,cl as bz,dp as c,Oe as d,de as e,Dt as f,gt as g,gh as h,Vs as i,qt as j,pp as k,hd as l,Il as m,Al as n,_h as o,$l as p,Ul as q,hp as r,hh as s,dh as t,Fc as u,ts as v,Un as w,tp as x,Ys as y,Yl as z};
|
|
31
|
+
//# sourceMappingURL=index.DoxG1d4A.js.map
|