@powerhousedao/connect 6.0.0-dev.1 → 6.0.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/assets/{AddDriveModal-DPAIVc5B.js → AddDriveModal-B-mkPvxY.js} +1 -1
  2. package/dist/assets/{ClearStorageModal-DDCSnHBa.js → ClearStorageModal-CPyXjtE_.js} +1 -1
  3. package/dist/assets/{CookiesPolicyModal-D5koyP0a.js → CookiesPolicyModal-Cfvaovdz.js} +1 -1
  4. package/dist/assets/CreateDocumentModal-CkNEbPYe.js +1 -0
  5. package/dist/assets/{DebugSettingsModal-DWoSRmAX.js → DebugSettingsModal-D2JAQzFM.js} +1 -1
  6. package/dist/assets/{DeleteDriveModal-BeubmwBZ.js → DeleteDriveModal-OsVneUN5.js} +1 -1
  7. package/dist/assets/{DeleteItemModal-DNjWQGhA.js → DeleteItemModal-BEl_TNZV.js} +1 -1
  8. package/dist/assets/DisclaimerModal-B3L0Zayk.js +1 -0
  9. package/dist/assets/{DriveSettingsModal-CXQCQZHm.js → DriveSettingsModal-BRo4Yo-8.js} +1 -1
  10. package/dist/assets/{ExportDocumentWithErrorsModal-CqOhmcTh.js → ExportDocumentWithErrorsModal-CFUpAfjW.js} +1 -1
  11. package/dist/assets/{SettingsModal-B-Ext2a5.js → SettingsModal-Dg1z54dL.js} +1 -1
  12. package/dist/assets/UpgradeDriveModal-D30aSlcL.js +1 -0
  13. package/dist/assets/{design_system-B-LWHRUh.js → design_system-DwS7cDsv.js} +1 -1
  14. package/dist/assets/{design_system_connect-cVSO9Msn.js → design_system_connect-BjOFBMFx.js} +27 -27
  15. package/dist/assets/{design_system_ui-CcOSmEq3.js → design_system_ui-DYqAwO-0.js} +1 -1
  16. package/dist/assets/{document_drive-Cn6j768A.js → document_drive-CwpHvdiT.js} +1 -1
  17. package/dist/assets/{document_engineering-D0rEhMoj.js → document_engineering-BUO9A4rP.js} +1 -1
  18. package/dist/assets/{document_model-BZM9Doht.js → document_model-_oCbt5YE.js} +1 -1
  19. package/dist/assets/{document_model_editor-B6UOlNyW.js → document_model_editor-Dg6e70B3.js} +4 -4
  20. package/dist/assets/{drive_explorer-CqMBWXV9.js → drive_explorer-tk5qJ4Gx.js} +2 -2
  21. package/dist/assets/{graphql-editor-Bz53xwVM.js → graphql-editor-BAn8LYCr.js} +1 -1
  22. package/dist/assets/{hooks-B7GA7zmd.js → hooks-CYnjW0qo.js} +1 -1
  23. package/dist/assets/{index-BGt-bCk0.js → index-R9P0-wte.js} +6 -6
  24. package/dist/assets/{index-cGjbPuoF.js → index-kDDMsCoU.js} +2 -2
  25. package/dist/assets/{json-editor-CKRAKV7M.js → json-editor-B78F1LTP.js} +1 -1
  26. package/dist/assets/{nodefs-Dmk3giym.js → nodefs-DZVLJg6R.js} +1 -1
  27. package/dist/assets/{opfs-ahp-DQdCBulO.js → opfs-ahp-hLKxG78S.js} +1 -1
  28. package/dist/assets/{reactor_browser-w_W9gLF7.js → reactor_browser-C4oTTg7Z.js} +12 -12
  29. package/dist/assets/{state-schemas-ChDaA9MW.js → state-schemas-DSmUjut0.js} +2 -2
  30. package/dist/index.html +9 -9
  31. package/lib/package.copy.json +1 -1
  32. package/lib/src/store/document-model.d.ts.map +1 -1
  33. package/lib/src/store/document-model.js +1 -0
  34. package/lib/src/store/document-model.js.map +1 -1
  35. package/lib/src/store/reactor.d.ts.map +1 -1
  36. package/lib/src/store/reactor.js +28 -4
  37. package/lib/src/store/reactor.js.map +1 -1
  38. package/lib/src/utils/reactor.d.ts +2 -2
  39. package/lib/src/utils/reactor.d.ts.map +1 -1
  40. package/lib/src/utils/reactor.js +2 -1
  41. package/lib/src/utils/reactor.js.map +1 -1
  42. package/lib/tsconfig.tsbuildinfo +1 -1
  43. package/nginx.conf +0 -9
  44. package/package.copy.json +1 -1
  45. package/package.json +10 -10
  46. package/dist/assets/CreateDocumentModal-WDQNTedg.js +0 -1
  47. package/dist/assets/DisclaimerModal-Bl0JZtHi.js +0 -1
  48. package/dist/assets/UpgradeDriveModal-BTM20583.js +0 -1
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sentry_react-cODD7zWc.js","assets/react-DQSxOgtG.js","assets/sentry_browser-B4YoBIIG.js","assets/AddDriveModal-DPAIVc5B.js","assets/document_model_editor-B6UOlNyW.js","assets/graphql-AKTCpY7l.js","assets/drive_explorer-CqMBWXV9.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-BZM9Doht.js","assets/zod-9j67vCAu.js","assets/design_system-B-LWHRUh.js","assets/tailwind_merge-Dr4f9Rms.js","assets/react-dom-D6zQJsh6.js","assets/reactor_browser-w_W9gLF7.js","assets/document_drive-Cn6j768A.js","assets/config-CU-aFfVJ.js","assets/design_system_connect-cVSO9Msn.js","assets/design_system_ui-CcOSmEq3.js","assets/react-dom/client-BVPiT_FE.js","assets/graphql_request-BJtmW2JS.js","assets/ClearStorageModal-DDCSnHBa.js","assets/CookiesPolicyModal-D5koyP0a.js","assets/CreateDocumentModal-WDQNTedg.js","assets/DebugSettingsModal-DWoSRmAX.js","assets/DeleteDriveModal-BeubmwBZ.js","assets/DeleteItemModal-DNjWQGhA.js","assets/DisclaimerModal-Bl0JZtHi.js","assets/DriveSettingsModal-CXQCQZHm.js","assets/ExportDocumentWithErrorsModal-CqOhmcTh.js","assets/SettingsModal-B-Ext2a5.js","assets/UpgradeDriveModal-BTM20583.js","assets/index-cGjbPuoF.js"])))=>i.map(i=>d[i]);
2
- import{j as _,g as Do,E as Lo}from"./document_model_editor-B6UOlNyW.js";import{d as Ao}from"./design_system_ui-CcOSmEq3.js";import{r as m,R as To,a as Vs}from"./sentry_react-cODD7zWc.js";import{q as Po,l as te,t as Hn,B as ko,R as Io,I as jo,E as Mo,v as vr,w as Ho}from"./document_drive-Cn6j768A.js";import{_ as Se,G as Fo}from"./drive_explorer-CqMBWXV9.js";import{t as Vo,c as Bs,H as Us,A as Bo,W as Uo,d as $o,e as zo,f as Wo,g as Ko,h as Zo,i as da,F as Yo,j as $s,k as Go,B as Jo,l as qo,m as Xo,S as Qo,n as el}from"./design_system_connect-cVSO9Msn.js";import{y as zs,z as Fn,U as tl,C as rl,R as nl,A as al,B as sl,D as il,E as ol,G as ll,K as cl,P as dl,x as et,F as Ws,H as ul,k as fl,I as hl,J as pl,L as ml,M as Vn,N as gl,O as vl,Q as yl,g as _n,T as Ks,V as Zs,W as _l,X as El,Y as Cl,Z as xl,i as bl,_ as Sl,$ as Nl,a0 as Rl,a1 as wl,a2 as Ol,a3 as Dl,c as Ll,a4 as Al,a5 as Tl,a6 as Ys,a7 as Pl,a8 as Gs,a9 as kl,aa as Il,ab as jl,ac as Ml,ad as Hl,ae as Fl,af as Vl,ag as Bl,ah as Ul,ai as $l,aj as ua,ak as zl,al as Wl,am as Kl,an as Zl,ao as Yl,ap as Gl,aq as Jl,ar as ql,as as Xl,at as Ql,au as ec,av as tc,aw as rc,ax as nc,ay as ac,az as sc,aA as ic,aB as oc,s as Rr,aC as lc,aD as Rt,aE as yt,aF as cc,d as Js,aG as dc,aH as uc,aI as qs,aJ as fc,aK as fa,aL as hc,aM as pc,aN as mc}from"./reactor_browser-w_W9gLF7.js";import{I as ha,l as Xs,T as gc,c as ir}from"./design_system-B-LWHRUh.js";import{a7 as vc,a6 as yc,a8 as yr,j as Qs,h as ei,g as _c}from"./document_model-BZM9Doht.js";import{g as Ec,r as Cc}from"./graphql_request-BJtmW2JS.js";import{g as xc,r as bc}from"./react-DQSxOgtG.js";import{t as Sc}from"./tailwind_merge-Dr4f9Rms.js";import{an as Nc}from"./sentry_browser-B4YoBIIG.js";import"./graphql-AKTCpY7l.js";import"./react/jsx-runtime-DldvXD6N.js";import"./zod-9j67vCAu.js";import"./react-dom-D6zQJsh6.js";import"./react-dom/client-BVPiT_FE.js";import"./config-CU-aFfVJ.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();var se;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(se||(se={}));var pa;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pa||(pa={}));const M=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xe=t=>{switch(typeof t){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(t)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(t)?M.array:t===null?M.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?M.promise:typeof Map<"u"&&t instanceof Map?M.map:typeof Set<"u"&&t instanceof Set?M.set:typeof Date<"u"&&t instanceof Date?M.date:M.object;default:return M.unknown}},O=se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class We extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return a(this),n}static assert(e){if(!(e instanceof We))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}We.create=t=>new We(t);const En=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===M.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,se.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${se.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${se.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${se.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:se.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,se.assertNever(t)}return{message:r}};let Rc=En;function wc(){return Rc}const Oc=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function P(t,e){const r=wc(),n=Oc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===En?void 0:En].filter(a=>!!a)});t.common.issues.push(n)}class Le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return Z;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return Le.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const Z=Object.freeze({status:"aborted"}),Jt=t=>({status:"dirty",value:t}),Ie=t=>({status:"valid",value:t}),ma=t=>t.status==="aborted",ga=t=>t.status==="dirty",It=t=>t.status==="valid",wr=t=>typeof Promise<"u"&&t instanceof Promise;var F;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(F||(F={}));class lt{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const va=(t,e)=>{if(It(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new We(t.common.issues);return this._error=r,this._error}}};function X(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:l}=t;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}class re{get description(){return this._def.description}_getType(e){return Xe(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(wr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},a=this._parseSync({data:e,path:n.path,parent:n});return va(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return It(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>It(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(wr(a)?a:Promise.resolve(a));return va(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:O.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Ht({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return it.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Ar.create(this,this._def)}or(e){return Dr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new Ht({...X(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new bn({...X(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new qc({typeName:Y.ZodBranded,type:this,...X(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Sn({...X(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bn.create(this,e)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Dc=/^c[^\s-]{8,}$/i,Lc=/^[0-9a-z]+$/,Ac=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Tc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pc=/^[a-z0-9_-]{21}$/i,kc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ic=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qr;const Hc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Vc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Uc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$c=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ti="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",zc=new RegExp(`^${ti}$`);function ri(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Wc(t){return new RegExp(`^${ri(t)}$`)}function Kc(t){let e=`${ti}T${ri(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Zc(t,e){return!!((e==="v4"||!e)&&Hc.test(t)||(e==="v6"||!e)&&Vc.test(t))}function Yc(t,e){if(!kc.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Gc(t,e){return!!((e==="v4"||!e)&&Fc.test(t)||(e==="v6"||!e)&&Bc.test(t))}class tt extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){const s=this._getOrReturnCtx(e);return P(s,{code:O.invalid_type,expected:M.string,received:s.parsedType}),Z}const n=new Le;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?P(a,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&P(a,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")jc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"email",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Qr||(Qr=new RegExp(Mc,"u")),Qr.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"emoji",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Tc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"uuid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Pc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"nanoid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Dc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Lc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cuid2",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ac.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ulid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),P(a,{validation:"url",code:O.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"regex",code:O.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Kc(s).test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?zc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Wc(s).test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{code:O.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Ic.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"duration",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Zc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"ip",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Yc(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"jwt",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Gc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"cidr",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Uc.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"base64",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?$c.test(e.data)||(a=this._getOrReturnCtx(e,a),P(a,{validation:"base64url",code:O.invalid_string,message:s.message}),n.dirty()):se.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:O.invalid_string,...F.errToObj(n)})}_addCheck(e){return new tt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...F.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...F.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...F.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...F.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...F.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...F.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...F.errToObj(r)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}tt.create=t=>new tt({checks:[],typeName:Y.ZodString,coerce:t?.coerce??!1,...X(t)});function Jc(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class jt extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){const s=this._getOrReturnCtx(e);return P(s,{code:O.invalid_type,expected:M.number,received:s.parsedType}),Z}let n;const a=new Le;for(const s of this._def.checks)s.kind==="int"?se.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:O.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Jc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:O.not_finite,message:s.message}),a.dirty()):se.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,a){return new jt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(a)}]})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&se.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}jt.create=t=>new jt({checks:[],typeName:Y.ZodNumber,coerce:t?.coerce||!1,...X(t)});class Qt extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let n;const a=new Le;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):se.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return P(r,{code:O.invalid_type,expected:M.bigint,received:r.parsedType}),Z}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Qt.create=t=>new Qt({checks:[],typeName:Y.ZodBigInt,coerce:t?.coerce??!1,...X(t)});class Cn extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.boolean,received:n.parsedType}),Z}return Ie(e.data)}}Cn.create=t=>new Cn({typeName:Y.ZodBoolean,coerce:t?.coerce||!1,...X(t)});class Or extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){const s=this._getOrReturnCtx(e);return P(s,{code:O.invalid_type,expected:M.date,received:s.parsedType}),Z}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return P(s,{code:O.invalid_date}),Z}const n=new Le;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:O.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:O.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):se.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Or({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:F.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Or.create=t=>new Or({checks:[],coerce:t?.coerce||!1,typeName:Y.ZodDate,...X(t)});class ya extends re{_parse(e){if(this._getType(e)!==M.symbol){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.symbol,received:n.parsedType}),Z}return Ie(e.data)}}ya.create=t=>new ya({typeName:Y.ZodSymbol,...X(t)});class _a extends re{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.undefined,received:n.parsedType}),Z}return Ie(e.data)}}_a.create=t=>new _a({typeName:Y.ZodUndefined,...X(t)});class Ea extends re{_parse(e){if(this._getType(e)!==M.null){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.null,received:n.parsedType}),Z}return Ie(e.data)}}Ea.create=t=>new Ea({typeName:Y.ZodNull,...X(t)});class Ca extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return Ie(e.data)}}Ca.create=t=>new Ca({typeName:Y.ZodAny,...X(t)});class xa extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ie(e.data)}}xa.create=t=>new xa({typeName:Y.ZodUnknown,...X(t)});class ct extends re{_parse(e){const r=this._getOrReturnCtx(e);return P(r,{code:O.invalid_type,expected:M.never,received:r.parsedType}),Z}}ct.create=t=>new ct({typeName:Y.ZodNever,...X(t)});class ba extends re{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.void,received:n.parsedType}),Z}return Ie(e.data)}}ba.create=t=>new ba({typeName:Y.ZodVoid,...X(t)});class Ve extends re{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==M.array)return P(r,{code:O.invalid_type,expected:M.array,received:r.parsedType}),Z;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(P(r,{code:i?O.too_big:O.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(P(r,{code:O.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(P(r,{code:O.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new lt(r,i,r.path,o)))).then(i=>Le.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new lt(r,i,r.path,o)));return Le.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ve({...this._def,minLength:{value:e,message:F.toString(r)}})}max(e,r){return new Ve({...this._def,maxLength:{value:e,message:F.toString(r)}})}length(e,r){return new Ve({...this._def,exactLength:{value:e,message:F.toString(r)}})}nonempty(e){return this.min(1,e)}}Ve.create=(t,e)=>new Ve({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...X(e)});function Lt(t){if(t instanceof Ee){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=it.create(Lt(n))}return new Ee({...t._def,shape:()=>e})}else return t instanceof Ve?new Ve({...t._def,type:Lt(t.element)}):t instanceof it?it.create(Lt(t.unwrap())):t instanceof Ft?Ft.create(Lt(t.unwrap())):t instanceof Ct?Ct.create(t.items.map(e=>Lt(e))):t}class Ee extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=se.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==M.object){const c=this._getOrReturnCtx(e);return P(c,{code:O.invalid_type,expected:M.object,received:c.parsedType}),Z}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ct&&this._def.unknownKeys==="strip"))for(const c in a.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const d=s[c],u=a.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new lt(a,u,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof ct){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:a.data[d]}});else if(c==="strict")o.length>0&&(P(a,{code:O.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const u=a.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new lt(a,u,a.path,d)),alwaysSet:d in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const u=await d.key,f=await d.value;c.push({key:u,value:f,alwaysSet:d.alwaysSet})}return c}).then(c=>Le.mergeObjectSync(n,c)):Le.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new Ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:F.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Ee({...this._def,unknownKeys:"strip"})}passthrough(){return new Ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ee({...this._def,catchall:e})}pick(e){const r={};for(const n of se.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ee({...this._def,shape:()=>r})}omit(e){const r={};for(const n of se.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Ee({...this._def,shape:()=>r})}deepPartial(){return Lt(this)}partial(e){const r={};for(const n of se.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new Ee({...this._def,shape:()=>r})}required(e){const r={};for(const n of se.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof it;)s=s._def.innerType;r[n]=s}return new Ee({...this._def,shape:()=>r})}keyof(){return ni(se.objectKeys(this.shape))}}Ee.create=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strip",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});Ee.strictCreate=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strict",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});Ee.lazycreate=(t,e)=>new Ee({shape:t,unknownKeys:"strip",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});class Dr extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new We(o.ctx.common.issues));return P(r,{code:O.invalid_union,unionErrors:i}),Z}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const l of n){const c={...r,common:{...r.common,issues:[]},parent:null},d=l._parseSync({data:r.data,path:r.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(l=>new We(l));return P(r,{code:O.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}}Dr.create=(t,e)=>new Dr({options:t,typeName:Y.ZodUnion,...X(e)});function xn(t,e){const r=Xe(t),n=Xe(e);if(t===e)return{valid:!0,data:t};if(r===M.object&&n===M.object){const a=se.objectKeys(e),s=se.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const l=xn(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(r===M.array&&n===M.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],l=xn(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===M.date&&n===M.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Lr extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(ma(s)||ma(i))return Z;const o=xn(s.value,i.value);return o.valid?((ga(s)||ga(i))&&r.dirty(),{status:r.value,value:o.data}):(P(n,{code:O.invalid_intersection_types}),Z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Lr.create=(t,e,r)=>new Lr({left:t,right:e,typeName:Y.ZodIntersection,...X(r)});class Ct extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return P(n,{code:O.invalid_type,expected:M.array,received:n.parsedType}),Z;if(n.data.length<this._def.items.length)return P(n,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new lt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Le.mergeArray(r,i)):Le.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Ct({...this._def,rest:e})}}Ct.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ct({items:t,typeName:Y.ZodTuple,rest:null,...X(e)})};class Sa extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.map)return P(n,{code:O.invalid_type,expected:M.map,received:n.parsedType}),Z;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,l],c)=>({key:a._parse(new lt(n,o,n.path,[c,"key"])),value:s._parse(new lt(n,l,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Z;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Z;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}}}}Sa.create=(t,e,r)=>new Sa({valueType:e,keyType:t,typeName:Y.ZodMap,...X(r)});class er extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return P(n,{code:O.invalid_type,expected:M.set,received:n.parsedType}),Z;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(P(n,{code:O.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(P(n,{code:O.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const d of l){if(d.status==="aborted")return Z;d.status==="dirty"&&r.dirty(),c.add(d.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((l,c)=>s._parse(new lt(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,r){return new er({...this._def,minSize:{value:e,message:F.toString(r)}})}max(e,r){return new er({...this._def,maxSize:{value:e,message:F.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}er.create=(t,e)=>new er({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...X(e)});class Na extends re{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Na.create=(t,e)=>new Na({getter:t,typeName:Y.ZodLazy,...X(e)});class Ra extends re{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ra.create=(t,e)=>new Ra({value:t,typeName:Y.ZodLiteral,...X(e)});function ni(t,e){return new Mt({values:t,typeName:Y.ZodEnum,...X(e)})}class Mt extends re{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:se.joinValues(n),received:r.parsedType,code:O.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:O.invalid_enum_value,options:n}),Z}return Ie(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Mt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Mt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Mt.create=ni;class wa extends re{_parse(e){const r=se.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==M.string&&n.parsedType!==M.number){const a=se.objectValues(r);return P(n,{expected:se.joinValues(a),received:n.parsedType,code:O.invalid_type}),Z}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=se.objectValues(r);return P(n,{received:n.data,code:O.invalid_enum_value,options:a}),Z}return Ie(e.data)}get enum(){return this._def.values}}wa.create=(t,e)=>new wa({values:t,typeName:Y.ZodNativeEnum,...X(e)});class Ar extends re{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.promise&&r.common.async===!1)return P(r,{code:O.invalid_type,expected:M.promise,received:r.parsedType}),Z;const n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return Ie(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ar.create=(t,e)=>new Ar({type:t,typeName:Y.ZodPromise,...X(e)});class Ht extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{P(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return Z;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?Z:l.status==="dirty"||r.value==="dirty"?Jt(l.value):l});{if(r.value==="aborted")return Z;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?Z:o.status==="dirty"||r.value==="dirty"?Jt(o.value):o}}if(a.type==="refinement"){const i=o=>{const l=a.refinement(o,s);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Z:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?Z:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!It(i))return Z;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>It(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):Z);se.assertNever(a)}}Ht.create=(t,e,r)=>new Ht({schema:t,typeName:Y.ZodEffects,effect:e,...X(r)});Ht.createWithPreprocess=(t,e,r)=>new Ht({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...X(r)});class it extends re{_parse(e){return this._getType(e)===M.undefined?Ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}it.create=(t,e)=>new it({innerType:t,typeName:Y.ZodOptional,...X(e)});class Ft extends re{_parse(e){return this._getType(e)===M.null?Ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ft.create=(t,e)=>new Ft({innerType:t,typeName:Y.ZodNullable,...X(e)});class bn extends re{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}bn.create=(t,e)=>new bn({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...X(e)});class Sn extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Sn.create=(t,e)=>new Sn({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...X(e)});class Oa extends re{_parse(e){if(this._getType(e)!==M.nan){const n=this._getOrReturnCtx(e);return P(n,{code:O.invalid_type,expected:M.nan,received:n.parsedType}),Z}return{status:"valid",value:e.data}}}Oa.create=t=>new Oa({typeName:Y.ZodNaN,...X(t)});class qc extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Bn extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Z:s.status==="dirty"?(r.dirty(),Jt(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Z:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Bn({in:e,out:r,typeName:Y.ZodPipeline})}}class Nn extends re{_parse(e){const r=this._def.innerType._parse(e),n=a=>(It(a)&&(a.value=Object.freeze(a.value)),a);return wr(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Nn.create=(t,e)=>new Nn({innerType:t,typeName:Y.ZodReadonly,...X(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const me=tt.create,Xc=jt.create,Qc=Cn.create;ct.create;Ve.create;const Ke=Ee.create,ai=Dr.create;Lr.create;Ct.create;const si=Mt.create;Ar.create;it.create;Ft.create;const ce=ai([Qc(),si(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),Tr=ai([Xc(),me()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),ed=Ke({PH_CONFIG_PATH:me().optional(),PH_PACKAGES:me().optional(),PH_LOCAL_PACKAGE:me().optional(),PH_DISABLE_LOCAL_PACKAGE:ce.default(!1),PH_WATCH_TIMEOUT:Tr.default(300),PH_SENTRY_AUTH_TOKEN:me().optional(),PH_SENTRY_ORG:me().optional(),PH_SENTRY_PROJECT:me().optional()}),td=Ke({PH_CONNECT_VERSION:me().default("unknown"),PH_CONNECT_LOG_LEVEL:si(["debug","info","warn","error"]).default("info"),PH_CONNECT_REQUIRES_HARD_REFRESH:ce.default(!0),PH_CONNECT_WARN_OUTDATED_APP:ce.default(!1),PH_CONNECT_STUDIO_MODE:ce.default(!1),PH_CONNECT_BASE_PATH:me().optional(),PH_CONNECT_DEFAULT_DRIVES_URL:me().optional(),PH_CONNECT_DRIVES_PRESERVE_STRATEGY:me().optional(),PH_CONNECT_VERSION_CHECK_INTERVAL:Tr.default(3600*1e3),PH_CONNECT_CLI_VERSION:me().optional(),PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:Tr.default(50)}),rd=Ke({PH_CONNECT_DISABLE_ADD_DRIVE:ce.default(!1),PH_CONNECT_SEARCH_BAR_ENABLED:ce.default(!1),PH_CONNECT_INSPECTOR_ENABLED:ce.default(!1),PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:ce.default(!0),PH_CONNECT_ENABLED_EDITORS:me().optional(),PH_CONNECT_DISABLED_EDITORS:me().default("powerhouse/document-drive"),PH_CONNECT_GA_TRACKING_ID:me().optional(),PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:ce.default(!1)}),nd=Ke({PH_CONNECT_PUBLIC_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:ce.default(!1),PH_CONNECT_CLOUD_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:ce.default(!1),PH_CONNECT_LOCAL_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:ce.default(!1)}),ad=Ke({PH_CONNECT_ANALYTICS_ENABLED:ce.default(!0),PH_CONNECT_ANALYTICS_DATABASE_NAME:me().optional(),PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:ce.default(!0),PH_CONNECT_DIFF_ANALYTICS_ENABLED:ce.default(!1),PH_CONNECT_DRIVE_ANALYTICS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:ce.default(!0)}),sd=Ke({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0)}),id=Ke({PH_CONNECT_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ce.default(!0)}),od=id.merge(ad).merge(sd),ld=Ke({PH_CONNECT_SENTRY_RELEASE:me().optional(),PH_CONNECT_SENTRY_DSN:me().optional(),PH_CONNECT_SENTRY_ENV:me().default("dev"),PH_CONNECT_SENTRY_TRACING_ENABLED:ce.default(!1)}),cd=Ke({PH_CONNECT_RENOWN_URL:me().default("https://www.renown.id"),PH_CONNECT_RENOWN_NETWORK_ID:me().default("eip155"),PH_CONNECT_RENOWN_CHAIN_ID:Tr.default(1)}),Cr=td.merge(rd).merge(nd).merge(od).merge(ld).merge(cd);ed.merge(Cr);function dd(t,e,r){const{processEnv:n={},optionsEnv:a={},fileEnv:s={}}=t,i={};for(const o of e){const l=[{name:"process.env",value:n[o]},{name:"options",value:a[o]},{name:"fileEnv",value:s[o]}];for(const c of l){const d=c.value;if(!(d===void 0||d===""))try{const u=r.shape[o];if(u){u.parse(d),i[o]=d;break}console.warn(`Unknown environment variable: '${o}'`),i[o]=d;break}catch{const u=d===null?"null":typeof d=="object"?JSON.stringify(d):d;console.warn(`Invalid value for ${o} from ${c.name}: ${u}. Trying next source.`)}}}return i}function ud(t={}){const e=new Set(Object.keys(Cr.shape)),r=dd(t,e,Cr);return Cr.parse(r)}function fd(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const hd={BASE_URL:"/",DEV:!1,MODE:"production",PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:"true",PH_CONNECT_ANALYTICS_ENABLED:"true",PH_CONNECT_CLOUD_DRIVES_ENABLED:"true",PH_CONNECT_DIFF_ANALYTICS_ENABLED:"false",PH_CONNECT_DISABLED_EDITORS:"powerhouse/document-drive",PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_ADD_DRIVE:"false",PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:"false",PH_CONNECT_DRIVE_ANALYTICS_ENABLED:"true",PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:"false",PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:"50",PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:"true",PH_CONNECT_INSPECTOR_ENABLED:"false",PH_CONNECT_LOCAL_DRIVES_ENABLED:"true",PH_CONNECT_LOG_LEVEL:"info",PH_CONNECT_PROCESSORS_ENABLED:"true",PH_CONNECT_PUBLIC_DRIVES_ENABLED:"true",PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_RENOWN_CHAIN_ID:"1",PH_CONNECT_RENOWN_NETWORK_ID:"eip155",PH_CONNECT_RENOWN_URL:"https://auth.renown.id",PH_CONNECT_REQUIRES_HARD_REFRESH:"true",PH_CONNECT_SEARCH_BAR_ENABLED:"false",PH_CONNECT_SENTRY_ENV:"prod",PH_CONNECT_SENTRY_TRACING_ENABLED:"false",PH_CONNECT_STUDIO_MODE:"false",PH_CONNECT_VERSION:"5.2.0-dev.1",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},L=ud({processEnv:hd});function pd(t){return t.endsWith("/")?t:t+"/"}function md(){const t=L.PH_CONNECT_BASE_PATH||"/",e=pd(t);return{basePath:t,routerBasename:e,allowList:void 0,allowedDocumentTypes:[],isDragAndDropEnabled:!0,isEditorDebugModeEnabled:!1,isEditorReadModeEnabled:!1,isExternalControlsEnabled:!1,version:L.PH_CONNECT_VERSION,logLevel:L.PH_CONNECT_LOG_LEVEL,requiresHardRefresh:L.PH_CONNECT_REQUIRES_HARD_REFRESH,warnOutdatedApp:L.PH_CONNECT_WARN_OUTDATED_APP,studioMode:L.PH_CONNECT_STUDIO_MODE,versionCheckInterval:L.PH_CONNECT_VERSION_CHECK_INTERVAL,cliVersion:L.PH_CONNECT_CLI_VERSION,fileUploadOperationsChunkSize:L.PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE,gaTrackingId:L.PH_CONNECT_GA_TRACKING_ID,defaultDrivesUrl:L.PH_CONNECT_DEFAULT_DRIVES_URL,drivesPreserveStrategy:L.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,enabledEditors:L.PH_CONNECT_ENABLED_EDITORS?.split(","),disabledEditors:L.PH_CONNECT_DISABLED_EDITORS.split(","),isExternalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED,isAnalyticsEnabled:L.PH_CONNECT_ANALYTICS_ENABLED,isAnalyticsExternalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&L.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,analyticsDatabaseName:L.PH_CONNECT_ANALYTICS_DATABASE_NAME,isRelationalProcessorsEnabled:L.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,isExternalRelationalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&L.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED,renownUrl:L.PH_CONNECT_RENOWN_URL,renownNetworkId:L.PH_CONNECT_RENOWN_NETWORK_ID,renownChainId:L.PH_CONNECT_RENOWN_CHAIN_ID,sentryRelease:L.PH_CONNECT_SENTRY_RELEASE,sentryDsn:L.PH_CONNECT_SENTRY_DSN,sentryEnv:L.PH_CONNECT_SENTRY_ENV,isDiffAnalyticsEnabled:L.PH_CONNECT_DIFF_ANALYTICS_ENABLED,isDriveAnalyticsEnabled:L.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,isPublicDrivesEnabled:L.PH_CONNECT_PUBLIC_DRIVES_ENABLED,isCloudDrivesEnabled:L.PH_CONNECT_CLOUD_DRIVES_ENABLED,isLocalDrivesEnabled:L.PH_CONNECT_LOCAL_DRIVES_ENABLED,isSentryTracingEnabled:L.PH_CONNECT_SENTRY_TRACING_ENABLED,isDocumentModelSelectionSettingsEnabled:!L.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,isAddDriveEnabled:!L.PH_CONNECT_DISABLE_ADD_DRIVE,isAddPublicDrivesEnabled:!L.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,isDeletePublicDrivesEnabled:!L.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES,isAddCloudDrivesEnabled:!L.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,isDeleteCloudDrivesEnabled:!L.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES,isAddLocalDrivesEnabled:!L.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,isDeleteLocalDrivesEnabled:!L.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES,isAnalyticsDatabaseWorkerEnabled:!L.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,isExternalPackagesEnabled:!L.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED}}const kt=md(),gd={isExternalControlsEnabled:kt.isExternalControlsEnabled},vd={allowedDocumentTypes:kt.allowedDocumentTypes,isDragAndDropEnabled:kt.isDragAndDropEnabled};Po(L.PH_CONNECT_LOG_LEVEL);te.debug(`Setting log level to ${L.PH_CONNECT_LOG_LEVEL}.`);const ii=fd(L.PH_CONNECT_BASE_PATH||"/"),yd=L.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${ii.replace(/\//g,"")}:analytics`,ge={appVersion:L.PH_CONNECT_VERSION,studioMode:L.PH_CONNECT_STUDIO_MODE,warnOutdatedApp:L.PH_CONNECT_WARN_OUTDATED_APP,appVersionCheckInterval:L.PH_CONNECT_VERSION_CHECK_INTERVAL,routerBasename:ii,externalPackagesEnabled:!L.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED,processors:{enabled:L.PH_CONNECT_PROCESSORS_ENABLED,externalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},analytics:{enabled:L.PH_CONNECT_ANALYTICS_ENABLED,databaseName:yd,useWorker:!L.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,driveAnalyticsEnabled:L.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,diffProcessorEnabled:L.PH_CONNECT_DIFF_ANALYTICS_ENABLED,externalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},relational:{enabled:L.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,externalProcessorsEnabled:L.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED},renown:{url:L.PH_CONNECT_RENOWN_URL,networkId:L.PH_CONNECT_RENOWN_NETWORK_ID,chainId:L.PH_CONNECT_RENOWN_CHAIN_ID},sentry:{release:L.PH_CONNECT_SENTRY_RELEASE,dsn:L.PH_CONNECT_SENTRY_DSN,env:L.PH_CONNECT_SENTRY_ENV,tracing:L.PH_CONNECT_SENTRY_TRACING_ENABLED},content:{showSearchBar:L.PH_CONNECT_SEARCH_BAR_ENABLED,showDocumentModelSelectionSetting:!L.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,inspectorEnabled:L.PH_CONNECT_INSPECTOR_ENABLED},drives:{addDriveEnabled:!L.PH_CONNECT_DISABLE_ADD_DRIVE,preserveStrategy:L.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,sections:{LOCAL:{enabled:L.PH_CONNECT_LOCAL_DRIVES_ENABLED,allowAdd:!L.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,allowDelete:!L.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES},CLOUD:{enabled:L.PH_CONNECT_CLOUD_DRIVES_ENABLED,allowAdd:!L.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,allowDelete:!L.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES},PUBLIC:{enabled:L.PH_CONNECT_PUBLIC_DRIVES_ENABLED,allowAdd:!L.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,allowDelete:!L.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES}}},gaTrackingId:L.PH_CONNECT_GA_TRACKING_ID,phCliVersion:L.PH_CONNECT_CLI_VERSION},_d=ge.routerBasename,oi=`${_d}:acceptedCookies`,Rn=new Set;let xr=Ed();function Ed(){try{const t=localStorage.getItem(oi);return t?JSON.parse(t):{analytics:!1,marketing:!1,functional:!1}}catch{return{analytics:!1,marketing:!1,functional:!1}}}function Da(){return xr}function Cd(t){xr=t(xr),localStorage.setItem(oi,JSON.stringify(xr)),Rn.forEach(e=>e())}function xd(t){return Rn.add(t),()=>Rn.delete(t)}const Un=()=>[m.useSyncExternalStore(xd,Da,Da),Cd];async function $n(){try{return(await Se(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Tg(t){const e=await $n();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-added",n))}e.on("studio:external-package-added",n),e.send("studio:add-external-package",{name:t})})}async function Pg(t){const e=await $n();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-removed",n))}e.on("studio:external-package-removed",n),e.send("studio:remove-external-package",{name:t})})}function bd(){const t=m.useRef(void 0);m.useEffect(()=>{const e=async n=>{const a=window.ph?.vetraPackages||[],l=(await Se(()=>import(`${n.url}?t=${n.timestamp}`),[])).default.map(zs),d=[...a.filter(u=>u.id==="powerhouse/common"),...l];Fn(d)};async function r(){const n=await $n();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(te.error),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Sd="connect";function or(t,e){const{type:r="default",containerId:n=Sd,...a}=e||{};return Vo(t,{type:r,containerId:n,...a})}const K=t=>typeof t=="string",Wt=()=>{let t,e;const r=new Promise((n,a)=>{t=n,e=a});return r.resolve=t,r.reject=e,r},La=t=>t==null?"":""+t,Nd=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Rd=/###/g,Aa=t=>t&&t.indexOf("###")>-1?t.replace(Rd,"."):t,Ta=t=>!t||K(t),Xt=(t,e,r)=>{const n=K(e)?e.split("."):e;let a=0;for(;a<n.length-1;){if(Ta(t))return{};const s=Aa(n[a]);!t[s]&&r&&(t[s]=new r),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++a}return Ta(t)?{}:{obj:t,k:Aa(n[a])}},Pa=(t,e,r)=>{const{obj:n,k:a}=Xt(t,e,Object);if(n!==void 0||e.length===1){n[a]=r;return}let s=e[e.length-1],i=e.slice(0,e.length-1),o=Xt(t,i,Object);for(;o.obj===void 0&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),o=Xt(t,i,Object),o?.obj&&typeof o.obj[`${o.k}.${s}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${s}`]=r},wd=(t,e,r,n)=>{const{obj:a,k:s}=Xt(t,e,Object);a[s]=a[s]||[],a[s].push(r)},Pr=(t,e)=>{const{obj:r,k:n}=Xt(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Od=(t,e,r)=>{const n=Pr(t,r);return n!==void 0?n:Pr(e,r)},li=(t,e,r)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?K(t[n])||t[n]instanceof String||K(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):li(t[n],e[n],r):t[n]=e[n]);return t},wt=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Dd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ld=t=>K(t)?t.replace(/[&<>"'\/]/g,e=>Dd[e]):t;class Ad{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const Td=[" ",",","?","!",";"],Pd=new Ad(20),kd=(t,e,r)=>{e=e||"",r=r||"";const n=Td.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const a=Pd.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let s=!a.test(t);if(!s){const i=t.indexOf(r);i>0&&!a.test(t.substring(0,i))&&(s=!0)}return s},wn=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(r);let a=t;for(let s=0;s<n.length;){if(!a||typeof a!="object")return;let i,o="";for(let l=s;l<n.length;++l)if(l!==s&&(o+=r),o+=n[l],i=a[o],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<n.length-1)continue;s+=l-s+1;break}a=i}return a},tr=t=>t?.replace("_","-"),Id={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class kr{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||Id,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,a){return a&&!this.debug?null:(K(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new kr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new kr(this.logger,e)}}var Fe=new kr;class Br{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const a=this.observers[n].get(r)||0;this.observers[n].set(r,a+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a.apply(a,[e,...r])})}}class ka extends Br{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,a={}){const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,r],n&&(Array.isArray(n)?o.push(...n):K(n)&&s?o.push(...n.split(s)):o.push(n)));const l=Pr(this.data,o);return!l&&!r&&!n&&e.indexOf(".")>-1&&(e=o[0],r=o[1],n=o.slice(2).join(".")),l||!i||!K(n)?l:wn(this.data?.[e]?.[r],n,s)}addResource(e,r,n,a,s={silent:!1}){const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let o=[e,r];n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."),a=r,r=o[1]),this.addNamespaces(r),Pa(this.data,o,a),s.silent||this.emit("added",e,r,n,a)}addResources(e,r,n,a={silent:!1}){for(const s in n)(K(n[s])||Array.isArray(n[s]))&&this.addResource(e,r,s,n[s],{silent:!0});a.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,a,s,i={silent:!1,skipCopy:!1}){let o=[e,r];e.indexOf(".")>-1&&(o=e.split("."),a=n,n=r,r=o[1]),this.addNamespaces(r);let l=Pr(this.data,o)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),a?li(l,n,s):l={...l,...n},Pa(this.data,o,l),i.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(a=>r[a]&&Object.keys(r[a]).length>0)}toJSON(){return this.data}}var ci={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,a){return t.forEach(s=>{e=this.processors[s]?.process(e,r,n,a)??e}),e}};const di=Symbol("i18next/PATH_KEY");function jd(){const t=[],e=Object.create(null);let r;return e.get=(n,a)=>(r?.revoke?.(),a===di?t:(t.push(a),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function Ir(t,e){const{[di]:r}=t(jd());return r.join(e?.keySeparator??".")}const Ia={},en=t=>!K(t)&&typeof t!="boolean"&&typeof t!="number";class jr extends Br{constructor(e,r={}){super(),Nd(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Fe.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){const n={...r};if(e==null)return!1;const a=this.resolve(e,n);if(a?.res===void 0)return!1;const s=en(a.res);return!(n.returnObjects===!1&&s)}extractFromKey(e,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let s=r.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!kd(e,n,a);if(i&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:K(s)?[s]:s};const c=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(a)}return{key:e,namespaces:K(s)?[s]:s}}translate(e,r,n){let a=typeof r=="object"?{...r}:r;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=Ir(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]);const s=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],a),c=l[l.length-1];let d=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const u=a.lng||this.language,f=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u?.toLowerCase()==="cimode")return f?s?{res:`${c}${d}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:`${c}${d}${o}`:s?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:o;const h=this.resolve(e,a);let g=h?.res;const E=h?.usedKey||o,b=h?.exactUsedKey||o,C=["[object Number]","[object Function]","[object RegExp]"],S=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,N=a.count!==void 0&&!K(a.count),D=jr.hasDefaultValue(a),T=N?this.pluralResolver.getSuffix(u,a.count,a):"",y=a.ordinal&&N?this.pluralResolver.getSuffix(u,a.count,{ordinal:!1}):"",w=N&&!a.ordinal&&a.count===0,U=w&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${T}`]||a[`defaultValue${y}`]||a.defaultValue;let V=g;k&&!g&&D&&(V=U);const G=en(V),z=Object.prototype.toString.apply(V);if(k&&V&&G&&C.indexOf(z)<0&&!(K(S)&&Array.isArray(V))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ee=this.options.returnedObjectHandler?this.options.returnedObjectHandler(E,V,{...a,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(h.res=ee,h.usedParams=this.getUsedParamsDetails(a),h):ee}if(i){const ee=Array.isArray(V),ne=ee?[]:{},Re=ee?b:E;for(const Ce in V)if(Object.prototype.hasOwnProperty.call(V,Ce)){const oe=`${Re}${i}${Ce}`;D&&!g?ne[Ce]=this.translate(oe,{...a,defaultValue:en(U)?U[Ce]:void 0,joinArrays:!1,ns:l}):ne[Ce]=this.translate(oe,{...a,joinArrays:!1,ns:l}),ne[Ce]===oe&&(ne[Ce]=V[Ce])}g=ne}}else if(k&&K(S)&&Array.isArray(g))g=g.join(S),g&&(g=this.extendTranslation(g,e,a,n));else{let ee=!1,ne=!1;!this.isValidLookup(g)&&D&&(ee=!0,g=U),this.isValidLookup(g)||(ne=!0,g=o);const Ce=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ne?void 0:g,oe=D&&U!==g&&this.options.updateMissing;if(ne||ee||oe){if(this.logger.log(oe?"updateKey":"missingKey",u,c,o,oe?U:g),i){const ve=this.resolve(o,{...a,keySeparator:!1});ve&&ve.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ue=[];const Be=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Be&&Be[0])for(let ve=0;ve<Be.length;ve++)ue.push(Be[ve]);else this.options.saveMissingTo==="all"?ue=this.languageUtils.toResolveHierarchy(a.lng||this.language):ue.push(a.lng||this.language);const Ze=(ve,xe,Ae)=>{const Ye=D&&Ae!==g?Ae:Ce;this.options.missingKeyHandler?this.options.missingKeyHandler(ve,c,xe,Ye,oe,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ve,c,xe,Ye,oe,a),this.emit("missingKey",ve,c,xe,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?ue.forEach(ve=>{const xe=this.pluralResolver.getSuffixes(ve,a);w&&a[`defaultValue${this.options.pluralSeparator}zero`]&&xe.indexOf(`${this.options.pluralSeparator}zero`)<0&&xe.push(`${this.options.pluralSeparator}zero`),xe.forEach(Ae=>{Ze([ve],o+Ae,a[`defaultValue${Ae}`]||U)})}):Ze(ue,o,U))}g=this.extendTranslation(g,e,a,h,n),ne&&g===o&&this.options.appendNamespaceToMissingKey&&(g=`${c}${d}${o}`),(ne||ee)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${d}${o}`:o,ee?g:void 0,a))}return s?(h.res=g,h.usedParams=this.getUsedParamsDetails(a),h):g}extendTranslation(e,r,n,a,s){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=K(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const u=e.match(this.interpolator.nestingRegexp);c=u&&u.length}let d=n.replace&&!K(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,n.lng||this.language||a.usedLng,n),l){const u=e.match(this.interpolator.nestingRegexp),f=u&&u.length;c<f&&(n.nest=!1)}!n.lng&&a&&a.res&&(n.lng=this.language||a.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...u)=>s?.[0]===u[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${u[0]} in key: ${r[0]}`),null):this.translate(...u,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,o=K(i)?[i]:i;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=ci.handle(o,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,a,s,i,o;return K(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(l,r),d=c.key;a=d;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const f=r.count!==void 0&&!K(r.count),h=f&&!r.ordinal&&r.count===0,g=r.context!==void 0&&(K(r.context)||typeof r.context=="number")&&r.context!=="",E=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);u.forEach(b=>{this.isValidLookup(n)||(o=b,!Ia[`${E[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(Ia[`${E[0]}-${b}`]=!0,this.logger.warn(`key "${a}" for languages "${E.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),E.forEach(C=>{if(this.isValidLookup(n))return;i=C;const S=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(S,d,C,b,r);else{let N;f&&(N=this.pluralResolver.getSuffix(C,r.count,r));const D=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&N.indexOf(T)===0&&S.push(d+N.replace(T,this.options.pluralSeparator)),S.push(d+N),h&&S.push(d+D)),g){const y=`${d}${this.options.contextSeparator||"_"}${r.context}`;S.push(y),f&&(r.ordinal&&N.indexOf(T)===0&&S.push(y+N.replace(T,this.options.pluralSeparator)),S.push(y+N),h&&S.push(y+D))}}let k;for(;k=S.pop();)this.isValidLookup(n)||(s=k,n=this.getResource(C,b,k,r))}))})}),{res:n,usedKey:a,exactUsedKey:s,usedLng:i,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,a):this.resourceStore.getResource(e,r,n,a)}getUsedParamsDetails(e={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!K(e.replace);let a=n?e.replace:e;if(n&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!n){a={...a};for(const s of r)delete a[s]}return a}static hasDefaultValue(e){const r="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}}class ja{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Fe.create("languageUtils")}getScriptPartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(K(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;const a=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(a))&&(r=a)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;const a=this.getScriptPartFromCode(n);if(this.isSupportedCode(a))return r=a;const s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return r=s;r=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),K(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),a=[],s=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return K(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):K(e)&&s(this.formatLanguageCode(e)),n.forEach(i=>{a.indexOf(i)<0&&s(this.formatLanguageCode(i))}),a}}const Ma={zero:0,one:1,two:2,few:3,many:4,other:5},Ha={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Md{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Fe.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){const n=tr(e==="dev"?"en":e),a=r.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:n,type:a});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let i;try{i=new Intl.PluralRules(n,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Ha;if(!e.match(/-|_/))return Ha;const l=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(l,r)}return this.pluralRulesCache[s]=i,i}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(a=>`${r}${a}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((a,s)=>Ma[a]-Ma[s]).map(a=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,r,n={}){const a=this.getRule(e,n);return a?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}}const Fa=(t,e,r,n=".",a=!0)=>{let s=Od(t,e,r);return!s&&a&&K(r)&&(s=wn(t,r,n),s===void 0&&(s=wn(e,r,n))),s},tn=t=>t.replace(/\$/g,"$$$$");class Hd{constructor(e={}){this.logger=Fe.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:a,prefix:s,prefixEscaped:i,suffix:o,suffixEscaped:l,formatSeparator:c,unescapeSuffix:d,unescapePrefix:u,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:E,nestingOptionsSeparator:b,maxReplaces:C,alwaysFormat:S}=e.interpolation;this.escape=r!==void 0?r:Ld,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?wt(s):i||"{{",this.suffix=o?wt(o):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=d?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=f?wt(f):h||wt("$t("),this.nestingSuffix=g?wt(g):E||wt(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=C||1e3,this.alwaysFormat=S!==void 0?S:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,a){let s,i,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const C=Fa(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,n,{...a,...r,interpolationkey:h}):C}const g=h.split(this.formatSeparator),E=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(Fa(r,l,E,this.options.keySeparator,this.options.ignoreJSONStructure),b,n,{...a,...r,interpolationkey:E})};this.resetRegExp();const d=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>tn(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?tn(this.escape(h)):tn(h)}].forEach(h=>{for(o=0;s=h.regex.exec(e);){const g=s[1].trim();if(i=c(g),i===void 0)if(typeof d=="function"){const b=d(e,s,a);i=K(b)?b:""}else if(a&&Object.prototype.hasOwnProperty.call(a,g))i="";else if(u){i=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),i="";else!K(i)&&!this.useRawValueToEscape&&(i=La(i));const E=h.safeValue(i);if(e=e.replace(s[0],E),u?(h.regex.lastIndex+=i.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,r,n={}){let a,s,i;const o=(l,c)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const u=l.split(new RegExp(`${d}[ ]*{`));let f=`{${u[1]}`;l=u[0],f=this.interpolate(f,i);const h=f.match(/'/g),g=f.match(/"/g);((h?.length??0)%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{i=JSON.parse(f),c&&(i={...c,...i})}catch(E){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,E),`${l}${d}${f}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;a=this.nestingRegexp.exec(e);){let l=[];i={...n},i=i.replace&&!K(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(c!==-1&&(l=a[1].slice(c).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),a[1]=a[1].slice(0,c)),s=r(o.call(this,a[1].trim(),i),i),s&&a[0]===e&&!K(s))return s;K(s)||(s=La(s)),s||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),s=""),l.length&&(s=l.reduce((d,u)=>this.format(d,u,n.lng,{...n,interpolationkey:a[1].trim()}),s.trim())),e=e.replace(a[0],s),this.regexp.lastIndex=0}return e}}const Fd=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const a=n[1].substring(0,n[1].length-1);e==="currency"&&a.indexOf(":")<0?r.currency||(r.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?r.range||(r.range=a.trim()):a.split(";").forEach(i=>{if(i){const[o,...l]=i.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),d=o.trim();r[d]||(r[d]=c),c==="false"&&(r[d]=!1),c==="true"&&(r[d]=!0),isNaN(c)||(r[d]=parseInt(c,10))}})}return{formatName:e,formatOptions:r}},Va=t=>{const e={};return(r,n,a)=>{let s=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(s={...s,[a.interpolationkey]:void 0});const i=n+JSON.stringify(s);let o=e[i];return o||(o=t(tr(n),a),e[i]=o),o(r)}},Vd=t=>(e,r,n)=>t(tr(r),n)(e);class Bd{constructor(e={}){this.logger=Fe.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?Va:Vd;this.formats={number:n((a,s)=>{const i=new Intl.NumberFormat(a,{...s});return o=>i.format(o)}),currency:n((a,s)=>{const i=new Intl.NumberFormat(a,{...s,style:"currency"});return o=>i.format(o)}),datetime:n((a,s)=>{const i=new Intl.DateTimeFormat(a,{...s});return o=>i.format(o)}),relativetime:n((a,s)=>{const i=new Intl.RelativeTimeFormat(a,{...s});return o=>i.format(o,s.range||"day")}),list:n((a,s)=>{const i=new Intl.ListFormat(a,{...s});return o=>i.format(o)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=Va(r)}format(e,r,n,a={}){const s=r.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(o=>o.indexOf(")")>-1)){const o=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,o)].join(this.formatSeparator)}return s.reduce((o,l)=>{const{formatName:c,formatOptions:d}=Fd(l);if(this.formats[c]){let u=o;try{const f=a?.formatParams?.[a.interpolationkey]||{},h=f.locale||f.lng||a.locale||a.lng||n;u=this.formats[c](o,h,{...d,...a,...f})}catch(f){this.logger.warn(f)}return u}else this.logger.warn(`there was no format function for ${c}`);return o},e)}}const Ud=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class $d extends Br{constructor(e,r,n,a={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=Fe.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,a.backend,a)}queueLoad(e,r,n,a){const s={},i={},o={},l={};return e.forEach(c=>{let d=!0;r.forEach(u=>{const f=`${c}|${u}`;!n.reload&&this.store.hasResourceBundle(c,u)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?i[f]===void 0&&(i[f]=!0):(this.state[f]=1,d=!1,i[f]===void 0&&(i[f]=!0),s[f]===void 0&&(s[f]=!0),l[u]===void 0&&(l[u]=!0)))}),d||(o[c]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){const a=e.split("|"),s=a[0],i=a[1];r&&this.emit("failedLoading",s,i,r),!r&&n&&this.store.addResourceBundle(s,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);const o={};this.queue.forEach(l=>{wd(l.loaded,[s],i),Ud(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{o[c]||(o[c]={});const d=l.loaded[c];d.length&&d.forEach(u=>{o[c][u]===void 0&&(o[c][u]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,a=0,s=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:a,wait:s,callback:i});return}this.readingCalls++;const o=(c,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(c&&d&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,a+1,s*2,i)},s);return}i(c,d)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const c=l(e,r);c&&typeof c.then=="function"?c.then(d=>o(null,d)).catch(o):o(null,c)}catch(c){o(c)}return}return l(e,r,o)}prepareLoading(e,r,n={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();K(e)&&(e=this.languageUtils.toResolveHierarchy(e)),K(r)&&(r=[r]);const s=this.queueLoad(e,r,n,a);if(!s.toLoad.length)return s.pending.length||a(),null;s.toLoad.forEach(i=>{this.loadOne(i)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){const n=e.split("|"),a=n[0],s=n[1];this.read(a,s,"read",void 0,void 0,(i,o)=>{i&&this.logger.warn(`${r}loading namespace ${s} for language ${a} failed`,i),!i&&o&&this.logger.log(`${r}loaded namespace ${s} for language ${a}`,o),this.loaded(e,i,o)})}saveMissing(e,r,n,a,s,i={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...i,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let d;c.length===5?d=c(e,r,n,a,l):d=c(e,r,n,a),d&&typeof d.then=="function"?d.then(u=>o(null,u)).catch(o):o(null,d)}catch(d){o(d)}else c(e,r,n,a,o,l)}!e||!e[0]||this.store.addResource(e[0],r,n,a)}}}const Ba=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),K(t[1])&&(e.defaultValue=t[1]),K(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ua=t=>(K(t.ns)&&(t.ns=[t.ns]),K(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),K(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),_r=()=>{},zd=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class rr extends Br{constructor(e={},r){if(super(),this.options=Ua(e),this.services={},this.logger=Fe,this.modules={external:[]},zd(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(K(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=Ba();this.options={...n,...this.options,...Ua(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const a=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Fe.init(a(this.modules.logger),this.options):Fe.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Bd;const d=new ja(this.options);this.store=new ka(this.options.resources,this.options);const u=this.services;u.logger=Fe,u.resourceStore=this.store,u.languageUtils=d,u.pluralResolver=new Md(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(u.formatter=a(c),u.formatter.init&&u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Hd(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new $d(a(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(h,...g)=>{this.emit(h,...g)}),this.modules.languageDetector&&(u.languageDetector=a(this.modules.languageDetector),u.languageDetector.init&&u.languageDetector.init(u,this.options.detection,this.options)),this.modules.i18nFormat&&(u.i18nFormat=a(this.modules.i18nFormat),u.i18nFormat.init&&u.i18nFormat.init(this)),this.translator=new jr(this.services,this.options),this.translator.on("*",(h,...g)=>{this.emit(h,...g)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=_r),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...d)=>this.store[c](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...d)=>(this.store[c](...d),this)});const o=Wt(),l=()=>{const c=(d,u)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(u),r(d,u)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,r=_r){let n=r;const a=K(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const s=[],i=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};a?i(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload?.forEach?.(o=>i(o)),this.services.backendConnector.load(s,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(o)})}else n(null)}reloadResources(e,r,n){const a=Wt();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=_r),this.services.backendConnector.reload(e,r,s=>{a.resolve(),n(s)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ci.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;const n=Wt();this.emit("languageChanging",e);const a=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},s=(o,l)=>{l?this.isLanguageChangingTo===e&&(a(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(o,(...c)=>this.t(...c))},i=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);const l=K(o)?o:o&&o[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(K(o)?[o]:o);c&&(this.language||a(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,d=>{s(d,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),n}getFixedT(e,r,n){const a=(s,i,...o)=>{let l;typeof i!="object"?l=this.options.overloadTranslationOptionHandler([s,i].concat(o)):l={...i},l.lng=l.lng||a.lng,l.lngs=l.lngs||a.lngs,l.ns=l.ns||a.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||a.keyPrefix);const c=this.options.keySeparator||".";let d;return l.keyPrefix&&Array.isArray(s)?d=s.map(u=>(typeof u=="function"&&(u=Ir(u,{...this.options,...i})),`${l.keyPrefix}${c}${u}`)):(typeof s=="function"&&(s=Ir(s,{...this.options,...i})),d=l.keyPrefix?`${l.keyPrefix}${c}${s}`:s),this.t(d,l)};return K(e)?a.lng=e:a.lngs=e,a.ns=r,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(o,l)=>{const c=this.services.backendConnector.state[`${o}|${l}`];return c===-1||c===0||c===2};if(r.precheck){const o=r.precheck(this,i);if(o!==void 0)return o}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!a||i(s,e)))}loadNamespaces(e,r){const n=Wt();return this.options.ns?(K(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{n.resolve(),r&&r(a)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){const n=Wt();K(e)&&(e=[e]);const a=this.options.preload||[],s=e.filter(i=>a.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return s.length?(this.options.preload=a.concat(s),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const s=a.getTextInfo();if(s&&s.direction)return s.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new ja(Ba());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new rr(e,r)}cloneInstance(e={},r=_r){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},s=new rr(a);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(o=>{s[o]=this[o]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},n){const o=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((d,u)=>(d[u]={...l[c][u]},d),l[c]),l),{});s.store=new ka(o,a),s.services.resourceStore=s.store}return s.translator=new jr(s.services,a),s.translator.on("*",(o,...l)=>{s.emit(o,...l)}),s.init(a,r),s.translator.options=a,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ne=rr.createInstance();Ne.createInstance=rr.createInstance;Ne.createInstance;Ne.dir;Ne.init;Ne.loadResources;Ne.reloadResources;Ne.use;Ne.changeLanguage;Ne.getFixedT;const kg=Ne.t;Ne.exists;Ne.setDefaultNamespace;Ne.hasLoadedNamespace;Ne.loadNamespaces;Ne.loadLanguages;var rn,$a;function Wd(){return $a||($a=1,rn={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}),rn}var Kd=Wd();const Zd=xc(Kd);var Yd=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function za(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(Zd[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 a=new RegExp(Yd),s=null;(s=a.exec(t))!==null;)if(s[0].trim())if(s[1]){var i=s[1].trim(),o=[i,""];i.indexOf("=")>-1&&(o=i.split("=")),e.attrs[o[0]]=o[1],a.lastIndex--}else s[2]&&(e.attrs[s[2]]=s[3].trim().substring(1,s[3].length-1));return e}var Gd=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Jd=/^\s*$/,qd=Object.create(null);function ui(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 a in r)n.push(a+'="'+r[a]+'"');return n.length?" "+n.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(ui,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Xd={parse:function(t,e){e||(e={}),e.components||(e.components=qd);var r,n=[],a=[],s=-1,i=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(Gd,function(l,c){if(i){if(l!=="</"+r.name+">")return;i=!1}var d,u=l.charAt(1)!=="/",f=l.startsWith("<!--"),h=c+l.length,g=t.charAt(h);if(f){var E=za(l);return s<0?(n.push(E),n):((d=a[s]).children.push(E),n)}if(u&&(s++,(r=za(l)).type==="tag"&&e.components[r.name]&&(r.type="component",i=!0),r.voidElement||i||!g||g==="<"||r.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),s===0&&n.push(r),(d=a[s-1])&&d.children.push(r),a[s]=r),(!u||r.voidElement)&&(s>-1&&(r.voidElement||r.name===l.slice(2,-1))&&(s--,r=s===-1?n:a[s]),!i&&g!=="<"&&g)){d=s===-1?n:a[s].children;var b=t.indexOf("<",h),C=t.slice(h,b===-1?void 0:b);Jd.test(C)&&(C=" "),(b>-1&&s+d.length>=0||C!==" ")&&d.push({type:"text",content:C})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+ui("",r)},"")}};const br=(t,e,r,n)=>{const a=[r,{code:e,...n||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);ke(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...a):console?.warn&&console.warn(...a)},Wa={},Ur=(t,e,r,n)=>{ke(r)&&Wa[r]||(ke(r)&&(Wa[r]=new Date),br(t,e,r,n))},fi=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},On=(t,e,r)=>{t.loadNamespaces(e,fi(t,r))},Ka=(t,e,r,n)=>{if(ke(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return On(t,r,n);r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,fi(t,n))},Qd=(t,e,r={})=>!e.languages||!e.languages.length?(Ur(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,t))return!1}}),ke=t=>typeof t=="string",rt=t=>typeof t=="object"&&t!==null,eu=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,tu={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},ru=t=>tu[t],nu=t=>t.replace(eu,ru);let Dn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:nu};const au=(t={})=>{Dn={...Dn,...t}},hi=()=>Dn;let pi;const su=t=>{pi=t},zn=()=>pi,nn=(t,e)=>{if(!t)return!1;const r=t.props?.children??t.children;return e?r.length>0:!!r},an=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?Pt(e):e},iu=t=>Array.isArray(t)&&t.every(m.isValidElement),Pt=t=>Array.isArray(t)?t:[t],ou=(t,e)=>{const r={...e};return r.props=Object.assign(t.props,e.props),r},mi=(t,e,r,n)=>{if(!t)return"";let a="";const s=Pt(t),i=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((o,l)=>{if(ke(o)){a+=`${o}`;return}if(m.isValidElement(o)){const{props:c,type:d}=o,u=Object.keys(c).length,f=i.indexOf(d)>-1,h=c.children;if(!h&&f&&!u){a+=`<${d}/>`;return}if(!h&&(!f||u)||c.i18nIsDynamicList){a+=`<${l}></${l}>`;return}if(f&&u===1&&ke(h)){a+=`<${d}>${h}</${d}>`;return}const g=mi(h,e,r,n);a+=`<${l}>${g}</${l}>`;return}if(o===null){br(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(rt(o)){const{format:c,...d}=o,u=Object.keys(d);if(u.length===1){const f=c?`${u[0]}, ${c}`:u[0];a+=`{{${f}}}`;return}br(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:o});return}br(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:o})}),a},lu=(t,e=[],r={})=>{if(!t)return t;const n=Object.keys(r),a=[...e,...n];let s="",i=0;for(;i<t.length;)if(t[i]==="<"){let o=!1;const l=t.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9-]*)>/);if(l){const c=l[1];(/^\d+$/.test(c)||a.includes(c))&&(o=!0,s+=l[0],i+=l[0].length)}if(!o){const c=t.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const d=c[1];(/^\d+$/.test(d)||a.includes(d))&&(o=!0,s+=c[0],i+=c[0].length)}}o||(s+="&lt;",i+=1)}else s+=t[i],i+=1;return s},cu=(t,e,r,n,a,s,i)=>{if(r==="")return[];const o=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(o.map(S=>`<${S}`).join("|")).test(r);if(!t&&!e&&!l&&!i)return[r];const c=e??{},d=S=>{Pt(S).forEach(N=>{ke(N)||(nn(N)?d(an(N)):rt(N)&&!m.isValidElement(N)&&Object.assign(c,N))})};d(t);const u=lu(r,o,c),f=Xd.parse(`<0>${u}</0>`),h={...c,...s},g=(S,k,N)=>{const D=an(S),T=b(D,k.children,N);return iu(D)&&T.length===0||S.props?.i18nIsDynamicList?D:T},E=(S,k,N,D,T)=>{S.dummy?(S.children=k,N.push(m.cloneElement(S,{key:D},T?void 0:k))):N.push(...m.Children.map([S],y=>{const w={...y.props};return delete w.i18nIsDynamicList,m.createElement(y.type,{...w,key:D,ref:y.props.ref??y.ref},T?null:k)}))},b=(S,k,N)=>{const D=Pt(S);return Pt(k).reduce((y,w,U)=>{const V=w.children?.[0]?.content&&n.services.interpolator.interpolate(w.children[0].content,h,n.language);if(w.type==="tag"){let G=D[parseInt(w.name,10)];!G&&e&&(G=e[w.name]),N.length===1&&!G&&(G=N[0][w.name]),G||(G={});const z=Object.keys(w.attrs).length!==0?ou({props:w.attrs},G):G,ee=m.isValidElement(z),ne=ee&&nn(w,!0)&&!w.voidElement,Re=l&&rt(z)&&z.dummy&&!ee,Ce=rt(e)&&Object.hasOwnProperty.call(e,w.name);if(ke(z)){const oe=n.services.interpolator.interpolate(z,h,n.language);y.push(oe)}else if(nn(z)||ne){const oe=g(z,w,N);E(z,oe,y,U)}else if(Re){const oe=b(D,w.children,N);E(z,oe,y,U)}else if(Number.isNaN(parseFloat(w.name)))if(Ce){const oe=g(z,w,N);E(z,oe,y,U,w.voidElement)}else if(a.transSupportBasicHtmlNodes&&o.indexOf(w.name)>-1)if(w.voidElement)y.push(m.createElement(w.name,{key:`${w.name}-${U}`}));else{const oe=b(D,w.children,N);y.push(m.createElement(w.name,{key:`${w.name}-${U}`},oe))}else if(w.voidElement)y.push(`<${w.name} />`);else{const oe=b(D,w.children,N);y.push(`<${w.name}>${oe}</${w.name}>`)}else if(rt(z)&&!ee){const oe=w.children[0]?V:null;oe&&y.push(oe)}else E(z,V,y,U,w.children.length!==1||!V)}else if(w.type==="text"){const G=a.transWrapTextNodes,z=i?a.unescape(n.services.interpolator.interpolate(w.content,h,n.language)):n.services.interpolator.interpolate(w.content,h,n.language);G?y.push(m.createElement(G,{key:`${w.name}-${U}`},z)):y.push(z)}return y},[])},C=b([{dummy:!0,children:t||[]}],f,Pt(t||[]));return an(C[0])},gi=(t,e,r)=>{const n=t.key||e,a=m.cloneElement(t,{key:n});if(!a.props||!a.props.children||r.indexOf(`${e}/>`)<0&&r.indexOf(`${e} />`)<0)return a;function s(){return m.createElement(m.Fragment,null,a)}return m.createElement(s,{key:n})},du=(t,e)=>t.map((r,n)=>gi(r,n,e)),uu=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:gi(t[n],n,e)})}),r},fu=(t,e,r,n)=>t?Array.isArray(t)?du(t,e):rt(t)?uu(t,e):(Ur(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,hu=t=>!rt(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function pu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s={},values:i,defaults:o,components:l,ns:c,i18n:d,t:u,shouldUnescape:f,...h}){const g=d||zn();if(!g)return Ur(g,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const E=u||g.t.bind(g)||(ne=>ne),b={...hi(),...g.options?.react};let C=c||E.ns||g.options?.defaultNS;C=ke(C)?[C]:C||["translation"];const S=mi(t,b,g,n),k=o||s?.defaultValue||S||b.transEmptyNodeValue||(typeof n=="function"?Ir(n):n),{hashTransKey:N}=b,D=n||(N?N(S||k):S||k);g.options?.interpolation?.defaultVariables&&(i=i&&Object.keys(i).length>0?{...i,...g.options.interpolation.defaultVariables}:{...g.options.interpolation.defaultVariables});const T=i||e!==void 0&&!g.options?.interpolation?.alwaysFormat||!t?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},y={...s,context:a||s.context,count:e,...i,...T,defaultValue:o||s?.defaultValue,ns:C};let w=D?E(D,y):k;w===D&&k&&(w=k);const U=fu(l,w,g,n);let V=U||t,G=null;hu(U)&&(G=U,V=t);const z=cu(V,G,w,g,b,y,f),ee=r??b.defaultTransParent;return ee?m.createElement(ee,h,z):z}const mu={type:"3rdParty",init(t){au(t.options.react),su(t)}},vi=m.createContext();class gu{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function vu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s={},values:i,defaults:o,components:l,ns:c,i18n:d,t:u,shouldUnescape:f,...h}){const{i18n:g,defaultNS:E}=m.useContext(vi)||{},b=d||g||zn(),C=u||b?.t.bind(b);return pu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s,values:i,defaults:o,components:l,ns:c||C?.ns||E||b?.options?.defaultNS,i18n:b,t:u,shouldUnescape:f,...h})}var sn={exports:{}},on={};var Za;function yu(){if(Za)return on;Za=1;var t=bc();function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,s=t.useLayoutEffect,i=t.useDebugValue;function o(u,f){var h=f(),g=n({inst:{value:h,getSnapshot:f}}),E=g[0].inst,b=g[1];return s(function(){E.value=h,E.getSnapshot=f,l(E)&&b({inst:E})},[u,h,f]),a(function(){return l(E)&&b({inst:E}),u(function(){l(E)&&b({inst:E})})},[u]),i(h),h}function l(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!r(u,h)}catch{return!0}}function c(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return on.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,on}var Ya;function _u(){return Ya||(Ya=1,sn.exports=yu()),sn.exports}var Eu=_u();const Cu=(t,e)=>ke(e)?e:rt(e)&&ke(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,xu={t:Cu,ready:!1},bu=()=>()=>{},yi=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:a}=m.useContext(vi)||{},s=r||n||zn();s&&!s.reportNamespaces&&(s.reportNamespaces=new gu),s||Ur(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=m.useMemo(()=>({...hi(),...s?.options?.react,...e}),[s,e]),{useSuspense:o,keyPrefix:l}=i,c=m.useMemo(()=>{const N=a||s?.options?.defaultNS;return ke(N)?[N]:N||["translation"]},[t,a,s]);s?.reportNamespaces?.addUsedNamespaces?.(c);const d=m.useRef(0),u=m.useCallback(N=>{if(!s)return bu;const{bindI18n:D,bindI18nStore:T}=i,y=()=>{d.current+=1,N()};return D&&s.on(D,y),T&&s.store.on(T,y),()=>{D&&D.split(" ").forEach(w=>s.off(w,y)),T&&T.split(" ").forEach(w=>s.store.off(w,y))}},[s,i]),f=m.useRef(),h=m.useCallback(()=>{if(!s)return xu;const N=!!(s.isInitialized||s.initializedStoreOnce)&&c.every(V=>Qd(V,s,i)),D=e.lng||s.language,T=d.current,y=f.current;if(y&&y.ready===N&&y.lng===D&&y.keyPrefix===l&&y.revision===T)return y;const U={t:s.getFixedT(D,i.nsMode==="fallback"?c:c[0],l),ready:N,lng:D,keyPrefix:l,revision:T};return f.current=U,U},[s,c,l,i,e.lng]),[g,E]=m.useState(0),{t:b,ready:C}=Eu.useSyncExternalStore(u,h,h);m.useEffect(()=>{if(s&&!C&&!o){const N=()=>E(D=>D+1);e.lng?Ka(s,e.lng,c,N):On(s,c,N)}},[s,e.lng,c,C,o,g]);const S=s||{},k=m.useMemo(()=>{const N=[b,S,C];return N.t=b,N.i18n=S,N.ready=C,N},[b,S,C]);if(s&&o&&!C)throw new Promise(N=>{const D=()=>N();e.lng?Ka(s,e.lng,c,D):On(s,c,D)});return k},Su=()=>{const{t}=yi();return _.jsxs("div",{children:[_.jsx("p",{className:"font-medium",children:t("notifications.reloadApp")}),_.jsxs("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},Nu=()=>{async function t(){const e=await Ah();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;ge.studioMode||!ge.warnOutdatedApp?te.warn(`Connect is outdated:
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sentry_react-cODD7zWc.js","assets/react-DQSxOgtG.js","assets/sentry_browser-B4YoBIIG.js","assets/AddDriveModal-B-mkPvxY.js","assets/document_model_editor-Dg6e70B3.js","assets/graphql-AKTCpY7l.js","assets/drive_explorer-tk5qJ4Gx.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-_oCbt5YE.js","assets/zod-9j67vCAu.js","assets/design_system-DwS7cDsv.js","assets/tailwind_merge-Dr4f9Rms.js","assets/react-dom-D6zQJsh6.js","assets/reactor_browser-C4oTTg7Z.js","assets/document_drive-CwpHvdiT.js","assets/config-CU-aFfVJ.js","assets/design_system_connect-BjOFBMFx.js","assets/design_system_ui-DYqAwO-0.js","assets/react-dom/client-BVPiT_FE.js","assets/graphql_request-BJtmW2JS.js","assets/ClearStorageModal-CPyXjtE_.js","assets/CookiesPolicyModal-Cfvaovdz.js","assets/CreateDocumentModal-CkNEbPYe.js","assets/DebugSettingsModal-D2JAQzFM.js","assets/DeleteDriveModal-OsVneUN5.js","assets/DeleteItemModal-BEl_TNZV.js","assets/DisclaimerModal-B3L0Zayk.js","assets/DriveSettingsModal-BRo4Yo-8.js","assets/ExportDocumentWithErrorsModal-CFUpAfjW.js","assets/SettingsModal-Dg1z54dL.js","assets/UpgradeDriveModal-D30aSlcL.js","assets/index-kDDMsCoU.js"])))=>i.map(i=>d[i]);
2
+ import{j as _,g as Do,E as Lo}from"./document_model_editor-Dg6e70B3.js";import{d as Ao}from"./design_system_ui-DYqAwO-0.js";import{r as m,R as To,a as Vs}from"./sentry_react-cODD7zWc.js";import{q as Po,l as te,t as Hn,B as ko,R as Io,I as jo,E as Mo,v as vr,w as Ho}from"./document_drive-CwpHvdiT.js";import{_ as Se,G as Fo}from"./drive_explorer-tk5qJ4Gx.js";import{t as Vo,c as Bs,H as Us,A as Bo,W as Uo,d as $o,e as zo,f as Wo,g as Ko,h as Zo,i as da,F as Yo,j as $s,k as Go,B as Jo,l as qo,m as Xo,S as Qo,n as el}from"./design_system_connect-BjOFBMFx.js";import{y as zs,z as Fn,U as tl,C as rl,R as nl,A as al,B as sl,D as il,E as ol,G as ll,K as cl,P as dl,x as et,F as Ws,H as ul,k as fl,I as hl,J as pl,L as ml,M as Vn,N as gl,O as vl,Q as yl,g as _n,T as Ks,V as Zs,W as _l,X as El,Y as Cl,Z as xl,i as bl,_ as Sl,$ as Nl,a0 as Rl,a1 as wl,a2 as Ol,a3 as Dl,c as Ll,a4 as Al,a5 as Tl,a6 as Ys,a7 as Pl,a8 as Gs,a9 as kl,aa as Il,ab as jl,ac as Ml,ad as Hl,ae as Fl,af as Vl,ag as Bl,ah as Ul,ai as $l,aj as ua,ak as zl,al as Wl,am as Kl,an as Zl,ao as Yl,ap as Gl,aq as Jl,ar as ql,as as Xl,at as Ql,au as ec,av as tc,aw as rc,ax as nc,ay as ac,az as sc,aA as ic,aB as oc,s as Rr,aC as lc,aD as Rt,aE as yt,aF as cc,d as Js,aG as dc,aH as uc,aI as qs,aJ as fc,aK as fa,aL as hc,aM as pc,aN as mc}from"./reactor_browser-C4oTTg7Z.js";import{I as ha,l as Xs,T as gc,c as ir}from"./design_system-DwS7cDsv.js";import{a7 as vc,a6 as yc,a8 as yr,j as Qs,h as ei,g as _c}from"./document_model-_oCbt5YE.js";import{g as Ec,r as Cc}from"./graphql_request-BJtmW2JS.js";import{g as xc,r as bc}from"./react-DQSxOgtG.js";import{t as Sc}from"./tailwind_merge-Dr4f9Rms.js";import{an as Nc}from"./sentry_browser-B4YoBIIG.js";import"./graphql-AKTCpY7l.js";import"./react/jsx-runtime-DldvXD6N.js";import"./zod-9j67vCAu.js";import"./react-dom-D6zQJsh6.js";import"./react-dom/client-BVPiT_FE.js";import"./config-CU-aFfVJ.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();var se;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(se||(se={}));var pa;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pa||(pa={}));const j=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xe=t=>{switch(typeof t){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(t)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(t)?j.array:t===null?j.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?j.promise:typeof Map<"u"&&t instanceof Map?j.map:typeof Set<"u"&&t instanceof Set?j.set:typeof Date<"u"&&t instanceof Date?j.date:j.object;default:return j.unknown}},O=se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class We extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return a(this),n}static assert(e){if(!(e instanceof We))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r=Object.create(null),n=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}We.create=t=>new We(t);const En=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===j.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,se.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${se.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${se.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${se.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:se.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,se.assertNever(t)}return{message:r}};let Rc=En;function wc(){return Rc}const Oc=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)o=c(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function T(t,e){const r=wc(),n=Oc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===En?void 0:En].filter(a=>!!a)});t.common.issues.push(n)}class Le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return Z;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const s=await a.key,i=await a.value;n.push({key:s,value:i})}return Le.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return Z;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const Z=Object.freeze({status:"aborted"}),Jt=t=>({status:"dirty",value:t}),Ie=t=>({status:"valid",value:t}),ma=t=>t.status==="aborted",ga=t=>t.status==="dirty",It=t=>t.status==="valid",wr=t=>typeof Promise<"u"&&t instanceof Promise;var F;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(F||(F={}));class lt{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const va=(t,e)=>{if(It(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new We(t.common.issues);return this._error=r,this._error}}};function X(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:l}=t;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}class re{get description(){return this._def.description}_getType(e){return Xe(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(wr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},a=this._parseSync({data:e,path:n.path,parent:n});return va(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return It(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>It(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(wr(a)?a:Promise.resolve(a));return va(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:O.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Ht({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return it.create(this,this._def)}nullable(){return Ft.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return Ar.create(this,this._def)}or(e){return Dr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new Ht({...X(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new bn({...X(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new qc({typeName:Y.ZodBranded,type:this,...X(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Sn({...X(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bn.create(this,e)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Dc=/^c[^\s-]{8,}$/i,Lc=/^[0-9a-z]+$/,Ac=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Tc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pc=/^[a-z0-9_-]{21}$/i,kc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ic=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qr;const Hc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Vc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Uc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$c=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ti="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",zc=new RegExp(`^${ti}$`);function ri(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Wc(t){return new RegExp(`^${ri(t)}$`)}function Kc(t){let e=`${ti}T${ri(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Zc(t,e){return!!((e==="v4"||!e)&&Hc.test(t)||(e==="v6"||!e)&&Vc.test(t))}function Yc(t,e){if(!kc.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Gc(t,e){return!!((e==="v4"||!e)&&Fc.test(t)||(e==="v6"||!e)&&Bc.test(t))}class tt extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){const s=this._getOrReturnCtx(e);return T(s,{code:O.invalid_type,expected:j.string,received:s.parsedType}),Z}const n=new Le;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),T(a,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),T(a,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?T(a,{code:O.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&T(a,{code:O.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")jc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"email",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Qr||(Qr=new RegExp(Mc,"u")),Qr.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"emoji",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Tc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"uuid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Pc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"nanoid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Dc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"cuid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Lc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"cuid2",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ac.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"ulid",code:O.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),T(a,{validation:"url",code:O.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"regex",code:O.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Kc(s).test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?zc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Wc(s).test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Ic.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"duration",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Zc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"ip",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Yc(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"jwt",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Gc(e.data,s.version)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"cidr",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Uc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"base64",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?$c.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"base64url",code:O.invalid_string,message:s.message}),n.dirty()):se.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:O.invalid_string,...F.errToObj(n)})}_addCheck(e){return new tt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...F.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...F.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...F.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...F.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...F.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...F.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...F.errToObj(r)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}tt.create=t=>new tt({checks:[],typeName:Y.ZodString,coerce:t?.coerce??!1,...X(t)});function Jc(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}class jt extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j.number){const s=this._getOrReturnCtx(e);return T(s,{code:O.invalid_type,expected:j.number,received:s.parsedType}),Z}let n;const a=new Le;for(const s of this._def.checks)s.kind==="int"?se.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:O.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Jc(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:O.not_finite,message:s.message}),a.dirty()):se.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,a){return new jt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(a)}]})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&se.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}jt.create=t=>new jt({checks:[],typeName:Y.ZodNumber,coerce:t?.coerce||!1,...X(t)});class Qt extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j.bigint)return this._getInvalidInput(e);let n;const a=new Le;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),T(n,{code:O.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):se.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return T(r,{code:O.invalid_type,expected:j.bigint,received:r.parsedType}),Z}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Qt.create=t=>new Qt({checks:[],typeName:Y.ZodBigInt,coerce:t?.coerce??!1,...X(t)});class Cn extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.boolean,received:n.parsedType}),Z}return Ie(e.data)}}Cn.create=t=>new Cn({typeName:Y.ZodBoolean,coerce:t?.coerce||!1,...X(t)});class Or extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){const s=this._getOrReturnCtx(e);return T(s,{code:O.invalid_type,expected:j.date,received:s.parsedType}),Z}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return T(s,{code:O.invalid_date}),Z}const n=new Le;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),T(a,{code:O.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),T(a,{code:O.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):se.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Or({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:F.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Or.create=t=>new Or({checks:[],coerce:t?.coerce||!1,typeName:Y.ZodDate,...X(t)});class ya extends re{_parse(e){if(this._getType(e)!==j.symbol){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.symbol,received:n.parsedType}),Z}return Ie(e.data)}}ya.create=t=>new ya({typeName:Y.ZodSymbol,...X(t)});class _a extends re{_parse(e){if(this._getType(e)!==j.undefined){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.undefined,received:n.parsedType}),Z}return Ie(e.data)}}_a.create=t=>new _a({typeName:Y.ZodUndefined,...X(t)});class Ea extends re{_parse(e){if(this._getType(e)!==j.null){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.null,received:n.parsedType}),Z}return Ie(e.data)}}Ea.create=t=>new Ea({typeName:Y.ZodNull,...X(t)});class Ca extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return Ie(e.data)}}Ca.create=t=>new Ca({typeName:Y.ZodAny,...X(t)});class xa extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ie(e.data)}}xa.create=t=>new xa({typeName:Y.ZodUnknown,...X(t)});class ct extends re{_parse(e){const r=this._getOrReturnCtx(e);return T(r,{code:O.invalid_type,expected:j.never,received:r.parsedType}),Z}}ct.create=t=>new ct({typeName:Y.ZodNever,...X(t)});class ba extends re{_parse(e){if(this._getType(e)!==j.undefined){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.void,received:n.parsedType}),Z}return Ie(e.data)}}ba.create=t=>new ba({typeName:Y.ZodVoid,...X(t)});class Ve extends re{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==j.array)return T(r,{code:O.invalid_type,expected:j.array,received:r.parsedType}),Z;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(T(r,{code:i?O.too_big:O.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(T(r,{code:O.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(T(r,{code:O.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new lt(r,i,r.path,o)))).then(i=>Le.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new lt(r,i,r.path,o)));return Le.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ve({...this._def,minLength:{value:e,message:F.toString(r)}})}max(e,r){return new Ve({...this._def,maxLength:{value:e,message:F.toString(r)}})}length(e,r){return new Ve({...this._def,exactLength:{value:e,message:F.toString(r)}})}nonempty(e){return this.min(1,e)}}Ve.create=(t,e)=>new Ve({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...X(e)});function Lt(t){if(t instanceof Ee){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=it.create(Lt(n))}return new Ee({...t._def,shape:()=>e})}else return t instanceof Ve?new Ve({...t._def,type:Lt(t.element)}):t instanceof it?it.create(Lt(t.unwrap())):t instanceof Ft?Ft.create(Lt(t.unwrap())):t instanceof Ct?Ct.create(t.items.map(e=>Lt(e))):t}class Ee extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=se.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==j.object){const c=this._getOrReturnCtx(e);return T(c,{code:O.invalid_type,expected:j.object,received:c.parsedType}),Z}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ct&&this._def.unknownKeys==="strip"))for(const c in a.data)i.includes(c)||o.push(c);const l=[];for(const c of i){const u=s[c],d=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new lt(a,d,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof ct){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(c==="strict")o.length>0&&(T(a,{code:O.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new lt(a,d,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Le.mergeObjectSync(n,c)):Le.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new Ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:F.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Ee({...this._def,unknownKeys:"strip"})}passthrough(){return new Ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ee({...this._def,catchall:e})}pick(e){const r={};for(const n of se.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ee({...this._def,shape:()=>r})}omit(e){const r={};for(const n of se.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Ee({...this._def,shape:()=>r})}deepPartial(){return Lt(this)}partial(e){const r={};for(const n of se.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new Ee({...this._def,shape:()=>r})}required(e){const r={};for(const n of se.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof it;)s=s._def.innerType;r[n]=s}return new Ee({...this._def,shape:()=>r})}keyof(){return ni(se.objectKeys(this.shape))}}Ee.create=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strip",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});Ee.strictCreate=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strict",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});Ee.lazycreate=(t,e)=>new Ee({shape:t,unknownKeys:"strip",catchall:ct.create(),typeName:Y.ZodObject,...X(e)});class Dr extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new We(o.ctx.common.issues));return T(r,{code:O.invalid_union,unionErrors:i}),Z}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const l of n){const c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(l=>new We(l));return T(r,{code:O.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}}Dr.create=(t,e)=>new Dr({options:t,typeName:Y.ZodUnion,...X(e)});function xn(t,e){const r=Xe(t),n=Xe(e);if(t===e)return{valid:!0,data:t};if(r===j.object&&n===j.object){const a=se.objectKeys(e),s=se.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const l=xn(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(r===j.array&&n===j.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],l=xn(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===j.date&&n===j.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Lr extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(ma(s)||ma(i))return Z;const o=xn(s.value,i.value);return o.valid?((ga(s)||ga(i))&&r.dirty(),{status:r.value,value:o.data}):(T(n,{code:O.invalid_intersection_types}),Z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Lr.create=(t,e,r)=>new Lr({left:t,right:e,typeName:Y.ZodIntersection,...X(r)});class Ct extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==j.array)return T(n,{code:O.invalid_type,expected:j.array,received:n.parsedType}),Z;if(n.data.length<this._def.items.length)return T(n,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&n.data.length>this._def.items.length&&(T(n,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new lt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Le.mergeArray(r,i)):Le.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Ct({...this._def,rest:e})}}Ct.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ct({items:t,typeName:Y.ZodTuple,rest:null,...X(e)})};class Sa extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==j.map)return T(n,{code:O.invalid_type,expected:j.map,received:n.parsedType}),Z;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,l],c)=>({key:a._parse(new lt(n,o,n.path,[c,"key"])),value:s._parse(new lt(n,l,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Z;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Z;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}}Sa.create=(t,e,r)=>new Sa({valueType:e,keyType:t,typeName:Y.ZodMap,...X(r)});class er extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==j.set)return T(n,{code:O.invalid_type,expected:j.set,received:n.parsedType}),Z;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(T(n,{code:O.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(T(n,{code:O.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Z;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((l,c)=>s._parse(new lt(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,r){return new er({...this._def,minSize:{value:e,message:F.toString(r)}})}max(e,r){return new er({...this._def,maxSize:{value:e,message:F.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}er.create=(t,e)=>new er({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...X(e)});class Na extends re{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Na.create=(t,e)=>new Na({getter:t,typeName:Y.ZodLazy,...X(e)});class Ra extends re{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return T(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ra.create=(t,e)=>new Ra({value:t,typeName:Y.ZodLiteral,...X(e)});function ni(t,e){return new Mt({values:t,typeName:Y.ZodEnum,...X(e)})}class Mt extends re{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return T(r,{expected:se.joinValues(n),received:r.parsedType,code:O.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return T(r,{received:r.data,code:O.invalid_enum_value,options:n}),Z}return Ie(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Mt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Mt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Mt.create=ni;class wa extends re{_parse(e){const r=se.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==j.string&&n.parsedType!==j.number){const a=se.objectValues(r);return T(n,{expected:se.joinValues(a),received:n.parsedType,code:O.invalid_type}),Z}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=se.objectValues(r);return T(n,{received:n.data,code:O.invalid_enum_value,options:a}),Z}return Ie(e.data)}get enum(){return this._def.values}}wa.create=(t,e)=>new wa({values:t,typeName:Y.ZodNativeEnum,...X(e)});class Ar extends re{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==j.promise&&r.common.async===!1)return T(r,{code:O.invalid_type,expected:j.promise,received:r.parsedType}),Z;const n=r.parsedType===j.promise?r.data:Promise.resolve(r.data);return Ie(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Ar.create=(t,e)=>new Ar({type:t,typeName:Y.ZodPromise,...X(e)});class Ht extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{T(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){const i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return Z;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?Z:l.status==="dirty"||r.value==="dirty"?Jt(l.value):l});{if(r.value==="aborted")return Z;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?Z:o.status==="dirty"||r.value==="dirty"?Jt(o.value):o}}if(a.type==="refinement"){const i=o=>{const l=a.refinement(o,s);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Z:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?Z:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!It(i))return Z;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>It(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):Z);se.assertNever(a)}}Ht.create=(t,e,r)=>new Ht({schema:t,typeName:Y.ZodEffects,effect:e,...X(r)});Ht.createWithPreprocess=(t,e,r)=>new Ht({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...X(r)});class it extends re{_parse(e){return this._getType(e)===j.undefined?Ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}it.create=(t,e)=>new it({innerType:t,typeName:Y.ZodOptional,...X(e)});class Ft extends re{_parse(e){return this._getType(e)===j.null?Ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ft.create=(t,e)=>new Ft({innerType:t,typeName:Y.ZodNullable,...X(e)});class bn extends re{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===j.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}bn.create=(t,e)=>new bn({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...X(e)});class Sn extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wr(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Sn.create=(t,e)=>new Sn({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...X(e)});class Oa extends re{_parse(e){if(this._getType(e)!==j.nan){const n=this._getOrReturnCtx(e);return T(n,{code:O.invalid_type,expected:j.nan,received:n.parsedType}),Z}return{status:"valid",value:e.data}}}Oa.create=t=>new Oa({typeName:Y.ZodNaN,...X(t)});class qc extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Bn extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Z:s.status==="dirty"?(r.dirty(),Jt(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Z:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Bn({in:e,out:r,typeName:Y.ZodPipeline})}}class Nn extends re{_parse(e){const r=this._def.innerType._parse(e),n=a=>(It(a)&&(a.value=Object.freeze(a.value)),a);return wr(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Nn.create=(t,e)=>new Nn({innerType:t,typeName:Y.ZodReadonly,...X(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const me=tt.create,Xc=jt.create,Qc=Cn.create;ct.create;Ve.create;const Ke=Ee.create,ai=Dr.create;Lr.create;Ct.create;const si=Mt.create;Ar.create;it.create;Ft.create;const ce=ai([Qc(),si(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),Tr=ai([Xc(),me()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),ed=Ke({PH_CONFIG_PATH:me().optional(),PH_PACKAGES:me().optional(),PH_LOCAL_PACKAGE:me().optional(),PH_DISABLE_LOCAL_PACKAGE:ce.default(!1),PH_WATCH_TIMEOUT:Tr.default(300),PH_SENTRY_AUTH_TOKEN:me().optional(),PH_SENTRY_ORG:me().optional(),PH_SENTRY_PROJECT:me().optional()}),td=Ke({PH_CONNECT_VERSION:me().default("unknown"),PH_CONNECT_LOG_LEVEL:si(["debug","info","warn","error"]).default("info"),PH_CONNECT_REQUIRES_HARD_REFRESH:ce.default(!0),PH_CONNECT_WARN_OUTDATED_APP:ce.default(!1),PH_CONNECT_STUDIO_MODE:ce.default(!1),PH_CONNECT_BASE_PATH:me().optional(),PH_CONNECT_DEFAULT_DRIVES_URL:me().optional(),PH_CONNECT_DRIVES_PRESERVE_STRATEGY:me().optional(),PH_CONNECT_VERSION_CHECK_INTERVAL:Tr.default(3600*1e3),PH_CONNECT_CLI_VERSION:me().optional(),PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:Tr.default(50)}),rd=Ke({PH_CONNECT_DISABLE_ADD_DRIVE:ce.default(!1),PH_CONNECT_SEARCH_BAR_ENABLED:ce.default(!1),PH_CONNECT_INSPECTOR_ENABLED:ce.default(!1),PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:ce.default(!0),PH_CONNECT_ENABLED_EDITORS:me().optional(),PH_CONNECT_DISABLED_EDITORS:me().default("powerhouse/document-drive"),PH_CONNECT_GA_TRACKING_ID:me().optional(),PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:ce.default(!1)}),nd=Ke({PH_CONNECT_PUBLIC_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:ce.default(!1),PH_CONNECT_CLOUD_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:ce.default(!1),PH_CONNECT_LOCAL_DRIVES_ENABLED:ce.default(!0),PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:ce.default(!1),PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:ce.default(!1)}),ad=Ke({PH_CONNECT_ANALYTICS_ENABLED:ce.default(!0),PH_CONNECT_ANALYTICS_DATABASE_NAME:me().optional(),PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:ce.default(!0),PH_CONNECT_DIFF_ANALYTICS_ENABLED:ce.default(!1),PH_CONNECT_DRIVE_ANALYTICS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:ce.default(!0)}),sd=Ke({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0)}),id=Ke({PH_CONNECT_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ce.default(!0)}),od=id.merge(ad).merge(sd),ld=Ke({PH_CONNECT_SENTRY_RELEASE:me().optional(),PH_CONNECT_SENTRY_DSN:me().optional(),PH_CONNECT_SENTRY_ENV:me().default("dev"),PH_CONNECT_SENTRY_TRACING_ENABLED:ce.default(!1)}),cd=Ke({PH_CONNECT_RENOWN_URL:me().default("https://www.renown.id"),PH_CONNECT_RENOWN_NETWORK_ID:me().default("eip155"),PH_CONNECT_RENOWN_CHAIN_ID:Tr.default(1)}),Cr=td.merge(rd).merge(nd).merge(od).merge(ld).merge(cd);ed.merge(Cr);function dd(t,e,r){const{processEnv:n={},optionsEnv:a={},fileEnv:s={}}=t,i={};for(const o of e){const l=[{name:"process.env",value:n[o]},{name:"options",value:a[o]},{name:"fileEnv",value:s[o]}];for(const c of l){const u=c.value;if(!(u===void 0||u===""))try{const d=r.shape[o];if(d){d.parse(u),i[o]=u;break}console.warn(`Unknown environment variable: '${o}'`),i[o]=u;break}catch{const d=u===null?"null":typeof u=="object"?JSON.stringify(u):u;console.warn(`Invalid value for ${o} from ${c.name}: ${d}. Trying next source.`)}}}return i}function ud(t={}){const e=new Set(Object.keys(Cr.shape)),r=dd(t,e,Cr);return Cr.parse(r)}function fd(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const hd={BASE_URL:"/",DEV:!1,MODE:"production",PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:"true",PH_CONNECT_ANALYTICS_ENABLED:"true",PH_CONNECT_CLOUD_DRIVES_ENABLED:"true",PH_CONNECT_DIFF_ANALYTICS_ENABLED:"false",PH_CONNECT_DISABLED_EDITORS:"powerhouse/document-drive",PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_ADD_DRIVE:"false",PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:"false",PH_CONNECT_DRIVE_ANALYTICS_ENABLED:"true",PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:"false",PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:"50",PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:"true",PH_CONNECT_INSPECTOR_ENABLED:"false",PH_CONNECT_LOCAL_DRIVES_ENABLED:"true",PH_CONNECT_LOG_LEVEL:"info",PH_CONNECT_PROCESSORS_ENABLED:"true",PH_CONNECT_PUBLIC_DRIVES_ENABLED:"true",PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_RENOWN_CHAIN_ID:"1",PH_CONNECT_RENOWN_NETWORK_ID:"eip155",PH_CONNECT_RENOWN_URL:"https://auth.renown.id",PH_CONNECT_REQUIRES_HARD_REFRESH:"true",PH_CONNECT_SEARCH_BAR_ENABLED:"false",PH_CONNECT_SENTRY_ENV:"prod",PH_CONNECT_SENTRY_TRACING_ENABLED:"false",PH_CONNECT_STUDIO_MODE:"false",PH_CONNECT_VERSION:"6.0.0-dev.2",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},D=ud({processEnv:hd});function pd(t){return t.endsWith("/")?t:t+"/"}function md(){const t=D.PH_CONNECT_BASE_PATH||"/",e=pd(t);return{basePath:t,routerBasename:e,allowList:void 0,allowedDocumentTypes:[],isDragAndDropEnabled:!0,isEditorDebugModeEnabled:!1,isEditorReadModeEnabled:!1,isExternalControlsEnabled:!1,version:D.PH_CONNECT_VERSION,logLevel:D.PH_CONNECT_LOG_LEVEL,requiresHardRefresh:D.PH_CONNECT_REQUIRES_HARD_REFRESH,warnOutdatedApp:D.PH_CONNECT_WARN_OUTDATED_APP,studioMode:D.PH_CONNECT_STUDIO_MODE,versionCheckInterval:D.PH_CONNECT_VERSION_CHECK_INTERVAL,cliVersion:D.PH_CONNECT_CLI_VERSION,fileUploadOperationsChunkSize:D.PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE,gaTrackingId:D.PH_CONNECT_GA_TRACKING_ID,defaultDrivesUrl:D.PH_CONNECT_DEFAULT_DRIVES_URL,drivesPreserveStrategy:D.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,enabledEditors:D.PH_CONNECT_ENABLED_EDITORS?.split(","),disabledEditors:D.PH_CONNECT_DISABLED_EDITORS.split(","),isExternalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED,isAnalyticsEnabled:D.PH_CONNECT_ANALYTICS_ENABLED,isAnalyticsExternalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&D.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,analyticsDatabaseName:D.PH_CONNECT_ANALYTICS_DATABASE_NAME,isRelationalProcessorsEnabled:D.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,isExternalRelationalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&D.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED,renownUrl:D.PH_CONNECT_RENOWN_URL,renownNetworkId:D.PH_CONNECT_RENOWN_NETWORK_ID,renownChainId:D.PH_CONNECT_RENOWN_CHAIN_ID,sentryRelease:D.PH_CONNECT_SENTRY_RELEASE,sentryDsn:D.PH_CONNECT_SENTRY_DSN,sentryEnv:D.PH_CONNECT_SENTRY_ENV,isDiffAnalyticsEnabled:D.PH_CONNECT_DIFF_ANALYTICS_ENABLED,isDriveAnalyticsEnabled:D.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,isPublicDrivesEnabled:D.PH_CONNECT_PUBLIC_DRIVES_ENABLED,isCloudDrivesEnabled:D.PH_CONNECT_CLOUD_DRIVES_ENABLED,isLocalDrivesEnabled:D.PH_CONNECT_LOCAL_DRIVES_ENABLED,isSentryTracingEnabled:D.PH_CONNECT_SENTRY_TRACING_ENABLED,isDocumentModelSelectionSettingsEnabled:!D.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,isAddDriveEnabled:!D.PH_CONNECT_DISABLE_ADD_DRIVE,isAddPublicDrivesEnabled:!D.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,isDeletePublicDrivesEnabled:!D.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES,isAddCloudDrivesEnabled:!D.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,isDeleteCloudDrivesEnabled:!D.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES,isAddLocalDrivesEnabled:!D.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,isDeleteLocalDrivesEnabled:!D.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES,isAnalyticsDatabaseWorkerEnabled:!D.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,isExternalPackagesEnabled:!D.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED}}const kt=md(),gd={isExternalControlsEnabled:kt.isExternalControlsEnabled},vd={allowedDocumentTypes:kt.allowedDocumentTypes,isDragAndDropEnabled:kt.isDragAndDropEnabled};Po(D.PH_CONNECT_LOG_LEVEL);te.debug(`Setting log level to ${D.PH_CONNECT_LOG_LEVEL}.`);const ii=fd(D.PH_CONNECT_BASE_PATH||"/"),yd=D.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${ii.replace(/\//g,"")}:analytics`,ge={appVersion:D.PH_CONNECT_VERSION,studioMode:D.PH_CONNECT_STUDIO_MODE,warnOutdatedApp:D.PH_CONNECT_WARN_OUTDATED_APP,appVersionCheckInterval:D.PH_CONNECT_VERSION_CHECK_INTERVAL,routerBasename:ii,externalPackagesEnabled:!D.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED,processors:{enabled:D.PH_CONNECT_PROCESSORS_ENABLED,externalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},analytics:{enabled:D.PH_CONNECT_ANALYTICS_ENABLED,databaseName:yd,useWorker:!D.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,driveAnalyticsEnabled:D.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,diffProcessorEnabled:D.PH_CONNECT_DIFF_ANALYTICS_ENABLED,externalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},relational:{enabled:D.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,externalProcessorsEnabled:D.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED},renown:{url:D.PH_CONNECT_RENOWN_URL,networkId:D.PH_CONNECT_RENOWN_NETWORK_ID,chainId:D.PH_CONNECT_RENOWN_CHAIN_ID},sentry:{release:D.PH_CONNECT_SENTRY_RELEASE,dsn:D.PH_CONNECT_SENTRY_DSN,env:D.PH_CONNECT_SENTRY_ENV,tracing:D.PH_CONNECT_SENTRY_TRACING_ENABLED},content:{showSearchBar:D.PH_CONNECT_SEARCH_BAR_ENABLED,showDocumentModelSelectionSetting:!D.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,inspectorEnabled:D.PH_CONNECT_INSPECTOR_ENABLED},drives:{addDriveEnabled:!D.PH_CONNECT_DISABLE_ADD_DRIVE,preserveStrategy:D.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,sections:{LOCAL:{enabled:D.PH_CONNECT_LOCAL_DRIVES_ENABLED,allowAdd:!D.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,allowDelete:!D.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES},CLOUD:{enabled:D.PH_CONNECT_CLOUD_DRIVES_ENABLED,allowAdd:!D.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,allowDelete:!D.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES},PUBLIC:{enabled:D.PH_CONNECT_PUBLIC_DRIVES_ENABLED,allowAdd:!D.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,allowDelete:!D.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES}}},gaTrackingId:D.PH_CONNECT_GA_TRACKING_ID,phCliVersion:D.PH_CONNECT_CLI_VERSION},_d=ge.routerBasename,oi=`${_d}:acceptedCookies`,Rn=new Set;let xr=Ed();function Ed(){try{const t=localStorage.getItem(oi);return t?JSON.parse(t):{analytics:!1,marketing:!1,functional:!1}}catch{return{analytics:!1,marketing:!1,functional:!1}}}function Da(){return xr}function Cd(t){xr=t(xr),localStorage.setItem(oi,JSON.stringify(xr)),Rn.forEach(e=>e())}function xd(t){return Rn.add(t),()=>Rn.delete(t)}const Un=()=>[m.useSyncExternalStore(xd,Da,Da),Cd];async function $n(){try{return(await Se(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Pg(t){const e=await $n();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-added",n))}e.on("studio:external-package-added",n),e.send("studio:add-external-package",{name:t})})}async function kg(t){const e=await $n();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-removed",n))}e.on("studio:external-package-removed",n),e.send("studio:remove-external-package",{name:t})})}function bd(){const t=m.useRef(void 0);m.useEffect(()=>{const e=async n=>{const a=window.ph?.vetraPackages||[],l=(await Se(()=>import(`${n.url}?t=${n.timestamp}`),[])).default.map(zs),u=[...a.filter(d=>d.id==="powerhouse/common"),...l];Fn(u)};async function r(){const n=await $n();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(te.error),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Sd="connect";function or(t,e){const{type:r="default",containerId:n=Sd,...a}=e||{};return Vo(t,{type:r,containerId:n,...a})}const K=t=>typeof t=="string",Wt=()=>{let t,e;const r=new Promise((n,a)=>{t=n,e=a});return r.resolve=t,r.reject=e,r},La=t=>t==null?"":""+t,Nd=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Rd=/###/g,Aa=t=>t&&t.indexOf("###")>-1?t.replace(Rd,"."):t,Ta=t=>!t||K(t),Xt=(t,e,r)=>{const n=K(e)?e.split("."):e;let a=0;for(;a<n.length-1;){if(Ta(t))return{};const s=Aa(n[a]);!t[s]&&r&&(t[s]=new r),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++a}return Ta(t)?{}:{obj:t,k:Aa(n[a])}},Pa=(t,e,r)=>{const{obj:n,k:a}=Xt(t,e,Object);if(n!==void 0||e.length===1){n[a]=r;return}let s=e[e.length-1],i=e.slice(0,e.length-1),o=Xt(t,i,Object);for(;o.obj===void 0&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),o=Xt(t,i,Object),o?.obj&&typeof o.obj[`${o.k}.${s}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${s}`]=r},wd=(t,e,r,n)=>{const{obj:a,k:s}=Xt(t,e,Object);a[s]=a[s]||[],a[s].push(r)},Pr=(t,e)=>{const{obj:r,k:n}=Xt(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Od=(t,e,r)=>{const n=Pr(t,r);return n!==void 0?n:Pr(e,r)},li=(t,e,r)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?K(t[n])||t[n]instanceof String||K(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):li(t[n],e[n],r):t[n]=e[n]);return t},wt=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Dd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ld=t=>K(t)?t.replace(/[&<>"'\/]/g,e=>Dd[e]):t;class Ad{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const Td=[" ",",","?","!",";"],Pd=new Ad(20),kd=(t,e,r)=>{e=e||"",r=r||"";const n=Td.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const a=Pd.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let s=!a.test(t);if(!s){const i=t.indexOf(r);i>0&&!a.test(t.substring(0,i))&&(s=!0)}return s},wn=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(r);let a=t;for(let s=0;s<n.length;){if(!a||typeof a!="object")return;let i,o="";for(let l=s;l<n.length;++l)if(l!==s&&(o+=r),o+=n[l],i=a[o],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<n.length-1)continue;s+=l-s+1;break}a=i}return a},tr=t=>t?.replace("_","-"),Id={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class kr{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||Id,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,a){return a&&!this.debug?null:(K(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new kr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new kr(this.logger,e)}}var Fe=new kr;class Br{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const a=this.observers[n].get(r)||0;this.observers[n].set(r,a+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a.apply(a,[e,...r])})}}class ka extends Br{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,a={}){const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,r],n&&(Array.isArray(n)?o.push(...n):K(n)&&s?o.push(...n.split(s)):o.push(n)));const l=Pr(this.data,o);return!l&&!r&&!n&&e.indexOf(".")>-1&&(e=o[0],r=o[1],n=o.slice(2).join(".")),l||!i||!K(n)?l:wn(this.data?.[e]?.[r],n,s)}addResource(e,r,n,a,s={silent:!1}){const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let o=[e,r];n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."),a=r,r=o[1]),this.addNamespaces(r),Pa(this.data,o,a),s.silent||this.emit("added",e,r,n,a)}addResources(e,r,n,a={silent:!1}){for(const s in n)(K(n[s])||Array.isArray(n[s]))&&this.addResource(e,r,s,n[s],{silent:!0});a.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,a,s,i={silent:!1,skipCopy:!1}){let o=[e,r];e.indexOf(".")>-1&&(o=e.split("."),a=n,n=r,r=o[1]),this.addNamespaces(r);let l=Pr(this.data,o)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),a?li(l,n,s):l={...l,...n},Pa(this.data,o,l),i.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(a=>r[a]&&Object.keys(r[a]).length>0)}toJSON(){return this.data}}var ci={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,a){return t.forEach(s=>{e=this.processors[s]?.process(e,r,n,a)??e}),e}};const di=Symbol("i18next/PATH_KEY");function jd(){const t=[],e=Object.create(null);let r;return e.get=(n,a)=>(r?.revoke?.(),a===di?t:(t.push(a),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function Ir(t,e){const{[di]:r}=t(jd());return r.join(e?.keySeparator??".")}const Ia={},en=t=>!K(t)&&typeof t!="boolean"&&typeof t!="number";class jr extends Br{constructor(e,r={}){super(),Nd(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Fe.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){const n={...r};if(e==null)return!1;const a=this.resolve(e,n);if(a?.res===void 0)return!1;const s=en(a.res);return!(n.returnObjects===!1&&s)}extractFromKey(e,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let s=r.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!kd(e,n,a);if(i&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:K(s)?[s]:s};const c=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(a)}return{key:e,namespaces:K(s)?[s]:s}}translate(e,r,n){let a=typeof r=="object"?{...r}:r;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=Ir(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]);const s=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],a),c=l[l.length-1];let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const d=a.lng||this.language,f=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return f?s?{res:`${c}${u}${o}`,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:`${c}${u}${o}`:s?{res:o,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:o;const h=this.resolve(e,a);let v=h?.res;const E=h?.usedKey||o,b=h?.exactUsedKey||o,C=["[object Number]","[object Function]","[object RegExp]"],N=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,R=a.count!==void 0&&!K(a.count),A=jr.hasDefaultValue(a),M=R?this.pluralResolver.getSuffix(d,a.count,a):"",g=a.ordinal&&R?this.pluralResolver.getSuffix(d,a.count,{ordinal:!1}):"",S=R&&!a.ordinal&&a.count===0,U=S&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${M}`]||a[`defaultValue${g}`]||a.defaultValue;let V=v;k&&!v&&A&&(V=U);const G=en(V),z=Object.prototype.toString.apply(V);if(k&&V&&G&&C.indexOf(z)<0&&!(K(N)&&Array.isArray(V))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ee=this.options.returnedObjectHandler?this.options.returnedObjectHandler(E,V,{...a,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(h.res=ee,h.usedParams=this.getUsedParamsDetails(a),h):ee}if(i){const ee=Array.isArray(V),ne=ee?[]:{},Re=ee?b:E;for(const Ce in V)if(Object.prototype.hasOwnProperty.call(V,Ce)){const oe=`${Re}${i}${Ce}`;A&&!v?ne[Ce]=this.translate(oe,{...a,defaultValue:en(U)?U[Ce]:void 0,joinArrays:!1,ns:l}):ne[Ce]=this.translate(oe,{...a,joinArrays:!1,ns:l}),ne[Ce]===oe&&(ne[Ce]=V[Ce])}v=ne}}else if(k&&K(N)&&Array.isArray(v))v=v.join(N),v&&(v=this.extendTranslation(v,e,a,n));else{let ee=!1,ne=!1;!this.isValidLookup(v)&&A&&(ee=!0,v=U),this.isValidLookup(v)||(ne=!0,v=o);const Ce=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ne?void 0:v,oe=A&&U!==v&&this.options.updateMissing;if(ne||ee||oe){if(this.logger.log(oe?"updateKey":"missingKey",d,c,o,oe?U:v),i){const ve=this.resolve(o,{...a,keySeparator:!1});ve&&ve.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ue=[];const Be=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Be&&Be[0])for(let ve=0;ve<Be.length;ve++)ue.push(Be[ve]);else this.options.saveMissingTo==="all"?ue=this.languageUtils.toResolveHierarchy(a.lng||this.language):ue.push(a.lng||this.language);const Ze=(ve,xe,Ae)=>{const Ye=A&&Ae!==v?Ae:Ce;this.options.missingKeyHandler?this.options.missingKeyHandler(ve,c,xe,Ye,oe,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(ve,c,xe,Ye,oe,a),this.emit("missingKey",ve,c,xe,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?ue.forEach(ve=>{const xe=this.pluralResolver.getSuffixes(ve,a);S&&a[`defaultValue${this.options.pluralSeparator}zero`]&&xe.indexOf(`${this.options.pluralSeparator}zero`)<0&&xe.push(`${this.options.pluralSeparator}zero`),xe.forEach(Ae=>{Ze([ve],o+Ae,a[`defaultValue${Ae}`]||U)})}):Ze(ue,o,U))}v=this.extendTranslation(v,e,a,h,n),ne&&v===o&&this.options.appendNamespaceToMissingKey&&(v=`${c}${u}${o}`),(ne||ee)&&this.options.parseMissingKeyHandler&&(v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${o}`:o,ee?v:void 0,a))}return s?(h.res=v,h.usedParams=this.getUsedParamsDetails(a),h):v}extendTranslation(e,r,n,a,s){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=K(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const d=e.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!K(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,n.lng||this.language||a.usedLng,n),l){const d=e.match(this.interpolator.nestingRegexp),f=d&&d.length;c<f&&(n.nest=!1)}!n.lng&&a&&a.res&&(n.lng=this.language||a.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>s?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,o=K(i)?[i]:i;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=ci.handle(o,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,a,s,i,o;return K(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(l,r),u=c.key;a=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=r.count!==void 0&&!K(r.count),h=f&&!r.ordinal&&r.count===0,v=r.context!==void 0&&(K(r.context)||typeof r.context=="number")&&r.context!=="",E=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(b=>{this.isValidLookup(n)||(o=b,!Ia[`${E[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(Ia[`${E[0]}-${b}`]=!0,this.logger.warn(`key "${a}" for languages "${E.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),E.forEach(C=>{if(this.isValidLookup(n))return;i=C;const N=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(N,u,C,b,r);else{let R;f&&(R=this.pluralResolver.getSuffix(C,r.count,r));const A=`${this.options.pluralSeparator}zero`,M=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(r.ordinal&&R.indexOf(M)===0&&N.push(u+R.replace(M,this.options.pluralSeparator)),N.push(u+R),h&&N.push(u+A)),v){const g=`${u}${this.options.contextSeparator||"_"}${r.context}`;N.push(g),f&&(r.ordinal&&R.indexOf(M)===0&&N.push(g+R.replace(M,this.options.pluralSeparator)),N.push(g+R),h&&N.push(g+A))}}let k;for(;k=N.pop();)this.isValidLookup(n)||(s=k,n=this.getResource(C,b,k,r))}))})}),{res:n,usedKey:a,exactUsedKey:s,usedLng:i,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,a):this.resourceStore.getResource(e,r,n,a)}getUsedParamsDetails(e={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!K(e.replace);let a=n?e.replace:e;if(n&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!n){a={...a};for(const s of r)delete a[s]}return a}static hasDefaultValue(e){const r="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}}class ja{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Fe.create("languageUtils")}getScriptPartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=tr(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(K(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;const a=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(a))&&(r=a)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;const a=this.getScriptPartFromCode(n);if(this.isSupportedCode(a))return r=a;const s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return r=s;r=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),K(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),a=[],s=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return K(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):K(e)&&s(this.formatLanguageCode(e)),n.forEach(i=>{a.indexOf(i)<0&&s(this.formatLanguageCode(i))}),a}}const Ma={zero:0,one:1,two:2,few:3,many:4,other:5},Ha={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Md{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Fe.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){const n=tr(e==="dev"?"en":e),a=r.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:n,type:a});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let i;try{i=new Intl.PluralRules(n,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Ha;if(!e.match(/-|_/))return Ha;const l=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(l,r)}return this.pluralRulesCache[s]=i,i}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(a=>`${r}${a}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((a,s)=>Ma[a]-Ma[s]).map(a=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,r,n={}){const a=this.getRule(e,n);return a?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}}const Fa=(t,e,r,n=".",a=!0)=>{let s=Od(t,e,r);return!s&&a&&K(r)&&(s=wn(t,r,n),s===void 0&&(s=wn(e,r,n))),s},tn=t=>t.replace(/\$/g,"$$$$");class Hd{constructor(e={}){this.logger=Fe.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:a,prefix:s,prefixEscaped:i,suffix:o,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:v,nestingSuffixEscaped:E,nestingOptionsSeparator:b,maxReplaces:C,alwaysFormat:N}=e.interpolation;this.escape=r!==void 0?r:Ld,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?wt(s):i||"{{",this.suffix=o?wt(o):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=f?wt(f):h||wt("$t("),this.nestingSuffix=v?wt(v):E||wt(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=C||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,a){let s,i,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const C=Fa(r,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,n,{...a,...r,interpolationkey:h}):C}const v=h.split(this.formatSeparator),E=v.shift().trim(),b=v.join(this.formatSeparator).trim();return this.format(Fa(r,l,E,this.options.keySeparator,this.options.ignoreJSONStructure),b,n,{...a,...r,interpolationkey:E})};this.resetRegExp();const u=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>tn(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?tn(this.escape(h)):tn(h)}].forEach(h=>{for(o=0;s=h.regex.exec(e);){const v=s[1].trim();if(i=c(v),i===void 0)if(typeof u=="function"){const b=u(e,s,a);i=K(b)?b:""}else if(a&&Object.prototype.hasOwnProperty.call(a,v))i="";else if(d){i=s[0];continue}else this.logger.warn(`missed to pass in variable ${v} for interpolating ${e}`),i="";else!K(i)&&!this.useRawValueToEscape&&(i=La(i));const E=h.safeValue(i);if(e=e.replace(s[0],E),d?(h.regex.lastIndex+=i.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,r,n={}){let a,s,i;const o=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,i);const h=f.match(/'/g),v=f.match(/"/g);((h?.length??0)%2===0&&!v||v.length%2!==0)&&(f=f.replace(/'/g,'"'));try{i=JSON.parse(f),c&&(i={...c,...i})}catch(E){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,E),`${l}${u}${f}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;a=this.nestingRegexp.exec(e);){let l=[];i={...n},i=i.replace&&!K(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(c!==-1&&(l=a[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),a[1]=a[1].slice(0,c)),s=r(o.call(this,a[1].trim(),i),i),s&&a[0]===e&&!K(s))return s;K(s)||(s=La(s)),s||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),s=""),l.length&&(s=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:a[1].trim()}),s.trim())),e=e.replace(a[0],s),this.regexp.lastIndex=0}return e}}const Fd=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const a=n[1].substring(0,n[1].length-1);e==="currency"&&a.indexOf(":")<0?r.currency||(r.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?r.range||(r.range=a.trim()):a.split(";").forEach(i=>{if(i){const[o,...l]=i.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=o.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:r}},Va=t=>{const e={};return(r,n,a)=>{let s=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(s={...s,[a.interpolationkey]:void 0});const i=n+JSON.stringify(s);let o=e[i];return o||(o=t(tr(n),a),e[i]=o),o(r)}},Vd=t=>(e,r,n)=>t(tr(r),n)(e);class Bd{constructor(e={}){this.logger=Fe.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?Va:Vd;this.formats={number:n((a,s)=>{const i=new Intl.NumberFormat(a,{...s});return o=>i.format(o)}),currency:n((a,s)=>{const i=new Intl.NumberFormat(a,{...s,style:"currency"});return o=>i.format(o)}),datetime:n((a,s)=>{const i=new Intl.DateTimeFormat(a,{...s});return o=>i.format(o)}),relativetime:n((a,s)=>{const i=new Intl.RelativeTimeFormat(a,{...s});return o=>i.format(o,s.range||"day")}),list:n((a,s)=>{const i=new Intl.ListFormat(a,{...s});return o=>i.format(o)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=Va(r)}format(e,r,n,a={}){const s=r.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(o=>o.indexOf(")")>-1)){const o=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,o)].join(this.formatSeparator)}return s.reduce((o,l)=>{const{formatName:c,formatOptions:u}=Fd(l);if(this.formats[c]){let d=o;try{const f=a?.formatParams?.[a.interpolationkey]||{},h=f.locale||f.lng||a.locale||a.lng||n;d=this.formats[c](o,h,{...u,...a,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return o},e)}}const Ud=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class $d extends Br{constructor(e,r,n,a={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=Fe.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,a.backend,a)}queueLoad(e,r,n,a){const s={},i={},o={},l={};return e.forEach(c=>{let u=!0;r.forEach(d=>{const f=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?i[f]===void 0&&(i[f]=!0):(this.state[f]=1,u=!1,i[f]===void 0&&(i[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(o[c]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){const a=e.split("|"),s=a[0],i=a[1];r&&this.emit("failedLoading",s,i,r),!r&&n&&this.store.addResourceBundle(s,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);const o={};this.queue.forEach(l=>{wd(l.loaded,[s],i),Ud(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{o[c]||(o[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{o[c][d]===void 0&&(o[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,a=0,s=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:a,wait:s,callback:i});return}this.readingCalls++;const o=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,a+1,s*2,i)},s);return}i(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const c=l(e,r);c&&typeof c.then=="function"?c.then(u=>o(null,u)).catch(o):o(null,c)}catch(c){o(c)}return}return l(e,r,o)}prepareLoading(e,r,n={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();K(e)&&(e=this.languageUtils.toResolveHierarchy(e)),K(r)&&(r=[r]);const s=this.queueLoad(e,r,n,a);if(!s.toLoad.length)return s.pending.length||a(),null;s.toLoad.forEach(i=>{this.loadOne(i)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){const n=e.split("|"),a=n[0],s=n[1];this.read(a,s,"read",void 0,void 0,(i,o)=>{i&&this.logger.warn(`${r}loading namespace ${s} for language ${a} failed`,i),!i&&o&&this.logger.log(`${r}loaded namespace ${s} for language ${a}`,o),this.loaded(e,i,o)})}saveMissing(e,r,n,a,s,i={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...i,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,r,n,a,l):u=c(e,r,n,a),u&&typeof u.then=="function"?u.then(d=>o(null,d)).catch(o):o(null,u)}catch(u){o(u)}else c(e,r,n,a,o,l)}!e||!e[0]||this.store.addResource(e[0],r,n,a)}}}const Ba=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),K(t[1])&&(e.defaultValue=t[1]),K(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ua=t=>(K(t.ns)&&(t.ns=[t.ns]),K(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),K(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),_r=()=>{},zd=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class rr extends Br{constructor(e={},r){if(super(),this.options=Ua(e),this.services={},this.logger=Fe,this.modules={external:[]},zd(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(K(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=Ba();this.options={...n,...this.options,...Ua(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const a=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Fe.init(a(this.modules.logger),this.options):Fe.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Bd;const u=new ja(this.options);this.store=new ka(this.options.resources,this.options);const d=this.services;d.logger=Fe,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new Md(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=a(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new Hd(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new $d(a(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(h,...v)=>{this.emit(h,...v)}),this.modules.languageDetector&&(d.languageDetector=a(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=a(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new jr(this.services,this.options),this.translator.on("*",(h,...v)=>{this.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=_r),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});const o=Wt(),l=()=>{const c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(d),r(u,d)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,r=_r){let n=r;const a=K(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const s=[],i=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};a?i(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload?.forEach?.(o=>i(o)),this.services.backendConnector.load(s,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(o)})}else n(null)}reloadResources(e,r,n){const a=Wt();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=_r),this.services.backendConnector.reload(e,r,s=>{a.resolve(),n(s)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ci.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;const n=Wt();this.emit("languageChanging",e);const a=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},s=(o,l)=>{l?this.isLanguageChangingTo===e&&(a(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(o,(...c)=>this.t(...c))},i=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);const l=K(o)?o:o&&o[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(K(o)?[o]:o);c&&(this.language||a(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{s(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),n}getFixedT(e,r,n){const a=(s,i,...o)=>{let l;typeof i!="object"?l=this.options.overloadTranslationOptionHandler([s,i].concat(o)):l={...i},l.lng=l.lng||a.lng,l.lngs=l.lngs||a.lngs,l.ns=l.ns||a.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||a.keyPrefix);const c=this.options.keySeparator||".";let u;return l.keyPrefix&&Array.isArray(s)?u=s.map(d=>(typeof d=="function"&&(d=Ir(d,{...this.options,...i})),`${l.keyPrefix}${c}${d}`)):(typeof s=="function"&&(s=Ir(s,{...this.options,...i})),u=l.keyPrefix?`${l.keyPrefix}${c}${s}`:s),this.t(u,l)};return K(e)?a.lng=e:a.lngs=e,a.ns=r,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(o,l)=>{const c=this.services.backendConnector.state[`${o}|${l}`];return c===-1||c===0||c===2};if(r.precheck){const o=r.precheck(this,i);if(o!==void 0)return o}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!a||i(s,e)))}loadNamespaces(e,r){const n=Wt();return this.options.ns?(K(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{n.resolve(),r&&r(a)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){const n=Wt();K(e)&&(e=[e]);const a=this.options.preload||[],s=e.filter(i=>a.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return s.length?(this.options.preload=a.concat(s),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const s=a.getTextInfo();if(s&&s.direction)return s.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new ja(Ba());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new rr(e,r)}cloneInstance(e={},r=_r){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},s=new rr(a);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(o=>{s[o]=this[o]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},n){const o=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});s.store=new ka(o,a),s.services.resourceStore=s.store}return s.translator=new jr(s.services,a),s.translator.on("*",(o,...l)=>{s.emit(o,...l)}),s.init(a,r),s.translator.options=a,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ne=rr.createInstance();Ne.createInstance=rr.createInstance;Ne.createInstance;Ne.dir;Ne.init;Ne.loadResources;Ne.reloadResources;Ne.use;Ne.changeLanguage;Ne.getFixedT;const Ig=Ne.t;Ne.exists;Ne.setDefaultNamespace;Ne.hasLoadedNamespace;Ne.loadNamespaces;Ne.loadLanguages;var rn,$a;function Wd(){return $a||($a=1,rn={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}),rn}var Kd=Wd();const Zd=xc(Kd);var Yd=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function za(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(Zd[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 a=new RegExp(Yd),s=null;(s=a.exec(t))!==null;)if(s[0].trim())if(s[1]){var i=s[1].trim(),o=[i,""];i.indexOf("=")>-1&&(o=i.split("=")),e.attrs[o[0]]=o[1],a.lastIndex--}else s[2]&&(e.attrs[s[2]]=s[3].trim().substring(1,s[3].length-1));return e}var Gd=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Jd=/^\s*$/,qd=Object.create(null);function ui(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 a in r)n.push(a+'="'+r[a]+'"');return n.length?" "+n.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(ui,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Xd={parse:function(t,e){e||(e={}),e.components||(e.components=qd);var r,n=[],a=[],s=-1,i=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(Gd,function(l,c){if(i){if(l!=="</"+r.name+">")return;i=!1}var u,d=l.charAt(1)!=="/",f=l.startsWith("<!--"),h=c+l.length,v=t.charAt(h);if(f){var E=za(l);return s<0?(n.push(E),n):((u=a[s]).children.push(E),n)}if(d&&(s++,(r=za(l)).type==="tag"&&e.components[r.name]&&(r.type="component",i=!0),r.voidElement||i||!v||v==="<"||r.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),s===0&&n.push(r),(u=a[s-1])&&u.children.push(r),a[s]=r),(!d||r.voidElement)&&(s>-1&&(r.voidElement||r.name===l.slice(2,-1))&&(s--,r=s===-1?n:a[s]),!i&&v!=="<"&&v)){u=s===-1?n:a[s].children;var b=t.indexOf("<",h),C=t.slice(h,b===-1?void 0:b);Jd.test(C)&&(C=" "),(b>-1&&s+u.length>=0||C!==" ")&&u.push({type:"text",content:C})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+ui("",r)},"")}};const br=(t,e,r,n)=>{const a=[r,{code:e,...n||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);ke(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...a):console?.warn&&console.warn(...a)},Wa={},Ur=(t,e,r,n)=>{ke(r)&&Wa[r]||(ke(r)&&(Wa[r]=new Date),br(t,e,r,n))},fi=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},On=(t,e,r)=>{t.loadNamespaces(e,fi(t,r))},Ka=(t,e,r,n)=>{if(ke(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return On(t,r,n);r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,fi(t,n))},Qd=(t,e,r={})=>!e.languages||!e.languages.length?(Ur(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,t))return!1}}),ke=t=>typeof t=="string",rt=t=>typeof t=="object"&&t!==null,eu=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,tu={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},ru=t=>tu[t],nu=t=>t.replace(eu,ru);let Dn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:nu};const au=(t={})=>{Dn={...Dn,...t}},hi=()=>Dn;let pi;const su=t=>{pi=t},zn=()=>pi,nn=(t,e)=>{if(!t)return!1;const r=t.props?.children??t.children;return e?r.length>0:!!r},an=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?Pt(e):e},iu=t=>Array.isArray(t)&&t.every(m.isValidElement),Pt=t=>Array.isArray(t)?t:[t],ou=(t,e)=>{const r={...e};return r.props=Object.assign(t.props,e.props),r},mi=(t,e,r,n)=>{if(!t)return"";let a="";const s=Pt(t),i=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((o,l)=>{if(ke(o)){a+=`${o}`;return}if(m.isValidElement(o)){const{props:c,type:u}=o,d=Object.keys(c).length,f=i.indexOf(u)>-1,h=c.children;if(!h&&f&&!d){a+=`<${u}/>`;return}if(!h&&(!f||d)||c.i18nIsDynamicList){a+=`<${l}></${l}>`;return}if(f&&d===1&&ke(h)){a+=`<${u}>${h}</${u}>`;return}const v=mi(h,e,r,n);a+=`<${l}>${v}</${l}>`;return}if(o===null){br(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(rt(o)){const{format:c,...u}=o,d=Object.keys(u);if(d.length===1){const f=c?`${d[0]}, ${c}`:d[0];a+=`{{${f}}}`;return}br(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:o});return}br(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:o})}),a},lu=(t,e=[],r={})=>{if(!t)return t;const n=Object.keys(r),a=[...e,...n];let s="",i=0;for(;i<t.length;)if(t[i]==="<"){let o=!1;const l=t.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9-]*)>/);if(l){const c=l[1];(/^\d+$/.test(c)||a.includes(c))&&(o=!0,s+=l[0],i+=l[0].length)}if(!o){const c=t.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const u=c[1];(/^\d+$/.test(u)||a.includes(u))&&(o=!0,s+=c[0],i+=c[0].length)}}o||(s+="&lt;",i+=1)}else s+=t[i],i+=1;return s},cu=(t,e,r,n,a,s,i)=>{if(r==="")return[];const o=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(o.map(N=>`<${N}`).join("|")).test(r);if(!t&&!e&&!l&&!i)return[r];const c=e??{},u=N=>{Pt(N).forEach(R=>{ke(R)||(nn(R)?u(an(R)):rt(R)&&!m.isValidElement(R)&&Object.assign(c,R))})};u(t);const d=lu(r,o,c),f=Xd.parse(`<0>${d}</0>`),h={...c,...s},v=(N,k,R)=>{const A=an(N),M=b(A,k.children,R);return iu(A)&&M.length===0||N.props?.i18nIsDynamicList?A:M},E=(N,k,R,A,M)=>{N.dummy?(N.children=k,R.push(m.cloneElement(N,{key:A},M?void 0:k))):R.push(...m.Children.map([N],g=>{const S={...g.props};return delete S.i18nIsDynamicList,m.createElement(g.type,{...S,key:A,ref:g.props.ref??g.ref},M?null:k)}))},b=(N,k,R)=>{const A=Pt(N);return Pt(k).reduce((g,S,U)=>{const V=S.children?.[0]?.content&&n.services.interpolator.interpolate(S.children[0].content,h,n.language);if(S.type==="tag"){let G=A[parseInt(S.name,10)];!G&&e&&(G=e[S.name]),R.length===1&&!G&&(G=R[0][S.name]),G||(G={});const z=Object.keys(S.attrs).length!==0?ou({props:S.attrs},G):G,ee=m.isValidElement(z),ne=ee&&nn(S,!0)&&!S.voidElement,Re=l&&rt(z)&&z.dummy&&!ee,Ce=rt(e)&&Object.hasOwnProperty.call(e,S.name);if(ke(z)){const oe=n.services.interpolator.interpolate(z,h,n.language);g.push(oe)}else if(nn(z)||ne){const oe=v(z,S,R);E(z,oe,g,U)}else if(Re){const oe=b(A,S.children,R);E(z,oe,g,U)}else if(Number.isNaN(parseFloat(S.name)))if(Ce){const oe=v(z,S,R);E(z,oe,g,U,S.voidElement)}else if(a.transSupportBasicHtmlNodes&&o.indexOf(S.name)>-1)if(S.voidElement)g.push(m.createElement(S.name,{key:`${S.name}-${U}`}));else{const oe=b(A,S.children,R);g.push(m.createElement(S.name,{key:`${S.name}-${U}`},oe))}else if(S.voidElement)g.push(`<${S.name} />`);else{const oe=b(A,S.children,R);g.push(`<${S.name}>${oe}</${S.name}>`)}else if(rt(z)&&!ee){const oe=S.children[0]?V:null;oe&&g.push(oe)}else E(z,V,g,U,S.children.length!==1||!V)}else if(S.type==="text"){const G=a.transWrapTextNodes,z=i?a.unescape(n.services.interpolator.interpolate(S.content,h,n.language)):n.services.interpolator.interpolate(S.content,h,n.language);G?g.push(m.createElement(G,{key:`${S.name}-${U}`},z)):g.push(z)}return g},[])},C=b([{dummy:!0,children:t||[]}],f,Pt(t||[]));return an(C[0])},gi=(t,e,r)=>{const n=t.key||e,a=m.cloneElement(t,{key:n});if(!a.props||!a.props.children||r.indexOf(`${e}/>`)<0&&r.indexOf(`${e} />`)<0)return a;function s(){return m.createElement(m.Fragment,null,a)}return m.createElement(s,{key:n})},du=(t,e)=>t.map((r,n)=>gi(r,n,e)),uu=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:gi(t[n],n,e)})}),r},fu=(t,e,r,n)=>t?Array.isArray(t)?du(t,e):rt(t)?uu(t,e):(Ur(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,hu=t=>!rt(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function pu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s={},values:i,defaults:o,components:l,ns:c,i18n:u,t:d,shouldUnescape:f,...h}){const v=u||zn();if(!v)return Ur(v,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const E=d||v.t.bind(v)||(ne=>ne),b={...hi(),...v.options?.react};let C=c||E.ns||v.options?.defaultNS;C=ke(C)?[C]:C||["translation"];const N=mi(t,b,v,n),k=o||s?.defaultValue||N||b.transEmptyNodeValue||(typeof n=="function"?Ir(n):n),{hashTransKey:R}=b,A=n||(R?R(N||k):N||k);v.options?.interpolation?.defaultVariables&&(i=i&&Object.keys(i).length>0?{...i,...v.options.interpolation.defaultVariables}:{...v.options.interpolation.defaultVariables});const M=i||e!==void 0&&!v.options?.interpolation?.alwaysFormat||!t?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},g={...s,context:a||s.context,count:e,...i,...M,defaultValue:o||s?.defaultValue,ns:C};let S=A?E(A,g):k;S===A&&k&&(S=k);const U=fu(l,S,v,n);let V=U||t,G=null;hu(U)&&(G=U,V=t);const z=cu(V,G,S,v,b,g,f),ee=r??b.defaultTransParent;return ee?m.createElement(ee,h,z):z}const mu={type:"3rdParty",init(t){au(t.options.react),su(t)}},vi=m.createContext();class gu{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function vu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s={},values:i,defaults:o,components:l,ns:c,i18n:u,t:d,shouldUnescape:f,...h}){const{i18n:v,defaultNS:E}=m.useContext(vi)||{},b=u||v||zn(),C=d||b?.t.bind(b);return pu({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:s,values:i,defaults:o,components:l,ns:c||C?.ns||E||b?.options?.defaultNS,i18n:b,t:d,shouldUnescape:f,...h})}var sn={exports:{}},on={};var Za;function yu(){if(Za)return on;Za=1;var t=bc();function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,s=t.useLayoutEffect,i=t.useDebugValue;function o(d,f){var h=f(),v=n({inst:{value:h,getSnapshot:f}}),E=v[0].inst,b=v[1];return s(function(){E.value=h,E.getSnapshot=f,l(E)&&b({inst:E})},[d,h,f]),a(function(){return l(E)&&b({inst:E}),d(function(){l(E)&&b({inst:E})})},[d]),i(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!r(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return on.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,on}var Ya;function _u(){return Ya||(Ya=1,sn.exports=yu()),sn.exports}var Eu=_u();const Cu=(t,e)=>ke(e)?e:rt(e)&&ke(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,xu={t:Cu,ready:!1},bu=()=>()=>{},yi=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:a}=m.useContext(vi)||{},s=r||n||zn();s&&!s.reportNamespaces&&(s.reportNamespaces=new gu),s||Ur(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=m.useMemo(()=>({...hi(),...s?.options?.react,...e}),[s,e]),{useSuspense:o,keyPrefix:l}=i,c=m.useMemo(()=>{const R=a||s?.options?.defaultNS;return ke(R)?[R]:R||["translation"]},[t,a,s]);s?.reportNamespaces?.addUsedNamespaces?.(c);const u=m.useRef(0),d=m.useCallback(R=>{if(!s)return bu;const{bindI18n:A,bindI18nStore:M}=i,g=()=>{u.current+=1,R()};return A&&s.on(A,g),M&&s.store.on(M,g),()=>{A&&A.split(" ").forEach(S=>s.off(S,g)),M&&M.split(" ").forEach(S=>s.store.off(S,g))}},[s,i]),f=m.useRef(),h=m.useCallback(()=>{if(!s)return xu;const R=!!(s.isInitialized||s.initializedStoreOnce)&&c.every(V=>Qd(V,s,i)),A=e.lng||s.language,M=u.current,g=f.current;if(g&&g.ready===R&&g.lng===A&&g.keyPrefix===l&&g.revision===M)return g;const U={t:s.getFixedT(A,i.nsMode==="fallback"?c:c[0],l),ready:R,lng:A,keyPrefix:l,revision:M};return f.current=U,U},[s,c,l,i,e.lng]),[v,E]=m.useState(0),{t:b,ready:C}=Eu.useSyncExternalStore(d,h,h);m.useEffect(()=>{if(s&&!C&&!o){const R=()=>E(A=>A+1);e.lng?Ka(s,e.lng,c,R):On(s,c,R)}},[s,e.lng,c,C,o,v]);const N=s||{},k=m.useMemo(()=>{const R=[b,N,C];return R.t=b,R.i18n=N,R.ready=C,R},[b,N,C]);if(s&&o&&!C)throw new Promise(R=>{const A=()=>R();e.lng?Ka(s,e.lng,c,A):On(s,c,A)});return k},Su=()=>{const{t}=yi();return _.jsxs("div",{children:[_.jsx("p",{className:"font-medium",children:t("notifications.reloadApp")}),_.jsxs("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},Nu=()=>{async function t(){const e=await Ah();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;ge.studioMode||!ge.warnOutdatedApp?te.warn(`Connect is outdated:
3
3
  Current: ${e.currentVersion}
4
- Latest: ${e.latestVersion}`):or(m.createElement(Su),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}m.useEffect(()=>{t().catch(console.error)},[])},Ru=ge.routerBasename,_i=`${Ru}:display-cookie-banner`,Ga=new Set;let Ei=wu();function wu(){try{return localStorage.getItem(_i)!=="false"}catch(t){return console.error(t),!0}}function Ja(){return Ei}function Ou(t){Ei=t,localStorage.setItem(_i,JSON.stringify(t))}function Du(t){return Ga.add(t),()=>Ga.delete(t)}const Lu=()=>[m.useSyncExternalStore(Du,Ja,Ja),Ou];function fe(){return fe=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},fe.apply(this,arguments)}var _e;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(_e||(_e={}));const qa="popstate";function Au(t){t===void 0&&(t={});function e(n,a){let{pathname:s,search:i,hash:o}=n.location;return nr("",{pathname:s,search:i,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:lr(a)}return Pu(e,r,null,t)}function q(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vt(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Tu(){return Math.random().toString(36).substr(2,8)}function Xa(t,e){return{usr:t.state,key:t.key,idx:e}}function nr(t,e,r,n){return r===void 0&&(r=null),fe({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?dt(e):e,{state:r,key:e&&e.key||n||Tu()})}function lr(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function dt(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function Pu(t,e,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:s=!1}=n,i=a.history,o=_e.Pop,l=null,c=d();c==null&&(c=0,i.replaceState(fe({},i.state,{idx:c}),""));function d(){return(i.state||{idx:null}).idx}function u(){o=_e.Pop;let b=d(),C=b==null?null:b-c;c=b,l&&l({action:o,location:E.location,delta:C})}function f(b,C){o=_e.Push;let S=nr(E.location,b,C);c=d()+1;let k=Xa(S,c),N=E.createHref(S);try{i.pushState(k,"",N)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(N)}s&&l&&l({action:o,location:E.location,delta:1})}function h(b,C){o=_e.Replace;let S=nr(E.location,b,C);c=d();let k=Xa(S,c),N=E.createHref(S);i.replaceState(k,"",N),s&&l&&l({action:o,location:E.location,delta:0})}function g(b){let C=a.location.origin!=="null"?a.location.origin:a.location.href,S=typeof b=="string"?b:lr(b);return S=S.replace(/ $/,"%20"),q(C,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,C)}let E={get action(){return o},get location(){return t(a,i)},listen(b){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(qa,u),l=b,()=>{a.removeEventListener(qa,u),l=null}},createHref(b){return e(a,b)},createURL:g,encodeLocation(b){let C=g(b);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:f,replace:h,go(b){return i.go(b)}};return E}var le;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(le||(le={}));const ku=new Set(["lazy","caseSensitive","path","id","index","children"]);function Iu(t){return t.index===!0}function Mr(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((a,s)=>{let i=[...r,String(s)],o=typeof a.id=="string"?a.id:i.join("-");if(q(a.index!==!0||!a.children,"Cannot specify children on an index route"),q(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),Iu(a)){let l=fe({},a,e(a),{id:o});return n[o]=l,l}else{let l=fe({},a,e(a),{id:o,children:void 0});return n[o]=l,a.children&&(l.children=Mr(a.children,e,i,n)),l}})}function Qe(t,e,r){return r===void 0&&(r="/"),Sr(t,e,r,!1)}function Sr(t,e,r,n){let a=typeof e=="string"?dt(e):e,s=cr(a.pathname||"/",r);if(s==null)return null;let i=Ci(t);Mu(i);let o=null;for(let l=0;o==null&&l<i.length;++l){let c=Yu(s);o=Ku(i[l],c,n)}return o}function ju(t,e){let{route:r,pathname:n,params:a}=t;return{id:r.id,pathname:n,params:a,data:e[r.id],handle:r.handle}}function Ci(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(s,i,o)=>{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};l.relativePath.startsWith("/")&&(q(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=ot([n,l.relativePath]),d=r.concat(l);s.children&&s.children.length>0&&(q(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ci(s.children,e,d,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:zu(c,s.index),routesMeta:d})};return t.forEach((s,i)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))a(s,i);else for(let l of xi(s.path))a(s,i,l)}),e}function xi(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,a=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return a?[s,""]:[s];let i=xi(n.join("/")),o=[];return o.push(...i.map(l=>l===""?s:[s,l].join("/"))),a&&o.push(...i),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function Mu(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Wu(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Hu=/^:[\w-]+$/,Fu=3,Vu=2,Bu=1,Uu=10,$u=-2,Qa=t=>t==="*";function zu(t,e){let r=t.split("/"),n=r.length;return r.some(Qa)&&(n+=$u),e&&(n+=Vu),r.filter(a=>!Qa(a)).reduce((a,s)=>a+(Hu.test(s)?Fu:s===""?Bu:Uu),n)}function Wu(t,e){return t.length===e.length&&t.slice(0,-1).every((n,a)=>n===e[a])?t[t.length-1]-e[e.length-1]:0}function Ku(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,a={},s="/",i=[];for(let o=0;o<n.length;++o){let l=n[o],c=o===n.length-1,d=s==="/"?e:e.slice(s.length)||"/",u=es({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),f=l.route;if(!u&&c&&r&&!n[n.length-1].route.index&&(u=es({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!u)return null;Object.assign(a,u.params),i.push({params:a,pathname:ot([s,u.pathname]),pathnameBase:qu(ot([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=ot([s,u.pathnameBase]))}return i}function es(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=Zu(t.path,t.caseSensitive,t.end),a=e.match(r);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:n.reduce((c,d,u)=>{let{paramName:f,isOptional:h}=d;if(f==="*"){let E=o[u]||"";i=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const g=o[u];return h&&!g?c[f]=void 0:c[f]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:t}}function Zu(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Vt(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),n]}function Yu(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vt(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function cr(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Gu(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?dt(t):t;return{pathname:r?r.startsWith("/")?r:Ju(r,e):e,search:Xu(n),hash:Qu(a)}}function Ju(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function ln(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function bi(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Si(t,e){let r=bi(t);return e?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Ni(t,e,r,n){n===void 0&&(n=!1);let a;typeof t=="string"?a=dt(t):(a=fe({},t),q(!a.pathname||!a.pathname.includes("?"),ln("?","pathname","search",a)),q(!a.pathname||!a.pathname.includes("#"),ln("#","pathname","hash",a)),q(!a.search||!a.search.includes("#"),ln("#","search","hash",a)));let s=t===""||a.pathname==="",i=s?"/":a.pathname,o;if(i==null)o=r;else{let u=e.length-1;if(!n&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),u-=1;a.pathname=f.join("/")}o=u>=0?e[u]:"/"}let l=Gu(a,o),c=i&&i!=="/"&&i.endsWith("/"),d=(s||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const ot=t=>t.join("/").replace(/\/\/+/g,"/"),qu=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Xu=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Qu=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class Hr{constructor(e,r,n,a){a===void 0&&(a=!1),this.status=e,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ar(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Ri=["post","put","patch","delete"],ef=new Set(Ri),tf=["get",...Ri],rf=new Set(tf),nf=new Set([301,302,303,307,308]),af=new Set([307,308]),cn={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},sf={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Kt={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Wn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,of=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),wi="remix-router-transitions";function lf(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;q(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(t.mapRouteProperties)a=t.mapRouteProperties;else if(t.detectErrorBoundary){let p=t.detectErrorBoundary;a=v=>({hasErrorBoundary:p(v)})}else a=of;let s={},i=Mr(t.routes,a,void 0,s),o,l=t.basename||"/",c=t.dataStrategy||ff,d=t.patchRoutesOnNavigation,u=fe({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,h=new Set,g=null,E=null,b=null,C=t.hydrationData!=null,S=Qe(i,t.history.location,l),k=!1,N=null;if(S==null&&!d){let p=Oe(404,{pathname:t.history.location.pathname}),{matches:v,route:x}=us(i);S=v,N={[x.id]:p}}S&&!t.hydrationData&&hr(S,i,t.history.location.pathname).active&&(S=null);let D;if(S)if(S.some(p=>p.route.lazy))D=!1;else if(!S.some(p=>p.route.loader))D=!0;else if(u.v7_partialHydration){let p=t.hydrationData?t.hydrationData.loaderData:null,v=t.hydrationData?t.hydrationData.errors:null;if(v){let x=S.findIndex(R=>v[R.route.id]!==void 0);D=S.slice(0,x+1).every(R=>!An(R.route,p,v))}else D=S.every(x=>!An(x.route,p,v))}else D=t.hydrationData!=null;else if(D=!1,S=[],u.v7_partialHydration){let p=hr(null,i,t.history.location.pathname);p.active&&p.matches&&(k=!0,S=p.matches)}let T,y={historyAction:t.history.action,location:t.history.location,matches:S,initialized:D,navigation:cn,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||N,fetchers:new Map,blockers:new Map},w=_e.Pop,U=!1,V,G=!1,z=new Map,ee=null,ne=!1,Re=!1,Ce=[],oe=new Set,ue=new Map,Be=0,Ze=-1,ve=new Map,xe=new Set,Ae=new Map,Ye=new Map,je=new Set,ht=new Map,pt=new Map,dr;function fo(){if(f=t.history.listen(p=>{let{action:v,location:x,delta:R}=p;if(dr){dr(),dr=void 0;return}Vt(pt.size===0||R!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let A=ia({currentLocation:y.location,nextLocation:x,historyAction:v});if(A&&R!=null){let $=new Promise(W=>{dr=W});t.history.go(R*-1),fr(A,{state:"blocked",location:x,proceed(){fr(A,{state:"proceeding",proceed:void 0,reset:void 0,location:x}),$.then(()=>t.history.go(R))},reset(){let W=new Map(y.blockers);W.set(A,Kt),we({blockers:W})}});return}return mt(v,x)}),r){Rf(e,z);let p=()=>wf(e,z);e.addEventListener("pagehide",p),ee=()=>e.removeEventListener("pagehide",p)}return y.initialized||mt(_e.Pop,y.location,{initialHydration:!0}),T}function ho(){f&&f(),ee&&ee(),h.clear(),V&&V.abort(),y.fetchers.forEach((p,v)=>ur(v)),y.blockers.forEach((p,v)=>sa(v))}function po(p){return h.add(p),()=>h.delete(p)}function we(p,v){v===void 0&&(v={}),y=fe({},y,p);let x=[],R=[];u.v7_fetcherPersist&&y.fetchers.forEach((A,$)=>{A.state==="idle"&&(je.has($)?R.push($):x.push($))}),je.forEach(A=>{!y.fetchers.has(A)&&!ue.has(A)&&R.push(A)}),[...h].forEach(A=>A(y,{deletedFetchers:R,viewTransitionOpts:v.viewTransitionOpts,flushSync:v.flushSync===!0})),u.v7_fetcherPersist?(x.forEach(A=>y.fetchers.delete(A)),R.forEach(A=>ur(A))):R.forEach(A=>je.delete(A))}function xt(p,v,x){var R,A;let{flushSync:$}=x===void 0?{}:x,W=y.actionData!=null&&y.navigation.formMethod!=null&&Me(y.navigation.formMethod)&&y.navigation.state==="loading"&&((R=p.state)==null?void 0:R._isRedirect)!==!0,j;v.actionData?Object.keys(v.actionData).length>0?j=v.actionData:j=null:W?j=y.actionData:j=null;let H=v.loaderData?cs(y.loaderData,v.loaderData,v.matches||[],v.errors):y.loaderData,I=y.blockers;I.size>0&&(I=new Map(I),I.forEach((Q,be)=>I.set(be,Kt)));let B=U===!0||y.navigation.formMethod!=null&&Me(y.navigation.formMethod)&&((A=p.state)==null?void 0:A._isRedirect)!==!0;o&&(i=o,o=void 0),ne||w===_e.Pop||(w===_e.Push?t.history.push(p,p.state):w===_e.Replace&&t.history.replace(p,p.state));let J;if(w===_e.Pop){let Q=z.get(y.location.pathname);Q&&Q.has(p.pathname)?J={currentLocation:y.location,nextLocation:p}:z.has(p.pathname)&&(J={currentLocation:p,nextLocation:y.location})}else if(G){let Q=z.get(y.location.pathname);Q?Q.add(p.pathname):(Q=new Set([p.pathname]),z.set(y.location.pathname,Q)),J={currentLocation:y.location,nextLocation:p}}we(fe({},v,{actionData:j,loaderData:H,historyAction:w,location:p,initialized:!0,navigation:cn,revalidation:"idle",restoreScrollPosition:la(p,v.matches||y.matches),preventScrollReset:B,blockers:I}),{viewTransitionOpts:J,flushSync:$===!0}),w=_e.Pop,U=!1,G=!1,ne=!1,Re=!1,Ce=[]}async function Xn(p,v){if(typeof p=="number"){t.history.go(p);return}let x=Ln(y.location,y.matches,l,u.v7_prependBasename,p,u.v7_relativeSplatPath,v?.fromRouteId,v?.relative),{path:R,submission:A,error:$}=ts(u.v7_normalizeFormMethod,!1,x,v),W=y.location,j=nr(y.location,R,v&&v.state);j=fe({},j,t.history.encodeLocation(j));let H=v&&v.replace!=null?v.replace:void 0,I=_e.Push;H===!0?I=_e.Replace:H===!1||A!=null&&Me(A.formMethod)&&A.formAction===y.location.pathname+y.location.search&&(I=_e.Replace);let B=v&&"preventScrollReset"in v?v.preventScrollReset===!0:void 0,J=(v&&v.flushSync)===!0,Q=ia({currentLocation:W,nextLocation:j,historyAction:I});if(Q){fr(Q,{state:"blocked",location:j,proceed(){fr(Q,{state:"proceeding",proceed:void 0,reset:void 0,location:j}),Xn(p,v)},reset(){let be=new Map(y.blockers);be.set(Q,Kt),we({blockers:be})}});return}return await mt(I,j,{submission:A,pendingError:$,preventScrollReset:B,replace:v&&v.replace,enableViewTransition:v&&v.viewTransition,flushSync:J})}function mo(){if(Gr(),we({revalidation:"loading"}),y.navigation.state!=="submitting"){if(y.navigation.state==="idle"){mt(y.historyAction,y.location,{startUninterruptedRevalidation:!0});return}mt(w||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:G===!0})}}async function mt(p,v,x){V&&V.abort(),V=null,w=p,ne=(x&&x.startUninterruptedRevalidation)===!0,No(y.location,y.matches),U=(x&&x.preventScrollReset)===!0,G=(x&&x.enableViewTransition)===!0;let R=o||i,A=x&&x.overrideNavigation,$=x!=null&&x.initialHydration&&y.matches&&y.matches.length>0&&!k?y.matches:Qe(R,v,l),W=(x&&x.flushSync)===!0;if($&&y.initialized&&!Re&&yf(y.location,v)&&!(x&&x.submission&&Me(x.submission.formMethod))){xt(v,{matches:$},{flushSync:W});return}let j=hr($,R,v.pathname);if(j.active&&j.matches&&($=j.matches),!$){let{error:de,notFoundMatches:ie,route:he}=Jr(v.pathname);xt(v,{matches:ie,loaderData:{},errors:{[he.id]:de}},{flushSync:W});return}V=new AbortController;let H=Ot(t.history,v,V.signal,x&&x.submission),I;if(x&&x.pendingError)I=[_t($).route.id,{type:le.error,error:x.pendingError}];else if(x&&x.submission&&Me(x.submission.formMethod)){let de=await go(H,v,x.submission,$,j.active,{replace:x.replace,flushSync:W});if(de.shortCircuited)return;if(de.pendingActionResult){let[ie,he]=de.pendingActionResult;if(De(he)&&ar(he.error)&&he.error.status===404){V=null,xt(v,{matches:de.matches,loaderData:{},errors:{[ie]:he.error}});return}}$=de.matches||$,I=de.pendingActionResult,A=dn(v,x.submission),W=!1,j.active=!1,H=Ot(t.history,H.url,H.signal)}let{shortCircuited:B,matches:J,loaderData:Q,errors:be}=await vo(H,v,$,j.active,A,x&&x.submission,x&&x.fetcherSubmission,x&&x.replace,x&&x.initialHydration===!0,W,I);B||(V=null,xt(v,fe({matches:J||$},ds(I),{loaderData:Q,errors:be})))}async function go(p,v,x,R,A,$){$===void 0&&($={}),Gr();let W=Sf(v,x);if(we({navigation:W},{flushSync:$.flushSync===!0}),A){let I=await pr(R,v.pathname,p.signal);if(I.type==="aborted")return{shortCircuited:!0};if(I.type==="error"){let B=_t(I.partialMatches).route.id;return{matches:I.partialMatches,pendingActionResult:[B,{type:le.error,error:I.error}]}}else if(I.matches)R=I.matches;else{let{notFoundMatches:B,error:J,route:Q}=Jr(v.pathname);return{matches:B,pendingActionResult:[Q.id,{type:le.error,error:J}]}}}let j,H=qt(R,v);if(!H.route.action&&!H.route.lazy)j={type:le.error,error:Oe(405,{method:p.method,pathname:v.pathname,routeId:H.route.id})};else if(j=(await Bt("action",y,p,[H],R,null))[H.route.id],p.signal.aborted)return{shortCircuited:!0};if(Et(j)){let I;return $&&$.replace!=null?I=$.replace:I=is(j.response.headers.get("Location"),new URL(p.url),l)===y.location.pathname+y.location.search,await gt(p,j,!0,{submission:x,replace:I}),{shortCircuited:!0}}if(nt(j))throw Oe(400,{type:"defer-action"});if(De(j)){let I=_t(R,H.route.id);return($&&$.replace)!==!0&&(w=_e.Push),{matches:R,pendingActionResult:[I.route.id,j]}}return{matches:R,pendingActionResult:[H.route.id,j]}}async function vo(p,v,x,R,A,$,W,j,H,I,B){let J=A||dn(v,$),Q=$||W||hs(J),be=!ne&&(!u.v7_partialHydration||!H);if(R){if(be){let pe=Qn(B);we(fe({navigation:J},pe!==void 0?{actionData:pe}:{}),{flushSync:I})}let ae=await pr(x,v.pathname,p.signal);if(ae.type==="aborted")return{shortCircuited:!0};if(ae.type==="error"){let pe=_t(ae.partialMatches).route.id;return{matches:ae.partialMatches,loaderData:{},errors:{[pe]:ae.error}}}else if(ae.matches)x=ae.matches;else{let{error:pe,notFoundMatches:St,route:zt}=Jr(v.pathname);return{matches:St,loaderData:{},errors:{[zt.id]:pe}}}}let de=o||i,[ie,he]=ns(t.history,y,x,Q,v,u.v7_partialHydration&&H===!0,u.v7_skipActionErrorRevalidation,Re,Ce,oe,je,Ae,xe,de,l,B);if(qr(ae=>!(x&&x.some(pe=>pe.route.id===ae))||ie&&ie.some(pe=>pe.route.id===ae)),Ze=++Be,ie.length===0&&he.length===0){let ae=na();return xt(v,fe({matches:x,loaderData:{},errors:B&&De(B[1])?{[B[0]]:B[1].error}:null},ds(B),ae?{fetchers:new Map(y.fetchers)}:{}),{flushSync:I}),{shortCircuited:!0}}if(be){let ae={};if(!R){ae.navigation=J;let pe=Qn(B);pe!==void 0&&(ae.actionData=pe)}he.length>0&&(ae.fetchers=yo(he)),we(ae,{flushSync:I})}he.forEach(ae=>{Je(ae.key),ae.controller&&ue.set(ae.key,ae.controller)});let bt=()=>he.forEach(ae=>Je(ae.key));V&&V.signal.addEventListener("abort",bt);let{loaderResults:Ut,fetcherResults:$e}=await ea(y,x,ie,he,p);if(p.signal.aborted)return{shortCircuited:!0};V&&V.signal.removeEventListener("abort",bt),he.forEach(ae=>ue.delete(ae.key));let He=Er(Ut);if(He)return await gt(p,He.result,!0,{replace:j}),{shortCircuited:!0};if(He=Er($e),He)return xe.add(He.key),await gt(p,He.result,!0,{replace:j}),{shortCircuited:!0};let{loaderData:Xr,errors:$t}=ls(y,x,Ut,B,he,$e,ht);ht.forEach((ae,pe)=>{ae.subscribe(St=>{(St||ae.done)&&ht.delete(pe)})}),u.v7_partialHydration&&H&&y.errors&&($t=fe({},y.errors,$t));let vt=na(),mr=aa(Ze),gr=vt||mr||he.length>0;return fe({matches:x,loaderData:Xr,errors:$t},gr?{fetchers:new Map(y.fetchers)}:{})}function Qn(p){if(p&&!De(p[1]))return{[p[0]]:p[1].data};if(y.actionData)return Object.keys(y.actionData).length===0?null:y.actionData}function yo(p){return p.forEach(v=>{let x=y.fetchers.get(v.key),R=Zt(void 0,x?x.data:void 0);y.fetchers.set(v.key,R)}),new Map(y.fetchers)}function _o(p,v,x,R){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Je(p);let A=(R&&R.flushSync)===!0,$=o||i,W=Ln(y.location,y.matches,l,u.v7_prependBasename,x,u.v7_relativeSplatPath,v,R?.relative),j=Qe($,W,l),H=hr(j,$,W);if(H.active&&H.matches&&(j=H.matches),!j){Ue(p,v,Oe(404,{pathname:W}),{flushSync:A});return}let{path:I,submission:B,error:J}=ts(u.v7_normalizeFormMethod,!0,W,R);if(J){Ue(p,v,J,{flushSync:A});return}let Q=qt(j,I),be=(R&&R.preventScrollReset)===!0;if(B&&Me(B.formMethod)){Eo(p,v,I,Q,j,H.active,A,be,B);return}Ae.set(p,{routeId:v,path:I}),Co(p,v,I,Q,j,H.active,A,be,B)}async function Eo(p,v,x,R,A,$,W,j,H){Gr(),Ae.delete(p);function I(ye){if(!ye.route.action&&!ye.route.lazy){let Nt=Oe(405,{method:H.formMethod,pathname:x,routeId:v});return Ue(p,v,Nt,{flushSync:W}),!0}return!1}if(!$&&I(R))return;let B=y.fetchers.get(p);Ge(p,Nf(H,B),{flushSync:W});let J=new AbortController,Q=Ot(t.history,x,J.signal,H);if($){let ye=await pr(A,new URL(Q.url).pathname,Q.signal,p);if(ye.type==="aborted")return;if(ye.type==="error"){Ue(p,v,ye.error,{flushSync:W});return}else if(ye.matches){if(A=ye.matches,R=qt(A,x),I(R))return}else{Ue(p,v,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,J);let be=Be,ie=(await Bt("action",y,Q,[R],A,p))[R.route.id];if(Q.signal.aborted){ue.get(p)===J&&ue.delete(p);return}if(u.v7_fetcherPersist&&je.has(p)){if(Et(ie)||De(ie)){Ge(p,qe(void 0));return}}else{if(Et(ie))if(ue.delete(p),Ze>be){Ge(p,qe(void 0));return}else return xe.add(p),Ge(p,Zt(H)),gt(Q,ie,!1,{fetcherSubmission:H,preventScrollReset:j});if(De(ie)){Ue(p,v,ie.error);return}}if(nt(ie))throw Oe(400,{type:"defer-action"});let he=y.navigation.location||y.location,bt=Ot(t.history,he,J.signal),Ut=o||i,$e=y.navigation.state!=="idle"?Qe(Ut,y.navigation.location,l):y.matches;q($e,"Didn't find any matches after fetcher action");let He=++Be;ve.set(p,He);let Xr=Zt(H,ie.data);y.fetchers.set(p,Xr);let[$t,vt]=ns(t.history,y,$e,H,he,!1,u.v7_skipActionErrorRevalidation,Re,Ce,oe,je,Ae,xe,Ut,l,[R.route.id,ie]);vt.filter(ye=>ye.key!==p).forEach(ye=>{let Nt=ye.key,ca=y.fetchers.get(Nt),Oo=Zt(void 0,ca?ca.data:void 0);y.fetchers.set(Nt,Oo),Je(Nt),ye.controller&&ue.set(Nt,ye.controller)}),we({fetchers:new Map(y.fetchers)});let mr=()=>vt.forEach(ye=>Je(ye.key));J.signal.addEventListener("abort",mr);let{loaderResults:gr,fetcherResults:ae}=await ea(y,$e,$t,vt,bt);if(J.signal.aborted)return;J.signal.removeEventListener("abort",mr),ve.delete(p),ue.delete(p),vt.forEach(ye=>ue.delete(ye.key));let pe=Er(gr);if(pe)return gt(bt,pe.result,!1,{preventScrollReset:j});if(pe=Er(ae),pe)return xe.add(pe.key),gt(bt,pe.result,!1,{preventScrollReset:j});let{loaderData:St,errors:zt}=ls(y,$e,gr,void 0,vt,ae,ht);if(y.fetchers.has(p)){let ye=qe(ie.data);y.fetchers.set(p,ye)}aa(He),y.navigation.state==="loading"&&He>Ze?(q(w,"Expected pending action"),V&&V.abort(),xt(y.navigation.location,{matches:$e,loaderData:St,errors:zt,fetchers:new Map(y.fetchers)})):(we({errors:zt,loaderData:cs(y.loaderData,St,$e,zt),fetchers:new Map(y.fetchers)}),Re=!1)}async function Co(p,v,x,R,A,$,W,j,H){let I=y.fetchers.get(p);Ge(p,Zt(H,I?I.data:void 0),{flushSync:W});let B=new AbortController,J=Ot(t.history,x,B.signal);if($){let ie=await pr(A,new URL(J.url).pathname,J.signal,p);if(ie.type==="aborted")return;if(ie.type==="error"){Ue(p,v,ie.error,{flushSync:W});return}else if(ie.matches)A=ie.matches,R=qt(A,x);else{Ue(p,v,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,B);let Q=Be,de=(await Bt("loader",y,J,[R],A,p))[R.route.id];if(nt(de)&&(de=await Kn(de,J.signal,!0)||de),ue.get(p)===B&&ue.delete(p),!J.signal.aborted){if(je.has(p)){Ge(p,qe(void 0));return}if(Et(de))if(Ze>Q){Ge(p,qe(void 0));return}else{xe.add(p),await gt(J,de,!1,{preventScrollReset:j});return}if(De(de)){Ue(p,v,de.error);return}q(!nt(de),"Unhandled fetcher deferred data"),Ge(p,qe(de.data))}}async function gt(p,v,x,R){let{submission:A,fetcherSubmission:$,preventScrollReset:W,replace:j}=R===void 0?{}:R;v.response.headers.has("X-Remix-Revalidate")&&(Re=!0);let H=v.response.headers.get("Location");q(H,"Expected a Location header on the redirect Response"),H=is(H,new URL(p.url),l);let I=nr(y.location,H,{_isRedirect:!0});if(r){let ie=!1;if(v.response.headers.has("X-Remix-Reload-Document"))ie=!0;else if(Wn.test(H)){const he=t.history.createURL(H);ie=he.origin!==e.location.origin||cr(he.pathname,l)==null}if(ie){j?e.location.replace(H):e.location.assign(H);return}}V=null;let B=j===!0||v.response.headers.has("X-Remix-Replace")?_e.Replace:_e.Push,{formMethod:J,formAction:Q,formEncType:be}=y.navigation;!A&&!$&&J&&Q&&be&&(A=hs(y.navigation));let de=A||$;if(af.has(v.response.status)&&de&&Me(de.formMethod))await mt(B,I,{submission:fe({},de,{formAction:H}),preventScrollReset:W||U,enableViewTransition:x?G:void 0});else{let ie=dn(I,A);await mt(B,I,{overrideNavigation:ie,fetcherSubmission:$,preventScrollReset:W||U,enableViewTransition:x?G:void 0})}}async function Bt(p,v,x,R,A,$){let W,j={};try{W=await hf(c,p,v,x,R,A,$,s,a)}catch(H){return R.forEach(I=>{j[I.route.id]={type:le.error,error:H}}),j}for(let[H,I]of Object.entries(W))if(_f(I)){let B=I.result;j[H]={type:le.redirect,response:gf(B,x,H,A,l,u.v7_relativeSplatPath)}}else j[H]=await mf(I);return j}async function ea(p,v,x,R,A){let $=p.matches,W=Bt("loader",p,A,x,v,null),j=Promise.all(R.map(async B=>{if(B.matches&&B.match&&B.controller){let Q=(await Bt("loader",p,Ot(t.history,B.path,B.controller.signal),[B.match],B.matches,B.key))[B.match.route.id];return{[B.key]:Q}}else return Promise.resolve({[B.key]:{type:le.error,error:Oe(404,{pathname:B.path})}})})),H=await W,I=(await j).reduce((B,J)=>Object.assign(B,J),{});return await Promise.all([xf(v,H,A.signal,$,p.loaderData),bf(v,I,R)]),{loaderResults:H,fetcherResults:I}}function Gr(){Re=!0,Ce.push(...qr()),Ae.forEach((p,v)=>{ue.has(v)&&oe.add(v),Je(v)})}function Ge(p,v,x){x===void 0&&(x={}),y.fetchers.set(p,v),we({fetchers:new Map(y.fetchers)},{flushSync:(x&&x.flushSync)===!0})}function Ue(p,v,x,R){R===void 0&&(R={});let A=_t(y.matches,v);ur(p),we({errors:{[A.route.id]:x},fetchers:new Map(y.fetchers)},{flushSync:(R&&R.flushSync)===!0})}function ta(p){return Ye.set(p,(Ye.get(p)||0)+1),je.has(p)&&je.delete(p),y.fetchers.get(p)||sf}function ur(p){let v=y.fetchers.get(p);ue.has(p)&&!(v&&v.state==="loading"&&ve.has(p))&&Je(p),Ae.delete(p),ve.delete(p),xe.delete(p),u.v7_fetcherPersist&&je.delete(p),oe.delete(p),y.fetchers.delete(p)}function xo(p){let v=(Ye.get(p)||0)-1;v<=0?(Ye.delete(p),je.add(p),u.v7_fetcherPersist||ur(p)):Ye.set(p,v),we({fetchers:new Map(y.fetchers)})}function Je(p){let v=ue.get(p);v&&(v.abort(),ue.delete(p))}function ra(p){for(let v of p){let x=ta(v),R=qe(x.data);y.fetchers.set(v,R)}}function na(){let p=[],v=!1;for(let x of xe){let R=y.fetchers.get(x);q(R,"Expected fetcher: "+x),R.state==="loading"&&(xe.delete(x),p.push(x),v=!0)}return ra(p),v}function aa(p){let v=[];for(let[x,R]of ve)if(R<p){let A=y.fetchers.get(x);q(A,"Expected fetcher: "+x),A.state==="loading"&&(Je(x),ve.delete(x),v.push(x))}return ra(v),v.length>0}function bo(p,v){let x=y.blockers.get(p)||Kt;return pt.get(p)!==v&&pt.set(p,v),x}function sa(p){y.blockers.delete(p),pt.delete(p)}function fr(p,v){let x=y.blockers.get(p)||Kt;q(x.state==="unblocked"&&v.state==="blocked"||x.state==="blocked"&&v.state==="blocked"||x.state==="blocked"&&v.state==="proceeding"||x.state==="blocked"&&v.state==="unblocked"||x.state==="proceeding"&&v.state==="unblocked","Invalid blocker state transition: "+x.state+" -> "+v.state);let R=new Map(y.blockers);R.set(p,v),we({blockers:R})}function ia(p){let{currentLocation:v,nextLocation:x,historyAction:R}=p;if(pt.size===0)return;pt.size>1&&Vt(!1,"A router only supports one blocker at a time");let A=Array.from(pt.entries()),[$,W]=A[A.length-1],j=y.blockers.get($);if(!(j&&j.state==="proceeding")&&W({currentLocation:v,nextLocation:x,historyAction:R}))return $}function Jr(p){let v=Oe(404,{pathname:p}),x=o||i,{matches:R,route:A}=us(x);return qr(),{notFoundMatches:R,route:A,error:v}}function qr(p){let v=[];return ht.forEach((x,R)=>{(!p||p(R))&&(x.cancel(),v.push(R),ht.delete(R))}),v}function So(p,v,x){if(g=p,b=v,E=x||null,!C&&y.navigation===cn){C=!0;let R=la(y.location,y.matches);R!=null&&we({restoreScrollPosition:R})}return()=>{g=null,b=null,E=null}}function oa(p,v){return E&&E(p,v.map(R=>ju(R,y.loaderData)))||p.key}function No(p,v){if(g&&b){let x=oa(p,v);g[x]=b()}}function la(p,v){if(g){let x=oa(p,v),R=g[x];if(typeof R=="number")return R}return null}function hr(p,v,x){if(d)if(p){if(Object.keys(p[0].params).length>0)return{active:!0,matches:Sr(v,x,l,!0)}}else return{active:!0,matches:Sr(v,x,l,!0)||[]};return{active:!1,matches:null}}async function pr(p,v,x,R){if(!d)return{type:"success",matches:p};let A=p;for(;;){let $=o==null,W=o||i,j=s;try{await d({signal:x,path:v,matches:A,fetcherKey:R,patch:(B,J)=>{x.aborted||ss(B,J,W,j,a)}})}catch(B){return{type:"error",error:B,partialMatches:A}}finally{$&&!x.aborted&&(i=[...i])}if(x.aborted)return{type:"aborted"};let H=Qe(W,v,l);if(H)return{type:"success",matches:H};let I=Sr(W,v,l,!0);if(!I||A.length===I.length&&A.every((B,J)=>B.route.id===I[J].route.id))return{type:"success",matches:null};A=I}}function Ro(p){s={},o=Mr(p,a,void 0,s)}function wo(p,v){let x=o==null;ss(p,v,o||i,s,a),x&&(i=[...i],we({}))}return T={get basename(){return l},get future(){return u},get state(){return y},get routes(){return i},get window(){return e},initialize:fo,subscribe:po,enableScrollRestoration:So,navigate:Xn,fetch:_o,revalidate:mo,createHref:p=>t.history.createHref(p),encodeLocation:p=>t.history.encodeLocation(p),getFetcher:ta,deleteFetcher:xo,dispose:ho,getBlocker:bo,deleteBlocker:sa,patchRoutes:wo,_internalFetchControllers:ue,_internalActiveDeferreds:ht,_internalSetRoutes:Ro},T}function cf(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Ln(t,e,r,n,a,s,i,o){let l,c;if(i){l=[];for(let u of e)if(l.push(u),u.route.id===i){c=u;break}}else l=e,c=e[e.length-1];let d=Ni(a||".",Si(l,s),cr(t.pathname,r)||t.pathname,o==="path");if(a==null&&(d.search=t.search,d.hash=t.hash),(a==null||a===""||a===".")&&c){let u=Zn(d.search);if(c.route.index&&!u)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&u){let f=new URLSearchParams(d.search),h=f.getAll("index");f.delete("index"),h.filter(E=>E).forEach(E=>f.append("index",E));let g=f.toString();d.search=g?"?"+g:""}}return n&&r!=="/"&&(d.pathname=d.pathname==="/"?r:ot([r,d.pathname])),lr(d)}function ts(t,e,r,n){if(!n||!cf(n))return{path:r};if(n.formMethod&&!Cf(n.formMethod))return{path:r,error:Oe(405,{method:n.formMethod})};let a=()=>({path:r,error:Oe(400,{type:"invalid-body"})}),s=n.formMethod||"get",i=t?s.toUpperCase():s.toLowerCase(),o=Li(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Me(i))return a();let f=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,g)=>{let[E,b]=g;return""+h+E+"="+b+`
5
- `},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:f}}}else if(n.formEncType==="application/json"){if(!Me(i))return a();try{let f=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:f,text:void 0}}}catch{return a()}}}q(typeof FormData=="function","FormData is not available in this environment");let l,c;if(n.formData)l=Tn(n.formData),c=n.formData;else if(n.body instanceof FormData)l=Tn(n.body),c=n.body;else if(n.body instanceof URLSearchParams)l=n.body,c=os(l);else if(n.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(n.body),c=os(l)}catch{return a()}let d={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Me(d.formMethod))return{path:r,submission:d};let u=dt(r);return e&&u.search&&Zn(u.search)&&l.append("index",""),u.search="?"+l,{path:lr(u),submission:d}}function rs(t,e,r){r===void 0&&(r=!1);let n=t.findIndex(a=>a.route.id===e);return n>=0?t.slice(0,r?n+1:n):t}function ns(t,e,r,n,a,s,i,o,l,c,d,u,f,h,g,E){let b=E?De(E[1])?E[1].error:E[1].data:void 0,C=t.createURL(e.location),S=t.createURL(a),k=r;s&&e.errors?k=rs(r,Object.keys(e.errors)[0],!0):E&&De(E[1])&&(k=rs(r,E[0]));let N=E?E[1].statusCode:void 0,D=i&&N&&N>=400,T=k.filter((w,U)=>{let{route:V}=w;if(V.lazy)return!0;if(V.loader==null)return!1;if(s)return An(V,e.loaderData,e.errors);if(df(e.loaderData,e.matches[U],w)||l.some(ee=>ee===w.route.id))return!0;let G=e.matches[U],z=w;return as(w,fe({currentUrl:C,currentParams:G.params,nextUrl:S,nextParams:z.params},n,{actionResult:b,actionStatus:N,defaultShouldRevalidate:D?!1:o||C.pathname+C.search===S.pathname+S.search||C.search!==S.search||Oi(G,z)}))}),y=[];return u.forEach((w,U)=>{if(s||!r.some(ne=>ne.route.id===w.routeId)||d.has(U))return;let V=Qe(h,w.path,g);if(!V){y.push({key:U,routeId:w.routeId,path:w.path,matches:null,match:null,controller:null});return}let G=e.fetchers.get(U),z=qt(V,w.path),ee=!1;f.has(U)?ee=!1:c.has(U)?(c.delete(U),ee=!0):G&&G.state!=="idle"&&G.data===void 0?ee=o:ee=as(z,fe({currentUrl:C,currentParams:e.matches[e.matches.length-1].params,nextUrl:S,nextParams:r[r.length-1].params},n,{actionResult:b,actionStatus:N,defaultShouldRevalidate:D?!1:o})),ee&&y.push({key:U,routeId:w.routeId,path:w.path,matches:V,match:z,controller:new AbortController})}),[T,y]}function An(t,e,r){if(t.lazy)return!0;if(!t.loader)return!1;let n=e!=null&&e[t.id]!==void 0,a=r!=null&&r[t.id]!==void 0;return!n&&a?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!n&&!a}function df(t,e,r){let n=!e||r.route.id!==e.route.id,a=t[r.route.id]===void 0;return n||a}function Oi(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function as(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function ss(t,e,r,n,a){var s;let i;if(t){let c=n[t];q(c,"No route found to patch children into: routeId = "+t),c.children||(c.children=[]),i=c.children}else i=r;let o=e.filter(c=>!i.some(d=>Di(c,d))),l=Mr(o,a,[t||"_","patch",String(((s=i)==null?void 0:s.length)||"0")],n);i.push(...l)}function Di(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((r,n)=>{var a;return(a=e.children)==null?void 0:a.some(s=>Di(r,s))}):!1}async function uf(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let a=r[t.id];q(a,"No route found in manifest");let s={};for(let i in n){let l=a[i]!==void 0&&i!=="hasErrorBoundary";Vt(!l,'Route "'+a.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!l&&!ku.has(i)&&(s[i]=n[i])}Object.assign(a,s),Object.assign(a,fe({},e(a),{lazy:void 0}))}async function ff(t){let{matches:e}=t,r=e.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,s,i)=>Object.assign(a,{[r[i].route.id]:s}),{})}async function hf(t,e,r,n,a,s,i,o,l,c){let d=s.map(h=>h.route.lazy?uf(h.route,l,o):void 0),u=s.map((h,g)=>{let E=d[g],b=a.some(S=>S.route.id===h.route.id);return fe({},h,{shouldLoad:b,resolve:async S=>(S&&n.method==="GET"&&(h.route.lazy||h.route.loader)&&(b=!0),b?pf(e,n,h,E,S,c):Promise.resolve({type:le.data,result:void 0}))})}),f=await t({matches:u,request:n,params:s[0].params,fetcherKey:i,context:c});try{await Promise.all(d)}catch{}return f}async function pf(t,e,r,n,a,s){let i,o,l=c=>{let d,u=new Promise((g,E)=>d=E);o=()=>d(),e.signal.addEventListener("abort",o);let f=g=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):c({request:e,params:r.params,context:s},...g!==void 0?[g]:[]),h=(async()=>{try{return{type:"data",result:await(a?a(E=>f(E)):f())}}catch(g){return{type:"error",result:g}}})();return Promise.race([h,u])};try{let c=r.route[t];if(n)if(c){let d,[u]=await Promise.all([l(c).catch(f=>{d=f}),n]);if(d!==void 0)throw d;i=u}else if(await n,c=r.route[t],c)i=await l(c);else if(t==="action"){let d=new URL(e.url),u=d.pathname+d.search;throw Oe(405,{method:e.method,pathname:u,routeId:r.route.id})}else return{type:le.data,result:void 0};else if(c)i=await l(c);else{let d=new URL(e.url),u=d.pathname+d.search;throw Oe(404,{pathname:u})}q(i.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:le.error,result:c}}finally{o&&e.signal.removeEventListener("abort",o)}return i}async function mf(t){let{result:e,type:r}=t;if(Ai(e)){let u;try{let f=e.headers.get("Content-Type");f&&/\bapplication\/json\b/.test(f)?e.body==null?u=null:u=await e.json():u=await e.text()}catch(f){return{type:le.error,error:f}}return r===le.error?{type:le.error,error:new Hr(e.status,e.statusText,u),statusCode:e.status,headers:e.headers}:{type:le.data,data:u,statusCode:e.status,headers:e.headers}}if(r===le.error){if(fs(e)){var n,a;if(e.data instanceof Error){var s,i;return{type:le.error,error:e.data,statusCode:(s=e.init)==null?void 0:s.status,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}}return{type:le.error,error:new Hr(((n=e.init)==null?void 0:n.status)||500,void 0,e.data),statusCode:ar(e)?e.status:void 0,headers:(a=e.init)!=null&&a.headers?new Headers(e.init.headers):void 0}}return{type:le.error,error:e,statusCode:ar(e)?e.status:void 0}}if(Ef(e)){var o,l;return{type:le.deferred,deferredData:e,statusCode:(o=e.init)==null?void 0:o.status,headers:((l=e.init)==null?void 0:l.headers)&&new Headers(e.init.headers)}}if(fs(e)){var c,d;return{type:le.data,data:e.data,statusCode:(c=e.init)==null?void 0:c.status,headers:(d=e.init)!=null&&d.headers?new Headers(e.init.headers):void 0}}return{type:le.data,data:e}}function gf(t,e,r,n,a,s){let i=t.headers.get("Location");if(q(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Wn.test(i)){let o=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=Ln(new URL(e.url),o,a,!0,i,s),t.headers.set("Location",i)}return t}function is(t,e,r){if(Wn.test(t)){let n=t,a=n.startsWith("//")?new URL(e.protocol+n):new URL(n),s=cr(a.pathname,r)!=null;if(a.origin===e.origin&&s)return a.pathname+a.search+a.hash}return t}function Ot(t,e,r,n){let a=t.createURL(Li(e)).toString(),s={signal:r};if(n&&Me(n.formMethod)){let{formMethod:i,formEncType:o}=n;s.method=i.toUpperCase(),o==="application/json"?(s.headers=new Headers({"Content-Type":o}),s.body=JSON.stringify(n.json)):o==="text/plain"?s.body=n.text:o==="application/x-www-form-urlencoded"&&n.formData?s.body=Tn(n.formData):s.body=n.formData}return new Request(a,s)}function Tn(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function os(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function vf(t,e,r,n,a){let s={},i=null,o,l=!1,c={},d=r&&De(r[1])?r[1].error:void 0;return t.forEach(u=>{if(!(u.route.id in e))return;let f=u.route.id,h=e[f];if(q(!Et(h),"Cannot handle redirect results in processLoaderData"),De(h)){let g=h.error;d!==void 0&&(g=d,d=void 0),i=i||{};{let E=_t(t,f);i[E.route.id]==null&&(i[E.route.id]=g)}s[f]=void 0,l||(l=!0,o=ar(h.error)?h.error.status:500),h.headers&&(c[f]=h.headers)}else nt(h)?(n.set(f,h.deferredData),s[f]=h.deferredData.data,h.statusCode!=null&&h.statusCode!==200&&!l&&(o=h.statusCode),h.headers&&(c[f]=h.headers)):(s[f]=h.data,h.statusCode&&h.statusCode!==200&&!l&&(o=h.statusCode),h.headers&&(c[f]=h.headers))}),d!==void 0&&r&&(i={[r[0]]:d},s[r[0]]=void 0),{loaderData:s,errors:i,statusCode:o||200,loaderHeaders:c}}function ls(t,e,r,n,a,s,i){let{loaderData:o,errors:l}=vf(e,r,n,i);return a.forEach(c=>{let{key:d,match:u,controller:f}=c,h=s[d];if(q(h,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(De(h)){let g=_t(t.matches,u?.route.id);l&&l[g.route.id]||(l=fe({},l,{[g.route.id]:h.error})),t.fetchers.delete(d)}else if(Et(h))q(!1,"Unhandled fetcher revalidation redirect");else if(nt(h))q(!1,"Unhandled fetcher deferred data");else{let g=qe(h.data);t.fetchers.set(d,g)}}),{loaderData:o,errors:l}}function cs(t,e,r,n){let a=fe({},e);for(let s of r){let i=s.route.id;if(e.hasOwnProperty(i)?e[i]!==void 0&&(a[i]=e[i]):t[i]!==void 0&&s.route.loader&&(a[i]=t[i]),n&&n.hasOwnProperty(i))break}return a}function ds(t){return t?De(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function _t(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function us(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Oe(t,e){let{pathname:r,routeId:n,method:a,type:s,message:i}=e===void 0?{}:e,o="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(o="Bad Request",a&&r&&n?l="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":s==="defer-action"?l="defer() is not supported in actions":s==="invalid-body"&&(l="Unable to encode submission body")):t===403?(o="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):t===404?(o="Not Found",l='No route matches URL "'+r+'"'):t===405&&(o="Method Not Allowed",a&&r&&n?l="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new Hr(t||500,o,new Error(l),!0)}function Er(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,a]=e[r];if(Et(a))return{key:n,result:a}}}function Li(t){let e=typeof t=="string"?dt(t):t;return lr(fe({},e,{hash:""}))}function yf(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function _f(t){return Ai(t.result)&&nf.has(t.result.status)}function nt(t){return t.type===le.deferred}function De(t){return t.type===le.error}function Et(t){return(t&&t.type)===le.redirect}function fs(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Ef(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function Ai(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Cf(t){return rf.has(t.toLowerCase())}function Me(t){return ef.has(t.toLowerCase())}async function xf(t,e,r,n,a){let s=Object.entries(e);for(let i=0;i<s.length;i++){let[o,l]=s[i],c=t.find(f=>f?.route.id===o);if(!c)continue;let d=n.find(f=>f.route.id===c.route.id),u=d!=null&&!Oi(d,c)&&(a&&a[c.route.id])!==void 0;nt(l)&&u&&await Kn(l,r,!1).then(f=>{f&&(e[o]=f)})}}async function bf(t,e,r){for(let n=0;n<r.length;n++){let{key:a,routeId:s,controller:i}=r[n],o=e[a];t.find(c=>c?.route.id===s)&&nt(o)&&(q(i,"Expected an AbortController for revalidating fetcher deferred result"),await Kn(o,i.signal,!0).then(c=>{c&&(e[a]=c)}))}}async function Kn(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:le.data,data:t.deferredData.unwrappedData}}catch(a){return{type:le.error,error:a}}return{type:le.data,data:t.deferredData.data}}}function Zn(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function qt(t,e){let r=typeof e=="string"?dt(e).search:e.search;if(t[t.length-1].route.index&&Zn(r||""))return t[t.length-1];let n=bi(t);return n[n.length-1]}function hs(t){let{formMethod:e,formAction:r,formEncType:n,text:a,formData:s,json:i}=t;if(!(!e||!r||!n)){if(a!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(s!=null)return{formMethod:e,formAction:r,formEncType:n,formData:s,json:void 0,text:void 0};if(i!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function dn(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Sf(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Zt(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Nf(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function qe(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Rf(t,e){try{let r=t.sessionStorage.getItem(wi);if(r){let n=JSON.parse(r);for(let[a,s]of Object.entries(n||{}))s&&Array.isArray(s)&&e.set(a,new Set(s||[]))}}catch{}}function wf(t,e){if(e.size>0){let r={};for(let[n,a]of e)r[n]=[...a];try{t.sessionStorage.setItem(wi,JSON.stringify(r))}catch(n){Vt(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}function Fr(){return Fr=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},Fr.apply(this,arguments)}const $r=m.createContext(null),Ti=m.createContext(null),zr=m.createContext(null),Wr=m.createContext(null),ut=m.createContext({outlet:null,matches:[],isDataRoute:!1}),Pi=m.createContext(null);function Kr(){return m.useContext(Wr)!=null}function Zr(){return Kr()||q(!1),m.useContext(Wr).location}function Of(){return m.useContext(Wr).navigationType}function ki(t){m.useContext(zr).static||m.useLayoutEffect(t)}function Df(){let{isDataRoute:t}=m.useContext(ut);return t?zf():Lf()}function Lf(){Kr()||q(!1);let t=m.useContext($r),{basename:e,future:r,navigator:n}=m.useContext(zr),{matches:a}=m.useContext(ut),{pathname:s}=Zr(),i=JSON.stringify(Si(a,r.v7_relativeSplatPath)),o=m.useRef(!1);return ki(()=>{o.current=!0}),m.useCallback(function(c,d){if(d===void 0&&(d={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let u=Ni(c,JSON.parse(i),s,d.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:ot([e,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[e,n,i,s,t])}const Af=m.createContext(null);function Tf(t){let e=m.useContext(ut).outlet;return e&&m.createElement(Af.Provider,{value:t},e)}function Pf(){let{matches:t}=m.useContext(ut),e=t[t.length-1];return e?e.params:{}}function kf(t,e,r,n){Kr()||q(!1);let{navigator:a}=m.useContext(zr),{matches:s}=m.useContext(ut),i=s[s.length-1],o=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let c=Zr(),d;d=c;let u=d.pathname||"/",f=u;if(l!=="/"){let E=l.replace(/^\//,"").split("/");f="/"+u.replace(/^\//,"").split("/").slice(E.length).join("/")}let h=Qe(t,{pathname:f});return Ff(h&&h.map(E=>Object.assign({},E,{params:Object.assign({},o,E.params),pathname:ot([l,a.encodeLocation?a.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?l:ot([l,a.encodeLocation?a.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),s,r,n)}function If(){let t=$f(),e=ar(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),r?m.createElement("pre",{style:a},r):null,null)}const jf=m.createElement(If,null);class Mf extends m.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?m.createElement(ut.Provider,{value:this.props.routeContext},m.createElement(Pi.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Hf(t){let{routeContext:e,match:r,children:n}=t,a=m.useContext($r);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),m.createElement(ut.Provider,{value:e},n)}function Ff(t,e,r,n){var a;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,o=(a=r)==null?void 0:a.errors;if(o!=null){let d=i.findIndex(u=>u.route.id&&o?.[u.route.id]!==void 0);d>=0||q(!1),i=i.slice(0,Math.min(i.length,d+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<i.length;d++){let u=i[d];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=d),u.route.id){let{loaderData:f,errors:h}=r,g=u.route.loader&&f[u.route.id]===void 0&&(!h||h[u.route.id]===void 0);if(u.route.lazy||g){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((d,u,f)=>{let h,g=!1,E=null,b=null;r&&(h=o&&u.route.id?o[u.route.id]:void 0,E=u.route.errorElement||jf,l&&(c<0&&f===0?(Wf("route-fallback"),g=!0,b=null):c===f&&(g=!0,b=u.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,f+1)),S=()=>{let k;return h?k=E:g?k=b:u.route.Component?k=m.createElement(u.route.Component,null):u.route.element?k=u.route.element:k=d,m.createElement(Hf,{match:u,routeContext:{outlet:d,matches:C,isDataRoute:r!=null},children:k})};return r&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?m.createElement(Mf,{location:r.location,revalidation:r.revalidation,component:E,error:h,children:S(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):S()},null)}var Ii=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Ii||{}),ji=(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})(ji||{});function Vf(t){let e=m.useContext($r);return e||q(!1),e}function Bf(t){let e=m.useContext(Ti);return e||q(!1),e}function Uf(t){let e=m.useContext(ut);return e||q(!1),e}function Mi(t){let e=Uf(),r=e.matches[e.matches.length-1];return r.route.id||q(!1),r.route.id}function $f(){var t;let e=m.useContext(Pi),r=Bf(ji.UseRouteError),n=Mi();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function zf(){let{router:t}=Vf(Ii.UseNavigateStable),e=Mi(),r=m.useRef(!1);return ki(()=>{r.current=!0}),m.useCallback(function(a,s){s===void 0&&(s={}),r.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Fr({fromRouteId:e},s)))},[t,e])}const ps={};function Wf(t,e,r){ps[t]||(ps[t]=!0)}function Kf(t,e){t?.v7_startTransition,t?.v7_relativeSplatPath===void 0&&(!e||e.v7_relativeSplatPath),e&&(e.v7_fetcherPersist,e.v7_normalizeFormMethod,e.v7_partialHydration,e.v7_skipActionErrorRevalidation)}function Zf(t){return Tf(t.context)}function Yf(t){q(!1)}function Gf(t){let{basename:e="/",children:r=null,location:n,navigationType:a=_e.Pop,navigator:s,static:i=!1,future:o}=t;Kr()&&q(!1);let l=e.replace(/^\/*/,"/"),c=m.useMemo(()=>({basename:l,navigator:s,static:i,future:Fr({v7_relativeSplatPath:!1},o)}),[l,o,s,i]);typeof n=="string"&&(n=dt(n));let{pathname:d="/",search:u="",hash:f="",state:h=null,key:g="default"}=n,E=m.useMemo(()=>{let b=cr(d,l);return b==null?null:{location:{pathname:b,search:u,hash:f,state:h,key:g},navigationType:a}},[l,d,u,f,h,g,a]);return E==null?null:m.createElement(zr.Provider,{value:c},m.createElement(Wr.Provider,{children:r,value:E}))}new Promise(()=>{});function Pn(t,e){e===void 0&&(e=[]);let r=[];return m.Children.forEach(t,(n,a)=>{if(!m.isValidElement(n))return;let s=[...e,a];if(n.type===m.Fragment){r.push.apply(r,Pn(n.props.children,s));return}n.type!==Yf&&q(!1),!n.props.index||!n.props.children||q(!1);let i={id:n.props.id||s.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&&(i.children=Pn(n.props.children,s)),r.push(i)}),r}function Jf(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:m.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:m.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:m.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function Vr(){return Vr=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},Vr.apply(this,arguments)}const qf="6";try{window.__reactRouterVersion=qf}catch{}function Xf(t,e){return lf({basename:e?.basename,future:Vr({},e?.future,{v7_prependBasename:!0}),history:Au({window:e?.window}),hydrationData:e?.hydrationData||Qf(),routes:t,mapRouteProperties:Jf,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window}).initialize()}function Qf(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Vr({},e,{errors:eh(e.errors)})),e}function eh(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,a]of e)if(a&&a.__type==="RouteErrorResponse")r[n]=new Hr(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let s=window[a.__subType];if(typeof s=="function")try{let i=new s(a.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let s=new Error(a.message);s.stack="",r[n]=s}}else r[n]=a;return r}const th=m.createContext({isTransitioning:!1}),rh=m.createContext(new Map),nh="startTransition",ms=To[nh],ah="flushSync",gs=Do[ah];function sh(t){ms?ms(t):t()}function Yt(t){gs?gs(t):t()}class ih{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function oh(t){let{fallbackElement:e,router:r,future:n}=t,[a,s]=m.useState(r.state),[i,o]=m.useState(),[l,c]=m.useState({isTransitioning:!1}),[d,u]=m.useState(),[f,h]=m.useState(),[g,E]=m.useState(),b=m.useRef(new Map),{v7_startTransition:C}=n||{},S=m.useCallback(w=>{C?sh(w):w()},[C]),k=m.useCallback((w,U)=>{let{deletedFetchers:V,flushSync:G,viewTransitionOpts:z}=U;w.fetchers.forEach((ne,Re)=>{ne.data!==void 0&&b.current.set(Re,ne.data)}),V.forEach(ne=>b.current.delete(ne));let ee=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!z||ee){G?Yt(()=>s(w)):S(()=>s(w));return}if(G){Yt(()=>{f&&(d&&d.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:z.currentLocation,nextLocation:z.nextLocation})});let ne=r.window.document.startViewTransition(()=>{Yt(()=>s(w))});ne.finished.finally(()=>{Yt(()=>{u(void 0),h(void 0),o(void 0),c({isTransitioning:!1})})}),Yt(()=>h(ne));return}f?(d&&d.resolve(),f.skipTransition(),E({state:w,currentLocation:z.currentLocation,nextLocation:z.nextLocation})):(o(w),c({isTransitioning:!0,flushSync:!1,currentLocation:z.currentLocation,nextLocation:z.nextLocation}))},[r.window,f,d,b,S]);m.useLayoutEffect(()=>r.subscribe(k),[r,k]),m.useEffect(()=>{l.isTransitioning&&!l.flushSync&&u(new ih)},[l]),m.useEffect(()=>{if(d&&i&&r.window){let w=i,U=d.promise,V=r.window.document.startViewTransition(async()=>{S(()=>s(w)),await U});V.finished.finally(()=>{u(void 0),h(void 0),o(void 0),c({isTransitioning:!1})}),h(V)}},[S,i,d,r.window]),m.useEffect(()=>{d&&i&&a.location.key===i.location.key&&d.resolve()},[d,f,a.location,i]),m.useEffect(()=>{!l.isTransitioning&&g&&(o(g.state),c({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),E(void 0))},[l.isTransitioning,g]),m.useEffect(()=>{},[]);let N=m.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:w=>r.navigate(w),push:(w,U,V)=>r.navigate(w,{state:U,preventScrollReset:V?.preventScrollReset}),replace:(w,U,V)=>r.navigate(w,{replace:!0,state:U,preventScrollReset:V?.preventScrollReset})}),[r]),D=r.basename||"/",T=m.useMemo(()=>({router:r,navigator:N,static:!1,basename:D}),[r,N,D]),y=m.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return m.useEffect(()=>Kf(n,r.future),[n,r.future]),m.createElement(m.Fragment,null,m.createElement($r.Provider,{value:T},m.createElement(Ti.Provider,{value:a},m.createElement(rh.Provider,{value:b.current},m.createElement(th.Provider,{value:l},m.createElement(Gf,{basename:D,location:a.location,navigationType:a.historyAction,navigator:N,future:y},a.initialized||r.future.v7_partialHydration?m.createElement(lh,{routes:r.routes,future:r.future,state:a}):e))))),null)}const lh=m.memo(ch);function ch(t){let{routes:e,future:r,state:n}=t;return kf(e,void 0,n,r)}var vs;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(vs||(vs={}));var ys;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ys||(ys={}));const _s=Hn(["sentry"]);let Yn=!1;async function Hi(){return await Se(()=>import("./sentry_react-cODD7zWc.js").then(t=>t.i),__vite__mapDeps([0,1,2]))}async function dh(){const t=await Hi(),e=[t.httpClientIntegration(),t.extraErrorDataIntegration({depth:5}),t.replayIntegration(),t.captureConsoleIntegration({levels:["error"]})];ge.sentry.tracing&&e.push(t.reactRouterV6BrowserTracingIntegration({useEffect:Vs.useEffect,useLocation:Zr,useNavigationType:Of,createRoutesFromChildren:Pn,matchRoutes:Qe})),t.init({release:ge.sentry.release,dsn:ge.sentry.dsn,environment:ge.sentry.env,integrations:e,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(r,n){const a=n.originalException;return a instanceof TypeError&&a.message.includes("Failed to fetch")&&!navigator.onLine?null:r}}),Yn=!0}async function uh(){return Yn?(await Hi()).getClient()?.close():void 0}function fh(){const[t]=Un(),{analytics:e}=t;m.useEffect(()=>{if(!e){uh().catch(r=>_s.error(r));return}Yn||!ge.sentry.dsn||ge.sentry.dsn===""||dh().catch(r=>_s.error(r))},[e])}function kn(){return kn=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},kn.apply(null,arguments)}var Fi=["shift","alt","meta","mod","ctrl"],hh={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function at(t){return(t&&hh[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function ph(t){return Fi.includes(t)}function un(t,e){return e===void 0&&(e=","),t.split(e)}function fn(t,e,r){e===void 0&&(e="+");var n=t.toLocaleLowerCase().split(e).map(function(i){return at(i)}),a={alt:n.includes("alt"),ctrl:n.includes("ctrl")||n.includes("control"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},s=n.filter(function(i){return!Fi.includes(i)});return kn({},a,{keys:s,description:r,hotkey:t})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(t){t.key!==void 0&&Vi([at(t.key),at(t.code)])}),document.addEventListener("keyup",function(t){t.key!==void 0&&Bi([at(t.key),at(t.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){st.clear()})})();var st=new Set;function Gn(t){return Array.isArray(t)}function mh(t,e){e===void 0&&(e=",");var r=Gn(t)?t:t.split(e);return r.every(function(n){return st.has(n.trim().toLowerCase())})}function Vi(t){var e=Array.isArray(t)?t:[t];st.has("meta")&&st.forEach(function(r){return!ph(r)&&st.delete(r.toLowerCase())}),e.forEach(function(r){return st.add(r.toLowerCase())})}function Bi(t){var e=Array.isArray(t)?t:[t];t==="meta"?st.clear():e.forEach(function(r){return st.delete(r.toLowerCase())})}function gh(t,e,r){(typeof r=="function"&&r(t,e)||r===!0)&&t.preventDefault()}function vh(t,e,r){return typeof r=="function"?r(t,e):r===!0||r===void 0}function yh(t){return Ui(t,["input","textarea","select"])}function Ui(t,e){e===void 0&&(e=!1);var r=t.target,n=t.composed,a=null;return _h(r)&&n?a=t.composedPath()[0]&&t.composedPath()[0].tagName:a=r&&r.tagName,Gn(e)?!!(a&&e&&e.some(function(s){var i;return s.toLowerCase()===((i=a)==null?void 0:i.toLowerCase())})):!!(a&&e&&e)}function _h(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function Eh(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(function(r){return e.includes(r)})||t.includes("*"):!0}var Ch=function(e,r,n){n===void 0&&(n=!1);var a=r.alt,s=r.meta,i=r.mod,o=r.shift,l=r.ctrl,c=r.keys,d=e.key,u=e.code,f=e.ctrlKey,h=e.metaKey,g=e.shiftKey,E=e.altKey,b=at(u),C=d.toLowerCase();if(!(c!=null&&c.includes(b))&&!(c!=null&&c.includes(C))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(b))return!1;if(!n){if(a===!E&&C!=="alt"||o===!g&&C!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(s===!h&&C!=="meta"&&C!=="os"||l===!f&&C!=="ctrl"&&C!=="control")return!1}return c&&c.length===1&&(c.includes(C)||c.includes(b))?!0:c?mh(c):!c},xh=m.createContext(void 0),bh=function(){return m.useContext(xh)};function $i(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce(function(r,n){return r&&$i(t[n],e[n])},!0):t===e}var Sh=m.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Nh=function(){return m.useContext(Sh)};function Rh(t){var e=m.useRef(void 0);return $i(e.current,t)||(e.current=t),e.current}var Es=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},wh=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Cs(t,e,r,n){var a=m.useState(null),s=a[0],i=a[1],o=m.useRef(!1),l=r instanceof Array?n instanceof Array?void 0:n:r,c=Gn(t)?t.join(l?.splitKey):t,d=r instanceof Array?r:n instanceof Array?n:void 0,u=m.useCallback(e,d??[]),f=m.useRef(u);d?f.current=u:f.current=e;var h=Rh(l),g=Nh(),E=g.enabledScopes,b=bh();return wh(function(){if(!(h?.enabled===!1||!Eh(E,h?.scopes))){var C=function(T,y){var w;if(y===void 0&&(y=!1),!(yh(T)&&!Ui(T,h?.enableOnFormTags))){if(s!==null){var U=s.getRootNode();if((U instanceof Document||U instanceof ShadowRoot)&&U.activeElement!==s&&!s.contains(U.activeElement)){Es(T);return}}(w=T.target)!=null&&w.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||un(c,h?.splitKey).forEach(function(V){var G,z=fn(V,h?.combinationKey);if(Ch(T,z,h?.ignoreModifiers)||(G=z.keys)!=null&&G.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(T)||y&&o.current)return;if(gh(T,z,h?.preventDefault),!vh(T,z,h?.enabled)){Es(T);return}f.current(T,z),y||(o.current=!0)}})}},S=function(T){T.key!==void 0&&(Vi(at(T.code)),(h?.keydown===void 0&&h?.keyup!==!0||h!=null&&h.keydown)&&C(T))},k=function(T){T.key!==void 0&&(Bi(at(T.code)),o.current=!1,h!=null&&h.keyup&&C(T,!0))},N=s||l?.document||document;return N.addEventListener("keyup",k,l?.eventListenerOptions),N.addEventListener("keydown",S,l?.eventListenerOptions),b&&un(c,h?.splitKey).forEach(function(D){return b.addHotkey(fn(D,h?.combinationKey,h?.description))}),function(){N.removeEventListener("keyup",k,l?.eventListenerOptions),N.removeEventListener("keydown",S,l?.eventListenerOptions),b&&un(c,h?.splitKey).forEach(function(D){return b.removeHotkey(fn(D,h?.combinationKey,h?.description))})}}},[s,c,h,E]),i}const Oh=t=>{const{undo:e,redo:r,canRedo:n,canUndo:a}=t,s=window.navigator.userAgent.includes("Mac");let i="ctrl+z",o="ctrl+y";s&&(i="mod+z",o="mod+shift+z"),Cs(i,l=>{l.preventDefault(),a&&e()},{},[a,e]),Cs(o,l=>{l.preventDefault(),n&&r()},{},[n,r])};window.navigator.appVersion.includes("Mac");const xs={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},Dh=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,r=Object.keys(xs).find(a=>e.includes(a)),n=r?xs[r]:void 0;if(n)return`${t}/${n}/package.json`},Lh=async()=>{const t=Dh();if(!t)return;const r=await(await fetch(t)).json(),{version:n}=r;return n},Ah=async()=>{const t=ge.appVersion,e=await Lh();return e?{isLatest:e===t,currentVersion:t,latestVersion:e}:null};function bs(...t){window.dataLayer?.push(...t)}const Th=()=>{const t=ge.gaTrackingId,[{analytics:e}]=Un(),r=t&&e;return m.useEffect(()=>{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||[],bs("js",new Date),bs("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null};function Ph(){return typeof document>"u"?"/":document.querySelector("base")?.getAttribute("href")||"/"}const kh=["preserve-all","preserve-by-url-and-detach"],Ih=()=>{const t=ge.drives.preserveStrategy;return t&&(r=>kh.includes(r))(t)?t:"preserve-by-url-and-detach"},jh=t=>{if(t.length===0)return{strategy:"preserve-all"};switch(Ih()){case"preserve-all":return{strategy:"preserve-all"};case"preserve-by-url-and-detach":return{strategy:"preserve-by-url-and-detach",urls:t};default:return{strategy:"preserve-by-url-and-detach",urls:t}}},Mh=t=>window.open(t,"_blank"),Hh=Mh,Ss=[],Fh=()=>({defaultDrives:{remoteDrives:Ss.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]}})),removeOldRemoteDrives:jh(Ss)}});function Vh(t){return new ko(t)}function Bh(t,e,r){return new Io(t).withStorage(e).withCache(new jo).withQueueManager(new Mo).withOptions({...r,...Fh()}).build()}async function Uh(t,e,r){const n={signer:new sl(r),verifier:al()},a=new tl("idb://reactor",{relaxedDurability:!0}),s=new rl(["reactor-client"]);return{...await new nl().withLogger(s).withSigner(n).withReactorBuilder(new il().withDocumentModels(t).withLegacyStorage(e).withSync(new ol().withChannelFactory(new ll(s))).withFeatures({legacyStorageEnabled:!0}).withKysely(new cl({dialect:new dl(a)}))).buildModule(),pg:a}}const $h=ge.routerBasename,zh=[$h,"service-worker.js"].join("/").replace(/\/{2,}/gm,"/");class Wh{ready=!1;debug=!1;registration=null;constructor(e=!1){this.debug=e}setDebug(e){this.debug=e}#t(e){this.debug&&console.log("ServiceWorker message: ",e);const r="type"in e.data?e:null;switch(r?.data.type){case"NEW_VERSION_AVAILABLE":{if(r.data.version===ge.appVersion)return;r.data.requiresHardRefresh&&(this.debug&&console.log("New version available"),window.location.reload());break}default:{console.warn("Unhandled message:",r);break}}}#e(e){this.debug&&console.log("ServiceWorker registered: ",e),navigator.serviceWorker.addEventListener("message",this.#t.bind(this)),this.registration=e,this.ready=!0}async#r(){try{const e=await navigator.serviceWorker.getRegistration();if(e)await e.update(),this.#e(e);else{const n=await navigator.serviceWorker.register(zh);this.#e(n),n.addEventListener("updatefound",()=>{this.#e(n)})}const r=setInterval(async()=>{const n=await navigator.serviceWorker.getRegistration();n?await n.update():(clearInterval(r),this.registerServiceWorker())},ge.appVersionCheckInterval)}catch(e){console.error("ServiceWorker registration failed: ",e)}}registerServiceWorker(e=!1){if(this.debug=e,!("serviceWorker"in navigator)){console.warn("Service Worker not available");return}window.addEventListener("load",()=>{this.#r().catch(console.error)})}}const Kh=new Wh,Zh=250,Yh=({delay:t=Zh})=>{const e=typeof window>"u",r=typeof document<"u"&&document.body.getAttribute("data-show-loader")==="true",[n,a]=m.useState(!t||r);return m.useEffect(()=>{const s=setTimeout(()=>{a(!0)},t);return()=>clearTimeout(s)},[]),_.jsxs("div",{className:`skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${n?"":"hidden"}`,children:[_.jsx("div",{className:"animate-pulse overflow-hidden rounded-full shadow-lg",children:_.jsx(Bo,{})}),e?_.jsx("script",{dangerouslySetInnerHTML:{__html:`setTimeout(() => {
4
+ Latest: ${e.latestVersion}`):or(m.createElement(Su),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}m.useEffect(()=>{t().catch(console.error)},[])},Ru=ge.routerBasename,_i=`${Ru}:display-cookie-banner`,Ga=new Set;let Ei=wu();function wu(){try{return localStorage.getItem(_i)!=="false"}catch(t){return console.error(t),!0}}function Ja(){return Ei}function Ou(t){Ei=t,localStorage.setItem(_i,JSON.stringify(t))}function Du(t){return Ga.add(t),()=>Ga.delete(t)}const Lu=()=>[m.useSyncExternalStore(Du,Ja,Ja),Ou];function fe(){return fe=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},fe.apply(this,arguments)}var _e;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(_e||(_e={}));const qa="popstate";function Au(t){t===void 0&&(t={});function e(n,a){let{pathname:s,search:i,hash:o}=n.location;return nr("",{pathname:s,search:i,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:lr(a)}return Pu(e,r,null,t)}function q(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vt(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Tu(){return Math.random().toString(36).substr(2,8)}function Xa(t,e){return{usr:t.state,key:t.key,idx:e}}function nr(t,e,r,n){return r===void 0&&(r=null),fe({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?dt(e):e,{state:r,key:e&&e.key||n||Tu()})}function lr(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function dt(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function Pu(t,e,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:s=!1}=n,i=a.history,o=_e.Pop,l=null,c=u();c==null&&(c=0,i.replaceState(fe({},i.state,{idx:c}),""));function u(){return(i.state||{idx:null}).idx}function d(){o=_e.Pop;let b=u(),C=b==null?null:b-c;c=b,l&&l({action:o,location:E.location,delta:C})}function f(b,C){o=_e.Push;let N=nr(E.location,b,C);c=u()+1;let k=Xa(N,c),R=E.createHref(N);try{i.pushState(k,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;a.location.assign(R)}s&&l&&l({action:o,location:E.location,delta:1})}function h(b,C){o=_e.Replace;let N=nr(E.location,b,C);c=u();let k=Xa(N,c),R=E.createHref(N);i.replaceState(k,"",R),s&&l&&l({action:o,location:E.location,delta:0})}function v(b){let C=a.location.origin!=="null"?a.location.origin:a.location.href,N=typeof b=="string"?b:lr(b);return N=N.replace(/ $/,"%20"),q(C,"No window.location.(origin|href) available to create URL for href: "+N),new URL(N,C)}let E={get action(){return o},get location(){return t(a,i)},listen(b){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(qa,d),l=b,()=>{a.removeEventListener(qa,d),l=null}},createHref(b){return e(a,b)},createURL:v,encodeLocation(b){let C=v(b);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:f,replace:h,go(b){return i.go(b)}};return E}var le;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(le||(le={}));const ku=new Set(["lazy","caseSensitive","path","id","index","children"]);function Iu(t){return t.index===!0}function Mr(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((a,s)=>{let i=[...r,String(s)],o=typeof a.id=="string"?a.id:i.join("-");if(q(a.index!==!0||!a.children,"Cannot specify children on an index route"),q(!n[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),Iu(a)){let l=fe({},a,e(a),{id:o});return n[o]=l,l}else{let l=fe({},a,e(a),{id:o,children:void 0});return n[o]=l,a.children&&(l.children=Mr(a.children,e,i,n)),l}})}function Qe(t,e,r){return r===void 0&&(r="/"),Sr(t,e,r,!1)}function Sr(t,e,r,n){let a=typeof e=="string"?dt(e):e,s=cr(a.pathname||"/",r);if(s==null)return null;let i=Ci(t);Mu(i);let o=null;for(let l=0;o==null&&l<i.length;++l){let c=Yu(s);o=Ku(i[l],c,n)}return o}function ju(t,e){let{route:r,pathname:n,params:a}=t;return{id:r.id,pathname:n,params:a,data:e[r.id],handle:r.handle}}function Ci(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(s,i,o)=>{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};l.relativePath.startsWith("/")&&(q(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=ot([n,l.relativePath]),u=r.concat(l);s.children&&s.children.length>0&&(q(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ci(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:zu(c,s.index),routesMeta:u})};return t.forEach((s,i)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))a(s,i);else for(let l of xi(s.path))a(s,i,l)}),e}function xi(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,a=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return a?[s,""]:[s];let i=xi(n.join("/")),o=[];return o.push(...i.map(l=>l===""?s:[s,l].join("/"))),a&&o.push(...i),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function Mu(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Wu(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Hu=/^:[\w-]+$/,Fu=3,Vu=2,Bu=1,Uu=10,$u=-2,Qa=t=>t==="*";function zu(t,e){let r=t.split("/"),n=r.length;return r.some(Qa)&&(n+=$u),e&&(n+=Vu),r.filter(a=>!Qa(a)).reduce((a,s)=>a+(Hu.test(s)?Fu:s===""?Bu:Uu),n)}function Wu(t,e){return t.length===e.length&&t.slice(0,-1).every((n,a)=>n===e[a])?t[t.length-1]-e[e.length-1]:0}function Ku(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,a={},s="/",i=[];for(let o=0;o<n.length;++o){let l=n[o],c=o===n.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=es({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d&&c&&r&&!n[n.length-1].route.index&&(d=es({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:ot([s,d.pathname]),pathnameBase:qu(ot([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=ot([s,d.pathnameBase]))}return i}function es(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=Zu(t.path,t.caseSensitive,t.end),a=e.match(r);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:n.reduce((c,u,d)=>{let{paramName:f,isOptional:h}=u;if(f==="*"){let E=o[d]||"";i=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const v=o[d];return h&&!v?c[f]=void 0:c[f]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:t}}function Zu(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Vt(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),n]}function Yu(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vt(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function cr(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Gu(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?dt(t):t;return{pathname:r?r.startsWith("/")?r:Ju(r,e):e,search:Xu(n),hash:Qu(a)}}function Ju(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function ln(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function bi(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Si(t,e){let r=bi(t);return e?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Ni(t,e,r,n){n===void 0&&(n=!1);let a;typeof t=="string"?a=dt(t):(a=fe({},t),q(!a.pathname||!a.pathname.includes("?"),ln("?","pathname","search",a)),q(!a.pathname||!a.pathname.includes("#"),ln("#","pathname","hash",a)),q(!a.search||!a.search.includes("#"),ln("#","search","hash",a)));let s=t===""||a.pathname==="",i=s?"/":a.pathname,o;if(i==null)o=r;else{let d=e.length-1;if(!n&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),d-=1;a.pathname=f.join("/")}o=d>=0?e[d]:"/"}let l=Gu(a,o),c=i&&i!=="/"&&i.endsWith("/"),u=(s||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const ot=t=>t.join("/").replace(/\/\/+/g,"/"),qu=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Xu=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Qu=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class Hr{constructor(e,r,n,a){a===void 0&&(a=!1),this.status=e,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ar(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Ri=["post","put","patch","delete"],ef=new Set(Ri),tf=["get",...Ri],rf=new Set(tf),nf=new Set([301,302,303,307,308]),af=new Set([307,308]),cn={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},sf={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Kt={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Wn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,of=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),wi="remix-router-transitions";function lf(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;q(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(t.mapRouteProperties)a=t.mapRouteProperties;else if(t.detectErrorBoundary){let p=t.detectErrorBoundary;a=y=>({hasErrorBoundary:p(y)})}else a=of;let s={},i=Mr(t.routes,a,void 0,s),o,l=t.basename||"/",c=t.dataStrategy||ff,u=t.patchRoutesOnNavigation,d=fe({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),f=null,h=new Set,v=null,E=null,b=null,C=t.hydrationData!=null,N=Qe(i,t.history.location,l),k=!1,R=null;if(N==null&&!u){let p=Oe(404,{pathname:t.history.location.pathname}),{matches:y,route:x}=us(i);N=y,R={[x.id]:p}}N&&!t.hydrationData&&hr(N,i,t.history.location.pathname).active&&(N=null);let A;if(N)if(N.some(p=>p.route.lazy))A=!1;else if(!N.some(p=>p.route.loader))A=!0;else if(d.v7_partialHydration){let p=t.hydrationData?t.hydrationData.loaderData:null,y=t.hydrationData?t.hydrationData.errors:null;if(y){let x=N.findIndex(w=>y[w.route.id]!==void 0);A=N.slice(0,x+1).every(w=>!An(w.route,p,y))}else A=N.every(x=>!An(x.route,p,y))}else A=t.hydrationData!=null;else if(A=!1,N=[],d.v7_partialHydration){let p=hr(null,i,t.history.location.pathname);p.active&&p.matches&&(k=!0,N=p.matches)}let M,g={historyAction:t.history.action,location:t.history.location,matches:N,initialized:A,navigation:cn,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||R,fetchers:new Map,blockers:new Map},S=_e.Pop,U=!1,V,G=!1,z=new Map,ee=null,ne=!1,Re=!1,Ce=[],oe=new Set,ue=new Map,Be=0,Ze=-1,ve=new Map,xe=new Set,Ae=new Map,Ye=new Map,je=new Set,ht=new Map,pt=new Map,dr;function fo(){if(f=t.history.listen(p=>{let{action:y,location:x,delta:w}=p;if(dr){dr(),dr=void 0;return}Vt(pt.size===0||w!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let L=ia({currentLocation:g.location,nextLocation:x,historyAction:y});if(L&&w!=null){let $=new Promise(W=>{dr=W});t.history.go(w*-1),fr(L,{state:"blocked",location:x,proceed(){fr(L,{state:"proceeding",proceed:void 0,reset:void 0,location:x}),$.then(()=>t.history.go(w))},reset(){let W=new Map(g.blockers);W.set(L,Kt),we({blockers:W})}});return}return mt(y,x)}),r){Rf(e,z);let p=()=>wf(e,z);e.addEventListener("pagehide",p),ee=()=>e.removeEventListener("pagehide",p)}return g.initialized||mt(_e.Pop,g.location,{initialHydration:!0}),M}function ho(){f&&f(),ee&&ee(),h.clear(),V&&V.abort(),g.fetchers.forEach((p,y)=>ur(y)),g.blockers.forEach((p,y)=>sa(y))}function po(p){return h.add(p),()=>h.delete(p)}function we(p,y){y===void 0&&(y={}),g=fe({},g,p);let x=[],w=[];d.v7_fetcherPersist&&g.fetchers.forEach((L,$)=>{L.state==="idle"&&(je.has($)?w.push($):x.push($))}),je.forEach(L=>{!g.fetchers.has(L)&&!ue.has(L)&&w.push(L)}),[...h].forEach(L=>L(g,{deletedFetchers:w,viewTransitionOpts:y.viewTransitionOpts,flushSync:y.flushSync===!0})),d.v7_fetcherPersist?(x.forEach(L=>g.fetchers.delete(L)),w.forEach(L=>ur(L))):w.forEach(L=>je.delete(L))}function xt(p,y,x){var w,L;let{flushSync:$}=x===void 0?{}:x,W=g.actionData!=null&&g.navigation.formMethod!=null&&Me(g.navigation.formMethod)&&g.navigation.state==="loading"&&((w=p.state)==null?void 0:w._isRedirect)!==!0,I;y.actionData?Object.keys(y.actionData).length>0?I=y.actionData:I=null:W?I=g.actionData:I=null;let H=y.loaderData?cs(g.loaderData,y.loaderData,y.matches||[],y.errors):g.loaderData,P=g.blockers;P.size>0&&(P=new Map(P),P.forEach((Q,be)=>P.set(be,Kt)));let B=U===!0||g.navigation.formMethod!=null&&Me(g.navigation.formMethod)&&((L=p.state)==null?void 0:L._isRedirect)!==!0;o&&(i=o,o=void 0),ne||S===_e.Pop||(S===_e.Push?t.history.push(p,p.state):S===_e.Replace&&t.history.replace(p,p.state));let J;if(S===_e.Pop){let Q=z.get(g.location.pathname);Q&&Q.has(p.pathname)?J={currentLocation:g.location,nextLocation:p}:z.has(p.pathname)&&(J={currentLocation:p,nextLocation:g.location})}else if(G){let Q=z.get(g.location.pathname);Q?Q.add(p.pathname):(Q=new Set([p.pathname]),z.set(g.location.pathname,Q)),J={currentLocation:g.location,nextLocation:p}}we(fe({},y,{actionData:I,loaderData:H,historyAction:S,location:p,initialized:!0,navigation:cn,revalidation:"idle",restoreScrollPosition:la(p,y.matches||g.matches),preventScrollReset:B,blockers:P}),{viewTransitionOpts:J,flushSync:$===!0}),S=_e.Pop,U=!1,G=!1,ne=!1,Re=!1,Ce=[]}async function Xn(p,y){if(typeof p=="number"){t.history.go(p);return}let x=Ln(g.location,g.matches,l,d.v7_prependBasename,p,d.v7_relativeSplatPath,y?.fromRouteId,y?.relative),{path:w,submission:L,error:$}=ts(d.v7_normalizeFormMethod,!1,x,y),W=g.location,I=nr(g.location,w,y&&y.state);I=fe({},I,t.history.encodeLocation(I));let H=y&&y.replace!=null?y.replace:void 0,P=_e.Push;H===!0?P=_e.Replace:H===!1||L!=null&&Me(L.formMethod)&&L.formAction===g.location.pathname+g.location.search&&(P=_e.Replace);let B=y&&"preventScrollReset"in y?y.preventScrollReset===!0:void 0,J=(y&&y.flushSync)===!0,Q=ia({currentLocation:W,nextLocation:I,historyAction:P});if(Q){fr(Q,{state:"blocked",location:I,proceed(){fr(Q,{state:"proceeding",proceed:void 0,reset:void 0,location:I}),Xn(p,y)},reset(){let be=new Map(g.blockers);be.set(Q,Kt),we({blockers:be})}});return}return await mt(P,I,{submission:L,pendingError:$,preventScrollReset:B,replace:y&&y.replace,enableViewTransition:y&&y.viewTransition,flushSync:J})}function mo(){if(Gr(),we({revalidation:"loading"}),g.navigation.state!=="submitting"){if(g.navigation.state==="idle"){mt(g.historyAction,g.location,{startUninterruptedRevalidation:!0});return}mt(S||g.historyAction,g.navigation.location,{overrideNavigation:g.navigation,enableViewTransition:G===!0})}}async function mt(p,y,x){V&&V.abort(),V=null,S=p,ne=(x&&x.startUninterruptedRevalidation)===!0,No(g.location,g.matches),U=(x&&x.preventScrollReset)===!0,G=(x&&x.enableViewTransition)===!0;let w=o||i,L=x&&x.overrideNavigation,$=x!=null&&x.initialHydration&&g.matches&&g.matches.length>0&&!k?g.matches:Qe(w,y,l),W=(x&&x.flushSync)===!0;if($&&g.initialized&&!Re&&yf(g.location,y)&&!(x&&x.submission&&Me(x.submission.formMethod))){xt(y,{matches:$},{flushSync:W});return}let I=hr($,w,y.pathname);if(I.active&&I.matches&&($=I.matches),!$){let{error:de,notFoundMatches:ie,route:he}=Jr(y.pathname);xt(y,{matches:ie,loaderData:{},errors:{[he.id]:de}},{flushSync:W});return}V=new AbortController;let H=Ot(t.history,y,V.signal,x&&x.submission),P;if(x&&x.pendingError)P=[_t($).route.id,{type:le.error,error:x.pendingError}];else if(x&&x.submission&&Me(x.submission.formMethod)){let de=await go(H,y,x.submission,$,I.active,{replace:x.replace,flushSync:W});if(de.shortCircuited)return;if(de.pendingActionResult){let[ie,he]=de.pendingActionResult;if(De(he)&&ar(he.error)&&he.error.status===404){V=null,xt(y,{matches:de.matches,loaderData:{},errors:{[ie]:he.error}});return}}$=de.matches||$,P=de.pendingActionResult,L=dn(y,x.submission),W=!1,I.active=!1,H=Ot(t.history,H.url,H.signal)}let{shortCircuited:B,matches:J,loaderData:Q,errors:be}=await vo(H,y,$,I.active,L,x&&x.submission,x&&x.fetcherSubmission,x&&x.replace,x&&x.initialHydration===!0,W,P);B||(V=null,xt(y,fe({matches:J||$},ds(P),{loaderData:Q,errors:be})))}async function go(p,y,x,w,L,$){$===void 0&&($={}),Gr();let W=Sf(y,x);if(we({navigation:W},{flushSync:$.flushSync===!0}),L){let P=await pr(w,y.pathname,p.signal);if(P.type==="aborted")return{shortCircuited:!0};if(P.type==="error"){let B=_t(P.partialMatches).route.id;return{matches:P.partialMatches,pendingActionResult:[B,{type:le.error,error:P.error}]}}else if(P.matches)w=P.matches;else{let{notFoundMatches:B,error:J,route:Q}=Jr(y.pathname);return{matches:B,pendingActionResult:[Q.id,{type:le.error,error:J}]}}}let I,H=qt(w,y);if(!H.route.action&&!H.route.lazy)I={type:le.error,error:Oe(405,{method:p.method,pathname:y.pathname,routeId:H.route.id})};else if(I=(await Bt("action",g,p,[H],w,null))[H.route.id],p.signal.aborted)return{shortCircuited:!0};if(Et(I)){let P;return $&&$.replace!=null?P=$.replace:P=is(I.response.headers.get("Location"),new URL(p.url),l)===g.location.pathname+g.location.search,await gt(p,I,!0,{submission:x,replace:P}),{shortCircuited:!0}}if(nt(I))throw Oe(400,{type:"defer-action"});if(De(I)){let P=_t(w,H.route.id);return($&&$.replace)!==!0&&(S=_e.Push),{matches:w,pendingActionResult:[P.route.id,I]}}return{matches:w,pendingActionResult:[H.route.id,I]}}async function vo(p,y,x,w,L,$,W,I,H,P,B){let J=L||dn(y,$),Q=$||W||hs(J),be=!ne&&(!d.v7_partialHydration||!H);if(w){if(be){let pe=Qn(B);we(fe({navigation:J},pe!==void 0?{actionData:pe}:{}),{flushSync:P})}let ae=await pr(x,y.pathname,p.signal);if(ae.type==="aborted")return{shortCircuited:!0};if(ae.type==="error"){let pe=_t(ae.partialMatches).route.id;return{matches:ae.partialMatches,loaderData:{},errors:{[pe]:ae.error}}}else if(ae.matches)x=ae.matches;else{let{error:pe,notFoundMatches:St,route:zt}=Jr(y.pathname);return{matches:St,loaderData:{},errors:{[zt.id]:pe}}}}let de=o||i,[ie,he]=ns(t.history,g,x,Q,y,d.v7_partialHydration&&H===!0,d.v7_skipActionErrorRevalidation,Re,Ce,oe,je,Ae,xe,de,l,B);if(qr(ae=>!(x&&x.some(pe=>pe.route.id===ae))||ie&&ie.some(pe=>pe.route.id===ae)),Ze=++Be,ie.length===0&&he.length===0){let ae=na();return xt(y,fe({matches:x,loaderData:{},errors:B&&De(B[1])?{[B[0]]:B[1].error}:null},ds(B),ae?{fetchers:new Map(g.fetchers)}:{}),{flushSync:P}),{shortCircuited:!0}}if(be){let ae={};if(!w){ae.navigation=J;let pe=Qn(B);pe!==void 0&&(ae.actionData=pe)}he.length>0&&(ae.fetchers=yo(he)),we(ae,{flushSync:P})}he.forEach(ae=>{Je(ae.key),ae.controller&&ue.set(ae.key,ae.controller)});let bt=()=>he.forEach(ae=>Je(ae.key));V&&V.signal.addEventListener("abort",bt);let{loaderResults:Ut,fetcherResults:$e}=await ea(g,x,ie,he,p);if(p.signal.aborted)return{shortCircuited:!0};V&&V.signal.removeEventListener("abort",bt),he.forEach(ae=>ue.delete(ae.key));let He=Er(Ut);if(He)return await gt(p,He.result,!0,{replace:I}),{shortCircuited:!0};if(He=Er($e),He)return xe.add(He.key),await gt(p,He.result,!0,{replace:I}),{shortCircuited:!0};let{loaderData:Xr,errors:$t}=ls(g,x,Ut,B,he,$e,ht);ht.forEach((ae,pe)=>{ae.subscribe(St=>{(St||ae.done)&&ht.delete(pe)})}),d.v7_partialHydration&&H&&g.errors&&($t=fe({},g.errors,$t));let vt=na(),mr=aa(Ze),gr=vt||mr||he.length>0;return fe({matches:x,loaderData:Xr,errors:$t},gr?{fetchers:new Map(g.fetchers)}:{})}function Qn(p){if(p&&!De(p[1]))return{[p[0]]:p[1].data};if(g.actionData)return Object.keys(g.actionData).length===0?null:g.actionData}function yo(p){return p.forEach(y=>{let x=g.fetchers.get(y.key),w=Zt(void 0,x?x.data:void 0);g.fetchers.set(y.key,w)}),new Map(g.fetchers)}function _o(p,y,x,w){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Je(p);let L=(w&&w.flushSync)===!0,$=o||i,W=Ln(g.location,g.matches,l,d.v7_prependBasename,x,d.v7_relativeSplatPath,y,w?.relative),I=Qe($,W,l),H=hr(I,$,W);if(H.active&&H.matches&&(I=H.matches),!I){Ue(p,y,Oe(404,{pathname:W}),{flushSync:L});return}let{path:P,submission:B,error:J}=ts(d.v7_normalizeFormMethod,!0,W,w);if(J){Ue(p,y,J,{flushSync:L});return}let Q=qt(I,P),be=(w&&w.preventScrollReset)===!0;if(B&&Me(B.formMethod)){Eo(p,y,P,Q,I,H.active,L,be,B);return}Ae.set(p,{routeId:y,path:P}),Co(p,y,P,Q,I,H.active,L,be,B)}async function Eo(p,y,x,w,L,$,W,I,H){Gr(),Ae.delete(p);function P(ye){if(!ye.route.action&&!ye.route.lazy){let Nt=Oe(405,{method:H.formMethod,pathname:x,routeId:y});return Ue(p,y,Nt,{flushSync:W}),!0}return!1}if(!$&&P(w))return;let B=g.fetchers.get(p);Ge(p,Nf(H,B),{flushSync:W});let J=new AbortController,Q=Ot(t.history,x,J.signal,H);if($){let ye=await pr(L,new URL(Q.url).pathname,Q.signal,p);if(ye.type==="aborted")return;if(ye.type==="error"){Ue(p,y,ye.error,{flushSync:W});return}else if(ye.matches){if(L=ye.matches,w=qt(L,x),P(w))return}else{Ue(p,y,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,J);let be=Be,ie=(await Bt("action",g,Q,[w],L,p))[w.route.id];if(Q.signal.aborted){ue.get(p)===J&&ue.delete(p);return}if(d.v7_fetcherPersist&&je.has(p)){if(Et(ie)||De(ie)){Ge(p,qe(void 0));return}}else{if(Et(ie))if(ue.delete(p),Ze>be){Ge(p,qe(void 0));return}else return xe.add(p),Ge(p,Zt(H)),gt(Q,ie,!1,{fetcherSubmission:H,preventScrollReset:I});if(De(ie)){Ue(p,y,ie.error);return}}if(nt(ie))throw Oe(400,{type:"defer-action"});let he=g.navigation.location||g.location,bt=Ot(t.history,he,J.signal),Ut=o||i,$e=g.navigation.state!=="idle"?Qe(Ut,g.navigation.location,l):g.matches;q($e,"Didn't find any matches after fetcher action");let He=++Be;ve.set(p,He);let Xr=Zt(H,ie.data);g.fetchers.set(p,Xr);let[$t,vt]=ns(t.history,g,$e,H,he,!1,d.v7_skipActionErrorRevalidation,Re,Ce,oe,je,Ae,xe,Ut,l,[w.route.id,ie]);vt.filter(ye=>ye.key!==p).forEach(ye=>{let Nt=ye.key,ca=g.fetchers.get(Nt),Oo=Zt(void 0,ca?ca.data:void 0);g.fetchers.set(Nt,Oo),Je(Nt),ye.controller&&ue.set(Nt,ye.controller)}),we({fetchers:new Map(g.fetchers)});let mr=()=>vt.forEach(ye=>Je(ye.key));J.signal.addEventListener("abort",mr);let{loaderResults:gr,fetcherResults:ae}=await ea(g,$e,$t,vt,bt);if(J.signal.aborted)return;J.signal.removeEventListener("abort",mr),ve.delete(p),ue.delete(p),vt.forEach(ye=>ue.delete(ye.key));let pe=Er(gr);if(pe)return gt(bt,pe.result,!1,{preventScrollReset:I});if(pe=Er(ae),pe)return xe.add(pe.key),gt(bt,pe.result,!1,{preventScrollReset:I});let{loaderData:St,errors:zt}=ls(g,$e,gr,void 0,vt,ae,ht);if(g.fetchers.has(p)){let ye=qe(ie.data);g.fetchers.set(p,ye)}aa(He),g.navigation.state==="loading"&&He>Ze?(q(S,"Expected pending action"),V&&V.abort(),xt(g.navigation.location,{matches:$e,loaderData:St,errors:zt,fetchers:new Map(g.fetchers)})):(we({errors:zt,loaderData:cs(g.loaderData,St,$e,zt),fetchers:new Map(g.fetchers)}),Re=!1)}async function Co(p,y,x,w,L,$,W,I,H){let P=g.fetchers.get(p);Ge(p,Zt(H,P?P.data:void 0),{flushSync:W});let B=new AbortController,J=Ot(t.history,x,B.signal);if($){let ie=await pr(L,new URL(J.url).pathname,J.signal,p);if(ie.type==="aborted")return;if(ie.type==="error"){Ue(p,y,ie.error,{flushSync:W});return}else if(ie.matches)L=ie.matches,w=qt(L,x);else{Ue(p,y,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,B);let Q=Be,de=(await Bt("loader",g,J,[w],L,p))[w.route.id];if(nt(de)&&(de=await Kn(de,J.signal,!0)||de),ue.get(p)===B&&ue.delete(p),!J.signal.aborted){if(je.has(p)){Ge(p,qe(void 0));return}if(Et(de))if(Ze>Q){Ge(p,qe(void 0));return}else{xe.add(p),await gt(J,de,!1,{preventScrollReset:I});return}if(De(de)){Ue(p,y,de.error);return}q(!nt(de),"Unhandled fetcher deferred data"),Ge(p,qe(de.data))}}async function gt(p,y,x,w){let{submission:L,fetcherSubmission:$,preventScrollReset:W,replace:I}=w===void 0?{}:w;y.response.headers.has("X-Remix-Revalidate")&&(Re=!0);let H=y.response.headers.get("Location");q(H,"Expected a Location header on the redirect Response"),H=is(H,new URL(p.url),l);let P=nr(g.location,H,{_isRedirect:!0});if(r){let ie=!1;if(y.response.headers.has("X-Remix-Reload-Document"))ie=!0;else if(Wn.test(H)){const he=t.history.createURL(H);ie=he.origin!==e.location.origin||cr(he.pathname,l)==null}if(ie){I?e.location.replace(H):e.location.assign(H);return}}V=null;let B=I===!0||y.response.headers.has("X-Remix-Replace")?_e.Replace:_e.Push,{formMethod:J,formAction:Q,formEncType:be}=g.navigation;!L&&!$&&J&&Q&&be&&(L=hs(g.navigation));let de=L||$;if(af.has(y.response.status)&&de&&Me(de.formMethod))await mt(B,P,{submission:fe({},de,{formAction:H}),preventScrollReset:W||U,enableViewTransition:x?G:void 0});else{let ie=dn(P,L);await mt(B,P,{overrideNavigation:ie,fetcherSubmission:$,preventScrollReset:W||U,enableViewTransition:x?G:void 0})}}async function Bt(p,y,x,w,L,$){let W,I={};try{W=await hf(c,p,y,x,w,L,$,s,a)}catch(H){return w.forEach(P=>{I[P.route.id]={type:le.error,error:H}}),I}for(let[H,P]of Object.entries(W))if(_f(P)){let B=P.result;I[H]={type:le.redirect,response:gf(B,x,H,L,l,d.v7_relativeSplatPath)}}else I[H]=await mf(P);return I}async function ea(p,y,x,w,L){let $=p.matches,W=Bt("loader",p,L,x,y,null),I=Promise.all(w.map(async B=>{if(B.matches&&B.match&&B.controller){let Q=(await Bt("loader",p,Ot(t.history,B.path,B.controller.signal),[B.match],B.matches,B.key))[B.match.route.id];return{[B.key]:Q}}else return Promise.resolve({[B.key]:{type:le.error,error:Oe(404,{pathname:B.path})}})})),H=await W,P=(await I).reduce((B,J)=>Object.assign(B,J),{});return await Promise.all([xf(y,H,L.signal,$,p.loaderData),bf(y,P,w)]),{loaderResults:H,fetcherResults:P}}function Gr(){Re=!0,Ce.push(...qr()),Ae.forEach((p,y)=>{ue.has(y)&&oe.add(y),Je(y)})}function Ge(p,y,x){x===void 0&&(x={}),g.fetchers.set(p,y),we({fetchers:new Map(g.fetchers)},{flushSync:(x&&x.flushSync)===!0})}function Ue(p,y,x,w){w===void 0&&(w={});let L=_t(g.matches,y);ur(p),we({errors:{[L.route.id]:x},fetchers:new Map(g.fetchers)},{flushSync:(w&&w.flushSync)===!0})}function ta(p){return Ye.set(p,(Ye.get(p)||0)+1),je.has(p)&&je.delete(p),g.fetchers.get(p)||sf}function ur(p){let y=g.fetchers.get(p);ue.has(p)&&!(y&&y.state==="loading"&&ve.has(p))&&Je(p),Ae.delete(p),ve.delete(p),xe.delete(p),d.v7_fetcherPersist&&je.delete(p),oe.delete(p),g.fetchers.delete(p)}function xo(p){let y=(Ye.get(p)||0)-1;y<=0?(Ye.delete(p),je.add(p),d.v7_fetcherPersist||ur(p)):Ye.set(p,y),we({fetchers:new Map(g.fetchers)})}function Je(p){let y=ue.get(p);y&&(y.abort(),ue.delete(p))}function ra(p){for(let y of p){let x=ta(y),w=qe(x.data);g.fetchers.set(y,w)}}function na(){let p=[],y=!1;for(let x of xe){let w=g.fetchers.get(x);q(w,"Expected fetcher: "+x),w.state==="loading"&&(xe.delete(x),p.push(x),y=!0)}return ra(p),y}function aa(p){let y=[];for(let[x,w]of ve)if(w<p){let L=g.fetchers.get(x);q(L,"Expected fetcher: "+x),L.state==="loading"&&(Je(x),ve.delete(x),y.push(x))}return ra(y),y.length>0}function bo(p,y){let x=g.blockers.get(p)||Kt;return pt.get(p)!==y&&pt.set(p,y),x}function sa(p){g.blockers.delete(p),pt.delete(p)}function fr(p,y){let x=g.blockers.get(p)||Kt;q(x.state==="unblocked"&&y.state==="blocked"||x.state==="blocked"&&y.state==="blocked"||x.state==="blocked"&&y.state==="proceeding"||x.state==="blocked"&&y.state==="unblocked"||x.state==="proceeding"&&y.state==="unblocked","Invalid blocker state transition: "+x.state+" -> "+y.state);let w=new Map(g.blockers);w.set(p,y),we({blockers:w})}function ia(p){let{currentLocation:y,nextLocation:x,historyAction:w}=p;if(pt.size===0)return;pt.size>1&&Vt(!1,"A router only supports one blocker at a time");let L=Array.from(pt.entries()),[$,W]=L[L.length-1],I=g.blockers.get($);if(!(I&&I.state==="proceeding")&&W({currentLocation:y,nextLocation:x,historyAction:w}))return $}function Jr(p){let y=Oe(404,{pathname:p}),x=o||i,{matches:w,route:L}=us(x);return qr(),{notFoundMatches:w,route:L,error:y}}function qr(p){let y=[];return ht.forEach((x,w)=>{(!p||p(w))&&(x.cancel(),y.push(w),ht.delete(w))}),y}function So(p,y,x){if(v=p,b=y,E=x||null,!C&&g.navigation===cn){C=!0;let w=la(g.location,g.matches);w!=null&&we({restoreScrollPosition:w})}return()=>{v=null,b=null,E=null}}function oa(p,y){return E&&E(p,y.map(w=>ju(w,g.loaderData)))||p.key}function No(p,y){if(v&&b){let x=oa(p,y);v[x]=b()}}function la(p,y){if(v){let x=oa(p,y),w=v[x];if(typeof w=="number")return w}return null}function hr(p,y,x){if(u)if(p){if(Object.keys(p[0].params).length>0)return{active:!0,matches:Sr(y,x,l,!0)}}else return{active:!0,matches:Sr(y,x,l,!0)||[]};return{active:!1,matches:null}}async function pr(p,y,x,w){if(!u)return{type:"success",matches:p};let L=p;for(;;){let $=o==null,W=o||i,I=s;try{await u({signal:x,path:y,matches:L,fetcherKey:w,patch:(B,J)=>{x.aborted||ss(B,J,W,I,a)}})}catch(B){return{type:"error",error:B,partialMatches:L}}finally{$&&!x.aborted&&(i=[...i])}if(x.aborted)return{type:"aborted"};let H=Qe(W,y,l);if(H)return{type:"success",matches:H};let P=Sr(W,y,l,!0);if(!P||L.length===P.length&&L.every((B,J)=>B.route.id===P[J].route.id))return{type:"success",matches:null};L=P}}function Ro(p){s={},o=Mr(p,a,void 0,s)}function wo(p,y){let x=o==null;ss(p,y,o||i,s,a),x&&(i=[...i],we({}))}return M={get basename(){return l},get future(){return d},get state(){return g},get routes(){return i},get window(){return e},initialize:fo,subscribe:po,enableScrollRestoration:So,navigate:Xn,fetch:_o,revalidate:mo,createHref:p=>t.history.createHref(p),encodeLocation:p=>t.history.encodeLocation(p),getFetcher:ta,deleteFetcher:xo,dispose:ho,getBlocker:bo,deleteBlocker:sa,patchRoutes:wo,_internalFetchControllers:ue,_internalActiveDeferreds:ht,_internalSetRoutes:Ro},M}function cf(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Ln(t,e,r,n,a,s,i,o){let l,c;if(i){l=[];for(let d of e)if(l.push(d),d.route.id===i){c=d;break}}else l=e,c=e[e.length-1];let u=Ni(a||".",Si(l,s),cr(t.pathname,r)||t.pathname,o==="path");if(a==null&&(u.search=t.search,u.hash=t.hash),(a==null||a===""||a===".")&&c){let d=Zn(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let f=new URLSearchParams(u.search),h=f.getAll("index");f.delete("index"),h.filter(E=>E).forEach(E=>f.append("index",E));let v=f.toString();u.search=v?"?"+v:""}}return n&&r!=="/"&&(u.pathname=u.pathname==="/"?r:ot([r,u.pathname])),lr(u)}function ts(t,e,r,n){if(!n||!cf(n))return{path:r};if(n.formMethod&&!Cf(n.formMethod))return{path:r,error:Oe(405,{method:n.formMethod})};let a=()=>({path:r,error:Oe(400,{type:"invalid-body"})}),s=n.formMethod||"get",i=t?s.toUpperCase():s.toLowerCase(),o=Li(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Me(i))return a();let f=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,v)=>{let[E,b]=v;return""+h+E+"="+b+`
5
+ `},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:f}}}else if(n.formEncType==="application/json"){if(!Me(i))return a();try{let f=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:o,formEncType:n.formEncType,formData:void 0,json:f,text:void 0}}}catch{return a()}}}q(typeof FormData=="function","FormData is not available in this environment");let l,c;if(n.formData)l=Tn(n.formData),c=n.formData;else if(n.body instanceof FormData)l=Tn(n.body),c=n.body;else if(n.body instanceof URLSearchParams)l=n.body,c=os(l);else if(n.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(n.body),c=os(l)}catch{return a()}let u={formMethod:i,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Me(u.formMethod))return{path:r,submission:u};let d=dt(r);return e&&d.search&&Zn(d.search)&&l.append("index",""),d.search="?"+l,{path:lr(d),submission:u}}function rs(t,e,r){r===void 0&&(r=!1);let n=t.findIndex(a=>a.route.id===e);return n>=0?t.slice(0,r?n+1:n):t}function ns(t,e,r,n,a,s,i,o,l,c,u,d,f,h,v,E){let b=E?De(E[1])?E[1].error:E[1].data:void 0,C=t.createURL(e.location),N=t.createURL(a),k=r;s&&e.errors?k=rs(r,Object.keys(e.errors)[0],!0):E&&De(E[1])&&(k=rs(r,E[0]));let R=E?E[1].statusCode:void 0,A=i&&R&&R>=400,M=k.filter((S,U)=>{let{route:V}=S;if(V.lazy)return!0;if(V.loader==null)return!1;if(s)return An(V,e.loaderData,e.errors);if(df(e.loaderData,e.matches[U],S)||l.some(ee=>ee===S.route.id))return!0;let G=e.matches[U],z=S;return as(S,fe({currentUrl:C,currentParams:G.params,nextUrl:N,nextParams:z.params},n,{actionResult:b,actionStatus:R,defaultShouldRevalidate:A?!1:o||C.pathname+C.search===N.pathname+N.search||C.search!==N.search||Oi(G,z)}))}),g=[];return d.forEach((S,U)=>{if(s||!r.some(ne=>ne.route.id===S.routeId)||u.has(U))return;let V=Qe(h,S.path,v);if(!V){g.push({key:U,routeId:S.routeId,path:S.path,matches:null,match:null,controller:null});return}let G=e.fetchers.get(U),z=qt(V,S.path),ee=!1;f.has(U)?ee=!1:c.has(U)?(c.delete(U),ee=!0):G&&G.state!=="idle"&&G.data===void 0?ee=o:ee=as(z,fe({currentUrl:C,currentParams:e.matches[e.matches.length-1].params,nextUrl:N,nextParams:r[r.length-1].params},n,{actionResult:b,actionStatus:R,defaultShouldRevalidate:A?!1:o})),ee&&g.push({key:U,routeId:S.routeId,path:S.path,matches:V,match:z,controller:new AbortController})}),[M,g]}function An(t,e,r){if(t.lazy)return!0;if(!t.loader)return!1;let n=e!=null&&e[t.id]!==void 0,a=r!=null&&r[t.id]!==void 0;return!n&&a?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!n&&!a}function df(t,e,r){let n=!e||r.route.id!==e.route.id,a=t[r.route.id]===void 0;return n||a}function Oi(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function as(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function ss(t,e,r,n,a){var s;let i;if(t){let c=n[t];q(c,"No route found to patch children into: routeId = "+t),c.children||(c.children=[]),i=c.children}else i=r;let o=e.filter(c=>!i.some(u=>Di(c,u))),l=Mr(o,a,[t||"_","patch",String(((s=i)==null?void 0:s.length)||"0")],n);i.push(...l)}function Di(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((r,n)=>{var a;return(a=e.children)==null?void 0:a.some(s=>Di(r,s))}):!1}async function uf(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let a=r[t.id];q(a,"No route found in manifest");let s={};for(let i in n){let l=a[i]!==void 0&&i!=="hasErrorBoundary";Vt(!l,'Route "'+a.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!l&&!ku.has(i)&&(s[i]=n[i])}Object.assign(a,s),Object.assign(a,fe({},e(a),{lazy:void 0}))}async function ff(t){let{matches:e}=t,r=e.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,s,i)=>Object.assign(a,{[r[i].route.id]:s}),{})}async function hf(t,e,r,n,a,s,i,o,l,c){let u=s.map(h=>h.route.lazy?uf(h.route,l,o):void 0),d=s.map((h,v)=>{let E=u[v],b=a.some(N=>N.route.id===h.route.id);return fe({},h,{shouldLoad:b,resolve:async N=>(N&&n.method==="GET"&&(h.route.lazy||h.route.loader)&&(b=!0),b?pf(e,n,h,E,N,c):Promise.resolve({type:le.data,result:void 0}))})}),f=await t({matches:d,request:n,params:s[0].params,fetcherKey:i,context:c});try{await Promise.all(u)}catch{}return f}async function pf(t,e,r,n,a,s){let i,o,l=c=>{let u,d=new Promise((v,E)=>u=E);o=()=>u(),e.signal.addEventListener("abort",o);let f=v=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):c({request:e,params:r.params,context:s},...v!==void 0?[v]:[]),h=(async()=>{try{return{type:"data",result:await(a?a(E=>f(E)):f())}}catch(v){return{type:"error",result:v}}})();return Promise.race([h,d])};try{let c=r.route[t];if(n)if(c){let u,[d]=await Promise.all([l(c).catch(f=>{u=f}),n]);if(u!==void 0)throw u;i=d}else if(await n,c=r.route[t],c)i=await l(c);else if(t==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw Oe(405,{method:e.method,pathname:d,routeId:r.route.id})}else return{type:le.data,result:void 0};else if(c)i=await l(c);else{let u=new URL(e.url),d=u.pathname+u.search;throw Oe(404,{pathname:d})}q(i.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:le.error,result:c}}finally{o&&e.signal.removeEventListener("abort",o)}return i}async function mf(t){let{result:e,type:r}=t;if(Ai(e)){let d;try{let f=e.headers.get("Content-Type");f&&/\bapplication\/json\b/.test(f)?e.body==null?d=null:d=await e.json():d=await e.text()}catch(f){return{type:le.error,error:f}}return r===le.error?{type:le.error,error:new Hr(e.status,e.statusText,d),statusCode:e.status,headers:e.headers}:{type:le.data,data:d,statusCode:e.status,headers:e.headers}}if(r===le.error){if(fs(e)){var n,a;if(e.data instanceof Error){var s,i;return{type:le.error,error:e.data,statusCode:(s=e.init)==null?void 0:s.status,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}}return{type:le.error,error:new Hr(((n=e.init)==null?void 0:n.status)||500,void 0,e.data),statusCode:ar(e)?e.status:void 0,headers:(a=e.init)!=null&&a.headers?new Headers(e.init.headers):void 0}}return{type:le.error,error:e,statusCode:ar(e)?e.status:void 0}}if(Ef(e)){var o,l;return{type:le.deferred,deferredData:e,statusCode:(o=e.init)==null?void 0:o.status,headers:((l=e.init)==null?void 0:l.headers)&&new Headers(e.init.headers)}}if(fs(e)){var c,u;return{type:le.data,data:e.data,statusCode:(c=e.init)==null?void 0:c.status,headers:(u=e.init)!=null&&u.headers?new Headers(e.init.headers):void 0}}return{type:le.data,data:e}}function gf(t,e,r,n,a,s){let i=t.headers.get("Location");if(q(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Wn.test(i)){let o=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=Ln(new URL(e.url),o,a,!0,i,s),t.headers.set("Location",i)}return t}function is(t,e,r){if(Wn.test(t)){let n=t,a=n.startsWith("//")?new URL(e.protocol+n):new URL(n),s=cr(a.pathname,r)!=null;if(a.origin===e.origin&&s)return a.pathname+a.search+a.hash}return t}function Ot(t,e,r,n){let a=t.createURL(Li(e)).toString(),s={signal:r};if(n&&Me(n.formMethod)){let{formMethod:i,formEncType:o}=n;s.method=i.toUpperCase(),o==="application/json"?(s.headers=new Headers({"Content-Type":o}),s.body=JSON.stringify(n.json)):o==="text/plain"?s.body=n.text:o==="application/x-www-form-urlencoded"&&n.formData?s.body=Tn(n.formData):s.body=n.formData}return new Request(a,s)}function Tn(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function os(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function vf(t,e,r,n,a){let s={},i=null,o,l=!1,c={},u=r&&De(r[1])?r[1].error:void 0;return t.forEach(d=>{if(!(d.route.id in e))return;let f=d.route.id,h=e[f];if(q(!Et(h),"Cannot handle redirect results in processLoaderData"),De(h)){let v=h.error;u!==void 0&&(v=u,u=void 0),i=i||{};{let E=_t(t,f);i[E.route.id]==null&&(i[E.route.id]=v)}s[f]=void 0,l||(l=!0,o=ar(h.error)?h.error.status:500),h.headers&&(c[f]=h.headers)}else nt(h)?(n.set(f,h.deferredData),s[f]=h.deferredData.data,h.statusCode!=null&&h.statusCode!==200&&!l&&(o=h.statusCode),h.headers&&(c[f]=h.headers)):(s[f]=h.data,h.statusCode&&h.statusCode!==200&&!l&&(o=h.statusCode),h.headers&&(c[f]=h.headers))}),u!==void 0&&r&&(i={[r[0]]:u},s[r[0]]=void 0),{loaderData:s,errors:i,statusCode:o||200,loaderHeaders:c}}function ls(t,e,r,n,a,s,i){let{loaderData:o,errors:l}=vf(e,r,n,i);return a.forEach(c=>{let{key:u,match:d,controller:f}=c,h=s[u];if(q(h,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if(De(h)){let v=_t(t.matches,d?.route.id);l&&l[v.route.id]||(l=fe({},l,{[v.route.id]:h.error})),t.fetchers.delete(u)}else if(Et(h))q(!1,"Unhandled fetcher revalidation redirect");else if(nt(h))q(!1,"Unhandled fetcher deferred data");else{let v=qe(h.data);t.fetchers.set(u,v)}}),{loaderData:o,errors:l}}function cs(t,e,r,n){let a=fe({},e);for(let s of r){let i=s.route.id;if(e.hasOwnProperty(i)?e[i]!==void 0&&(a[i]=e[i]):t[i]!==void 0&&s.route.loader&&(a[i]=t[i]),n&&n.hasOwnProperty(i))break}return a}function ds(t){return t?De(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function _t(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function us(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Oe(t,e){let{pathname:r,routeId:n,method:a,type:s,message:i}=e===void 0?{}:e,o="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(o="Bad Request",a&&r&&n?l="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":s==="defer-action"?l="defer() is not supported in actions":s==="invalid-body"&&(l="Unable to encode submission body")):t===403?(o="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):t===404?(o="Not Found",l='No route matches URL "'+r+'"'):t===405&&(o="Method Not Allowed",a&&r&&n?l="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new Hr(t||500,o,new Error(l),!0)}function Er(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,a]=e[r];if(Et(a))return{key:n,result:a}}}function Li(t){let e=typeof t=="string"?dt(t):t;return lr(fe({},e,{hash:""}))}function yf(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function _f(t){return Ai(t.result)&&nf.has(t.result.status)}function nt(t){return t.type===le.deferred}function De(t){return t.type===le.error}function Et(t){return(t&&t.type)===le.redirect}function fs(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Ef(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function Ai(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Cf(t){return rf.has(t.toLowerCase())}function Me(t){return ef.has(t.toLowerCase())}async function xf(t,e,r,n,a){let s=Object.entries(e);for(let i=0;i<s.length;i++){let[o,l]=s[i],c=t.find(f=>f?.route.id===o);if(!c)continue;let u=n.find(f=>f.route.id===c.route.id),d=u!=null&&!Oi(u,c)&&(a&&a[c.route.id])!==void 0;nt(l)&&d&&await Kn(l,r,!1).then(f=>{f&&(e[o]=f)})}}async function bf(t,e,r){for(let n=0;n<r.length;n++){let{key:a,routeId:s,controller:i}=r[n],o=e[a];t.find(c=>c?.route.id===s)&&nt(o)&&(q(i,"Expected an AbortController for revalidating fetcher deferred result"),await Kn(o,i.signal,!0).then(c=>{c&&(e[a]=c)}))}}async function Kn(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:le.data,data:t.deferredData.unwrappedData}}catch(a){return{type:le.error,error:a}}return{type:le.data,data:t.deferredData.data}}}function Zn(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function qt(t,e){let r=typeof e=="string"?dt(e).search:e.search;if(t[t.length-1].route.index&&Zn(r||""))return t[t.length-1];let n=bi(t);return n[n.length-1]}function hs(t){let{formMethod:e,formAction:r,formEncType:n,text:a,formData:s,json:i}=t;if(!(!e||!r||!n)){if(a!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(s!=null)return{formMethod:e,formAction:r,formEncType:n,formData:s,json:void 0,text:void 0};if(i!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function dn(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Sf(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Zt(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Nf(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function qe(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Rf(t,e){try{let r=t.sessionStorage.getItem(wi);if(r){let n=JSON.parse(r);for(let[a,s]of Object.entries(n||{}))s&&Array.isArray(s)&&e.set(a,new Set(s||[]))}}catch{}}function wf(t,e){if(e.size>0){let r={};for(let[n,a]of e)r[n]=[...a];try{t.sessionStorage.setItem(wi,JSON.stringify(r))}catch(n){Vt(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}function Fr(){return Fr=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},Fr.apply(this,arguments)}const $r=m.createContext(null),Ti=m.createContext(null),zr=m.createContext(null),Wr=m.createContext(null),ut=m.createContext({outlet:null,matches:[],isDataRoute:!1}),Pi=m.createContext(null);function Kr(){return m.useContext(Wr)!=null}function Zr(){return Kr()||q(!1),m.useContext(Wr).location}function Of(){return m.useContext(Wr).navigationType}function ki(t){m.useContext(zr).static||m.useLayoutEffect(t)}function Df(){let{isDataRoute:t}=m.useContext(ut);return t?zf():Lf()}function Lf(){Kr()||q(!1);let t=m.useContext($r),{basename:e,future:r,navigator:n}=m.useContext(zr),{matches:a}=m.useContext(ut),{pathname:s}=Zr(),i=JSON.stringify(Si(a,r.v7_relativeSplatPath)),o=m.useRef(!1);return ki(()=>{o.current=!0}),m.useCallback(function(c,u){if(u===void 0&&(u={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=Ni(c,JSON.parse(i),s,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:ot([e,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[e,n,i,s,t])}const Af=m.createContext(null);function Tf(t){let e=m.useContext(ut).outlet;return e&&m.createElement(Af.Provider,{value:t},e)}function Pf(){let{matches:t}=m.useContext(ut),e=t[t.length-1];return e?e.params:{}}function kf(t,e,r,n){Kr()||q(!1);let{navigator:a}=m.useContext(zr),{matches:s}=m.useContext(ut),i=s[s.length-1],o=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let c=Zr(),u;u=c;let d=u.pathname||"/",f=d;if(l!=="/"){let E=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(E.length).join("/")}let h=Qe(t,{pathname:f});return Ff(h&&h.map(E=>Object.assign({},E,{params:Object.assign({},o,E.params),pathname:ot([l,a.encodeLocation?a.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?l:ot([l,a.encodeLocation?a.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),s,r,n)}function If(){let t=$f(),e=ar(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),r?m.createElement("pre",{style:a},r):null,null)}const jf=m.createElement(If,null);class Mf extends m.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?m.createElement(ut.Provider,{value:this.props.routeContext},m.createElement(Pi.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Hf(t){let{routeContext:e,match:r,children:n}=t,a=m.useContext($r);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),m.createElement(ut.Provider,{value:e},n)}function Ff(t,e,r,n){var a;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,o=(a=r)==null?void 0:a.errors;if(o!=null){let u=i.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);u>=0||q(!1),i=i.slice(0,Math.min(i.length,u+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<i.length;u++){let d=i[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:f,errors:h}=r,v=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||v){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((u,d,f)=>{let h,v=!1,E=null,b=null;r&&(h=o&&d.route.id?o[d.route.id]:void 0,E=d.route.errorElement||jf,l&&(c<0&&f===0?(Wf("route-fallback"),v=!0,b=null):c===f&&(v=!0,b=d.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,f+1)),N=()=>{let k;return h?k=E:v?k=b:d.route.Component?k=m.createElement(d.route.Component,null):d.route.element?k=d.route.element:k=u,m.createElement(Hf,{match:d,routeContext:{outlet:u,matches:C,isDataRoute:r!=null},children:k})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?m.createElement(Mf,{location:r.location,revalidation:r.revalidation,component:E,error:h,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):N()},null)}var Ii=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Ii||{}),ji=(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})(ji||{});function Vf(t){let e=m.useContext($r);return e||q(!1),e}function Bf(t){let e=m.useContext(Ti);return e||q(!1),e}function Uf(t){let e=m.useContext(ut);return e||q(!1),e}function Mi(t){let e=Uf(),r=e.matches[e.matches.length-1];return r.route.id||q(!1),r.route.id}function $f(){var t;let e=m.useContext(Pi),r=Bf(ji.UseRouteError),n=Mi();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function zf(){let{router:t}=Vf(Ii.UseNavigateStable),e=Mi(),r=m.useRef(!1);return ki(()=>{r.current=!0}),m.useCallback(function(a,s){s===void 0&&(s={}),r.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Fr({fromRouteId:e},s)))},[t,e])}const ps={};function Wf(t,e,r){ps[t]||(ps[t]=!0)}function Kf(t,e){t?.v7_startTransition,t?.v7_relativeSplatPath===void 0&&(!e||e.v7_relativeSplatPath),e&&(e.v7_fetcherPersist,e.v7_normalizeFormMethod,e.v7_partialHydration,e.v7_skipActionErrorRevalidation)}function Zf(t){return Tf(t.context)}function Yf(t){q(!1)}function Gf(t){let{basename:e="/",children:r=null,location:n,navigationType:a=_e.Pop,navigator:s,static:i=!1,future:o}=t;Kr()&&q(!1);let l=e.replace(/^\/*/,"/"),c=m.useMemo(()=>({basename:l,navigator:s,static:i,future:Fr({v7_relativeSplatPath:!1},o)}),[l,o,s,i]);typeof n=="string"&&(n=dt(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:v="default"}=n,E=m.useMemo(()=>{let b=cr(u,l);return b==null?null:{location:{pathname:b,search:d,hash:f,state:h,key:v},navigationType:a}},[l,u,d,f,h,v,a]);return E==null?null:m.createElement(zr.Provider,{value:c},m.createElement(Wr.Provider,{children:r,value:E}))}new Promise(()=>{});function Pn(t,e){e===void 0&&(e=[]);let r=[];return m.Children.forEach(t,(n,a)=>{if(!m.isValidElement(n))return;let s=[...e,a];if(n.type===m.Fragment){r.push.apply(r,Pn(n.props.children,s));return}n.type!==Yf&&q(!1),!n.props.index||!n.props.children||q(!1);let i={id:n.props.id||s.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&&(i.children=Pn(n.props.children,s)),r.push(i)}),r}function Jf(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:m.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:m.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:m.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function Vr(){return Vr=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},Vr.apply(this,arguments)}const qf="6";try{window.__reactRouterVersion=qf}catch{}function Xf(t,e){return lf({basename:e?.basename,future:Vr({},e?.future,{v7_prependBasename:!0}),history:Au({window:e?.window}),hydrationData:e?.hydrationData||Qf(),routes:t,mapRouteProperties:Jf,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window}).initialize()}function Qf(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Vr({},e,{errors:eh(e.errors)})),e}function eh(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,a]of e)if(a&&a.__type==="RouteErrorResponse")r[n]=new Hr(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let s=window[a.__subType];if(typeof s=="function")try{let i=new s(a.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let s=new Error(a.message);s.stack="",r[n]=s}}else r[n]=a;return r}const th=m.createContext({isTransitioning:!1}),rh=m.createContext(new Map),nh="startTransition",ms=To[nh],ah="flushSync",gs=Do[ah];function sh(t){ms?ms(t):t()}function Yt(t){gs?gs(t):t()}class ih{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function oh(t){let{fallbackElement:e,router:r,future:n}=t,[a,s]=m.useState(r.state),[i,o]=m.useState(),[l,c]=m.useState({isTransitioning:!1}),[u,d]=m.useState(),[f,h]=m.useState(),[v,E]=m.useState(),b=m.useRef(new Map),{v7_startTransition:C}=n||{},N=m.useCallback(S=>{C?sh(S):S()},[C]),k=m.useCallback((S,U)=>{let{deletedFetchers:V,flushSync:G,viewTransitionOpts:z}=U;S.fetchers.forEach((ne,Re)=>{ne.data!==void 0&&b.current.set(Re,ne.data)}),V.forEach(ne=>b.current.delete(ne));let ee=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!z||ee){G?Yt(()=>s(S)):N(()=>s(S));return}if(G){Yt(()=>{f&&(u&&u.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:z.currentLocation,nextLocation:z.nextLocation})});let ne=r.window.document.startViewTransition(()=>{Yt(()=>s(S))});ne.finished.finally(()=>{Yt(()=>{d(void 0),h(void 0),o(void 0),c({isTransitioning:!1})})}),Yt(()=>h(ne));return}f?(u&&u.resolve(),f.skipTransition(),E({state:S,currentLocation:z.currentLocation,nextLocation:z.nextLocation})):(o(S),c({isTransitioning:!0,flushSync:!1,currentLocation:z.currentLocation,nextLocation:z.nextLocation}))},[r.window,f,u,b,N]);m.useLayoutEffect(()=>r.subscribe(k),[r,k]),m.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new ih)},[l]),m.useEffect(()=>{if(u&&i&&r.window){let S=i,U=u.promise,V=r.window.document.startViewTransition(async()=>{N(()=>s(S)),await U});V.finished.finally(()=>{d(void 0),h(void 0),o(void 0),c({isTransitioning:!1})}),h(V)}},[N,i,u,r.window]),m.useEffect(()=>{u&&i&&a.location.key===i.location.key&&u.resolve()},[u,f,a.location,i]),m.useEffect(()=>{!l.isTransitioning&&v&&(o(v.state),c({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),E(void 0))},[l.isTransitioning,v]),m.useEffect(()=>{},[]);let R=m.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:S=>r.navigate(S),push:(S,U,V)=>r.navigate(S,{state:U,preventScrollReset:V?.preventScrollReset}),replace:(S,U,V)=>r.navigate(S,{replace:!0,state:U,preventScrollReset:V?.preventScrollReset})}),[r]),A=r.basename||"/",M=m.useMemo(()=>({router:r,navigator:R,static:!1,basename:A}),[r,R,A]),g=m.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return m.useEffect(()=>Kf(n,r.future),[n,r.future]),m.createElement(m.Fragment,null,m.createElement($r.Provider,{value:M},m.createElement(Ti.Provider,{value:a},m.createElement(rh.Provider,{value:b.current},m.createElement(th.Provider,{value:l},m.createElement(Gf,{basename:A,location:a.location,navigationType:a.historyAction,navigator:R,future:g},a.initialized||r.future.v7_partialHydration?m.createElement(lh,{routes:r.routes,future:r.future,state:a}):e))))),null)}const lh=m.memo(ch);function ch(t){let{routes:e,future:r,state:n}=t;return kf(e,void 0,n,r)}var vs;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(vs||(vs={}));var ys;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ys||(ys={}));const _s=Hn(["sentry"]);let Yn=!1;async function Hi(){return await Se(()=>import("./sentry_react-cODD7zWc.js").then(t=>t.i),__vite__mapDeps([0,1,2]))}async function dh(){const t=await Hi(),e=[t.httpClientIntegration(),t.extraErrorDataIntegration({depth:5}),t.replayIntegration(),t.captureConsoleIntegration({levels:["error"]})];ge.sentry.tracing&&e.push(t.reactRouterV6BrowserTracingIntegration({useEffect:Vs.useEffect,useLocation:Zr,useNavigationType:Of,createRoutesFromChildren:Pn,matchRoutes:Qe})),t.init({release:ge.sentry.release,dsn:ge.sentry.dsn,environment:ge.sentry.env,integrations:e,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(r,n){const a=n.originalException;return a instanceof TypeError&&a.message.includes("Failed to fetch")&&!navigator.onLine?null:r}}),Yn=!0}async function uh(){return Yn?(await Hi()).getClient()?.close():void 0}function fh(){const[t]=Un(),{analytics:e}=t;m.useEffect(()=>{if(!e){uh().catch(r=>_s.error(r));return}Yn||!ge.sentry.dsn||ge.sentry.dsn===""||dh().catch(r=>_s.error(r))},[e])}function kn(){return kn=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},kn.apply(null,arguments)}var Fi=["shift","alt","meta","mod","ctrl"],hh={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function at(t){return(t&&hh[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function ph(t){return Fi.includes(t)}function un(t,e){return e===void 0&&(e=","),t.split(e)}function fn(t,e,r){e===void 0&&(e="+");var n=t.toLocaleLowerCase().split(e).map(function(i){return at(i)}),a={alt:n.includes("alt"),ctrl:n.includes("ctrl")||n.includes("control"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},s=n.filter(function(i){return!Fi.includes(i)});return kn({},a,{keys:s,description:r,hotkey:t})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(t){t.key!==void 0&&Vi([at(t.key),at(t.code)])}),document.addEventListener("keyup",function(t){t.key!==void 0&&Bi([at(t.key),at(t.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){st.clear()})})();var st=new Set;function Gn(t){return Array.isArray(t)}function mh(t,e){e===void 0&&(e=",");var r=Gn(t)?t:t.split(e);return r.every(function(n){return st.has(n.trim().toLowerCase())})}function Vi(t){var e=Array.isArray(t)?t:[t];st.has("meta")&&st.forEach(function(r){return!ph(r)&&st.delete(r.toLowerCase())}),e.forEach(function(r){return st.add(r.toLowerCase())})}function Bi(t){var e=Array.isArray(t)?t:[t];t==="meta"?st.clear():e.forEach(function(r){return st.delete(r.toLowerCase())})}function gh(t,e,r){(typeof r=="function"&&r(t,e)||r===!0)&&t.preventDefault()}function vh(t,e,r){return typeof r=="function"?r(t,e):r===!0||r===void 0}function yh(t){return Ui(t,["input","textarea","select"])}function Ui(t,e){e===void 0&&(e=!1);var r=t.target,n=t.composed,a=null;return _h(r)&&n?a=t.composedPath()[0]&&t.composedPath()[0].tagName:a=r&&r.tagName,Gn(e)?!!(a&&e&&e.some(function(s){var i;return s.toLowerCase()===((i=a)==null?void 0:i.toLowerCase())})):!!(a&&e&&e)}function _h(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function Eh(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(function(r){return e.includes(r)})||t.includes("*"):!0}var Ch=function(e,r,n){n===void 0&&(n=!1);var a=r.alt,s=r.meta,i=r.mod,o=r.shift,l=r.ctrl,c=r.keys,u=e.key,d=e.code,f=e.ctrlKey,h=e.metaKey,v=e.shiftKey,E=e.altKey,b=at(d),C=u.toLowerCase();if(!(c!=null&&c.includes(b))&&!(c!=null&&c.includes(C))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(b))return!1;if(!n){if(a===!E&&C!=="alt"||o===!v&&C!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(s===!h&&C!=="meta"&&C!=="os"||l===!f&&C!=="ctrl"&&C!=="control")return!1}return c&&c.length===1&&(c.includes(C)||c.includes(b))?!0:c?mh(c):!c},xh=m.createContext(void 0),bh=function(){return m.useContext(xh)};function $i(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce(function(r,n){return r&&$i(t[n],e[n])},!0):t===e}var Sh=m.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Nh=function(){return m.useContext(Sh)};function Rh(t){var e=m.useRef(void 0);return $i(e.current,t)||(e.current=t),e.current}var Es=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},wh=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Cs(t,e,r,n){var a=m.useState(null),s=a[0],i=a[1],o=m.useRef(!1),l=r instanceof Array?n instanceof Array?void 0:n:r,c=Gn(t)?t.join(l?.splitKey):t,u=r instanceof Array?r:n instanceof Array?n:void 0,d=m.useCallback(e,u??[]),f=m.useRef(d);u?f.current=d:f.current=e;var h=Rh(l),v=Nh(),E=v.enabledScopes,b=bh();return wh(function(){if(!(h?.enabled===!1||!Eh(E,h?.scopes))){var C=function(M,g){var S;if(g===void 0&&(g=!1),!(yh(M)&&!Ui(M,h?.enableOnFormTags))){if(s!==null){var U=s.getRootNode();if((U instanceof Document||U instanceof ShadowRoot)&&U.activeElement!==s&&!s.contains(U.activeElement)){Es(M);return}}(S=M.target)!=null&&S.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||un(c,h?.splitKey).forEach(function(V){var G,z=fn(V,h?.combinationKey);if(Ch(M,z,h?.ignoreModifiers)||(G=z.keys)!=null&&G.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(M)||g&&o.current)return;if(gh(M,z,h?.preventDefault),!vh(M,z,h?.enabled)){Es(M);return}f.current(M,z),g||(o.current=!0)}})}},N=function(M){M.key!==void 0&&(Vi(at(M.code)),(h?.keydown===void 0&&h?.keyup!==!0||h!=null&&h.keydown)&&C(M))},k=function(M){M.key!==void 0&&(Bi(at(M.code)),o.current=!1,h!=null&&h.keyup&&C(M,!0))},R=s||l?.document||document;return R.addEventListener("keyup",k,l?.eventListenerOptions),R.addEventListener("keydown",N,l?.eventListenerOptions),b&&un(c,h?.splitKey).forEach(function(A){return b.addHotkey(fn(A,h?.combinationKey,h?.description))}),function(){R.removeEventListener("keyup",k,l?.eventListenerOptions),R.removeEventListener("keydown",N,l?.eventListenerOptions),b&&un(c,h?.splitKey).forEach(function(A){return b.removeHotkey(fn(A,h?.combinationKey,h?.description))})}}},[s,c,h,E]),i}const Oh=t=>{const{undo:e,redo:r,canRedo:n,canUndo:a}=t,s=window.navigator.userAgent.includes("Mac");let i="ctrl+z",o="ctrl+y";s&&(i="mod+z",o="mod+shift+z"),Cs(i,l=>{l.preventDefault(),a&&e()},{},[a,e]),Cs(o,l=>{l.preventDefault(),n&&r()},{},[n,r])};window.navigator.appVersion.includes("Mac");const xs={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},Dh=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,r=Object.keys(xs).find(a=>e.includes(a)),n=r?xs[r]:void 0;if(n)return`${t}/${n}/package.json`},Lh=async()=>{const t=Dh();if(!t)return;const r=await(await fetch(t)).json(),{version:n}=r;return n},Ah=async()=>{const t=ge.appVersion,e=await Lh();return e?{isLatest:e===t,currentVersion:t,latestVersion:e}:null};function bs(...t){window.dataLayer?.push(...t)}const Th=()=>{const t=ge.gaTrackingId,[{analytics:e}]=Un(),r=t&&e;return m.useEffect(()=>{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||[],bs("js",new Date),bs("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null};function Ph(){return typeof document>"u"?"/":document.querySelector("base")?.getAttribute("href")||"/"}const kh=["preserve-all","preserve-by-url-and-detach"],Ih=()=>{const t=ge.drives.preserveStrategy;return t&&(r=>kh.includes(r))(t)?t:"preserve-by-url-and-detach"},jh=t=>{if(t.length===0)return{strategy:"preserve-all"};switch(Ih()){case"preserve-all":return{strategy:"preserve-all"};case"preserve-by-url-and-detach":return{strategy:"preserve-by-url-and-detach",urls:t};default:return{strategy:"preserve-by-url-and-detach",urls:t}}},Mh=t=>window.open(t,"_blank"),Hh=Mh,Ss=[],Fh=()=>({defaultDrives:{remoteDrives:Ss.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]}})),removeOldRemoteDrives:jh(Ss)}});function Vh(t){return new ko(t)}function Bh(t,e,r){return new Io(t).withStorage(e).withCache(new jo).withQueueManager(new Mo).withOptions({...r,...Fh()}).build()}async function Uh(t,e,r,n){const a={signer:new sl(n),verifier:al()},s=new tl("idb://reactor",{relaxedDurability:!0}),i=new rl(["reactor-client"]);return{...await new nl().withLogger(i).withSigner(a).withReactorBuilder(new il().withDocumentModels(t).withUpgradeManifests(e).withLegacyStorage(r).withSync(new ol().withChannelFactory(new ll(i))).withFeatures({legacyStorageEnabled:!0}).withKysely(new cl({dialect:new dl(s)}))).buildModule(),pg:s}}const $h=ge.routerBasename,zh=[$h,"service-worker.js"].join("/").replace(/\/{2,}/gm,"/");class Wh{ready=!1;debug=!1;registration=null;constructor(e=!1){this.debug=e}setDebug(e){this.debug=e}#t(e){this.debug&&console.log("ServiceWorker message: ",e);const r="type"in e.data?e:null;switch(r?.data.type){case"NEW_VERSION_AVAILABLE":{if(r.data.version===ge.appVersion)return;r.data.requiresHardRefresh&&(this.debug&&console.log("New version available"),window.location.reload());break}default:{console.warn("Unhandled message:",r);break}}}#e(e){this.debug&&console.log("ServiceWorker registered: ",e),navigator.serviceWorker.addEventListener("message",this.#t.bind(this)),this.registration=e,this.ready=!0}async#r(){try{const e=await navigator.serviceWorker.getRegistration();if(e)await e.update(),this.#e(e);else{const n=await navigator.serviceWorker.register(zh);this.#e(n),n.addEventListener("updatefound",()=>{this.#e(n)})}const r=setInterval(async()=>{const n=await navigator.serviceWorker.getRegistration();n?await n.update():(clearInterval(r),this.registerServiceWorker())},ge.appVersionCheckInterval)}catch(e){console.error("ServiceWorker registration failed: ",e)}}registerServiceWorker(e=!1){if(this.debug=e,!("serviceWorker"in navigator)){console.warn("Service Worker not available");return}window.addEventListener("load",()=>{this.#r().catch(console.error)})}}const Kh=new Wh,Zh=250,Yh=({delay:t=Zh})=>{const e=typeof window>"u",r=typeof document<"u"&&document.body.getAttribute("data-show-loader")==="true",[n,a]=m.useState(!t||r);return m.useEffect(()=>{const s=setTimeout(()=>{a(!0)},t);return()=>clearTimeout(s)},[]),_.jsxs("div",{className:`skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${n?"":"hidden"}`,children:[_.jsx("div",{className:"animate-pulse overflow-hidden rounded-full shadow-lg",children:_.jsx(Bo,{})}),e?_.jsx("script",{dangerouslySetInnerHTML:{__html:`setTimeout(() => {
6
6
  document.querySelector('.skeleton-loader')?.classList.remove('hidden');
7
7
  document.body.setAttribute('data-show-loader', 'true');
8
8
  }, ${t})`}}):null]})},Gh=()=>{const t=typeof window>"u",e=!t&&window.location.pathname===Ph();return _.jsxs("div",{className:"flex h-screen",children:[_.jsx(Bs,{className:"animate-pulse",onLogin:void 0,onDisconnect:void 0,onClickSettings:void 0,address:void 0}),_.jsx(Us,{containerClassName:t||!e?"hidden home-screen":void 0,children:null}),t?_.jsx("script",{dangerouslySetInnerHTML:{__html:`
@@ -11,8 +11,8 @@ Latest: ${e.latestVersion}`):or(m.createElement(Su),{type:"connect-warning",toas
11
11
  const basePath = href || '/';
12
12
  if (window.location.pathname === basePath) {
13
13
  document.querySelector('.home-screen')?.classList.remove('hidden')
14
- }`}}):null,_.jsx(Yh,{})]})};function Jh({children:t}){return _.jsx(_.Fragment,{children:t})}const qh=({children:t})=>(fh(),t),Xh=()=>(m.useEffect(()=>{const t=()=>{console.log("Outdated chunks detected, reloading page..."),window.location.reload()};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),m.useEffect(()=>{Kh.registerServiceWorker(!1)},[]),_.jsx(qh,{children:_.jsx(Uo,{children:_.jsxs(Jh,{children:[_.jsx($o,{position:"bottom-right",containerId:"connect"}),_.jsx(cg,{}),_.jsx(Th,{})]})})})),Qh={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},ep={placeholder:"Search Powerhouse",filterLabel:"File type"},tp={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},rp={options:{switchboardLink:"Switchboard Link"}},np={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},ap={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},sp={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},ip={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},op={common:Qh,searchbar:ep,folderView:tp,files:rp,modals:np,notifications:ap,footer:sp,cookieBanner:ip},lp={en:{code:"en",name:"English",translation:op}};Ne.use(mu).init({resources:lp,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const cp=(t,e)=>t.some(r=>r.id===e&&r.value),dp=()=>{const{t}=yi(void 0,{useSuspense:!0,i18n:Ne}),[e,r]=Lu(),[,n]=Un(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=o=>{r(!1),cp(o,"analytics-cookie")&&n(l=>({...l,analytics:!0}))},i=()=>{r(!1),n(()=>({analytics:!1,functional:!1,marketing:!1}))};return e?_.jsxs("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[_.jsx("div",{className:"absolute inset-0 bg-black opacity-15"}),_.jsx("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:_.jsx(zo,{className:"max-w-[1024px]",cookies:a,onSubmit:s,onReject:i,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:_.jsx("p",{className:"font-semibold text-gray-500",children:_.jsx(vu,{i18nKey:"cookieBanner.message",components:{a:_.jsx("a",{onClick:()=>et({type:"cookiesPolicy"}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};function up(){const[t]=Ws(),[e]=ul(),r=fl(e.header.id),n=hl(t),a=pl(t),s=ml(),i=Vn(),o=m.useCallback(()=>{gl(e).length?et({type:"exportDocumentWithErrors",documentId:e.header.id}):vl(e).catch(u=>{console.error(u);const f=u instanceof Error?u.message:JSON.stringify(u,null,1);or(`Failed to export document: ${f}`)})},[e]),l=m.useMemo(()=>n?async()=>{if(!e.header.id){console.error("No selected document");return}if(!a){console.error("No remote drive url found");return}const d=i?.address?await s?.getBearerToken(a,i.address,!1,{expiresIn:600}):void 0,u=yl(a,e.header.id,d);try{Hh(u)}catch(f){console.error("Error opening switchboard link",f)}}:void 0,[n,a,e]),c=m.useCallback(()=>{_n(r)},[r,_n]);return _.jsx("div",{id:"document-editor-container",className:"flex-1 rounded-2xl bg-gray-50 p-4",children:_.jsx(xp,{document:e,onClose:c,onExport:o,onOpenSwitchboardLink:l})})}function Nr(t){const[e,r]=m.useState(!1);if(m.useEffect(()=>{setTimeout(()=>{r(!0)},t.loadingTimeout??200)},[t]),!e)return null;const{customEditorLoader:n,...a}=t;return n?_.jsx(_.Fragment,{children:n}):_.jsx(Wo,{...a})}const fp=m.createContext(null),hn={didCatch:!1,error:null};let hp=class extends m.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hn}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var r,n,a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:s,reason:"imperative-api"}),this.setState(hn)}}componentDidCatch(e,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,e,r)}componentDidUpdate(e,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&pp(e.resetKeys,a)){var s,i;(s=(i=this.props).onReset)===null||s===void 0||s.call(i,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(hn)}}render(){const{children:e,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:s,error:i}=this.state;let o=e;if(s){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")o=r(l);else if(n)o=m.createElement(n,l);else if(a!==void 0)o=a;else throw i}return m.createElement(fp.Provider,{value:{didCatch:s,error:i,resetErrorBoundary:this.resetErrorBoundary}},o)}};function pp(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((r,n)=>!Object.is(r,e[n]))}const mp=Hn(["Connect"]);function gp(t){return"fallbackRender"in t}function vp(){return null}function yp({message:t="Something went wrong"}){return _.jsx("div",{className:"text-center",children:t})}function _p({error:t}){const e=t instanceof Error?t.message:String(t);return _.jsxs("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[_.jsx("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),_.jsx("i",{children:e}),_.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function zi({error:t}){const e=t instanceof Error?t.message:String(t);return _.jsx("div",{className:"flex size-full items-center justify-center",children:_.jsx("h3",{className:"text-lg font-semibold",children:e})})}function Ep(t,e){switch(t){case"silent":return vp;case"text":return()=>_.jsx(yp,{message:e});case"detailed":return _p;default:return zi}}function Yr(t){const{children:e,onError:r,resetKeys:n,loggerContext:a}=t,s=(o,l)=>{if(o.message.includes("Failed to fetch dynamically imported module")&&o.message.includes("node_modules/.vite")){console.error(o),console.log("Outdated chunk detected, reloading page..."),window.location.reload();return}(a?Hn(a):mp).error(o,l),r?.(o,l)},i=gp(t)?t.fallbackRender:Ep(t.variant,t.fallbackMessage);return _.jsx(hp,{fallbackRender:i,onError:s,resetKeys:n,children:e})}function Cp(){const[t]=Ws(),e=Ks(),r=Zs(t.header.meta?.preferredEditor),n=_l(),a=r?.Component??n?.Component??Fo.Component;if(!a)throw new Error("No drive editor component found");return _.jsx(Yr,{variant:"detailed",resetKeys:[t.header.id],loggerContext:["Connect","DriveEditor"],children:_.jsx(m.Suspense,{fallback:_.jsx(Nr,{}),children:_.jsx(Ko,{className:"flex h-full flex-col overflow-auto",children:_.jsx(a,{children:e?_.jsx(up,{}):null})})})})}function Wi({drive:t}){const e=El(t),r=t?.state.global.icon;return r?_.jsx("img",{src:r,alt:t.header.name,height:32,width:32}):e==="LOCAL"?_.jsx(ha,{name:"Hdd",size:32}):_.jsx(ha,{name:"Server",size:32})}function Ns({message:t}){return _.jsx("div",{className:"flex size-full items-center justify-center",children:_.jsx("h3",{className:"text-lg font-semibold",children:t})})}const xp=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:a}=t,s=Cl(),i=xl(),[o,l]=bl(e.header.id),c=o?.header.id??void 0,d=o?.header.name??void 0,u=o?.header.documentType??void 0,f=o?.header.meta?.preferredEditor??void 0,h=o?.operations.global??[],g=o?.operations.local??[],E=o?.header.revision.global??0,b=o?.header.revision.local??0,C=Sl(u),S=Nl(f),k=Rl(u),N=S??k,D=!o,T=N&&u&&!N.documentTypes.includes(u)&&!N.documentTypes.includes("*"),y=E>0||b>0,w=!!o?.clipboard.length;Oh({undo:()=>l(vc()),redo:()=>l(yc()),canUndo:y,canRedo:w}),m.useEffect(()=>()=>{window.documentEditorDebugTools?.clear()},[]);const[G,z]=m.useState(void 0);m.useEffect(()=>{G&&G.documentId!==c&&z(void 0)},[G,c]);const ee=(Re,Ce)=>{z({error:Re,documentId:c,info:Ce})};if(T)return _.jsx(Nr,{message:"Loading editor"});if(D)return _.jsx(Nr,{message:"Loading document"});if(!C)return _.jsx(Ns,{message:_.jsxs("div",{className:"text-center leading-10",children:[_.jsxs("p",{children:['Unable to open the document because the document model "',u,'" is not supported.']}),_.jsxs("p",{children:["Go to the"," ",_.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{et({type:"settings"})},children:"package manager"})," ","to install this document model"]})]})});if(!N)return _.jsx(Ns,{message:_.jsxs("div",{className:"text-center leading-10",children:[_.jsx("p",{children:"Unable to open the document because no editor has been found"}),_.jsxs("p",{children:["Go to the"," ",_.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{et({type:"settings"})},children:"package manager"})," ",'an editor for the "$',u,'" document type']})]})});const ne=N.Component;return _.jsx("div",{className:"relative h-full",id:"document-editor-context",children:i?_.jsx(Zo,{documentTitle:d??"",documentId:c??"",globalOperations:h,localOperations:g,onClose:()=>wl(!1),documentState:o.state,onCopyState:()=>{or("Copied document state to clipboard",{type:"success"})}},c):_.jsx(m.Suspense,{fallback:_.jsx(Nr,{message:"Loading editor"}),name:"EditorLoader",children:_.jsx(Yr,{fallbackRender:zi,resetKeys:[c],onError:ee,loggerContext:["Connect","DocumentEditor"],children:!G?.error&&_.jsx(ne,{context:{readMode:!!s,selectedTimelineRevision:Ol(s?.startDate,s?.endDate,h)},documentId:o.header.id},c)})})})},bp=m.lazy(()=>Se(()=>import("./AddDriveModal-DPAIVc5B.js"),__vite__mapDeps([3,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.AddDriveModal}))),Sp=m.lazy(()=>Se(()=>import("./ClearStorageModal-DDCSnHBa.js"),__vite__mapDeps([20,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ClearStorageModal}))),Np=m.lazy(()=>Se(()=>import("./CookiesPolicyModal-D5koyP0a.js"),__vite__mapDeps([21,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.CookiesPolicyModal}))),Rp=m.lazy(()=>Se(()=>import("./CreateDocumentModal-WDQNTedg.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.CreateDocumentModal}))),wp=m.lazy(()=>Se(()=>import("./DebugSettingsModal-DWoSRmAX.js"),__vite__mapDeps([23,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DebugSettingsModal}))),Op=m.lazy(()=>Se(()=>import("./DeleteDriveModal-BeubmwBZ.js"),__vite__mapDeps([24,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteDriveModal}))),Dp=m.lazy(()=>Se(()=>import("./DeleteItemModal-DNjWQGhA.js"),__vite__mapDeps([25,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteItemModal}))),Lp=m.lazy(()=>Se(()=>import("./DisclaimerModal-Bl0JZtHi.js"),__vite__mapDeps([26,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DisclaimerModal}))),Ap=m.lazy(()=>Se(()=>import("./DriveSettingsModal-CXQCQZHm.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DriveSettingsModal}))),Tp=m.lazy(()=>Se(()=>import("./ExportDocumentWithErrorsModal-CqOhmcTh.js"),__vite__mapDeps([28,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ExportDocumentWithErrorsModal}))),Pp=m.lazy(()=>Se(()=>import("./SettingsModal-B-Ext2a5.js"),__vite__mapDeps([29,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.SettingsModal}))),kp=m.lazy(()=>Se(()=>import("./UpgradeDriveModal-BTM20583.js"),__vite__mapDeps([30,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.UpgradeDriveModal}))),Ip=m.lazy(()=>Se(()=>import("./index-cGjbPuoF.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.InspectorModal}))),jp={addDrive:bp,clearStorage:Sp,cookiesPolicy:Np,createDocument:Rp,debugSettings:wp,deleteDrive:Op,deleteItem:Dp,disclaimer:Lp,driveSettings:Ap,exportDocumentWithErrors:Tp,inspector:Ip,settings:Pp,upgradeDrive:kp};function Mp(){const t=Dl();if(!t?.type)return null;const e=jp[t.type];return e?_.jsx(Yr,{variant:"silent",loggerContext:["Connect","Modals"],children:_.jsx(m.Suspense,{fallback:null,children:_.jsx(e,{})})}):null}function Hp(t){return t.documentModel.global}function Fp(){const{isAllowedToCreateDocuments:t}=Ll(),r=Al()?.filter(n=>n.documentModel.global.id!=="powerhouse/document-drive");return t?_.jsxs("div",{className:"px-6 py-4",children:[_.jsx("h3",{className:"mb-3 text-xl font-bold text-gray-600",children:"New document"}),_.jsx("div",{className:"flex w-full flex-wrap gap-4",children:r?.map(n=>{const a=Hp(n);return _.jsx(Xs,{color:"light",title:a.name,"aria-description":a.description,onClick:()=>Tl(a.id),children:_.jsx("span",{className:"text-sm",children:a.name})},a.id)})})]}):null}const Gt=8,pn=256,Rs=48,Vp=420;function Bp(){const t=m.useRef(null),r=gc().innerWidth-Vp,a=Ys().filter(f=>Pl(f)),s=Math.floor(r/(pn+Gt))||1,i=Math.ceil(a.length/s),o=da({count:i,getScrollElement:()=>t.current,estimateSize:f=>f>0?Rs+Gt:Rs,overscan:5}),l=da({horizontal:!0,count:s,getScrollElement:()=>t.current,estimateSize:f=>f>0?pn+Gt:pn,overscan:5}),c=(f,h)=>f*s+h,d=(f,h)=>{const g=c(f,h);return a[g]||null};if(a.length===0)return _.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"});const u=(f,h)=>{const g=d(f,h);return g?_.jsx("div",{style:{marginLeft:h===0?0:Gt},children:_.jsx(Yo,{fileNode:g},g.id)}):null};return _.jsx("div",{ref:t,style:{width:"100%",overflow:"auto"},children:_.jsx("div",{style:{height:`${o.getTotalSize()}px`,width:`${l.getTotalSize()}px`,position:"relative"},children:o.getVirtualItems().map(f=>_.jsx(Vs.Fragment,{children:l.getVirtualItems().map(h=>_.jsx("div",{style:{position:"absolute",top:0,left:0,marginTop:f.index===0?0:Gt,width:`${h.size}px`,height:`${f.size}px`,transform:`translateX(${h.start}px) translateY(${f.start}px)`},children:u(f.index,h.index)},h.key))},f.key))})})}function Pe({children:t,className:e,...r}){return _.jsx(Pe.Container,{className:e,...r,children:t})}Pe.Container=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2",r),...n,...a,children:e})};Pe.Header=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex-0",r),...n,...a,children:e})};Pe.Content=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("mb-5 flex-1 px-4",r),...n,...a,children:e})};Pe.ContentSection=function({title:e,children:r,className:n,containerProps:a,...s}){return _.jsxs("div",{className:ir(n),...a,...s,children:[e&&_.jsx("div",{className:"mb-4 text-base font-semibold text-gray-600",children:e}),_.jsx("div",{className:"flex flex-wrap gap-2",children:r})]})};Pe.Footer=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex-0",r),...n,...a,children:e})};function Up(t){const{className:e}=t,r=Ys(),n=Gs(),a=r.filter(o=>kl(o)),{isDropTarget:s,dropProps:i}=$s({target:n});return _.jsxs("div",{className:Sc("rounded-md border-2 border-transparent p-2",s&&"border-dashed border-blue-100",e),...i,children:[_.jsx(Pe.ContentSection,{title:"Folders",className:"mb-4",children:a.length>0?a.map(o=>_.jsx(Go,{folderNode:o},o.id)):_.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"})}),_.jsx(Pe.ContentSection,{title:"Documents and files",children:_.jsx("div",{className:"w-full",children:_.jsx(Bp,{})})})]})}const $p={allowedDocumentTypes:[],isDragAndDropEnabled:!0};function Ki(t){Il($p);const{className:e,children:r}=t,{isDropTarget:n,dropProps:a}=$s(),s=!!r;return _.jsxs(Pe,{className:e,children:[!s&&_.jsx(Pe.Header,{children:_.jsx(Jo,{})}),s?r:_.jsx(Pe.Content,{...a,className:n?"rounded-xl bg-blue-100":"",children:_.jsx(Up,{})}),!s&&_.jsx(Pe.Footer,{children:_.jsx(Fp,{})})]})}const jg=Object.freeze(Object.defineProperty({__proto__:null,default:Ki},Symbol.toStringTag,{value:"Module"}));function zp(){return{id:jl,name:"Generic Drive Explorer",documentTypes:["powerhouse/document-drive"],Component:Ki}}function Wp(){return{id:"document-model-editor-v2",name:"Document Model Editor",documentTypes:["powerhouse/document-model"],Component:Lo}}async function Kp(){const t=yr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,s=t.specifications,i=yr.reducer,o=yr.actions,l=yr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:s,reducer:i,actions:o,utils:l,documentModel:Qs(ei(),t)}}async function Zp(){const t=vr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,s=t.specifications,i=vr.reducer,o=vr.actions,l=vr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:s,reducer:i,actions:o,utils:l,documentModel:Qs(ei(),t)}}async function Yp(){const t=await Kp(),e=await Zp(),r=Wp(),n=zp();return{id:Ml,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]}}}const{externalPackagesEnabled:Gp}=ge;function Jp(t){return t.loadExternalPackages().then(e=>e.map(zs))}async function qp(){try{if(!Gp)return[];const t=await Se(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return Jp(t)}catch(t){return console.error(t),[]}}var Xp=Object.defineProperty,Qp=Object.defineProperties,em=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,tm=Object.prototype.hasOwnProperty,rm=Object.prototype.propertyIsEnumerable,Os=(t,e,r)=>e in t?Xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mn=(t,e)=>{for(var r in e||(e={}))tm.call(e,r)&&Os(t,r,e[r]);if(ws)for(var r of ws(e))rm.call(e,r)&&Os(t,r,e[r]);return t},gn=(t,e)=>Qp(t,em(e)),At=(t,e,r)=>new Promise((n,a)=>{var s=l=>{try{o(r.next(l))}catch(c){a(c)}},i=l=>{try{o(r.throw(l))}catch(c){a(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,i);o((r=r.apply(t,e)).next())}),nm=class{constructor(){this.data=new Map}set(t,e){this.data.set(t,e)}get(t){return this.data.get(t)}has(t){return this.data.has(t)}delete(t){return this.data.delete(t)}clear(){this.data.clear()}},am={ERROR:"ERROR"},Zi=(t=>(t.PROVIDER_NOT_READY="PROVIDER_NOT_READY",t.PROVIDER_FATAL="PROVIDER_FATAL",t.FLAG_NOT_FOUND="FLAG_NOT_FOUND",t.PARSE_ERROR="PARSE_ERROR",t.TYPE_MISMATCH="TYPE_MISMATCH",t.TARGETING_KEY_MISSING="TARGETING_KEY_MISSING",t.INVALID_CONTEXT="INVALID_CONTEXT",t.GENERAL="GENERAL",t))(Zi||{}),ft=class Yi extends Error{constructor(e,r){super(e),Object.setPrototypeOf(this,Yi.prototype),this.name="OpenFeatureError",this.cause=r?.cause}},sm=class Gi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Gi.prototype),this.name="FlagNotFoundError",this.code="FLAG_NOT_FOUND"}},Ji=class qi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,qi.prototype),this.name="GeneralError",this.code="GENERAL"}},im=class Xi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Xi.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},om=class Qi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Qi.prototype),this.name="ParseError",this.code="PARSE_ERROR"}},eo=class to extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,to.prototype),this.name="ProviderFatalError",this.code="PROVIDER_FATAL"}},ro=class no extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,no.prototype),this.name="ProviderNotReadyError",this.code="PROVIDER_NOT_READY"}},lm=class ao extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,ao.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},cm=class so extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,so.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},dm=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new sm(e);case"PARSE_ERROR":return new om(e);case"TYPE_MISMATCH":return new cm(e);case"TARGETING_KEY_MISSING":return new lm(e);case"INVALID_CONTEXT":return new im(e);case"PROVIDER_NOT_READY":return new ro(e);case"PROVIDER_FATAL":return new eo(e);default:return new Ji(e)}},sr=(t=>(t.NOT_READY="NOT_READY",t.READY="READY",t.ERROR="ERROR",t.STALE="STALE",t.FATAL="FATAL",t.RECONCILING="RECONCILING",t))(sr||{}),ze=(t=>(t.Ready="PROVIDER_READY",t.Error="PROVIDER_ERROR",t.ConfigurationChanged="PROVIDER_CONFIGURATION_CHANGED",t.ContextChanged="PROVIDER_CONTEXT_CHANGED",t.Reconciling="PROVIDER_RECONCILING",t.Stale="PROVIDER_STALE",t))(ze||{}),um={READY:"PROVIDER_READY",ERROR:"PROVIDER_ERROR",FATAL:"PROVIDER_ERROR",STALE:"PROVIDER_STALE",RECONCILING:"PROVIDER_RECONCILING",NOT_READY:void 0},io=(t,e)=>!e&&t==="PROVIDER_READY"||um[e]===t,oo=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},fm=["error","warn","info","debug"],Jn=class{constructor(t){this.fallbackLogger=new oo;try{for(const e of fm)if(!t[e]||typeof t[e]!="function")throw new Error(`The provided logger is missing the ${e} method.`);this.logger=t}catch(e){console.error(e),console.error("Falling back to the default logger."),this.logger=this.fallbackLogger}}error(...t){this.log("error",...t)}warn(...t){this.log("warn",...t)}info(...t){this.log("info",...t)}debug(...t){this.log("debug",...t)}log(t,...e){try{this.logger[t](...e)}catch{this.fallbackLogger[t](...e)}}},hm=class{constructor(t){this.globalLogger=t,this._handlers={PROVIDER_CONFIGURATION_CHANGED:new WeakMap,PROVIDER_CONTEXT_CHANGED:new WeakMap,PROVIDER_READY:new WeakMap,PROVIDER_ERROR:new WeakMap,PROVIDER_STALE:new WeakMap,PROVIDER_RECONCILING:new WeakMap}}emit(t,e){this.eventEmitter.emit(t,e)}addHandler(t,e){const r=a=>At(this,null,function*(){var s;try{yield e(a)}catch(i){(s=this._logger)==null||s.error("Error running event handler:",i)}}),n=this._handlers[t].get(e);this._handlers[t].set(e,[...n||[],r]),this.eventEmitter.on(t,r)}removeHandler(t,e){const r=this._handlers[t].get(e);if(r){const n=r.pop();n&&this.eventEmitter.removeListener(t,n)}}removeAllHandlers(t){t?this.eventEmitter.removeAllListeners(t):this.eventEmitter.removeAllListeners()}getHandlers(t){return this.eventEmitter.listeners(t)}setLogger(t){return this._eventLogger=new Jn(t),this}get _logger(){var t,e;return(e=this._eventLogger)!=null?e:(t=this.globalLogger)==null?void 0:t.call(this)}};function pm(t){return typeof t=="string"}function Tt(t){return pm(t)?t:void 0}function mm(t){return typeof t=="object"}function Te(t){return mm(t)?t:void 0}function Ds(t){return typeof t<"u"&&t!==null}var In=class{constructor(t,e,r){this._provider=t,this._status=e,this._pendingContextChanges=0;var n,a,s;(n=t.events)==null||n.addHandler("PROVIDER_READY",()=>{this._status=r.READY}),(a=t.events)==null||a.addHandler("PROVIDER_STALE",()=>{this._status=r.STALE}),(s=t.events)==null||s.addHandler("PROVIDER_ERROR",i=>{i?.errorCode==="PROVIDER_FATAL"?this._status=r.FATAL:this._status=r.ERROR})}get provider(){return this._provider}set provider(t){this._provider=t}get status(){return this._status}set status(t){this._status=t}get allContextChangesSettled(){return this._pendingContextChanges===0}incrementPendingContextChanges(){this._pendingContextChanges++}decrementPendingContextChanges(){this._pendingContextChanges--}},gm=class{constructor(t){this._hooks=[],this._context={},this._logger=new oo,this._clientEventHandlers=new Map,this._domainScopedContext=new Map,this._clientEvents=new Map,this._runsOn=t}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}setLogger(t){return this._logger=new Jn(t),this}get providerMetadata(){return this.getProviderMetadata()}getProviderMetadata(t){return this.getProviderForClient(t).metadata}addHandler(t,e,r){[...new Map([[void 0,this._defaultProvider]]),...this._domainScopedProviders].forEach(n=>{var a;const s=n[0],i=n[1].provider,o=n[1].status;if(io(t,o))try{e({domain:s,providerName:i.metadata.name})}catch(c){(a=this._logger)==null||a.error("Error running event handler:",c)}}),this._apiEmitter.addHandler(t,e),r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this._apiEmitter.removeHandler(t,e)}clearHandlers(){this._apiEmitter.removeAllHandlers()}getHandlers(t){return this._apiEmitter.getHandlers(t)}setAwaitableProvider(t,e){var r,n,a,s,i,o,l,c;const d=Tt(t),u=(r=Te(t))!=null?r:Te(e);if(!u){this._logger.debug("No provider defined, ignoring setProvider call");return}const f=this.getProviderForClient(d),h=u.metadata.name;if(f===u){this._logger.debug("Provider is already set, ignoring setProvider call");return}if(!u.runsOn)this._logger.debug(`Provider '${u.metadata.name}' has not defined its intended use.`);else if(u.runsOn!==this._runsOn)throw new Ji(`Provider '${u.metadata.name}' is intended for use on the ${u.runsOn}.`);const g=this.getAssociatedEventEmitters(d);let E;const b=new In(u,this._statusEnumType.NOT_READY,this._statusEnumType);return typeof u.initialize=="function"&&!this.allProviders.includes(u)?E=(i=(s=(a=u.initialize)==null?void 0:a.call(u,d?(n=this._domainScopedContext.get(d))!=null?n:this._context:this._context))==null?void 0:s.then(()=>{var C;b.status=this._statusEnumType.READY,this.getAssociatedEventEmitters(d).forEach(S=>{S?.emit("PROVIDER_READY",{clientName:d,domain:d,providerName:h})}),(C=this._apiEmitter)==null||C.emit("PROVIDER_READY",{clientName:d,domain:d,providerName:h})}))==null?void 0:i.catch(C=>{var S;throw C?.code==="PROVIDER_FATAL"?b.status=this._statusEnumType.FATAL:b.status=this._statusEnumType.ERROR,this.getAssociatedEventEmitters(d).forEach(k=>{k?.emit("PROVIDER_ERROR",{clientName:d,domain:d,providerName:h,message:C?.message})}),(S=this._apiEmitter)==null||S.emit("PROVIDER_ERROR",{clientName:d,domain:d,providerName:h,message:C?.message}),C}):(b.status=this._statusEnumType.READY,g.forEach(C=>{C?.emit("PROVIDER_READY",{clientName:d,domain:d,providerName:h})}),(o=this._apiEmitter)==null||o.emit("PROVIDER_READY",{clientName:d,domain:d,providerName:h})),d?this._domainScopedProviders.set(d,b):this._defaultProvider=b,this.transferListeners(f,u,d,g),this.allProviders.includes(f)||(c=(l=f?.onClose)==null?void 0:l.call(f))==null||c.catch(C=>{this._logger.error(`error closing provider: ${C?.message}, ${C?.stack}`)}),E}getProviderForClient(t){var e,r;return t?(r=(e=this._domainScopedProviders.get(t))==null?void 0:e.provider)!=null?r:this._defaultProvider.provider:this._defaultProvider.provider}buildAndCacheEventEmitterForClient(t){const e=this._clientEvents.get(t);if(e)return e;const r=this._createEventEmitter();this._clientEvents.set(t,r);const n=this.getProviderForClient(t);return Object.values(ze).forEach(a=>{var s;return(s=n.events)==null?void 0:s.addHandler(a,i=>At(this,null,function*(){r.emit(a,gn(mn({},i),{clientName:t,domain:t,providerName:n.metadata.name}))}))}),r}getUnboundEmitters(){const t=[...this._domainScopedProviders.keys()];return[...[...this._clientEvents.keys()].filter(Ds).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(Ds)}getAssociatedEventEmitters(t){return t?[this.buildAndCacheEventEmitterForClient(t)]:this.getUnboundEmitters()}transferListeners(t,e,r,n){var a;(a=this._clientEventHandlers.get(r))==null||a.forEach(i=>{var o;return(o=t.events)==null?void 0:o.removeHandler(...i)});const s=Object.values(ze).map(i=>[i,l=>At(this,null,function*(){n.forEach(c=>{c?.emit(i,gn(mn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))}),this._apiEmitter.emit(i,gn(mn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))})]);this._clientEventHandlers.set(r,s),s.forEach(i=>{var o;return(o=e.events)==null?void 0:o.addHandler(...i)})}close(){return At(this,null,function*(){var t,e;try{yield(e=(t=this==null?void 0:this._defaultProvider.provider)==null?void 0:t.onClose)==null?void 0:e.call(t)}catch(n){this.handleShutdownError(this._defaultProvider.provider,n)}const r=Array.from(this._domainScopedProviders);yield Promise.all(r.map(n=>At(this,[n],function*([,a]){var s,i;try{yield(i=a==null?void 0:(s=a.provider).onClose)==null?void 0:i.call(s)}catch(o){this.handleShutdownError(a?.provider,o)}})))})}clearProvidersAndSetDefault(t){return At(this,null,function*(){try{yield this.close()}catch{this._logger.error("Unable to cleanly close providers. Resetting to the default configuration.")}finally{this._domainScopedProviders.clear(),this._defaultProvider=new In(t,this._statusEnumType.NOT_READY,this._statusEnumType)}})}get allProviders(){return[...[...this._domainScopedProviders.values()].map(t=>t.provider),this._defaultProvider.provider]}handleShutdownError(t,e){this._logger.error(`Error during shutdown of provider ${t.metadata.name}: ${e}`),this._logger.error(e?.stack)}},vm=Object.create,qn=Object.defineProperty,ym=Object.defineProperties,_m=Object.getOwnPropertyDescriptor,Em=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertyNames,Ls=Object.getOwnPropertySymbols,co=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty,Cm=Object.prototype.propertyIsEnumerable,xm=Reflect.get,As=(t,e,r)=>e in t?qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vn=(t,e)=>{for(var r in e||(e={}))uo.call(e,r)&&As(t,r,e[r]);if(Ls)for(var r of Ls(e))Cm.call(e,r)&&As(t,r,e[r]);return t},bm=(t,e)=>ym(t,Em(e)),Sm=(t,e)=>function(){return e||(0,t[lo(t)[0]])((e={exports:{}}).exports,e),e.exports},Nm=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of lo(e))!uo.call(t,a)&&a!==r&&qn(t,a,{get:()=>e[a],enumerable:!(n=_m(e,a))||n.enumerable});return t},Rm=(t,e,r)=>(r=t!=null?vm(co(t)):{},Nm(qn(r,"default",{value:t,enumerable:!0}),t)),wm=(t,e,r)=>xm(co(t),r,e),Dt=(t,e,r)=>new Promise((n,a)=>{var s=l=>{try{o(r.next(l))}catch(c){a(c)}},i=l=>{try{o(r.throw(l))}catch(c){a(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,i);o((r=r.apply(t,e)).next())}),Om=Sm({"../../node_modules/eventemitter3/index.js"(t,e){var r=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function s(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,f,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var g=new s(u,f||c,h),E=n?n+d:d;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],g]:c._events[E].push(g):(c._events[E]=g,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new a:delete c._events[d]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,f;if(this._eventsCount===0)return d;for(f in u=this._events)r.call(u,f)&&d.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,g=f.length,E=new Array(g);h<g;h++)E[h]=f[h].fn;return E},l.prototype.listenerCount=function(d){var u=n?n+d:d,f=this._events[u];return f?f.fn?1:f.length:0},l.prototype.emit=function(d,u,f,h,g,E){var b=n?n+d:d;if(!this._events[b])return!1;var C=this._events[b],S=arguments.length,k,N;if(C.fn){switch(C.once&&this.removeListener(d,C.fn,void 0,!0),S){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,u),!0;case 3:return C.fn.call(C.context,u,f),!0;case 4:return C.fn.call(C.context,u,f,h),!0;case 5:return C.fn.call(C.context,u,f,h,g),!0;case 6:return C.fn.call(C.context,u,f,h,g,E),!0}for(N=1,k=new Array(S-1);N<S;N++)k[N-1]=arguments[N];C.fn.apply(C.context,k)}else{var D=C.length,T;for(N=0;N<D;N++)switch(C[N].once&&this.removeListener(d,C[N].fn,void 0,!0),S){case 1:C[N].fn.call(C[N].context);break;case 2:C[N].fn.call(C[N].context,u);break;case 3:C[N].fn.call(C[N].context,u,f);break;case 4:C[N].fn.call(C[N].context,u,f,h);break;default:if(!k)for(T=1,k=new Array(S-1);T<S;T++)k[T-1]=arguments[T];C[N].fn.apply(C[N].context,k)}}return!0},l.prototype.on=function(d,u,f){return i(this,d,u,f,!1)},l.prototype.once=function(d,u,f){return i(this,d,u,f,!0)},l.prototype.removeListener=function(d,u,f,h){var g=n?n+d:d;if(!this._events[g])return this;if(!u)return o(this,g),this;var E=this._events[g];if(E.fn)E.fn===u&&(!h||E.once)&&(!f||E.context===f)&&o(this,g);else{for(var b=0,C=[],S=E.length;b<S;b++)(E[b].fn!==u||h&&!E[b].once||f&&E[b].context!==f)&&C.push(E[b]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}}),Dm="No-op",Lm=class{constructor(){this.metadata={name:"No-op Provider"}}resolveBooleanEvaluation(t,e){return this.noOp(e)}resolveStringEvaluation(t,e){return this.noOp(e)}resolveNumberEvaluation(t,e){return this.noOp(e)}resolveObjectEvaluation(t,e){return this.noOp(e)}noOp(t){return{value:t,reason:Dm}}},Ts=new Lm,Am=Rm(Om()),Ps=class extends hm{constructor(){super(),this.eventEmitter=new Am.default}},Tm=class{constructor(t,e,r,n,a,s,i){this.providerAccessor=t,this.providerStatusAccessor=e,this.emitterAccessor=r,this.apiContextAccessor=n,this.apiHooksAccessor=a,this.globalLogger=s,this.options=i,this._hooks=[]}get metadata(){var t,e;return{name:(t=this.options.domain)!=null?t:this.options.name,domain:(e=this.options.domain)!=null?e:this.options.name,version:this.options.version,providerMetadata:this.providerAccessor().metadata}}get providerStatus(){return this.providerStatusAccessor()}addHandler(t,e,r){var n;if(this.emitterAccessor().addHandler(t,e),io(t,this.providerStatus))try{e({clientName:this.metadata.name,domain:this.metadata.domain,providerName:this._provider.metadata.name})}catch(s){(n=this._logger)==null||n.error("Error running event handler:",s)}r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this.emitterAccessor().removeHandler(t,e)}getHandlers(t){return this.emitterAccessor().getHandlers(t)}setLogger(t){return this._clientLogger=new Jn(t),this}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}getBooleanValue(t,e,r){return this.getBooleanDetails(t,e,r).value}getBooleanDetails(t,e,r){return this.evaluate(t,this._provider.resolveBooleanEvaluation,e,"boolean",r)}getStringValue(t,e,r){return this.getStringDetails(t,e,r).value}getStringDetails(t,e,r){return this.evaluate(t,this._provider.resolveStringEvaluation,e,"string",r)}getNumberValue(t,e,r){return this.getNumberDetails(t,e,r).value}getNumberDetails(t,e,r){return this.evaluate(t,this._provider.resolveNumberEvaluation,e,"number",r)}getObjectValue(t,e,r){return this.getObjectDetails(t,e,r).value}getObjectDetails(t,e,r){return this.evaluate(t,this._provider.resolveObjectEvaluation,e,"object",r)}track(t,e={}){var r,n,a;try{if(this.shortCircuitIfNotReady(),typeof this._provider.track=="function"){const s=Object.freeze(vn({},this.apiContextAccessor((r=this==null?void 0:this.options)==null?void 0:r.domain)));return(a=(n=this._provider).track)==null?void 0:a.call(n,t,s,e)}else this._logger.debug("Provider does not support the track function; will no-op.")}catch(s){this._logger.debug("Error recording tracking event.",s)}}evaluate(t,e,r,n,a={}){var s,i;const o=[...this.apiHooksAccessor(),...this.getHooks(),...a.hooks||[],...this._provider.hooks||[]],l=[...o].reverse(),c=vn({},this.apiContextAccessor((s=this==null?void 0:this.options)==null?void 0:s.domain)),d=l.map(()=>Object.freeze({flagKey:t,defaultValue:r,flagValueType:n,clientMetadata:this.metadata,providerMetadata:this._provider.metadata,context:c,logger:this._logger,hookData:new nm}));let u;try{this.beforeHooks(o,d,a),this.shortCircuitIfNotReady();const f=e.call(this._provider,t,r,c,this._logger),h=bm(vn({},f),{flagMetadata:Object.freeze((i=f.flagMetadata)!=null?i:{}),flagKey:t});if(h.errorCode){const g=dm(h.errorCode,h.errorMessage);this.errorHooks(l,d,g,a),u=this.getErrorEvaluationDetails(t,r,g,h.flagMetadata)}else this.afterHooks(l,d,h,a),u=h}catch(f){this.errorHooks(l,d,f,a),u=this.getErrorEvaluationDetails(t,r,f)}return this.finallyHooks(l,d,u,a),u}beforeHooks(t,e,r){var n;for(const[a,s]of t.entries()){const i=t.length-1-a,o=e[i];Object.freeze(o),Object.freeze(o.context),(n=s?.before)==null||n.call(s,o,Object.freeze(r.hookHints))}}afterHooks(t,e,r,n){var a;for(const[s,i]of t.entries()){const o=e[s];(a=i?.after)==null||a.call(i,o,r,n.hookHints)}}errorHooks(t,e,r,n){var a;for(const[s,i]of t.entries())try{const o=e[s];(a=i?.error)==null||a.call(i,o,r,n.hookHints)}catch(o){this._logger.error(`Unhandled error during 'error' hook: ${o}`),o instanceof Error&&this._logger.error(o.stack),this._logger.error(o?.stack)}}finallyHooks(t,e,r,n){var a;for(const[s,i]of t.entries())try{const o=e[s];(a=i?.finally)==null||a.call(i,o,r,n.hookHints)}catch(o){this._logger.error(`Unhandled error during 'finally' hook: ${o}`),o instanceof Error&&this._logger.error(o.stack),this._logger.error(o?.stack)}}get _provider(){return this.providerAccessor()}get _logger(){return this._clientLogger||this.globalLogger()}shortCircuitIfNotReady(){if(this.providerStatus===sr.NOT_READY)throw new ro("provider has not yet initialized");if(this.providerStatus===sr.FATAL)throw new eo("provider is in an irrecoverable error state")}getErrorEvaluationDetails(t,e,r,n={}){const a=r?.message;return{errorCode:r?.code||Zi.GENERAL,errorMessage:a,value:e,reason:am.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},ks=Symbol.for("@openfeature/web-sdk/api"),Is=globalThis,Pm=class jn extends gm{constructor(){super("client"),this._statusEnumType=sr,this._apiEmitter=new Ps,this._defaultProvider=new In(Ts,sr.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new Ps}static getInstance(){const e=Is[ks];if(e)return e;const r=new jn;return Is[ks]=r,r}getProviderStatus(e){var r,n;return e?(n=(r=this._domainScopedProviders.get(e))==null?void 0:r.status)!=null?n:this._defaultProvider.status:this._defaultProvider.status}setProviderAndWait(e,r,n){return Dt(this,null,function*(){const a=Tt(e),s=Te(a?r:e),i=Te(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i),yield this.setAwaitableProvider(a,s)})}setProvider(e,r,n){const a=Tt(e),s=Te(a?r:e),i=Te(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i);const o=this.setAwaitableProvider(a,s);return Promise.resolve(o).catch(l=>{this._logger.error("Error during provider initialization:",l)}),this}getProvider(e){return this.getProviderForClient(e)}setContext(e,r){return Dt(this,null,function*(){var n,a;const s=Tt(e),i=(a=(n=Te(e))!=null?n:Te(r))!=null?a:{};if(s){const o=this._domainScopedProviders.get(s);if(o){const l=this.getContext(s);this._domainScopedContext.set(s,i),yield this.runProviderContextChangeHandler(s,o,l,i)}else this._domainScopedContext.set(s,i)}else{const o=this._context;this._context=i;const l=Array.from(this._domainScopedProviders.entries()).filter(([d])=>!this._domainScopedContext.has(d)).reduce((d,[u,f])=>(d.push({domain:u,wrapper:f}),d),[]),c=[{domain:void 0,wrapper:this._defaultProvider},...l];yield Promise.all(c.map(d=>this.runProviderContextChangeHandler(d.domain,d.wrapper,o,i)))}})}getContext(e){const r=Tt(e);if(r){const n=this._domainScopedContext.get(r);if(n)return n;this._logger.debug(`Unable to find context for '${r}'.`)}return this._context}clearContext(e){return Dt(this,null,function*(){const r=Tt(e);if(r){const n=this._domainScopedProviders.get(r);if(n){const a=this.getContext(r);this._domainScopedContext.delete(r);const s=this.getContext();yield this.runProviderContextChangeHandler(r,n,a,s)}else this._domainScopedContext.delete(r)}else return this.setContext({})})}clearContexts(){return Dt(this,null,function*(){yield this.clearContext(),yield Promise.allSettled(Array.from(this._domainScopedProviders.keys()).map(e=>this.clearContext(e)))})}getClient(e,r){return new Tm(()=>this.getProviderForClient(e),()=>this.getProviderStatus(e),()=>this.buildAndCacheEventEmitterForClient(e),n=>this.getContext(n),()=>this.getHooks(),()=>this._logger,{domain:e,version:r})}clearProviders(){return Dt(this,null,function*(){yield wm(jn.prototype,this,"clearProvidersAndSetDefault").call(this,Ts),this._domainScopedContext.clear()})}runProviderContextChangeHandler(e,r,n,a){return Dt(this,null,function*(){var s,i,o,l,c,d;const u=((i=(s=r.provider)==null?void 0:s.metadata)==null?void 0:i.name)||"unnamed-provider";try{if(typeof r.provider.onContextChange=="function"){const f=r.provider.onContextChange(n,a);f&&typeof f?.then=="function"&&(r.incrementPendingContextChanges(),r.status=this._statusEnumType.RECONCILING,this.getAssociatedEventEmitters(e).forEach(h=>{h?.emit(ze.Reconciling,{domain:e,providerName:u})}),(o=this._apiEmitter)==null||o.emit(ze.Reconciling,{domain:e,providerName:u}),yield f,r.decrementPendingContextChanges())}r.status=this._statusEnumType.READY,r.allContextChangesSettled&&(this.getAssociatedEventEmitters(e).forEach(f=>{f?.emit(ze.ContextChanged,{clientName:e,domain:e,providerName:u})}),(l=this._apiEmitter)==null||l.emit(ze.ContextChanged,{clientName:e,domain:e,providerName:u}))}catch(f){if(r.decrementPendingContextChanges(),r.status=this._statusEnumType.ERROR,r.allContextChangesSettled){const h=f,g=`Error running ${u}'s context change handler: ${h?.message}`;(c=this._logger)==null||c.error(`${g}`,f),this.getAssociatedEventEmitters(e).forEach(E=>{E?.emit(ze.Error,{clientName:e,domain:e,providerName:u,message:g})}),(d=this._apiEmitter)==null||d.emit(ze.Error,{clientName:e,domain:e,providerName:u,message:g})}}})}},js=Pm.getInstance();class km{runsOn="client";metadata={name:"QueryParamProvider"};flags;constructor(e){this.flags=new Map;for(const[r,n]of e.entries())this.flags.set(r,n)}resolveBooleanEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n.toLowerCase()==="true"||n==="1",reason:"STATIC",variant:n}}resolveStringEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n,reason:"STATIC",variant:n}}resolveNumberEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};const a=Number(n);return isNaN(a)?{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse "${n}" as a number`}:{value:a,reason:"STATIC",variant:n}}resolveObjectEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};try{return{value:JSON.parse(n),reason:"STATIC",variant:n}}catch(a){return{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse JSON: ${a instanceof Error?a.message:String(a)}`}}}}async function Im(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new km(e);await js.setProviderAndWait(r);const n=new Map,a=js.getClient();n.set(Ms,a.getBooleanValue(Ms,jm)),n.set(Hs,a.getBooleanValue(Hs,Mm)),n.set(Fs,a.getBooleanValue(Fs,Hm));const i=e.has(yn)?a.getBooleanValue(yn,Fm):ge.content.inspectorEnabled;return n.set(yn,i),n}const Ms="FEATURE_LEGACY_READ_ENABLED",jm=!1,Hs="FEATURE_LEGACY_WRITE_ENABLED",Mm=!1,Fs="FEATURE_CHANNEL_SYNC_ENABLED",Hm=!0,yn="FEATURE_INSPECTOR_ENABLED",Fm=!1;let Mn;function Vm(t){Mn=t}async function Mg(){await Mn?.clear();const t=window.ph?.reactorClientModule?.pg;return t&&await cc(t),!!Mn}async function Bm(t){const e=await Yp(),r=[e,...t];return Fn([e,...t]),r}async function Um(t,e,r){const n=r.find(a=>a.state.local.triggers.find(s=>s.type==="PullResponder"&&s.data?.url===t));if(n)return n;try{return await e.addRemoteDrive(t,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:t,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:_c(),system:!0}],triggers:[]})}catch(a){te.error("Error adding remote drive",a)}}async function $m(){if(window.ph||(window.ph={}),window.ph.legacyReactor||window.ph.loading)return;window.ph.loading=!0,Hl(),Fl(or);const t=await Im();te.info(`Features: ${JSON.stringify(Object.fromEntries(t),null,2)}`);const e=await Vl(),r=await e.did(),n=Bl(r,kt.routerBasename),a=Vh(kt.routerBasename);Vm(a);const s=await qp(),i=await Bm(s),o=i.flatMap(D=>D.modules.documentModelModules).filter(D=>D!==void 0),l=Ul(),c=Bh(o,a,{...l,featureFlags:{enableDualActionCreate:!0}}),d=await Uh(o,a,e);await $l(c,n,e);const u=new Ho(c.listeners,c);let f=await ua(c);const h=Wm(),g=h?await Um(h,c,f):void 0;g&&(f=await ua(c));const E=window.location.pathname,b=g?.header.slug??zl(E),C=g?"":Wl(E),S=zm();await Kl(S,c,n,e);const k=t.get("FEATURE_LEGACY_READ_ENABLED")??!0,N=k?new Zl(c):new Yl(d.client);Gl(kt),Jl(c),ql(d),Xl(d.client),Ql(d.reactorModule?.syncModule?.syncManager),ec(d.reactorModule?.database),tc(d.pg),rc(N),nc(e),ac(r),sc(n),ic(u),oc(f),Fn(i),Rr(b),_n(C),lc(t),k?(c.on("defaultRemoteDrive",(...D)=>{te.verbose("defaultRemoteDrive",...D),Rt(c).catch(te.error)}),c.on("clientStrandsError",(...D)=>{te.verbose("clientStrandsError",...D),Rt(c).catch(te.error)}),c.on("driveAdded",(...D)=>{te.verbose("driveAdded",...D),u.registerDrive(D[0].header.id).catch(te.error),Rt(c).catch(te.error)}),c.on("driveDeleted",(...D)=>{te.verbose("driveDeleted",...D),Rt(c).catch(te.error)}),c.on("documentModelModules",(...D)=>{te.verbose("documentModelModules",...D),Rt(c).catch(te.error)}),c.on("driveOperationsAdded",(...D)=>{te.verbose("driveOperationsAdded",...D),Rt(c).catch(te.error)})):(c.on("defaultRemoteDrive",(...T)=>{te.verbose("future:defaultRemoteDrive",...T),yt(d.client).catch(te.error)}),c.on("clientStrandsError",(...T)=>{te.verbose("future:clientStrandsError",...T),yt(d.client).catch(te.error)}),c.on("driveAdded",(...T)=>{te.verbose("future:driveAdded",...T),u.registerDrive(T[0].header.id).catch(te.error),yt(d.client).catch(te.error)}),c.on("driveDeleted",(...T)=>{te.verbose("future:driveDeleted",...T),yt(d.client).catch(te.error)}),c.on("documentModelModules",(...T)=>{te.verbose("future:documentModelModules",...T),yt(d.client).catch(te.error)}),c.on("driveOperationsAdded",(...T)=>{te.verbose("future:driveOperationsAdded",...T),yt(d.client).catch(te.error)}),d.client.subscribe({type:"powerhouse/document-drive"},T=>{te.verbose("ReactorClient subscription event",T),yt(d.client).catch(te.error)})),window.ph.loading=!1}function zm(){const e=new URLSearchParams(window.location.search).get("user");return e?decodeURIComponent(e):void 0}function Wm(){const e=new URLSearchParams(window.location.search).get("driveUrl");return e?decodeURIComponent(e):void 0}function Km(){const t=Vn();m.useEffect(()=>{let e=null;if(t){const{credential:r,...n}=t;e={id:n.did,username:n.ens?.name,...n}}Nc(e)},[t])}function Zm(){return _.jsx("div",{className:"h-screen",children:_.jsx("div",{className:"flex h-screen items-stretch overflow-auto",role:"presentation",tabIndex:0,children:_.jsxs(m.Suspense,{name:"Root",children:[_.jsx(dg,{}),_.jsx("div",{className:"relative flex-1 overflow-auto",children:_.jsx(Zf,{})})]})})})}function Ym(){const[t]=Js(),e=Gs(),r=Ks();m.useEffect(()=>{r||dc(gd)},[r]),m.useEffect(()=>{t||uc(vd)},[t]);const n=!r&&!t&&!e;return _.jsx(Gm,{children:n?_.jsx(qm,{}):_.jsx(Cp,{})})}function Gm({children:t}){return _.jsx("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:t})}function Jm({drive:t}){const r=Zs(t.header.meta?.preferredEditor)?.name||"Drive Explorer App";return _.jsx(Xo,{title:t.state.global.name,description:r,icon:_.jsx(Wi,{drive:t}),onClick:()=>Rr(t)},t.header.id)}function qm(){const t=qs(),e=ge;return _.jsxs(Us,{children:[t?.map(r=>_.jsx(Jm,{drive:r},r.header.id)),e.drives.addDriveEnabled&&_.jsx(qo,{})]})}const Xm=t=>m.createElement("svg",{width:28,height:32,viewBox:"0 0 28 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},m.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",fill:"url(#paint0_radial_319_20865)"}),m.createElement("path",{d:"M14 0L0 23.9998V7.99993L14 0Z",fill:"url(#paint1_linear_319_20865)"}),m.createElement("path",{d:"M28 24L7.82013e-05 24L14 31.9999L28 24Z",fill:"url(#paint2_linear_319_20865)"}),m.createElement("path",{d:"M14 0L28 23.9998V7.99993L14 0Z",fill:"url(#paint3_linear_319_20865)"}),m.createElement("defs",null,m.createElement("radialGradient",{id:"paint0_radial_319_20865",cx:0,cy:0,r:1,gradientUnits:"userSpaceOnUse",gradientTransform:"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)"},m.createElement("stop",{offset:.181008,stopColor:"#FFCD6B"}),m.createElement("stop",{offset:1,stopColor:"#EB5EDF"})),m.createElement("linearGradient",{id:"paint1_linear_319_20865",x1:-.031454,y1:24.041,x2:13.801,y2:-.142908,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#4331E9"}),m.createElement("stop",{offset:1,stopColor:"#A273FF"})),m.createElement("linearGradient",{id:"paint2_linear_319_20865",x1:-.0310093,y1:24,x2:28.0444,y2:24,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#A273FF"}),m.createElement("stop",{offset:1,stopColor:"#4331E9"})),m.createElement("linearGradient",{id:"paint3_linear_319_20865",x1:28.0315,y1:24.041,x2:14.199,y2:-.142908,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#A273FF"}),m.createElement("stop",{offset:1,stopColor:"#4331E9"})))),Qm=t=>m.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},m.createElement("path",{d:"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",fill:"#6C7275"}),m.createElement("path",{d:"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",fill:"#6C7275"})),eg="https://apps.powerhouse.io/sky-atlas/staging/switchboard",tg=2e3;function rg(){const{search:t}=Zr();return m.useMemo(()=>{const r=new URLSearchParams(t).get("reactorUrl")??eg;return r.endsWith("/")?r:`${r}/`},[t])}async function ng(t,e){const r=Ec`
14
+ }`}}):null,_.jsx(Yh,{})]})};function Jh({children:t}){return _.jsx(_.Fragment,{children:t})}const qh=({children:t})=>(fh(),t),Xh=()=>(m.useEffect(()=>{const t=()=>{console.log("Outdated chunks detected, reloading page..."),window.location.reload()};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),m.useEffect(()=>{Kh.registerServiceWorker(!1)},[]),_.jsx(qh,{children:_.jsx(Uo,{children:_.jsxs(Jh,{children:[_.jsx($o,{position:"bottom-right",containerId:"connect"}),_.jsx(dg,{}),_.jsx(Th,{})]})})})),Qh={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},ep={placeholder:"Search Powerhouse",filterLabel:"File type"},tp={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},rp={options:{switchboardLink:"Switchboard Link"}},np={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},ap={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},sp={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},ip={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},op={common:Qh,searchbar:ep,folderView:tp,files:rp,modals:np,notifications:ap,footer:sp,cookieBanner:ip},lp={en:{code:"en",name:"English",translation:op}};Ne.use(mu).init({resources:lp,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const cp=(t,e)=>t.some(r=>r.id===e&&r.value),dp=()=>{const{t}=yi(void 0,{useSuspense:!0,i18n:Ne}),[e,r]=Lu(),[,n]=Un(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=o=>{r(!1),cp(o,"analytics-cookie")&&n(l=>({...l,analytics:!0}))},i=()=>{r(!1),n(()=>({analytics:!1,functional:!1,marketing:!1}))};return e?_.jsxs("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[_.jsx("div",{className:"absolute inset-0 bg-black opacity-15"}),_.jsx("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:_.jsx(zo,{className:"max-w-[1024px]",cookies:a,onSubmit:s,onReject:i,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:_.jsx("p",{className:"font-semibold text-gray-500",children:_.jsx(vu,{i18nKey:"cookieBanner.message",components:{a:_.jsx("a",{onClick:()=>et({type:"cookiesPolicy"}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};function up(){const[t]=Ws(),[e]=ul(),r=fl(e.header.id),n=hl(t),a=pl(t),s=ml(),i=Vn(),o=m.useCallback(()=>{gl(e).length?et({type:"exportDocumentWithErrors",documentId:e.header.id}):vl(e).catch(d=>{console.error(d);const f=d instanceof Error?d.message:JSON.stringify(d,null,1);or(`Failed to export document: ${f}`)})},[e]),l=m.useMemo(()=>n?async()=>{if(!e.header.id){console.error("No selected document");return}if(!a){console.error("No remote drive url found");return}const u=i?.address?await s?.getBearerToken(a,i.address,!1,{expiresIn:600}):void 0,d=yl(a,e.header.id,u);try{Hh(d)}catch(f){console.error("Error opening switchboard link",f)}}:void 0,[n,a,e]),c=m.useCallback(()=>{_n(r)},[r,_n]);return _.jsx("div",{id:"document-editor-container",className:"flex-1 rounded-2xl bg-gray-50 p-4",children:_.jsx(xp,{document:e,onClose:c,onExport:o,onOpenSwitchboardLink:l})})}function Nr(t){const[e,r]=m.useState(!1);if(m.useEffect(()=>{setTimeout(()=>{r(!0)},t.loadingTimeout??200)},[t]),!e)return null;const{customEditorLoader:n,...a}=t;return n?_.jsx(_.Fragment,{children:n}):_.jsx(Wo,{...a})}const fp=m.createContext(null),hn={didCatch:!1,error:null};let hp=class extends m.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hn}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var r,n,a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:s,reason:"imperative-api"}),this.setState(hn)}}componentDidCatch(e,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,e,r)}componentDidUpdate(e,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&pp(e.resetKeys,a)){var s,i;(s=(i=this.props).onReset)===null||s===void 0||s.call(i,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(hn)}}render(){const{children:e,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:s,error:i}=this.state;let o=e;if(s){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")o=r(l);else if(n)o=m.createElement(n,l);else if(a!==void 0)o=a;else throw i}return m.createElement(fp.Provider,{value:{didCatch:s,error:i,resetErrorBoundary:this.resetErrorBoundary}},o)}};function pp(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((r,n)=>!Object.is(r,e[n]))}const mp=Hn(["Connect"]);function gp(t){return"fallbackRender"in t}function vp(){return null}function yp({message:t="Something went wrong"}){return _.jsx("div",{className:"text-center",children:t})}function _p({error:t}){const e=t instanceof Error?t.message:String(t);return _.jsxs("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[_.jsx("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),_.jsx("i",{children:e}),_.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function zi({error:t}){const e=t instanceof Error?t.message:String(t);return _.jsx("div",{className:"flex size-full items-center justify-center",children:_.jsx("h3",{className:"text-lg font-semibold",children:e})})}function Ep(t,e){switch(t){case"silent":return vp;case"text":return()=>_.jsx(yp,{message:e});case"detailed":return _p;default:return zi}}function Yr(t){const{children:e,onError:r,resetKeys:n,loggerContext:a}=t,s=(o,l)=>{if(o.message.includes("Failed to fetch dynamically imported module")&&o.message.includes("node_modules/.vite")){console.error(o),console.log("Outdated chunk detected, reloading page..."),window.location.reload();return}(a?Hn(a):mp).error(o,l),r?.(o,l)},i=gp(t)?t.fallbackRender:Ep(t.variant,t.fallbackMessage);return _.jsx(hp,{fallbackRender:i,onError:s,resetKeys:n,children:e})}function Cp(){const[t]=Ws(),e=Ks(),r=Zs(t.header.meta?.preferredEditor),n=_l(),a=r?.Component??n?.Component??Fo.Component;if(!a)throw new Error("No drive editor component found");return _.jsx(Yr,{variant:"detailed",resetKeys:[t.header.id],loggerContext:["Connect","DriveEditor"],children:_.jsx(m.Suspense,{fallback:_.jsx(Nr,{}),children:_.jsx(Ko,{className:"flex h-full flex-col overflow-auto",children:_.jsx(a,{children:e?_.jsx(up,{}):null})})})})}function Wi({drive:t}){const e=El(t),r=t?.state.global.icon;return r?_.jsx("img",{src:r,alt:t.header.name,height:32,width:32}):e==="LOCAL"?_.jsx(ha,{name:"Hdd",size:32}):_.jsx(ha,{name:"Server",size:32})}function Ns({message:t}){return _.jsx("div",{className:"flex size-full items-center justify-center",children:_.jsx("h3",{className:"text-lg font-semibold",children:t})})}const xp=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:a}=t,s=Cl(),i=xl(),[o,l]=bl(e.header.id),c=o?.header.id??void 0,u=o?.header.name??void 0,d=o?.header.documentType??void 0,f=o?.header.meta?.preferredEditor??void 0,h=o?.operations.global??[],v=o?.operations.local??[],E=o?.header.revision.global??0,b=o?.header.revision.local??0,C=Sl(d),N=Nl(f),k=Rl(d),R=N??k,A=!o,M=R&&d&&!R.documentTypes.includes(d)&&!R.documentTypes.includes("*"),g=E>0||b>0,S=!!o?.clipboard.length;Oh({undo:()=>l(vc()),redo:()=>l(yc()),canUndo:g,canRedo:S}),m.useEffect(()=>()=>{window.documentEditorDebugTools?.clear()},[]);const[G,z]=m.useState(void 0);m.useEffect(()=>{G&&G.documentId!==c&&z(void 0)},[G,c]);const ee=(Re,Ce)=>{z({error:Re,documentId:c,info:Ce})};if(M)return _.jsx(Nr,{message:"Loading editor"});if(A)return _.jsx(Nr,{message:"Loading document"});if(!C)return _.jsx(Ns,{message:_.jsxs("div",{className:"text-center leading-10",children:[_.jsxs("p",{children:['Unable to open the document because the document model "',d,'" is not supported.']}),_.jsxs("p",{children:["Go to the"," ",_.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{et({type:"settings"})},children:"package manager"})," ","to install this document model"]})]})});if(!R)return _.jsx(Ns,{message:_.jsxs("div",{className:"text-center leading-10",children:[_.jsx("p",{children:"Unable to open the document because no editor has been found"}),_.jsxs("p",{children:["Go to the"," ",_.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{et({type:"settings"})},children:"package manager"})," ",'an editor for the "$',d,'" document type']})]})});const ne=R.Component;return _.jsx("div",{className:"relative h-full",id:"document-editor-context",children:i?_.jsx(Zo,{documentTitle:u??"",documentId:c??"",globalOperations:h,localOperations:v,onClose:()=>wl(!1),documentState:o.state,onCopyState:()=>{or("Copied document state to clipboard",{type:"success"})}},c):_.jsx(m.Suspense,{fallback:_.jsx(Nr,{message:"Loading editor"}),name:"EditorLoader",children:_.jsx(Yr,{fallbackRender:zi,resetKeys:[c],onError:ee,loggerContext:["Connect","DocumentEditor"],children:!G?.error&&_.jsx(ne,{context:{readMode:!!s,selectedTimelineRevision:Ol(s?.startDate,s?.endDate,h)},documentId:o.header.id},c)})})})},bp=m.lazy(()=>Se(()=>import("./AddDriveModal-B-mkPvxY.js"),__vite__mapDeps([3,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.AddDriveModal}))),Sp=m.lazy(()=>Se(()=>import("./ClearStorageModal-CPyXjtE_.js"),__vite__mapDeps([20,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ClearStorageModal}))),Np=m.lazy(()=>Se(()=>import("./CookiesPolicyModal-Cfvaovdz.js"),__vite__mapDeps([21,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.CookiesPolicyModal}))),Rp=m.lazy(()=>Se(()=>import("./CreateDocumentModal-CkNEbPYe.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.CreateDocumentModal}))),wp=m.lazy(()=>Se(()=>import("./DebugSettingsModal-D2JAQzFM.js"),__vite__mapDeps([23,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DebugSettingsModal}))),Op=m.lazy(()=>Se(()=>import("./DeleteDriveModal-OsVneUN5.js"),__vite__mapDeps([24,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteDriveModal}))),Dp=m.lazy(()=>Se(()=>import("./DeleteItemModal-BEl_TNZV.js"),__vite__mapDeps([25,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteItemModal}))),Lp=m.lazy(()=>Se(()=>import("./DisclaimerModal-B3L0Zayk.js"),__vite__mapDeps([26,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DisclaimerModal}))),Ap=m.lazy(()=>Se(()=>import("./DriveSettingsModal-BRo4Yo-8.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DriveSettingsModal}))),Tp=m.lazy(()=>Se(()=>import("./ExportDocumentWithErrorsModal-CFUpAfjW.js"),__vite__mapDeps([28,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ExportDocumentWithErrorsModal}))),Pp=m.lazy(()=>Se(()=>import("./SettingsModal-Dg1z54dL.js"),__vite__mapDeps([29,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.SettingsModal}))),kp=m.lazy(()=>Se(()=>import("./UpgradeDriveModal-D30aSlcL.js"),__vite__mapDeps([30,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.UpgradeDriveModal}))),Ip=m.lazy(()=>Se(()=>import("./index-kDDMsCoU.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.InspectorModal}))),jp={addDrive:bp,clearStorage:Sp,cookiesPolicy:Np,createDocument:Rp,debugSettings:wp,deleteDrive:Op,deleteItem:Dp,disclaimer:Lp,driveSettings:Ap,exportDocumentWithErrors:Tp,inspector:Ip,settings:Pp,upgradeDrive:kp};function Mp(){const t=Dl();if(!t?.type)return null;const e=jp[t.type];return e?_.jsx(Yr,{variant:"silent",loggerContext:["Connect","Modals"],children:_.jsx(m.Suspense,{fallback:null,children:_.jsx(e,{})})}):null}function Hp(t){return t.documentModel.global}function Fp(){const{isAllowedToCreateDocuments:t}=Ll(),r=Al()?.filter(n=>n.documentModel.global.id!=="powerhouse/document-drive");return t?_.jsxs("div",{className:"px-6 py-4",children:[_.jsx("h3",{className:"mb-3 text-xl font-bold text-gray-600",children:"New document"}),_.jsx("div",{className:"flex w-full flex-wrap gap-4",children:r?.map(n=>{const a=Hp(n),s=n.version?` v${n.version}`:"";return _.jsx(Xs,{color:"light",title:`${a.name}${s}`,"aria-description":a.description,onClick:()=>Tl(a.id),children:_.jsxs("span",{className:"text-sm",children:[a.name,s]})},`${a.id}-v${n.version??1}`)})})]}):null}const Gt=8,pn=256,Rs=48,Vp=420;function Bp(){const t=m.useRef(null),r=gc().innerWidth-Vp,a=Ys().filter(f=>Pl(f)),s=Math.floor(r/(pn+Gt))||1,i=Math.ceil(a.length/s),o=da({count:i,getScrollElement:()=>t.current,estimateSize:f=>f>0?Rs+Gt:Rs,overscan:5}),l=da({horizontal:!0,count:s,getScrollElement:()=>t.current,estimateSize:f=>f>0?pn+Gt:pn,overscan:5}),c=(f,h)=>f*s+h,u=(f,h)=>{const v=c(f,h);return a[v]||null};if(a.length===0)return _.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"});const d=(f,h)=>{const v=u(f,h);return v?_.jsx("div",{style:{marginLeft:h===0?0:Gt},children:_.jsx(Yo,{fileNode:v},v.id)}):null};return _.jsx("div",{ref:t,style:{width:"100%",overflow:"auto"},children:_.jsx("div",{style:{height:`${o.getTotalSize()}px`,width:`${l.getTotalSize()}px`,position:"relative"},children:o.getVirtualItems().map(f=>_.jsx(Vs.Fragment,{children:l.getVirtualItems().map(h=>_.jsx("div",{style:{position:"absolute",top:0,left:0,marginTop:f.index===0?0:Gt,width:`${h.size}px`,height:`${f.size}px`,transform:`translateX(${h.start}px) translateY(${f.start}px)`},children:d(f.index,h.index)},h.key))},f.key))})})}function Pe({children:t,className:e,...r}){return _.jsx(Pe.Container,{className:e,...r,children:t})}Pe.Container=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2",r),...n,...a,children:e})};Pe.Header=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex-0",r),...n,...a,children:e})};Pe.Content=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("mb-5 flex-1 px-4",r),...n,...a,children:e})};Pe.ContentSection=function({title:e,children:r,className:n,containerProps:a,...s}){return _.jsxs("div",{className:ir(n),...a,...s,children:[e&&_.jsx("div",{className:"mb-4 text-base font-semibold text-gray-600",children:e}),_.jsx("div",{className:"flex flex-wrap gap-2",children:r})]})};Pe.Footer=function({children:e,className:r,containerProps:n,...a}){return _.jsx("div",{className:ir("flex-0",r),...n,...a,children:e})};function Up(t){const{className:e}=t,r=Ys(),n=Gs(),a=r.filter(o=>kl(o)),{isDropTarget:s,dropProps:i}=$s({target:n});return _.jsxs("div",{className:Sc("rounded-md border-2 border-transparent p-2",s&&"border-dashed border-blue-100",e),...i,children:[_.jsx(Pe.ContentSection,{title:"Folders",className:"mb-4",children:a.length>0?a.map(o=>_.jsx(Go,{folderNode:o},o.id)):_.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"})}),_.jsx(Pe.ContentSection,{title:"Documents and files",children:_.jsx("div",{className:"w-full",children:_.jsx(Bp,{})})})]})}const $p={allowedDocumentTypes:[],isDragAndDropEnabled:!0};function Ki(t){Il($p);const{className:e,children:r}=t,{isDropTarget:n,dropProps:a}=$s(),s=!!r;return _.jsxs(Pe,{className:e,children:[!s&&_.jsx(Pe.Header,{children:_.jsx(Jo,{})}),s?r:_.jsx(Pe.Content,{...a,className:n?"rounded-xl bg-blue-100":"",children:_.jsx(Up,{})}),!s&&_.jsx(Pe.Footer,{children:_.jsx(Fp,{})})]})}const Mg=Object.freeze(Object.defineProperty({__proto__:null,default:Ki},Symbol.toStringTag,{value:"Module"}));function zp(){return{id:jl,name:"Generic Drive Explorer",documentTypes:["powerhouse/document-drive"],Component:Ki}}function Wp(){return{id:"document-model-editor-v2",name:"Document Model Editor",documentTypes:["powerhouse/document-model"],Component:Lo}}async function Kp(){const t=yr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,s=t.specifications,i=yr.reducer,o=yr.actions,l=yr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:s,reducer:i,actions:o,utils:l,documentModel:Qs(ei(),t)}}async function Zp(){const t=vr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,s=t.specifications,i=vr.reducer,o=vr.actions,l=vr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:s,reducer:i,actions:o,utils:l,documentModel:Qs(ei(),t)}}async function Yp(){const t=await Kp(),e=await Zp(),r=Wp(),n=zp();return{id:Ml,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]},upgradeManifests:[]}}const{externalPackagesEnabled:Gp}=ge;function Jp(t){return t.loadExternalPackages().then(e=>e.map(zs))}async function qp(){try{if(!Gp)return[];const t=await Se(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return Jp(t)}catch(t){return console.error(t),[]}}var Xp=Object.defineProperty,Qp=Object.defineProperties,em=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,tm=Object.prototype.hasOwnProperty,rm=Object.prototype.propertyIsEnumerable,Os=(t,e,r)=>e in t?Xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mn=(t,e)=>{for(var r in e||(e={}))tm.call(e,r)&&Os(t,r,e[r]);if(ws)for(var r of ws(e))rm.call(e,r)&&Os(t,r,e[r]);return t},gn=(t,e)=>Qp(t,em(e)),At=(t,e,r)=>new Promise((n,a)=>{var s=l=>{try{o(r.next(l))}catch(c){a(c)}},i=l=>{try{o(r.throw(l))}catch(c){a(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,i);o((r=r.apply(t,e)).next())}),nm=class{constructor(){this.data=new Map}set(t,e){this.data.set(t,e)}get(t){return this.data.get(t)}has(t){return this.data.has(t)}delete(t){return this.data.delete(t)}clear(){this.data.clear()}},am={ERROR:"ERROR"},Zi=(t=>(t.PROVIDER_NOT_READY="PROVIDER_NOT_READY",t.PROVIDER_FATAL="PROVIDER_FATAL",t.FLAG_NOT_FOUND="FLAG_NOT_FOUND",t.PARSE_ERROR="PARSE_ERROR",t.TYPE_MISMATCH="TYPE_MISMATCH",t.TARGETING_KEY_MISSING="TARGETING_KEY_MISSING",t.INVALID_CONTEXT="INVALID_CONTEXT",t.GENERAL="GENERAL",t))(Zi||{}),ft=class Yi extends Error{constructor(e,r){super(e),Object.setPrototypeOf(this,Yi.prototype),this.name="OpenFeatureError",this.cause=r?.cause}},sm=class Gi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Gi.prototype),this.name="FlagNotFoundError",this.code="FLAG_NOT_FOUND"}},Ji=class qi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,qi.prototype),this.name="GeneralError",this.code="GENERAL"}},im=class Xi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Xi.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},om=class Qi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Qi.prototype),this.name="ParseError",this.code="PARSE_ERROR"}},eo=class to extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,to.prototype),this.name="ProviderFatalError",this.code="PROVIDER_FATAL"}},ro=class no extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,no.prototype),this.name="ProviderNotReadyError",this.code="PROVIDER_NOT_READY"}},lm=class ao extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,ao.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},cm=class so extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,so.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},dm=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new sm(e);case"PARSE_ERROR":return new om(e);case"TYPE_MISMATCH":return new cm(e);case"TARGETING_KEY_MISSING":return new lm(e);case"INVALID_CONTEXT":return new im(e);case"PROVIDER_NOT_READY":return new ro(e);case"PROVIDER_FATAL":return new eo(e);default:return new Ji(e)}},sr=(t=>(t.NOT_READY="NOT_READY",t.READY="READY",t.ERROR="ERROR",t.STALE="STALE",t.FATAL="FATAL",t.RECONCILING="RECONCILING",t))(sr||{}),ze=(t=>(t.Ready="PROVIDER_READY",t.Error="PROVIDER_ERROR",t.ConfigurationChanged="PROVIDER_CONFIGURATION_CHANGED",t.ContextChanged="PROVIDER_CONTEXT_CHANGED",t.Reconciling="PROVIDER_RECONCILING",t.Stale="PROVIDER_STALE",t))(ze||{}),um={READY:"PROVIDER_READY",ERROR:"PROVIDER_ERROR",FATAL:"PROVIDER_ERROR",STALE:"PROVIDER_STALE",RECONCILING:"PROVIDER_RECONCILING",NOT_READY:void 0},io=(t,e)=>!e&&t==="PROVIDER_READY"||um[e]===t,oo=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},fm=["error","warn","info","debug"],Jn=class{constructor(t){this.fallbackLogger=new oo;try{for(const e of fm)if(!t[e]||typeof t[e]!="function")throw new Error(`The provided logger is missing the ${e} method.`);this.logger=t}catch(e){console.error(e),console.error("Falling back to the default logger."),this.logger=this.fallbackLogger}}error(...t){this.log("error",...t)}warn(...t){this.log("warn",...t)}info(...t){this.log("info",...t)}debug(...t){this.log("debug",...t)}log(t,...e){try{this.logger[t](...e)}catch{this.fallbackLogger[t](...e)}}},hm=class{constructor(t){this.globalLogger=t,this._handlers={PROVIDER_CONFIGURATION_CHANGED:new WeakMap,PROVIDER_CONTEXT_CHANGED:new WeakMap,PROVIDER_READY:new WeakMap,PROVIDER_ERROR:new WeakMap,PROVIDER_STALE:new WeakMap,PROVIDER_RECONCILING:new WeakMap}}emit(t,e){this.eventEmitter.emit(t,e)}addHandler(t,e){const r=a=>At(this,null,function*(){var s;try{yield e(a)}catch(i){(s=this._logger)==null||s.error("Error running event handler:",i)}}),n=this._handlers[t].get(e);this._handlers[t].set(e,[...n||[],r]),this.eventEmitter.on(t,r)}removeHandler(t,e){const r=this._handlers[t].get(e);if(r){const n=r.pop();n&&this.eventEmitter.removeListener(t,n)}}removeAllHandlers(t){t?this.eventEmitter.removeAllListeners(t):this.eventEmitter.removeAllListeners()}getHandlers(t){return this.eventEmitter.listeners(t)}setLogger(t){return this._eventLogger=new Jn(t),this}get _logger(){var t,e;return(e=this._eventLogger)!=null?e:(t=this.globalLogger)==null?void 0:t.call(this)}};function pm(t){return typeof t=="string"}function Tt(t){return pm(t)?t:void 0}function mm(t){return typeof t=="object"}function Te(t){return mm(t)?t:void 0}function Ds(t){return typeof t<"u"&&t!==null}var In=class{constructor(t,e,r){this._provider=t,this._status=e,this._pendingContextChanges=0;var n,a,s;(n=t.events)==null||n.addHandler("PROVIDER_READY",()=>{this._status=r.READY}),(a=t.events)==null||a.addHandler("PROVIDER_STALE",()=>{this._status=r.STALE}),(s=t.events)==null||s.addHandler("PROVIDER_ERROR",i=>{i?.errorCode==="PROVIDER_FATAL"?this._status=r.FATAL:this._status=r.ERROR})}get provider(){return this._provider}set provider(t){this._provider=t}get status(){return this._status}set status(t){this._status=t}get allContextChangesSettled(){return this._pendingContextChanges===0}incrementPendingContextChanges(){this._pendingContextChanges++}decrementPendingContextChanges(){this._pendingContextChanges--}},gm=class{constructor(t){this._hooks=[],this._context={},this._logger=new oo,this._clientEventHandlers=new Map,this._domainScopedContext=new Map,this._clientEvents=new Map,this._runsOn=t}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}setLogger(t){return this._logger=new Jn(t),this}get providerMetadata(){return this.getProviderMetadata()}getProviderMetadata(t){return this.getProviderForClient(t).metadata}addHandler(t,e,r){[...new Map([[void 0,this._defaultProvider]]),...this._domainScopedProviders].forEach(n=>{var a;const s=n[0],i=n[1].provider,o=n[1].status;if(io(t,o))try{e({domain:s,providerName:i.metadata.name})}catch(c){(a=this._logger)==null||a.error("Error running event handler:",c)}}),this._apiEmitter.addHandler(t,e),r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this._apiEmitter.removeHandler(t,e)}clearHandlers(){this._apiEmitter.removeAllHandlers()}getHandlers(t){return this._apiEmitter.getHandlers(t)}setAwaitableProvider(t,e){var r,n,a,s,i,o,l,c;const u=Tt(t),d=(r=Te(t))!=null?r:Te(e);if(!d){this._logger.debug("No provider defined, ignoring setProvider call");return}const f=this.getProviderForClient(u),h=d.metadata.name;if(f===d){this._logger.debug("Provider is already set, ignoring setProvider call");return}if(!d.runsOn)this._logger.debug(`Provider '${d.metadata.name}' has not defined its intended use.`);else if(d.runsOn!==this._runsOn)throw new Ji(`Provider '${d.metadata.name}' is intended for use on the ${d.runsOn}.`);const v=this.getAssociatedEventEmitters(u);let E;const b=new In(d,this._statusEnumType.NOT_READY,this._statusEnumType);return typeof d.initialize=="function"&&!this.allProviders.includes(d)?E=(i=(s=(a=d.initialize)==null?void 0:a.call(d,u?(n=this._domainScopedContext.get(u))!=null?n:this._context:this._context))==null?void 0:s.then(()=>{var C;b.status=this._statusEnumType.READY,this.getAssociatedEventEmitters(u).forEach(N=>{N?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:h})}),(C=this._apiEmitter)==null||C.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:h})}))==null?void 0:i.catch(C=>{var N;throw C?.code==="PROVIDER_FATAL"?b.status=this._statusEnumType.FATAL:b.status=this._statusEnumType.ERROR,this.getAssociatedEventEmitters(u).forEach(k=>{k?.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:h,message:C?.message})}),(N=this._apiEmitter)==null||N.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:h,message:C?.message}),C}):(b.status=this._statusEnumType.READY,v.forEach(C=>{C?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:h})}),(o=this._apiEmitter)==null||o.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:h})),u?this._domainScopedProviders.set(u,b):this._defaultProvider=b,this.transferListeners(f,d,u,v),this.allProviders.includes(f)||(c=(l=f?.onClose)==null?void 0:l.call(f))==null||c.catch(C=>{this._logger.error(`error closing provider: ${C?.message}, ${C?.stack}`)}),E}getProviderForClient(t){var e,r;return t?(r=(e=this._domainScopedProviders.get(t))==null?void 0:e.provider)!=null?r:this._defaultProvider.provider:this._defaultProvider.provider}buildAndCacheEventEmitterForClient(t){const e=this._clientEvents.get(t);if(e)return e;const r=this._createEventEmitter();this._clientEvents.set(t,r);const n=this.getProviderForClient(t);return Object.values(ze).forEach(a=>{var s;return(s=n.events)==null?void 0:s.addHandler(a,i=>At(this,null,function*(){r.emit(a,gn(mn({},i),{clientName:t,domain:t,providerName:n.metadata.name}))}))}),r}getUnboundEmitters(){const t=[...this._domainScopedProviders.keys()];return[...[...this._clientEvents.keys()].filter(Ds).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(Ds)}getAssociatedEventEmitters(t){return t?[this.buildAndCacheEventEmitterForClient(t)]:this.getUnboundEmitters()}transferListeners(t,e,r,n){var a;(a=this._clientEventHandlers.get(r))==null||a.forEach(i=>{var o;return(o=t.events)==null?void 0:o.removeHandler(...i)});const s=Object.values(ze).map(i=>[i,l=>At(this,null,function*(){n.forEach(c=>{c?.emit(i,gn(mn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))}),this._apiEmitter.emit(i,gn(mn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))})]);this._clientEventHandlers.set(r,s),s.forEach(i=>{var o;return(o=e.events)==null?void 0:o.addHandler(...i)})}close(){return At(this,null,function*(){var t,e;try{yield(e=(t=this==null?void 0:this._defaultProvider.provider)==null?void 0:t.onClose)==null?void 0:e.call(t)}catch(n){this.handleShutdownError(this._defaultProvider.provider,n)}const r=Array.from(this._domainScopedProviders);yield Promise.all(r.map(n=>At(this,[n],function*([,a]){var s,i;try{yield(i=a==null?void 0:(s=a.provider).onClose)==null?void 0:i.call(s)}catch(o){this.handleShutdownError(a?.provider,o)}})))})}clearProvidersAndSetDefault(t){return At(this,null,function*(){try{yield this.close()}catch{this._logger.error("Unable to cleanly close providers. Resetting to the default configuration.")}finally{this._domainScopedProviders.clear(),this._defaultProvider=new In(t,this._statusEnumType.NOT_READY,this._statusEnumType)}})}get allProviders(){return[...[...this._domainScopedProviders.values()].map(t=>t.provider),this._defaultProvider.provider]}handleShutdownError(t,e){this._logger.error(`Error during shutdown of provider ${t.metadata.name}: ${e}`),this._logger.error(e?.stack)}},vm=Object.create,qn=Object.defineProperty,ym=Object.defineProperties,_m=Object.getOwnPropertyDescriptor,Em=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertyNames,Ls=Object.getOwnPropertySymbols,co=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty,Cm=Object.prototype.propertyIsEnumerable,xm=Reflect.get,As=(t,e,r)=>e in t?qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vn=(t,e)=>{for(var r in e||(e={}))uo.call(e,r)&&As(t,r,e[r]);if(Ls)for(var r of Ls(e))Cm.call(e,r)&&As(t,r,e[r]);return t},bm=(t,e)=>ym(t,Em(e)),Sm=(t,e)=>function(){return e||(0,t[lo(t)[0]])((e={exports:{}}).exports,e),e.exports},Nm=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of lo(e))!uo.call(t,a)&&a!==r&&qn(t,a,{get:()=>e[a],enumerable:!(n=_m(e,a))||n.enumerable});return t},Rm=(t,e,r)=>(r=t!=null?vm(co(t)):{},Nm(qn(r,"default",{value:t,enumerable:!0}),t)),wm=(t,e,r)=>xm(co(t),r,e),Dt=(t,e,r)=>new Promise((n,a)=>{var s=l=>{try{o(r.next(l))}catch(c){a(c)}},i=l=>{try{o(r.throw(l))}catch(c){a(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,i);o((r=r.apply(t,e)).next())}),Om=Sm({"../../node_modules/eventemitter3/index.js"(t,e){var r=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var v=new s(d,f||c,h),E=n?n+u:u;return c._events[E]?c._events[E].fn?c._events[E]=[c._events[E],v]:c._events[E].push(v):(c._events[E]=v,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new a:delete c._events[u]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)r.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,v=f.length,E=new Array(v);h<v;h++)E[h]=f[h].fn;return E},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,v,E){var b=n?n+u:u;if(!this._events[b])return!1;var C=this._events[b],N=arguments.length,k,R;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),N){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,f),!0;case 4:return C.fn.call(C.context,d,f,h),!0;case 5:return C.fn.call(C.context,d,f,h,v),!0;case 6:return C.fn.call(C.context,d,f,h,v,E),!0}for(R=1,k=new Array(N-1);R<N;R++)k[R-1]=arguments[R];C.fn.apply(C.context,k)}else{var A=C.length,M;for(R=0;R<A;R++)switch(C[R].once&&this.removeListener(u,C[R].fn,void 0,!0),N){case 1:C[R].fn.call(C[R].context);break;case 2:C[R].fn.call(C[R].context,d);break;case 3:C[R].fn.call(C[R].context,d,f);break;case 4:C[R].fn.call(C[R].context,d,f,h);break;default:if(!k)for(M=1,k=new Array(N-1);M<N;M++)k[M-1]=arguments[M];C[R].fn.apply(C[R].context,k)}}return!0},l.prototype.on=function(u,d,f){return i(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var v=n?n+u:u;if(!this._events[v])return this;if(!d)return o(this,v),this;var E=this._events[v];if(E.fn)E.fn===d&&(!h||E.once)&&(!f||E.context===f)&&o(this,v);else{for(var b=0,C=[],N=E.length;b<N;b++)(E[b].fn!==d||h&&!E[b].once||f&&E[b].context!==f)&&C.push(E[b]);C.length?this._events[v]=C.length===1?C[0]:C:o(this,v)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}}),Dm="No-op",Lm=class{constructor(){this.metadata={name:"No-op Provider"}}resolveBooleanEvaluation(t,e){return this.noOp(e)}resolveStringEvaluation(t,e){return this.noOp(e)}resolveNumberEvaluation(t,e){return this.noOp(e)}resolveObjectEvaluation(t,e){return this.noOp(e)}noOp(t){return{value:t,reason:Dm}}},Ts=new Lm,Am=Rm(Om()),Ps=class extends hm{constructor(){super(),this.eventEmitter=new Am.default}},Tm=class{constructor(t,e,r,n,a,s,i){this.providerAccessor=t,this.providerStatusAccessor=e,this.emitterAccessor=r,this.apiContextAccessor=n,this.apiHooksAccessor=a,this.globalLogger=s,this.options=i,this._hooks=[]}get metadata(){var t,e;return{name:(t=this.options.domain)!=null?t:this.options.name,domain:(e=this.options.domain)!=null?e:this.options.name,version:this.options.version,providerMetadata:this.providerAccessor().metadata}}get providerStatus(){return this.providerStatusAccessor()}addHandler(t,e,r){var n;if(this.emitterAccessor().addHandler(t,e),io(t,this.providerStatus))try{e({clientName:this.metadata.name,domain:this.metadata.domain,providerName:this._provider.metadata.name})}catch(s){(n=this._logger)==null||n.error("Error running event handler:",s)}r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this.emitterAccessor().removeHandler(t,e)}getHandlers(t){return this.emitterAccessor().getHandlers(t)}setLogger(t){return this._clientLogger=new Jn(t),this}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}getBooleanValue(t,e,r){return this.getBooleanDetails(t,e,r).value}getBooleanDetails(t,e,r){return this.evaluate(t,this._provider.resolveBooleanEvaluation,e,"boolean",r)}getStringValue(t,e,r){return this.getStringDetails(t,e,r).value}getStringDetails(t,e,r){return this.evaluate(t,this._provider.resolveStringEvaluation,e,"string",r)}getNumberValue(t,e,r){return this.getNumberDetails(t,e,r).value}getNumberDetails(t,e,r){return this.evaluate(t,this._provider.resolveNumberEvaluation,e,"number",r)}getObjectValue(t,e,r){return this.getObjectDetails(t,e,r).value}getObjectDetails(t,e,r){return this.evaluate(t,this._provider.resolveObjectEvaluation,e,"object",r)}track(t,e={}){var r,n,a;try{if(this.shortCircuitIfNotReady(),typeof this._provider.track=="function"){const s=Object.freeze(vn({},this.apiContextAccessor((r=this==null?void 0:this.options)==null?void 0:r.domain)));return(a=(n=this._provider).track)==null?void 0:a.call(n,t,s,e)}else this._logger.debug("Provider does not support the track function; will no-op.")}catch(s){this._logger.debug("Error recording tracking event.",s)}}evaluate(t,e,r,n,a={}){var s,i;const o=[...this.apiHooksAccessor(),...this.getHooks(),...a.hooks||[],...this._provider.hooks||[]],l=[...o].reverse(),c=vn({},this.apiContextAccessor((s=this==null?void 0:this.options)==null?void 0:s.domain)),u=l.map(()=>Object.freeze({flagKey:t,defaultValue:r,flagValueType:n,clientMetadata:this.metadata,providerMetadata:this._provider.metadata,context:c,logger:this._logger,hookData:new nm}));let d;try{this.beforeHooks(o,u,a),this.shortCircuitIfNotReady();const f=e.call(this._provider,t,r,c,this._logger),h=bm(vn({},f),{flagMetadata:Object.freeze((i=f.flagMetadata)!=null?i:{}),flagKey:t});if(h.errorCode){const v=dm(h.errorCode,h.errorMessage);this.errorHooks(l,u,v,a),d=this.getErrorEvaluationDetails(t,r,v,h.flagMetadata)}else this.afterHooks(l,u,h,a),d=h}catch(f){this.errorHooks(l,u,f,a),d=this.getErrorEvaluationDetails(t,r,f)}return this.finallyHooks(l,u,d,a),d}beforeHooks(t,e,r){var n;for(const[a,s]of t.entries()){const i=t.length-1-a,o=e[i];Object.freeze(o),Object.freeze(o.context),(n=s?.before)==null||n.call(s,o,Object.freeze(r.hookHints))}}afterHooks(t,e,r,n){var a;for(const[s,i]of t.entries()){const o=e[s];(a=i?.after)==null||a.call(i,o,r,n.hookHints)}}errorHooks(t,e,r,n){var a;for(const[s,i]of t.entries())try{const o=e[s];(a=i?.error)==null||a.call(i,o,r,n.hookHints)}catch(o){this._logger.error(`Unhandled error during 'error' hook: ${o}`),o instanceof Error&&this._logger.error(o.stack),this._logger.error(o?.stack)}}finallyHooks(t,e,r,n){var a;for(const[s,i]of t.entries())try{const o=e[s];(a=i?.finally)==null||a.call(i,o,r,n.hookHints)}catch(o){this._logger.error(`Unhandled error during 'finally' hook: ${o}`),o instanceof Error&&this._logger.error(o.stack),this._logger.error(o?.stack)}}get _provider(){return this.providerAccessor()}get _logger(){return this._clientLogger||this.globalLogger()}shortCircuitIfNotReady(){if(this.providerStatus===sr.NOT_READY)throw new ro("provider has not yet initialized");if(this.providerStatus===sr.FATAL)throw new eo("provider is in an irrecoverable error state")}getErrorEvaluationDetails(t,e,r,n={}){const a=r?.message;return{errorCode:r?.code||Zi.GENERAL,errorMessage:a,value:e,reason:am.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},ks=Symbol.for("@openfeature/web-sdk/api"),Is=globalThis,Pm=class jn extends gm{constructor(){super("client"),this._statusEnumType=sr,this._apiEmitter=new Ps,this._defaultProvider=new In(Ts,sr.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new Ps}static getInstance(){const e=Is[ks];if(e)return e;const r=new jn;return Is[ks]=r,r}getProviderStatus(e){var r,n;return e?(n=(r=this._domainScopedProviders.get(e))==null?void 0:r.status)!=null?n:this._defaultProvider.status:this._defaultProvider.status}setProviderAndWait(e,r,n){return Dt(this,null,function*(){const a=Tt(e),s=Te(a?r:e),i=Te(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i),yield this.setAwaitableProvider(a,s)})}setProvider(e,r,n){const a=Tt(e),s=Te(a?r:e),i=Te(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i);const o=this.setAwaitableProvider(a,s);return Promise.resolve(o).catch(l=>{this._logger.error("Error during provider initialization:",l)}),this}getProvider(e){return this.getProviderForClient(e)}setContext(e,r){return Dt(this,null,function*(){var n,a;const s=Tt(e),i=(a=(n=Te(e))!=null?n:Te(r))!=null?a:{};if(s){const o=this._domainScopedProviders.get(s);if(o){const l=this.getContext(s);this._domainScopedContext.set(s,i),yield this.runProviderContextChangeHandler(s,o,l,i)}else this._domainScopedContext.set(s,i)}else{const o=this._context;this._context=i;const l=Array.from(this._domainScopedProviders.entries()).filter(([u])=>!this._domainScopedContext.has(u)).reduce((u,[d,f])=>(u.push({domain:d,wrapper:f}),u),[]),c=[{domain:void 0,wrapper:this._defaultProvider},...l];yield Promise.all(c.map(u=>this.runProviderContextChangeHandler(u.domain,u.wrapper,o,i)))}})}getContext(e){const r=Tt(e);if(r){const n=this._domainScopedContext.get(r);if(n)return n;this._logger.debug(`Unable to find context for '${r}'.`)}return this._context}clearContext(e){return Dt(this,null,function*(){const r=Tt(e);if(r){const n=this._domainScopedProviders.get(r);if(n){const a=this.getContext(r);this._domainScopedContext.delete(r);const s=this.getContext();yield this.runProviderContextChangeHandler(r,n,a,s)}else this._domainScopedContext.delete(r)}else return this.setContext({})})}clearContexts(){return Dt(this,null,function*(){yield this.clearContext(),yield Promise.allSettled(Array.from(this._domainScopedProviders.keys()).map(e=>this.clearContext(e)))})}getClient(e,r){return new Tm(()=>this.getProviderForClient(e),()=>this.getProviderStatus(e),()=>this.buildAndCacheEventEmitterForClient(e),n=>this.getContext(n),()=>this.getHooks(),()=>this._logger,{domain:e,version:r})}clearProviders(){return Dt(this,null,function*(){yield wm(jn.prototype,this,"clearProvidersAndSetDefault").call(this,Ts),this._domainScopedContext.clear()})}runProviderContextChangeHandler(e,r,n,a){return Dt(this,null,function*(){var s,i,o,l,c,u;const d=((i=(s=r.provider)==null?void 0:s.metadata)==null?void 0:i.name)||"unnamed-provider";try{if(typeof r.provider.onContextChange=="function"){const f=r.provider.onContextChange(n,a);f&&typeof f?.then=="function"&&(r.incrementPendingContextChanges(),r.status=this._statusEnumType.RECONCILING,this.getAssociatedEventEmitters(e).forEach(h=>{h?.emit(ze.Reconciling,{domain:e,providerName:d})}),(o=this._apiEmitter)==null||o.emit(ze.Reconciling,{domain:e,providerName:d}),yield f,r.decrementPendingContextChanges())}r.status=this._statusEnumType.READY,r.allContextChangesSettled&&(this.getAssociatedEventEmitters(e).forEach(f=>{f?.emit(ze.ContextChanged,{clientName:e,domain:e,providerName:d})}),(l=this._apiEmitter)==null||l.emit(ze.ContextChanged,{clientName:e,domain:e,providerName:d}))}catch(f){if(r.decrementPendingContextChanges(),r.status=this._statusEnumType.ERROR,r.allContextChangesSettled){const h=f,v=`Error running ${d}'s context change handler: ${h?.message}`;(c=this._logger)==null||c.error(`${v}`,f),this.getAssociatedEventEmitters(e).forEach(E=>{E?.emit(ze.Error,{clientName:e,domain:e,providerName:d,message:v})}),(u=this._apiEmitter)==null||u.emit(ze.Error,{clientName:e,domain:e,providerName:d,message:v})}}})}},js=Pm.getInstance();class km{runsOn="client";metadata={name:"QueryParamProvider"};flags;constructor(e){this.flags=new Map;for(const[r,n]of e.entries())this.flags.set(r,n)}resolveBooleanEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n.toLowerCase()==="true"||n==="1",reason:"STATIC",variant:n}}resolveStringEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n,reason:"STATIC",variant:n}}resolveNumberEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};const a=Number(n);return isNaN(a)?{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse "${n}" as a number`}:{value:a,reason:"STATIC",variant:n}}resolveObjectEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};try{return{value:JSON.parse(n),reason:"STATIC",variant:n}}catch(a){return{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse JSON: ${a instanceof Error?a.message:String(a)}`}}}}async function Im(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new km(e);await js.setProviderAndWait(r);const n=new Map,a=js.getClient();n.set(Ms,a.getBooleanValue(Ms,jm)),n.set(Hs,a.getBooleanValue(Hs,Mm)),n.set(Fs,a.getBooleanValue(Fs,Hm));const i=e.has(yn)?a.getBooleanValue(yn,Fm):ge.content.inspectorEnabled;return n.set(yn,i),n}const Ms="FEATURE_LEGACY_READ_ENABLED",jm=!1,Hs="FEATURE_LEGACY_WRITE_ENABLED",Mm=!1,Fs="FEATURE_CHANNEL_SYNC_ENABLED",Hm=!0,yn="FEATURE_INSPECTOR_ENABLED",Fm=!1;let Mn;function Vm(t){Mn=t}async function Hg(){await Mn?.clear();const t=window.ph?.reactorClientModule?.pg;return t&&await cc(t),!!Mn}async function Bm(t){const e=await Yp(),r=[e,...t];return Fn([e,...t]),r}function Um(t){const e=new Map;for(const r of t){const n=r.documentModel.global.id,a=r.documentModel.global.specifications?.[0]?.version??1,s=e.get(n),i=s?.documentModel.global.specifications?.[0]?.version??1;(!s||a>i)&&e.set(n,r)}return Array.from(e.values())}async function $m(t,e,r){const n=r.find(a=>a.state.local.triggers.find(s=>s.type==="PullResponder"&&s.data?.url===t));if(n)return n;try{return await e.addRemoteDrive(t,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:t,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:_c(),system:!0}],triggers:[]})}catch(a){te.error("Error adding remote drive",a)}}async function zm(){if(window.ph||(window.ph={}),window.ph.legacyReactor||window.ph.loading)return;window.ph.loading=!0,Hl(),Fl(or);const t=await Im();te.info(`Features: ${JSON.stringify(Object.fromEntries(t),null,2)}`);const e=await Vl(),r=await e.did(),n=Bl(r,kt.routerBasename),a=Vh(kt.routerBasename);Vm(a);const s=await qp(),i=await Bm(s),o=i.flatMap(g=>g.modules.documentModelModules).filter(g=>g!==void 0),l=i.flatMap(g=>g.upgradeManifests).filter(g=>g!==void 0),c=Um(o),u=Ul(),d=Bh(c,a,{...u,featureFlags:{enableDualActionCreate:!0}}),f=await Uh(o,l,a,e);await $l(d,n,e);const h=new Ho(d.listeners,d);let v=await ua(d);const E=Km(),b=E?await $m(E,d,v):void 0;b&&(v=await ua(d));const C=window.location.pathname,N=b?.header.slug??zl(C),k=b?"":Wl(C),R=Wm();await Kl(R,d,n,e);const A=t.get("FEATURE_LEGACY_READ_ENABLED")??!0,M=A?new Zl(d):new Yl(f.client);Gl(kt),Jl(d),ql(f),Xl(f.client),Ql(f.reactorModule?.syncModule?.syncManager),ec(f.reactorModule?.database),tc(f.pg),rc(M),nc(e),ac(r),sc(n),ic(h),oc(v),Fn(i),Rr(N),_n(k),lc(t),A?(d.on("defaultRemoteDrive",(...g)=>{te.verbose("defaultRemoteDrive",...g),Rt(d).catch(te.error)}),d.on("clientStrandsError",(...g)=>{te.verbose("clientStrandsError",...g),Rt(d).catch(te.error)}),d.on("driveAdded",(...g)=>{te.verbose("driveAdded",...g),h.registerDrive(g[0].header.id).catch(te.error),Rt(d).catch(te.error)}),d.on("driveDeleted",(...g)=>{te.verbose("driveDeleted",...g),Rt(d).catch(te.error)}),d.on("documentModelModules",(...g)=>{te.verbose("documentModelModules",...g),Rt(d).catch(te.error)}),d.on("driveOperationsAdded",(...g)=>{te.verbose("driveOperationsAdded",...g),Rt(d).catch(te.error)})):(d.on("defaultRemoteDrive",(...S)=>{te.verbose("future:defaultRemoteDrive",...S),yt(f.client).catch(te.error)}),d.on("clientStrandsError",(...S)=>{te.verbose("future:clientStrandsError",...S),yt(f.client).catch(te.error)}),d.on("driveAdded",(...S)=>{te.verbose("future:driveAdded",...S),h.registerDrive(S[0].header.id).catch(te.error),yt(f.client).catch(te.error)}),d.on("driveDeleted",(...S)=>{te.verbose("future:driveDeleted",...S),yt(f.client).catch(te.error)}),d.on("documentModelModules",(...S)=>{te.verbose("future:documentModelModules",...S),yt(f.client).catch(te.error)}),d.on("driveOperationsAdded",(...S)=>{te.verbose("future:driveOperationsAdded",...S),yt(f.client).catch(te.error)}),f.client.subscribe({type:"powerhouse/document-drive"},S=>{te.verbose("ReactorClient subscription event",S),yt(f.client).catch(te.error)})),window.ph.loading=!1}function Wm(){const e=new URLSearchParams(window.location.search).get("user");return e?decodeURIComponent(e):void 0}function Km(){const e=new URLSearchParams(window.location.search).get("driveUrl");return e?decodeURIComponent(e):void 0}function Zm(){const t=Vn();m.useEffect(()=>{let e=null;if(t){const{credential:r,...n}=t;e={id:n.did,username:n.ens?.name,...n}}Nc(e)},[t])}function Ym(){return _.jsx("div",{className:"h-screen",children:_.jsx("div",{className:"flex h-screen items-stretch overflow-auto",role:"presentation",tabIndex:0,children:_.jsxs(m.Suspense,{name:"Root",children:[_.jsx(ug,{}),_.jsx("div",{className:"relative flex-1 overflow-auto",children:_.jsx(Zf,{})})]})})})}function Gm(){const[t]=Js(),e=Gs(),r=Ks();m.useEffect(()=>{r||dc(gd)},[r]),m.useEffect(()=>{t||uc(vd)},[t]);const n=!r&&!t&&!e;return _.jsx(Jm,{children:n?_.jsx(Xm,{}):_.jsx(Cp,{})})}function Jm({children:t}){return _.jsx("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:t})}function qm({drive:t}){const r=Zs(t.header.meta?.preferredEditor)?.name||"Drive Explorer App";return _.jsx(Xo,{title:t.state.global.name,description:r,icon:_.jsx(Wi,{drive:t}),onClick:()=>Rr(t)},t.header.id)}function Xm(){const t=qs(),e=ge;return _.jsxs(Us,{children:[t?.map(r=>_.jsx(qm,{drive:r},r.header.id)),e.drives.addDriveEnabled&&_.jsx(qo,{})]})}const Qm=t=>m.createElement("svg",{width:28,height:32,viewBox:"0 0 28 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},m.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",fill:"url(#paint0_radial_319_20865)"}),m.createElement("path",{d:"M14 0L0 23.9998V7.99993L14 0Z",fill:"url(#paint1_linear_319_20865)"}),m.createElement("path",{d:"M28 24L7.82013e-05 24L14 31.9999L28 24Z",fill:"url(#paint2_linear_319_20865)"}),m.createElement("path",{d:"M14 0L28 23.9998V7.99993L14 0Z",fill:"url(#paint3_linear_319_20865)"}),m.createElement("defs",null,m.createElement("radialGradient",{id:"paint0_radial_319_20865",cx:0,cy:0,r:1,gradientUnits:"userSpaceOnUse",gradientTransform:"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)"},m.createElement("stop",{offset:.181008,stopColor:"#FFCD6B"}),m.createElement("stop",{offset:1,stopColor:"#EB5EDF"})),m.createElement("linearGradient",{id:"paint1_linear_319_20865",x1:-.031454,y1:24.041,x2:13.801,y2:-.142908,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#4331E9"}),m.createElement("stop",{offset:1,stopColor:"#A273FF"})),m.createElement("linearGradient",{id:"paint2_linear_319_20865",x1:-.0310093,y1:24,x2:28.0444,y2:24,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#A273FF"}),m.createElement("stop",{offset:1,stopColor:"#4331E9"})),m.createElement("linearGradient",{id:"paint3_linear_319_20865",x1:28.0315,y1:24.041,x2:14.199,y2:-.142908,gradientUnits:"userSpaceOnUse"},m.createElement("stop",{stopColor:"#A273FF"}),m.createElement("stop",{offset:1,stopColor:"#4331E9"})))),eg=t=>m.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},m.createElement("path",{d:"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",fill:"#6C7275"}),m.createElement("path",{d:"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",fill:"#6C7275"})),tg="https://apps.powerhouse.io/sky-atlas/staging/switchboard",rg=2e3;function ng(){const{search:t}=Zr();return m.useMemo(()=>{const r=new URLSearchParams(t).get("reactorUrl")??tg;return r.endsWith("/")?r:`${r}/`},[t])}async function ag(t,e){const r=Ec`
15
15
  mutation ForkAtlas($docId: PHID) {
16
16
  ForkAtlas(docId: $docId)
17
17
  }
18
- `;return await Cc(`${e}graphql`,r,{docId:t})}function ag(){const t=m.useRef("initial"),e=fc(),{documentId:r}=Pf(),n=rg(),a=Df(),[s,i]=m.useState(void 0),[o,l]=m.useState(void 0),[c,d]=m.useState(!0),u=t.current==="error";m.useEffect(()=>{o&&(console.error("Error forking Atlas:",o),or("Error forking Atlas",{type:"error"}))},[o]);async function f(E){const C=(await ng(E,n)).ForkAtlas;t.current="forked",i(C)}const h=m.useCallback(()=>{s&&!c&&a(`/d/${s}`,{replace:!0})},[s,a,c]),g=m.useCallback(async E=>{console.log("Adding remote drive:",E);const b=`${n}d/${E}`;try{const C=await fa(b,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:b,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]});t.current="done",console.log("Added remote drive:",C),setTimeout(()=>{d(!1)},tg)}catch(C){t.current="error",d(!1),l(C)}},[fa,a,n]);return m.useEffect(()=>{!r||t.current!=="initial"||(t.current="forking",f(r).catch(E=>{t.current="error",l(E)}))},[r,t]),m.useEffect(()=>{!s||!e||t.current!=="forked"||(t.current="addingDrive",new Promise(E=>{setTimeout(E,500)}).then(()=>g(s)).catch(E=>{t.current="error",l(E)}))},[s,e,t]),_.jsx("div",{className:"flex size-full justify-center gap-x-4 bg-gray-50",children:_.jsxs("div",{className:"w-full max-w-[850px] rounded-2xl bg-white p-6 drop-shadow-sm",children:[_.jsx("h1",{className:"text-lg font-medium text-gray-900",children:"Welcome to the Atlas Explorer"}),_.jsx("div",{className:"mt-4 rounded-xl border border-gray-200 bg-gray-50 p-6",children:_.jsxs("div",{className:"flex min-h-80 flex-col items-center justify-center rounded-2xl bg-slate-50",children:[_.jsx("div",{children:_.jsx(Xm,{})}),u?_.jsx("div",{className:"mt-3 text-sm text-gray-800",children:"Error forking Atlas scope. Please try again."}):_.jsx("div",{className:"mt-3 text-sm text-gray-500",children:"Forking Atlas scope..."}),_.jsx(Xs,{onClick:u?window.location.reload.bind(window.location):h,size:"small",color:"light",className:"mt-4 h-9 border border-gray-200 bg-white px-3 text-gray-600",children:u?"Retry":c?_.jsxs(_.Fragment,{children:[_.jsx(Qm,{className:"animate-spin"}),"Loading"]}):"Continue"})]})})]})})}function sg(t){const e=ge.routerBasename;return Xf(t,{basename:e,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function ig(){const t=[{index:!0,path:"d?/:driveId?/*?",element:_.jsx(m.Suspense,{name:"Drive",children:_.jsx(Ym,{})})},{path:"import/:documentId",element:_.jsx(m.Suspense,{name:"AtlasImport",children:_.jsx(ag,{})})}];return[{element:_.jsx(m.Suspense,{name:"RouteRoot",children:_.jsx(Zm,{})}),children:t}]}const og=ig(),lg=sg(og),cg=()=>_.jsx(oh,{router:lg});function dg(){const t=Vn(),e=qs(),[r]=Js(),n=hc(),a=localStorage.getItem("CONNECT_DEBUG")==="true",s=()=>{et({type:"settings"})},i=()=>{et({type:"addDrive"})},o=()=>{et({type:"inspector"})},l=t?.address?`https://etherscan.io/address/${t.address}`:"";return _.jsx(Bs,{id:"sidebar",onClick:()=>Rr(void 0),onClickSettings:s,onInspectorClick:n?o:void 0,address:t?.address,onLogin:mc,onDisconnect:pc,etherscanUrl:l,showDebug:a,onDebugClick:()=>et({type:"debugSettings"}),children:_.jsxs(Yr,{variant:"text",fallbackMessage:"There was an error loading drives",loggerContext:["Connect","Sidebar"],children:[e?.map((c,d)=>_.jsx(Qo,{title:c.header.name,onClick:()=>Rr(c),active:r?.header.id===c.header.id,icon:_.jsx(Wi,{drive:c})},d)),ge.drives.addDriveEnabled&&_.jsx(el,{onClick:i})]})})}const ug=m.lazy(async()=>(await $m(),{default:({children:t})=>(bd(),Km(),Nu(),t)})),fg=()=>_.jsxs(m.StrictMode,{children:[_.jsx(m.Suspense,{fallback:_.jsx(Gh,{}),name:"AppLoader",children:_.jsx(ug,{children:_.jsx(Xh,{})})}),_.jsx(m.Suspense,{name:"CookieBanner",children:_.jsx(dp,{})}),_.jsx(Mp,{})]});Ao.createRoot(document.getElementById("root")).render(_.jsx(fg,{}));export{vu as T,kg as a,ge as b,Mg as c,Tg as d,jg as e,Pg as r,Kh as s,or as t,yi as u};
18
+ `;return await Cc(`${e}graphql`,r,{docId:t})}function sg(){const t=m.useRef("initial"),e=fc(),{documentId:r}=Pf(),n=ng(),a=Df(),[s,i]=m.useState(void 0),[o,l]=m.useState(void 0),[c,u]=m.useState(!0),d=t.current==="error";m.useEffect(()=>{o&&(console.error("Error forking Atlas:",o),or("Error forking Atlas",{type:"error"}))},[o]);async function f(E){const C=(await ag(E,n)).ForkAtlas;t.current="forked",i(C)}const h=m.useCallback(()=>{s&&!c&&a(`/d/${s}`,{replace:!0})},[s,a,c]),v=m.useCallback(async E=>{console.log("Adding remote drive:",E);const b=`${n}d/${E}`;try{const C=await fa(b,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:b,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]});t.current="done",console.log("Added remote drive:",C),setTimeout(()=>{u(!1)},rg)}catch(C){t.current="error",u(!1),l(C)}},[fa,a,n]);return m.useEffect(()=>{!r||t.current!=="initial"||(t.current="forking",f(r).catch(E=>{t.current="error",l(E)}))},[r,t]),m.useEffect(()=>{!s||!e||t.current!=="forked"||(t.current="addingDrive",new Promise(E=>{setTimeout(E,500)}).then(()=>v(s)).catch(E=>{t.current="error",l(E)}))},[s,e,t]),_.jsx("div",{className:"flex size-full justify-center gap-x-4 bg-gray-50",children:_.jsxs("div",{className:"w-full max-w-[850px] rounded-2xl bg-white p-6 drop-shadow-sm",children:[_.jsx("h1",{className:"text-lg font-medium text-gray-900",children:"Welcome to the Atlas Explorer"}),_.jsx("div",{className:"mt-4 rounded-xl border border-gray-200 bg-gray-50 p-6",children:_.jsxs("div",{className:"flex min-h-80 flex-col items-center justify-center rounded-2xl bg-slate-50",children:[_.jsx("div",{children:_.jsx(Qm,{})}),d?_.jsx("div",{className:"mt-3 text-sm text-gray-800",children:"Error forking Atlas scope. Please try again."}):_.jsx("div",{className:"mt-3 text-sm text-gray-500",children:"Forking Atlas scope..."}),_.jsx(Xs,{onClick:d?window.location.reload.bind(window.location):h,size:"small",color:"light",className:"mt-4 h-9 border border-gray-200 bg-white px-3 text-gray-600",children:d?"Retry":c?_.jsxs(_.Fragment,{children:[_.jsx(eg,{className:"animate-spin"}),"Loading"]}):"Continue"})]})})]})})}function ig(t){const e=ge.routerBasename;return Xf(t,{basename:e,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function og(){const t=[{index:!0,path:"d?/:driveId?/*?",element:_.jsx(m.Suspense,{name:"Drive",children:_.jsx(Gm,{})})},{path:"import/:documentId",element:_.jsx(m.Suspense,{name:"AtlasImport",children:_.jsx(sg,{})})}];return[{element:_.jsx(m.Suspense,{name:"RouteRoot",children:_.jsx(Ym,{})}),children:t}]}const lg=og(),cg=ig(lg),dg=()=>_.jsx(oh,{router:cg});function ug(){const t=Vn(),e=qs(),[r]=Js(),n=hc(),a=localStorage.getItem("CONNECT_DEBUG")==="true",s=()=>{et({type:"settings"})},i=()=>{et({type:"addDrive"})},o=()=>{et({type:"inspector"})},l=t?.address?`https://etherscan.io/address/${t.address}`:"";return _.jsx(Bs,{id:"sidebar",onClick:()=>Rr(void 0),onClickSettings:s,onInspectorClick:n?o:void 0,address:t?.address,onLogin:mc,onDisconnect:pc,etherscanUrl:l,showDebug:a,onDebugClick:()=>et({type:"debugSettings"}),children:_.jsxs(Yr,{variant:"text",fallbackMessage:"There was an error loading drives",loggerContext:["Connect","Sidebar"],children:[e?.map((c,u)=>_.jsx(Qo,{title:c.header.name,onClick:()=>Rr(c),active:r?.header.id===c.header.id,icon:_.jsx(Wi,{drive:c})},u)),ge.drives.addDriveEnabled&&_.jsx(el,{onClick:i})]})})}const fg=m.lazy(async()=>(await zm(),{default:({children:t})=>(bd(),Zm(),Nu(),t)})),hg=()=>_.jsxs(m.StrictMode,{children:[_.jsx(m.Suspense,{fallback:_.jsx(Gh,{}),name:"AppLoader",children:_.jsx(fg,{children:_.jsx(Xh,{})})}),_.jsx(m.Suspense,{name:"CookieBanner",children:_.jsx(dp,{})}),_.jsx(Mp,{})]});Ao.createRoot(document.getElementById("root")).render(_.jsx(hg,{}));export{vu as T,Ig as a,ge as b,Hg as c,Pg as d,Mg as e,kg as r,Kh as s,or as t,yi as u};