@powerhousedao/connect 1.0.0-dev.191 → 1.0.0-dev.193
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/{app-BIDiEHBz.js → app-ACX0Clye.js} +5 -5
- package/dist/assets/{app-BIDiEHBz.js.map → app-ACX0Clye.js.map} +1 -1
- package/dist/assets/{app-loader-CU-gFJvb.js → app-loader-37r2eMk_.js} +3 -3
- package/dist/assets/{app-loader-CU-gFJvb.js.map → app-loader-37r2eMk_.js.map} +1 -1
- package/dist/assets/{browser-HhGAAWtQ.js → browser-YDp_xMjJ.js} +4 -4
- package/dist/assets/{browser-HhGAAWtQ.js.map → browser-YDp_xMjJ.js.map} +1 -1
- package/dist/assets/{ccip-D8Vl-oON.js → ccip-CGTUXc2u.js} +2 -2
- package/dist/assets/{ccip-D8Vl-oON.js.map → ccip-CGTUXc2u.js.map} +1 -1
- package/dist/assets/{content-DUAVRmAa.js → content-D-8F3NIl.js} +3 -3
- package/dist/assets/{content-DUAVRmAa.js.map → content-D-8F3NIl.js.map} +1 -1
- package/dist/assets/{editor-CdT7i7GG.js → editor-BbmqzUVS.js} +2 -2
- package/dist/assets/{editor-CdT7i7GG.js.map → editor-BbmqzUVS.js.map} +1 -1
- package/dist/assets/{editor-DmHEwtqc.js → editor-CU_oft0S.js} +2 -2
- package/dist/assets/{editor-DmHEwtqc.js.map → editor-CU_oft0S.js.map} +1 -1
- package/dist/assets/{editor-CCx8SVcE.js → editor-DF09Xm9F.js} +2 -2
- package/dist/assets/{editor-CCx8SVcE.js.map → editor-DF09Xm9F.js.map} +1 -1
- package/dist/assets/{editor-CaKlOHRk.js → editor-YpthKte0.js} +2 -2
- package/dist/assets/{editor-CaKlOHRk.js.map → editor-YpthKte0.js.map} +1 -1
- package/dist/assets/{editors-C_HvlNCl.js → editors-CUSze4lr.js} +4 -4
- package/dist/assets/{editors-C_HvlNCl.js.map → editors-CUSze4lr.js.map} +1 -1
- package/dist/assets/{index-fUQXjnk1.js → index-DX_EzB-C.js} +3 -3
- package/dist/assets/{index-fUQXjnk1.js.map → index-DX_EzB-C.js.map} +1 -1
- package/dist/assets/{index-BgDn--mP.js → index-zOgcw8RH.js} +2 -2
- package/dist/assets/{index-BgDn--mP.js.map → index-zOgcw8RH.js.map} +1 -1
- package/dist/assets/{main.CuhK_teW.js → main.Dn_g_SSw.js} +2 -2
- package/dist/assets/{main.CuhK_teW.js.map → main.Dn_g_SSw.js.map} +1 -1
- package/dist/assets/{root-CiT_af3P.js → root-Dm2tQkYV.js} +2 -2
- package/dist/assets/{root-CiT_af3P.js.map → root-Dm2tQkYV.js.map} +1 -1
- package/dist/assets/{router-i6g_L9gI.js → router-Tgbf-6i0.js} +4 -4
- package/dist/assets/{router-i6g_L9gI.js.map → router-Tgbf-6i0.js.map} +1 -1
- package/dist/assets/{useUiNodes-BXGcF2vL.js → useUiNodes-Cf5bUEDX.js} +2 -2
- package/dist/assets/{useUiNodes-BXGcF2vL.js.map → useUiNodes-Cf5bUEDX.js.map} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/dist/studio/index.d.ts +2 -0
- package/dist/studio/index.js +21 -10
- package/dist/studio/server.d.ts +2 -0
- package/dist/swEnv.js +2 -2
- package/dist/vite-envs.sh +5 -5
- package/package.json +9 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var Ij=Object.defineProperty;var px=t=>{throw TypeError(t)};var Cj=(t,e,r)=>e in t?Ij(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var hx=(t,e,r)=>Cj(t,typeof e!="symbol"?e+"":e,r),Pg=(t,e,r)=>e.has(t)||px("Cannot "+r);var br=(t,e,r)=>(Pg(t,e,"read from private field"),r?r.call(t):e.get(t)),ka=(t,e,r)=>e.has(t)?px("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),jl=(t,e,r,n)=>(Pg(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ra=(t,e,r)=>(Pg(t,e,"access private method"),r);import{_ as Uc}from"./main.CuhK_teW.js";import{jsx as Xe,jsxs as Br,Fragment as VA}from"react/jsx-runtime";import{AddLocalDriveModal as Mj,AddRemoteDriveModal as Oj,ConnectConfirmationModal as kj,ReadRequiredModal as HA,FILE as bv,LOCAL as Rj,ERROR as Fj,CreateDocumentModal as Pj,Modal as Bj,Icon as xp,Combobox as rd,Button as gc,FormInput as mx,ConnectDeleteDriveModal as Lj,ConnectDeleteItemModal as jj,DriveSettingsModal as Uj,SettingsModal as $j,DocumentSelectSettingsRow as zj,ClearStorageSettingsRow as qj,DependencyVersions as Vj,ConnectUpgradeDriveModal as Hj,CookieBanner as Wj,WagmiContext as Yj,UiNodesContextProvider as Zj,ToastContainer as Jj}from"@powerhousedao/design-system";import*as ft from"react";import xs,{createElement as _d,isValidElement as Yh,cloneElement as Gj,Children as Kj,createContext as dw,useContext as $f,useState as Zn,useRef as Zh,useEffect as ui,useReducer as Xj,useDebugValue as Qj,useCallback as wr,useMemo as ho,Suspense as eU}from"react";import{g as WA,a as fw,c as hs,s as Ep,p as tU}from"./app-loader-CU-gFJvb.js";function rU(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function wv(){return wv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},wv.apply(null,arguments)}var gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function j5e(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var nU={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const iU=zf(nU);var aU=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function gx(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(iU[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(aU),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var sU=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,oU=/^\s*$/,uU=Object.create(null);function YA(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(YA,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var cU={parse:function(t,e){e||(e={}),e.components||(e.components=uU);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(sU,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),p=c+u.length,h=t.charAt(p);if(f){var m=gx(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=gx(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!h||h==="<"||r.children.push({type:"text",content:t.slice(p,t.indexOf("<",p))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&h!=="<"&&h)){l=a===-1?n:i[a].children;var y=t.indexOf("<",p),g=t.slice(p,y===-1?void 0:y);oU.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+YA("",r)},"")}};function Ah(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const yx={};function Jh(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&yx[e[0]]||(typeof e[0]=="string"&&(yx[e[0]]=new Date),Ah(...e))}const ZA=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function vx(t,e,r){t.loadNamespaces(e,ZA(t,r))}function bx(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,ZA(t,n))}function lU(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function dU(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Jh("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):lU(t,e,r)}function Bg(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Lg(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?yc(e):e}function fU(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Yh(e))}function yc(t){return Array.isArray(t)?t:[t]}function pU(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function JA(t,e){if(!t)return"";let r="";const n=yc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Yh(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=JA(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Ah("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Ah("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Ah("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function hU(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){yc(y).forEach(b=>{typeof b!="string"&&(Bg(b)?c(Lg(b)):typeof b=="object"&&!Yh(b)&&Object.assign(u,b))})}c(t);const l=cU.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,b){const _=Lg(y),E=h(_,g.children,b);return fU(_)&&E.length===0||y.props&&y.props.i18nIsDynamicList?_:E}function p(y,g,b,_,E){y.dummy?(y.children=g,b.push(Gj(y,{key:_},E?void 0:g))):b.push(...Kj.map([y],x=>{const D={...x.props};return delete D.i18nIsDynamicList,xs.createElement(x.type,wv({},D,{key:_,ref:x.ref},E?{}:{children:g}))}))}function h(y,g,b){const _=yc(y);return yc(g).reduce((x,D,O)=>{const F=D.children&&D.children[0]&&D.children[0].content&&r.services.interpolator.interpolate(D.children[0].content,d,r.language);if(D.type==="tag"){let k=_[parseInt(D.name,10)];b.length===1&&!k&&(k=b[0][D.name]),k||(k={});const U=Object.keys(D.attrs).length!==0?pU({props:D.attrs},k):k,T=Yh(U),A=T&&Bg(D,!0)&&!D.voidElement,v=o&&typeof U=="object"&&U.dummy&&!T,w=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,D.name);if(typeof U=="string"){const N=r.services.interpolator.interpolate(U,d,r.language);x.push(N)}else if(Bg(U)||A){const N=f(U,D,b);p(U,N,x,O)}else if(v){const N=h(_,D.children,b);p(U,N,x,O)}else if(Number.isNaN(parseFloat(D.name)))if(w){const N=f(U,D,b);p(U,N,x,O,D.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(D.name)>-1)if(D.voidElement)x.push(_d(D.name,{key:`${D.name}-${O}`}));else{const N=h(_,D.children,b);x.push(_d(D.name,{key:`${D.name}-${O}`},N))}else if(D.voidElement)x.push(`<${D.name} />`);else{const N=h(_,D.children,b);x.push(`<${D.name}>${N}</${D.name}>`)}else if(typeof U=="object"&&!T){const N=D.children[0]?F:null;N&&x.push(N)}else p(U,F,x,O,D.children.length!==1||!F)}else if(D.type==="text"){const k=n.transWrapTextNodes,U=a?n.unescape(r.services.interpolator.interpolate(D.content,d,r.language)):r.services.interpolator.interpolate(D.content,d,r.language);k?x.push(_d(k,{key:`${D.name}-${O}`},U)):x.push(U)}return x},[])}const m=h([{dummy:!0,children:t||[]}],l,yc(t||[]));return Lg(m[0])}function mU(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const m=d||fw();if(!m)return Jh("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(A=>A);a&&(s.context=a);const g={...WA(),...m.options&&m.options.react};let b=l||y.ns||m.options&&m.options.defaultNS;b=typeof b=="string"?[b]:b||["translation"];const _=JA(e,g),E=u||_||g.transEmptyNodeValue||i,{hashTransKey:x}=g,D=i||(x?x(_||E):_||E);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const O=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...O,defaultValue:E,ns:b},k=D?y(D,F):E;c&&Object.keys(c).forEach(A=>{const v=c[A];if(typeof v.type=="function"||!v.props||!v.props.children||k.indexOf(`${A}/>`)<0&&k.indexOf(`${A} />`)<0)return;function w(){return xs.createElement(xs.Fragment,null,v)}c[A]=xs.createElement(w,null)});const U=hU(c||e,k,m,g,F,p),T=n!==void 0?n:g.defaultTransParent;return T?_d(T,h,U):U}const GA=dw();class gU{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function KA(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const{i18n:m,defaultNS:y}=$f(GA)||{},g=d||m||fw(),b=f||g&&g.t.bind(g);return mU({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||b&&b.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:p,...h})}const yU=(t,e)=>{const r=Zh();return ui(()=>{r.current=t},[t,e]),r.current};function Nu(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=$f(GA)||{},a=r||n||fw();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new gU),!a){Jh("You will need to pass in an i18next instance by using initReactI18next");const _=(x,D)=>typeof D=="string"?D:D&&typeof D=="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(x)?x[x.length-1]:x,E=[_,{},!1];return E.t=_,E.i18n={},E.ready=!1,E}a.options.react&&a.options.react.wait!==void 0&&Jh("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...WA(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(_=>dU(_,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,p]=Zn(d);let h=c.join();e.lng&&(h=`${e.lng}${h}`);const m=yU(h),y=Zh(!0);ui(()=>{const{bindI18n:_,bindI18nStore:E}=s;y.current=!0,!l&&!o&&(e.lng?bx(a,e.lng,c,()=>{y.current&&p(d)}):vx(a,c,()=>{y.current&&p(d)})),l&&m&&m!==h&&y.current&&p(d);function x(){y.current&&p(d)}return _&&a&&a.on(_,x),E&&a&&a.store.on(E,x),()=>{y.current=!1,_&&a&&_.split(" ").forEach(D=>a.off(D,x)),E&&a&&E.split(" ").forEach(D=>a.store.off(D,x))}},[a,h]);const g=Zh(!0);ui(()=>{y.current&&!g.current&&p(d),g.current=!1},[a,u]);const b=[f,a,l];if(b.t=f,b.i18n=a,b.ready=l,l||!l&&!o)return b;throw new Promise(_=>{e.lng?bx(a,e.lng,c,()=>_()):vx(a,c,()=>_())})}const Hi={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""};let vU=0;function Cn(t,e){const r=`atom${++vU}`,n={toString(){return(Hi?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=bU,n.write=wU),e&&(n.write=e),n}function bU(t){return t(this)}function wU(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const wx=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,jg=t=>"init"in t,Ug=t=>!!t.write,Gh=new WeakMap,_v=t=>{var e;return xv(t)&&!((e=Gh.get(t))!=null&&e[1])},_U=(t,e)=>{const r=Gh.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Hi?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},xU=t=>{if(Gh.has(t))return;const e=[new Set,!1];Gh.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},xv=t=>typeof(t==null?void 0:t.then)=="function",_x=t=>"v"in t||"e"in t,Sp=t=>{if("e"in t)throw t.e;if((Hi?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},XA=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},xx=(t,e,r,n,i)=>{var a;if((Hi?"production":void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,i.n),_v(r.v)&&XA(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&EU(t,n,e)},Vu=()=>[new Map,new Map,new Set],$g=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},EU=(t,e,r)=>{const n=t[0].get(e);n&&n.add(r)},SU=(t,e)=>t[0].get(e),Ex=(t,e)=>{t[2].add(e)},$s=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();const i=new Set(t[1].values());t[1].clear();const a=new Set(t[2]);t[2].clear(),i.forEach(s=>{var o;return(o=s.m)==null?void 0:o.l.forEach(n)}),a.forEach(n)}if(r)throw e},QA=(...[t,e,r,n])=>{let i;(Hi?"production":void 0)!=="production"&&(i=new Set);const a=(_,E,x)=>{const D="v"in E,O=E.v,F=_v(E.v)?E.v:null;if(xv(x)){xU(x);for(const k of E.d.keys())XA(_,x,t(k));E.v=x,delete E.e}else E.v=x,delete E.e;(!D||!Object.is(O,E.v))&&(++E.n,F&&_U(F,x))},s=(_,E,x)=>{var D;const O=t(E);if(_x(O)&&(O.m&&!(x!=null&&x.has(E))||Array.from(O.d).every(([v,w])=>s(_,v,x).n===w)))return O;O.d.clear();let F=!0;const k=v=>{if(wx(E,v)){const N=t(v);if(!_x(N))if(jg(v))a(v,N,v.init);else throw new Error("no atom init");return Sp(N)}const w=s(_,v,x);try{return Sp(w)}finally{if(F)xx(_,E,O,v,w);else{const N=Vu();xx(N,E,O,v,w),p(N,E,O),$s(N)}}};let U,T;const A={get signal(){return U||(U=new AbortController),U.signal},get setSelf(){return(Hi?"production":void 0)!=="production"&&!Ug(E)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&Ug(E)&&(T=(...v)=>{if((Hi?"production":void 0)!=="production"&&F&&console.warn("setSelf function cannot be called in sync"),!F)return f(E,...v)}),T}};try{const v=e(E,k,A);if(a(E,O,v),xv(v)){(D=v.onCancel)==null||D.call(v,()=>U==null?void 0:U.abort());const w=()=>{if(O.m){const N=Vu();p(N,E,O),$s(N)}};v.then(w,w)}return O}catch(v){return delete O.v,O.e=v,++O.n,O}finally{F=!1}},o=_=>Sp(s(void 0,_)),u=(_,E,x)=>{var D,O;const F=new Map;for(const k of((D=x.m)==null?void 0:D.t)||[])F.set(k,t(k));for(const k of x.p)F.set(k,t(k));return(O=SU(_,E))==null||O.forEach(k=>{F.set(k,t(k))}),F};function c(_,E,x){const D=[],O=new Set,F=new Set,k=[[E,x]];for(;k.length>0;){const[U,T]=k[k.length-1];if(F.has(U)){k.pop();continue}if(O.has(U)){D.push([U,T,T.n]),F.add(U),k.pop();continue}O.add(U);for(const[A,v]of u(_,U,T))U!==A&&!O.has(A)&&k.push([A,v])}return[D,F]}const l=(_,E,x)=>{const[D,O]=c(_,E,x),F=new Set([E]);for(let k=D.length-1;k>=0;--k){const[U,T,A]=D[k];let v=!1;for(const w of T.d.keys())if(w!==U&&F.has(w)){v=!0;break}v&&(s(_,U,O),p(_,U,T),A!==T.n&&($g(_,U,T),F.add(U))),O.delete(U)}},d=(_,E,...x)=>{let D=!0;const O=k=>Sp(s(_,k)),F=(k,...U)=>{const T=t(k);try{if(wx(E,k)){if(!jg(k))throw new Error("atom not writable");const A=T.n,v=U[0];a(k,T,v),p(_,k,T),A!==T.n&&($g(_,k,T),l(_,k,T));return}else return d(_,k,...U)}finally{D||$s(_)}};try{return r(E,O,F,...x)}finally{D=!1}},f=(_,...E)=>{const x=Vu();try{return d(x,_,...E)}finally{$s(x)}},p=(_,E,x)=>{if(x.m&&!_v(x.v)){for(const D of x.d.keys())x.m.d.has(D)||(h(_,D,t(D)).t.add(E),x.m.d.add(D));for(const D of x.m.d||[])if(!x.d.has(D)){x.m.d.delete(D);const O=m(_,D,t(D));O==null||O.t.delete(E)}}},h=(_,E,x)=>{if(!x.m){s(_,E);for(const D of x.d.keys())h(_,D,t(D)).t.add(E);if(x.m={l:new Set,d:new Set(x.d.keys()),t:new Set},(Hi?"production":void 0)!=="production"&&i.add(E),Ug(E)){const D=x.m;let O;const F=(k,U)=>{let T=!0;O=(...A)=>{try{return d(k,E,...A)}finally{T||$s(k)}};try{return U()}finally{T=!1}};Ex(_,()=>{const k=F(_,()=>n(E,(...U)=>O(...U)));k&&(D.u=U=>F(U,k))})}}return x.m},m=(_,E,x)=>{if(x.m&&!x.m.l.size&&!Array.from(x.m.t).some(D=>{var O;return(O=t(D).m)==null?void 0:O.d.has(E)})){const D=x.m.u;D&&Ex(_,()=>D(_)),delete x.m,(Hi?"production":void 0)!=="production"&&i.delete(E);for(const O of x.d.keys()){const F=m(_,O,t(O));F==null||F.t.delete(E)}return}return x.m},b={get:o,set:f,sub:(_,E)=>{const x=Vu(),D=t(_),F=h(x,_,D).l;return F.add(E),$s(x),()=>{F.delete(E);const k=Vu();m(k,_,D),$s(k)}},unstable_derive:_=>QA(..._(t,e,r,n))};return(Hi?"production":void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:E=>{const x=t(E);if(x.n!==0)return x}}),dev4_get_mounted_atoms:()=>i,dev4_restore_atoms:E=>{const x=Vu();for(const[D,O]of E)if(jg(D)){const F=t(D),k=F.n;a(D,F,O),p(x,D,F),k!==F.n&&($g(x,D,F),l(x,D,F))}$s(x)}}),b},pw=()=>{const t=new WeakMap;return QA(r=>{if((Hi?"production":void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var i;return(i=r.onMount)==null?void 0:i.call(r,...n)})};let Ul;const TU=()=>(Ul||(Ul=pw(),(Hi?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Ul),globalThis.__JOTAI_DEFAULT_STORE__!==Ul&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Ul),eN={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},tN=dw(void 0),rN=t=>$f(tN)||TU(),DU=({children:t,store:e})=>{const r=Zh();return!e&&!r.current&&(r.current=pw()),_d(tN.Provider,{value:e||r.current},t)},nN=t=>typeof(t==null?void 0:t.then)=="function",AU=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},NU=xs.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(AU(t),t)}),zg=new WeakMap,IU=t=>{let e=zg.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{if((eN?"production":void 0)!=="production"&&c===u)throw new Error("[Bug] p is not updated even after cancelation");nN(c)?(zg.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),zg.set(t,e)),e};function qf(t,e){const r=rN(),[[n,i,a],s]=Xj(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),ui(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),Qj(o),nN(o)){const c=IU(o);return NU(c)}return o}function CU(t,e){const r=rN();return wr((...i)=>{if((eN?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...i)},[r,t])}function Ea(t,e){return[qf(t),CU(t)]}const jd={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},MU=Symbol((jd?"production":void 0)!=="production"?"RESET":"");function OU(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const kU=t=>typeof(t==null?void 0:t.then)=="function";function RU(t=()=>{try{return window.localStorage}catch(r){(jd?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(r);return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=h=>{if(h=h||"",n!==h){try{i=JSON.parse(h,e==null?void 0:e.reviver)}catch{return c}n=h}return i},p=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return kU(p)?p.then(f):f(p)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let p;try{p=JSON.parse(f||"")}catch{p=d}l(p)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const FU=RU();function iN(t,e,r=FU,n){const i=Cn(e);return(jd?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},Cn(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===MU?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const Sx=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),PU=new WeakMap,BU=(t,e,r)=>{const n=Sx(()=>new WeakMap,PU,e);return Sx(t,n,r)},LU=t=>t instanceof Promise,jU=()=>{};function aN(t,e=jU){return BU(()=>{const r=new WeakMap,n=new WeakMap,i=Cn(0);(jd?"production":void 0)!=="production"&&(i.debugPrivate=!0);const a=Cn((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!LU(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,(jd?"production":void 0)!=="production"&&(a.debugPrivate=!0),Cn(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}const nd=hs.routerBasename,Vf=(t,e,r,n)=>iN(`${nd}:${t}`,e,void 0),UU=(t,e,r)=>iN(t,e,{getItem(n,i){const a=localStorage.getItem(`${nd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${nd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${nd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${nd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),$U="acceptedCookies",zU=Vf($U,{analytics:!1,marketing:!1,functional:!1}),hw=()=>Ea(zU),qU="display-cookie-banner",VU=Vf(qU,!0),HU=()=>Ea(VU);function WU(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return Xe(Mj,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const YU=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),ZU=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),JU=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),GU=/[^\p{L}\d]+/giu,Tx="$1\0$2",Dx="";function sN(t){let e=t.trim();e=e.replace(YU,Tx).replace(ZU,Tx),e=e.replace(GU,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function KU(t){const e=sN(t);for(let r=0;r<e.length;r++){const n=e[r],i=JU.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function oN(t,e){const[r,n,i]=t$(t,e),a=XU(e==null?void 0:e.locale),s=QU(e==null?void 0:e.locale),o=e$(a,s);return r+n.map(o).join("")+i}function XU(t){return e=>e.toLocaleLowerCase(t)}function QU(t){return e=>e.toLocaleUpperCase(t)}function e$(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function t$(t,e={}){const r=e.split??(e.separateNumbers?KU:sN),n=e.prefixCharacters??Dx,i=e.suffixCharacters??Dx;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Tr(t,e){if(!!!t)throw new Error(e)}function lu(t){return typeof t=="object"&&t!==null}function ga(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const r$=/\r\n|[\n\r]/g;function Ev(t,e){let r=0,n=1;for(const i of t.body.matchAll(r$)){if(typeof i.index=="number"||ga(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function n$(t){return uN(t.source,Ev(t.source,t.start))}function uN(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-zOgcw8RH.js","assets/main.Dn_g_SSw.js","assets/app-loader-37r2eMk_.js","assets/app-loader-DoI5W0wZ.css","assets/browser-YDp_xMjJ.js","assets/router-Tgbf-6i0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ij=Object.defineProperty;var px=t=>{throw TypeError(t)};var Cj=(t,e,r)=>e in t?Ij(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var hx=(t,e,r)=>Cj(t,typeof e!="symbol"?e+"":e,r),Pg=(t,e,r)=>e.has(t)||px("Cannot "+r);var br=(t,e,r)=>(Pg(t,e,"read from private field"),r?r.call(t):e.get(t)),ka=(t,e,r)=>e.has(t)?px("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),jl=(t,e,r,n)=>(Pg(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ra=(t,e,r)=>(Pg(t,e,"access private method"),r);import{_ as Uc}from"./main.Dn_g_SSw.js";import{jsx as Xe,jsxs as Br,Fragment as VA}from"react/jsx-runtime";import{AddLocalDriveModal as Mj,AddRemoteDriveModal as Oj,ConnectConfirmationModal as kj,ReadRequiredModal as HA,FILE as bv,LOCAL as Rj,ERROR as Fj,CreateDocumentModal as Pj,Modal as Bj,Icon as xp,Combobox as rd,Button as gc,FormInput as mx,ConnectDeleteDriveModal as Lj,ConnectDeleteItemModal as jj,DriveSettingsModal as Uj,SettingsModal as $j,DocumentSelectSettingsRow as zj,ClearStorageSettingsRow as qj,DependencyVersions as Vj,ConnectUpgradeDriveModal as Hj,CookieBanner as Wj,WagmiContext as Yj,UiNodesContextProvider as Zj,ToastContainer as Jj}from"@powerhousedao/design-system";import*as ft from"react";import xs,{createElement as _d,isValidElement as Yh,cloneElement as Gj,Children as Kj,createContext as dw,useContext as $f,useState as Zn,useRef as Zh,useEffect as ui,useReducer as Xj,useDebugValue as Qj,useCallback as wr,useMemo as ho,Suspense as eU}from"react";import{g as WA,a as fw,c as hs,s as Ep,p as tU}from"./app-loader-37r2eMk_.js";function rU(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function wv(){return wv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},wv.apply(null,arguments)}var gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function j5e(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var nU={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const iU=zf(nU);var aU=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function gx(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(iU[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(aU),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var sU=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,oU=/^\s*$/,uU=Object.create(null);function YA(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(YA,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var cU={parse:function(t,e){e||(e={}),e.components||(e.components=uU);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(sU,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),p=c+u.length,h=t.charAt(p);if(f){var m=gx(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=gx(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!h||h==="<"||r.children.push({type:"text",content:t.slice(p,t.indexOf("<",p))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&h!=="<"&&h)){l=a===-1?n:i[a].children;var y=t.indexOf("<",p),g=t.slice(p,y===-1?void 0:y);oU.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+YA("",r)},"")}};function Ah(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const yx={};function Jh(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&yx[e[0]]||(typeof e[0]=="string"&&(yx[e[0]]=new Date),Ah(...e))}const ZA=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function vx(t,e,r){t.loadNamespaces(e,ZA(t,r))}function bx(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,ZA(t,n))}function lU(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function dU(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Jh("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):lU(t,e,r)}function Bg(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Lg(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?yc(e):e}function fU(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Yh(e))}function yc(t){return Array.isArray(t)?t:[t]}function pU(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function JA(t,e){if(!t)return"";let r="";const n=yc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Yh(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=JA(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Ah("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Ah("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Ah("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function hU(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){yc(y).forEach(b=>{typeof b!="string"&&(Bg(b)?c(Lg(b)):typeof b=="object"&&!Yh(b)&&Object.assign(u,b))})}c(t);const l=cU.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,b){const _=Lg(y),E=h(_,g.children,b);return fU(_)&&E.length===0||y.props&&y.props.i18nIsDynamicList?_:E}function p(y,g,b,_,E){y.dummy?(y.children=g,b.push(Gj(y,{key:_},E?void 0:g))):b.push(...Kj.map([y],x=>{const D={...x.props};return delete D.i18nIsDynamicList,xs.createElement(x.type,wv({},D,{key:_,ref:x.ref},E?{}:{children:g}))}))}function h(y,g,b){const _=yc(y);return yc(g).reduce((x,D,O)=>{const F=D.children&&D.children[0]&&D.children[0].content&&r.services.interpolator.interpolate(D.children[0].content,d,r.language);if(D.type==="tag"){let k=_[parseInt(D.name,10)];b.length===1&&!k&&(k=b[0][D.name]),k||(k={});const U=Object.keys(D.attrs).length!==0?pU({props:D.attrs},k):k,T=Yh(U),A=T&&Bg(D,!0)&&!D.voidElement,v=o&&typeof U=="object"&&U.dummy&&!T,w=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,D.name);if(typeof U=="string"){const N=r.services.interpolator.interpolate(U,d,r.language);x.push(N)}else if(Bg(U)||A){const N=f(U,D,b);p(U,N,x,O)}else if(v){const N=h(_,D.children,b);p(U,N,x,O)}else if(Number.isNaN(parseFloat(D.name)))if(w){const N=f(U,D,b);p(U,N,x,O,D.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(D.name)>-1)if(D.voidElement)x.push(_d(D.name,{key:`${D.name}-${O}`}));else{const N=h(_,D.children,b);x.push(_d(D.name,{key:`${D.name}-${O}`},N))}else if(D.voidElement)x.push(`<${D.name} />`);else{const N=h(_,D.children,b);x.push(`<${D.name}>${N}</${D.name}>`)}else if(typeof U=="object"&&!T){const N=D.children[0]?F:null;N&&x.push(N)}else p(U,F,x,O,D.children.length!==1||!F)}else if(D.type==="text"){const k=n.transWrapTextNodes,U=a?n.unescape(r.services.interpolator.interpolate(D.content,d,r.language)):r.services.interpolator.interpolate(D.content,d,r.language);k?x.push(_d(k,{key:`${D.name}-${O}`},U)):x.push(U)}return x},[])}const m=h([{dummy:!0,children:t||[]}],l,yc(t||[]));return Lg(m[0])}function mU(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const m=d||fw();if(!m)return Jh("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(A=>A);a&&(s.context=a);const g={...WA(),...m.options&&m.options.react};let b=l||y.ns||m.options&&m.options.defaultNS;b=typeof b=="string"?[b]:b||["translation"];const _=JA(e,g),E=u||_||g.transEmptyNodeValue||i,{hashTransKey:x}=g,D=i||(x?x(_||E):_||E);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const O=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...O,defaultValue:E,ns:b},k=D?y(D,F):E;c&&Object.keys(c).forEach(A=>{const v=c[A];if(typeof v.type=="function"||!v.props||!v.props.children||k.indexOf(`${A}/>`)<0&&k.indexOf(`${A} />`)<0)return;function w(){return xs.createElement(xs.Fragment,null,v)}c[A]=xs.createElement(w,null)});const U=hU(c||e,k,m,g,F,p),T=n!==void 0?n:g.defaultTransParent;return T?_d(T,h,U):U}const GA=dw();class gU{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function KA(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const{i18n:m,defaultNS:y}=$f(GA)||{},g=d||m||fw(),b=f||g&&g.t.bind(g);return mU({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||b&&b.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:p,...h})}const yU=(t,e)=>{const r=Zh();return ui(()=>{r.current=t},[t,e]),r.current};function Nu(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=$f(GA)||{},a=r||n||fw();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new gU),!a){Jh("You will need to pass in an i18next instance by using initReactI18next");const _=(x,D)=>typeof D=="string"?D:D&&typeof D=="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(x)?x[x.length-1]:x,E=[_,{},!1];return E.t=_,E.i18n={},E.ready=!1,E}a.options.react&&a.options.react.wait!==void 0&&Jh("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...WA(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(_=>dU(_,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,p]=Zn(d);let h=c.join();e.lng&&(h=`${e.lng}${h}`);const m=yU(h),y=Zh(!0);ui(()=>{const{bindI18n:_,bindI18nStore:E}=s;y.current=!0,!l&&!o&&(e.lng?bx(a,e.lng,c,()=>{y.current&&p(d)}):vx(a,c,()=>{y.current&&p(d)})),l&&m&&m!==h&&y.current&&p(d);function x(){y.current&&p(d)}return _&&a&&a.on(_,x),E&&a&&a.store.on(E,x),()=>{y.current=!1,_&&a&&_.split(" ").forEach(D=>a.off(D,x)),E&&a&&E.split(" ").forEach(D=>a.store.off(D,x))}},[a,h]);const g=Zh(!0);ui(()=>{y.current&&!g.current&&p(d),g.current=!1},[a,u]);const b=[f,a,l];if(b.t=f,b.i18n=a,b.ready=l,l||!l&&!o)return b;throw new Promise(_=>{e.lng?bx(a,e.lng,c,()=>_()):vx(a,c,()=>_())})}const Hi={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""};let vU=0;function Cn(t,e){const r=`atom${++vU}`,n={toString(){return(Hi?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=bU,n.write=wU),e&&(n.write=e),n}function bU(t){return t(this)}function wU(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const wx=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,jg=t=>"init"in t,Ug=t=>!!t.write,Gh=new WeakMap,_v=t=>{var e;return xv(t)&&!((e=Gh.get(t))!=null&&e[1])},_U=(t,e)=>{const r=Gh.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Hi?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},xU=t=>{if(Gh.has(t))return;const e=[new Set,!1];Gh.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},xv=t=>typeof(t==null?void 0:t.then)=="function",_x=t=>"v"in t||"e"in t,Sp=t=>{if("e"in t)throw t.e;if((Hi?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},XA=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},xx=(t,e,r,n,i)=>{var a;if((Hi?"production":void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,i.n),_v(r.v)&&XA(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&EU(t,n,e)},Vu=()=>[new Map,new Map,new Set],$g=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},EU=(t,e,r)=>{const n=t[0].get(e);n&&n.add(r)},SU=(t,e)=>t[0].get(e),Ex=(t,e)=>{t[2].add(e)},$s=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();const i=new Set(t[1].values());t[1].clear();const a=new Set(t[2]);t[2].clear(),i.forEach(s=>{var o;return(o=s.m)==null?void 0:o.l.forEach(n)}),a.forEach(n)}if(r)throw e},QA=(...[t,e,r,n])=>{let i;(Hi?"production":void 0)!=="production"&&(i=new Set);const a=(_,E,x)=>{const D="v"in E,O=E.v,F=_v(E.v)?E.v:null;if(xv(x)){xU(x);for(const k of E.d.keys())XA(_,x,t(k));E.v=x,delete E.e}else E.v=x,delete E.e;(!D||!Object.is(O,E.v))&&(++E.n,F&&_U(F,x))},s=(_,E,x)=>{var D;const O=t(E);if(_x(O)&&(O.m&&!(x!=null&&x.has(E))||Array.from(O.d).every(([v,w])=>s(_,v,x).n===w)))return O;O.d.clear();let F=!0;const k=v=>{if(wx(E,v)){const N=t(v);if(!_x(N))if(jg(v))a(v,N,v.init);else throw new Error("no atom init");return Sp(N)}const w=s(_,v,x);try{return Sp(w)}finally{if(F)xx(_,E,O,v,w);else{const N=Vu();xx(N,E,O,v,w),p(N,E,O),$s(N)}}};let U,T;const A={get signal(){return U||(U=new AbortController),U.signal},get setSelf(){return(Hi?"production":void 0)!=="production"&&!Ug(E)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&Ug(E)&&(T=(...v)=>{if((Hi?"production":void 0)!=="production"&&F&&console.warn("setSelf function cannot be called in sync"),!F)return f(E,...v)}),T}};try{const v=e(E,k,A);if(a(E,O,v),xv(v)){(D=v.onCancel)==null||D.call(v,()=>U==null?void 0:U.abort());const w=()=>{if(O.m){const N=Vu();p(N,E,O),$s(N)}};v.then(w,w)}return O}catch(v){return delete O.v,O.e=v,++O.n,O}finally{F=!1}},o=_=>Sp(s(void 0,_)),u=(_,E,x)=>{var D,O;const F=new Map;for(const k of((D=x.m)==null?void 0:D.t)||[])F.set(k,t(k));for(const k of x.p)F.set(k,t(k));return(O=SU(_,E))==null||O.forEach(k=>{F.set(k,t(k))}),F};function c(_,E,x){const D=[],O=new Set,F=new Set,k=[[E,x]];for(;k.length>0;){const[U,T]=k[k.length-1];if(F.has(U)){k.pop();continue}if(O.has(U)){D.push([U,T,T.n]),F.add(U),k.pop();continue}O.add(U);for(const[A,v]of u(_,U,T))U!==A&&!O.has(A)&&k.push([A,v])}return[D,F]}const l=(_,E,x)=>{const[D,O]=c(_,E,x),F=new Set([E]);for(let k=D.length-1;k>=0;--k){const[U,T,A]=D[k];let v=!1;for(const w of T.d.keys())if(w!==U&&F.has(w)){v=!0;break}v&&(s(_,U,O),p(_,U,T),A!==T.n&&($g(_,U,T),F.add(U))),O.delete(U)}},d=(_,E,...x)=>{let D=!0;const O=k=>Sp(s(_,k)),F=(k,...U)=>{const T=t(k);try{if(wx(E,k)){if(!jg(k))throw new Error("atom not writable");const A=T.n,v=U[0];a(k,T,v),p(_,k,T),A!==T.n&&($g(_,k,T),l(_,k,T));return}else return d(_,k,...U)}finally{D||$s(_)}};try{return r(E,O,F,...x)}finally{D=!1}},f=(_,...E)=>{const x=Vu();try{return d(x,_,...E)}finally{$s(x)}},p=(_,E,x)=>{if(x.m&&!_v(x.v)){for(const D of x.d.keys())x.m.d.has(D)||(h(_,D,t(D)).t.add(E),x.m.d.add(D));for(const D of x.m.d||[])if(!x.d.has(D)){x.m.d.delete(D);const O=m(_,D,t(D));O==null||O.t.delete(E)}}},h=(_,E,x)=>{if(!x.m){s(_,E);for(const D of x.d.keys())h(_,D,t(D)).t.add(E);if(x.m={l:new Set,d:new Set(x.d.keys()),t:new Set},(Hi?"production":void 0)!=="production"&&i.add(E),Ug(E)){const D=x.m;let O;const F=(k,U)=>{let T=!0;O=(...A)=>{try{return d(k,E,...A)}finally{T||$s(k)}};try{return U()}finally{T=!1}};Ex(_,()=>{const k=F(_,()=>n(E,(...U)=>O(...U)));k&&(D.u=U=>F(U,k))})}}return x.m},m=(_,E,x)=>{if(x.m&&!x.m.l.size&&!Array.from(x.m.t).some(D=>{var O;return(O=t(D).m)==null?void 0:O.d.has(E)})){const D=x.m.u;D&&Ex(_,()=>D(_)),delete x.m,(Hi?"production":void 0)!=="production"&&i.delete(E);for(const O of x.d.keys()){const F=m(_,O,t(O));F==null||F.t.delete(E)}return}return x.m},b={get:o,set:f,sub:(_,E)=>{const x=Vu(),D=t(_),F=h(x,_,D).l;return F.add(E),$s(x),()=>{F.delete(E);const k=Vu();m(k,_,D),$s(k)}},unstable_derive:_=>QA(..._(t,e,r,n))};return(Hi?"production":void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:E=>{const x=t(E);if(x.n!==0)return x}}),dev4_get_mounted_atoms:()=>i,dev4_restore_atoms:E=>{const x=Vu();for(const[D,O]of E)if(jg(D)){const F=t(D),k=F.n;a(D,F,O),p(x,D,F),k!==F.n&&($g(x,D,F),l(x,D,F))}$s(x)}}),b},pw=()=>{const t=new WeakMap;return QA(r=>{if((Hi?"production":void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var i;return(i=r.onMount)==null?void 0:i.call(r,...n)})};let Ul;const TU=()=>(Ul||(Ul=pw(),(Hi?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Ul),globalThis.__JOTAI_DEFAULT_STORE__!==Ul&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Ul),eN={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},tN=dw(void 0),rN=t=>$f(tN)||TU(),DU=({children:t,store:e})=>{const r=Zh();return!e&&!r.current&&(r.current=pw()),_d(tN.Provider,{value:e||r.current},t)},nN=t=>typeof(t==null?void 0:t.then)=="function",AU=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},NU=xs.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(AU(t),t)}),zg=new WeakMap,IU=t=>{let e=zg.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{if((eN?"production":void 0)!=="production"&&c===u)throw new Error("[Bug] p is not updated even after cancelation");nN(c)?(zg.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),zg.set(t,e)),e};function qf(t,e){const r=rN(),[[n,i,a],s]=Xj(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),ui(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),Qj(o),nN(o)){const c=IU(o);return NU(c)}return o}function CU(t,e){const r=rN();return wr((...i)=>{if((eN?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...i)},[r,t])}function Ea(t,e){return[qf(t),CU(t)]}const jd={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},MU=Symbol((jd?"production":void 0)!=="production"?"RESET":"");function OU(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const kU=t=>typeof(t==null?void 0:t.then)=="function";function RU(t=()=>{try{return window.localStorage}catch(r){(jd?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(r);return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=h=>{if(h=h||"",n!==h){try{i=JSON.parse(h,e==null?void 0:e.reviver)}catch{return c}n=h}return i},p=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return kU(p)?p.then(f):f(p)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let p;try{p=JSON.parse(f||"")}catch{p=d}l(p)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const FU=RU();function iN(t,e,r=FU,n){const i=Cn(e);return(jd?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},Cn(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===MU?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const Sx=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),PU=new WeakMap,BU=(t,e,r)=>{const n=Sx(()=>new WeakMap,PU,e);return Sx(t,n,r)},LU=t=>t instanceof Promise,jU=()=>{};function aN(t,e=jU){return BU(()=>{const r=new WeakMap,n=new WeakMap,i=Cn(0);(jd?"production":void 0)!=="production"&&(i.debugPrivate=!0);const a=Cn((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!LU(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,(jd?"production":void 0)!=="production"&&(a.debugPrivate=!0),Cn(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}const nd=hs.routerBasename,Vf=(t,e,r,n)=>iN(`${nd}:${t}`,e,void 0),UU=(t,e,r)=>iN(t,e,{getItem(n,i){const a=localStorage.getItem(`${nd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${nd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${nd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${nd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),$U="acceptedCookies",zU=Vf($U,{analytics:!1,marketing:!1,functional:!1}),hw=()=>Ea(zU),qU="display-cookie-banner",VU=Vf(qU,!0),HU=()=>Ea(VU);function WU(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return Xe(Mj,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const YU=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),ZU=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),JU=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),GU=/[^\p{L}\d]+/giu,Tx="$1\0$2",Dx="";function sN(t){let e=t.trim();e=e.replace(YU,Tx).replace(ZU,Tx),e=e.replace(GU,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function KU(t){const e=sN(t);for(let r=0;r<e.length;r++){const n=e[r],i=JU.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function oN(t,e){const[r,n,i]=t$(t,e),a=XU(e==null?void 0:e.locale),s=QU(e==null?void 0:e.locale),o=e$(a,s);return r+n.map(o).join("")+i}function XU(t){return e=>e.toLocaleLowerCase(t)}function QU(t){return e=>e.toLocaleUpperCase(t)}function e$(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function t$(t,e={}){const r=e.split??(e.separateNumbers?KU:sN),n=e.prefixCharacters??Dx,i=e.suffixCharacters??Dx;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Tr(t,e){if(!!!t)throw new Error(e)}function lu(t){return typeof t=="object"&&t!==null}function ga(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const r$=/\r\n|[\n\r]/g;function Ev(t,e){let r=0,n=1;for(const i of t.body.matchAll(r$)){if(typeof i.index=="number"||ga(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function n$(t){return uN(t.source,Ev(t.source,t.start))}function uN(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
|
|
3
3
|
`,l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){const f=Math.floor(u/80),p=u%80,h=[];for(let m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return c+Ax([[`${s} |`,h[0]],...h.slice(1,f+1).map(m=>["|",m]),["|","^".padStart(p)],["|",h[f+1]]])}return c+Ax([[`${s-1} |`,l[i-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function Ax(t){const e=t.filter(([n,i])=>i!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(r)+(i?" "+i:"")).join(`
|
|
4
4
|
`)}function i$(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class Ve extends Error{constructor(e,...r){var n,i,a;const{nodes:s,source:o,positions:u,path:c,originalError:l,extensions:d}=i$(r);super(e),this.name="GraphQLError",this.path=c??void 0,this.originalError=l??void 0,this.nodes=Nx(Array.isArray(s)?s:s?[s]:void 0);const f=Nx((n=this.nodes)===null||n===void 0?void 0:n.map(h=>h.loc).filter(h=>h!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=u??(f==null?void 0:f.map(h=>h.start)),this.locations=u&&o?u.map(h=>Ev(o,h)):f==null?void 0:f.map(h=>Ev(h.source,h.start));const p=lu(l==null?void 0:l.extensions)?l==null?void 0:l.extensions:void 0;this.extensions=(a=d??p)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Ve):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=`
|
|
5
5
|
|
|
@@ -1119,7 +1119,7 @@ enum ReactionType {
|
|
|
1119
1119
|
"modules": []
|
|
1120
1120
|
}
|
|
1121
1121
|
]
|
|
1122
|
-
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},O6e=t=>t!=null;Te.any().refine(t=>O6e(t));function k6e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function R6e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function F6e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function P6e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function B6e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:uL().nullish()})}function L6e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function j6e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function U6e(){return Te.object({id:Te.string()})}function $6e(){return Te.object({id:Te.string()})}function z6e(){return Te.object({id:Te.string()})}function q6e(){return Te.object({id:Te.string()})}function V6e(){return Te.object({scope:Te.string(),id:Te.string()})}function uL(){return Te.literal("global").or(Te.literal("local"))}function H6e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function W6e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function Y6e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function Z6e(){return Te.object({order:Te.array(Te.string())})}function J6e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function G6e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function K6e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function X6e(){return Te.object({authorName:Te.string()})}function Q6e(){return Te.object({authorWebsite:Te.string()})}function e8e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function t8e(){return Te.object({description:Te.string()})}function r8e(){return Te.object({extension:Te.string()})}function n8e(){return Te.object({id:Te.string()})}function i8e(){return Te.object({name:Te.string()})}function a8e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function s8e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function o8e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function u8e(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function c8e(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function l8e(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function d8e(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function f8e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function p8e(){return Te.object({id:Te.string(),scope:uL()})}function h8e(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function m8e(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function g8e(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function y8e(){return Te.object({scope:Te.string(),schema:Te.string()})}function v8e(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function b8e(){return Te.object({example:Te.string(),id:Te.string()})}function w8e(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const ic={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Xl={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},_8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Ql={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(_8e(e.input.order))}},x8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},qo={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(x8e(e.input.order))}},E8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Eh={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(E8e(e.input.order))}},S8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Pa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(S8e(e.input.order))}},T8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},ac={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(T8e(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},D8e=(t,e)=>{if(Hc(e))return t;switch(e.type){case"SET_MODEL_NAME":i8e().parse(e.input),ic.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":n8e().parse(e.input),ic.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":r8e().parse(e.input),ic.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":t8e().parse(e.input),ic.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":X6e().parse(e.input),ic.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":Q6e().parse(e.input),ic.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":k6e().parse(e.input),Xl.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":v8e().parse(e.input),Xl.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":j6e().parse(e.input),Xl.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":W6e().parse(e.input),Xl.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Xl.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":R6e().parse(e.input),Ql.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":s8e().parse(e.input),Ql.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":a8e().parse(e.input),Ql.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":U6e().parse(e.input),Ql.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":Z6e().parse(e.input),Ql.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":F6e().parse(e.input),qo.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":u8e().parse(e.input),qo.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":l8e().parse(e.input),qo.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":c8e().parse(e.input),qo.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":d8e().parse(e.input),qo.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":$6e().parse(e.input),qo.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":J6e().parse(e.input),qo.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":P6e().parse(e.input),Eh.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":b8e().parse(e.input),Eh.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":z6e().parse(e.input),Eh.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":G6e().parse(e.input),Eh.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":B6e().parse(e.input),Pa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":f8e().parse(e.input),Pa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":p8e().parse(e.input),Pa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":m8e().parse(e.input),Pa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":o8e().parse(e.input),Pa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":g8e().parse(e.input),Pa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":h8e().parse(e.input),Pa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":H6e().parse(e.input),Pa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":q6e().parse(e.input),Pa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":Y6e().parse(e.input),Pa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":y8e().parse(e.input),ac.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":e8e().parse(e.input),ac.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":L6e().parse(e.input),ac.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":w8e().parse(e.input),ac.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":V6e().parse(e.input),ac.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":K6e().parse(e.input),ac.reorderStateExamplesOperation(t.global,e);break;default:return t}},f0=Ww(D8e),A8e={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},N8e={},Ld={fileExtension:"phdm",createState(t){return{global:{...A8e,...t==null?void 0:t.global},local:{...N8e,...t==null?void 0:t.local}}},createExtendedState(t){return Yw({...t,documentType:"powerhouse/document-model"},Ld.createState)},createDocument(t){return Zw(Ld.createExtendedState(t),Ld.createState)},saveToFile(t,e,r){return Vw(t,e,"phdm",r)},saveToFileHandle(t,e){return $I(t,e)},loadFromFile(t){return lm(t,f0)},loadFromInput(t){return Hw(t,f0)}},cL=t=>It("SET_MODEL_NAME",{...t}),lL=t=>It("SET_MODEL_ID",{...t}),dL=t=>It("SET_MODEL_EXTENSION",{...t}),fL=t=>It("SET_MODEL_DESCRIPTION",{...t}),pL=t=>It("SET_AUTHOR_NAME",{...t}),hL=t=>It("SET_AUTHOR_WEBSITE",{...t});class I8e extends $r{setModelName(e,r){return this.dispatch(cL(e),r)}setModelId(e,r){return this.dispatch(lL(e),r)}setModelExtension(e,r){return this.dispatch(dL(e),r)}setModelDescription(e,r){return this.dispatch(fL(e),r)}setAuthorName(e,r){return this.dispatch(pL(e),r)}setAuthorWebsite(e,r){return this.dispatch(hL(e),r)}}const mL=t=>It("ADD_CHANGE_LOG_ITEM",{...t}),gL=t=>It("UPDATE_CHANGE_LOG_ITEM",{...t}),yL=t=>It("DELETE_CHANGE_LOG_ITEM",{...t}),vL=t=>It("REORDER_CHANGE_LOG_ITEMS",{...t}),bL=()=>It("RELEASE_NEW_VERSION");class C8e extends $r{addChangeLogItem(e,r){return this.dispatch(mL(e),r)}updateChangeLogItem(e,r){return this.dispatch(gL(e),r)}deleteChangeLogItem(e,r){return this.dispatch(yL(e),r)}reorderChangeLogItems(e,r){return this.dispatch(vL(e),r)}releaseNewVersion(e){return this.dispatch(bL(),e)}}const wL=t=>It("ADD_MODULE",{...t}),_L=t=>It("SET_MODULE_NAME",{...t}),xL=t=>It("SET_MODULE_DESCRIPTION",{...t}),EL=t=>It("DELETE_MODULE",{...t}),SL=t=>It("REORDER_MODULES",{...t});class M8e extends $r{addModule(e,r){return this.dispatch(wL(e),r)}setModuleName(e,r){return this.dispatch(_L(e),r)}setModuleDescription(e,r){return this.dispatch(xL(e),r)}deleteModule(e,r){return this.dispatch(EL(e),r)}reorderModules(e,r){return this.dispatch(SL(e),r)}}const TL=t=>It("ADD_OPERATION_ERROR",{...t}),DL=t=>It("SET_OPERATION_ERROR_CODE",{...t}),AL=t=>It("SET_OPERATION_ERROR_NAME",{...t}),NL=t=>It("SET_OPERATION_ERROR_DESCRIPTION",{...t}),IL=t=>It("SET_OPERATION_ERROR_TEMPLATE",{...t}),CL=t=>It("DELETE_OPERATION_ERROR",{...t}),ML=t=>It("REORDER_OPERATION_ERRORS",{...t});class O8e extends $r{addOperationError(e,r){return this.dispatch(TL(e),r)}setOperationErrorCode(e,r){return this.dispatch(DL(e),r)}setOperationErrorName(e,r){return this.dispatch(AL(e),r)}setOperationErrorDescription(e,r){return this.dispatch(NL(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(IL(e),r)}deleteOperationError(e,r){return this.dispatch(CL(e),r)}reorderOperationErrors(e,r){return this.dispatch(ML(e),r)}}const OL=t=>It("ADD_OPERATION_EXAMPLE",{...t}),kL=t=>It("UPDATE_OPERATION_EXAMPLE",{...t}),RL=t=>It("DELETE_OPERATION_EXAMPLE",{...t}),FL=t=>It("REORDER_OPERATION_EXAMPLES",{...t});class k8e extends $r{addOperationExample(e,r){return this.dispatch(OL(e),r)}updateOperationExample(e,r){return this.dispatch(kL(e),r)}deleteOperationExample(e,r){return this.dispatch(RL(e),r)}reorderOperationExamples(e,r){return this.dispatch(FL(e),r)}}const PL=t=>It("ADD_OPERATION",{...t}),BL=t=>It("SET_OPERATION_NAME",{...t}),LL=t=>It("SET_OPERATION_SCOPE",{...t}),jL=t=>It("SET_OPERATION_SCHEMA",{...t}),UL=t=>It("SET_OPERATION_DESCRIPTION",{...t}),$L=t=>It("SET_OPERATION_TEMPLATE",{...t}),zL=t=>It("SET_OPERATION_REDUCER",{...t}),qL=t=>It("MOVE_OPERATION",{...t}),VL=t=>It("DELETE_OPERATION",{...t}),HL=t=>It("REORDER_MODULE_OPERATIONS",{...t});class R8e extends $r{addOperation(e,r){return this.dispatch(PL(e),r)}setOperationName(e,r){return this.dispatch(BL(e),r)}setOperationScope(e,r){return this.dispatch(LL(e),r)}setOperationSchema(e,r){return this.dispatch(jL(e),r)}setOperationDescription(e,r){return this.dispatch(UL(e),r)}setOperationTemplate(e,r){return this.dispatch($L(e),r)}setOperationReducer(e,r){return this.dispatch(zL(e),r)}moveOperation(e,r){return this.dispatch(qL(e),r)}deleteOperation(e,r){return this.dispatch(VL(e),r)}reorderModuleOperations(e,r){return this.dispatch(HL(e),r)}}const WL=t=>It("SET_STATE_SCHEMA",{...t}),YL=t=>It("SET_INITIAL_STATE",{...t}),ZL=t=>It("ADD_STATE_EXAMPLE",{...t}),JL=t=>It("UPDATE_STATE_EXAMPLE",{...t}),GL=t=>It("DELETE_STATE_EXAMPLE",{...t}),KL=t=>It("REORDER_STATE_EXAMPLES",{...t});class F8e extends $r{setStateSchema(e,r){return this.dispatch(WL(e),r)}setInitialState(e,r){return this.dispatch(YL(e),r)}addStateExample(e,r){return this.dispatch(ZL(e),r)}updateStateExample(e,r){return this.dispatch(JL(e),r)}deleteStateExample(e,r){return this.dispatch(GL(e),r)}reorderStateExamples(e,r){return this.dispatch(KL(e),r)}}let XL=(xh=class extends $r{constructor(t,e){super(f0,Ld.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,xh.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},y6e(xh,"fileExtension","phdm"),xh);ku(XL,[I8e,C8e,M8e,O8e,k8e,R8e,F8e]);const P8e=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:mL,addModule:wL,addOperation:PL,addOperationError:TL,addOperationExample:OL,addStateExample:ZL,deleteChangeLogItem:yL,deleteModule:EL,deleteOperation:VL,deleteOperationError:CL,deleteOperationExample:RL,deleteStateExample:GL,moveOperation:qL,releaseNewVersion:bL,reorderChangeLogItems:vL,reorderModuleOperations:HL,reorderModules:SL,reorderOperationErrors:ML,reorderOperationExamples:FL,reorderStateExamples:KL,setAuthorName:pL,setAuthorWebsite:hL,setInitialState:YL,setModelDescription:fL,setModelExtension:dL,setModelId:lL,setModelName:cL,setModuleDescription:xL,setModuleName:_L,setOperationDescription:UL,setOperationErrorCode:DL,setOperationErrorDescription:NL,setOperationErrorName:AL,setOperationErrorTemplate:IL,setOperationName:BL,setOperationReducer:zL,setOperationSchema:jL,setOperationScope:LL,setOperationTemplate:$L,setStateSchema:WL,updateChangeLogItem:gL,updateOperationExample:kL,updateStateExample:JL},Symbol.toStringTag,{value:"Module"})),B8e=XL,L8e={...Ld,...C6e},j8e={...Ou,...P8e},U8e={Document:B8e,reducer:f0,actions:j8e,utils:L8e,documentModel:M6e},$8e="feature-flags-config",qh=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,z8e=qh==null?void 0:qh.split(","),Vh=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,q8e=Vh==null?void 0:Vh.split(","),QL={editors:{enabledEditors:qh==="*"?"*":z8e,disabledEditors:Vh==="*"?"*":q8e}},V8e=Vf($8e,QL),ej=()=>{const[t,e]=Ea(V8e);return{config:{...QL,...t},setConfig:e}},H8e=UU("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Bf=pw(),W8e=Vf("sidebar-collapsed",!1);Cn(!1);const Y8e={sidebarCollapsedAtom:W8e,themeAtom:H8e},Z8e=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS,bA=window.__VITE_ENVS.LOAD_EXTERNAL_PROJECTS;async function J8e(){if(!bA||bA!=="true")return[];try{return(await Uc(()=>import("EXTERNAL_PROJECTS"),[])).default}catch(t){return console.error("Error loading external projects",t),[]}}function G8e(t){return t.filter(e=>!!e.documentModels).map(e=>e.documentModels).reduce((e,r)=>e.concat(r),[])}async function K8e(){if(!Z8e)return[];try{const t=await Uc(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const X8e={DocumentModel:U8e,...h6e},tj=Object.values(X8e),rj=K8e(),Q8e=J8e(),eTe=Cn(rj),tTe=Cn(Q8e),Lf=Cn(async t=>{const e=await t(eTe),r=await t(tTe),n=e.map(i=>i.documentModel.id);return[...tj.filter(i=>!n.includes(i.documentModel.id)),...e,...G8e(r)]}),rTe=()=>qf(Lf),nTe=aN(Lf),nj=()=>qf(nTe),iTe=()=>rj,aTe=function(t){return Bf.sub(Lf,()=>{Bf.get(Lf).then(t).catch(e=>{throw e})})};function sTe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const oTe=()=>{const t=nj();return e=>sTe(e,t)},uTe=()=>{const t=nj(),{config:e}=ej(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function cTe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=lTe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function lTe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Ln=class Ln{constructor(e){this.db=vS.ready().then(()=>vS.createInstance({name:e?`${e}:${Ln.DBName}`:Ln.DBName}))}buildKey(...e){return e.join(Ln.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Ln.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_m(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Ln.DRIVES_KEY)).map(n=>n.slice(Ln.DRIVES_KEY.length+Ln.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Ln.DRIVES_KEY,e));if(!n)throw new Dd(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Ln.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Ln.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_m(i.operations,r);await(await this.db).setItem(this.buildKey(Ln.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Ln.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=cTe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Ln.DBName="DOCUMENT_DRIVES",Ln.SEP=":",Ln.DRIVES_KEY="DRIVES";let aw=Ln;const wA=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,mv=wA?wA.split(","):[],dTe=()=>({defaultDrives:{remoteDrives:mv.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:[],pullInterval:3e3}})),removeOldRemoteDrives:mv.length>0?{strategy:"preserve-by-url-and-detach",urls:mv}:{strategy:"preserve-all"}}});function fTe(t,e){return new UZ(t,new aw(e),new mC,new yC(1,10),{...dTe()})}async function pTe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&hs.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:rt.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(wn.error)}const rx=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??fTe(tj,hs.routerBasename);return await pTe(t),t})(),ij=Cn(rx),hTe=aN(ij),aj=()=>qf(hTe),mTe=()=>rx;aTe(async t=>{(await Bf.get(ij)).setDocumentModels(t)});async function gTe(){await iTe();const t=await Bf.get(Lf);(await rx).setDocumentModels(t)}gTe().catch(console.error);const Hh=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await Uc(async()=>{const{ConnectCrypto:n}=await import("./index-BgDn--mP.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await Uc(async()=>{const{BrowserKeyStorage:n}=await import("./browser-Dmr6AWWk.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function nx(){return ho(()=>({async regenerateDid(){return(await Hh).regenerateDid()},async did(){return(await Hh).did()},sign:async t=>await(await Hh).sign(t)}),[])}const yTe=Cn(void 0);function vTe(){const[t,e]=Ea(yTe);return ui(()=>{t||Hh.then(r=>r.did()).then(r=>e(r)).catch(wn.error)}),t}const bTe=Cn(window.renown?Promise.resolve(window.renown):void 0);function sj(){const[t,e]=Ea(bTe),{did:r}=nx();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await Uc(async()=>{const{initRenownBrowser:c}=await import("./browser-HhGAAWtQ.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let Sh=!1;const wTe=Cn(void 0),Ig=()=>{const[t,e]=Ea(wTe),r=sj();return ui(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}mG(n)},[t]),ui(()=>{if(Sh)return;Sh=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),Sh=!1}},[r,Sh]),t},_Te=parseInt("50");function NDe(t,e,r=wn.error){const[n,i]=Zn(e),[a,s]=Zn(),o=c=>{s(c),r(c)};return ui(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const p=t(f,c),h=c.scope??"global",m=p.operations[h],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...p}}),p}catch(p){return o(p),d==null||d(p),f}})},a]}async function xTe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var p;if(!(l.documentId===e&&l.scope==r))return;const f=(p=l.operations.at(-1))==null?void 0:p.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function ETe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||_Te;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await xTe(1e4,e,d,l.index,n)}}const STe=async t=>{(await rt.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(wn.error)};async function IDe(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await STe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function TTe(t,e){const r=await rt.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function DTe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return wn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await rt.buildSignedOperation(t,i,n,s,e)}function ATe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const _A=Cn(new Map);function NTe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function p0(t){return t.map(NTe).join("&")}const ITe=t=>()=>Cn(e=>t?e(_A).get(t)??[]:[],(e,r,n)=>{r(_A,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||p0(a)!==p0(n)?new Map(i).set(t,n):i})}),CTe=OU(()=>Cn("INITIAL"));function MTe(){const t=aj(),[e,r]=Ea(ho(ITe(t),[t])),n=wr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){wn.error(l)}}catch(u){wn.error(u)}finally{r(o)}},[t]),[i,a]=Ea(CTe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=wr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,p,h)=>{h&&wn.error(h),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return ho(()=>[e,n,s,i],[e,i])}const OTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",kTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",RTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",FTe=Cn("initial"),ix=()=>{const[t,e]=Ea(FTe),r=Ig(),n=sj(),{did:i}=nx(),a=wr(async()=>{var l;const u=await i(),c=new URL(OTe);if(c.searchParams.set("connect",u),c.searchParams.set("network",kTe),c.searchParams.set("chain",RTe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=wr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),wn.error(c)}},[n]);ui(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=wr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return ho(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function PTe(){const{user:t,status:e}=ix(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function oj(){const t=PTe();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function ax(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=oj()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Ig()||void 0,n=vTe(),{sign:i}=nx(),a=aj(),s=oTe(),[o,u,,c]=MTe(),l=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,B);if(!R)throw new Error(`There was an error opening file with id ${B} on drive ${S}`);return R},[a]),d=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=wu(R,ATe(B,n,r));const q=B.scope??"global",X=R.operations[q].findLast(z=>z.type===B.type);if(!X)throw new Error("There was an error applying the operation");const ie=await DTe(X,i,S,L,wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&wn.error(z.error),z.operations.length&&await u(),z.document&&!Ho(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return wn.error(z),R}},[o,u,a,i,r,n]),f=wr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const G=rt.hashKey();let X=o.find(V=>V.state.global.id===S);if(!X)throw new Error(`Drive with id ${S} not found`);const ie=_2(X.state.global,{id:G,name:B,parentFolder:L??null,documentType:R,document:q},["global"]);X=await d(S,ie);const z=X==null?void 0:X.state.global.nodes.find(V=>V.id===G);if(!z||!yi(z))throw new Error("There was an error adding document");return z},[d,o,t]),p=wr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(G=>G.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,B,R)).document},[o,e,a]),h=wr(async(S,B,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await TTe(S,s),G={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},X=await f(B,R||(typeof S=="string"?q.name:S.name),q.documentType,L,G),ie=o.find(V=>V.state.global.id===B),z=ie&&ie.state.local.listeners.length>0;ETe(B,X.id,q,a,p,{waitForSync:z}).catch(V=>{throw V})},[f,p,s,t,a]),m=wr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const G=await d(S,jn.updateFile({id:B,name:L||void 0,parentFolder:q,documentType:R})),X=G==null?void 0:G.state.global.nodes.find(ie=>ie.id===B);if(!X||!yi(X))throw new Error("There was an error updating document");return X},[d,t]),y=wr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=rt.hashKey(),q=await d(S,jn.addFolder({id:L,name:B,parentFolder:R})),G=q==null?void 0:q.state.global.nodes.find(X=>X.id===L);if(!G||!D0(G))throw new Error("There was an error adding folder");return G},[d,t]),g=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,jn.deleteNode({id:B}))},[d,t]),b=wr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,jn.updateNode({id:B,name:R})),q=L==null?void 0:L.state.global.nodes.find(G=>G.id===B);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),_=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to move documents");B.kind===bv||S.parentFolder===B.id||await d(B.driveId,jn.moveNode({srcFolder:S.id,targetParentFolder:B.id}))},[d,t]),E=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(B.kind===bv)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>rt.hashKey(),G=Ef.generateNodesCopy({srcId:S.id,targetParentFolder:B.id,targetName:S.name},L,R.state.global.nodes).map(ie=>jn.copyNode(ie)),X=await a.addDriveActions(S.driveId,G);X.operations.length?await u():X.status!=="SUCCESS"&&wn.error(`Error copying files: ${X.status}`,X.error)},[o,t,u,a]),x=wr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(G=>G.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,B,R)).document},[o,e,a]),D=wr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const B=S.global.id||rt.hashKey();S=Ef.createState(S);const R=await a.addDrive({global:{...S.global,id:B},local:S.local});return await u(),R},[t,u,a]),O=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,B);return await u(),R},[u,a]),F=wr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,jn.setDriveName({name:B}))},[d,t]),U=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,jn.setAvailableOffline({availableOffline:B}))},[d,t]),T=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,jn.setSharingType({type:B}))},[d,t]),A=wr(async(S,B)=>{if(B!==Rj){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof gC?"INITIAL_SYNC":R}catch(R){return console.error(R),Fj}}},[a]),v=wr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),w=wr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),N=wr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=wr(async(S,B)=>{const R=await d(S,jn.removeTrigger({triggerId:B}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===B))throw new Error(`There was an error removing trigger ${B}`)},[d]),I=wr(async(S,B,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,B,R)},[a]),M=wr(async(S,B)=>{const R=await d(S,jn.addTrigger({trigger:B}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${B.id}`)},[d]);return ho(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:h,updateFile:m,addFolder:y,deleteNode:g,renameNode:b,moveNode:_,copyNode:E,addOperation:x,addOperations:p,addDrive:D,addRemoteDrive:O,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:U,setDriveSharingType:T,getSyncStatus:A,onStrandUpdate:v,onSyncStatus:w,clearStorage:N,removeTrigger:C,addTrigger:M,registerNewPullResponderTrigger:I}),[f,D,h,y,x,p,O,M,N,E,F,g,o,c,A,_,v,w,l,I,C,k,b,U,T,m])}function BTe(t){return t.replaceAll(/\s/g,"-")}const LTe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=ax();return Xe(Pj,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:BTe(c.name),kind:bv,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},jTe=Cn(hs);function sx(){return Ea(jTe)}let Th;const UTe=new Uint8Array(16);function $Te(){if(!Th&&(Th=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Th))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Th(UTe)}const Bn=[];for(let t=0;t<256;++t)Bn.push((t+256).toString(16).slice(1));function zTe(t,e=0){return Bn[t[e+0]]+Bn[t[e+1]]+Bn[t[e+2]]+Bn[t[e+3]]+"-"+Bn[t[e+4]]+Bn[t[e+5]]+"-"+Bn[t[e+6]]+Bn[t[e+7]]+"-"+Bn[t[e+8]]+Bn[t[e+9]]+"-"+Bn[t[e+10]]+Bn[t[e+11]]+Bn[t[e+12]]+Bn[t[e+13]]+Bn[t[e+14]]+Bn[t[e+15]]}const qTe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xA={randomUUID:qTe};function EA(t,e,r){if(xA.randomUUID&&!e&&!t)return xA.randomUUID();t=t||{};const n=t.random||(t.rng||$Te)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,zTe(n)}const VTe=t=>{var T;const[e]=sx(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=Zn(e.appVersion),[o,u]=Zn({label:Ep.debug?"Enabled":"Disabled",value:Ep.debug}),[c,l]=Zn(),[d,f]=Zn(null),[p,h]=Zn(""),[m,y]=Zn({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:b,addTrigger:_,registerNewPullResponderTrigger:E}=ax();ui(()=>{Ep.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const x=((T=g.find(A=>A.state.global.id===c))==null?void 0:T.state.local.triggers)||[],O=!c||p==="",F=async()=>{!d||!c||(await b(c,d.value),f(null))},k=async(A=!1)=>{if(!(!p||p===""||!c)){if(!A){const v=await E(c,p,{pullInterval:3e3});await _(c,v),h("");return}await _(c,{id:`invalid-trigger-${EA()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${EA()}`,url:p}}),h("")}},U=A=>{y(A),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",A.value)};return Xe(Bj,{open:r,onOpenChange:A=>{if(!A)return n()},contentProps:{className:"rounded-2xl"},children:Br("div",{className:"w-[700px] rounded-2xl p-6",children:[Br("div",{className:"mb-6 flex justify-between",children:[Xe("div",{className:"text-xl font-bold",children:"Debug Tools"}),Xe("button",{id:"close-modal",onClick:()=>n(),children:Xe(xp,{name:"Xmark",size:28})})]}),Br("div",{className:"flex text-sm font-bold",children:[Xe(xp,{name:"Ring",size:22}),Br("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Br("div",{className:"mt-4 flex text-sm font-bold",children:[Xe(xp,{name:"Hdd",size:22}),Xe("span",{className:"ml-2",children:"Drive Tools:"})]}),Br("div",{children:[Xe("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),Xe(rd,{id:"selectedDrive",onChange:A=>{if(!A||typeof A!="object"||!("value"in A)){l(void 0),f(null);return}l(A.value),f(null)},options:g.map(A=>({label:A.state.global.name,value:A.state.global.id}))})]}),Xe("div",{className:"mt-2 flex items-end justify-between pl-4",children:Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),Xe(rd,{id:"autoRegisterPullResponder",onChange:A=>{U(A)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),Xe(rd,{id:"driveTrigger",onChange:A=>{f(A)},value:d,options:x.map(A=>({label:`${A.id} - ${A.type}`,value:A.id}))})]}),Xe("div",{children:Xe(gc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),Xe(mx,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:Xe("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:p,onChange:A=>h(A.target.value)})]}),Br("div",{className:"mb-1 flex items-center justify-center",children:[Xe(gc,{className:"mr-2",color:O?"light":"blue",size:"small",disabled:O,onClick:()=>k(),children:"Add Trigger"}),Xe(gc,{color:O?"light":"red",size:"small",disabled:O,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Br("div",{className:"mt-4 flex text-sm font-bold",children:[Xe(xp,{name:"Gear",size:22}),Xe("span",{className:"ml-2",children:"Service Worker Tools:"})]}),Xe("div",{className:"mt-2 flex items-end justify-between pl-4",children:Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),Xe(rd,{id:"serviceWorkerDebugMode",onChange:A=>{u(A)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),Xe(mx,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:Xe("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:A=>s(A.target.value)})]}),Xe("div",{className:"mb-1 flex items-center justify-center",children:Xe(gc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{Ep.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},HTe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=Nu();return Xe(Lj,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},WTe=t=>{const{t:e}=Nu(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return Xe(jj,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},YTe=t=>{const{open:e,onClose:r}=t,{t:n}=Nu();return Xe(HA,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function ZTe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return Xe(Uj,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const JTe="defaultDocumentModelEditor",GTe=Vf(JTe,{label:"V2",value:"document-model-editor-v2"}),KTe=()=>Ea(GTe),XTe=t=>ft.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},ft.createElement("g",{id:"Group 1000003373"},ft.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),ft.createElement("g",{id:"Renown"},ft.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),ft.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),ft.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),ft.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),ft.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),ft.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),QTe=()=>{const[t,e]=Zn(0);return ui(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),Xe("span",{children:new Array(t).fill(".").join("")})},e4e=()=>{const t=Ig(),{openRenown:e,status:r}=ix();return Xe("div",{children:r==="checking"?Br("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[Xe("span",{children:"Checking Authorization"}),Xe("span",{className:"inline-block w-5 text-left",children:Xe(QTe,{})})]}):r!=="authorized"?Br("div",{className:"flex flex-col items-center",children:[Xe("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),Xe(XTe,{className:"mb-3"}),Xe("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),Xe(gc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:Xe("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Br("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},SA=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),t4e=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=ax(),{t:a}=Nu(),s=uTe(),o=rTe(),{setConfig:u}=ej(),{showModal:c}=cj(),[l]=sx(),[d,f]=KTe(),[p,h]=Zn(SA(s)),{logout:m,status:y}=ix(),g=Ig(),b=()=>{u(E=>({...E,editors:{enabledEditors:p.map(x=>x.value)}})),r()},_=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(wn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Br($j,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:b,onOpenChange:E=>{if(!E)return r()},children:[Xe("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Br(VA,{children:[Br("p",{children:["Logged in with address:"," ",Xe("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),Xe(gc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):Xe(e4e,{})}),l.content.showDocumentModelSelectionSetting&&Xe(zj,{selected:p,onChange:E=>h(E),options:SA(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),Xe(qj,{onClearStorage:_,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Br("div",{children:[Xe("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),Xe(rd,{id:"default-document-model-editor",value:d,onChange:E=>f(E),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),Xe(Vj,{packageJson:tU})]})},r4e=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=Nu();return Xe(Hj,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},n4e={deleteItem:WTe,upgradeDrive:r4e,createDocument:LTe,addLocalDrive:WU,addRemoteDrive:Nq,driveSettings:ZTe,settingsModal:t4e,confirmationModal:Iq,deleteDriveModal:HTe,debugSettingsModal:VTe,disclaimerModal:YTe,cookiesPolicy:Cq},uj=xs.createContext({showModal:()=>{},closeModal:()=>{}}),cj=()=>$f(uj),i4e=t=>{const{children:e}=t,[r,n]=Zn(),[i,a]=Zn(),[s,o]=Zn(!1),u=wr((f,p)=>{o(!0),n(p),a(f)},[]),c=wr(()=>{o(!1)},[]),l=i?n4e[i]:null,d=ho(()=>({showModal:u,closeModal:c}),[c,u]);return Br(uj.Provider,{value:d,children:[e,l&&Xe(l,{...r,open:s,onClose:c})]})},a4e=(t,e)=>t.some(r=>r.id===e&&r.value),s4e=()=>{const{t}=Nu(),{showModal:e}=cj(),[r,n]=HU(),[,i]=hw(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),a4e(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Br("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[Xe("div",{className:"absolute inset-0 bg-black opacity-15"}),Xe("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:Xe(Wj,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:Xe("p",{className:"font-semibold text-gray-500",children:Xe(KA,{i18nKey:"cookieBanner.message",components:{a:Xe("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var o4e=Object.defineProperty,u4e=Object.getOwnPropertyDescriptor,ns=(t,e,r,n)=>{for(var i=u4e(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&o4e(e,r,i),i};function is(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function c4e(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Oa{constructor(e){hx(this,"server");c4e(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}ns([is],Oa.prototype,"migrateReadDrive");ns([is],Oa.prototype,"addReadDrive");ns([is],Oa.prototype,"getReadDrives");ns([is],Oa.prototype,"getReadDriveBySlug");ns([is],Oa.prototype,"getReadDrive");ns([is],Oa.prototype,"getReadDriveContext");ns([is],Oa.prototype,"fetchDrive");ns([is],Oa.prototype,"fetchDocument");ns([is],Oa.prototype,"deleteReadDrive");ns([is],Oa.prototype,"onReadDrivesUpdate");const mc=new Oa,lj=dw({...mc,readDrives:[]});async function l4e(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof Wo))}const d4e=t=>{const e=mTe(),[r,n]=Zn([]),i=oj(),[a,s]=Zn(!1);ui(()=>{e.then(c=>{mc.setDocumentDrive(c),s(!0)}).catch(wn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);ho(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=mc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(wn.error)},[o,a]),ui(()=>{if(!a)return;l4e(mc).then(l=>n(l)).catch(wn.error);const c=mc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||p0(d)!==p0(l)?l:d)}).catch(wn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(wn.error)}},[a]);const u=ho(()=>({...mc,readDrives:r}),[r]);return Xe(lj.Provider,{...t,value:u})},CDe=()=>$f(lj);/**
|
|
1122
|
+
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},O6e=t=>t!=null;Te.any().refine(t=>O6e(t));function k6e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function R6e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function F6e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function P6e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function B6e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:uL().nullish()})}function L6e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function j6e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function U6e(){return Te.object({id:Te.string()})}function $6e(){return Te.object({id:Te.string()})}function z6e(){return Te.object({id:Te.string()})}function q6e(){return Te.object({id:Te.string()})}function V6e(){return Te.object({scope:Te.string(),id:Te.string()})}function uL(){return Te.literal("global").or(Te.literal("local"))}function H6e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function W6e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function Y6e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function Z6e(){return Te.object({order:Te.array(Te.string())})}function J6e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function G6e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function K6e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function X6e(){return Te.object({authorName:Te.string()})}function Q6e(){return Te.object({authorWebsite:Te.string()})}function e8e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function t8e(){return Te.object({description:Te.string()})}function r8e(){return Te.object({extension:Te.string()})}function n8e(){return Te.object({id:Te.string()})}function i8e(){return Te.object({name:Te.string()})}function a8e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function s8e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function o8e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function u8e(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function c8e(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function l8e(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function d8e(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function f8e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function p8e(){return Te.object({id:Te.string(),scope:uL()})}function h8e(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function m8e(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function g8e(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function y8e(){return Te.object({scope:Te.string(),schema:Te.string()})}function v8e(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function b8e(){return Te.object({example:Te.string(),id:Te.string()})}function w8e(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const ic={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Xl={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},_8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Ql={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(_8e(e.input.order))}},x8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},qo={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(x8e(e.input.order))}},E8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Eh={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(E8e(e.input.order))}},S8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Pa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(S8e(e.input.order))}},T8e=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},ac={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(T8e(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},D8e=(t,e)=>{if(Hc(e))return t;switch(e.type){case"SET_MODEL_NAME":i8e().parse(e.input),ic.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":n8e().parse(e.input),ic.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":r8e().parse(e.input),ic.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":t8e().parse(e.input),ic.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":X6e().parse(e.input),ic.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":Q6e().parse(e.input),ic.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":k6e().parse(e.input),Xl.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":v8e().parse(e.input),Xl.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":j6e().parse(e.input),Xl.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":W6e().parse(e.input),Xl.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Xl.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":R6e().parse(e.input),Ql.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":s8e().parse(e.input),Ql.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":a8e().parse(e.input),Ql.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":U6e().parse(e.input),Ql.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":Z6e().parse(e.input),Ql.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":F6e().parse(e.input),qo.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":u8e().parse(e.input),qo.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":l8e().parse(e.input),qo.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":c8e().parse(e.input),qo.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":d8e().parse(e.input),qo.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":$6e().parse(e.input),qo.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":J6e().parse(e.input),qo.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":P6e().parse(e.input),Eh.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":b8e().parse(e.input),Eh.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":z6e().parse(e.input),Eh.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":G6e().parse(e.input),Eh.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":B6e().parse(e.input),Pa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":f8e().parse(e.input),Pa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":p8e().parse(e.input),Pa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":m8e().parse(e.input),Pa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":o8e().parse(e.input),Pa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":g8e().parse(e.input),Pa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":h8e().parse(e.input),Pa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":H6e().parse(e.input),Pa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":q6e().parse(e.input),Pa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":Y6e().parse(e.input),Pa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":y8e().parse(e.input),ac.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":e8e().parse(e.input),ac.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":L6e().parse(e.input),ac.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":w8e().parse(e.input),ac.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":V6e().parse(e.input),ac.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":K6e().parse(e.input),ac.reorderStateExamplesOperation(t.global,e);break;default:return t}},f0=Ww(D8e),A8e={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},N8e={},Ld={fileExtension:"phdm",createState(t){return{global:{...A8e,...t==null?void 0:t.global},local:{...N8e,...t==null?void 0:t.local}}},createExtendedState(t){return Yw({...t,documentType:"powerhouse/document-model"},Ld.createState)},createDocument(t){return Zw(Ld.createExtendedState(t),Ld.createState)},saveToFile(t,e,r){return Vw(t,e,"phdm",r)},saveToFileHandle(t,e){return $I(t,e)},loadFromFile(t){return lm(t,f0)},loadFromInput(t){return Hw(t,f0)}},cL=t=>It("SET_MODEL_NAME",{...t}),lL=t=>It("SET_MODEL_ID",{...t}),dL=t=>It("SET_MODEL_EXTENSION",{...t}),fL=t=>It("SET_MODEL_DESCRIPTION",{...t}),pL=t=>It("SET_AUTHOR_NAME",{...t}),hL=t=>It("SET_AUTHOR_WEBSITE",{...t});class I8e extends $r{setModelName(e,r){return this.dispatch(cL(e),r)}setModelId(e,r){return this.dispatch(lL(e),r)}setModelExtension(e,r){return this.dispatch(dL(e),r)}setModelDescription(e,r){return this.dispatch(fL(e),r)}setAuthorName(e,r){return this.dispatch(pL(e),r)}setAuthorWebsite(e,r){return this.dispatch(hL(e),r)}}const mL=t=>It("ADD_CHANGE_LOG_ITEM",{...t}),gL=t=>It("UPDATE_CHANGE_LOG_ITEM",{...t}),yL=t=>It("DELETE_CHANGE_LOG_ITEM",{...t}),vL=t=>It("REORDER_CHANGE_LOG_ITEMS",{...t}),bL=()=>It("RELEASE_NEW_VERSION");class C8e extends $r{addChangeLogItem(e,r){return this.dispatch(mL(e),r)}updateChangeLogItem(e,r){return this.dispatch(gL(e),r)}deleteChangeLogItem(e,r){return this.dispatch(yL(e),r)}reorderChangeLogItems(e,r){return this.dispatch(vL(e),r)}releaseNewVersion(e){return this.dispatch(bL(),e)}}const wL=t=>It("ADD_MODULE",{...t}),_L=t=>It("SET_MODULE_NAME",{...t}),xL=t=>It("SET_MODULE_DESCRIPTION",{...t}),EL=t=>It("DELETE_MODULE",{...t}),SL=t=>It("REORDER_MODULES",{...t});class M8e extends $r{addModule(e,r){return this.dispatch(wL(e),r)}setModuleName(e,r){return this.dispatch(_L(e),r)}setModuleDescription(e,r){return this.dispatch(xL(e),r)}deleteModule(e,r){return this.dispatch(EL(e),r)}reorderModules(e,r){return this.dispatch(SL(e),r)}}const TL=t=>It("ADD_OPERATION_ERROR",{...t}),DL=t=>It("SET_OPERATION_ERROR_CODE",{...t}),AL=t=>It("SET_OPERATION_ERROR_NAME",{...t}),NL=t=>It("SET_OPERATION_ERROR_DESCRIPTION",{...t}),IL=t=>It("SET_OPERATION_ERROR_TEMPLATE",{...t}),CL=t=>It("DELETE_OPERATION_ERROR",{...t}),ML=t=>It("REORDER_OPERATION_ERRORS",{...t});class O8e extends $r{addOperationError(e,r){return this.dispatch(TL(e),r)}setOperationErrorCode(e,r){return this.dispatch(DL(e),r)}setOperationErrorName(e,r){return this.dispatch(AL(e),r)}setOperationErrorDescription(e,r){return this.dispatch(NL(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(IL(e),r)}deleteOperationError(e,r){return this.dispatch(CL(e),r)}reorderOperationErrors(e,r){return this.dispatch(ML(e),r)}}const OL=t=>It("ADD_OPERATION_EXAMPLE",{...t}),kL=t=>It("UPDATE_OPERATION_EXAMPLE",{...t}),RL=t=>It("DELETE_OPERATION_EXAMPLE",{...t}),FL=t=>It("REORDER_OPERATION_EXAMPLES",{...t});class k8e extends $r{addOperationExample(e,r){return this.dispatch(OL(e),r)}updateOperationExample(e,r){return this.dispatch(kL(e),r)}deleteOperationExample(e,r){return this.dispatch(RL(e),r)}reorderOperationExamples(e,r){return this.dispatch(FL(e),r)}}const PL=t=>It("ADD_OPERATION",{...t}),BL=t=>It("SET_OPERATION_NAME",{...t}),LL=t=>It("SET_OPERATION_SCOPE",{...t}),jL=t=>It("SET_OPERATION_SCHEMA",{...t}),UL=t=>It("SET_OPERATION_DESCRIPTION",{...t}),$L=t=>It("SET_OPERATION_TEMPLATE",{...t}),zL=t=>It("SET_OPERATION_REDUCER",{...t}),qL=t=>It("MOVE_OPERATION",{...t}),VL=t=>It("DELETE_OPERATION",{...t}),HL=t=>It("REORDER_MODULE_OPERATIONS",{...t});class R8e extends $r{addOperation(e,r){return this.dispatch(PL(e),r)}setOperationName(e,r){return this.dispatch(BL(e),r)}setOperationScope(e,r){return this.dispatch(LL(e),r)}setOperationSchema(e,r){return this.dispatch(jL(e),r)}setOperationDescription(e,r){return this.dispatch(UL(e),r)}setOperationTemplate(e,r){return this.dispatch($L(e),r)}setOperationReducer(e,r){return this.dispatch(zL(e),r)}moveOperation(e,r){return this.dispatch(qL(e),r)}deleteOperation(e,r){return this.dispatch(VL(e),r)}reorderModuleOperations(e,r){return this.dispatch(HL(e),r)}}const WL=t=>It("SET_STATE_SCHEMA",{...t}),YL=t=>It("SET_INITIAL_STATE",{...t}),ZL=t=>It("ADD_STATE_EXAMPLE",{...t}),JL=t=>It("UPDATE_STATE_EXAMPLE",{...t}),GL=t=>It("DELETE_STATE_EXAMPLE",{...t}),KL=t=>It("REORDER_STATE_EXAMPLES",{...t});class F8e extends $r{setStateSchema(e,r){return this.dispatch(WL(e),r)}setInitialState(e,r){return this.dispatch(YL(e),r)}addStateExample(e,r){return this.dispatch(ZL(e),r)}updateStateExample(e,r){return this.dispatch(JL(e),r)}deleteStateExample(e,r){return this.dispatch(GL(e),r)}reorderStateExamples(e,r){return this.dispatch(KL(e),r)}}let XL=(xh=class extends $r{constructor(t,e){super(f0,Ld.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,xh.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},y6e(xh,"fileExtension","phdm"),xh);ku(XL,[I8e,C8e,M8e,O8e,k8e,R8e,F8e]);const P8e=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:mL,addModule:wL,addOperation:PL,addOperationError:TL,addOperationExample:OL,addStateExample:ZL,deleteChangeLogItem:yL,deleteModule:EL,deleteOperation:VL,deleteOperationError:CL,deleteOperationExample:RL,deleteStateExample:GL,moveOperation:qL,releaseNewVersion:bL,reorderChangeLogItems:vL,reorderModuleOperations:HL,reorderModules:SL,reorderOperationErrors:ML,reorderOperationExamples:FL,reorderStateExamples:KL,setAuthorName:pL,setAuthorWebsite:hL,setInitialState:YL,setModelDescription:fL,setModelExtension:dL,setModelId:lL,setModelName:cL,setModuleDescription:xL,setModuleName:_L,setOperationDescription:UL,setOperationErrorCode:DL,setOperationErrorDescription:NL,setOperationErrorName:AL,setOperationErrorTemplate:IL,setOperationName:BL,setOperationReducer:zL,setOperationSchema:jL,setOperationScope:LL,setOperationTemplate:$L,setStateSchema:WL,updateChangeLogItem:gL,updateOperationExample:kL,updateStateExample:JL},Symbol.toStringTag,{value:"Module"})),B8e=XL,L8e={...Ld,...C6e},j8e={...Ou,...P8e},U8e={Document:B8e,reducer:f0,actions:j8e,utils:L8e,documentModel:M6e},$8e="feature-flags-config",qh=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,z8e=qh==null?void 0:qh.split(","),Vh=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,q8e=Vh==null?void 0:Vh.split(","),QL={editors:{enabledEditors:qh==="*"?"*":z8e,disabledEditors:Vh==="*"?"*":q8e}},V8e=Vf($8e,QL),ej=()=>{const[t,e]=Ea(V8e);return{config:{...QL,...t},setConfig:e}},H8e=UU("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Bf=pw(),W8e=Vf("sidebar-collapsed",!1);Cn(!1);const Y8e={sidebarCollapsedAtom:W8e,themeAtom:H8e},Z8e=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS,bA=window.__VITE_ENVS.LOAD_EXTERNAL_PROJECTS;async function J8e(){if(!bA||bA!=="true")return[];try{return(await Uc(()=>import("EXTERNAL_PROJECTS"),[])).default}catch(t){return console.error("Error loading external projects",t),[]}}function G8e(t){return t.filter(e=>!!e.documentModels).map(e=>e.documentModels).reduce((e,r)=>e.concat(r),[])}async function K8e(){if(!Z8e)return[];try{const t=await Uc(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const X8e={DocumentModel:U8e,...h6e},tj=Object.values(X8e),rj=K8e(),Q8e=J8e(),eTe=Cn(rj),tTe=Cn(Q8e),Lf=Cn(async t=>{const e=await t(eTe),r=await t(tTe),n=e.map(i=>i.documentModel.id);return[...tj.filter(i=>!n.includes(i.documentModel.id)),...e,...G8e(r)]}),rTe=()=>qf(Lf),nTe=aN(Lf),nj=()=>qf(nTe),iTe=()=>rj,aTe=function(t){return Bf.sub(Lf,()=>{Bf.get(Lf).then(t).catch(e=>{throw e})})};function sTe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const oTe=()=>{const t=nj();return e=>sTe(e,t)},uTe=()=>{const t=nj(),{config:e}=ej(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function cTe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=lTe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function lTe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Ln=class Ln{constructor(e){this.db=vS.ready().then(()=>vS.createInstance({name:e?`${e}:${Ln.DBName}`:Ln.DBName}))}buildKey(...e){return e.join(Ln.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Ln.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=_m(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Ln.DRIVES_KEY)).map(n=>n.slice(Ln.DRIVES_KEY.length+Ln.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Ln.DRIVES_KEY,e));if(!n)throw new Dd(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Ln.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Ln.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=_m(i.operations,r);await(await this.db).setItem(this.buildKey(Ln.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Ln.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=cTe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Ln.DBName="DOCUMENT_DRIVES",Ln.SEP=":",Ln.DRIVES_KEY="DRIVES";let aw=Ln;const wA=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,mv=wA?wA.split(","):[],dTe=()=>({defaultDrives:{remoteDrives:mv.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:[],pullInterval:3e3}})),removeOldRemoteDrives:mv.length>0?{strategy:"preserve-by-url-and-detach",urls:mv}:{strategy:"preserve-all"}}});function fTe(t,e){return new UZ(t,new aw(e),new mC,new yC(1,10),{...dTe()})}async function pTe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&hs.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:rt.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(wn.error)}const rx=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??fTe(tj,hs.routerBasename);return await pTe(t),t})(),ij=Cn(rx),hTe=aN(ij),aj=()=>qf(hTe),mTe=()=>rx;aTe(async t=>{(await Bf.get(ij)).setDocumentModels(t)});async function gTe(){await iTe();const t=await Bf.get(Lf);(await rx).setDocumentModels(t)}gTe().catch(console.error);const Hh=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await Uc(async()=>{const{ConnectCrypto:n}=await import("./index-zOgcw8RH.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await Uc(async()=>{const{BrowserKeyStorage:n}=await import("./browser-Dmr6AWWk.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function nx(){return ho(()=>({async regenerateDid(){return(await Hh).regenerateDid()},async did(){return(await Hh).did()},sign:async t=>await(await Hh).sign(t)}),[])}const yTe=Cn(void 0);function vTe(){const[t,e]=Ea(yTe);return ui(()=>{t||Hh.then(r=>r.did()).then(r=>e(r)).catch(wn.error)}),t}const bTe=Cn(window.renown?Promise.resolve(window.renown):void 0);function sj(){const[t,e]=Ea(bTe),{did:r}=nx();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await Uc(async()=>{const{initRenownBrowser:c}=await import("./browser-YDp_xMjJ.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let Sh=!1;const wTe=Cn(void 0),Ig=()=>{const[t,e]=Ea(wTe),r=sj();return ui(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}mG(n)},[t]),ui(()=>{if(Sh)return;Sh=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),Sh=!1}},[r,Sh]),t},_Te=parseInt("50");function NDe(t,e,r=wn.error){const[n,i]=Zn(e),[a,s]=Zn(),o=c=>{s(c),r(c)};return ui(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const p=t(f,c),h=c.scope??"global",m=p.operations[h],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...p}}),p}catch(p){return o(p),d==null||d(p),f}})},a]}async function xTe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var p;if(!(l.documentId===e&&l.scope==r))return;const f=(p=l.operations.at(-1))==null?void 0:p.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function ETe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||_Te;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await xTe(1e4,e,d,l.index,n)}}const STe=async t=>{(await rt.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(wn.error)};async function IDe(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await STe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function TTe(t,e){const r=await rt.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function DTe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return wn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await rt.buildSignedOperation(t,i,n,s,e)}function ATe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const _A=Cn(new Map);function NTe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function p0(t){return t.map(NTe).join("&")}const ITe=t=>()=>Cn(e=>t?e(_A).get(t)??[]:[],(e,r,n)=>{r(_A,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||p0(a)!==p0(n)?new Map(i).set(t,n):i})}),CTe=OU(()=>Cn("INITIAL"));function MTe(){const t=aj(),[e,r]=Ea(ho(ITe(t),[t])),n=wr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){wn.error(l)}}catch(u){wn.error(u)}finally{r(o)}},[t]),[i,a]=Ea(CTe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=wr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,p,h)=>{h&&wn.error(h),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return ho(()=>[e,n,s,i],[e,i])}const OTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",kTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",RTe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",FTe=Cn("initial"),ix=()=>{const[t,e]=Ea(FTe),r=Ig(),n=sj(),{did:i}=nx(),a=wr(async()=>{var l;const u=await i(),c=new URL(OTe);if(c.searchParams.set("connect",u),c.searchParams.set("network",kTe),c.searchParams.set("chain",RTe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=wr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),wn.error(c)}},[n]);ui(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=wr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return ho(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function PTe(){const{user:t,status:e}=ix(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function oj(){const t=PTe();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function ax(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=oj()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Ig()||void 0,n=vTe(),{sign:i}=nx(),a=aj(),s=oTe(),[o,u,,c]=MTe(),l=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,B);if(!R)throw new Error(`There was an error opening file with id ${B} on drive ${S}`);return R},[a]),d=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=wu(R,ATe(B,n,r));const q=B.scope??"global",X=R.operations[q].findLast(z=>z.type===B.type);if(!X)throw new Error("There was an error applying the operation");const ie=await DTe(X,i,S,L,wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&wn.error(z.error),z.operations.length&&await u(),z.document&&!Ho(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return wn.error(z),R}},[o,u,a,i,r,n]),f=wr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const G=rt.hashKey();let X=o.find(V=>V.state.global.id===S);if(!X)throw new Error(`Drive with id ${S} not found`);const ie=_2(X.state.global,{id:G,name:B,parentFolder:L??null,documentType:R,document:q},["global"]);X=await d(S,ie);const z=X==null?void 0:X.state.global.nodes.find(V=>V.id===G);if(!z||!yi(z))throw new Error("There was an error adding document");return z},[d,o,t]),p=wr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(G=>G.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,B,R)).document},[o,e,a]),h=wr(async(S,B,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await TTe(S,s),G={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},X=await f(B,R||(typeof S=="string"?q.name:S.name),q.documentType,L,G),ie=o.find(V=>V.state.global.id===B),z=ie&&ie.state.local.listeners.length>0;ETe(B,X.id,q,a,p,{waitForSync:z}).catch(V=>{throw V})},[f,p,s,t,a]),m=wr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const G=await d(S,jn.updateFile({id:B,name:L||void 0,parentFolder:q,documentType:R})),X=G==null?void 0:G.state.global.nodes.find(ie=>ie.id===B);if(!X||!yi(X))throw new Error("There was an error updating document");return X},[d,t]),y=wr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=rt.hashKey(),q=await d(S,jn.addFolder({id:L,name:B,parentFolder:R})),G=q==null?void 0:q.state.global.nodes.find(X=>X.id===L);if(!G||!D0(G))throw new Error("There was an error adding folder");return G},[d,t]),g=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,jn.deleteNode({id:B}))},[d,t]),b=wr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,jn.updateNode({id:B,name:R})),q=L==null?void 0:L.state.global.nodes.find(G=>G.id===B);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),_=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to move documents");B.kind===bv||S.parentFolder===B.id||await d(B.driveId,jn.moveNode({srcFolder:S.id,targetParentFolder:B.id}))},[d,t]),E=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(B.kind===bv)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>rt.hashKey(),G=Ef.generateNodesCopy({srcId:S.id,targetParentFolder:B.id,targetName:S.name},L,R.state.global.nodes).map(ie=>jn.copyNode(ie)),X=await a.addDriveActions(S.driveId,G);X.operations.length?await u():X.status!=="SUCCESS"&&wn.error(`Error copying files: ${X.status}`,X.error)},[o,t,u,a]),x=wr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(G=>G.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,B,R)).document},[o,e,a]),D=wr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const B=S.global.id||rt.hashKey();S=Ef.createState(S);const R=await a.addDrive({global:{...S.global,id:B},local:S.local});return await u(),R},[t,u,a]),O=wr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,B);return await u(),R},[u,a]),F=wr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,jn.setDriveName({name:B}))},[d,t]),U=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,jn.setAvailableOffline({availableOffline:B}))},[d,t]),T=wr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,jn.setSharingType({type:B}))},[d,t]),A=wr(async(S,B)=>{if(B!==Rj){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof gC?"INITIAL_SYNC":R}catch(R){return console.error(R),Fj}}},[a]),v=wr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),w=wr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),N=wr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=wr(async(S,B)=>{const R=await d(S,jn.removeTrigger({triggerId:B}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===B))throw new Error(`There was an error removing trigger ${B}`)},[d]),I=wr(async(S,B,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,B,R)},[a]),M=wr(async(S,B)=>{const R=await d(S,jn.addTrigger({trigger:B}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${B.id}`)},[d]);return ho(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:h,updateFile:m,addFolder:y,deleteNode:g,renameNode:b,moveNode:_,copyNode:E,addOperation:x,addOperations:p,addDrive:D,addRemoteDrive:O,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:U,setDriveSharingType:T,getSyncStatus:A,onStrandUpdate:v,onSyncStatus:w,clearStorage:N,removeTrigger:C,addTrigger:M,registerNewPullResponderTrigger:I}),[f,D,h,y,x,p,O,M,N,E,F,g,o,c,A,_,v,w,l,I,C,k,b,U,T,m])}function BTe(t){return t.replaceAll(/\s/g,"-")}const LTe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=ax();return Xe(Pj,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:BTe(c.name),kind:bv,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},jTe=Cn(hs);function sx(){return Ea(jTe)}let Th;const UTe=new Uint8Array(16);function $Te(){if(!Th&&(Th=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Th))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Th(UTe)}const Bn=[];for(let t=0;t<256;++t)Bn.push((t+256).toString(16).slice(1));function zTe(t,e=0){return Bn[t[e+0]]+Bn[t[e+1]]+Bn[t[e+2]]+Bn[t[e+3]]+"-"+Bn[t[e+4]]+Bn[t[e+5]]+"-"+Bn[t[e+6]]+Bn[t[e+7]]+"-"+Bn[t[e+8]]+Bn[t[e+9]]+"-"+Bn[t[e+10]]+Bn[t[e+11]]+Bn[t[e+12]]+Bn[t[e+13]]+Bn[t[e+14]]+Bn[t[e+15]]}const qTe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xA={randomUUID:qTe};function EA(t,e,r){if(xA.randomUUID&&!e&&!t)return xA.randomUUID();t=t||{};const n=t.random||(t.rng||$Te)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,zTe(n)}const VTe=t=>{var T;const[e]=sx(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=Zn(e.appVersion),[o,u]=Zn({label:Ep.debug?"Enabled":"Disabled",value:Ep.debug}),[c,l]=Zn(),[d,f]=Zn(null),[p,h]=Zn(""),[m,y]=Zn({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:b,addTrigger:_,registerNewPullResponderTrigger:E}=ax();ui(()=>{Ep.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const x=((T=g.find(A=>A.state.global.id===c))==null?void 0:T.state.local.triggers)||[],O=!c||p==="",F=async()=>{!d||!c||(await b(c,d.value),f(null))},k=async(A=!1)=>{if(!(!p||p===""||!c)){if(!A){const v=await E(c,p,{pullInterval:3e3});await _(c,v),h("");return}await _(c,{id:`invalid-trigger-${EA()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${EA()}`,url:p}}),h("")}},U=A=>{y(A),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",A.value)};return Xe(Bj,{open:r,onOpenChange:A=>{if(!A)return n()},contentProps:{className:"rounded-2xl"},children:Br("div",{className:"w-[700px] rounded-2xl p-6",children:[Br("div",{className:"mb-6 flex justify-between",children:[Xe("div",{className:"text-xl font-bold",children:"Debug Tools"}),Xe("button",{id:"close-modal",onClick:()=>n(),children:Xe(xp,{name:"Xmark",size:28})})]}),Br("div",{className:"flex text-sm font-bold",children:[Xe(xp,{name:"Ring",size:22}),Br("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Br("div",{className:"mt-4 flex text-sm font-bold",children:[Xe(xp,{name:"Hdd",size:22}),Xe("span",{className:"ml-2",children:"Drive Tools:"})]}),Br("div",{children:[Xe("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),Xe(rd,{id:"selectedDrive",onChange:A=>{if(!A||typeof A!="object"||!("value"in A)){l(void 0),f(null);return}l(A.value),f(null)},options:g.map(A=>({label:A.state.global.name,value:A.state.global.id}))})]}),Xe("div",{className:"mt-2 flex items-end justify-between pl-4",children:Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),Xe(rd,{id:"autoRegisterPullResponder",onChange:A=>{U(A)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),Xe(rd,{id:"driveTrigger",onChange:A=>{f(A)},value:d,options:x.map(A=>({label:`${A.id} - ${A.type}`,value:A.id}))})]}),Xe("div",{children:Xe(gc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),Xe(mx,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:Xe("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:p,onChange:A=>h(A.target.value)})]}),Br("div",{className:"mb-1 flex items-center justify-center",children:[Xe(gc,{className:"mr-2",color:O?"light":"blue",size:"small",disabled:O,onClick:()=>k(),children:"Add Trigger"}),Xe(gc,{color:O?"light":"red",size:"small",disabled:O,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Br("div",{className:"mt-4 flex text-sm font-bold",children:[Xe(xp,{name:"Gear",size:22}),Xe("span",{className:"ml-2",children:"Service Worker Tools:"})]}),Xe("div",{className:"mt-2 flex items-end justify-between pl-4",children:Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),Xe(rd,{id:"serviceWorkerDebugMode",onChange:A=>{u(A)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Br("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Br("div",{className:"w-[400px]",children:[Xe("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),Xe(mx,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:Xe("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:A=>s(A.target.value)})]}),Xe("div",{className:"mb-1 flex items-center justify-center",children:Xe(gc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{Ep.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},HTe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=Nu();return Xe(Lj,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},WTe=t=>{const{t:e}=Nu(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return Xe(jj,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},YTe=t=>{const{open:e,onClose:r}=t,{t:n}=Nu();return Xe(HA,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function ZTe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return Xe(Uj,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const JTe="defaultDocumentModelEditor",GTe=Vf(JTe,{label:"V2",value:"document-model-editor-v2"}),KTe=()=>Ea(GTe),XTe=t=>ft.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},ft.createElement("g",{id:"Group 1000003373"},ft.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),ft.createElement("g",{id:"Renown"},ft.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),ft.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),ft.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),ft.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),ft.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),ft.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),QTe=()=>{const[t,e]=Zn(0);return ui(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),Xe("span",{children:new Array(t).fill(".").join("")})},e4e=()=>{const t=Ig(),{openRenown:e,status:r}=ix();return Xe("div",{children:r==="checking"?Br("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[Xe("span",{children:"Checking Authorization"}),Xe("span",{className:"inline-block w-5 text-left",children:Xe(QTe,{})})]}):r!=="authorized"?Br("div",{className:"flex flex-col items-center",children:[Xe("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),Xe(XTe,{className:"mb-3"}),Xe("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),Xe(gc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:Xe("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Br("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},SA=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),t4e=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=ax(),{t:a}=Nu(),s=uTe(),o=rTe(),{setConfig:u}=ej(),{showModal:c}=cj(),[l]=sx(),[d,f]=KTe(),[p,h]=Zn(SA(s)),{logout:m,status:y}=ix(),g=Ig(),b=()=>{u(E=>({...E,editors:{enabledEditors:p.map(x=>x.value)}})),r()},_=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(wn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Br($j,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:b,onOpenChange:E=>{if(!E)return r()},children:[Xe("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Br(VA,{children:[Br("p",{children:["Logged in with address:"," ",Xe("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),Xe(gc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):Xe(e4e,{})}),l.content.showDocumentModelSelectionSetting&&Xe(zj,{selected:p,onChange:E=>h(E),options:SA(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),Xe(qj,{onClearStorage:_,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Br("div",{children:[Xe("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),Xe(rd,{id:"default-document-model-editor",value:d,onChange:E=>f(E),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),Xe(Vj,{packageJson:tU})]})},r4e=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=Nu();return Xe(Hj,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},n4e={deleteItem:WTe,upgradeDrive:r4e,createDocument:LTe,addLocalDrive:WU,addRemoteDrive:Nq,driveSettings:ZTe,settingsModal:t4e,confirmationModal:Iq,deleteDriveModal:HTe,debugSettingsModal:VTe,disclaimerModal:YTe,cookiesPolicy:Cq},uj=xs.createContext({showModal:()=>{},closeModal:()=>{}}),cj=()=>$f(uj),i4e=t=>{const{children:e}=t,[r,n]=Zn(),[i,a]=Zn(),[s,o]=Zn(!1),u=wr((f,p)=>{o(!0),n(p),a(f)},[]),c=wr(()=>{o(!1)},[]),l=i?n4e[i]:null,d=ho(()=>({showModal:u,closeModal:c}),[c,u]);return Br(uj.Provider,{value:d,children:[e,l&&Xe(l,{...r,open:s,onClose:c})]})},a4e=(t,e)=>t.some(r=>r.id===e&&r.value),s4e=()=>{const{t}=Nu(),{showModal:e}=cj(),[r,n]=HU(),[,i]=hw(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),a4e(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Br("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[Xe("div",{className:"absolute inset-0 bg-black opacity-15"}),Xe("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:Xe(Wj,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:Xe("p",{className:"font-semibold text-gray-500",children:Xe(KA,{i18nKey:"cookieBanner.message",components:{a:Xe("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var o4e=Object.defineProperty,u4e=Object.getOwnPropertyDescriptor,ns=(t,e,r,n)=>{for(var i=u4e(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&o4e(e,r,i),i};function is(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function c4e(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Oa{constructor(e){hx(this,"server");c4e(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}ns([is],Oa.prototype,"migrateReadDrive");ns([is],Oa.prototype,"addReadDrive");ns([is],Oa.prototype,"getReadDrives");ns([is],Oa.prototype,"getReadDriveBySlug");ns([is],Oa.prototype,"getReadDrive");ns([is],Oa.prototype,"getReadDriveContext");ns([is],Oa.prototype,"fetchDrive");ns([is],Oa.prototype,"fetchDocument");ns([is],Oa.prototype,"deleteReadDrive");ns([is],Oa.prototype,"onReadDrivesUpdate");const mc=new Oa,lj=dw({...mc,readDrives:[]});async function l4e(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof Wo))}const d4e=t=>{const e=mTe(),[r,n]=Zn([]),i=oj(),[a,s]=Zn(!1);ui(()=>{e.then(c=>{mc.setDocumentDrive(c),s(!0)}).catch(wn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);ho(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=mc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(wn.error)},[o,a]),ui(()=>{if(!a)return;l4e(mc).then(l=>n(l)).catch(wn.error);const c=mc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||p0(d)!==p0(l)?l:d)}).catch(wn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(wn.error)}},[a]);const u=ho(()=>({...mc,readDrives:r}),[r]);return Xe(lj.Provider,{...t,value:u})},CDe=()=>$f(lj);/**
|
|
1123
1123
|
* @remix-run/router v1.21.0
|
|
1124
1124
|
*
|
|
1125
1125
|
* Copyright (c) Remix Software Inc.
|
|
@@ -1138,5 +1138,5 @@ enum ReactionType {
|
|
|
1138
1138
|
* LICENSE.md file in the root directory of this source tree.
|
|
1139
1139
|
*
|
|
1140
1140
|
* @license MIT
|
|
1141
|
-
*/function jf(){return jf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jf.apply(this,arguments)}const lx=ft.createContext(null),u5e=ft.createContext(null),Mg=ft.createContext(null),Og=ft.createContext(null),Lo=ft.createContext({outlet:null,matches:[],isDataRoute:!1}),xj=ft.createContext(null);function kg(){return ft.useContext(Og)!=null}function dx(){return kg()||sr(!1),ft.useContext(Og).location}function c5e(){return ft.useContext(Og).navigationType}function Ej(t){ft.useContext(Mg).static||ft.useLayoutEffect(t)}function ODe(){let{isDataRoute:t}=ft.useContext(Lo);return t?x5e():l5e()}function l5e(){kg()||sr(!1);let t=ft.useContext(lx),{basename:e,future:r,navigator:n}=ft.useContext(Mg),{matches:i}=ft.useContext(Lo),{pathname:a}=dx(),s=JSON.stringify(hj(i,r.v7_relativeSplatPath)),o=ft.useRef(!1);return Ej(()=>{o.current=!0}),ft.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=mj(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:po([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const d5e=ft.createContext(null);function f5e(t){let e=ft.useContext(Lo).outlet;return e&&ft.createElement(d5e.Provider,{value:t},e)}function kDe(){let{matches:t}=ft.useContext(Lo),e=t[t.length-1];return e?e.params:{}}function RDe(t,e,r,n){kg()||sr(!1);let{navigator:i}=ft.useContext(Mg),{matches:a}=ft.useContext(Lo),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=dx(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=no(t,{pathname:f});return y5e(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:po([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:po([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function p5e(){let t=_5e(),e=Cg(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return ft.createElement(ft.Fragment,null,ft.createElement("h2",null,"Unexpected Application Error!"),ft.createElement("h3",{style:{fontStyle:"italic"}},e),r?ft.createElement("pre",{style:i},r):null,null)}const h5e=ft.createElement(p5e,null);class m5e extends ft.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?ft.createElement(Lo.Provider,{value:this.props.routeContext},ft.createElement(xj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function g5e(t){let{routeContext:e,match:r,children:n}=t,i=ft.useContext(lx);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),ft.createElement(Lo.Provider,{value:e},n)}function y5e(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||sr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:p}=r,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let p,h=!1,m=null,y=null;r&&(p=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||h5e,u&&(c<0&&f===0?(h=!0,y=null):c===f&&(h=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),b=()=>{let _;return p?_=m:h?_=y:d.route.Component?_=ft.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=l,ft.createElement(g5e,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?ft.createElement(m5e,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:b(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):b()},null)}var Sj=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Sj||{}),m0=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(m0||{});function v5e(t){let e=ft.useContext(lx);return e||sr(!1),e}function b5e(t){let e=ft.useContext(u5e);return e||sr(!1),e}function w5e(t){let e=ft.useContext(Lo);return e||sr(!1),e}function Tj(t){let e=w5e(),r=e.matches[e.matches.length-1];return r.route.id||sr(!1),r.route.id}function _5e(){var t;let e=ft.useContext(xj),r=b5e(m0.UseRouteError),n=Tj(m0.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function x5e(){let{router:t}=v5e(Sj.UseNavigateStable),e=Tj(m0.UseNavigateStable),r=ft.useRef(!1);return Ej(()=>{r.current=!0}),ft.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,jf({fromRouteId:e},a)))},[t,e])}const zA={};function E5e(t,e){zA[e]||(zA[e]=!0,console.warn(e))}const oc=(t,e,r)=>E5e(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function FDe(t,e){t!=null&&t.v7_startTransition||oc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(t!=null&&t.v7_relativeSplatPath)&&(!e||!e.v7_relativeSplatPath)&&oc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist||oc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod||oc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration||oc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation||oc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function PDe(t){return f5e(t.context)}function S5e(t){sr(!1)}function BDe(t){let{basename:e="/",children:r=null,location:n,navigationType:i=Xr.Pop,navigator:a,static:s=!1,future:o}=t;kg()&&sr(!1);let u=e.replace(/^\/*/,"/"),c=ft.useMemo(()=>({basename:u,navigator:a,static:s,future:jf({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=Us(n));let{pathname:l="/",search:d="",hash:f="",state:p=null,key:h="default"}=n,m=ft.useMemo(()=>{let y=_p(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h},navigationType:i}},[u,l,d,f,p,h,i]);return m==null?null:ft.createElement(Mg.Provider,{value:c},ft.createElement(Og.Provider,{children:r,value:m}))}new Promise(()=>{});function lw(t,e){e===void 0&&(e=[]);let r=[];return ft.Children.forEach(t,(n,i)=>{if(!ft.isValidElement(n))return;let a=[...e,i];if(n.type===ft.Fragment){r.push.apply(r,lw(n.props.children,a));return}n.type!==S5e&&sr(!1),!n.props.index||!n.props.children||sr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=lw(n.props.children,a)),r.push(s)}),r}function T5e(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:ft.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:ft.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:ft.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function LDe(t,e){return z4e({basename:e==null?void 0:e.basename,future:jf({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:f4e({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:T5e,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function D5e(){const[t]=hw(),{analytics:e}=t;ui(()=>{const r=hr();if(!e){r&&r.close();return}if(r||!hs.sentry.dsn||hs.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[YM(),VM({depth:5}),pne(),zM({levels:["error"]})];hs.sentry.tracing&&i.push($ne({useEffect:xs.useEffect,useLocation:dx,useNavigationType:c5e,createRoutesFromChildren:lw,matchRoutes:no})),One({release:n,dsn:hs.sentry.dsn,environment:hs.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const A5e=({children:t})=>(D5e(),t);function qA(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const N5e=()=>{const[{gaTrackingId:t}]=sx(),[{analytics:e}]=hw(),r=t&&e;return ui(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],qA("js",new Date),qA("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},I5e=xs.lazy(async()=>({default:await(await Uc(()=>import("./router-i6g_L9gI.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),C5e=()=>{for(const t of Object.values(Y8e))qf(t);return null},M5e=()=>Xe(xs.StrictMode,{children:Xe(eU,{fallback:Xe(VA,{}),children:Br(DU,{store:Bf,children:[Xe(C5e,{}),Xe(Yj,{children:Xe(A5e,{children:Xe(d4e,{children:Br(Zj,{children:[Xe(Jj,{position:"bottom-right"}),Br(i4e,{children:[Xe(I5e,{}),Xe(s4e,{}),Xe(N5e,{})]})]})})})})]})})}),jDe=Object.freeze(Object.defineProperty({__proto__:null,default:M5e},Symbol.toStringTag,{value:"Module"}));export{kr as $,KTe as A,qf as B,Ig as C,lx as D,sw as E,vTe as F,nx as G,oTe as H,NDe as I,oj as J,H8e as K,ATe as L,Ou as M,DTe as N,PDe as O,HU as P,kDe as Q,BDe as R,L8e as S,KA as T,IDe as U,NTe as V,uTe as W,BTe as X,HP as Y,T3e as Z,En as _,ODe as a,f6e as a0,rt as a1,Jn as a2,bde as a3,Ff as a4,K as a5,j8e as a6,yg as a7,hie as a8,Pie as a9,G3e as aa,FB as ab,Ng as ac,Pf as ad,k3e as ae,PB as af,jB as ag,pl as ah,BB as ai,LB as aj,jDe as ak,u5e as b,RDe as c,z4e as d,MDe as e,LDe as f,j5e as g,zf as h,OTe as i,wn as j,Nu as k,FDe as l,T5e as m,ax as n,MTe as o,CDe as p,aj as q,sx as r,Ea as s,cj as t,dx as u,ix as v,W8e as w,Cn as x,aN as y,J8e as z};
|
|
1142
|
-
//# sourceMappingURL=app-
|
|
1141
|
+
*/function jf(){return jf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jf.apply(this,arguments)}const lx=ft.createContext(null),u5e=ft.createContext(null),Mg=ft.createContext(null),Og=ft.createContext(null),Lo=ft.createContext({outlet:null,matches:[],isDataRoute:!1}),xj=ft.createContext(null);function kg(){return ft.useContext(Og)!=null}function dx(){return kg()||sr(!1),ft.useContext(Og).location}function c5e(){return ft.useContext(Og).navigationType}function Ej(t){ft.useContext(Mg).static||ft.useLayoutEffect(t)}function ODe(){let{isDataRoute:t}=ft.useContext(Lo);return t?x5e():l5e()}function l5e(){kg()||sr(!1);let t=ft.useContext(lx),{basename:e,future:r,navigator:n}=ft.useContext(Mg),{matches:i}=ft.useContext(Lo),{pathname:a}=dx(),s=JSON.stringify(hj(i,r.v7_relativeSplatPath)),o=ft.useRef(!1);return Ej(()=>{o.current=!0}),ft.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=mj(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:po([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const d5e=ft.createContext(null);function f5e(t){let e=ft.useContext(Lo).outlet;return e&&ft.createElement(d5e.Provider,{value:t},e)}function kDe(){let{matches:t}=ft.useContext(Lo),e=t[t.length-1];return e?e.params:{}}function RDe(t,e,r,n){kg()||sr(!1);let{navigator:i}=ft.useContext(Mg),{matches:a}=ft.useContext(Lo),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=dx(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=no(t,{pathname:f});return y5e(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:po([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:po([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function p5e(){let t=_5e(),e=Cg(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return ft.createElement(ft.Fragment,null,ft.createElement("h2",null,"Unexpected Application Error!"),ft.createElement("h3",{style:{fontStyle:"italic"}},e),r?ft.createElement("pre",{style:i},r):null,null)}const h5e=ft.createElement(p5e,null);class m5e extends ft.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?ft.createElement(Lo.Provider,{value:this.props.routeContext},ft.createElement(xj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function g5e(t){let{routeContext:e,match:r,children:n}=t,i=ft.useContext(lx);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),ft.createElement(Lo.Provider,{value:e},n)}function y5e(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||sr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:p}=r,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let p,h=!1,m=null,y=null;r&&(p=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||h5e,u&&(c<0&&f===0?(h=!0,y=null):c===f&&(h=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),b=()=>{let _;return p?_=m:h?_=y:d.route.Component?_=ft.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=l,ft.createElement(g5e,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?ft.createElement(m5e,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:b(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):b()},null)}var Sj=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Sj||{}),m0=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(m0||{});function v5e(t){let e=ft.useContext(lx);return e||sr(!1),e}function b5e(t){let e=ft.useContext(u5e);return e||sr(!1),e}function w5e(t){let e=ft.useContext(Lo);return e||sr(!1),e}function Tj(t){let e=w5e(),r=e.matches[e.matches.length-1];return r.route.id||sr(!1),r.route.id}function _5e(){var t;let e=ft.useContext(xj),r=b5e(m0.UseRouteError),n=Tj(m0.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function x5e(){let{router:t}=v5e(Sj.UseNavigateStable),e=Tj(m0.UseNavigateStable),r=ft.useRef(!1);return Ej(()=>{r.current=!0}),ft.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,jf({fromRouteId:e},a)))},[t,e])}const zA={};function E5e(t,e){zA[e]||(zA[e]=!0,console.warn(e))}const oc=(t,e,r)=>E5e(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function FDe(t,e){t!=null&&t.v7_startTransition||oc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(t!=null&&t.v7_relativeSplatPath)&&(!e||!e.v7_relativeSplatPath)&&oc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist||oc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod||oc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration||oc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation||oc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function PDe(t){return f5e(t.context)}function S5e(t){sr(!1)}function BDe(t){let{basename:e="/",children:r=null,location:n,navigationType:i=Xr.Pop,navigator:a,static:s=!1,future:o}=t;kg()&&sr(!1);let u=e.replace(/^\/*/,"/"),c=ft.useMemo(()=>({basename:u,navigator:a,static:s,future:jf({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=Us(n));let{pathname:l="/",search:d="",hash:f="",state:p=null,key:h="default"}=n,m=ft.useMemo(()=>{let y=_p(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h},navigationType:i}},[u,l,d,f,p,h,i]);return m==null?null:ft.createElement(Mg.Provider,{value:c},ft.createElement(Og.Provider,{children:r,value:m}))}new Promise(()=>{});function lw(t,e){e===void 0&&(e=[]);let r=[];return ft.Children.forEach(t,(n,i)=>{if(!ft.isValidElement(n))return;let a=[...e,i];if(n.type===ft.Fragment){r.push.apply(r,lw(n.props.children,a));return}n.type!==S5e&&sr(!1),!n.props.index||!n.props.children||sr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=lw(n.props.children,a)),r.push(s)}),r}function T5e(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:ft.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:ft.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:ft.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function LDe(t,e){return z4e({basename:e==null?void 0:e.basename,future:jf({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:f4e({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:T5e,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function D5e(){const[t]=hw(),{analytics:e}=t;ui(()=>{const r=hr();if(!e){r&&r.close();return}if(r||!hs.sentry.dsn||hs.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[YM(),VM({depth:5}),pne(),zM({levels:["error"]})];hs.sentry.tracing&&i.push($ne({useEffect:xs.useEffect,useLocation:dx,useNavigationType:c5e,createRoutesFromChildren:lw,matchRoutes:no})),One({release:n,dsn:hs.sentry.dsn,environment:hs.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const A5e=({children:t})=>(D5e(),t);function qA(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const N5e=()=>{const[{gaTrackingId:t}]=sx(),[{analytics:e}]=hw(),r=t&&e;return ui(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],qA("js",new Date),qA("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},I5e=xs.lazy(async()=>({default:await(await Uc(()=>import("./router-Tgbf-6i0.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),C5e=()=>{for(const t of Object.values(Y8e))qf(t);return null},M5e=()=>Xe(xs.StrictMode,{children:Xe(eU,{fallback:Xe(VA,{}),children:Br(DU,{store:Bf,children:[Xe(C5e,{}),Xe(Yj,{children:Xe(A5e,{children:Xe(d4e,{children:Br(Zj,{children:[Xe(Jj,{position:"bottom-right"}),Br(i4e,{children:[Xe(I5e,{}),Xe(s4e,{}),Xe(N5e,{})]})]})})})})]})})}),jDe=Object.freeze(Object.defineProperty({__proto__:null,default:M5e},Symbol.toStringTag,{value:"Module"}));export{kr as $,KTe as A,qf as B,Ig as C,lx as D,sw as E,vTe as F,nx as G,oTe as H,NDe as I,oj as J,H8e as K,ATe as L,Ou as M,DTe as N,PDe as O,HU as P,kDe as Q,BDe as R,L8e as S,KA as T,IDe as U,NTe as V,uTe as W,BTe as X,HP as Y,T3e as Z,En as _,ODe as a,f6e as a0,rt as a1,Jn as a2,bde as a3,Ff as a4,K as a5,j8e as a6,yg as a7,hie as a8,Pie as a9,G3e as aa,FB as ab,Ng as ac,Pf as ad,k3e as ae,PB as af,jB as ag,pl as ah,BB as ai,LB as aj,jDe as ak,u5e as b,RDe as c,z4e as d,MDe as e,LDe as f,j5e as g,zf as h,OTe as i,wn as j,Nu as k,FDe as l,T5e as m,ax as n,MTe as o,CDe as p,aj as q,sx as r,Ea as s,cj as t,dx as u,ix as v,W8e as w,Cn as x,aN as y,J8e as z};
|
|
1142
|
+
//# sourceMappingURL=app-ACX0Clye.js.map
|