@powerhousedao/connect 6.0.0-dev.14 → 6.0.0-dev.15

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 (44) hide show
  1. package/dist/assets/{AddDriveModal-CdO7bn3v.js → AddDriveModal-qEnuBO_x.js} +1 -1
  2. package/dist/assets/ClearStorageModal-C-jQAs02.js +1 -0
  3. package/dist/assets/CookiesPolicyModal-C2paP1mB.js +1 -0
  4. package/dist/assets/CreateDocumentModal-RAQMk5HC.js +1 -0
  5. package/dist/assets/{DebugSettingsModal-DDhbtnTJ.js → DebugSettingsModal-CT0Y_y3S.js} +1 -1
  6. package/dist/assets/{DeleteDriveModal-CCys4Xug.js → DeleteDriveModal-CwrQtSlk.js} +1 -1
  7. package/dist/assets/DeleteItemModal-CsX6EyD3.js +1 -0
  8. package/dist/assets/{DisclaimerModal-B6mOULsM.js → DisclaimerModal-D-UKOYjV.js} +1 -1
  9. package/dist/assets/DriveSettingsModal-CVwoXZ33.js +1 -0
  10. package/dist/assets/{ExportDocumentWithErrorsModal-Dw8uNeOX.js → ExportDocumentWithErrorsModal-BMnWEsAG.js} +1 -1
  11. package/dist/assets/{SettingsModal-xfAWiRI0.js → SettingsModal-CVtu0vMc.js} +1 -1
  12. package/dist/assets/{UpgradeDriveModal-DV6zwMol.js → UpgradeDriveModal-k1kHvjgE.js} +1 -1
  13. package/dist/assets/{design_system-IWZk5eiE.js → design_system-OamFlF5e.js} +2 -2
  14. package/dist/assets/{design_system_connect-BwXoX_zu.js → design_system_connect-DiR-4e0Y.js} +33 -33
  15. package/dist/assets/{design_system_ui-DSdkJYwh.js → design_system_ui-C91aaCcj.js} +1 -1
  16. package/dist/assets/{document_engineering-BXIkRAQ4.js → document_engineering-Cvoj_Gxy.js} +1 -1
  17. package/dist/assets/{document_model_editor-bjkSCbVR.js → document_model_editor-QUld_aUx.js} +5 -5
  18. package/dist/assets/{drive_explorer-CHwbHSwK.js → drive_explorer-BFislAzR.js} +2 -2
  19. package/dist/assets/{graphql-editor-BUXhhUBs.js → graphql-editor-BQ6BXaXq.js} +1 -1
  20. package/dist/assets/{hooks-CBZDlj3_.js → hooks-DhpARCZV.js} +1 -1
  21. package/dist/assets/{index-DxBII4B2.js → index-CAv1ewUf.js} +3 -3
  22. package/dist/assets/index-KvbX0WxU.js +18 -0
  23. package/dist/assets/{json-editor-COS1W6K2.js → json-editor-Bgr9t_-i.js} +1 -1
  24. package/dist/assets/{nodefs-AJuGHwpT.js → nodefs-DDYpZiCJ.js} +1 -1
  25. package/dist/assets/{opfs-ahp-C00YgeRt.js → opfs-ahp-B7Az90a5.js} +1 -1
  26. package/dist/assets/{reactor_browser-xHwaGmj0.js → reactor_browser-i5whXQtt.js} +12 -12
  27. package/dist/assets/{state-schemas-BlHVnfyI.js → state-schemas-C4i97w88.js} +2 -2
  28. package/dist/index.html +7 -7
  29. package/lib/package.copy.json +1 -1
  30. package/lib/src/components/document-editor-container.d.ts.map +1 -1
  31. package/lib/src/components/document-editor-container.js +1 -1
  32. package/lib/src/components/document-editor-container.js.map +1 -1
  33. package/lib/src/components/sidebar.d.ts.map +1 -1
  34. package/lib/src/components/sidebar.js +2 -2
  35. package/lib/src/components/sidebar.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/package.copy.json +1 -1
  38. package/package.json +10 -10
  39. package/dist/assets/ClearStorageModal-FTxWJX1x.js +0 -1
  40. package/dist/assets/CookiesPolicyModal-N2NEJZC5.js +0 -1
  41. package/dist/assets/CreateDocumentModal-CUBTy1Vr.js +0 -1
  42. package/dist/assets/DeleteItemModal-C7-lZCXg.js +0 -1
  43. package/dist/assets/DriveSettingsModal-DiPVKK3j.js +0 -1
  44. package/dist/assets/index-CyQb1t7o.js +0 -18
@@ -1,18 +0,0 @@
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-CdO7bn3v.js","assets/document_model_editor-bjkSCbVR.js","assets/graphql-AKTCpY7l.js","assets/drive_explorer-CHwbHSwK.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-_oCbt5YE.js","assets/zod-9j67vCAu.js","assets/design_system-IWZk5eiE.js","assets/tailwind_merge-Dr4f9Rms.js","assets/react-dom-D6zQJsh6.js","assets/reactor_browser-xHwaGmj0.js","assets/document_drive-Bubv8iix.js","assets/config-CU-aFfVJ.js","assets/design_system_connect-BwXoX_zu.js","assets/design_system_ui-DSdkJYwh.js","assets/react-dom/client-BVPiT_FE.js","assets/graphql_request-BJtmW2JS.js","assets/ClearStorageModal-FTxWJX1x.js","assets/CookiesPolicyModal-N2NEJZC5.js","assets/CreateDocumentModal-CUBTy1Vr.js","assets/DebugSettingsModal-DDhbtnTJ.js","assets/DeleteDriveModal-CCys4Xug.js","assets/DeleteItemModal-C7-lZCXg.js","assets/DisclaimerModal-B6mOULsM.js","assets/DriveSettingsModal-DiPVKK3j.js","assets/ExportDocumentWithErrorsModal-Dw8uNeOX.js","assets/SettingsModal-xfAWiRI0.js","assets/UpgradeDriveModal-DV6zwMol.js","assets/index-DxBII4B2.js"])))=>i.map(i=>d[i]);
2
- import{j as _,g as Do,E as Lo}from"./document_model_editor-bjkSCbVR.js";import{r as Ao}from"./react-dom/client-BVPiT_FE.js";import{r as m,R as To,a as Fs}from"./sentry_react-cODD7zWc.js";import{t as Vs,l as Q,v as Hn,B as Po,R as ko,I as Io,E as jo,w as vr,x as Mo}from"./document_drive-Bubv8iix.js";import{_ as Se,G as Ho}from"./drive_explorer-CHwbHSwK.js";import{t as Fo,c as Bs,H as $s,A as Vo,W as Bo,d as $o,e as Uo,f as zo,g as Wo,h as Ko,i as da,F as Zo,j as Us,k as Yo,B as Go,l as Jo,m as qo,S as Xo,n as Qo}from"./design_system_connect-BwXoX_zu.js";import{y as zs,z as Fn,A as el,U as tl,C as rl,R as nl,B as al,D as sl,E as il,F as ol,G as ll,K as cl,P as dl,H as ul,x as et,I as Ws,J as fl,k as hl,L as pl,M as ml,N as gl,O as Vn,Q as vl,T as yl,V as _l,g as _n,W as Ks,X as Zs,Y as El,Z as Cl,_ as xl,$ as bl,i as Sl,a0 as Nl,a1 as Rl,a2 as wl,a3 as Ol,a4 as Dl,a5 as Ll,c as Al,a6 as Tl,a7 as Pl,a8 as Ys,a9 as kl,aa as Gs,ab as Il,ac as jl,ad as Ml,ae as Hl,af as Fl,ag as Vl,ah as Bl,ai as $l,aj as Ul,ak as ua,al as zl,am as Wl,an as Kl,ao as Zl,ap as Yl,aq as Gl,ar as Jl,as as ql,at as Xl,au as Ql,av as ec,aw as tc,ax as rc,ay as nc,az as ac,aA as sc,aB as ic,aC as oc,s as Rr,aD as lc,aE as Rt,aF as yt,aG as cc,d as Js,aH as dc,aI as uc,aJ as qs,aK as fc,aL as fa,aM as hc,aN as pc,aO as mc}from"./reactor_browser-xHwaGmj0.js";import{I as ha,l as Xs,T as gc,c as ir}from"./design_system-IWZk5eiE.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"./config-CU-aFfVJ.js";import"./design_system_ui-DSdkJYwh.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 Rc=Ao(),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 wc=En;function Oc(){return wc}const Dc=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=Oc(),n=Dc({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 Xc({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 Lc=/^c[^\s-]{8,}$/i,Ac=/^[0-9a-z]+$/,Tc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Pc=/^[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,kc=/^[a-z0-9_-]{21}$/i,Ic=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jc=/^[-+]?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)?)??$/,Mc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qr;const 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])$/,Vc=/^(?:(?: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])$/,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]))$/,$c=/^(([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}=))?$/,zc=/^([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])))",Wc=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 Kc(t){return new RegExp(`^${ri(t)}$`)}function Zc(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 Yc(t,e){return!!((e==="v4"||!e)&&Fc.test(t)||(e==="v6"||!e)&&Bc.test(t))}function Gc(t,e){if(!Ic.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 Jc(t,e){return!!((e==="v4"||!e)&&Vc.test(t)||(e==="v6"||!e)&&$c.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")Mc.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(Hc,"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")Pc.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")kc.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")Lc.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")Ac.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")Tc.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"?Zc(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"?Wc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{code:O.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Kc(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"?jc.test(e.data)||(a=this._getOrReturnCtx(e,a),T(a,{validation:"duration",code:O.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Yc(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"?Gc(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"?Jc(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"?zc.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 qc(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"?qc(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 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&&(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 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 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},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 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,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!==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 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 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 Xc 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,Qc=jt.create,ed=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([ed(),si(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),Tr=ai([Qc(),me()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),td=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()}),rd=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)}),nd=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)}),ad=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)}),sd=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)}),id=Ke({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ce.default(!0)}),od=Ke({PH_CONNECT_PROCESSORS_ENABLED:ce.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ce.default(!0)}),ld=od.merge(sd).merge(id),cd=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)}),dd=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=rd.merge(nd).merge(ad).merge(ld).merge(cd).merge(dd);td.merge(Cr);function ud(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 fd(t={}){const e=new Set(Object.keys(Cr.shape)),r=ud(t,e,Cr);return Cr.parse(r)}function hd(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const pd={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.13",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},D=fd({processEnv:pd});function md(t){return t.endsWith("/")?t:t+"/"}function gd(){const t=D.PH_CONNECT_BASE_PATH||"/",e=md(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=gd(),vd={isExternalControlsEnabled:kt.isExternalControlsEnabled},yd={allowedDocumentTypes:kt.allowedDocumentTypes,isDragAndDropEnabled:kt.isDragAndDropEnabled};Vs(D.PH_CONNECT_LOG_LEVEL);Q.debug(`Setting log level to ${D.PH_CONNECT_LOG_LEVEL}.`);const ii=hd(D.PH_CONNECT_BASE_PATH||"/"),_d=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:_d,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},Ed=ge.routerBasename,oi=`${Ed}:acceptedCookies`,Rn=new Set;let xr=Cd();function Cd(){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 xd(t){xr=t(xr),localStorage.setItem(oi,JSON.stringify(xr)),Rn.forEach(e=>e())}function bd(t){return Rn.add(t),()=>Rn.delete(t)}const $n=()=>[m.useSyncExternalStore(bd,Da,Da),xd];async function Un(){try{return(await Se(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Mg(t){const e=await Un();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 Hg(t){const e=await Un();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 Sd(){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 Un();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(Q.error),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Nd="connect";function or(t,e){const{type:r="default",containerId:n=Nd,...a}=e||{};return Fo(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,Rd=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},wd=/###/g,Aa=t=>t&&t.indexOf("###")>-1?t.replace(wd,"."):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},Od=(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]},Dd=(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 Ld={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Ad=t=>K(t)?t.replace(/[&<>"'\/]/g,e=>Ld[e]):t;class Td{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 Pd=[" ",",","?","!",";"],kd=new Td(20),Id=(t,e,r)=>{e=e||"",r=r||"";const n=Pd.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const a=kd.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("_","-"),jd={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||jd,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 Md(){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(Md());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(),Rd(["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&&!Id(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 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(u,a.count,a):"",g=a.ordinal&&R?this.pluralResolver.getSuffix(u,a.count,{ordinal:!1}):"",S=R&&!a.ordinal&&a.count===0,$=S&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${M}`]||a[`defaultValue${g}`]||a.defaultValue;let V=v;k&&!v&&A&&(V=$);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 te=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=te,h.usedParams=this.getUsedParamsDetails(a),h):te}if(i){const te=Array.isArray(V),ne=te?[]:{},Re=te?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($)?$[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 te=!1,ne=!1;!this.isValidLookup(v)&&A&&(te=!0,v=$),this.isValidLookup(v)||(ne=!0,v=o);const Ce=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&ne?void 0:v,oe=A&&$!==v&&this.options.updateMissing;if(ne||te||oe){if(this.logger.log(oe?"updateKey":"missingKey",u,c,o,oe?$: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}`]||$)})}):Ze(ue,o,$))}v=this.extendTranslation(v,e,a,h,n),ne&&v===o&&this.options.appendNamespaceToMissingKey&&(v=`${c}${d}${o}`),(ne||te)&&this.options.parseMissingKeyHandler&&(v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${d}${o}`:o,te?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 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,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);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 N=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(N,d,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(d+R.replace(M,this.options.pluralSeparator)),N.push(d+R),h&&N.push(d+A)),v){const g=`${d}${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 Hd{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=Dd(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 Fd{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:v,nestingSuffixEscaped:E,nestingOptionsSeparator:b,maxReplaces:C,alwaysFormat:N}=e.interpolation;this.escape=r!==void 0?r:Ad,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=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 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 v=s[1].trim();if(i=c(v),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,v))i="";else if(u){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),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),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}${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 Vd=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)}},Bd=t=>(e,r,n)=>t(tr(r),n)(e);class $d{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:Bd;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}=Vd(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 zd 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=>{Od(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}),$a=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=()=>{},Wd=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=$a(e),this.services={},this.logger=Fe,this.modules={external:[]},Wd(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,...$a(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=$d;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 Hd(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 Fd(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new zd(a(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(h,...v)=>{this.emit(h,...v)}),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,...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]=(...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 Fg=Ne.t;Ne.exists;Ne.setDefaultNamespace;Ne.hasLoadedNamespace;Ne.loadNamespaces;Ne.loadLanguages;var rn,Ua;function Kd(){return Ua||(Ua=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 Zd=Kd();const Yd=xc(Zd);var Gd=/\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],(Yd[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(Gd),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 Jd=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,qd=/^\s*$/,Xd=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 Qd={parse:function(t,e){e||(e={}),e.components||(e.components=Xd);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(Jd,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,v=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||!v||v==="<"||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&&v!=="<"&&v)){d=s===-1?n:a[s].children;var b=t.indexOf("<",h),C=t.slice(h,b===-1?void 0:b);qd.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={},$r=(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))},eu=(t,e,r={})=>!e.languages||!e.languages.length?($r(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,tu=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ru={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},nu=t=>ru[t],au=t=>t.replace(tu,nu);let Dn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:au};const su=(t={})=>{Dn={...Dn,...t}},hi=()=>Dn;let pi;const iu=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},ou=t=>Array.isArray(t)&&t.every(m.isValidElement),Pt=t=>Array.isArray(t)?t:[t],lu=(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 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,...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},cu=(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},du=(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??{},d=N=>{Pt(N).forEach(R=>{ke(R)||(nn(R)?d(an(R)):rt(R)&&!m.isValidElement(R)&&Object.assign(c,R))})};d(t);const u=cu(r,o,c),f=Qd.parse(`<0>${u}</0>`),h={...c,...s},v=(N,k,R)=>{const A=an(N),M=b(A,k.children,R);return ou(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,$)=>{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?lu({props:S.attrs},G):G,te=m.isValidElement(z),ne=te&&nn(S,!0)&&!S.voidElement,Re=l&&rt(z)&&z.dummy&&!te,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,$)}else if(Re){const oe=b(A,S.children,R);E(z,oe,g,$)}else if(Number.isNaN(parseFloat(S.name)))if(Ce){const oe=v(z,S,R);E(z,oe,g,$,S.voidElement)}else if(a.transSupportBasicHtmlNodes&&o.indexOf(S.name)>-1)if(S.voidElement)g.push(m.createElement(S.name,{key:`${S.name}-${$}`}));else{const oe=b(A,S.children,R);g.push(m.createElement(S.name,{key:`${S.name}-${$}`},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)&&!te){const oe=S.children[0]?V:null;oe&&g.push(oe)}else E(z,V,g,$,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}-${$}`},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})},uu=(t,e)=>t.map((r,n)=>gi(r,n,e)),fu=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:gi(t[n],n,e)})}),r},hu=(t,e,r,n)=>t?Array.isArray(t)?uu(t,e):rt(t)?fu(t,e):($r(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,pu=t=>!rt(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function mu({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 v=d||zn();if(!v)return $r(v,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const E=u||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 $=hu(l,S,v,n);let V=$||t,G=null;pu($)&&(G=$,V=t);const z=du(V,G,S,v,b,g,f),te=r??b.defaultTransParent;return te?m.createElement(te,h,z):z}const gu={type:"3rdParty",init(t){su(t.options.react),iu(t)}},vi=m.createContext();class vu{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function yu({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:v,defaultNS:E}=m.useContext(vi)||{},b=d||v||zn(),C=u||b?.t.bind(b);return mu({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 _u(){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(),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})},[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 Eu(){return Ya||(Ya=1,sn.exports=_u()),sn.exports}var Cu=Eu();const xu=(t,e)=>ke(e)?e:rt(e)&&ke(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,bu={t:xu,ready:!1},Su=()=>()=>{},yi=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:a}=m.useContext(vi)||{},s=r||n||zn();s&&!s.reportNamespaces&&(s.reportNamespaces=new vu),s||$r(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 d=m.useRef(0),u=m.useCallback(R=>{if(!s)return Su;const{bindI18n:A,bindI18nStore:M}=i,g=()=>{d.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 bu;const R=!!(s.isInitialized||s.initializedStoreOnce)&&c.every(V=>eu(V,s,i)),A=e.lng||s.language,M=d.current,g=f.current;if(g&&g.ready===R&&g.lng===A&&g.keyPrefix===l&&g.revision===M)return g;const $={t:s.getFixedT(A,i.nsMode==="fallback"?c:c[0],l),ready:R,lng:A,keyPrefix:l,revision:M};return f.current=$,$},[s,c,l,i,e.lng]),[v,E]=m.useState(0),{t:b,ready:C}=Cu.useSyncExternalStore(u,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},Nu=()=>{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")," 🔄"]})]})},Ru=()=>{async function t(){const e=await Th();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;ge.studioMode||!ge.warnOutdatedApp?Q.warn(`Connect is outdated:
3
- Current: ${e.currentVersion}
4
- Latest: ${e.latestVersion}`):or(m.createElement(Nu),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}m.useEffect(()=>{t().catch(console.error)},[])},wu=ge.routerBasename,_i=`${wu}:display-cookie-banner`,Ga=new Set;let Ei=Ou();function Ou(){try{return localStorage.getItem(_i)!=="false"}catch(t){return console.error(t),!0}}function Ja(){return Ei}function Du(t){Ei=t,localStorage.setItem(_i,JSON.stringify(t))}function Lu(t){return Ga.add(t),()=>Ga.delete(t)}const Au=()=>[m.useSyncExternalStore(Lu,Ja,Ja),Du];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 Tu(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 ku(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 Pu(){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||Pu()})}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 ku(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 N=nr(E.location,b,C);c=d()+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=d();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,u),l=b,()=>{a.removeEventListener(qa,u),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 Iu=new Set(["lazy","caseSensitive","path","id","index","children"]);function ju(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`),ju(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);Hu(i);let o=null;for(let l=0;o==null&&l<i.length;++l){let c=Gu(s);o=Zu(i[l],c,n)}return o}function Mu(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:Wu(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 Hu(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Ku(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Fu=/^:[\w-]+$/,Vu=3,Bu=2,$u=1,Uu=10,zu=-2,Qa=t=>t==="*";function Wu(t,e){let r=t.split("/"),n=r.length;return r.some(Qa)&&(n+=zu),e&&(n+=Bu),r.filter(a=>!Qa(a)).reduce((a,s)=>a+(Fu.test(s)?Vu:s===""?$u:Uu),n)}function Ku(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 Zu(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:Xu(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]=Yu(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 v=o[u];return h&&!v?c[f]=void 0:c[f]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:t}}function Yu(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 Gu(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 Ju(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:qu(r,e):e,search:Qu(n),hash:ef(a)}}function qu(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=Ju(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,"/"),Xu=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Qu=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ef=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"],tf=new Set(Ri),rf=["get",...Ri],nf=new Set(rf),af=new Set([301,302,303,307,308]),sf=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},of={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,lf=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),wi="remix-router-transitions";function cf(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=lf;let s={},i=Mr(t.routes,a,void 0,s),o,l=t.basename||"/",c=t.dataStrategy||hf,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,v=null,E=null,b=null,C=t.hydrationData!=null,N=Qe(i,t.history.location,l),k=!1,R=null;if(N==null&&!d){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(u.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=[],u.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,$=!1,V,G=!1,z=new Map,te=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 U=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}),U.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){wf(e,z);let p=()=>Of(e,z);e.addEventListener("pagehide",p),te=()=>e.removeEventListener("pagehide",p)}return g.initialized||mt(_e.Pop,g.location,{initialHydration:!0}),M}function ho(){f&&f(),te&&te(),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=[];u.v7_fetcherPersist&&g.fetchers.forEach((L,U)=>{L.state==="idle"&&(je.has(U)?w.push(U):x.push(U))}),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})),u.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:U}=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((ee,be)=>P.set(be,Kt)));let B=$===!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 ee=z.get(g.location.pathname);ee&&ee.has(p.pathname)?J={currentLocation:g.location,nextLocation:p}:z.has(p.pathname)&&(J={currentLocation:p,nextLocation:g.location})}else if(G){let ee=z.get(g.location.pathname);ee?ee.add(p.pathname):(ee=new Set([p.pathname]),z.set(g.location.pathname,ee)),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:U===!0}),S=_e.Pop,$=!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,u.v7_prependBasename,p,u.v7_relativeSplatPath,y?.fromRouteId,y?.relative),{path:w,submission:L,error:U}=ts(u.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,ee=ia({currentLocation:W,nextLocation:I,historyAction:P});if(ee){fr(ee,{state:"blocked",location:I,proceed(){fr(ee,{state:"proceeding",proceed:void 0,reset:void 0,location:I}),Xn(p,y)},reset(){let be=new Map(g.blockers);be.set(ee,Kt),we({blockers:be})}});return}return await mt(P,I,{submission:L,pendingError:U,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),$=(x&&x.preventScrollReset)===!0,G=(x&&x.enableViewTransition)===!0;let w=o||i,L=x&&x.overrideNavigation,U=x!=null&&x.initialHydration&&g.matches&&g.matches.length>0&&!k?g.matches:Qe(w,y,l),W=(x&&x.flushSync)===!0;if(U&&g.initialized&&!Re&&_f(g.location,y)&&!(x&&x.submission&&Me(x.submission.formMethod))){xt(y,{matches:U},{flushSync:W});return}let I=hr(U,w,y.pathname);if(I.active&&I.matches&&(U=I.matches),!U){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(U).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,U,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}}U=de.matches||U,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:ee,errors:be}=await vo(H,y,U,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||U},ds(P),{loaderData:ee,errors:be})))}async function go(p,y,x,w,L,U){U===void 0&&(U={}),Gr();let W=Nf(y,x);if(we({navigation:W},{flushSync:U.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:ee}=Jr(y.pathname);return{matches:B,pendingActionResult:[ee.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 U&&U.replace!=null?P=U.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(U&&U.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,U,W,I,H,P,B){let J=L||dn(y,U),ee=U||W||hs(J),be=!ne&&(!u.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,ee,y,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(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:$t,fetcherResults:Ue}=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($t);if(He)return await gt(p,He.result,!0,{replace:I}),{shortCircuited:!0};if(He=Er(Ue),He)return xe.add(He.key),await gt(p,He.result,!0,{replace:I}),{shortCircuited:!0};let{loaderData:Xr,errors:Ut}=ls(g,x,$t,B,he,Ue,ht);ht.forEach((ae,pe)=>{ae.subscribe(St=>{(St||ae.done)&&ht.delete(pe)})}),u.v7_partialHydration&&H&&g.errors&&(Ut=fe({},g.errors,Ut));let vt=na(),mr=aa(Ze),gr=vt||mr||he.length>0;return fe({matches:x,loaderData:Xr,errors:Ut},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,U=o||i,W=Ln(g.location,g.matches,l,u.v7_prependBasename,x,u.v7_relativeSplatPath,y,w?.relative),I=Qe(U,W,l),H=hr(I,U,W);if(H.active&&H.matches&&(I=H.matches),!I){$e(p,y,Oe(404,{pathname:W}),{flushSync:L});return}let{path:P,submission:B,error:J}=ts(u.v7_normalizeFormMethod,!0,W,w);if(J){$e(p,y,J,{flushSync:L});return}let ee=qt(I,P),be=(w&&w.preventScrollReset)===!0;if(B&&Me(B.formMethod)){Eo(p,y,P,ee,I,H.active,L,be,B);return}Ae.set(p,{routeId:y,path:P}),Co(p,y,P,ee,I,H.active,L,be,B)}async function Eo(p,y,x,w,L,U,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 $e(p,y,Nt,{flushSync:W}),!0}return!1}if(!U&&P(w))return;let B=g.fetchers.get(p);Ge(p,Rf(H,B),{flushSync:W});let J=new AbortController,ee=Ot(t.history,x,J.signal,H);if(U){let ye=await pr(L,new URL(ee.url).pathname,ee.signal,p);if(ye.type==="aborted")return;if(ye.type==="error"){$e(p,y,ye.error,{flushSync:W});return}else if(ye.matches){if(L=ye.matches,w=qt(L,x),P(w))return}else{$e(p,y,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,J);let be=Be,ie=(await Bt("action",g,ee,[w],L,p))[w.route.id];if(ee.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(ee,ie,!1,{fetcherSubmission:H,preventScrollReset:I});if(De(ie)){$e(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),$t=o||i,Ue=g.navigation.state!=="idle"?Qe($t,g.navigation.location,l):g.matches;q(Ue,"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[Ut,vt]=ns(t.history,g,Ue,H,he,!1,u.v7_skipActionErrorRevalidation,Re,Ce,oe,je,Ae,xe,$t,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,Ue,Ut,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,Ue,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:Ue,loaderData:St,errors:zt,fetchers:new Map(g.fetchers)})):(we({errors:zt,loaderData:cs(g.loaderData,St,Ue,zt),fetchers:new Map(g.fetchers)}),Re=!1)}async function Co(p,y,x,w,L,U,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(U){let ie=await pr(L,new URL(J.url).pathname,J.signal,p);if(ie.type==="aborted")return;if(ie.type==="error"){$e(p,y,ie.error,{flushSync:W});return}else if(ie.matches)L=ie.matches,w=qt(L,x);else{$e(p,y,Oe(404,{pathname:x}),{flushSync:W});return}}ue.set(p,B);let ee=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>ee){Ge(p,qe(void 0));return}else{xe.add(p),await gt(J,de,!1,{preventScrollReset:I});return}if(De(de)){$e(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:U,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:ee,formEncType:be}=g.navigation;!L&&!U&&J&&ee&&be&&(L=hs(g.navigation));let de=L||U;if(sf.has(y.response.status)&&de&&Me(de.formMethod))await mt(B,P,{submission:fe({},de,{formAction:H}),preventScrollReset:W||$,enableViewTransition:x?G:void 0});else{let ie=dn(P,L);await mt(B,P,{overrideNavigation:ie,fetcherSubmission:U,preventScrollReset:W||$,enableViewTransition:x?G:void 0})}}async function Bt(p,y,x,w,L,U){let W,I={};try{W=await pf(c,p,y,x,w,L,U,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(Ef(P)){let B=P.result;I[H]={type:le.redirect,response:vf(B,x,H,L,l,u.v7_relativeSplatPath)}}else I[H]=await gf(P);return I}async function ea(p,y,x,w,L){let U=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 ee=(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]:ee}}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([bf(y,H,L.signal,U,p.loaderData),Sf(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 $e(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)||of}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),u.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),u.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()),[U,W]=L[L.length-1],I=g.blockers.get(U);if(!(I&&I.state==="proceeding")&&W({currentLocation:y,nextLocation:x,historyAction:w}))return U}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=>Mu(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(d)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(!d)return{type:"success",matches:p};let L=p;for(;;){let U=o==null,W=o||i,I=s;try{await d({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{U&&!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 u},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 df(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 v=f.toString();d.search=v?"?"+v:""}}return n&&r!=="/"&&(d.pathname=d.pathname==="/"?r:ot([r,d.pathname])),lr(d)}function ts(t,e,r,n){if(!n||!df(n))return{path:r};if(n.formMethod&&!xf(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 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,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,$)=>{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(uf(e.loaderData,e.matches[$],S)||l.some(te=>te===S.route.id))return!0;let G=e.matches[$],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 u.forEach((S,$)=>{if(s||!r.some(ne=>ne.route.id===S.routeId)||d.has($))return;let V=Qe(h,S.path,v);if(!V){g.push({key:$,routeId:S.routeId,path:S.path,matches:null,match:null,controller:null});return}let G=e.fetchers.get($),z=qt(V,S.path),te=!1;f.has($)?te=!1:c.has($)?(c.delete($),te=!0):G&&G.state!=="idle"&&G.data===void 0?te=o:te=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})),te&&g.push({key:$,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 uf(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 ff(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&&!Iu.has(i)&&(s[i]=n[i])}Object.assign(a,s),Object.assign(a,fe({},e(a),{lazy:void 0}))}async function hf(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 pf(t,e,r,n,a,s,i,o,l,c){let d=s.map(h=>h.route.lazy?ff(h.route,l,o):void 0),u=s.map((h,v)=>{let E=d[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?mf(e,n,h,E,N,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 mf(t,e,r,n,a,s){let i,o,l=c=>{let d,u=new Promise((v,E)=>d=E);o=()=>d(),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,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 gf(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(Cf(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 vf(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 yf(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 v=h.error;d!==void 0&&(v=d,d=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))}),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}=yf(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 v=_t(t.matches,u?.route.id);l&&l[v.route.id]||(l=fe({},l,{[v.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 v=qe(h.data);t.fetchers.set(d,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 _f(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Ef(t){return Ai(t.result)&&af.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 Cf(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 xf(t){return nf.has(t.toLowerCase())}function Me(t){return tf.has(t.toLowerCase())}async function bf(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 Sf(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 Nf(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 Rf(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 wf(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 Of(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 Ur=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 Df(){return m.useContext(Wr).navigationType}function ki(t){m.useContext(zr).static||m.useLayoutEffect(t)}function Lf(){let{isDataRoute:t}=m.useContext(ut);return t?Wf():Af()}function Af(){Kr()||q(!1);let t=m.useContext(Ur),{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 Tf=m.createContext(null);function Pf(t){let e=m.useContext(ut).outlet;return e&&m.createElement(Tf.Provider,{value:t},e)}function kf(){let{matches:t}=m.useContext(ut),e=t[t.length-1];return e?e.params:{}}function If(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 Vf(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 jf(){let t=zf(),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 Mf=m.createElement(jf,null);class Hf 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 Ff(t){let{routeContext:e,match:r,children:n}=t,a=m.useContext(Ur);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 Vf(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,v=u.route.loader&&f[u.route.id]===void 0&&(!h||h[u.route.id]===void 0);if(u.route.lazy||v){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((d,u,f)=>{let h,v=!1,E=null,b=null;r&&(h=o&&u.route.id?o[u.route.id]:void 0,E=u.route.errorElement||Mf,l&&(c<0&&f===0?(Kf("route-fallback"),v=!0,b=null):c===f&&(v=!0,b=u.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,f+1)),N=()=>{let k;return h?k=E:v?k=b:u.route.Component?k=m.createElement(u.route.Component,null):u.route.element?k=u.route.element:k=d,m.createElement(Ff,{match:u,routeContext:{outlet:d,matches:C,isDataRoute:r!=null},children:k})};return r&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?m.createElement(Hf,{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 Bf(t){let e=m.useContext(Ur);return e||q(!1),e}function $f(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 zf(){var t;let e=m.useContext(Pi),r=$f(ji.UseRouteError),n=Mi();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function Wf(){let{router:t}=Bf(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 Kf(t,e,r){ps[t]||(ps[t]=!0)}function Zf(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 Yf(t){return Pf(t.context)}function Gf(t){q(!1)}function Jf(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:v="default"}=n,E=m.useMemo(()=>{let b=cr(d,l);return b==null?null:{location:{pathname:b,search:u,hash:f,state:h,key:v},navigationType:a}},[l,d,u,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!==Gf&&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 qf(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 Xf="6";try{window.__reactRouterVersion=Xf}catch{}function Qf(t,e){return cf({basename:e?.basename,future:Vr({},e?.future,{v7_prependBasename:!0}),history:Tu({window:e?.window}),hydrationData:e?.hydrationData||eh(),routes:t,mapRouteProperties:qf,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window}).initialize()}function eh(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Vr({},e,{errors:th(e.errors)})),e}function th(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 rh=m.createContext({isTransitioning:!1}),nh=m.createContext(new Map),ah="startTransition",ms=To[ah],sh="flushSync",gs=Do[sh];function ih(t){ms?ms(t):t()}function Yt(t){gs?gs(t):t()}class oh{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 lh(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(),[v,E]=m.useState(),b=m.useRef(new Map),{v7_startTransition:C}=n||{},N=m.useCallback(S=>{C?ih(S):S()},[C]),k=m.useCallback((S,$)=>{let{deletedFetchers:V,flushSync:G,viewTransitionOpts:z}=$;S.fetchers.forEach((ne,Re)=>{ne.data!==void 0&&b.current.set(Re,ne.data)}),V.forEach(ne=>b.current.delete(ne));let te=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!z||te){G?Yt(()=>s(S)):N(()=>s(S));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(S))});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:S,currentLocation:z.currentLocation,nextLocation:z.nextLocation})):(o(S),c({isTransitioning:!0,flushSync:!1,currentLocation:z.currentLocation,nextLocation:z.nextLocation}))},[r.window,f,d,b,N]);m.useLayoutEffect(()=>r.subscribe(k),[r,k]),m.useEffect(()=>{l.isTransitioning&&!l.flushSync&&u(new oh)},[l]),m.useEffect(()=>{if(d&&i&&r.window){let S=i,$=d.promise,V=r.window.document.startViewTransition(async()=>{N(()=>s(S)),await $});V.finished.finally(()=>{u(void 0),h(void 0),o(void 0),c({isTransitioning:!1})}),h(V)}},[N,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&&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,$,V)=>r.navigate(S,{state:$,preventScrollReset:V?.preventScrollReset}),replace:(S,$,V)=>r.navigate(S,{replace:!0,state:$,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(()=>Zf(n,r.future),[n,r.future]),m.createElement(m.Fragment,null,m.createElement(Ur.Provider,{value:M},m.createElement(Ti.Provider,{value:a},m.createElement(nh.Provider,{value:b.current},m.createElement(rh.Provider,{value:l},m.createElement(Jf,{basename:A,location:a.location,navigationType:a.historyAction,navigator:R,future:g},a.initialized||r.future.v7_partialHydration?m.createElement(ch,{routes:r.routes,future:r.future,state:a}):e))))),null)}const ch=m.memo(dh);function dh(t){let{routes:e,future:r,state:n}=t;return If(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 uh(){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:Fs.useEffect,useLocation:Zr,useNavigationType:Df,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 fh(){return Yn?(await Hi()).getClient()?.close():void 0}function hh(){const[t]=$n(),{analytics:e}=t;m.useEffect(()=>{if(!e){fh().catch(r=>_s.error(r));return}Yn||!ge.sentry.dsn||ge.sentry.dsn===""||uh().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"],ph={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&&ph[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function mh(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 gh(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!mh(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 vh(t,e,r){(typeof r=="function"&&r(t,e)||r===!0)&&t.preventDefault()}function yh(t,e,r){return typeof r=="function"?r(t,e):r===!0||r===void 0}function _h(t){return $i(t,["input","textarea","select"])}function $i(t,e){e===void 0&&(e=!1);var r=t.target,n=t.composed,a=null;return Eh(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 Eh(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function Ch(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 xh=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,v=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===!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?gh(c):!c},bh=m.createContext(void 0),Sh=function(){return m.useContext(bh)};function Ui(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&&Ui(t[n],e[n])},!0):t===e}var Nh=m.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Rh=function(){return m.useContext(Nh)};function wh(t){var e=m.useRef(void 0);return Ui(e.current,t)||(e.current=t),e.current}var Es=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Oh=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=wh(l),v=Rh(),E=v.enabledScopes,b=Sh();return Oh(function(){if(!(h?.enabled===!1||!Ch(E,h?.scopes))){var C=function(M,g){var S;if(g===void 0&&(g=!1),!(_h(M)&&!$i(M,h?.enableOnFormTags))){if(s!==null){var $=s.getRootNode();if(($ instanceof Document||$ instanceof ShadowRoot)&&$.activeElement!==s&&!s.contains($.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(xh(M,z,h?.ignoreModifiers)||(G=z.keys)!=null&&G.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(M)||g&&o.current)return;if(vh(M,z,h?.preventDefault),!yh(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 Dh=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"},Lh=()=>{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`},Ah=async()=>{const t=Lh();if(!t)return;const r=await(await fetch(t)).json(),{version:n}=r;return n},Th=async()=>{const t=ge.appVersion,e=await Ah();return e?{isLatest:e===t,currentVersion:t,latestVersion:e}:null};function bs(...t){window.dataLayer?.push(...t)}const Ph=()=>{const t=ge.gaTrackingId,[{analytics:e}]=$n(),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 kh(){return typeof document>"u"?"/":document.querySelector("base")?.getAttribute("href")||"/"}const Ih=["preserve-all","preserve-by-url-and-detach"],jh=()=>{const t=ge.drives.preserveStrategy;return t&&(r=>Ih.includes(r))(t)?t:"preserve-by-url-and-detach"},Mh=t=>{if(t.length===0)return{strategy:"preserve-all"};switch(jh()){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}}},Hh=t=>window.open(t,"_blank"),Fh=Hh;function Vh(){return[]}const Bh=()=>{const t=Vh();return{defaultDrives:{...el({defaultDrivesUrl:t}).defaultDrives,removeOldRemoteDrives:Mh(t)}}};function $h(t){return new Po(t)}function Uh(t,e,r){return new ko(t).withStorage(e).withCache(new Io).withQueueManager(new jo).withOptions(r).build()}async function zh(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}}function Wh(){return[]}async function Kh(t,e){const r=t.list(),n=new Set(r.map(a=>a.name));for(const a of e)try{const s=`default-drive-${a.driveId}`;if(n.has(s))continue;await t.add(s,ul("main",a.driveId),{type:"gql",parameters:{url:a.graphqlEndpoint}})}catch(s){console.error(`Failed to add default drive ${a.url}:`,s)}}const Zh=ge.routerBasename,Yh=[Zh,"service-worker.js"].join("/").replace(/\/{2,}/gm,"/");class Gh{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(Yh);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 Jh=new Gh,qh=250,Xh=({delay:t=qh})=>{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(Vo,{})}),e?_.jsx("script",{dangerouslySetInnerHTML:{__html:`setTimeout(() => {
6
- document.querySelector('.skeleton-loader')?.classList.remove('hidden');
7
- document.body.setAttribute('data-show-loader', 'true');
8
- }, ${t})`}}):null]})},Qh=()=>{const t=typeof window>"u",e=!t&&window.location.pathname===kh();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($s,{containerClassName:t||!e?"hidden home-screen":void 0,children:null}),t?_.jsx("script",{dangerouslySetInnerHTML:{__html:`
9
- const baseEl = document.querySelector('base');
10
- const href = baseEl?.getAttribute('href');
11
- const basePath = href || '/';
12
- if (window.location.pathname === basePath) {
13
- document.querySelector('.home-screen')?.classList.remove('hidden')
14
- }`}}):null,_.jsx(Xh,{})]})};function ep({children:t}){return _.jsx(_.Fragment,{children:t})}const tp=({children:t})=>(hh(),t),rp=()=>(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(()=>{Jh.registerServiceWorker(!1)},[]),_.jsx(tp,{children:_.jsx(Bo,{children:_.jsxs(ep,{children:[_.jsx($o,{position:"bottom-right",containerId:"connect"}),_.jsx(pg,{}),_.jsx(Ph,{})]})})})),np={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},ap={placeholder:"Search Powerhouse",filterLabel:"File type"},sp={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},ip={options:{switchboardLink:"Switchboard Link"}},op={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>"}},lp={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."},cp={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},dp={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"}},up={common:np,searchbar:ap,folderView:sp,files:ip,modals:op,notifications:lp,footer:cp,cookieBanner:dp},fp={en:{code:"en",name:"English",translation:up}};Ne.use(gu).init({resources:fp,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const hp=(t,e)=>t.some(r=>r.id===e&&r.value),pp=()=>{const{t}=yi(void 0,{useSuspense:!0,i18n:Ne}),[e,r]=Au(),[,n]=$n(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=o=>{r(!1),hp(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(Uo,{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(yu,{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 mp(){const[t]=Ws(),[e]=fl(),r=hl(e.header.id),n=pl(t),a=ml(t),s=gl(),i=Vn(),o=m.useCallback(()=>{vl(e).length?et({type:"exportDocumentWithErrors",documentId:e.header.id}):yl(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=_l(a,e.header.id,d);try{Fh(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(Rp,{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(zo,{...a})}const gp=m.createContext(null),hn={didCatch:!1,error:null};let vp=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&&yp(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(gp.Provider,{value:{didCatch:s,error:i,resetErrorBoundary:this.resetErrorBoundary}},o)}};function yp(){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 _p=Hn(["Connect"]);function Ep(t){return"fallbackRender"in t}function Cp(){return null}function xp({message:t="Something went wrong"}){return _.jsx("div",{className:"text-center",children:t})}function bp({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 Sp(t,e){switch(t){case"silent":return Cp;case"text":return()=>_.jsx(xp,{message:e});case"detailed":return bp;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):_p).error(o,l),r?.(o,l)},i=Ep(t)?t.fallbackRender:Sp(t.variant,t.fallbackMessage);return _.jsx(vp,{fallbackRender:i,onError:s,resetKeys:n,children:e})}function Np(){const[t]=Ws(),e=Ks(),r=Zs(t.header.meta?.preferredEditor),n=El(),a=r?.Component??n?.Component??Ho.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(Wo,{className:"flex h-full flex-col overflow-auto",children:_.jsx(a,{children:e?_.jsx(mp,{}):null})})})})}function Wi({drive:t}){const e=Cl(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 Ss({message:t}){return _.jsx("div",{className:"flex size-full items-center justify-center",children:_.jsx("h3",{className:"text-lg font-semibold",children:t})})}const Rp=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:a}=t,s=xl(),i=bl(),[o,l]=Sl(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??[],v=o?.operations.local??[],E=o?.header.revision.global??0,b=o?.header.revision.local??0,C=Nl(u),N=Rl(f),k=wl(u),R=N??k,A=!o,M=R&&u&&!R.documentTypes.includes(u)&&!R.documentTypes.includes("*"),g=E>0||b>0,S=!!o?.clipboard.length;Dh({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 te=(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(Ss,{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(!R)return _.jsx(Ss,{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=R.Component;return _.jsx("div",{className:"relative h-full",id:"document-editor-context",children:i?_.jsx(Ko,{documentTitle:d??"",documentId:c??"",globalOperations:h,localOperations:v,onClose:()=>Ol(!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:te,loggerContext:["Connect","DocumentEditor"],children:!G?.error&&_.jsx(ne,{context:{readMode:!!s,selectedTimelineRevision:Dl(s?.startDate,s?.endDate,h)},documentId:o.header.id},c)})})})},wp=m.lazy(()=>Se(()=>import("./AddDriveModal-CdO7bn3v.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}))),Op=m.lazy(()=>Se(()=>import("./ClearStorageModal-FTxWJX1x.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}))),Dp=m.lazy(()=>Se(()=>import("./CookiesPolicyModal-N2NEJZC5.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}))),Lp=m.lazy(()=>Se(()=>import("./CreateDocumentModal-CUBTy1Vr.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17])).then(t=>({default:t.CreateDocumentModal}))),Ap=m.lazy(()=>Se(()=>import("./DebugSettingsModal-DDhbtnTJ.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}))),Tp=m.lazy(()=>Se(()=>import("./DeleteDriveModal-CCys4Xug.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}))),Pp=m.lazy(()=>Se(()=>import("./DeleteItemModal-C7-lZCXg.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}))),kp=m.lazy(()=>Se(()=>import("./DisclaimerModal-B6mOULsM.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}))),Ip=m.lazy(()=>Se(()=>import("./DriveSettingsModal-DiPVKK3j.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17])).then(t=>({default:t.DriveSettingsModal}))),jp=m.lazy(()=>Se(()=>import("./ExportDocumentWithErrorsModal-Dw8uNeOX.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}))),Mp=m.lazy(()=>Se(()=>import("./SettingsModal-xfAWiRI0.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}))),Hp=m.lazy(()=>Se(()=>import("./UpgradeDriveModal-DV6zwMol.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}))),Fp=m.lazy(()=>Se(()=>import("./index-DxBII4B2.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17])).then(t=>({default:t.InspectorModal}))),Vp={addDrive:wp,clearStorage:Op,cookiesPolicy:Dp,createDocument:Lp,debugSettings:Ap,deleteDrive:Tp,deleteItem:Pp,disclaimer:kp,driveSettings:Ip,exportDocumentWithErrors:jp,inspector:Fp,settings:Mp,upgradeDrive:Hp};function Bp(){const t=Ll();if(!t?.type)return null;const e=Vp[t.type];return e?_.jsx(Yr,{variant:"silent",loggerContext:["Connect","Modals"],children:_.jsx(m.Suspense,{fallback:null,children:_.jsx(e,{})})}):null}function $p(t){return t.documentModel.global}function Up(){const{isAllowedToCreateDocuments:t}=Al(),r=Tl()?.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=$p(n),s=n.version?` v${n.version}`:"";return _.jsx(Xs,{color:"light",title:`${a.name}${s}`,"aria-description":a.description,onClick:()=>Pl(a.id),children:_.jsxs("span",{className:"text-sm",children:[a.name,s]})},`${a.id}-v${n.version??1}`)})})]}):null}const Gt=8,pn=256,Ns=48,zp=420;function Wp(){const t=m.useRef(null),r=gc().innerWidth-zp,a=Ys().filter(f=>kl(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?Ns+Gt:Ns,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 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 u=(f,h)=>{const v=d(f,h);return v?_.jsx("div",{style:{marginLeft:h===0?0:Gt},children:_.jsx(Zo,{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(Fs.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 Kp(t){const{className:e}=t,r=Ys(),n=Gs(),a=r.filter(o=>Il(o)),{isDropTarget:s,dropProps:i}=Us({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(Yo,{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(Wp,{})})})]})}const Zp={allowedDocumentTypes:[],isDragAndDropEnabled:!0};function Ki(t){jl(Zp);const{className:e,children:r}=t,{isDropTarget:n,dropProps:a}=Us(),s=!!r;return _.jsxs(Pe,{className:e,children:[!s&&_.jsx(Pe.Header,{children:_.jsx(Go,{})}),s?r:_.jsx(Pe.Content,{...a,className:n?"rounded-xl bg-blue-100":"",children:_.jsx(Kp,{})}),!s&&_.jsx(Pe.Footer,{children:_.jsx(Up,{})})]})}const Bg=Object.freeze(Object.defineProperty({__proto__:null,default:Ki},Symbol.toStringTag,{value:"Module"}));function Yp(){return{id:Ml,name:"Generic Drive Explorer",documentTypes:["powerhouse/document-drive"],Component:Ki}}function Gp(){return{id:"document-model-editor-v2",name:"Document Model Editor",documentTypes:["powerhouse/document-model"],Component:Lo}}async function Jp(){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 qp(){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 Xp(){const t=await Jp(),e=await qp(),r=Gp(),n=Yp();return{id:Hl,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]},upgradeManifests:[]}}const{externalPackagesEnabled:Qp}=ge;function em(t){return t.loadExternalPackages().then(e=>e.map(zs))}async function tm(){try{if(!Qp)return[];const t=await Se(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return em(t)}catch(t){return console.error(t),[]}}var rm=Object.defineProperty,nm=Object.defineProperties,am=Object.getOwnPropertyDescriptors,Rs=Object.getOwnPropertySymbols,sm=Object.prototype.hasOwnProperty,im=Object.prototype.propertyIsEnumerable,ws=(t,e,r)=>e in t?rm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mn=(t,e)=>{for(var r in e||(e={}))sm.call(e,r)&&ws(t,r,e[r]);if(Rs)for(var r of Rs(e))im.call(e,r)&&ws(t,r,e[r]);return t},gn=(t,e)=>nm(t,am(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())}),om=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()}},lm={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}},cm=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"}},dm=class Xi extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Xi.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},um=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"}},fm=class ao extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,ao.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},hm=class so extends ft{constructor(e,r){super(e,r),Object.setPrototypeOf(this,so.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},pm=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new cm(e);case"PARSE_ERROR":return new um(e);case"TYPE_MISMATCH":return new hm(e);case"TARGETING_KEY_MISSING":return new fm(e);case"INVALID_CONTEXT":return new dm(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||{}),mm={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"||mm[e]===t,oo=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},gm=["error","warn","info","debug"],Jn=class{constructor(t){this.fallbackLogger=new oo;try{for(const e of gm)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)}}},vm=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 ym(t){return typeof t=="string"}function Tt(t){return ym(t)?t:void 0}function _m(t){return typeof t=="object"}function Te(t){return _m(t)?t:void 0}function Os(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--}},Em=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 v=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(N=>{N?.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 N;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})}),(N=this._apiEmitter)==null||N.emit("PROVIDER_ERROR",{clientName:d,domain:d,providerName:h,message:C?.message}),C}):(b.status=this._statusEnumType.READY,v.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,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(Os).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(Os)}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)}},Cm=Object.create,qn=Object.defineProperty,xm=Object.defineProperties,bm=Object.getOwnPropertyDescriptor,Sm=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertyNames,Ds=Object.getOwnPropertySymbols,co=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty,Nm=Object.prototype.propertyIsEnumerable,Rm=Reflect.get,Ls=(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)&&Ls(t,r,e[r]);if(Ds)for(var r of Ds(e))Nm.call(e,r)&&Ls(t,r,e[r]);return t},wm=(t,e)=>xm(t,Sm(e)),Om=(t,e)=>function(){return e||(0,t[lo(t)[0]])((e={exports:{}}).exports,e),e.exports},Dm=(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=bm(e,a))||n.enumerable});return t},Lm=(t,e,r)=>(r=t!=null?Cm(co(t)):{},Dm(qn(r,"default",{value:t,enumerable:!0}),t)),Am=(t,e,r)=>Rm(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())}),Tm=Om({"../../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 v=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],v]:c._events[E].push(v):(c._events[E]=v,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,v=f.length,E=new Array(v);h<v;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,v,E){var b=n?n+d:d;if(!this._events[b])return!1;var C=this._events[b],N=arguments.length,k,R;if(C.fn){switch(C.once&&this.removeListener(d,C.fn,void 0,!0),N){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,v),!0;case 6:return C.fn.call(C.context,u,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(d,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,u);break;case 3:C[R].fn.call(C[R].context,u,f);break;case 4:C[R].fn.call(C[R].context,u,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(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 v=n?n+d:d;if(!this._events[v])return this;if(!u)return o(this,v),this;var E=this._events[v];if(E.fn)E.fn===u&&(!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!==u||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(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)}}),Pm="No-op",km=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:Pm}}},As=new km,Im=Lm(Tm()),Ts=class extends vm{constructor(){super(),this.eventEmitter=new Im.default}},jm=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 om}));let u;try{this.beforeHooks(o,d,a),this.shortCircuitIfNotReady();const f=e.call(this._provider,t,r,c,this._logger),h=wm(vn({},f),{flagMetadata:Object.freeze((i=f.flagMetadata)!=null?i:{}),flagKey:t});if(h.errorCode){const v=pm(h.errorCode,h.errorMessage);this.errorHooks(l,d,v,a),u=this.getErrorEvaluationDetails(t,r,v,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:lm.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},Ps=Symbol.for("@openfeature/web-sdk/api"),ks=globalThis,Mm=class jn extends Em{constructor(){super("client"),this._statusEnumType=sr,this._apiEmitter=new Ts,this._defaultProvider=new In(As,sr.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new Ts}static getInstance(){const e=ks[Ps];if(e)return e;const r=new jn;return ks[Ps]=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 jm(()=>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 Am(jn.prototype,this,"clearProvidersAndSetDefault").call(this,As),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,v=`Error running ${u}'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:u,message:v})}),(d=this._apiEmitter)==null||d.emit(ze.Error,{clientName:e,domain:e,providerName:u,message:v})}}})}},Is=Mm.getInstance();class Hm{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 Fm(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new Hm(e);await Is.setProviderAndWait(r);const n=new Map,a=Is.getClient();n.set(js,a.getBooleanValue(js,Vm)),n.set(Ms,a.getBooleanValue(Ms,Bm)),n.set(Hs,a.getBooleanValue(Hs,$m));const i=e.has(yn)?a.getBooleanValue(yn,Um):ge.content.inspectorEnabled;n.set(yn,i);const o=e.get("LOG_LEVEL");if(o){const l=["verbose","debug","info","warn","error"];l.includes(o.toLowerCase())?(Vs(o.toLowerCase()),Q.info(`Log level set to ${o.toLowerCase()} via query param`)):Q.warn(`Invalid LOG_LEVEL query param: ${o}. Valid values: ${l.join(", ")}`)}return n}const js="FEATURE_LEGACY_READ_ENABLED",Vm=!1,Ms="FEATURE_LEGACY_WRITE_ENABLED",Bm=!1,Hs="FEATURE_CHANNEL_SYNC_ENABLED",$m=!0,yn="FEATURE_INSPECTOR_ENABLED",Um=!1;let Mn;function zm(t){Mn=t}async function $g(){await Mn?.clear();const t=window.ph?.reactorClientModule?.pg;return t&&await cc(t),!!Mn}async function Wm(t){const e=await Xp(),r=[e,...t];return Fn([e,...t]),r}function Km(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 Zm(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){Q.error("Error adding remote drive",a)}}async function Ym(){if(window.ph||(window.ph={}),window.ph.legacyReactor||window.ph.loading)return;window.ph.loading=!0,Fl(),Vl(or);const t=await Fm();Q.info(`Features: ${JSON.stringify(Object.fromEntries(t),null,2)}`);const e=await Bl(),r=await e.did(),n=$l(r,kt.routerBasename),a=$h(kt.routerBasename);zm(a);const s=await tm(),i=await Wm(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=Km(o),d=t.get("FEATURE_LEGACY_READ_ENABLED")??!0,u={featureFlags:{enableDualActionCreate:!0}};if(d){const g=Bh();Object.assign(u,g)}const f=Uh(c,a,u),h=await zh(o,l,a,e);if(!d){const g=Wh();if(g.length>0){const S=h.reactorModule?.syncModule?.syncManager;S&&await Kh(S,g)}}await Ul(f,n,e);const v=new Mo(f.listeners,f);let E=await ua(f);const b=Jm(),C=b?await Zm(b,f,E):void 0;C&&(E=await ua(f));const N=window.location.pathname,k=C?.header.slug??zl(N),R=C?"":Wl(N),A=Gm();await Kl(A,f,n,e);const M=d?new Zl(f):new Yl(h.client);Gl(kt),Jl(f),ql(h),Xl(h.client),Ql(h.reactorModule?.syncModule?.syncManager),ec(h.reactorModule?.database),tc(h.pg),rc(M),nc(e),ac(r),sc(n),ic(v),oc(E),Fn(i),Rr(k),_n(R),lc(t),d?(f.on("defaultRemoteDrive",(...g)=>{Q.verbose("defaultRemoteDrive",...g),Rt(f).catch(Q.error)}),f.on("clientStrandsError",(...g)=>{Q.verbose("clientStrandsError",...g),Rt(f).catch(Q.error)}),f.on("driveAdded",(...g)=>{Q.verbose("driveAdded",...g),v.registerDrive(g[0].header.id).catch(Q.error),Rt(f).catch(Q.error)}),f.on("driveDeleted",(...g)=>{Q.verbose("driveDeleted",...g),Rt(f).catch(Q.error)}),f.on("documentModelModules",(...g)=>{Q.verbose("documentModelModules",...g),Rt(f).catch(Q.error)}),f.on("driveOperationsAdded",(...g)=>{Q.verbose("driveOperationsAdded",...g),Rt(f).catch(Q.error)})):(f.on("defaultRemoteDrive",(...S)=>{Q.verbose("future:defaultRemoteDrive",...S),yt(h.client).catch(Q.error)}),f.on("clientStrandsError",(...S)=>{Q.verbose("future:clientStrandsError",...S),yt(h.client).catch(Q.error)}),f.on("driveAdded",(...S)=>{Q.verbose("future:driveAdded",...S),v.registerDrive(S[0].header.id).catch(Q.error),yt(h.client).catch(Q.error)}),f.on("driveDeleted",(...S)=>{Q.verbose("future:driveDeleted",...S),yt(h.client).catch(Q.error)}),f.on("documentModelModules",(...S)=>{Q.verbose("future:documentModelModules",...S),yt(h.client).catch(Q.error)}),f.on("driveOperationsAdded",(...S)=>{Q.verbose("future:driveOperationsAdded",...S),yt(h.client).catch(Q.error)}),h.client.subscribe({type:"powerhouse/document-drive"},S=>{Q.verbose("ReactorClient subscription event",S),yt(h.client).catch(Q.error)})),window.ph.loading=!1}function Gm(){const e=new URLSearchParams(window.location.search).get("user");return e?decodeURIComponent(e):void 0}function Jm(){const e=new URLSearchParams(window.location.search).get("driveUrl");return e?decodeURIComponent(e):void 0}function qm(){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 Xm(){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(mg,{}),_.jsx("div",{className:"relative flex-1 overflow-auto",children:_.jsx(Yf,{})})]})})})}function Qm(){const[t]=Js(),e=Gs(),r=Ks();m.useEffect(()=>{r||dc(vd)},[r]),m.useEffect(()=>{t||uc(yd)},[t]);const n=!r&&!t&&!e;return _.jsx(eg,{children:n?_.jsx(rg,{}):_.jsx(Np,{})})}function eg({children:t}){return _.jsx("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:t})}function tg({drive:t}){const r=Zs(t.header.meta?.preferredEditor)?.name||"Drive Explorer App";return _.jsx(qo,{title:t.state.global.name,description:r,icon:_.jsx(Wi,{drive:t}),onClick:()=>Rr(t)},t.header.id)}function rg(){const t=qs(),e=ge;return _.jsxs($s,{children:[t?.map(r=>_.jsx(tg,{drive:r},r.header.id)),e.drives.addDriveEnabled&&_.jsx(Jo,{})]})}const ng=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"})))),ag=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"})),sg="https://apps.powerhouse.io/sky-atlas/staging/switchboard",ig=2e3;function og(){const{search:t}=Zr();return m.useMemo(()=>{const r=new URLSearchParams(t).get("reactorUrl")??sg;return r.endsWith("/")?r:`${r}/`},[t])}async function lg(t,e){const r=Ec`
15
- mutation ForkAtlas($docId: PHID) {
16
- ForkAtlas(docId: $docId)
17
- }
18
- `;return await Cc(`${e}graphql`,r,{docId:t})}function cg(){const t=m.useRef("initial"),e=fc(),{documentId:r}=kf(),n=og(),a=Lf(),[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 lg(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(()=>{d(!1)},ig)}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(()=>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(ng,{})}),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(ag,{className:"animate-spin"}),"Loading"]}):"Continue"})]})})]})})}function dg(t){const e=ge.routerBasename;return Qf(t,{basename:e,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function ug(){const t=[{index:!0,path:"d?/:driveId?/*?",element:_.jsx(m.Suspense,{name:"Drive",children:_.jsx(Qm,{})})},{path:"import/:documentId",element:_.jsx(m.Suspense,{name:"AtlasImport",children:_.jsx(cg,{})})}];return[{element:_.jsx(m.Suspense,{name:"RouteRoot",children:_.jsx(Xm,{})}),children:t}]}const fg=ug(),hg=dg(fg),pg=()=>_.jsx(lh,{router:hg});function mg(){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(Xo,{title:c.header.name,onClick:()=>Rr(c),active:r?.header.id===c.header.id,icon:_.jsx(Wi,{drive:c})},d)),ge.drives.addDriveEnabled&&_.jsx(Qo,{onClick:i})]})})}const gg=m.lazy(async()=>(await Ym(),{default:({children:t})=>(Sd(),qm(),Ru(),t)})),vg=()=>_.jsxs(m.StrictMode,{children:[_.jsx(m.Suspense,{fallback:_.jsx(Qh,{}),name:"AppLoader",children:_.jsx(gg,{children:_.jsx(rp,{})})}),_.jsx(m.Suspense,{name:"CookieBanner",children:_.jsx(pp,{})}),_.jsx(Bp,{})]});Rc.createRoot(document.getElementById("root")).render(_.jsx(vg,{}));export{yu as T,Fg as a,ge as b,$g as c,Mg as d,Bg as e,Hg as r,Jh as s,or as t,yi as u};